@nabeeltahirdeveloper/chart-sdk 2.3.24-beta → 2.3.25-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart-sdk.es.js +13273 -11728
- package/dist/chart-sdk.umd.js +20 -20
- package/package.json +1 -1
package/dist/chart-sdk.umd.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(function(je,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(je=typeof globalThis<"u"?globalThis:je||self,a(je.ChartSDK={},je.jsxRuntime,je.React))})(this,(function(je,a,q){"use strict";var $s=typeof document<"u"?document.currentScript:null;const $t="17:00-17:00",Xt="America/New_York",IA="24x7",_A="UTC",ml={EURUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},ETHUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},BNBUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},SOLUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},ADAUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},XRPUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},DOGEUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},DOTUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},MATICUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"},LINKUSDT:{type:"crypto",session:IA,sessionTZ:_A,priceMode:"last"}},gl={type:"forex",sessionTZ:Xt,session:$t,priceMode:"mid"};function rr(i){return i&&ml[i.toUpperCase()]||gl}function en(i){return rr(i).type==="forex"}function tn(i){return rr(i).type==="crypto"}function Zd(i){return rr(i).session==="24x7"}function te(i){if(i==null)return null;if(typeof i=="number"){if(Number.isNaN(i)||!Number.isFinite(i))return null;let e;i>1e10?e=i/1e3:(i<1e9,e=i);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof i=="string"){const e=Date.parse(i);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof i=="object"&&"year"in i&&"month"in i&&"day"in i){const t=new Date(Date.UTC(i.year,i.month-1,i.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Yd(i,e){if(!i||i.length<2)return[];const t=[],A=2;for(let r=1;r<i.length;r++){const n=i[r-1].time,s=i[r].time,o=s-n;o>e*A&&t.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 t}function qd(i,e="America/New_York"){const t=new Date(i*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),r=A.getDay();return!(r===0||r===6||r===5&&A.getHours()>=17)}function wl(i){return Array.isArray(i)?i.map(e=>({...e,time:te(e.time)})).filter(e=>e.time!=null):[]}function jd(i){if(!i||i.length<2)return!0;for(let e=1;e<i.length;e++)if(i[e].time<=i[e-1].time)return!1;return!0}function Ve(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function Bl(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(te(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<r||r>t||r>n||r>A||t<=0||A<=0||r<=0||n<=0)}function yl(i){const e=s=>Math.round(s*1e5)/1e5;let t=e(i.open),A=e(i.high),r=e(i.low),n=e(i.close);return A=Math.max(A,t,n,r),r=Math.min(r,t,n,A),{...i,open:t,high:A,low:r,close:n,volume:i.volume!=null?Math.round(i.volume):i.volume}}function Cl(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=te(t.time);if(A!=null)if(e.has(A)){const r=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function ef(i,e){if(!Array.isArray(i)||i.length===0)return i;const t=[],A=Math.max(e*10080,604800),r=1e4;for(let o=0;o<i.length;o++)if(t.push(i[o]),o<i.length-1){const l=i[o].time,c=i[o+1].time,h=c-l;if(h>A&&((h/3600).toFixed(1),(A/3600).toFixed(1)),h>e&&h<=A){const g=i[o];let v=l+e,x=0;for(v=Ve(v,e);v<c&&x<r;){const F=Ve(v,e);t.some(S=>S.time===F)||(t.push({time:F,open:g.close,high:g.close,low:g.close,close:g.close,volume:0}),x++),v+=e}if(v<c&&x>=r){const F=Ve(c-e,e);t.some(S=>S.time===F)||t.push({time:F,open:g.close,high:g.close,low:g.close,close:g.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function pA(i){if(!i||typeof i!="string")return 60;const e=i.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const A=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[A]||60)}if(t=i.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),r=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function vl(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=rr(e),r=pA(t),o=wl(i).map(Q=>({...Q,time:Ve(Q.time,r)})).filter(Q=>Bl(Q)).map(Q=>yl(Q)),l=Cl(o);l.sort((Q,N)=>Q.time-N.time);const c=Math.floor(Date.now()/1e3),h=l.filter(Q=>Q.time<=c),v=h.filter((Q,N)=>N===0?!0:Q.time>h[N-1].time),x=Cl(v);x.sort((Q,N)=>Q.time-N.time);const F=ef(x,r),T=[];for(let Q=1;Q<F.length;Q++){const N=F[Q].time-F[Q-1].time;N>r*2&&T.push({from:F[Q-1].time,to:F[Q].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(F[Q-1].time*1e3).toISOString(),toDate:new Date(F[Q].time*1e3).toISOString()})}const S=v.filter((Q,N)=>N===0?!1:Q.close===v[N-1].close&&Q.open===v[N-1].close).length,I={original:i.length,processed:F.length,duplicates:i.length-l.length,outliers:S,gaps:T,filledGaps:F.length-x.length,symbolConfig:A};return{candles:F,stats:I}}function Tl(i,e,t="1m"){if(!i||!e||!Bl(i))return null;const A=te(i.time);if(A==null)return null;const r=pA(t),n=Ve(A,r);return yl({...i,time:n})}function bl(i,e=20,t=2){if(!i||i.length<e)return null;const A=[],r=[],n=[];for(let s=e-1;s<i.length;s++){let o=0;for(let v=s-e+1;v<=s;v++)o+=i[v].close;const l=o/e;let c=0;for(let v=s-e+1;v<=s;v++){const x=i[v].close-l;c+=x*x}const h=Math.sqrt(c/e),g=i[s].time;r.push({time:g,value:l}),A.push({time:g,value:l+t*h}),n.push({time:g,value:l-t*h})}return{upper:A,middle:r,lower:n}}function Xs(i,e=20,t=2){if(!i||i.length<e)return null;const A=i.slice(-e);let r=0;for(let c=0;c<A.length;c++)r+=A[c].close;const n=r/e;let s=0;for(let c=0;c<A.length;c++){const h=A[c].close-n;s+=h*h}const o=Math.sqrt(s/e);return{time:i[i.length-1].time,upper:n+t*o,middle:n,lower:n-t*o}}function bt(i){var e=i.width,t=i.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(t<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:t}}function gi(i,e){return i.width===e.width&&i.height===e.height}var tf=(function(){function i(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return i.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(i.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),i.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==A})}}},i.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)},i.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},i.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},i.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},i})();function Af(i){return new tf(i)}var rf=(function(){function i(e,t,A){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=bt({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=A?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return i.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)===null||t===void 0||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(i.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"bitmapSize",{get:function(){return bt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=bt(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},i.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(i.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),i.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},i.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},i.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},i.prototype._resizeBitmap=function(e){var t=this.bitmapSize;gi(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},i.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=bt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=gi(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&gi(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},i.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(A,e,t)})},i.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}sf().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=xl(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Af(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=xl(this._canvasElement);if(A!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:A.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?of(n[0],r):bt({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},i.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var r=A.devicePixelContentBoxSize[0],n=bt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function nf(i,e){return new rf(i,e.transform,e.options)}function xl(i){return i.ownerDocument.defaultView}function sf(){return new Promise(function(i){var e=new ResizeObserver(function(t){i(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function of(i,e){return bt({width:Math.round(i.left*e+i.width*e)-Math.round(i.left*e),height:Math.round(i.top*e+i.height*e)-Math.round(i.top*e)})}var af=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.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()}},i.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(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function wi(i,e){var t=i.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=i.bitmapSize;if(A.width===0||A.height===0)return null;var r=i.canvasElement.getContext("2d",e);return r===null?null:new af(r,t,A)}const lf={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},cf={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},hf={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},uf={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},pf={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},df={color:"#26a69a",base:0},Ql={color:"#2196f3"},Fl={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 Ul,Sl;function Bi(i,e){const t={0:[],1:[i.lineWidth,i.lineWidth],2:[2*i.lineWidth,2*i.lineWidth],3:[6*i.lineWidth,6*i.lineWidth],4:[i.lineWidth,4*i.lineWidth]}[e];i.setLineDash(t)}function El(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ii(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function Di(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Ul||(Ul={})),(function(i){i[i.Solid=0]="Solid",i[i.Dotted=1]="Dotted",i[i.Dashed=2]="Dashed",i[i.LargeDashed=3]="LargeDashed",i[i.SparseDotted=4]="SparseDotted"})(Sl||(Sl={}));const Ll={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 mA(i){return i<0?0:i>255?255:Math.round(i)||0}function Ml(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const ff=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,mf=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,gf=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,wf=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function nr(i){(i=i.toLowerCase())in Ll&&(i=Ll[i]);{const e=wf.exec(i)||gf.exec(i);if(e)return[mA(parseInt(e[1],10)),mA(parseInt(e[2],10)),mA(parseInt(e[3],10)),Ml(e.length<5?1:parseFloat(e[4]))]}{const e=mf.exec(i);if(e)return[mA(parseInt(e[1],16)),mA(parseInt(e[2],16)),mA(parseInt(e[3],16)),1]}{const e=ff.exec(i);if(e)return[mA(17*parseInt(e[1],16)),mA(17*parseInt(e[2],16)),mA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function Hl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function An(i){const e=nr(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Hl(e)>160?"black":"white"}}class Mt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function QA(i,...e){for(const t of e)for(const A in t)t[A]!==void 0&&Object.prototype.hasOwnProperty.call(t,A)&&!["__proto__","constructor","prototype"].includes(A)&&(typeof t[A]!="object"||i[A]===void 0||Array.isArray(t[A])?i[A]=t[A]:QA(i[A],t[A]));return i}function DA(i){return typeof i=="number"&&isFinite(i)}function sr(i){return typeof i=="number"&&i%1==0}function or(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function JA(i){const e=i;if(!e||typeof e!="object")return e;let t,A,r;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(r=e[A],t[A]=r&&typeof r=="object"?JA(r):r);return t}function Bf(i){return i!==null}function ar(i){return i===null?void 0:i}const Js="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Pi(i,e,t){return e===void 0&&(e=Js),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class yf{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,t=this.j(),A=this.H();return e.P===t&&e.D===A||(e.P=t,e.D=A,e.R=Pi(t,A),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/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 Zs{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class FA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class Cf extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const h=n.it[c],g=Math.round(h.nt*t)+s,v=h.st*A,x=l*A+s;e.moveTo(g,v),e.arc(g,v,x,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 vf(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Tf={from:0,to:1};class bf{constructor(e,t){this.ut=new Zs,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(vf),this.ct=this.dt.map((A=>{const r=new Cf;return r.J(A),r})),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,t=this.F.wt(),A=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(l.tt=null);const h=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,h.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=A,l.it[0].nt=r.It(A),l.tt=Tf}))}}let xf=class extends FA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){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*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,Bi(e,this.zt.Lt.Nt),(function(c,h,g,v){c.beginPath();const x=c.lineWidth%2?.5:0;c.moveTo(h+x,g),c.lineTo(h+x,v),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,Bi(e,this.zt.Et.Nt),El(e,l,0,t.width))}};class Qf{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 xf(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(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function Ff(i,e,t,A,r,n){i.fillRect(e+n,t,A-2*n,n),i.fillRect(e+n,t+r-n,A-2*n,n),i.fillRect(e,t,n,r),i.fillRect(e+A-n,t,n,r)}function nn(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function Il(i,e,t,A,r,n){i.beginPath(),i.roundRect?i.roundRect(e,t,A,r,n):(i.lineTo(e+A-n[1],t),n[1]!==0&&i.arcTo(e+A,t,e+A,t+n[1],n[1]),i.lineTo(e+A,t+r-n[2]),n[2]!==0&&i.arcTo(e+A,t+r,e+A-n[2],t+r,n[2]),i.lineTo(e+n[3],t+r),n[3]!==0&&i.arcTo(e,t+r,e,t+r-n[3],n[3]),i.lineTo(e,t+n[0]),n[0]!==0&&i.arcTo(e,t,e+n[0],t,n[0]))}function _l(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return Il(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var h;Il(i,e+c,t+c,A-s,r-s,(h=-c,o.map((g=>g===0?g:g+h)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function Dl(i,e,t,A,r,n,s){i.save(),i.globalCompositeOperation="copy";const o=i.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),i.fillStyle=o,i.fillRect(e,t,A,r),i.restore()}class Pl{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,A,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const h=this.Gt(l,t,A,r),g=h.Jt;return h.Qt?_l(c,g.ti,g.ii,g.ni,g.si,s,g.ei,[g.ht,0,0,g.ht],s):_l(c,g.ri,g.ii,g.ni,g.si,s,g.ei,[0,g.ht,g.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(g.ri,g.li,g.ai-g.ri,g.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?g.ui-g.ei:0,g.ii,g.ei,g.ci-g.ii)),h}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:h}=e,g=this.zt.hi||!this.zt.mi?t.T:0,v=this.zt.bi?t.C:0,x=t.L+this.Xt.wi,F=t.B+this.Xt.gi,T=t.A,S=t.I,I=this.zt.Kt,Q=t.P,N=A.Mi(s,I),X=Math.ceil(A.xi(s,I)),H=Q+x+F,V=t.C+T+S+X+g,ne=Math.max(1,Math.floor(h));let Z=Math.round(H*h);Z%2!=ne%2&&(Z+=1);const re=v>0?Math.max(1,Math.floor(v*c)):0,R=Math.round(V*c),oe=Math.round(g*c),le=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,ee=Math.round(le*h)-Math.floor(.5*h),fe=Math.floor(ee+ne/2-Z/2),j=fe+Z,se=r==="right",Ae=se?l.width-v:v,ue=se?o.width-re:re;let ae,Be,be;return se?(ae=ue-R,Be=ue-oe,be=Ae-g-T-v):(ae=ue+R,Be=ue+oe,be=Ae+g+T),{Qt:se,Jt:{ii:fe,li:ee,ci:j,ni:R,si:Z,ht:2*c,ei:re,ti:ae,ri:ue,ai:Be,oi:ne,ui:o.width},di:{ii:fe/h,ci:j/h,fi:be,pi:N}}}}class sn{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||Pl)(this.Ci,this.yi),this.Ri=new(e||Pl)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,t=!1){return Math.max(this.Pi.At(e,t),this.Ri.At(e,t))}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 Uf extends sn{constructor(e,t,A){super(),this.jt=e,this.Li=t,this.Ei=A}zi(e,t,A){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=An(r.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const l=this.Ei(this.Li);A.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const Sf=/[1-9]/g;class kl{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const A=e.useMediaCoordinateSpace((({context:v})=>(v.font=t.R,Math.round(t.Wi.xi(v,Se(this.zt).Kt,Sf)))));if(A<=0)return;const r=t.ji,n=A+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const h=c+n,g=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:v,horizontalPixelRatio:x,verticalPixelRatio:F})=>{const T=Se(this.zt);v.fillStyle=T.t;const S=Math.round(c*x),I=Math.round(0*F),Q=Math.round(h*x),N=Math.round(g*F),X=Math.round(2*x);if(v.beginPath(),v.moveTo(S,I),v.lineTo(S,N-X),v.arcTo(S,N,S+X,N,X),v.lineTo(Q-X,N),v.arcTo(Q,N,Q,N-X,X),v.lineTo(Q,I),v.fill(),T.hi){const H=Math.round(T.ki*x),V=I,ne=Math.round((V+t.T)*F);v.fillStyle=T.V;const Z=Math.max(1,Math.floor(x)),re=Math.floor(.5*x);v.fillRect(H-re,V,Z,ne-V)}})),e.useMediaCoordinateSpace((({context:v})=>{const x=Se(this.zt),F=0+t.C+t.T+t.L+t.P/2;v.font=t.R,v.textAlign="left",v.textBaseline="middle",v.fillStyle=x.V;const T=t.Wi.Mi(v,"Apr0");v.translate(c+r,F+T),v.fillText(x.Kt,0,0)}))}}class Ef{constructor(e,t,A){this.ft=!0,this.Wt=new kl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}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 t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ys{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 Nl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(Nl||(Nl={}));class Lf extends Ys{constructor(e,t){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=t,this.dn=new bf(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new Ef(this,e,A),this.wn=new Qf(this)}W(){return this.cn}gn(e,t){this._n=e,this.un=t}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,t,A){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,A)}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,t){this.en&&this.tn===e||this.rn.clear();const A=[];return this.tn===e&&A.push(this.Dn(this.rn,t,this.fn)),A}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,t,A){this.Bn(e,t,A)&&this.Vn()}Bn(e,t,A){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(Bf),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let r=e.get(t);return r===void 0&&(r=new Uf(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Kt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.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 t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Kt(2)}static es(){return new Kt(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((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Ol=".";function ZA(i,e){if(!DA(i))return"n/a";if(!sr(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),DA(e)&&sr(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+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 t=this.Li/this.rs;let A=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-A*t).toFixed(this._s);s>=t&&(s-=t,A+=1),r=Ol+ZA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Ol+ZA(0,n));return A.toFixed(0)+r}}class Kl extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Mf{constructor(e){this.us=e}format(e){let t="";return e<0&&(t="-",e=-e),e<995?t+this.cs(e):e<999995?t+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),t+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),t+this.cs(e/1e9)+"B")}cs(e){let t;const A=Math.pow(10,this.us);return t=(e=Math.round(e*A)/A)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Vl(i,e,t,A,r,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=i,h=e[A.from];let g=n(i,h),v=h;if(A.to-A.from<2){const x=r/2;o.beginPath();const F={nt:h.nt-x,st:h.st},T={nt:h.nt+x,st:h.st};o.moveTo(F.nt*l,F.st*c),o.lineTo(T.nt*l,T.st*c),s(i,g,F,T)}else{const x=(T,S)=>{s(i,g,v,S),o.beginPath(),g=T,v=S};let F=v;o.beginPath(),o.moveTo(h.nt*l,h.st*c);for(let T=A.from+1;T<A.to;++T){F=e[T];const S=n(i,F);switch(t){case 0:o.lineTo(F.nt*l,F.st*c);break;case 1:o.lineTo(F.nt*l,e[T-1].st*c),S!==g&&(x(S,F),o.lineTo(F.nt*l,e[T-1].st*c)),o.lineTo(F.nt*l,F.st*c);break;case 2:{const[I,Q]=Hf(e,T-1,T);o.bezierCurveTo(I.nt*l,I.st*c,Q.nt*l,Q.st*c,F.nt*l,F.st*c);break}}t!==1&&S!==g&&(x(S,F),o.moveTo(F.nt*l,F.st*c))}(v!==F||v===F&&t===1)&&s(i,g,v,F)}}const zl=6;function qs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Wl(i,e){return{nt:i.nt/e,st:i.st/e}}function Hf(i,e,t){const A=Math.max(0,e-1),r=Math.min(i.length-1,t+1);var n,s;return[(n=i[e],s=Wl(qs(i[t],i[A]),zl),{nt:n.nt+s.nt,st:n.st+s.st}),qs(i[t],Wl(qs(i[r],i[e]),zl))]}function If(i,e,t,A,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,i*o),n.lineTo(A.nt*s,i*o),n.closePath(),n.fillStyle=t,n.fill()}class Rl extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,Bi(h,o),h.lineWidth=1,Vl(e,A,l,r,n,this.bs.bind(this),If.bind(null,c))}}function js(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Gl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class eo{ws(e,t){const A=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==r||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==l){const h=e.context.createLinearGradient(0,0,0,l);if(h.addColorStop(0,r),c!=null){const g=js(c*e.verticalPixelRatio/l,0,1);h.addColorStop(g,n),h.addColorStop(g,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class _f extends Rl{constructor(){super(...arguments),this.Ts=new eo}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Df(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class $l extends FA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,Bi(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&Vl(e,t,n,A,r,h,Df),l&&(function(g,v,x,F,T){const{horizontalPixelRatio:S,verticalPixelRatio:I,context:Q}=g;let N=null;const X=Math.max(1,Math.floor(S))%2/2,H=x*I+X;for(let V=F.to-1;V>=F.from;--V){const ne=v[V];if(ne){const Z=T(g,ne);Z!==N&&(Q.beginPath(),N!==null&&Q.fill(),Q.fillStyle=Z,N=Z);const re=Math.round(ne.nt*S)+X,R=ne.st*I;Q.moveTo(re,R),Q.arc(re,R,H,0,2*Math.PI)}}Q.fill()})(e,t,l,A,h)}}class Xl extends $l{Vs(e,t){return t.lt}}function Jl(i,e,t,A,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;A(e[l],t)===i?(r=l+1,s-=o+1):s=o}return r}const lr=Jl.bind(null,!0),Zl=Jl.bind(null,!1);function Pf(i,e){return i.ot<e}function kf(i,e){return e<i.ot}function Yl(i,e,t){const A=e.Os(),r=e.ui(),n=lr(i,A,Pf),s=Zl(i,r,kf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<i.length&&i[n].ot>=A&&(o=n-1),s>0&&s<i.length&&i[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class to{constructor(e,t,A){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=A}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(),t=this.Ns.St();if(this.qs(),t.Ni()||e.Ni())return;const A=t.Xs();if(A===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=Yl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends to{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,ar(this.Ls)),e.te(this.zs,A,ar(this.Ls))}ie(e,t){return{ot:e,_t:t,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>{const A=t.Vt[3];return this.se(t.ee,A,e)}))}}class Nf extends cn{constructor(e,t){super(e,t),this.js=new Zs,this.re=new _f,this.he=new Xl,this.js.Z([this.re,this.he])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$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 Of extends FA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),h=c-l,g=this.oe,v=h+g-1,x=Math.min(o.de,o.fe),F=Math.max(o.de,o.fe),T=Math.round(x*A)-l,S=Math.round(F*A)+l,I=Math.max(S-T,this.oe);e.fillRect(h,T,g,I);const Q=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const V=c-Q;let ne=Math.max(T,Math.round(o.pe*A)-l),Z=ne+g-1;Z>T+I-1&&(Z=T+I-1,ne=Z-g+1),e.fillRect(V,ne,h-V,Z-ne+1)}const N=c+Q;let X=Math.max(T,Math.round(o.me*A)-l),H=X+g-1;H>T+I-1&&(H=T+I-1,X=H-g+1),e.fillRect(v+1,X,N-v,H-X+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Se(this.zt).le,e)))}}class ql extends to{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,ar(this.Ls)),e.be(this.zs,A,ar(this.Ls))}we(e,t,A){return{ot:e,ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.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((t=>this.se(t.ee,t,e)))}}class Kf extends ql{constructor(){super(...arguments),this.js=new Of}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$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 Vf extends Rl{constructor(){super(...arguments),this.Ts=new eo}bs(e,t){const A=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:A.vs})}}class zf extends $l{constructor(){super(...arguments),this.Pe=new eo}Vs(e,t){const A=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:A.vs})}}class Wf extends cn{constructor(e,t){super(e,t),this.js=new Zs,this.Ve=new Vf,this.Oe=new zf,this.js.Z([this.Ve,this.Oe])}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),A=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:A,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:A,tt:this.Ls,ds:r})}}class Rf extends FA{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:t}=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),c=Math.floor(n*s),h=Math.min(l,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:r,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 c=Math.floor(.5*l);let h=null;for(let g=A.from;g<A.to;g++){const v=t[g];v.Ee!==o&&(r.fillStyle=v.Ee,o=v.Ee);const x=Math.round(Math.min(v.pe,v.me)*s),F=Math.round(Math.max(v.pe,v.me)*s),T=Math.round(v.de*s),S=Math.round(v.fe*s);let I=Math.round(n*v.nt)-c;const Q=I+l-1;h!==null&&(I=Math.max(h+1,I),I=Math.min(I,Q));const N=Q-I+1;r.fillRect(I,T,N,x-T),r.fillRect(I,F+1,N,S-F),h=Q}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const A=Math.max(Math.floor(e),t);return this.ae<=2*A?Math.max(Math.floor(e),Math.floor(1*e)):A}Ie(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let h=A.from;h<A.to;h++){const g=t[h];g.Ne!==o&&(r.fillStyle=g.Ne,o=g.Ne);let v=Math.round(g.nt*n)-Math.floor(.5*this.ae);const x=v+this.ae-1,F=Math.round(Math.min(g.pe,g.me)*s),T=Math.round(Math.max(g.pe,g.me)*s);if(c!==null&&(v=Math.max(c+1,v),v=Math.min(v,x)),this.zt.le*n>2*l)Ff(r,v,F,x-v+1,T-F+1,l);else{const S=x-v+1;r.fillRect(v,F,S,T-F+1)}c=x}}Le(e,t,A){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=A.from;c<A.to;c++){const h=t[c];let g=Math.round(Math.min(h.pe,h.me)*s),v=Math.round(Math.max(h.pe,h.me)*s),x=Math.round(h.nt*n)-Math.floor(.5*this.ae),F=x+this.ae-1;if(h.ce!==o){const T=h.ce;r.fillStyle=T,o=T}this.zt._i&&(x+=l,g+=l,F-=l,v-=l),g>v||r.fillRect(x,g,F-x+1,v-g+1)}}}class Gf extends ql{constructor(){super(...arguments),this.js=new Rf}se(e,t,A){return Object.assign(Object.assign({},this.we(e,t,A)),A.$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 $f{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Ao extends to{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new $f(this.wn.renderer(),(r=>{const n=e.Ct();return n===null?null:e.Dt().Rt(r,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((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,ar(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Xf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Xf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class Jf extends FA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],h=Math.round(l.st*A);let g,v;e.fillStyle=l.ce,h<=n?(g=h,v=s):(g=n,v=h-Math.floor(r/2)+r),e.fillRect(c.Os,g,c.ui-c.Os+1,v-g)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),A=Math.round(this.zt.le*e)-t;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,c;if(A%2){const h=(A-1)/2;l=o-h,c=o+h}else{const h=A/2;l=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,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!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=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;r=Math.min(o,r)}if(t>0&&r<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>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class Zf extends cn{constructor(){super(...arguments),this.js=new Jf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$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,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Yf extends cn{constructor(){super(...arguments),this.js=new Xl}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e=this.Es.W(),t={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(t)}}const qf=/[2-9]/g;class cr{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,t,A){return this.sr(e,t,A).width}Mi(e,t,A){const r=this.sr(e,t,A);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,A){const r=A||qf,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(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&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class jf{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,A){this.hr=e,this.k=t,this.lr=A}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class jl{constructor(e,t,A){this.ur=e,this.ar=new cr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new jf(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const t=e.vr(this.cr)?e.pr():this.cr.Dt();if(t===null)return null;const A=e.mr(t);if(A==="overlay")return null;const r=this.F.br();return r.P!==this.j&&(this.j=r.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),r,A),this.Wt}}class e0 extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),Bi(e,this.zt.Nt),El(e,n,0,t.width))}}class io{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new e0,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 t0 extends io{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),t=e.Cr().Cr;if(t!==2&&t!==3)return;const A=this.Es.W();if(!A.baseLineVisible||!this.Es.yt())return;const r=this.Es.Ct();r!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(r.Vt,r.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class A0 extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*A;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const i0=[{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 ec(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=nr(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function tc(i,e){const t=i%2600/2600;let A;for(const l of i0)if(t>=l.Vr&&t<=l.Or){A=l;break}ii(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:ec(e,r,A.Ir,A.zr),Dr:ec(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class r0{constructor(e){this.Wt=new A0,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(),t=this.Wr-e;if(t>0)return void(t<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(),t=e.Xs(),A=this.jr.Ct();if(t===null||A===null)return;const r=this.jr.Zr(!0);if(r.Xr||!t.Kr(r.ee))return;const n={x:e.It(r.ee),y:this.jr.Dt().Rt(r._t,A.Vt)},s=r.V,o=this.jr.W().lineWidth,l=tc(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 t=tc(this.Gr(),e.Tr);e.Rr=t.Rr,e.Dr=t.Dr,e.ht=t.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function hr(i,e){return Gl(Math.min(Math.max(i,12),30)*e)}function ur(i,e){switch(i){case"arrowDown":case"arrowUp":return hr(e,1);case"circle":return hr(e,.8);case"square":return hr(e,.7)}}function Ac(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(hr(i,1))}function ic(i){return Math.max(hr(i,.1),3)}function rc(i,e,t){return e?i:t?Math.ceil(i/2):0}function nc(i,e,t,A,r){const n=ur("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function sc(i,e,t,A){const r=(ur("arrowUp",A)-1)/2*t.Jr,n=(Gl(A/2)-1)/2*t.Jr;e.beginPath(),i?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function n0(i,e,t,A,r,n){return nc(e,t,A,r,n)}class s0 extends FA{constructor(){super(...arguments),this.zt=null,this.ar=new cr,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,t){this.j===e&&this.H===t||(this.j=e,this.H=t,this.Qr=Pi(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let A=this.zt.tt.from;A<this.zt.tt.to;A++){const r=this.zt.it[A];if(a0(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},r,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),o0(o,e,t,A)}}}}function o0(i,e,t,A){e.fillStyle=i.V,i.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,i.Kt.ih,i.Kt.nt,i.Kt.st,t,A),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void sc(!1,n,s,r.Ks);case"arrowUp":return void sc(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const h=(ur("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,h*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const h=ur("square",c),g=(h-1)*l.Jr/2,v=l.nt-g,x=l.st-g;o.fillRect(v,x,h*l.Jr,h*l.Jr)})(n,s,r.Ks)}r.nh}})(i,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(i,t,A))}function a0(i,e,t){return!(i.Kt===void 0||!(function(A,r,n,s,o,l){const c=s/2;return o>=A&&o<=A+n&&l>=r-c&&l<=r+c})(i.Kt.nt,i.Kt.st,i.Kt.Hi,i.Kt.At,e,t))||(function(A,r,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return n0(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,h){const g=2+ur("circle",l)/2,v=s-c,x=o-h;return Math.sqrt(v*v+x*x)<=g})(A.nt,A.st,A.Ks,r,n);case"square":return nc(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function l0(i,e,t,A,r,n,s,o,l){const c=DA(t)?t:t.Se,h=DA(t)?t:t.Me,g=DA(t)?t:t.xe,v=DA(e.size)?Math.max(e.size,0):1,x=Ac(o.le())*v,F=x/2;switch(i.Ks=x,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+F+n+.6*r));case"aboveBar":return i.st=s.Rt(h,l)-F-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-F-.6*r,A.sh+=1.2*r),void(A.sh+=x+n);case"belowBar":return i.st=s.Rt(g,l)+F+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+F+n+.6*r,A.eh+=1.2*r),void(A.eh+=x+n)}e.position}class c0{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new s0,this.jr=e,this.$i=t,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 t=this.$i.W().layout;return this.Wt._r(t.fontSize,t.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),t=ic(e),A=1.5*Ac(e)+2*t,r=this.fh();this.ah={above:rc(A,r.aboveBar,r.inBar),below:rc(A,r.belowBar,r.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=ic(t.le()),c={sh:l,eh:l};this.zt.tt=Yl(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const g=A[h];g.time!==o&&(c.sh=l,c.eh=l,o=g.time);const v=this.zt.it[h];v.nt=t.It(g.time),g.text!==void 0&&g.text.length>0&&(v.Kt={ih:g.text,nt:0,st:0,Hi:0,At:0});const x=this.jr.ph(g.time);x!==null&&l0(v,g,x,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class h0 extends io{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class u0 extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const h=r.mh(c.V),g=An(h);A.t=g.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=h,e.V=g.i,t.V=g.i}gh(e,t,A,r){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,A){return t?A?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function oc(i,e,t,A){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?i(e,t):r||n?r?e:t:A}class nA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new nA(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 nA(oc(Math.min,this.Ph(),e.Ph(),-1/0),oc(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!DA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,r=this.kh-t;A*=e,r*=e,this.yh=t+A,this.kh=t+r}Oh(e){DA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new nA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||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 hn(nA.Ah(e.priceRange),e.margins)}}class p0 extends io{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const A=this.Nh.Fh();A!==null&&(e.yt=!0,e.st=A,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class d0 extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const h=r.axisLabelTextColor||c.i;e.V=h,t.V=h,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class f0{constructor(e,t){this.jr=e,this.cn=t,this.jh=new p0(e,this),this.ur=new d0(e,this),this.Hh=new jl(this.ur,e,e.$t())}$h(e){QA(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,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class m0 extends Ys{constructor(e){super(),this.$i=e}$t(){return this.$i}}const g0={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=Di(o.Vt[0])<=Di(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,h=e.borderDownColor,g=e.wickUpColor,v=e.wickDownColor,x=Se(i(t,A)),F=Di(x.Vt[0])<=Di(x.Vt[3]);return{ce:(r=x.V)!==null&&r!==void 0?r:F?o:l,Ne:(n=x.Ot)!==null&&n!==void 0?n:F?c:h,Ee:(s=x.Xh)!==null&&s!==void 0?s:F?g:v}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r: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:(i,e,t,A)=>{var r,n,s,o,l,c;const h=Se(i(t,A));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=h.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=h.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class w0{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=g0[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var ac;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(ac||(ac={}));const ri=30;class B0{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,t=0){const A=this.hl(e,t);return A===null?null:Object.assign(Object.assign({},this.al(A)),{ee:this.rl(A)})}ne(){return this.tl}ol(e,t,A){if(this.Ni())return null;let r=null;for(const n of A)r=un(r,this._l(e,t,n));return r}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,t){const A=this.ul(e);if(A===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return A}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return lr(this.tl,e,((t,A)=>t.ee<A))}vl(e){return Zl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ri)*ri,h=Math.max(c,Math.floor(l/ri)*ri);{const v=this.fl(o),x=this.vl(Math.min(l,c,t));r=un(r,this.pl(v,x,A))}let g=this.il.get(A);g===void 0&&(g=new Map,this.il.set(A,g));for(let v=Math.max(c+1,o);v<h;v+=ri){const x=Math.floor(v/ri);let F=g.get(x);if(F===void 0){const T=this.fl(x*ri),S=this.vl((x+1)*ri-1);F=this.pl(T,S,A),g.set(x,F)}r=un(r,F)}{const v=this.fl(h),x=this.vl(l);r=un(r,this.pl(v,x,A))}return r}}function un(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class y0{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class ro{constructor(e){this.tr=null,this.wn=e}gt(){var e;const t=this.wn.renderer();if(t===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===t)return this.tr.xl;const A=new y0(t);return this.tr={Ml:t,xl:A},A}Sl(){var e,t,A;return(A=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:"normal"}}function lc(i){var e,t,A,r,n;return{Kt:i.text(),ki:i.coordinate(),Si:(e=i.fixedCoordinate)===null||e===void 0?void 0:e.call(i),V:i.textColor(),t:i.backColor(),yt:(A=(t=i.visible)===null||t===void 0?void 0:t.call(i))===null||A===void 0||A,hi:(n=(r=i.tickVisible)===null||r===void 0?void 0:r.call(i))===null||n===void 0||n}}class C0{constructor(e,t){this.Wt=new kl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},lc(this.kl))),this.Wt}}class v0 extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=lc(this.kl);A.t=r.t,e.V=r.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=r.ki,A.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class T0{constructor(e,t){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=t}Ol(){return this.Vl}Vn(){var e,t;(t=(e=this.Vl).updateAllViews)===null||t===void 0||t.call(e)}Pn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new ro(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Tl)===null||r===void 0?void 0:r.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new C0(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Pl)===null||r===void 0?void 0:r.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new v0(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,r;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new ro(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,A,r;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new ro(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var A,r,n;return(n=(r=(A=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,r,n;return(n=(r=(A=this.Vl).hitTest)===null||r===void 0?void 0:r.call(A,e,t))!==null&&n!==void 0?n:null}}function no(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function so(i){return i.Pn()}function b0(i){return i.Bl()}function x0(i){return i.Al()}class oo extends m0{constructor(e,t,A,r,n){super(e),this.zt=new B0,this.jh=new h0(this),this.zl=[],this.Ll=new t0(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=A;const s=new u0(this);this.rn=[s],this.Hh=new jl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new r0(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},A=this.Dt();if(this.$t().St().Ni()||A.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const g=this.zt.sl();if(g===null)return t;s=g,o=g.ee}else{const g=this.zt.ll(r.ui(),-1);if(g===null||(s=this.zt.Gh(g.ee),s===null))return t;o=g.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=A.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:A.Fi(l,n.Vt),xh:A.Yl(l),Sh:A.Zl(l,n.Vt),V:c.ce,ki:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new w0(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),QA(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,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const A=this.$t().dr(this);this.$t().ia(A),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new f0(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,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 t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];no(this.Hl,so,"top",t);const A=this.El;return A!==null&&A.yt()&&(this.jl===null&&A.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),A.Ur(),t.unshift(A)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((A=>A.qh()));return e.push(...t),no(this.Hl,so,"normal",e),e}ua(){return this.ca(so,"bottom")}da(e){return this.ca(b0,e)}fa(e){return this.ca(x0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.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 T0(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Ao)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Ao)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!sr(e)||!sr(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,A);let n=r!==null?new nA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new nA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const x=new nA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(x):x}var c,h,g,v;l?.margins&&(c=s,h=l.margins,s={above:Math.max((g=c?.above)!==null&&g!==void 0?g:0,h.above),below:Math.max((v=c?.below)!==null&&v!==void 0?v:0,h.below)})})),new hn(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 t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}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 Mf(this.cn.priceFormat.precision);break;case"percent":this.wa=new Kl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(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 t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new c0(this,this.$t()),this.$l){case"Bar":this.wn=new Kf(this,this.$t());break;case"Candlestick":this.wn=new Gf(this,this.$t());break;case"Line":this.wn=new Yf(this,this.$t());break;case"Custom":this.wn=new Ao(this,this.$t(),jt(e));break;case"Area":this.wn=new Nf(this,this.$t());break;case"Baseline":this.wn=new Wf(this,this.$t());break;case"Histogram":this.wn=new Zf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return no(this.Hl,e,t,A),A}}class Q0{constructor(e){this.cn=e}Oa(e,t,A){let r=e;if(this.cn.mode===0)return r;const n=A.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=A.Ba().filter((h=>h instanceof oo)).reduce(((h,g)=>{if(A.vr(g)||!g.yt())return h;const v=g.Dt(),x=g.In();if(v.Ni()||!x.Kr(t))return h;const F=x.Gh(t);if(F===null)return h;const T=Di(g.Ct());return h.concat([v.Rt(F.Vt[3],T.Vt)])}),[]);if(l.length===0)return r;l.sort(((h,g)=>Math.abs(h-o)-Math.abs(g-o)));const c=l[0];return r=n.pn(c,s),r}}class F0 extends FA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,Bi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,Bi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class U0{constructor(e){this.Wt=new F0,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,t={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((A=>({Ea:A.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class S0{constructor(e){this.wn=new U0(e)}qh(){return this.wn}}const ao={$a:4,Ua:1e-4};function ki(i,e){const t=100*(i-e)/e;return e<0?-t:t}function E0(i,e){const t=ki(i.Ph(),e),A=ki(i.Rh(),e);return new nA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function L0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new nA(t,A)}function pn(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return i<0?-A:A}function dr(i,e){const t=Math.abs(i);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return i<0?-A:A}function fr(i,e){if(i===null)return null;const t=pn(i.Ph(),e),A=pn(i.Rh(),e);return new nA(t,A)}function dn(i,e){if(i===null)return null;const t=dr(i.Ph(),e),A=dr(i.Rh(),e);return new nA(t,A)}function lo(i){if(i===null)return ao;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return ao;const t=Math.ceil(Math.abs(Math.log10(e))),A=ao.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class co{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let r=A;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let A=this.qa;A!==1;){if(A%2==0)this.Za.push(2),A/=2;else{if(A%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),A/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,A){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const g=ln(n,r,1e-14)&&n>r+1e-14,v=ln(n,A*o,1e-14),x=ln(n,1,1e-14);if(!(g&&v&&x))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,h=1e-14,Math.abs(l-c)<h))for(s=0,o=this.Za[0];ln(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,h;return n}}class cc{constructor(e,t,A,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),r=(e-t)*this.Qa()/A,n=new co(this.qa,[2,2.5,2]),s=new co(this.qa,[2,2,2.5]),o=new co(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let h=c[0];for(let g=1;g<c.length;++g)c[g]<h&&(h=c[g]);return h})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),r=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=A-1-s,c=Math.max(r,n),h=Math.min(r,n);if(c===h)return void(this.Ka=[]);let g=this.Xa(c,h),v=c%g;v+=v<0?g:0;const x=c>=h?1:-1;let F=null,T=0;for(let S=c-v;S>h;S-=g){const I=this.Ja(S,t,!0);F!==null&&Math.abs(I-F)<this.Qa()||I<o||I>l||(T<this.Ka.length?(this.Ka[T].Ea=I,this.Ka[T].so=e.eo(S)):this.Ka.push({Ea:I,so:e.eo(S)}),T++,F=I,e.ro()&&(g=this.Xa(S*x,h)))}this.Ka.length=T}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function hc(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var uc;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(uc||(uc={}));const pc=new Kl,dc=new an(100,1);class M0{constructor(e,t,A,r){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 Mt,this.vo=new Mt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=dc,this.xo=lo(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new cc(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(QA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);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 t=this.Cr();let A=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),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=dr(n.Ph(),s),l=dr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=dn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=fr(this.Ih,this.xo),A!==null&&this.Ao(A));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,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,t){const A=this.Ih;(t||A===null&&e!==null||A!==null&&!A.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,t){return this.Mh()?e=ki(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),g=A===void 0?0:A.from,v=A===void 0?e.length:A.to,x=this.Ho();for(let F=g;F<v;F++){const T=e[F],S=T._t;if(isNaN(S))continue;let I=S;x!==null&&(I=x(T._t,t));const Q=r+h*(I-s),N=c?Q:this.ho-1-Q;T.st=N}}be(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),g=A===void 0?0:A.from,v=A===void 0?e.length:A.to,x=this.Ho();for(let F=g;F<v;F++){const T=e[F];let S=T.ge,I=T.Me,Q=T.xe,N=T.Se;x!==null&&(S=x(T.ge,t),I=x(T.Me,t),Q=x(T.xe,t),N=x(T.Se,t));let X=r+h*(S-s),H=c?X:this.ho-1-X;T.pe=H,X=r+h*(I-s),H=c?X:this.ho-1-X,T.de=H,X=r+h*(Q-s),H=c?X:this.ho-1-X,T.fe=H,X=r+h*(N-s),H=c?X:this.ho-1-X,T.me=H}}pn(e,t){const A=this.To(e,t);return this.$o(A,t)}$o(e,t){let A=e;return this.Mh()?A=(function(r,n){return n<0&&(r=-r),r/100*n+n})(A,t):this.Oo()&&(A=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(A,t)),A}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const A=this.po[t];A.Xi()===null&&A.Ki(t+1),e.push(A)}return e=hc(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}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 t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}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=Se(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 t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}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=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),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,t){switch(this.cn.mode){case 2:return this.s_(ki(e,t));case 3:return this.ba().format(pr(e,t));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,Se(this.e_()).ba())}Zl(e,t){return e=ki(e,t),this.s_(e,pc)}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 t=100;e!==null&&(t=Math.round(1/e.ma())),this.wa=dc,this.Mh()?(this.wa=pc,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new cc(this,t,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,t){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?pn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?dr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const A=this.r_();let r=0,n=0;for(const l of A){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const h=l.Il(e.Os(),e.ui());let g=h&&h.Lh();if(g!==null){switch(this.cn.mode){case 1:g=fr(g,this.xo);break;case 2:g=E0(g,c.Vt);break;case 3:g=L0(g,c.Vt)}if(t=t===null?g:t.ts(Se(g)),h!==null){const v=h.Eh();v!==null&&(r=Math.max(r,v.above),n=Math.max(n,v.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=dn(t,this.xo)),t=new nA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=fr(t,this.xo))}if(this.ro()){const l=dn(t,this.xo),c=lo(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?dn(this.ao,this.xo):null;this.xo=c,t=fr(l,c),h!==null&&(this.ao=fr(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new nA(-.5,.5)),this.xo=lo(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?ki:this.Oo()?pr:this.ro()?e=>pn(e,this.xo):null}a_(e,t,A){return t===void 0?(A===void 0&&(A=this.ba()),A.format(e)):t(e)}Wh(e,t){return this.a_(e,this.yo.priceFormatter,t)}s_(e,t){return this.a_(e,this.yo.percentageFormatter,t)}}class H0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Mt,this.yl=e,this.$i=t,this.d_=new S0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.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_(A)}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 t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(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((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ii(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),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,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),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 t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),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=hc(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const A=this.yl.Xs();A!==null&&e.h_(A)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,A=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!on(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(A),this.P_(r),this.mo=null}m_(e,t,A){t.Cr!==A.Cr&&this.L_(e)}v_(e,t){const A=Object.assign({visible:!0,autoScale:!0},JA(t)),r=new M0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class I0{constructor(e,t,A=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=A}Y_(e){const t=e.time,A=this.q_.cacheKey(t),r=this.tr.get(A);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class mr{constructor(e,t){ii(e<=t,"right should be >= left"),this.X_=e,this.K_=t}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 fc(i,e){return i===null||e===null?i===e:i.Ch(e)}class _0{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let A=t;A<e.length;++A){const r=e[A];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:A,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const A=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===A||(this.tr={Ha:this.ru(A),eu:A}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((A,r)=>{e<=A[0].index?t.push(r):A.splice(lr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,h=-1/0;for(let g=0;g<l;g++){const v=o[g],x=v.index;for(;s<n;){const F=r[s],T=F.index;if(!(T<x)){c=T;break}s++,t.push(F),h=T,c=1/0}if(c-x>=e&&x-h>=e)t.push(v),h=x;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Ni{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 Ni(null)}}function D0(i,e){return i.weight>e.weight?i:e}class P0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new _0,this.du=new Map,this.fu=Ni.ou(),this.vu=!0,this.pu=new Mt,this.mu=new Mt,this.bu=new Mt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){QA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;QA(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((A=e.barSpacing)!==null&&A!==void 0?A:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,A;return(A=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&A!==void 0?A:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const A=lr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}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 t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!sr(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}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,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,h=this.$u(),g=this.cn.fixLeftEdge||h,v=this.cn.fixRightEdge||h;let x=0;for(const F of o){if(!(n<=F.index&&F.index<=s))continue;let T;x<this.Mu.length?(T=this.Mu[x],T.coord=this.It(F.index),T.label=this.Uu(F),T.weight=F.weight):(T={needAlignCoordinate:!1,coord:this.It(F.index),label:this.Uu(F),weight:F.weight},this.Mu.push(T)),this.Su>t/2&&!h?T.needAlignCoordinate=!1:T.needAlignCoordinate=g&&F.index<=l||v&&F.index>=c,x++}return this.Mu.length=x,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,t){const A=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(A-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 t=js(this.__-e,0,this.__),A=js(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}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 t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new mr(e,t+this.cn.rightOffset))}lc(e){const t=new mr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.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 t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Ni.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new mr(A-t+1,A);this._c(new Ni(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,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 t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-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 t=this.du.get(e.weight);return t===void 0&&(t=new I0((A=>this.fc(A)),this.q_),this.du.set(e.weight,t)),t.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const t=this.fu;this.fu=e,fc(t.lu(),this.fu.lu())||this.pu.m(),fc(t.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 t=this.Xs();if(t===null)return;const A=t.Os()-e;if(A<0){const r=this.xu-A-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class k0{X(e,t,A){e.useMediaCoordinateSpace((r=>this.K(r,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((r=>this.vc(r,t,A)))}vc(e,t,A){}}class N0 extends k0{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:A}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>A.width?s.Zu=A.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-r)/2,0);break;case"bottom":n=Math.max(A.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=A.width/2;break;case"right":t.textAlign="right",o=A.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const A=this.kc(e.font);let r=A.get(t);return r===void 0&&(r=e.measureText(t).width,A.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class O0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new N0(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(),t=this.Ft;t.yt=e.visible,t.yt&&(t.V=e.color,t.xc=e.horzAlign,t.Mc=e.vertAlign,t.bc=[{Kt:e.text,R:Pi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class K0 extends Ys{constructor(e,t){super(),this.cn=t,this.wn=new O0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var mc,gc,wc,Bc,yc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(mc||(mc={}));class V0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Mt,this.Rc=new Mt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new yf(this),this.yl=new P0(this,t.timeScale,this.cn.localization,A),this.vt=new Lf(this,t.crosshair),this.Bc=new Q0(t.crosshair),this.Ac=new K0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Kt.es())}Uh(){this.Nc(Kt.ss())}oa(){this.Nc(new Kt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){QA(this.cn,e),this.yc.forEach((t=>t.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,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const A=this.Uc(e);A!==null&&(A.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const A=t.w_(e);if(A!==null)return{Ht:t,Dt:A}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new H0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Kt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),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,t,A,r,n){this.vt.gn(e,t);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 c=r.vn(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const r=A.vn(),n=r.Ct(),s=r.Rt(e,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!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 t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),h=e!==null&&e>s&&!c,g=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,v=l&&(A!==void 0||g)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!v){const x=e-s;this.yl.Jn(this.yl.Hu()-x)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}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,t,A){const r=this.yc[0],n=this.fd(t,e,r,A);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),A=this.Cc.indexOf(e);ii(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Kt.ss();e.$n(),this.Nc(e)}pd(e){const t=Kt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Kt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Kt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Kt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Kt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Kt.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 t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,h,g]=nr(n),[v,x,F,T]=nr(s),S=[mA(l+o*(v-l)),mA(c+o*(x-c)),mA(h+o*(F-h)),Ml(g+o*(T-g))];return`rgba(${S[0]}, ${S[1]}, ${S[2]}, ${S[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Kt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new oo(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),on(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function ho(i){return!DA(i)&&!or(i)}function Cc(i){return DA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(gc||(gc={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(wc||(wc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(Bc||(Bc={})),(function(i){i[i.Year=0]="Year",i[i.Month=1]="Month",i[i.DayOfMonth=2]="DayOfMonth",i[i.Time=3]="Time",i[i.TimeWithSeconds=4]="TimeWithSeconds"})(yc||(yc={}));const vc=i=>i.getUTCFullYear();function z0(i,e,t){return e.replace(/yyyy/g,(A=>ZA(vc(A),4))(i)).replace(/yy/g,(A=>ZA(vc(A)%100,2))(i)).replace(/MMMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(i,t)).replace(/MMM/g,((A,r)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(i,t)).replace(/MM/g,(A=>ZA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>ZA((r=>r.getUTCDate())(A),2))(i))}class Tc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return z0(e,this.gd,this.Md)}}class W0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",ZA(e.getUTCHours(),2)).replace("%m",ZA(e.getUTCMinutes(),2)).replace("%s",ZA(e.getUTCSeconds(),2))}}const R0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class G0{constructor(e={}){const t=Object.assign(Object.assign({},R0),e);this.Td=new Tc(t.Sd,t.Cd),this.Pd=new W0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function fn(i){return 60*i*60*1e3}function uo(i){return 60*i*1e3}const mn=[{Dd:(bc=1,1e3*bc),Vd:10},{Dd:uo(1),Vd:20},{Dd:uo(5),Vd:21},{Dd:uo(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var bc;function xc(i,e){if(i.getUTCFullYear()!==e.getUTCFullYear())return 70;if(i.getUTCMonth()!==e.getUTCMonth())return 60;if(i.getUTCDate()!==e.getUTCDate())return 50;for(let t=mn.length-1;t>=0;--t)if(Math.floor(e.getTime()/mn[t].Dd)!==Math.floor(i.getTime()/mn[t].Dd))return mn[t].Vd;return 0}function po(i){let e=i;if(or(i)&&(e=fo(i)),!ho(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function Qc(i){if(!Cc(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function fo(i){const e=new Date(i);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${i}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Fc(i){or(i.time)&&(i.time=fo(i.time))}class Uc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(Fc)})(e):Fc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:ho(t[0].time)||or(t[0].time)?po:Qc})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return Cc(t=e)?Qc(t):ho(t)?po(t):po(fo(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new G0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Tc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const A=(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),r=this.cn.timeScale;if(r.tickMarkFormatter!==void 0){const n=r.tickMarkFormatter(e.originalTime,A,t.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 c=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(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(D0,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,r=0){if(A.length===0)return;let n=r===0?null:A[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<A.length;++l){const c=A[l],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=xc(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}if(r===0&&A.length>1){const l=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-l));A[0].timeWeight=xc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return QA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Oi=typeof window<"u";function Sc(){return!!Oi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function mo(){return!!Oi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function go(i){return i+i%2}function wo(i,e){return i.zd-e.zd}function Bo(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class $0{constructor(e,t,A,r){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=t,this.qd=A,this.rs=r}Yd(e,t){if(this.Ld!==null){if(this.Ld.ot===t)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:t,zd:e}}Vr(e,t){if(this.Ld===null||this.Ed===null||t-this.Ld.ot>50)return;let A=0;const r=Bo(this.Ld,this.Ed,this.Ud),n=wo(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=Bo(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const h=wo(this.Ed,this.Nd);if(s.push(c),o.push(h),A+=h,this.Fd!==null){const g=Bo(this.Nd,this.Fd,this.Ud);if(Math.sign(g)===Math.sign(r)){const v=wo(this.Nd,this.Fd);s.push(g),o.push(v),A+=v}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/A*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,h){const g=Math.log(h);return Math.log(1*g/-c)/g})(Math.abs(l),this.qd))}tc(e){const t=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class X0{constructor(e,t){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=t,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 Hl(nr(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 yi(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=nf(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return A.resizeCanvasElement(e),A}function Ci(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function yo(i,e,t,A){i.gl&&i.gl(e,t,A)}function gn(i,e,t,A){i.X(e,t,A)}function Co(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function J0(i){Oi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class vo{constructor(e,t,A){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=!mo(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(PA(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(PA(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=A,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 t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const A=this.Ef(e);this.Uf(A,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 t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=To(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(PA(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Ki(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(PA(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=To(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(PA(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Ki(e));this._f===0&&Ki(e),e.touches.length===0&&this.ff&&(this.ff=!1,Ki(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),Sc()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:A}=this.Ff(PA(e),this.af);A<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=wn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=PA(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{A.removeEventListener("touchmove",n),A.removeEventListener("touchend",s)},A.addEventListener("touchmove",n,{passive:!1}),A.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=PA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;Sc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=PA(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=PA(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=A=>{this.Hf.wv&&(A.composed&&this.Zf.contains(A.composedPath()[0])||A.target&&this.Zf.contains(A.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}mo()&&(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}),J0(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 t=Ec(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Ki(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 t=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,st:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Tf=Ec(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 t=this.Ef(e);this.Uf(t,this.Hf.Pv),this.Bf=!mo()}vv(e){const t=To(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.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:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Ki(e)}}}}function Ec(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Ki(i){i.cancelable&&i.preventDefault()}function PA(i){return{nt:i.pageX,st:i.pageY}}function wn(i){return i.timeStamp||performance.now()}function To(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function Bn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function Z0(i,e,t){for(const A of i){const r=A.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function bo(i,e){return t=>{var A,r,n,s;return((r=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,i))!==null&&s!==void 0?s:[]}}function Lc(i,e,t,A){if(!i.length)return;let r=0;const n=t/2,s=i[0].At(A,!0);let o=e===1?n-(i[0].Vi()-s/2):i[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<i.length;l++){const c=i[l],h=i[l-1],g=h.At(A,!1),v=c.Vi(),x=h.Vi();if(e===1?v>x-g:v<x+g){const F=x-g*e;c.Oi(F);const T=F-e*g/2;if((e===1?T<0:T>t)&&o>0){const S=e===1?-1-T:T-t,I=Math.min(S,o);for(let Q=r;Q<i.length;Q++)i[Q].Oi(i[Q].Vi()+e*I);o-=I}}else r=l,o=e===1?x-g-v:v-(x+g)}}class Mc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new cr(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=t,this.ko=t.layout,this.Oc=A,this.qv=r==="left",this.Yv=bo("normal",r),this.Zv=bo("top",r),this.Xv=bo("bottom",r),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=yi(this.Kv,bt({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=yi(this.Kv,bt({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 vo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(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 t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(A,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;A.restore();const l=e||34;return go(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&gi(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 Se(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,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}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 t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,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=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Dl(e,0,0,A,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(l)),h=Math.floor(.5*l),g=Math.round(r.T*o);s.beginPath();for(const v of t)s.rect(Math.floor(n*o),Math.round(v.Ea*l)-h,g,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=A.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-r.A):Math.round(n+r.T+r.A),c=t.map((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const g=t[h];s.fillText(g.so,l,g.Ea+c[h])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),r=this.ap();this.Li===A.pr()&&this.tn.fp().Uo().forEach((s=>{A.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(A,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,r)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,r=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));r.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(t)/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)}Lc(r,1,this.Ev.height,t),Lc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(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 Pi(this.ko.fontSize,this.ko.fontFamily)}}function Y0(i,e){var t,A;return(A=(t=i.ua)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function yn(i,e){var t,A;return(A=(t=i.Pn)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function q0(i,e){var t,A;return(A=(t=i.Ji)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function j0(i,e){var t,A;return(A=(t=i.aa)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}class xo{constructor(e,t){this.Ev=bt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Mt,this.Op=new Mt,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=t,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 A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.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(A),this.Gv=yi(A,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=yi(A,bt({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 vo(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),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(xo.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(t=this.Pp)!==null&&t!==void 0?t:new X0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.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(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(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 t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t: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 t={x:e.localX,y:e.localY};this.rm(t,t,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,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-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,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,h,g){var v,x;let F,T;for(const Q of c){const N=(x=(v=Q.va)===null||v===void 0?void 0:v.call(Q,h,g))!==null&&x!==void 0?x:[];for(const X of N)S=X.zOrder,(!(I=F?.zOrder)||S==="top"&&I!=="top"||S==="normal"&&I==="bottom")&&(F=X,T=Q)}var S,I;return F&&T?{zv:F,Hc:T}:null})(o,n,s);if(l?.zv.zOrder==="top")return Bn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Bn(l);const h=Z0(c.Pn(r),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(bt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){gi(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=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}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 A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,Y0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,q0)))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,j0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const A=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:r},t)}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,o):Dl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,yo,t),this.Mm(e,yn,gn,t)}bm(e){this.Mm(e,yn,gn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,yo,r);for(const r of A)this.Mm(e,t,gn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;Co(t,(c=>A(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,A=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),A||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const r=e.$t().ud();t&&this.Cp===null&&(this.Cp=new Mc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new Mc(this,e.W(),r,"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,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(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 t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.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 c=A.le();this.Ep=new $0(.2/c,7/c,.997,15/c),this.Ep.Yd(A.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||t.A_(this.Np,o,e.localY),t.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||t.I_(this.Np,o,e.localY),t.sd(e.localX),this.Ep!==null&&this.Ep.Yd(A.Hu(),l))}}class Hc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=bt({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=r,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=yi(this.Kv,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){gi(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 t=wi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*A),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Pm())}}function Qo(i){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,i))!==null&&A!==void 0?A:[]}}const em=Qo("normal"),tm=Qo("top"),Am=Qo("bottom");class im{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=bt({width:0,height:0}),this.Om=new Mt,this.Fv=new cr(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_=t,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=yi(this.Im,bt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const A=this.Gv.canvasElement;A.style.position="absolute",A.style.zIndex="1",A.style.left="0",A.style.top="0",this.Jv=yi(this.Im,bt({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.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 vo(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),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(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 t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.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 t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.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,t,A){gi(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(bt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(bt({width:A,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,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,Am)})),this.wp(A),this.$m(A,em)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,tm))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)Co(t,(n=>yo(n,e,!1,void 0)),r,void 0);for(const r of A)Co(t,(n=>gn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const h=Math.max(1,Math.floor(l)),g=Math.floor(.5*l);o.beginPath();const v=Math.round(n.T*c);for(let x=A.length;x--;){const F=Math.round(A[x].coord*l);o.rect(F-g,0,h,v)}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 c of A)if(c.weight<r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}}))}Ym(e,t,A){const r=this.Fv.xi(e,A),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const A=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Pi(this.j(),this.cn.fontFamily)}Zm(){return Pi(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 cr,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const A=this.j();e.P=A,e.R=t,e.L=3*A/12,e.B=3*A/12,e.ji=9*A/12,e.N=0,e.Hm=4*A/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const A={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Hc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Hc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const rm=!!Oi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!Oi&&(!((Fo=navigator?.userAgentData)===null||Fo===void 0)&&Fo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Fo;class nm{constructor(e,t,A){var r;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 Mt,this.Op=new Mt,this.Rc=new Mt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,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%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Uo(this.cn)&&this.hb(!0),this.$i=new V0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new im(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.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=[],Se(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,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return bt({width:l-l%2,height:c-c%2})})(bt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Kt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Kt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=Uo(this.cn);this.$i.$h(e);const A=Uo(this.cn);A!==t&&this.hb(A),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),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(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 jt(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 t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let h=0;h<this.Xm.length;h++){const g=this.Xm[h],v=Se(o==="left"?g.wm():g.gm()),x=v.xp();e!==null&&v.Sp(e,l,c),c+=x.height}};this.xb()&&(n("left",0),t+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return bt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const F of this.Xm)this.xb()&&(t=Math.max(t,Se(F.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(F.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=F.M_();t=go(t),A=go(A);const r=this.__,n=this.ho,s=Math.max(r-t-A,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const h=0+l,g=n<h?0:n-h,v=g/e;let x=0;for(let F=0;F<this.Xm.length;++F){const T=this.Xm[F];T.qp(this.$i.qc()[F]);let S=0,I=0;I=F===this.Xm.length-1?g-x:Math.round(T.M_()*v),S=Math.max(I,2),x+=S,T.cp(bt({width:s,height:S})),this.xb()&&T._m(t,"left"),this.Sb()&&T._m(A,"right"),T.fp()&&this.$i.Kc(T.fp(),S)}this.ab.Fm(bt({width:o?s:0,height:l}),o?t:0,o?A:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==A&&(this.Jm=A)}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 rm?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),A=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((A=this.Qm)===null||A===void 0?void 0:A.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const A of e.Qn())this.ns(A,t)}Vb(e){const t=this.$i.qc();for(let A=0;A<t.length;A++)e.Hn(A).Wn&&t[A].N_()}ns(e,t){const A=this.$i.St();switch(e.qn){case 0:A.hc();break;case 1:A.lc(e.Vt);break;case 2:A.Gn(e.Vt);break;case 3:A.Jn(e.Vt);break;case 4:A.qu();break;case 5:e.Vt.Qu(t)||A.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const A=this.Qm;this.Qm=null,this.mb(A,t);for(const r of A.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let r=t;r<A;r++){const n=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new xo(this,e[r]);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 r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var r;const n=new Map;e!==null&&this.$i.wt().forEach((h=>{const g=h.In().ll(e);g!==null&&n.set(h,g)}));let s;if(e!==null){const h=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof oo?o.Hc:void 0,c=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:t??void 0,Eb:l,Nb:n,Fb:c,Wb:A??void 0}}Bb(e,t,A){this.Vp.m((()=>this.Ib(e,t,A)))}Ab(e,t,A){this.Op.m((()=>this.Ib(e,t,A)))}lb(e,t,A){this.Rc.m((()=>this.Ib(e,t,A)))}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 t=e.find((A=>A.target===this.Jd));t&&this._b(t.contentRect.width,t.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function Uo(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function sm(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function Ic(i,e){var t={};for(var A in i)Object.prototype.hasOwnProperty.call(i,A)&&e.indexOf(A)<0&&(t[A]=i[A]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(A=Object.getOwnPropertySymbols(i);r<A.length;r++)e.indexOf(A[r])<0&&Object.prototype.propertyIsEnumerable.call(i,A[r])&&(t[A[r]]=i[A[r]])}return t}function _c(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.color!==void 0&&(n.V=t.color),n}function om(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function am(i,e,t,A){const r=t.value,n={ee:e,ot:i,Vt:[r,r,r,r],zb:A};return t.topLineColor!==void 0&&(n.Re=t.topLineColor),t.bottomLineColor!==void 0&&(n.De=t.bottomLineColor),t.topFillColor1!==void 0&&(n.ke=t.topFillColor1),t.topFillColor2!==void 0&&(n.ye=t.topFillColor2),t.bottomFillColor1!==void 0&&(n.Ce=t.bottomFillColor1),t.bottomFillColor2!==void 0&&(n.Te=t.bottomFillColor2),n}function lm(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),r}function cm(i,e,t,A){const r={ee:e,ot:i,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function hm(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],h=t,{time:g,color:v}=h;return{ee:e,ot:i,Vt:c,zb:A,$e:Ic(h,["time","color"]),V:v}}function Cn(i){return i.Vt!==void 0}function Dc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function vi(i){return(e,t,A,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?Dc({ot:e,ee:t,zb:r},A):Dc(i(e,t,A,r,n),A)}function Pc(i){return{Candlestick:vi(cm),Bar:vi(lm),Area:vi(om),Baseline:vi(am),Histogram:vi(_c),Line:vi(_c),Custom:vi(hm)}[i]}function kc(i){return{ee:0,Hb:new Map,la:i}}function Nc(i,e){if(i!==void 0&&i.length!==0)return{$b:e.key(i[0].ot),Ub:e.key(i[i.length-1].ot)}}function Oc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),jt(e)}class um{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,t){let A=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((x=>x.time)),c=this.q_.createConverterToInternalObj(t),h=Pc(e.Qh()),g=e.Ca(),v=e.Ta();s=t.map(((x,F)=>{const T=c(x.time),S=this.q_.key(T);let I=this.qb.get(S);I===void 0&&(I=kc(T),this.qb.set(S,I),r=!0);const Q=h(T,I.ee,x,l[F],g,v);return I.Hb.set(e,Q),Q}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Oc(c.Hb)})})),l.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,h){const g=Nc(l,h),v=Nc(c,h);if(g!==void 0&&v!==void 0)return{ta:g.Ub>=v.Ub&&g.$b>=v.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(T){T.zb===void 0&&(T.zb=T.time)})(A),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=kc(r),this.qb.set(this.q_.key(r),s));const l=Pc(e.Qh()),c=e.Ca(),h=e.Ta(),g=l(r,s.ee,t,A.zb,c,h);s.Hb.set(e,g),this.nw(e,g);const v={ta:Cn(g)};if(!o)return this.tw(e,-1,v);const x={timeWeight:0,time:s.la,pointData:s,originalTime:Oc(s.Hb)},F=lr(this.Xb,this.q_.key(x.time),((T,S)=>this.q_.key(T.time)<S));this.Xb.splice(F,0,x);for(let T=F;T<this.Xb.length;++T)So(this.Xb[T].pointData,T);return this.q_.fillWeightsForPoints(this.Xb,F),this.tw(e,F,v)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const r=A.length!==0?A[A.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Cn(t)&&A.push(t):Cn(t)?A[A.length-1]=t:A.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Cn)),this.Zb.set(e,t[t.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 t=-1;for(let A=0;A<this.Xb.length&&A<e.length;++A){const r=this.Xb[A],n=e[A];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=r.timeWeight,So(n.pointData,A)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let A=t;A<e.length;++A)So(e[A].pointData,A);return this.q_.fillWeightsForPoints(e,t),this.Xb=e,t}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].ee))})),e}tw(e,t,A){const r={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{r.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:A}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:A})}return r}}function So(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function Eo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Kc(i){const e=Eo(i);return i.V!==void 0&&(e.color=i.V),e}function pm(i){const e=Eo(i);return i.lt!==void 0&&(e.lineColor=i.lt),i.Ps!==void 0&&(e.topColor=i.Ps),i.Rs!==void 0&&(e.bottomColor=i.Rs),e}function dm(i){const e=Eo(i);return i.Re!==void 0&&(e.topLineColor=i.Re),i.De!==void 0&&(e.bottomLineColor=i.De),i.ke!==void 0&&(e.topFillColor1=i.ke),i.ye!==void 0&&(e.topFillColor2=i.ye),i.Ce!==void 0&&(e.bottomFillColor1=i.Ce),i.Te!==void 0&&(e.bottomFillColor2=i.Te),e}function Vc(i){const e={open:i.Vt[0],high:i.Vt[1],low:i.Vt[2],close:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function fm(i){const e=Vc(i);return i.V!==void 0&&(e.color=i.V),e}function mm(i){const e=Vc(i),{V:t,Ot:A,Xh:r}=i;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),r!==void 0&&(e.wickColor=r),e}function Lo(i){return{Area:pm,Line:Kc,Baseline:dm,Histogram:Kc,Bar:fm,Candlestick:mm,Custom:gm}[i]}function gm(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const wm={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},Bm={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},ym={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Js,attributionLogo:!0},Mo={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},Cm={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},vm={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Js,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function zc(){return{width:0,height:0,autoSize:!1,layout:ym,crosshair:wm,grid:Bm,overlayPriceScales:Object.assign({},Mo),leftPriceScale:Object.assign(Object.assign({},Mo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Mo),{visible:!0}),timeScale:Cm,watermark:vm,localization:{locale:Oi?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 Tm{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Wc(i,e,t){const A=Ic(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const bm={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class xm{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class Qm{constructor(e,t,A,r,n){this.uw=new Mt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new Ni(new mr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.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,t){const A=this.Es.In().ll(e,t);return A===null?null:Lo(this.seriesType())(A)}data(){const e=Lo(this.seriesType());return this.Es.In().ne().map((t=>e(t)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const t=e.map((A=>Wc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Wc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return JA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=QA(JA(bm),e),A=this.Es.ea(t);return new xm(A)}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 Fm{constructor(e,t,A){this.ww=new Mt,this.mu=new Mt,this.Om=new Mt,this.$i=e,this.yl=e.St(),this.ab=t,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_=A}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,t){t?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 t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ii(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 t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.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({},JA(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 Um(i){if(i===void 0||i.type==="custom")return;const e=i;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let A=0;for(;A<8;A++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return A;t*=10}return A})(e.minMove))}function Rc(i){return(function(e){if(rn(e.handleScale)){const A=e.handleScale;e.handleScale={axisDoubleClickReset:{time:A,price:A},axisPressedMouseMove:{time:A,price:A},mouseWheel:A,pinch:A}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:A,axisDoubleClickReset:r}=e.handleScale;rn(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),rn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;rn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class Sm{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Mt,this.Cw=new Mt,this.Tw=new Mt,this.Pw=new um(t);const r=A===void 0?JA(zc()):QA(JA(zc()),Rc(A));this.q_=t,this.aw=new nm(e,r,t),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 Fm(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,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=Di(e),r=Object.assign(Object.assign({},Ql),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",uf,e)}addBaselineSeries(e){return this.Vw("Baseline",pf,e)}addBarSeries(e){return this.Vw("Bar",cf,e)}addCandlestickSeries(e={}){return(function(t){t.borderColor!==void 0&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),t.wickColor!==void 0&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)})(e),this.Vw("Candlestick",lf,e)}addHistogramSeries(e){return this.Vw("Histogram",df,e)}addLineSeries(e){return this.Vw("Line",hf,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}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 Tm(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Rc(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,t,A){const r=this.Sw.get(A);if(r===void 0)return;const n=this.aw.$t().dr(r);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},r){Um(A.priceFormat);const n=QA(JA(Fl),JA(t),A),s=this.aw.$t().dd(e,n,r),o=new Qm(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Lo(s)(r);if(s!=="Custom")ii(sm(o));else{const l=n.Ta();ii(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=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:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function Em(i,e,t){let A;if(or(i)){const n=document.getElementById(i);ii(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new Sm(A,e,t);return e.setOptions(r.options()),r}function Lm(i,e){return Em(i,new Uc,Uc.Id(e))}Object.assign(Object.assign({},Fl),Ql);function Gc(i,e){return function(){return i.apply(e,arguments)}}const{toString:Mm}=Object.prototype,{getPrototypeOf:Ho}=Object,{iterator:vn,toStringTag:$c}=Symbol,Tn=(i=>e=>{const t=Mm.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),UA=i=>(i=i.toLowerCase(),e=>Tn(e)===i),bn=i=>e=>typeof e===i,{isArray:Vi}=Array,zi=bn("undefined");function gr(i){return i!==null&&!zi(i)&&i.constructor!==null&&!zi(i.constructor)&&sA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Xc=UA("ArrayBuffer");function Hm(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Xc(i.buffer),e}const Im=bn("string"),sA=bn("function"),Jc=bn("number"),wr=i=>i!==null&&typeof i=="object",_m=i=>i===!0||i===!1,xn=i=>{if(Tn(i)!=="object")return!1;const e=Ho(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!($c in i)&&!(vn in i)},Dm=i=>{if(!wr(i)||gr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},Pm=UA("Date"),km=UA("File"),Nm=UA("Blob"),Om=UA("FileList"),Km=i=>wr(i)&&sA(i.pipe),Vm=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||sA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&sA(i.toString)&&i.toString()==="[object FormData]"))},zm=UA("URLSearchParams"),[Wm,Rm,Gm,$m]=["ReadableStream","Request","Response","Headers"].map(UA),Xm=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Br(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Vi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(gr(i))return;const n=t?Object.getOwnPropertyNames(i):Object.keys(i),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,i[o],o,i)}}function Zc(i,e){if(gr(i))return null;e=e.toLowerCase();const t=Object.keys(i);let A=t.length,r;for(;A-- >0;)if(r=t[A],e===r.toLowerCase())return r;return null}const Ti=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Yc=i=>!zi(i)&&i!==Ti;function Io(){const{caseless:i,skipUndefined:e}=Yc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Zc(t,n)||n;xn(t[s])&&xn(r)?t[s]=Io(t[s],r):xn(r)?t[s]=Io({},r):Vi(r)?t[s]=r.slice():(!e||!zi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&Br(arguments[r],A);return t}const Jm=(i,e,t,{allOwnKeys:A}={})=>(Br(e,(r,n)=>{t&&sA(r)?Object.defineProperty(i,n,{value:Gc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),Zm=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Ym=(i,e,t,A)=>{i.prototype=Object.create(e.prototype,A),Object.defineProperty(i.prototype,"constructor",{value:i,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(i,"super",{value:e.prototype}),t&&Object.assign(i.prototype,t)},qm=(i,e,t,A)=>{let r,n,s;const o={};if(e=e||{},i==null)return e;do{for(r=Object.getOwnPropertyNames(i),n=r.length;n-- >0;)s=r[n],(!A||A(s,i,e))&&!o[s]&&(e[s]=i[s],o[s]=!0);i=t!==!1&&Ho(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},jm=(i,e,t)=>{i=String(i),(t===void 0||t>i.length)&&(t=i.length),t-=e.length;const A=i.indexOf(e,t);return A!==-1&&A===t},eg=i=>{if(!i)return null;if(Vi(i))return i;let e=i.length;if(!Jc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},tg=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Ho(Uint8Array)),Ag=(i,e)=>{const A=(i&&i[vn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},ig=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},rg=UA("HTMLFormElement"),ng=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),qc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),sg=UA("RegExp"),jc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};Br(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},og=i=>{jc(i,(e,t)=>{if(sA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(sA(A)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},ag=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Vi(i)?A(i):A(String(i).split(e)),t},lg=()=>{},cg=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function hg(i){return!!(i&&sA(i.append)&&i[$c]==="FormData"&&i[vn])}const ug=i=>{const e=new Array(10),t=(A,r)=>{if(wr(A)){if(e.indexOf(A)>=0)return;if(gr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Vi(A)?[]:{};return Br(A,(s,o)=>{const l=t(s,r+1);!zi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},pg=UA("AsyncFunction"),dg=i=>i&&(wr(i)||sA(i))&&sA(i.then)&&sA(i.catch),eh=((i,e)=>i?setImmediate:e?((t,A)=>(Ti.addEventListener("message",({source:r,data:n})=>{r===Ti&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),Ti.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",sA(Ti.postMessage)),fg=typeof queueMicrotask<"u"?queueMicrotask.bind(Ti):typeof process<"u"&&process.nextTick||eh,pe={isArray:Vi,isArrayBuffer:Xc,isBuffer:gr,isFormData:Vm,isArrayBufferView:Hm,isString:Im,isNumber:Jc,isBoolean:_m,isObject:wr,isPlainObject:xn,isEmptyObject:Dm,isReadableStream:Wm,isRequest:Rm,isResponse:Gm,isHeaders:$m,isUndefined:zi,isDate:Pm,isFile:km,isBlob:Nm,isRegExp:sg,isFunction:sA,isStream:Km,isURLSearchParams:zm,isTypedArray:tg,isFileList:Om,forEach:Br,merge:Io,extend:Jm,trim:Xm,stripBOM:Zm,inherits:Ym,toFlatObject:qm,kindOf:Tn,kindOfTest:UA,endsWith:jm,toArray:eg,forEachEntry:Ag,matchAll:ig,isHTMLForm:rg,hasOwnProperty:qc,hasOwnProp:qc,reduceDescriptors:jc,freezeMethods:og,toObjectSet:ag,toCamelCase:ng,noop:lg,toFiniteNumber:cg,findKey:Zc,global:Ti,isContextDefined:Yc,isSpecCompliantForm:hg,toJSONObject:ug,isAsyncFn:pg,isThenable:dg,setImmediate:eh,asap:fg,isIterable:i=>i!=null&&sA(i[vn])};let Ye=class Xd extends Error{static from(e,t,A,r,n,s){const o=new Xd(e.message,t||e.code,A,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),r&&(this.request=r),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:pe.toJSONObject(this.config),code:this.code,status:this.status}}};Ye.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ye.ERR_BAD_OPTION="ERR_BAD_OPTION",Ye.ECONNABORTED="ECONNABORTED",Ye.ETIMEDOUT="ETIMEDOUT",Ye.ERR_NETWORK="ERR_NETWORK",Ye.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ye.ERR_DEPRECATED="ERR_DEPRECATED",Ye.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ye.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ye.ERR_CANCELED="ERR_CANCELED",Ye.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ye.ERR_INVALID_URL="ERR_INVALID_URL";const mg=null;function _o(i){return pe.isPlainObject(i)||pe.isArray(i)}function th(i){return pe.endsWith(i,"[]")?i.slice(0,-2):i}function Ah(i,e,t){return i?i.concat(e).map(function(r,n){return r=th(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function gg(i){return pe.isArray(i)&&!i.some(_o)}const wg=pe.toFlatObject(pe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(i,e,t){if(!pe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=pe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,S){return!pe.isUndefined(S[T])});const A=t.metaTokens,r=t.visitor||h,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&pe.isSpecCompliantForm(e);if(!pe.isFunction(r))throw new TypeError("visitor must be a function");function c(F){if(F===null)return"";if(pe.isDate(F))return F.toISOString();if(pe.isBoolean(F))return F.toString();if(!l&&pe.isBlob(F))throw new Ye("Blob is not supported. Use a Buffer instead.");return pe.isArrayBuffer(F)||pe.isTypedArray(F)?l&&typeof Blob=="function"?new Blob([F]):Buffer.from(F):F}function h(F,T,S){let I=F;if(F&&!S&&typeof F=="object"){if(pe.endsWith(T,"{}"))T=A?T:T.slice(0,-2),F=JSON.stringify(F);else if(pe.isArray(F)&&gg(F)||(pe.isFileList(F)||pe.endsWith(T,"[]"))&&(I=pe.toArray(F)))return T=th(T),I.forEach(function(N,X){!(pe.isUndefined(N)||N===null)&&e.append(s===!0?Ah([T],X,n):s===null?T:T+"[]",c(N))}),!1}return _o(F)?!0:(e.append(Ah(S,T,n),c(F)),!1)}const g=[],v=Object.assign(wg,{defaultVisitor:h,convertValue:c,isVisitable:_o});function x(F,T){if(!pe.isUndefined(F)){if(g.indexOf(F)!==-1)throw Error("Circular reference detected in "+T.join("."));g.push(F),pe.forEach(F,function(I,Q){(!(pe.isUndefined(I)||I===null)&&r.call(e,I,pe.isString(Q)?Q.trim():Q,T,v))===!0&&x(I,T?T.concat(Q):[Q])}),g.pop()}}if(!pe.isObject(i))throw new TypeError("data must be an object");return x(i),e}function ih(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function Do(i,e){this._pairs=[],i&&Qn(i,this,e)}const rh=Do.prototype;rh.append=function(e,t){this._pairs.push([e,t])},rh.toString=function(e){const t=e?function(A){return e.call(this,A,ih)}:ih;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Bg(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function nh(i,e,t){if(!e)return i;const A=t&&t.encode||Bg,r=pe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=pe.isURLSearchParams(e)?e.toString():new Do(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class sh{constructor(){this.handlers=[]}use(e,t,A){return this.handlers.push({fulfilled:e,rejected:t,synchronous:A?A.synchronous:!1,runWhen:A?A.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){pe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const Po={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},yg={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Do,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},ko=typeof window<"u"&&typeof document<"u",No=typeof navigator=="object"&&navigator||void 0,Cg=ko&&(!No||["ReactNative","NativeScript","NS"].indexOf(No.product)<0),vg=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Tg=ko&&window.location.href||"http://localhost",Jt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ko,hasStandardBrowserEnv:Cg,hasStandardBrowserWebWorkerEnv:vg,navigator:No,origin:Tg},Symbol.toStringTag,{value:"Module"})),...yg};function bg(i,e){return Qn(i,new Jt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Jt.isNode&&pe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function xg(i){return pe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Qg(i){const e={},t=Object.keys(i);let A;const r=t.length;let n;for(A=0;A<r;A++)n=t[A],e[n]=i[n];return e}function oh(i){function e(t,A,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&pe.isArray(r)?r.length:s,l?(pe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!pe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&pe.isArray(r[s])&&(r[s]=Qg(r[s])),!o)}if(pe.isFormData(i)&&pe.isFunction(i.entries)){const t={};return pe.forEachEntry(i,(A,r)=>{e(xg(A),r,t,0)}),t}return null}function Fg(i,e,t){if(pe.isString(i))try{return(e||JSON.parse)(i),pe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const yr={transitional:Po,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=pe.isObject(e);if(n&&pe.isHTMLForm(e)&&(e=new FormData(e)),pe.isFormData(e))return r?JSON.stringify(oh(e)):e;if(pe.isArrayBuffer(e)||pe.isBuffer(e)||pe.isStream(e)||pe.isFile(e)||pe.isBlob(e)||pe.isReadableStream(e))return e;if(pe.isArrayBufferView(e))return e.buffer;if(pe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(A.indexOf("application/x-www-form-urlencoded")>-1)return bg(e,this.formSerializer).toString();if((o=pe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),Fg(e)):e}],transformResponse:[function(e){const t=this.transitional||yr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(pe.isResponse(e)||pe.isReadableStream(e))return e;if(e&&pe.isString(e)&&(A&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ye.from(o,Ye.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:Jt.classes.FormData,Blob:Jt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};pe.forEach(["delete","get","head","post","put","patch"],i=>{yr.headers[i]={}});const Ug=pe.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"]),Sg=i=>{const e={};let t,A,r;return i&&i.split(`
|
|
2
|
-
`).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),
|
|
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,...t){const A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[ah]=this[ah]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=Cr(s);A[o]||(Hg(r,s),A[o]=!0)}return pe.isArray(e)?e.forEach(n):n(e),this}};oA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),pe.reduceDescriptors(oA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),pe.freezeMethods(oA);function Ko(i,e){const t=this||yr,A=e||t,r=oA.from(A.headers);let n=A.data;return pe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function lh(i){return!!(i&&i.__CANCEL__)}let vr=class extends Ye{constructor(e,t,A){super(e??"canceled",Ye.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function ch(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Ye("Request failed with status code "+t.status,[Ye.ERR_BAD_REQUEST,Ye.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Ig(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function _g(i,e){i=i||10;const t=new Array(i),A=new Array(i);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),h=A[n];s||(s=c),t[r]=l,A[r]=c;let g=n,v=0;for(;g!==r;)v+=t[g++],g=g%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const x=h&&c-h;return x?Math.round(v*1e3/x):void 0}}function Dg(i,e){let t=0,A=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const h=Date.now(),g=h-t;g>=A?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-g)))},()=>r&&s(r)]}const Un=(i,e,t=3)=>{let A=0;const r=_g(50,250);return Dg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),h=s<=o;A=s;const g={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(g)},t)},hh=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},uh=i=>(...e)=>pe.asap(()=>i(...e)),Pg=Jt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Jt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Jt.origin),Jt.navigator&&/(msie|trident)/i.test(Jt.navigator.userAgent)):()=>!0,kg=Jt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];pe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),pe.isString(A)&&o.push(`path=${A}`),pe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),pe.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(i){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+i+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(i){this.write(i,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ng(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Og(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function ph(i,e,t){let A=!Ng(e);return i&&(A||t==!1)?Og(i,e):e}const dh=i=>i instanceof oA?{...i}:i;function bi(i,e){e=e||{};const t={};function A(c,h,g,v){return pe.isPlainObject(c)&&pe.isPlainObject(h)?pe.merge.call({caseless:v},c,h):pe.isPlainObject(h)?pe.merge({},h):pe.isArray(h)?h.slice():h}function r(c,h,g,v){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c,g,v)}else return A(c,h,g,v)}function n(c,h){if(!pe.isUndefined(h))return A(void 0,h)}function s(c,h){if(pe.isUndefined(h)){if(!pe.isUndefined(c))return A(void 0,c)}else return A(void 0,h)}function o(c,h,g){if(g in e)return A(c,h);if(g in i)return A(void 0,c)}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:(c,h,g)=>r(dh(c),dh(h),g,!0)};return pe.forEach(Object.keys({...i,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const g=pe.hasOwnProp(l,h)?l[h]:r,v=g(i[h],e[h],h);pe.isUndefined(v)&&g!==o||(t[h]=v)}),t}const fh=i=>{const e=bi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=oA.from(s),e.url=nh(ph(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),pe.isFormData(t)){if(Jt.hasStandardBrowserEnv||Jt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(pe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,g])=>{c.includes(h.toLowerCase())&&s.set(h,g)})}}if(Jt.hasStandardBrowserEnv&&(A&&pe.isFunction(A)&&(A=A(e)),A||A!==!1&&Pg(e.url))){const l=r&&n&&kg.read(n);l&&s.set(r,l)}return e},Kg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=fh(i);let n=r.data;const s=oA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,g,v,x,F;function T(){x&&x(),F&&F(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(r.method.toUpperCase(),r.url,!0),S.timeout=r.timeout;function I(){if(!S)return;const N=oA.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),H={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:i,request:S};ch(function(ne){t(ne),T()},function(ne){A(ne),T()},H),S=null}"onloadend"in S?S.onloadend=I:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(I)},S.onabort=function(){S&&(A(new Ye("Request aborted",Ye.ECONNABORTED,i,S)),S=null)},S.onerror=function(X){const H=X&&X.message?X.message:"Network Error",V=new Ye(H,Ye.ERR_NETWORK,i,S);V.event=X||null,A(V),S=null},S.ontimeout=function(){let X=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||Po;r.timeoutErrorMessage&&(X=r.timeoutErrorMessage),A(new Ye(X,H.clarifyTimeoutError?Ye.ETIMEDOUT:Ye.ECONNABORTED,i,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&pe.forEach(s.toJSON(),function(X,H){S.setRequestHeader(H,X)}),pe.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([v,F]=Un(c,!0),S.addEventListener("progress",v)),l&&S.upload&&([g,x]=Un(l),S.upload.addEventListener("progress",g),S.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(h=N=>{S&&(A(!N||N.type?new vr(null,i,S):N),S.abort(),S=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const Q=Ig(r.url);if(Q&&Jt.protocols.indexOf(Q)===-1){A(new Ye("Unsupported protocol "+Q+":",Ye.ERR_BAD_REQUEST,i));return}S.send(n||null)})},Vg=(i,e)=>{const{length:t}=i=i?i.filter(Boolean):[];if(e||t){let A=new AbortController,r;const n=function(c){if(!r){r=!0,o();const h=c instanceof Error?c:this.reason;A.abort(h instanceof Ye?h:new vr(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new Ye(`timeout of ${e}ms exceeded`,Ye.ETIMEDOUT))},e);const o=()=>{i&&(s&&clearTimeout(s),s=null,i.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),i=null)};i.forEach(c=>c.addEventListener("abort",n));const{signal:l}=A;return l.unsubscribe=()=>pe.asap(o),l}},zg=function*(i,e){let t=i.byteLength;if(t<e){yield i;return}let A=0,r;for(;A<t;)r=A+e,yield i.slice(A,r),A=r},Wg=async function*(i,e){for await(const t of Rg(i))yield*zg(t,e)},Rg=async function*(i){if(i[Symbol.asyncIterator]){yield*i;return}const e=i.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},mh=(i,e,t,A)=>{const r=Wg(i,e);let n=0,s,o=l=>{s||(s=!0,A&&A(l))};return new ReadableStream({async pull(l){try{const{done:c,value:h}=await r.next();if(c){o(),l.close();return}let g=h.byteLength;if(t){let v=n+=g;t(v)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},gh=64*1024,{isFunction:Sn}=pe,Gg=(({Request:i,Response:e})=>({Request:i,Response:e}))(pe.global),{ReadableStream:wh,TextEncoder:Bh}=pe.global,yh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},$g=i=>{i=pe.merge.call({skipUndefined:!0},Gg,i);const{fetch:e,Request:t,Response:A}=i,r=e?Sn(e):typeof fetch=="function",n=Sn(t),s=Sn(A);if(!r)return!1;const o=r&&Sn(wh),l=r&&(typeof Bh=="function"?(F=>T=>F.encode(T))(new Bh):async F=>new Uint8Array(await new t(F).arrayBuffer())),c=n&&o&&yh(()=>{let F=!1;const T=new t(Jt.origin,{body:new wh,method:"POST",get duplex(){return F=!0,"half"}}).headers.has("Content-Type");return F&&!T}),h=s&&o&&yh(()=>pe.isReadableStream(new A("").body)),g={stream:h&&(F=>F.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(F=>{!g[F]&&(g[F]=(T,S)=>{let I=T&&T[F];if(I)return I.call(T);throw new Ye(`Response type '${F}' is not supported`,Ye.ERR_NOT_SUPPORT,S)})});const v=async F=>{if(F==null)return 0;if(pe.isBlob(F))return F.size;if(pe.isSpecCompliantForm(F))return(await new t(Jt.origin,{method:"POST",body:F}).arrayBuffer()).byteLength;if(pe.isArrayBufferView(F)||pe.isArrayBuffer(F))return F.byteLength;if(pe.isURLSearchParams(F)&&(F=F+""),pe.isString(F))return(await l(F)).byteLength},x=async(F,T)=>{const S=pe.toFiniteNumber(F.getContentLength());return S??v(T)};return async F=>{let{url:T,method:S,data:I,signal:Q,cancelToken:N,timeout:X,onDownloadProgress:H,onUploadProgress:V,responseType:ne,headers:Z,withCredentials:re="same-origin",fetchOptions:R}=fh(F),oe=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let le=Vg([Q,N&&N.toAbortSignal()],X),ee=null;const fe=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let j;try{if(V&&c&&S!=="get"&&S!=="head"&&(j=await x(Z,I))!==0){let be=new t(T,{method:"POST",body:I,duplex:"half"}),xe;if(pe.isFormData(I)&&(xe=be.headers.get("content-type"))&&Z.setContentType(xe),be.body){const[me,ve]=hh(j,Un(uh(V)));I=mh(be.body,gh,me,ve)}}pe.isString(re)||(re=re?"include":"omit");const se=n&&"credentials"in t.prototype,Ae={...R,signal:le,method:S.toUpperCase(),headers:Z.normalize().toJSON(),body:I,duplex:"half",credentials:se?re:void 0};ee=n&&new t(T,Ae);let ue=await(n?oe(ee,R):oe(T,Ae));const ae=h&&(ne==="stream"||ne==="response");if(h&&(H||ae&&fe)){const be={};["status","statusText","headers"].forEach(Qe=>{be[Qe]=ue[Qe]});const xe=pe.toFiniteNumber(ue.headers.get("content-length")),[me,ve]=H&&hh(xe,Un(uh(H),!0))||[];ue=new A(mh(ue.body,gh,me,()=>{ve&&ve(),fe&&fe()}),be)}ne=ne||"text";let Be=await g[pe.findKey(g,ne)||"text"](ue,F);return!ae&&fe&&fe(),await new Promise((be,xe)=>{ch(be,xe,{data:Be,headers:oA.from(ue.headers),status:ue.status,statusText:ue.statusText,config:F,request:ee})})}catch(se){throw fe&&fe(),se&&se.name==="TypeError"&&/Load failed|fetch/i.test(se.message)?Object.assign(new Ye("Network Error",Ye.ERR_NETWORK,F,ee,se&&se.response),{cause:se.cause||se}):Ye.from(se,se&&se.code,F,ee,se&&se.response)}}},Xg=new Map,Ch=i=>{let e=i&&i.env||{};const{fetch:t,Request:A,Response:r}=e,n=[A,r,t];let s=n.length,o=s,l,c,h=Xg;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:$g(e)),h=c;return c};Ch();const Vo={http:mg,xhr:Kg,fetch:{get:Ch}};pe.forEach(Vo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const vh=i=>`- ${i}`,Jg=i=>pe.isFunction(i)||i===null||i===!1;function Zg(i,e){i=pe.isArray(i)?i:[i];const{length:t}=i;let A,r;const n={};for(let s=0;s<t;s++){A=i[s];let o;if(r=A,!Jg(A)&&(r=Vo[(o=String(A)).toLowerCase()],r===void 0))throw new Ye(`Unknown adapter '${o}'`);if(r&&(pe.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
4
|
-
`+s.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=bi(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&Ln.assertOptions(A,{silentJSONParsing:gA.transitional(gA.boolean),forcedJSONParsing:gA.transitional(gA.boolean),clarifyTimeoutError:gA.transitional(gA.boolean),legacyInterceptorReqResOrdering:gA.transitional(gA.boolean)},!1),r!=null&&(pe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:gA.function,serialize:gA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:gA.spelling("baseURL"),withXsrfToken:gA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&pe.merge(n.common,n[t.method]);n&&pe.forEach(["delete","get","head","post","put","patch","common"],F=>{delete n[F]}),t.headers=oA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;l=l&&T.synchronous;const S=t.transitional||Po;S&&S.legacyInterceptorReqResOrdering?o.unshift(T.fulfilled,T.rejected):o.push(T.fulfilled,T.rejected)});const c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let h,g=0,v;if(!l){const F=[bh.bind(this),void 0];for(F.unshift(...o),F.push(...c),v=F.length,h=Promise.resolve(t);g<v;)h=h.then(F[g++],F[g++]);return h}v=o.length;let x=t;for(;g<v;){const F=o[g++],T=o[g++];try{x=F(x)}catch(S){T.call(this,S);break}}try{h=bh.call(this,x)}catch(F){return Promise.reject(F)}for(g=0,v=c.length;g<v;)h=h.then(c[g++],c[g++]);return h}getUri(e){e=bi(this.defaults,e);const t=ph(e.baseURL,e.url,e.allowAbsoluteUrls);return nh(t,e.params,e.paramsSerializer)}};pe.forEach(["delete","get","head","options"],function(e){xi.prototype[e]=function(t,A){return this.request(bi(A||{},{method:e,url:t,data:(A||{}).data}))}}),pe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(bi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}xi.prototype[e]=t(),xi.prototype[e+"Form"]=t(!0)});let qg=class Jd{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const A=this;this.promise.then(r=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](r);A._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(r);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new vr(n,s,o),t(A.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 t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=A=>{e.abort(A)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Jd(function(r){e=r}),cancel:e}}};function jg(i){return function(t){return i.apply(null,t)}}function e1(i){return pe.isObject(i)&&i.isAxiosError===!0}const Wo={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(Wo).forEach(([i,e])=>{Wo[e]=i});function Fh(i){const e=new xi(i),t=Gc(xi.prototype.request,e);return pe.extend(t,xi.prototype,e,{allOwnKeys:!0}),pe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Fh(bi(i,r))},t}const gt=Fh(yr);gt.Axios=xi,gt.CanceledError=vr,gt.CancelToken=qg,gt.isCancel=lh,gt.VERSION=xh,gt.toFormData=Qn,gt.AxiosError=Ye,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=jg,gt.isAxiosError=e1,gt.mergeConfig=bi,gt.AxiosHeaders=oA,gt.formToJSON=i=>oh(pe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=Th.getAdapter,gt.HttpStatusCode=Wo,gt.default=gt;const{Axios:yb,AxiosError:Cb,CanceledError:vb,isCancel:Tb,CancelToken:bb,VERSION:xb,all:Qb,Cancel:Fb,isAxiosError:Ub,spread:Sb,toFormData:Eb,AxiosHeaders:Lb,HttpStatusCode:Mb,formToJSON:Hb,getAdapter:Ib,mergeConfig:_b}=gt,kA=Object.create(null);kA.open="0",kA.close="1",kA.ping="2",kA.pong="3",kA.message="4",kA.upgrade="5",kA.noop="6";const Mn=Object.create(null);Object.keys(kA).forEach(i=>{Mn[kA[i]]=i});const Ro={type:"error",data:"parser error"},Uh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Sh=typeof ArrayBuffer=="function",Eh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Go=({type:i,data:e},t,A)=>Uh&&e instanceof Blob?t?A(e):Lh(e,A):Sh&&(e instanceof ArrayBuffer||Eh(e))?t?A(e):Lh(new Blob([e]),A):A(kA[i]+(e||"")),Lh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function Mh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let $o;function t1(i,e){if(Uh&&i.data instanceof Blob)return i.data.arrayBuffer().then(Mh).then(e);if(Sh&&(i.data instanceof ArrayBuffer||Eh(i.data)))return e(Mh(i.data));Go(i,!1,t=>{$o||($o=new TextEncoder),e($o.encode(t))})}const Hh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<Hh.length;i++)Tr[Hh.charCodeAt(i)]=i;const A1=i=>{let e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(A=0;A<t;A+=4)n=Tr[i.charCodeAt(A)],s=Tr[i.charCodeAt(A+1)],o=Tr[i.charCodeAt(A+2)],l=Tr[i.charCodeAt(A+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},i1=typeof ArrayBuffer=="function",Xo=(i,e)=>{if(typeof i!="string")return{type:"message",data:Ih(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:r1(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:Ro},r1=(i,e)=>{if(i1){const t=A1(i);return Ih(t,e)}else return{base64:!0,data:i}},Ih=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,_h="",n1=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{Go(n,!1,o=>{A[s]=o,++r===t&&e(A.join(_h))})})},s1=(i,e)=>{const t=i.split(_h),A=[];for(let r=0;r<t.length;r++){const n=Xo(t[r],e);if(A.push(n),n.type==="error")break}return A};function o1(){return new TransformStream({transform(i,e){t1(i,t=>{const A=t.length;let r;if(A<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,A);else if(A<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}i.data&&typeof i.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Jo;function Hn(i){return i.reduce((e,t)=>e+t.length,0)}function In(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let A=0;for(let r=0;r<e;r++)t[r]=i[0][A++],A===i[0].length&&(i.shift(),A=0);return i.length&&A<i[0].length&&(i[0]=i[0].slice(A)),t}function a1(i,e){Jo||(Jo=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Ro);break}r=h*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Xo(n?l:Jo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Ro);break}}}})}const Dh=4;function Dt(i){if(i)return l1(i)}function l1(i){for(var e in Dt.prototype)i[e]=Dt.prototype[e];return i}Dt.prototype.on=Dt.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},Dt.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},Dt.prototype.off=Dt.prototype.removeListener=Dt.prototype.removeAllListeners=Dt.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var A,r=0;r<t.length;r++)if(A=t[r],A===e||A.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+i],this},Dt.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,r=t.length;A<r;++A)t[A].apply(this,e)}return this},Dt.prototype.emitReserved=Dt.prototype.emit,Dt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},Dt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),wA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),c1="arraybuffer";function Db(){}function Ph(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const h1=wA.setTimeout,u1=wA.clearTimeout;function Dn(i,e){e.useNativeTimers?(i.setTimeoutFn=h1.bind(wA),i.clearTimeoutFn=u1.bind(wA)):(i.setTimeoutFn=wA.setTimeout.bind(wA),i.clearTimeoutFn=wA.clearTimeout.bind(wA))}const p1=1.33;function d1(i){return typeof i=="string"?f1(i):Math.ceil((i.byteLength||i.size)*p1)}function f1(i){let e=0,t=0;for(let A=0,r=i.length;A<r;A++)e=i.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function kh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function m1(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function g1(i){let e={},t=i.split("&");for(let A=0,r=t.length;A<r;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class w1 extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Zo extends Dt{constructor(e){super(),this.writable=!1,Dn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,A){return super.emitReserved("error",new w1(e,t,A)),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 t=Xo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_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 t=m1(e);return t.length?"?"+t:""}}class B1 extends Zo{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let A=0;this._polling&&(A++,this.once("pollComplete",function(){--A||t()})),this.writable||(A++,this.once("drain",function(){--A||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=A=>{if(this.readyState==="opening"&&A.type==="open"&&this.onOpen(),A.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(A)};s1(e,this.socket.binaryType).forEach(t),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,n1(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=kh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Nh=!1;try{Nh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const y1=Nh;function C1(){}class v1 extends B1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends Dt{constructor(e,t,A){super(),this.createRequest=e,Dn(this,A),this._opts=A,this._method=A.method||"GET",this._uri=t,this._data=A.data!==void 0?A.data:null,this._create()}_create(){var e;const t=Ph(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.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=C1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.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(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Oh);else if(typeof addEventListener=="function"){const i="onpagehide"in wA?"pagehide":"unload";addEventListener(i,Oh,!1)}}function Oh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const T1=(function(){const i=Kh({xdomain:!1});return i&&i.responseType!==null})();class b1 extends v1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=T1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Kh,this.uri(),e)}}function Kh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||y1))return new XMLHttpRequest}catch{}if(!e)try{return new wA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Vh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class x1 extends Zo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Vh?{}:Ph(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(A.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,A)}catch(r){return this.emitReserved("error",r)}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 t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;Go(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&_n(()=>{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",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=kh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Yo=wA.WebSocket||wA.MozWebSocket;class Q1 extends x1{createSocket(e,t,A){return Vh?new Yo(e,t,A):t?new Yo(e,t):new Yo(e)}doWrite(e,t){this.ws.send(t)}}class F1 extends Zo{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 t=a1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=o1();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{A.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 t=0;t<e.length;t++){const A=e[t],r=t===e.length-1;this._writer.write(A).then(()=>{r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const U1={websocket:Q1,webtransport:F1,polling:b1},S1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,E1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function qo(i){if(i.length>8e3)throw"URI too long";const e=i,t=i.indexOf("["),A=i.indexOf("]");t!=-1&&A!=-1&&(i=i.substring(0,t)+i.substring(t,A).replace(/:/g,";")+i.substring(A,i.length));let r=S1.exec(i||""),n={},s=14;for(;s--;)n[E1[s]]=r[s]||"";return t!=-1&&A!=-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=L1(n,n.path),n.queryKey=M1(n,n.query),n}function L1(i,e){const t=/\/{2,9}/g,A=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&A.splice(0,1),e.slice(-1)=="/"&&A.splice(A.length-1,1),A}function M1(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const jo=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];jo&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class ni extends Dt{constructor(e,t){if(super(),this.binaryType=c1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const A=qo(e);t.hostname=A.host,t.secure=A.protocol==="https"||A.protocol==="wss",t.port=A.port,A.query&&(t.query=A.query)}else t.host&&(t.hostname=qo(t.host).host);Dn(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(A=>{const r=A.prototype.name;this.transports.push(r),this._transportsByName[r]=A}),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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=g1(this.opts.query)),jo&&(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"})},Pn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Dh,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ni.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 t=new Error("server error");t.code=e.data,this._onError(t);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 t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=d1(r)),A>0&&t>this._maxPayload)return this.writeBuffer.slice(0,A);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(ni.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,t){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(),jo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=Dh;class H1 extends ni{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 t=this.createTransport(e),A=!1;ni.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",g=>{if(!A)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ni.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function n(){A||(A=!0,h(),t.close(),t=null)}const s=g=>{const v=new Error("probe error: "+g);v.transport=t.name,n(),this.emitReserved("upgradeError",v)};function o(){s("transport closed")}function l(){s("socket closed")}function c(g){t&&g.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{A||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let A=0;A<e.length;A++)~this.transports.indexOf(e[A])&&t.push(e[A]);return t}}let I1=class extends H1{constructor(e,t={}){const A=typeof e=="object"?e:t;(!A.transports||A.transports&&typeof A.transports[0]=="string")&&(A.transports=(A.transports||["polling","websocket","webtransport"]).map(r=>U1[r]).filter(r=>!!r)),super(e,A)}};function _1(i,e="",t){let A=i;t=t||typeof location<"u"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(typeof t<"u"?i=t.protocol+"//"+i:i="https://"+i),A=qo(i)),A.port||(/^(http|ws)$/.test(A.protocol)?A.port="80":/^(http|ws)s$/.test(A.protocol)&&(A.port="443")),A.path=A.path||"/";const n=A.host.indexOf(":")!==-1?"["+A.host+"]":A.host;return A.id=A.protocol+"://"+n+":"+A.port+e,A.href=A.protocol+"://"+n+(t&&t.port===A.port?"":":"+A.port),A}const D1=typeof ArrayBuffer=="function",P1=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,zh=Object.prototype.toString,k1=typeof Blob=="function"||typeof Blob<"u"&&zh.call(Blob)==="[object BlobConstructor]",N1=typeof File=="function"||typeof File<"u"&&zh.call(File)==="[object FileConstructor]";function ea(i){return D1&&(i instanceof ArrayBuffer||P1(i))||k1&&i instanceof Blob||N1&&i instanceof File}function kn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(kn(i[t]))return!0;return!1}if(ea(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return kn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&kn(i[t]))return!0;return!1}function O1(i){const e=[],t=i.data,A=i;return A.data=ta(t,e),A.attachments=e.length,{packet:A,buffers:e}}function ta(i,e){if(!i)return i;if(ea(i)){const t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){const t=new Array(i.length);for(let A=0;A<i.length;A++)t[A]=ta(i[A],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){const t={};for(const A in i)Object.prototype.hasOwnProperty.call(i,A)&&(t[A]=ta(i[A],e));return t}return i}function K1(i,e){return i.data=Aa(i.data,e),delete i.attachments,i}function Aa(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Aa(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Aa(i[t],e));return i}const V1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ht;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(ht||(ht={}));class z1{constructor(e){this.replacer=e}encode(e){return(e.type===ht.EVENT||e.type===ht.ACK)&&kn(e)?this.encodeAsBinary({type:e.type===ht.EVENT?ht.BINARY_EVENT:ht.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ht.BINARY_EVENT||e.type===ht.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=O1(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class ia extends Dt{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const A=t.type===ht.BINARY_EVENT;A||t.type===ht.BINARY_ACK?(t.type=A?ht.EVENT:ht.ACK,this.reconstructor=new W1(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ea(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const A={type:Number(e.charAt(0))};if(ht[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ht.BINARY_EVENT||A.type===ht.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");A.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););A.nsp=e.substring(n,t)}else A.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}A.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(ia.isPayloadValid(A.type,n))A.data=n;else throw new Error("invalid payload")}return A}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ht.CONNECT:return Wh(t);case ht.DISCONNECT:return t===void 0;case ht.CONNECT_ERROR:return typeof t=="string"||Wh(t);case ht.EVENT:case ht.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&V1.indexOf(t[0])===-1);case ht.ACK:case ht.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class W1{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=K1(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Wh(i){return Object.prototype.toString.call(i)==="[object Object]"}const R1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ia,Encoder:z1,get PacketType(){return ht}},Symbol.toStringTag,{value:"Module"}));function SA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const G1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Rh extends Dt{constructor(e,t,A){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=t,A&&A.auth&&(this.auth=A.auth),this._opts=Object.assign({},A),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[SA(e,"open",this.onopen.bind(this)),SA(e,"packet",this.onpacket.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(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,...t){var A,r,n;if(G1.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ht.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,g=t.pop();this._registerAckCallback(h,g),s.id=h}const o=(r=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||r===void 0?void 0:r.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,t){var A;const r=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;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);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,r)=>{const n=(s,o)=>s?r(s):A(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const A={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),A.pending=!1,this._drainQueue())),this._queue.push(A),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.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:ht.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,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(A=>String(A.id)===e)){const A=this.acks[e];delete this.acks[e],A.withError&&A.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ht.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 ht.EVENT:case ht.BINARY_EVENT:this.onevent(e);break;case ht.ACK:case ht.BINARY_ACK:this.onack(e);break;case ht.DISCONNECT:this.ondisconnect();break;case ht.CONNECT_ERROR:this.destroy();const A=new Error(e.data.message);A.data=e.data.data,this.emitReserved("connect_error",A);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const A of t)A.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 t=this;let A=!1;return function(...r){A||(A=!0,t.packet({type:ht.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,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:ht.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 t=this._anyListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,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 t=this._anyOutgoingListeners;for(let A=0;A<t.length;A++)if(e===t[A])return t.splice(A,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const A of t)A.apply(this,e.data)}}}function Wi(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}Wi.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=(Math.floor(e*10)&1)==0?i-t:i+t}return Math.min(i,this.max)|0},Wi.prototype.reset=function(){this.attempts=0},Wi.prototype.setMin=function(i){this.ms=i},Wi.prototype.setMax=function(i){this.max=i},Wi.prototype.setJitter=function(i){this.jitter=i};class ra extends Dt{constructor(e,t){var A;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,Dn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((A=t.randomizationFactor)!==null&&A!==void 0?A:.5),this.backoff=new Wi({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||R1;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.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 t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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 I1(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=SA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=SA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),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(SA(e,"ping",this.onping.bind(this)),SA(e,"data",this.ondata.bind(this)),SA(e,"error",this.onerror.bind(this)),SA(e,"close",this.onclose.bind(this)),SA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let A=this.nsps[e];return A?this._autoConnect&&!A.active&&A.connect():(A=new Rh(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],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,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),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 t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const br={};function Nn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=_1(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=br[r]&&n in br[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new ra(A,e):(br[r]||(br[r]=new ra(A,e)),l=br[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Nn,{Manager:ra,Socket:Rh,io:Nn,connect:Nn});function na(i){if(!i)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(i,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(i).trim().replace(/\/+$/,"")}}let dA=na("http://localhost:8000");function Gh(i){const e=na(i);e&&e!==dA&&(dA=e,St&&(St.disconnect(),St.removeAllListeners(),St=null))}let St=null;function $1(){const i=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=i();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 t=Nn(dA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const r=i();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:dA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:dA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:dA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:dA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function sa(){const i=na(St?.io?.uri||null);return!St||St.io&&i&&dA&&i!==dA?(St&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:dA,wasConnected:St.connected,reason:"baseUrl changed"}),St.disconnect(),St.removeAllListeners(),St=null),St=$1()):St.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:St.id,connected:St.connected,baseUrl:dA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:St.id,baseUrl:dA}),St}function X1(i,e){const t=sa();return t.on(i,e),()=>t.off(i,e)}function J1(i,e){St&&St.off(i,e)}function Z1(i,e){sa().emit(i,e)}function Y1(){return St?St.connected?"connected":"connecting":"disconnected"}const On={getSocket:sa,on:X1,off:J1,emit:Z1,getStatus:Y1,setBaseUrl:Gh},q1={},$h=q.createContext(),Vt=()=>{const i=q.useContext($h);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},j1=({children:i,baseUrl:e,endpoints:t,accountId:A,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:$s&&$s.tagName.toUpperCase()==="SCRIPT"&&$s.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&q1?.VITE_BASE_URL)??"http://localhost:5002";On.setBaseUrl(l);const h={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},g=t?.params||{},[v,x]=q.useState(r||"BTC/USD"),[F,T]=q.useState(n||"M1"),[S,I]=q.useState([]),[Q,N]=q.useState(!0),[X,H]=q.useState([]),[V,ne]=q.useState(!1),[Z,re]=q.useState(1e5),[R,oe]=q.useState(null),[le,ee]=q.useState([]),[fe,j]=q.useState(!0),[se,Ae]=q.useState(!1),[ue,ae]=q.useState(!0),[Be,be]=q.useState("candles"),[xe,me]=q.useState(!1),[ve,Qe]=q.useState("dark"),[Ee,Me]=q.useState(null),[Ke,Re]=q.useState(!1),[$e,Ce]=q.useState(!1),[At,Fe]=q.useState(!1),[Ie,dt]=q.useState(!1),[lt,Xe]=q.useState(!1),[Pe,we]=q.useState(!1),[He,_e]=q.useState(!1),[Ge,qe]=q.useState(!1),[mt,Et]=q.useState(!1),[bA,ti]=q.useState(!1),[iA,hA]=q.useState([]),xA=q.useRef(null),GA=q.useRef(new Map),xt=q.useRef(null),Rt=1e3,vt=q.useCallback(async()=>{if(A)try{const Ue=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Ue)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Ue}`}});let nt=[];Array.isArray(ze.data)?nt=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(nt=ze.data.data);const Te=nt.filter(De=>De.closePrice===null||De.closePrice===void 0).map(De=>({id:De.id,ticket:23,symbol:De.symbol,type:De.type,volume:De.volume,openPrice:De.openPrice??De.price,stopLoss:De.stopLoss,takeProfit:De.takeProfit,comment:De.comment||"",status:"OPEN",swap:0,profit:De.profit||0,profitCurrency:"USD",time:new Date(De.openedAt||De.openAt||Date.now()).toLocaleTimeString(),openAt:De.openedAt||De.openAt,closeAt:De.closedAt||De.closeAt}));H(Te)}catch(Ue){console.error("❌ Error fetching orders:",Ue.response?.data||Ue.message),H([])}finally{ne(!1)}},[l,A]),it=q.useCallback((Ue,ze)=>!ze||!Ue.price||isNaN(ze)||isNaN(Ue.price)?Ue.profit||0:(Ue?.type?.toUpperCase()==="BUY"?ze-Ue.price:Ue.price-ze)*Ue.volume,[]),Ut=q.useCallback(async()=>{try{const Ue=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Ue)return;const ze=await gt.get(`${l}${h.account}`,{headers:{Authorization:`Bearer ${Ue}`}});if(ze.data&&ze.data.data){const nt=parseFloat(ze.data.data.balance);isNaN(nt)||re(nt)}}catch(Ue){console.error("❌ Error fetching user balance:",Ue.response?.data||Ue.message)}},[l]),Lt=q.useCallback(async()=>{if(A)try{const Ue=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Ue)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Ue}`}});let nt=[];Array.isArray(ze.data)?nt=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(nt=ze.data.data);const Te=nt.filter(De=>De.closePrice!==null&&De.closePrice!==void 0).map(De=>({id:De.id,ticket:23,symbol:De.symbol,type:De.type,volume:De.volume,openPrice:De.openPrice??De.price,closePrice:De.closePrice,stopLoss:De.stopLoss,takeProfit:De.takeProfit,profit:De.profit??De.profitLoss??0,profitCurrency:"USD",openAt:De.openedAt||De.openAt,closeAt:De.closedAt||De.closeAt,closeReason:De.closeReason||"",status:"CLOSED"}));hA(Te)}catch(Ue){console.error("❌ Error fetching history orders:",Ue.response?.data||Ue.message),hA([])}},[l,A]),Ii=q.useMemo(()=>{const Ue=Z,ze=X.reduce((ot,Bt)=>ot+Bt.volume*Bt.price*.01,0),nt=X.reduce((ot,Bt)=>{const Gt=S.find($A=>$A.symbol===Bt.symbol);if(Gt){const $A=Bt.type?.toUpperCase()==="BUY"?parseFloat(Gt.bid||0):parseFloat(Gt.ask||0);if($A&&$A>0&&!isNaN($A))return ot+it(Bt,$A)}return ot+(Bt.profit||0)},0),Te=Ue+nt,De=Te-ze,st=ze>0?Te/ze*100:0;return{balance:Ue,equity:Te,margin:ze,freeMargin:De,level:st.toFixed(2)}},[X,S,Z,it]);q.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(vt(),Ut(),Lt())},[vt,Ut,Lt,A]),q.useEffect(()=>{(async()=>{try{N(!0);const ze=h.symbols.includes("?")?`${l}${h.symbols}`:`${l}${h.symbols}`,nt=localStorage.getItem("token")??localStorage.getItem("authToken"),Te=await gt.get(ze,{headers:nt?{Authorization:`Bearer ${nt}`}:{}});let De=[];Array.isArray(Te.data)?De=Te.data:Te.data&&Te.data.data&&Array.isArray(Te.data.data)?De=Te.data.data:Te.data&&Te.data.prices&&Array.isArray(Te.data.prices)?De=Te.data.prices:Te.data&&Array.isArray(Te.data)&&(De=Te.data);const st=De.map(ot=>{const Bt=ot.symbol||ot.name||"",Gt=ot.category||null;return Bt&&(ot.bid!==void 0||ot.price!==void 0)?{symbol:Bt,bid:ot.bid??ot.price??0,ask:ot.ask??ot.price??0,change:ot.change??0,category:Gt}:{...ot,symbol:Bt,category:Gt}});st.length>0?(I(st),st.find(Bt=>Bt.symbol===v)||x(st[0].symbol)):I([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),I([])}finally{N(!1)}})()},[l,h.symbols]);const Ze=q.useCallback(()=>{const Ue=GA.current;if(Ue.size===0)return;const ze=new Map(Ue);Ue.clear(),I(nt=>nt.map(Te=>{const De=ze.get(Te.symbol);return De?{...Te,...De}:Te})),H(nt=>{let Te=!1;const De=nt.map(st=>{const ot=ze.get(st.symbol);if(!ot)return st;const Bt=st.type?.toUpperCase()==="BUY"?parseFloat(ot.bid||0):parseFloat(ot.ask||0);if(!Bt||isNaN(Bt)||Bt<=0)return st;const Gt=it(st,Bt);return Gt===st.profit?st:(Te=!0,{...st,profit:Gt})});return Te?De:nt})},[it]);q.useEffect(()=>{xA.current||(xA.current=On.getSocket());const Ue=xA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Ue.emit("joinUserRoom",{userId:Number(A)})},nt=()=>console.log("⚠️ TradingContext: Disconnected"),Te=st=>{st?.symbol&&(GA.current.set(st.symbol,st),xt.current||(xt.current=setTimeout(()=>{xt.current=null,Ze()},Rt)))},De=async st=>{if(st){if(st.newBalance!==void 0){const ot=parseFloat(st.newBalance);isNaN(ot)||re(ot)}if(window.notify){const ot=st.profitLoss||st.profit||0,Bt=ot>=0?`+${ot.toFixed(2)}`:ot.toFixed(2),Gt=st.symbol||"Trade",$A=st.reason||"Closed";window.notify(`Trade Closed: ${$A} | ${Gt} | P/L: ${Bt} USD`,ot>=0?"success":"error")}st.tradeId&&H(ot=>ot.filter(Bt=>Bt.id!==st.tradeId)),await vt(),await Ut()}};return Ue.on("connect",ze),Ue.on("disconnect",nt),Ue.on("priceUpdate",Te),Ue.on("tradeClosed",De),Ue.connected&&A&&Number.isFinite(Number(A))&&Ue.emit("joinUserRoom",{userId:Number(A)}),()=>{Ue.off("connect",ze),Ue.off("disconnect",nt),Ue.off("priceUpdate",Te),Ue.off("tradeClosed",De),xt.current&&(clearTimeout(xt.current),xt.current=null),GA.current.clear()}},[Ze,vt,Ut]),q.useEffect(()=>{try{const Ue=document.documentElement;if(!Ue)return;Ue.dataset.theme=ve}catch{}},[ve]);const ke=q.useMemo(()=>S.find(Ue=>Ue.symbol===v)||{bid:"0.00000",ask:"0.00000",change:0},[S,v]),rt=q.useMemo(()=>({selectedSymbol:v,setSelectedSymbol:x,selectedTimeframe:F,setSelectedTimeframe:T,symbols:S,setSymbols:I,symbolsLoading:Q,orders:X,setOrders:H,ordersLoading:V,fetchOrders:vt,fetchUserBalance:Ut,userBalance:Z,setUserBalance:re,accountSummary:Ii,currentSymbolData:ke,activeTool:R,setActiveTool:oe,chartObjects:le,setChartObjects:ee,showGrid:fe,setShowGrid:j,snapToGrid:se,setSnapToGrid:Ae,drawingsVisible:ue,setDrawingsVisible:ae,chartType:Be,setChartType:be,chartLocked:xe,setChartLocked:me,theme:ve,setTheme:Qe,candleColors:Ee,setCandleColors:Me,showTradeOrders:Ke,setShowTradeOrders:Re,showTradePosition:$e,setShowTradePosition:Ce,showTradeHistory:At,setShowTradeHistory:Fe,showSLTP:Ie,setShowSLTP:dt,showAskPrice:lt,setShowAskPrice:Xe,showChartControls:Pe,setShowChartControls:we,showTradeNotification:He,setShowTradeNotification:_e,showCrosshair:Ge,setShowCrosshair:qe,showOHLC:mt,setShowOHLC:Et,baseUrl:l,endpoints:h,endpointParams:g,accountId:A,isShow:bA,setIsShow:ti,historyOrders:iA,setHistoryOrders:hA,fetchHistoryOrders:Lt,indicators:s,indicatorSettings:o}),[v,F,S,Q,X,V,vt,Ut,Z,Ii,ke,R,le,fe,se,ue,Be,xe,ve,Ee,Ke,$e,At,Ie,lt,Pe,He,Ge,mt,l,h,g,bA,iA,Lt,s,o]);return a.jsx($h.Provider,{value:rt,children:i})};var Xh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jh=q.createContext&&q.createContext(Xh),ew=["attr","size","title"];function tw(i,e){if(i==null)return{};var t=Aw(i,e),A,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);for(r=0;r<n.length;r++)A=n[r],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(i,A)&&(t[A]=i[A])}return t}function Aw(i,e){if(i==null)return{};var t={};for(var A in i)if(Object.prototype.hasOwnProperty.call(i,A)){if(e.indexOf(A)>=0)continue;t[A]=i[A]}return t}function Kn(){return Kn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(i[A]=t[A])}return i},Kn.apply(this,arguments)}function Zh(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(i);e&&(A=A.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,A)}return t}function Vn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zh(Object(t),!0).forEach(function(A){iw(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Zh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function iw(i,e,t){return e=rw(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function rw(i){var e=nw(i,"string");return typeof e=="symbol"?e:e+""}function nw(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var A=t.call(i,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Yh(i){return i&&i.map((e,t)=>q.createElement(e.tag,Vn({key:t},e.attr),Yh(e.child)))}function eA(i){return e=>q.createElement(sw,Kn({attr:Vn({},i.attr)},e),Yh(i.child))}function sw(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=tw(i,ew),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),q.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&q.createElement("title",null,n),i.children)};return Jh!==void 0?q.createElement(Jh.Consumer,null,t=>e(t)):e(Xh)}function ow(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function aw(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function lw(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function cw(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function qh(i){return eA({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:[]}]})(i)}function hw(i){return eA({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:[]}]})(i)}function uw(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function pw(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function dw(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function fw(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const mw={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},jh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A,onExecuteTrade:r,forceParentExecution:n=!1})=>{const{theme:s,selectedSymbol:o,fetchOrders:l,baseUrl:c,endpoints:h}=Vt(),g=s==="light",[v,x]=q.useState("0.01"),[F,T]=q.useState(""),[S,I]=q.useState(!1),Q=g?"bg-slate-100":"bg-[#12161d]",N=g?"text-slate-700":"text-white",X=g?"hover:bg-slate-200":"hover:bg-[#1e2635]",H=ne=>{const Z=parseFloat(v)||.01,re=Math.max(.01,Z+ne);x(re.toFixed(2))},V=async ne=>{T("");const Z=ne,re=parseFloat(Z==="BUY"?e:i),R=parseFloat(v);if(!R||R<=0||isNaN(R)){T("Please enter a valid volume (minimum 0.01)");return}if(R<.01){T("Volume must be at least 0.01");return}if(!re||re<=0||isNaN(re)){T("Invalid price. Please refresh and try again.");return}const oe=localStorage.getItem("token")??localStorage.getItem("authToken");if(!oe){T("Please login to place trades");return}I(!0);const le=typeof o=="object"?o?.symbol:o;if(r){try{await Promise.resolve(r({symbol:le,type:Z,lotSize:R,entryPrice:re,stopLoss:null,takeProfit:null})),l&&l(),A&&A()}catch(fe){const j=fe?.message||"Trade execution failed";T(j)}finally{I(!1)}return}if(n){T("Trade handler not configured"),I(!1);return}const ee={accountId:t,symbol:le,type:Z,volume:R,openPrice:re,takeProfit:null,stopLoss:null};try{const fe=c||mw?.VITE_BASE_URL||"http://localhost:8000",j=h?.trades||"/api/trades",se=await gt.post(`${fe}${j}`,ee,{headers:{Authorization:`Bearer ${oe}`,"Content-Type":"application/json"}});if(se.status<200||se.status>=300){T(se.data?.message||`Failed to place trade (${se.status})`);return}l&&l(),A&&A()}catch(fe){const j=fe?.response?.data?.message||fe?.message||"Network error. Please try again.";T(j)}finally{I(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>V("SELL"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:i?Number(i).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${Q}`,children:[a.jsx("button",{type:"button",onClick:()=>H(-.01),className:`w-5 flex items-center justify-center ${N} ${X} transition-colors`,children:a.jsx(qh,{size:8})}),a.jsx("input",{type:"number",value:v,onChange:ne=>{const Z=ne.target.value;(Z===""||/^\d*\.?\d{0,2}$/.test(Z))&&x(Z)},onBlur:()=>{const ne=parseFloat(v);x(isNaN(ne)||ne<.01?"0.01":ne.toFixed(2))},className:`w-14 text-center focus:outline-none ${Q} ${N}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>H(.01),className:`w-5 flex items-center justify-center ${N} ${X} transition-colors`,children:a.jsx(hw,{size:8})})]}),a.jsxs("button",{onClick:()=>V("BUY"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),F&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:F})]})},gw={},eu=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:g,selectedTimeframe:v,setOrders:x,symbols:F,fetchOrders:T,theme:S,baseUrl:I,endpoints:Q}=Vt(),N=S==="light",X={getContractSpec:He=>{const _e=String(He||"").toUpperCase();return _e.includes("BTC")||_e.includes("ETH")||_e.includes("SOL")||_e.includes("XRP")||_e.includes("ADA")||_e.includes("DOGE")||_e.includes("BNB")||_e.includes("AVAX")||_e.includes("DOT")||_e.includes("LINK")||_e.endsWith("USDT")?{contractSize:1}:_e.includes("XAU")||_e.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:He,volume:_e})=>{const Ge=X.getContractSpec(He);return(parseFloat(_e)||0)*(Ge.contractSize||1)}},H=h||X,[V,ne]=q.useState("0.01"),[Z,re]=q.useState(""),[R,oe]=q.useState(""),[le,ee]=q.useState(""),[fe,j]=q.useState(!1),[se,Ae]=q.useState(null),[ue,ae]=q.useState(""),[Be,be]=q.useState(t||"BUY"),[xe,me]=q.useState(parseFloat(A)||0),[ve,Qe]=q.useState(parseFloat(r)||0),[Ee,Me]=q.useState("text-white"),[Ke,Re]=q.useState("text-white"),$e=q.useRef(parseFloat(A)||0),Ce=q.useRef(parseFloat(r)||0);q.useEffect(()=>{if(!i)return;const He=On.getSocket(),_e=qe=>{if(!(!qe||!qe.symbol)&&qe.symbol.toUpperCase()===g?.toUpperCase()){const mt=parseFloat(qe.bid)||0,Et=parseFloat(qe.ask)||0;mt>0&&(mt>$e.current?(Me("text-green-400"),setTimeout(()=>Me("text-white"),500)):mt<$e.current&&$e.current>0&&(Me("text-red-400"),setTimeout(()=>Me("text-white"),500)),me(mt),$e.current=mt),Et>0&&(Et>Ce.current?(Re("text-green-400"),setTimeout(()=>Re("text-white"),500)):Et<Ce.current&&Ce.current>0&&(Re("text-red-400"),setTimeout(()=>Re("text-white"),500)),Qe(Et),Ce.current=Et)}};He.on("priceUpdate",_e);const Ge=F.find(qe=>qe.symbol===g);if(Ge){const qe=parseFloat(Ge.bid)||0,mt=parseFloat(Ge.ask)||0;qe>0&&(me(qe),$e.current=qe),mt>0&&(Qe(mt),Ce.current=mt)}return()=>{He.off("priceUpdate",_e)}},[i,g,F]),q.useEffect(()=>{if(i){ne(o?String(o):"0.01"),re(""),oe(""),ee(""),ae(""),be(t||"BUY");const He=parseFloat(A)||0,_e=parseFloat(r)||0;He>0&&(me(He),$e.current=He),_e>0&&(Qe(_e),Ce.current=_e)}},[i,t,o]);const At=xe||0,Fe=ve||0,Ie=He=>{const _e=parseFloat(V)||.01,Ge=Math.max(.01,_e+He);ne(Ge.toFixed(2))},dt=He=>{const _e=parseFloat(Z)||0,Ge=parseFloat(Be==="BUY"?ve:xe)||0;if(!Ge){ae("Current price not available. Please wait...");return}let qe=_e+He;Be==="BUY"?qe=Math.max(1e-5,Math.min(qe,Ge-1e-5)):qe=Math.max(Ge+1e-5,qe),re(qe>0?qe.toFixed(5):""),ae("")},lt=He=>{const _e=parseFloat(R)||0,Ge=parseFloat(Be==="BUY"?ve:xe)||0;if(!Ge){ae("Current price not available. Please wait...");return}let qe=_e+He;Be==="BUY"?qe=Math.max(Ge+1e-5,qe):qe=Math.max(1e-5,Math.min(qe,Ge-1e-5)),oe(qe>0?qe.toFixed(5):""),ae("")},Xe=async He=>{ae("");const _e=He||Be,Ge=parseFloat(_e==="BUY"?ve:xe),qe=parseFloat(V),mt=Z?parseFloat(Z):null,Et=R?parseFloat(R):null;if(!qe||qe<=0||isNaN(qe)){ae("Please enter a valid volume (minimum 0.01)");return}if(qe<.01){ae("Volume must be at least 0.01");return}if(!Ge||Ge<=0||isNaN(Ge)){ae("Invalid price. Please refresh and try again.");return}if(mt!==null&&mt!==""){if(isNaN(mt)||mt<=0){ae("Stop Loss must be a valid positive number");return}if(_e==="BUY"&&mt>=Ge){ae("Stop Loss must be below the current price for BUY orders");return}if(_e==="SELL"&&mt<=Ge){ae("Stop Loss must be above the current price for SELL orders");return}}if(Et!==null&&Et!==""){if(isNaN(Et)||Et<=0){ae("Take Profit must be a valid positive number");return}if(_e==="BUY"){if(Et<=Ge){ae(`Take Profit must be above the entry price (${Ge.toFixed(5)}) for BUY orders`);return}}else if(_e==="SELL"&&Et>=Ge){ae(`Take Profit must be below the entry price (${Ge.toFixed(5)}) for SELL orders`);return}}be(_e),Ae(_e),j(!0);const bA=new Date,ti=bA.toLocaleTimeString(),iA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,hA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!hA){ae("Please login to place trades"),j(!1),Ae(null);return}const xA={accountId:s,symbol:g,type:_e,volume:qe,price:Ge,takeProfit:Et,stopLoss:mt,comment:le.trim()||null},GA={ticket:iA.substring(0,8),symbol:g,type:_e,volume:parseFloat(qe),price:parseFloat(Ge),time:ti,stopLoss:mt?parseFloat(mt):null,takeProfit:Et?parseFloat(Et):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:iA,status:"OPEN",openAt:bA.toISOString()};if(!l&&x&&x(xt=>[...xt,GA]),c&&!n){ae("Execution handler is required in forceParentExecution mode"),j(!1),Ae(null);return}if(n){j(!1),Ae(null),e();const xt={symbol:g,type:_e,lotSize:qe,entryPrice:Ge,stopLoss:mt,takeProfit:Et,comment:le.trim()||null};Promise.resolve(n(xt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),T&&T()}).catch(Rt=>{console.error("❌ Trade execution failed:",Rt),!l&&x&&x(vt=>vt.filter(it=>it.id!==iA))})}else{if(c){ae("Fallback API path disabled in forceParentExecution mode"),j(!1),Ae(null);return}j(!1),Ae(null),e();const xt=I||gw?.VITE_BASE_URL||"http://localhost:8000",Rt=Q?.trades||"/api/trades";gt.post(`${xt}${Rt}`,xA,{headers:{Authorization:`Bearer ${hA}`,"Content-Type":"application/json"}}).then(vt=>{if(vt.data&&vt.data.data){const it=vt.data.data.trade;!l&&x&&x(Ut=>Ut.map(Lt=>Lt.id===iA?{...Lt,id:it.id,ticket:it.id.substring(0,8),time:ti,openAt:it.openAt}:Lt)),console.log("✅ Trade saved successfully:",it),window.notify&&window.notify(`Trade placed successfully: ${it.symbol} ${it.type}`,"success")}else{!l&&x&&x(Ut=>Ut.filter(Lt=>Lt.id!==iA));const it=vt.data?.message||"Failed to place trade";window.notify&&window.notify(it,"error")}}).catch(vt=>{console.error("Error placing trade:",vt),!l&&x&&x(Ut=>Ut.filter(Lt=>Lt.id!==iA));let it="Failed to place trade";if(vt.response){const Ut=vt.response.status,Lt=vt.response.data;Ut===400?it=Lt?.message||"Invalid trade data. Please check your inputs.":Ut===401?it="Authentication failed. Please login again.":Ut===404?it=Lt?.message||"Symbol not found. Please select a valid symbol.":Ut===500?it="Server error. Please try again later.":it=Lt?.message||`Error: ${Ut}`}else vt.request&&(it="Network error. Please check your internet connection.");window.notify&&window.notify(it,"error")})}},we=(H?.calculateVolumeUnits?.({symbol:g,volume:parseFloat(V)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return i?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[ue&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:ue}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[we," ",g]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>Ie(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:V,onChange:He=>{const _e=He.target.value;(_e===""||/^\d*\.?\d{0,2}$/.test(_e))&&(ne(_e),ae(""))},onBlur:()=>{const He=parseFloat(V);ne(isNaN(He)||He<.01?"0.01":He.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"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"}),a.jsx("button",{type:"button",onClick:()=>Ie(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>dt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:Z,onChange:He=>{const _e=He.target.value;(_e===""||/^\d*\.?\d*$/.test(_e))&&(re(_e),ae(""))},onBlur:He=>{const _e=parseFloat(He.target.value);!isNaN(_e)&&_e>0?re(_e.toFixed(5)):He.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>dt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>lt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:R,onChange:He=>{const _e=He.target.value;(_e===""||/^\d*\.?\d*$/.test(_e))&&(oe(_e),ae(""))},onBlur:He=>{const _e=parseFloat(He.target.value);!isNaN(_e)&&_e>0?oe(_e.toFixed(5)):He.target.value===""&&oe("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>lt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:le,onChange:He=>ee(He.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 ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Ee} font-medium transition-colors duration-400`,children:At>0?At.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ke} font-medium transition-colors duration-400`,children:Fe>0?Fe.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>Xe("SELL"),disabled:fe,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:fe&&se==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.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"}),a.jsx("button",{onClick:()=>Xe("BUY"),disabled:fe,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:fe&&se==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.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},ww={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},Bw=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],si={width:"78%",height:"78%",display:"block"},tu={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function yw(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const Cw=()=>a.jsx(dw,{style:si}),vw=()=>a.jsx(fw,{style:si}),Tw=()=>a.jsx(cw,{style:si}),bw=()=>a.jsx(pw,{style:si}),xw=()=>a.jsx(aw,{style:si}),Qw=()=>a.jsx(ow,{style:si}),Fw=()=>a.jsx(lw,{style:si}),Uw=()=>a.jsx(qh,{style:si}),oa=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function xr({checked:i,onClick:e,hideLeftBorder:t,tokens:A,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,borderLeftWidth:t?0:1,background:i?A.activeFill:"transparent",color:i?A.activeText:A.text,cursor:"pointer",padding:0},children:a.jsx(oa,{size:"18px",children:r})})}function et({checked:i,onChange:e,label:t,tokens:A,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:i,onChange:n=>e(n.target.checked),disabled:r,style:tu}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Nt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:A,style:{...tu,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const g=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(g?`#${g}`:"")},onBlur:t,disabled:A,style:c})]})}function BA({tokens:i,disabled:e=!1,style:t={},...A}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?i.fieldDisabledBg:i.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?i.fieldDisabledBg:i.fieldBg,color:e?i.fieldDisabledText:i.text,...t},...A})}function Qi({value:i,onChange:e,tokens:t,disabled:A=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:i,onChange:e,disabled:A,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${A?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:A?t.fieldDisabledBg:t.fieldBg,color:A?t.fieldDisabledText:t.text,cursor:A?"default":"pointer",opacity:A?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(Uw,{})})]})}function Sw({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===zn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:zn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(et,{checked:A,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:zn.map(s=>a.jsx(et,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Ew({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Qi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Bw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(xr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(Tw,{})}),a.jsx(xr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(bw,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(xr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(xw,{})}),a.jsx(xr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Qw,{})}),a.jsx(xr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(Fw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(et,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(et,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Nt,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(BA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.borderEnabled,value:i.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!i.borderEnabled,value:i.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:i.borderWidth??1})]}),a.jsx(et,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(BA,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!i.bgEnabled,value:i.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:i.text||"",onChange:n=>A("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Wn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(et,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(et,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(et,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(et,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(et,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(et,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(et,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(et,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Lw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(et,{checked:i.showArea!==!1,onChange:n=>A("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(et,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(et,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(et,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(et,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Mw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(et,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(et,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(et,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(et,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(et,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(et,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Hw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(BA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Fi(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function Ui({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(BA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point2Time),style:n}),a.jsx(BA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Au({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(et,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(et,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Nt,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Qi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Qi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function Iw({draft:i,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(BA,{tokens:t,value:i.price??"",onChange:A=>{const r=Number(A.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function _w({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.originTime),style:r}),a.jsx(BA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Dw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(et,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function Pw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:t})]})})}function kw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#7aa6ae",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(et,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(et,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(et,{checked:!!i.statsShowAlways,onChange:n=>A("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(et,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(et,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Nw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(et,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(et,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function Ow({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:r}),a.jsx(BA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function iu({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(et,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(BA,{tokens:t,value:i.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&A("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(et,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Nt,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(et,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.rayRight,onChange:n=>A("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(et,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(et,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function ru({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(BA,{tokens:t,value:i.point1Price??"",onChange:s=>A("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point2Time),style:n}),a.jsx(BA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(BA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function Kw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||zn.map(t=>t.key)};if(i.type==="trendline"){const t=typeof i.series?.options=="function"?i.series.options():{};return{...e,lineColor:t.color??i.lineColor??"#22c55e",lineWidth:t.lineWidth??i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.point1?.price??0,point1Time:i.point1?.rawTime??i.point1?.time??0,point2Price:i.point2?.price??0,point2Time:i.point2?.rawTime??i.point2?.time??0}}return i.type==="text"?{...e,text:i.primitive?.text??i.text??"Text",color:i.primitive?.color??"#5f8f96",fontSize:i.primitive?.fontSize??12,fontWeight:i.primitive?.fontWeight??"normal",fontStyle:i.primitive?.fontStyle??"normal",textAlign:i.primitive?.textAlign??"center",textWrap:i.primitive?.textWrap??!1,borderEnabled:i.primitive?.borderEnabled??!1,borderColor:i.primitive?.borderColor??"#5f8f96",borderOpacity:i.primitive?.borderOpacity??.1,borderWidth:i.primitive?.borderWidth??1,bgEnabled:i.primitive?.bgEnabled??!1,bgColor:i.primitive?.bgColor??"#5f8f96",bgOpacity:i.primitive?.bgOpacity??.1,price:i.price}:i.type==="pricelevel"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price}:i.type==="horizontalray"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price,originTime:i.rawOriginTime??i.originTime}:i.type==="verticalline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showDate:i.showDate!==!1,rawTime:i.rawTime}:i.type==="infoline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!0,statsPriceRange:i.statsPriceRange??!0,statsBarsRange:i.statsBarsRange??!0,statsDateRange:i.statsDateRange??!0,statsAngle:i.statsAngle??!0,statsDistance:i.statsDistance??!0,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="arrowedline"?{...e,lineColor:i.lineColor??"#f59e0b",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight!==!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="rayline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="extendedline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft!==!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="crossline"?{...e,lineColor:i.lineColor??"#06a0e3",lineWidth:i.lineWidth??2,showTime:i.showTime??!1,showPrice:i.showPrice??!1,rawTime:i.p?.rawTime??0,price:i.p?.price??0}:i.type==="trendbyangle"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="disjointchannel"?{...e,lineColor:i.lineColor??"#129f5c",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#6aa84f",fillOpacity:i.fillOpacity??.1,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#129f5c",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="flattopbottom"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#3b82f6",fillOpacity:i.fillOpacity??.12,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#3b82f6",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="rulerline"?{...e,lineColor:i.lineColor??"#3b82f6",showArea:i.showArea!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways!==!1,statsPriceRange:i.statsPriceRange!==!1,statsBarsRange:i.statsBarsRange!==!1,statsDateRange:i.statsDateRange!==!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:e}const nu=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Vt(),s=yw(r==="light"),[o,l]=q.useState("style"),[c,h]=q.useState({}),[g,v]=q.useState(null),x=q.useRef(null),F=q.useRef(null);q.useEffect(()=>{t&&(h(Kw(t)),l("style"))},[t]),q.useEffect(()=>{i||v(null)},[i]);const T=H=>{if(H.button!==0)return;H.preventDefault();const V=x.current;if(!V)return;const ne=V.offsetParent,Z=ne?ne.getBoundingClientRect():{left:0,top:0},re=V.getBoundingClientRect(),R=re.left-Z.left,oe=re.top-Z.top;F.current={startMX:H.clientX,startMY:H.clientY,startX:R,startY:oe},v({x:R,y:oe});const le=fe=>{const{startMX:j,startMY:se,startX:Ae,startY:ue}=F.current;v({x:Ae+fe.clientX-j,y:ue+fe.clientY-se})},ee=()=>{F.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",ee)};if(!i||!t)return null;const S=ww[t.type]||t.type,I=["style","coordinates","visualization"],Q=()=>{if(o==="visualization")return a.jsx(Sw,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Ew,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Hw,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Au,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Iw,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Au,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(_w,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(Dw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Pw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Mw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(Lw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(Nw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ow,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(kw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(iu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ru,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(iu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(ru,{draft:c,setDraft:h,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{A(c),e()};return a.jsxs("div",{ref:x,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...g===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:g.y,left:g.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:T,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(oa,{size:"18px",children:a.jsx(Cw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(oa,{size:"20px",children:a.jsx(vw,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:I.map(H=>{const V=o===H;return a.jsxs("button",{type:"button",onClick:()=>l(H),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:V?s.text:s.mutedText,cursor:"pointer"},children:[H.charAt(0).toUpperCase()+H.slice(1),V&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},H)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:Q()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var aa=function(i,e){return aa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(t[r]=A[r])},aa(i,e)};function EA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");aa(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var la=function(){return la=Object.assign||function(e){for(var t,A=1,r=arguments.length;A<r;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},la.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(A.next(h))}catch(g){s(g)}}function l(h){try{c(A.throw(h))}catch(g){s(g)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Zt(i,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,r,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(c){return function(h){return l([c,h])}}function l(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(i,t)}catch(h){c=[6,h],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var YA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return YA.fromClientRect(i,e.getBoundingClientRect())},Vw=function(i){var e=i.body,t=i.documentElement;if(!e||!t)throw new Error("Unable to get document size");var A=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new YA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Ht=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<su.length;Xn++)zw[su.charCodeAt(Xn)]=Xn;for(var ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<ou.length;Jn++)Qr[ou.charCodeAt(Jn)]=Jn;for(var Ww=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Qr[i.charCodeAt(A)],s=Qr[i.charCodeAt(A+1)],o=Qr[i.charCodeAt(A+2)],l=Qr[i.charCodeAt(A+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},Rw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Gw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Si=5,ca=11,ha=2,$w=ca-Si,au=65536>>Si,Xw=1<<Si,ua=Xw-1,Jw=1024>>Si,Zw=au+Jw,Yw=Zw,qw=32,jw=Yw+qw,eB=65536>>ca,tB=1<<$w,AB=tB-1,lu=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},iB=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},rB=function(i,e){var t=Ww(i),A=Array.isArray(t)?Gw(t):new Uint32Array(t),r=Array.isArray(t)?Rw(t):new Uint16Array(t),n=24,s=lu(r,n/2,A[4]/2),o=A[5]===2?lu(r,(n+A[4])/2):iB(A,Math.ceil((n+A[4])/4));return new nB(A[0],A[1],A[2],A[3],s,o)},nB=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Si],t=(t<<ha)+(e&ua),this.data[t];if(e<=65535)return t=this.index[au+(e-55296>>Si)],t=(t<<ha)+(e&ua),this.data[t];if(e<this.highStart)return t=jw-eB+(e>>ca),t=this.index[t],t+=e>>Si&AB,t=this.index[t],t=(t<<ha)+(e&ua),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<cu.length;Zn++)sB[cu.charCodeAt(Zn)]=Zn;var oB="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==",hu=50,aB=1,uu=2,pu=3,lB=4,cB=5,du=7,fu=8,mu=9,oi=10,pa=11,gu=12,da=13,hB=14,Fr=15,fa=16,Yn=17,Ur=18,uB=19,wu=20,ma=21,Sr=22,ga=23,Ri=24,fA=25,Er=26,Lr=27,Gi=28,pB=29,Ei=30,dB=31,qn=32,jn=33,wa=34,Ba=35,ya=36,Mr=37,Ca=38,es=39,ts=40,va=41,Bu=42,fB=43,mB=[9001,65288],yu="!",ct="×",As="÷",Ta=rB(oB),qA=[Ei,ya],ba=[aB,uu,pu,cB],Cu=[oi,fu],vu=[Lr,Er],gB=ba.concat(Cu),Tu=[Ca,es,ts,wa,Ba],wB=[Fr,da],BB=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=Ta.get(n);if(o>hu?(r.push(!0),o-=hu):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(fa);if(o===lB||o===pa){if(s===0)return A.push(s),t.push(Ei);var l=t[s-1];return gB.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Ei))}if(A.push(s),o===dB)return t.push(e==="strict"?ma:Mr);if(o===Bu||o===pB)return t.push(Ei);if(o===fB)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Mr):t.push(Ei);t.push(o)}),[A,t,r]},xa=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==oi)break}if(r===oi)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==oi)break}if(o!==oi)break}return!1},bu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===oi)t--;else return A}return 0},yB=function(i,e,t,A,r){if(t[A]===0)return ct;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return ct;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,h=e[o];if(l===uu&&h===pu)return ct;if(ba.indexOf(l)!==-1)return yu;if(ba.indexOf(h)!==-1||Cu.indexOf(h)!==-1)return ct;if(bu(n,e)===fu)return As;if(Ta.get(i[n])===pa||(l===qn||l===jn)&&Ta.get(i[o])===pa||l===du||h===du||l===mu||[oi,da,Fr].indexOf(l)===-1&&h===mu||[Yn,Ur,uB,Ri,Gi].indexOf(h)!==-1||bu(n,e)===Sr||xa(ga,Sr,n,e)||xa([Yn,Ur],ma,n,e)||xa(gu,gu,n,e))return ct;if(l===oi)return As;if(l===ga||h===ga)return ct;if(h===fa||l===fa)return As;if([da,Fr,ma].indexOf(h)!==-1||l===hB||c===ya&&wB.indexOf(l)!==-1||l===Gi&&h===ya||h===wu||qA.indexOf(h)!==-1&&l===fA||qA.indexOf(l)!==-1&&h===fA||l===Lr&&[Mr,qn,jn].indexOf(h)!==-1||[Mr,qn,jn].indexOf(l)!==-1&&h===Er||qA.indexOf(l)!==-1&&vu.indexOf(h)!==-1||vu.indexOf(l)!==-1&&qA.indexOf(h)!==-1||[Lr,Er].indexOf(l)!==-1&&(h===fA||[Sr,Fr].indexOf(h)!==-1&&e[o+1]===fA)||[Sr,Fr].indexOf(l)!==-1&&h===fA||l===fA&&[fA,Gi,Ri].indexOf(h)!==-1)return ct;if([fA,Gi,Ri,Yn,Ur].indexOf(h)!==-1)for(var g=n;g>=0;){var v=e[g];if(v===fA)return ct;if([Gi,Ri].indexOf(v)!==-1)g--;else break}if([Lr,Er].indexOf(h)!==-1)for(var g=[Yn,Ur].indexOf(l)!==-1?s:n;g>=0;){var v=e[g];if(v===fA)return ct;if([Gi,Ri].indexOf(v)!==-1)g--;else break}if(Ca===l&&[Ca,es,wa,Ba].indexOf(h)!==-1||[es,wa].indexOf(l)!==-1&&[es,ts].indexOf(h)!==-1||[ts,Ba].indexOf(l)!==-1&&h===ts||Tu.indexOf(l)!==-1&&[wu,Er].indexOf(h)!==-1||Tu.indexOf(h)!==-1&&l===Lr||qA.indexOf(l)!==-1&&qA.indexOf(h)!==-1||l===Ri&&qA.indexOf(h)!==-1||qA.concat(fA).indexOf(l)!==-1&&h===Sr&&mB.indexOf(i[o])===-1||qA.concat(fA).indexOf(h)!==-1&&l===Ur)return ct;if(l===va&&h===va){for(var x=t[n],F=1;x>0&&(x--,e[x]===va);)F++;if(F%2!==0)return ct}return l===qn&&h===jn?ct:As},CB=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=BB(i,e.lineBreak),A=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[fA,Ei,Bu].indexOf(o)!==-1?Mr:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&i[l]>=19968&&i[l]<=40959}):void 0;return[A,r,s]},vB=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===yu,this.start=A,this.end=r}return i.prototype.slice=function(){return Ht.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),TB=function(i,e){var t=$n(i),A=CB(t,e),r=A[0],n=A[1],s=A[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=ct;c<o&&(h=yB(t,n,r,++c,s))===ct;);if(h!==ct||c===o){var g=new vB(t,h,l,c);return l=c,{value:g,done:!1}}return{done:!0,value:null}}}},bB=1,xB=2,Hr=4,xu=8,is=10,Qu=47,Ir=92,QB=9,FB=32,rs=34,_r=61,UB=35,SB=36,EB=37,ns=39,ss=40,Dr=41,LB=95,aA=45,MB=33,HB=60,IB=62,_B=64,DB=91,PB=93,kB=61,NB=123,os=63,OB=125,Fu=124,KB=126,VB=128,Uu=65533,Qa=42,Li=43,zB=44,WB=58,RB=59,Pr=46,GB=0,$B=8,XB=11,JB=14,ZB=31,YB=127,KA=-1,Su=48,Eu=97,Lu=101,qB=102,jB=117,e2=122,Mu=65,Hu=69,Iu=70,t2=85,A2=90,Yt=function(i){return i>=Su&&i<=57},i2=function(i){return i>=55296&&i<=57343},$i=function(i){return Yt(i)||i>=Mu&&i<=Iu||i>=Eu&&i<=qB},r2=function(i){return i>=Eu&&i<=e2},n2=function(i){return i>=Mu&&i<=A2},s2=function(i){return r2(i)||n2(i)},o2=function(i){return i>=VB},as=function(i){return i===is||i===QB||i===FB},ls=function(i){return s2(i)||o2(i)||i===LB},_u=function(i){return ls(i)||Yt(i)||i===aA},a2=function(i){return i>=GB&&i<=$B||i===XB||i>=JB&&i<=ZB||i===YB},ai=function(i,e){return i!==Ir?!1:e!==is},cs=function(i,e,t){return i===aA?ls(e)||ai(e,t):ls(i)?!0:!!(i===Ir&&ai(i,e))},Fa=function(i,e,t){return i===Li||i===aA?Yt(e)?!0:e===Pr&&Yt(t):Yt(i===Pr?e:i)},l2=function(i){var e=0,t=1;(i[e]===Li||i[e]===aA)&&(i[e]===aA&&(t=-1),e++);for(var A=[];Yt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Ht.apply(void 0,A),10):0;i[e]===Pr&&e++;for(var n=[];Yt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Ht.apply(void 0,n),10):0;(i[e]===Hu||i[e]===Lu)&&e++;var l=1;(i[e]===Li||i[e]===aA)&&(i[e]===aA&&(l=-1),e++);for(var c=[];Yt(i[e]);)c.push(i[e++]);var h=c.length?parseInt(Ht.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},c2={type:2},h2={type:3},u2={type:4},p2={type:13},d2={type:8},f2={type:21},m2={type:9},g2={type:10},w2={type:11},B2={type:12},y2={type:14},hs={type:23},C2={type:1},v2={type:25},T2={type:24},b2={type:26},x2={type:27},Q2={type:28},F2={type:29},U2={type:31},Ua={type:32},Du=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat($n(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ua;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rs:return this.consumeStringToken(rs);case UB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(_u(t)||ai(A,r)){var n=cs(t,A,r)?xB:bB,s=this.consumeName();return{type:5,value:s,flags:n}}break;case SB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),p2;break;case ns:return this.consumeStringToken(ns);case ss:return c2;case Dr:return h2;case Qa:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),y2;break;case Li:if(Fa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case zB:return u2;case aA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Fa(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===aA&&c===IB)return this.consumeCodePoint(),this.consumeCodePoint(),T2;break;case Pr:if(Fa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Qu:if(this.peekCodePoint(0)===Qa)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===Qa&&(h=this.consumeCodePoint(),h===Qu))return this.consumeToken();if(h===KA)return this.consumeToken()}break;case WB:return b2;case RB:return x2;case HB:if(this.peekCodePoint(0)===MB&&this.peekCodePoint(1)===aA&&this.peekCodePoint(2)===aA)return this.consumeCodePoint(),this.consumeCodePoint(),v2;break;case _B:var g=this.peekCodePoint(0),v=this.peekCodePoint(1),x=this.peekCodePoint(2);if(cs(g,v,x)){var s=this.consumeName();return{type:7,value:s}}break;case DB:return Q2;case Ir:if(ai(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case PB:return F2;case kB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),d2;break;case NB:return w2;case OB:return B2;case jB:case t2:var F=this.peekCodePoint(0),T=this.peekCodePoint(1);return F===Li&&($i(T)||T===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Fu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),m2;if(this.peekCodePoint(0)===Fu)return this.consumeCodePoint(),f2;break;case KB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),g2;break;case KA:return Ua}return as(e)?(this.consumeWhiteSpace(),U2):Yt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ht(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();$i(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?Su:l})),16),n=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?Iu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Ht.apply(void 0,e),16);if(this.peekCodePoint(0)===aA&&$i(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];$i(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Ht.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Dr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===KA||r===Dr)return{type:22,value:Ht.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Dr?(this.consumeCodePoint(),{type:22,value:Ht.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||a2(r))return this.consumeBadUrlRemnants(),hs;if(r===Ir)if(ai(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Dr||e===KA)return;ai(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Ht.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===KA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),C2;if(r===Ir){var n=this._value[A+1];n!==KA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):ai(r,n)&&(t+=this.consumeStringSlice(A),t+=Ht(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Hr,A=this.peekCodePoint(0);for((A===Li||A===aA)&&e.push(this.consumeCodePoint());Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Pr&&Yt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=xu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===Hu||A===Lu)&&((r===Li||r===aA)&&Yt(n)||Yt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=xu;Yt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[l2(e),t]},i.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(cs(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===EB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if($i(e)){for(var t=Ht(e);$i(this.peekCodePoint(0))&&t.length<6;)t+=Ht(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||i2(A)||A>1114111?Uu:A}return e===KA?Uu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(_u(t))e+=Ht(t);else if(ai(t,this.peekCodePoint(0)))e+=Ht(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),Pu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Du;return t.write(e),new i(t.read())},i.parseValue=function(e){return i.create(e).parseComponentValue()},i.parseValues=function(e){return i.create(e).parseComponentValues()},i.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 t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},i.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},i.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},i.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||E2(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},i.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var A=this.consumeToken();if(A.type===32||A.type===3)return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue())}},i.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ua:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),kr=function(i){return i.type===15},Xi=function(i){return i.type===17},wt=function(i){return i.type===20},S2=function(i){return i.type===0},Sa=function(i,e){return wt(i)&&i.value===e},ku=function(i){return i.type!==31},Ji=function(i){return i.type!==31&&i.type!==4},VA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},E2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},li=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||li(i)},Nu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},zt={type:17,number:0,flags:Hr},Ea={type:16,number:50,flags:Hr},ci={type:16,number:100,flags:Hr},Nr=function(i,e,t){var A=i[0],r=i[1];return[Tt(A,e),Tt(typeof r<"u"?r:A,t)]},Tt=function(i,e){if(i.type===16)return i.number/100*e;if(kr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Ou="deg",Ku="grad",Vu="rad",zu="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Ou:return Math.PI*e.number/180;case Ku:return Math.PI/200*e.number;case Vu:return e.number;case zu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Wu=function(i){return i.type===15&&(i.unit===Ou||i.unit===Ku||i.unit===Vu||i.unit===zu)},Ru=function(i){var e=i.filter(wt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[zt,zt];case"to top":case"bottom":return yA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[zt,ci];case"to right":case"left":return yA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ci,ci];case"to bottom":case"top":return yA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ci,zt];case"to left":case"right":return yA(270)}return 0},yA=function(i){return Math.PI*i/180},hi={name:"color",parse:function(i,e){if(e.type===18){var t=L2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(i,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return pi(parseInt(A+A,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return pi(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=jA[e.value.toUpperCase()];if(typeof o<"u")return o}return jA.TRANSPARENT}},ui=function(i){return(255&i)===0},Ot=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},pi=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Gu=function(i,e){if(i.type===17)return i.number;if(i.type===16){var t=e===3?1:255;return e===3?i.number/100*t:Math.round(i.number/100*t)}return 0},$u=function(i,e){var t=e.filter(Ji);if(t.length===3){var A=t.map(Gu),r=A[0],n=A[1],s=A[2];return pi(r,n,s,1)}if(t.length===4){var o=t.map(Gu),r=o[0],n=o[1],s=o[2],l=o[3];return pi(r,n,s,l)}return 0};function La(i,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-i)*t*6+i:t<1/2?e:t<2/3?(e-i)*6*(2/3-t)+i:i}var Xu=function(i,e){var t=e.filter(Ji),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?yA(A.number):us.parse(i,A))/(Math.PI*2),l=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,h=typeof s<"u"&&Pt(s)?Tt(s,1):1;if(l===0)return pi(c*255,c*255,c*255,1);var g=c<=.5?c*(l+1):c+l-c*l,v=c*2-g,x=La(v,g,o+1/3),F=La(v,g,o),T=La(v,g,o-1/3);return pi(x*255,F*255,T*255,h)},L2={hsl:Xu,hsla:Xu,rgb:$u,rgba:$u},Or=function(i,e){return hi.parse(i,Pu.create(e).parseComponentValue())},jA={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},M2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},H2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ps=function(i,e){var t=hi.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},Ju=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=zt),A.stop===null&&(A.stop=ci);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=Tt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var g=s-c,v=r[c-1],x=(h-v)/(g+1),F=1;F<=g;F++)r[c+F-1]=x*F;c=null}}return i.map(function(T,S){var I=T.color;return{color:I,stop:Math.max(Math.min(1,r[S]/e),0)}})},I2=function(i,e,t){var A=e/2,r=t/2,n=Tt(i[0],e)-A,s=r-Tt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},_2=function(i,e,t){var A=typeof i=="number"?i:I2(i,e,t),r=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=r/2,l=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},LA=function(i,e){return Math.sqrt(i*i+e*e)},Zu=function(i,e,t,A,r){var n=[[0,0],[0,e],[i,0],[i,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],h=LA(t-l,A-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},D2=function(i,e,t,A,r){var n=0,s=0;switch(i.size){case 0:i.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(i.shape===0)n=s=Math.min(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-A)),l=Zu(A,r,e,t,!0),c=l[0],h=l[1];n=LA(c-e,(h-t)/o),s=o*n}break;case 1:i.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-r)):i.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(i.shape===0)n=s=Math.max(LA(e,t),LA(e,t-r),LA(e-A,t),LA(e-A,t-r));else if(i.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-A)),g=Zu(A,r,e,t,!1),c=g[0],h=g[1];n=LA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=Tt(i.size[0],A),s=i.size.length===2?Tt(i.size[1],r):n),[n,s]},P2=function(i,e){var t=yA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Ru(r);return}else if(Wu(s)){t=us.parse(i,s);return}}var o=ps(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ds=function(i,e){var t=yA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Ru(r);return}else if(Wu(s)){t=(us.parse(i,s)+yA(270))%yA(360);return}}var o=ps(i,r);A.push(o)}),{angle:t,stops:A,type:1}},k2=function(i,e){var t=yA(180),A=[],r=1,n=0,s=3,o=[];return VA(e).forEach(function(l,c){var h=l[0];if(c===0){if(wt(h)&&h.value==="linear"){r=1;return}else if(wt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var g=hi.parse(i,h.values[0]);A.push({stop:zt,color:g})}else if(h.name==="to"){var g=hi.parse(i,h.values[0]);A.push({stop:ci,color:g})}else if(h.name==="color-stop"){var v=h.values.filter(Ji);if(v.length===2){var g=hi.parse(i,v[1]),x=v[0];Xi(x)&&A.push({stop:{type:16,number:x.number*100,flags:x.flags},color:g})}}}}),r===1?{angle:(t+yA(180))%yA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Yu="closest-side",qu="farthest-side",ju="closest-corner",ep="farthest-corner",tp="circle",Ap="ellipse",ip="cover",rp="contain",N2=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(g,v){if(c)if(wt(v))switch(v.value){case"center":return n.push(Ea),g;case"top":case"left":return n.push(zt),g;case"right":case"bottom":return n.push(ci),g}else(Pt(v)||li(v))&&n.push(v);else if(wt(v))switch(v.value){case tp:return t=0,!1;case Ap:return t=1,!1;case"at":return c=!0,!1;case Yu:return A=0,!1;case ip:case qu:return A=1,!1;case rp:case ju:return A=2,!1;case ep:return A=3,!1}else if(li(v)||Pt(v))return Array.isArray(A)||(A=[]),A.push(v),!1;return g},l)}if(l){var h=ps(i,s);r.push(h)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,g){if(wt(g))switch(g.value){case"center":return n.push(Ea),!1;case"top":case"left":return n.push(zt),!1;case"right":case"bottom":return n.push(ci),!1}else if(Pt(g)||li(g))return n.push(g),!1;return h},l):o===1&&(l=s.reduce(function(h,g){if(wt(g))switch(g.value){case tp:return t=0,!1;case Ap:return t=1,!1;case rp:case Yu:return A=0,!1;case qu:return A=1,!1;case ju:return A=2,!1;case ip:case ep:return A=3,!1}else if(li(g)||Pt(g))return Array.isArray(A)||(A=[]),A.push(g),!1;return h},l)),l){var c=ps(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},O2=function(i){return i.type===1},K2=function(i){return i.type===2},Ma={name:"image",parse:function(i,e){if(e.type===22){var t={url:e.value,type:0};return i.cache.addImage(e.value),t}if(e.type===18){var A=np[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(i,e.values)}throw new Error("Unsupported image type "+e.type)}};function V2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!np[i.name])}var np={"linear-gradient":P2,"-moz-linear-gradient":ds,"-ms-linear-gradient":ds,"-o-linear-gradient":ds,"-webkit-linear-gradient":ds,"radial-gradient":N2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":k2},z2={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return Ji(A)&&V2(A)}).map(function(A){return Ma.parse(i,A)})}},W2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(wt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},R2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return VA(e).map(function(t){return t.filter(Pt)}).map(Nu)}},G2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(wt).map(function(A){return A.value}).join(" ")}).map($2)}},$2=function(i){switch(i){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}},Zi;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Zi||(Zi={}));var X2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(J2)})}},J2=function(i){return wt(i)||Pt(i)},ms=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Z2=ms("top"),Y2=ms("right"),q2=ms("bottom"),j2=ms("left"),gs=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Nu(t.filter(Pt))}}},ey=gs("top-left"),ty=gs("top-right"),Ay=gs("bottom-right"),iy=gs("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},ry=ws("top"),ny=ws("right"),sy=ws("bottom"),oy=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return kr(t)?t.number:0}}},ay=Bs("top"),ly=Bs("right"),cy=Bs("bottom"),hy=Bs("left"),uy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},py={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},dy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).reduce(function(t,A){return t|fy(A.value)},0)}},fy=function(i){switch(i){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},my={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},gy={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(i,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ys;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ys||(ys={}));var wy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},By={name:"line-height",initialValue:"normal",prefix:!1,type:4},sp=function(i,e){return wt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?Tt(i,e):e},yy={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:Ma.parse(i,e)}},Cy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Ha={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(i,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}}},Cs=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},vy=Cs("top"),Ty=Cs("right"),by=Cs("bottom"),xy=Cs("left"),Qy={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},Fy={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},vs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Uy=vs("top"),Sy=vs("right"),Ey=vs("bottom"),Ly=vs("left"),My={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(i,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Hy={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(i,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Iy={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Sa(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:jA.TRANSPARENT,offsetX:zt,offsetY:zt,blur:zt},r=0,n=0;n<t.length;n++){var s=t[n];li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=hi.parse(i,s)}return A})}},_y={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Dy={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(i,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=Ny[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Py=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},ky=function(i){var e=i.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],A=e[1];e[2],e[3];var r=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?[t,A,r,n,s,o]:null},Ny={matrix:Py,matrix3d:ky},op={type:16,number:50,flags:Hr},Oy=[op,op],Ky={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?Oy:[t[0],t[1]]}},Vy={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Kr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Kr||(Kr={}));for(var zy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Kr.BREAK_ALL;case"keep-all":return Kr.KEEP_ALL;default:return Kr.NORMAL}}},Wy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Xi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},ap={name:"time",parse:function(i,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")}},Ry={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:1}},Gy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},$y={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(wt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Xy={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(i,e){var t=[],A=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},Jy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Zy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Xi(e)?e.number:wt(e)&&e.value==="bold"?700:400}},Yy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(wt).map(function(t){return t.value})}},qy={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},kt=function(i,e){return(i&e)!==0},jy={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(i,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},eC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],r=e.filter(ku),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Xi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},tC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(ku),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(wt(n)&&n.value!=="none"){var o=s&&Xi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},AC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(kr).map(function(t){return ap.parse(i,t)})}},iC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],r=e.filter(S2);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;A.push({open:s,close:o})}return A}},lp=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},rC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&Sa(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:255,offsetX:zt,offsetY:zt,blur:zt,spread:zt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Sa(s,"inset")?A.inset=!0:li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=hi.parse(i,s)}return A})}},nC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(wt).forEach(function(r){switch(r.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(r){A.indexOf(r)===-1&&A.push(r)}),A}},sC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},oC={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return kr(e)?e.number:0}},aC=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,AC,t.animationDuration),this.backgroundClip=Oe(e,M2,t.backgroundClip),this.backgroundColor=Oe(e,H2,t.backgroundColor),this.backgroundImage=Oe(e,z2,t.backgroundImage),this.backgroundOrigin=Oe(e,W2,t.backgroundOrigin),this.backgroundPosition=Oe(e,R2,t.backgroundPosition),this.backgroundRepeat=Oe(e,G2,t.backgroundRepeat),this.backgroundSize=Oe(e,X2,t.backgroundSize),this.borderTopColor=Oe(e,Z2,t.borderTopColor),this.borderRightColor=Oe(e,Y2,t.borderRightColor),this.borderBottomColor=Oe(e,q2,t.borderBottomColor),this.borderLeftColor=Oe(e,j2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,ey,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,ty,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,Ay,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,iy,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,ry,t.borderTopStyle),this.borderRightStyle=Oe(e,ny,t.borderRightStyle),this.borderBottomStyle=Oe(e,sy,t.borderBottomStyle),this.borderLeftStyle=Oe(e,oy,t.borderLeftStyle),this.borderTopWidth=Oe(e,ay,t.borderTopWidth),this.borderRightWidth=Oe(e,ly,t.borderRightWidth),this.borderBottomWidth=Oe(e,cy,t.borderBottomWidth),this.borderLeftWidth=Oe(e,hy,t.borderLeftWidth),this.boxShadow=Oe(e,rC,t.boxShadow),this.color=Oe(e,uy,t.color),this.direction=Oe(e,py,t.direction),this.display=Oe(e,dy,t.display),this.float=Oe(e,my,t.cssFloat),this.fontFamily=Oe(e,Xy,t.fontFamily),this.fontSize=Oe(e,Jy,t.fontSize),this.fontStyle=Oe(e,qy,t.fontStyle),this.fontVariant=Oe(e,Yy,t.fontVariant),this.fontWeight=Oe(e,Zy,t.fontWeight),this.letterSpacing=Oe(e,gy,t.letterSpacing),this.lineBreak=Oe(e,wy,t.lineBreak),this.lineHeight=Oe(e,By,t.lineHeight),this.listStyleImage=Oe(e,yy,t.listStyleImage),this.listStylePosition=Oe(e,Cy,t.listStylePosition),this.listStyleType=Oe(e,Ha,t.listStyleType),this.marginTop=Oe(e,vy,t.marginTop),this.marginRight=Oe(e,Ty,t.marginRight),this.marginBottom=Oe(e,by,t.marginBottom),this.marginLeft=Oe(e,xy,t.marginLeft),this.opacity=Oe(e,Ry,t.opacity);var n=Oe(e,Qy,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,Fy,t.overflowWrap),this.paddingTop=Oe(e,Uy,t.paddingTop),this.paddingRight=Oe(e,Sy,t.paddingRight),this.paddingBottom=Oe(e,Ey,t.paddingBottom),this.paddingLeft=Oe(e,Ly,t.paddingLeft),this.paintOrder=Oe(e,nC,t.paintOrder),this.position=Oe(e,Hy,t.position),this.textAlign=Oe(e,My,t.textAlign),this.textDecorationColor=Oe(e,Gy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,$y,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,Iy,t.textShadow),this.textTransform=Oe(e,_y,t.textTransform),this.transform=Oe(e,Dy,t.transform),this.transformOrigin=Oe(e,Ky,t.transformOrigin),this.visibility=Oe(e,Vy,t.visibility),this.webkitTextStrokeColor=Oe(e,sC,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,oC,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,zy,t.wordBreak),this.zIndex=Oe(e,Wy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return ui(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return kt(this.display,4)||kt(this.display,33554432)||kt(this.display,268435456)||kt(this.display,536870912)||kt(this.display,67108864)||kt(this.display,134217728)},i})(),lC=(function(){function i(e,t){this.content=Oe(e,jy,t.content),this.quotes=Oe(e,iC,t.quotes)}return i})(),cp=(function(){function i(e,t){this.counterIncrement=Oe(e,eC,t.counterIncrement),this.counterReset=Oe(e,tC,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new Du,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new Pu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,wt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return hi.parse(i,n.parseComponentValue());case"image":return Ma.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return li(o)?o:zt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:zt;case"time":return ap.parse(i,n.parseComponentValue())}break}},cC="data-html2canvas-debug",hC=function(i){var e=i.getAttribute(cC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Ia=function(i,e){var t=hC(i);return t===1||e===t},zA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Ia(t,3))debugger;this.styles=new aC(e,window.getComputedStyle(t,null)),Xa(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gn(this.context,t),Ia(t,4)&&(this.flags|=16)}return i})(),uC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Vr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<hp.length;Ts++)Vr[hp.charCodeAt(Ts)]=Ts;for(var pC=function(i){var e=i.length*.75,t=i.length,A,r=0,n,s,o,l;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Vr[i.charCodeAt(A)],s=Vr[i.charCodeAt(A+1)],o=Vr[i.charCodeAt(A+2)],l=Vr[i.charCodeAt(A+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},dC=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},fC=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Mi=5,_a=11,Da=2,mC=_a-Mi,up=65536>>Mi,gC=1<<Mi,Pa=gC-1,wC=1024>>Mi,BC=up+wC,yC=BC,CC=32,vC=yC+CC,TC=65536>>_a,bC=1<<mC,xC=bC-1,pp=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},QC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},FC=function(i,e){var t=pC(i),A=Array.isArray(t)?fC(t):new Uint32Array(t),r=Array.isArray(t)?dC(t):new Uint16Array(t),n=24,s=pp(r,n/2,A[4]/2),o=A[5]===2?pp(r,(n+A[4])/2):QC(A,Math.ceil((n+A[4])/4));return new UC(A[0],A[1],A[2],A[3],s,o)},UC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<Da)+(e&Pa),this.data[t];if(e<=65535)return t=this.index[up+(e-55296>>Mi)],t=(t<<Da)+(e&Pa),this.data[t];if(e<this.highStart)return t=vC-TC+(e>>_a),t=this.index[t],t+=e>>Mi&xC,t=this.index[t],t=(t<<Da)+(e&Pa),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),dp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",SC=typeof Uint8Array>"u"?[]:new Uint8Array(256),bs=0;bs<dp.length;bs++)SC[dp.charCodeAt(bs)]=bs;var EC=1,ka=2,Na=3,fp=4,mp=5,LC=7,gp=8,Oa=9,Ka=10,wp=11,Bp=12,yp=13,Cp=14,Va=15,MC=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},HC=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},IC=FC(uC),CA="×",za="÷",_C=function(i){return IC.get(i)},DC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===ka&&s===Na)return CA;if(n===ka||n===Na||n===fp||s===ka||s===Na||s===fp)return za;if(n===gp&&[gp,Oa,wp,Bp].indexOf(s)!==-1||(n===wp||n===Oa)&&(s===Oa||s===Ka)||(n===Bp||n===Ka)&&s===Ka||s===yp||s===mp||s===LC||n===EC)return CA;if(n===yp&&s===Cp){for(;r===mp;)r=e[--A];if(r===Cp)return CA}if(n===Va&&s===Va){for(var o=0;r===Va;)o++,r=e[--A];if(o%2===0)return CA}return za},PC=function(i){var e=MC(i),t=e.length,A=0,r=0,n=e.map(_C);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=CA;A<t&&(s=DC(e,n,++A))===CA;);if(s!==CA||A===t){var o=HC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},kC=function(i){for(var e=PC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},NC=function(i){var e=123;if(i.createRange){var t=i.createRange();if(t.getBoundingClientRect){var A=i.createElement("boundtest");A.style.height=e+"px",A.style.display="block",i.body.appendChild(A),t.selectNode(A);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(i.body.removeChild(A),n===e)return!0}}return!1},OC=function(i){var e=i.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",i.body.appendChild(e);var t=i.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Ht(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var g=h.x>s.x||h.y>s.y;return s=h,c===0?!0:g});return i.body.removeChild(e),o},KC=function(){return typeof new Image().crossOrigin<"u"},VC=function(){return typeof new XMLHttpRequest().responseType=="string"},zC=function(i){var e=new Image,t=i.createElement("canvas"),A=t.getContext("2d");if(!A)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{A.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},vp=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},WC=function(i){var e=i.createElement("canvas"),t=100;e.width=t,e.height=t;var A=e.getContext("2d");if(!A)return Promise.reject(!1);A.fillStyle="rgb(0, 255, 0)",A.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Wa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),Tp(s).then(function(o){A.drawImage(o,0,0);var l=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=i.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",vp(l)?Tp(Wa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),vp(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Wa=function(i,e,t,A,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",i.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},Tp=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Wt={get SUPPORT_RANGE_BOUNDS(){var i=NC(document);return Object.defineProperty(Wt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Wt.SUPPORT_RANGE_BOUNDS&&OC(document);return Object.defineProperty(Wt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=zC(document);return Object.defineProperty(Wt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?WC(document):Promise.resolve(!1);return Object.defineProperty(Wt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=KC();return Object.defineProperty(Wt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=VC();return Object.defineProperty(Wt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},zr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),RC=function(i,e,t,A){var r=XC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Wt.SUPPORT_RANGE_BOUNDS){var l=bp(A,s,o.length).getClientRects();if(l.length>1){var c=Ra(o),h=0;c.forEach(function(v){n.push(new zr(v,YA.fromDOMRectList(i,bp(A,h+s,v.length).getClientRects()))),h+=v.length})}else n.push(new zr(o,YA.fromDOMRectList(i,l)))}else{var g=A.splitText(o.length);n.push(new zr(o,GC(i,A))),A=g}else Wt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},GC=function(i,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(A,e);var n=Gn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return YA.EMPTY},bp=function(i,e,t){var A=i.ownerDocument;if(!A)throw new Error("Node has no owner document");var r=A.createRange();return r.setStart(i,e),r.setEnd(i,e+t),r},Ra=function(i){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return kC(i)},$C=function(i,e){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return ZC(i,e)},XC=function(i,e){return e.letterSpacing!==0?Ra(i):$C(i,e)},JC=[32,160,4961,65792,65793,4153,4241],ZC=function(i,e){for(var t=TB(i,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],r,n=function(){if(r.value){var s=r.value.slice(),o=$n(s),l="";o.forEach(function(c){JC.indexOf(c)===-1?l+=Ht(c):(l.length&&A.push(l),A.push(Ht(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},YC=(function(){function i(e,t,A){this.text=qC(t.data,A.textTransform),this.textBounds=RC(e,this.text,A,t)}return i})(),qC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(jC,ev);case 2:return i.toUpperCase();default:return i}},jC=/(^|\s|:|-|\(|\))([a-z])/g,ev=function(i,e,t){return i.length>0?e+t.toUpperCase():i},xp=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return e})(zA),Qp=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return e})(zA),Fp=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Gn(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})(zA),Up=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Ga=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.start=A.start,r.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,r}return e})(zA),tv=[{type:15,flags:0,unit:"px",number:3}],Av=[{type:16,flags:0,number:50}],iv=function(i){return i.width>i.height?new YA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new YA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},rv=function(i){var e=i.type===nv?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},xs="checkbox",Qs="radio",nv="password",Sp=707406591,$a=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;switch(r.type=A.type.toLowerCase(),r.checked=A.checked,r.value=rv(A),(r.type===xs||r.type===Qs)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=iv(r.bounds)),r.type){case xs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=tv;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Av;break}return r}return e})(zA),Ep=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return r.value=n&&n.text||"",r}return e})(zA),Lp=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Mp=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;r.src=A.src,r.width=parseInt(A.width,10)||0,r.height=parseInt(A.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){r.tree=Ip(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Or(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):jA.TRANSPARENT,s=A.contentWindow.document.body?Or(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):jA.TRANSPARENT;r.backgroundColor=ui(n)?ui(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(zA),sv=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,_p(r)&&r.data.trim().length>0)t.textNodes.push(new YC(i,r,t.styles));else if(Yi(r))if(Kp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=Hp(i,r);s.styles.isVisible()&&(ov(r,s,A)?s.flags|=4:av(s.styles)&&(s.flags|=2),sv.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Dp(r)&&!Es(r)&&Fs(i,r,s,A))}},Hp=function(i,e){return Za(e)?new xp(i,e):Pp(e)?new Qp(i,e):Dp(e)?new Fp(i,e):lv(e)?new Up(i,e):cv(e)?new Ga(i,e):hv(e)?new $a(i,e):Es(e)?new Ep(i,e):Ss(e)?new Lp(i,e):Np(e)?new Mp(i,e):new zA(i,e)},Ip=function(i,e){var t=Hp(i,e);return t.flags|=4,Fs(i,e,t,t),t},ov=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ja(i)&&t.styles.isTransparent()},av=function(i){return i.isPositioned()||i.isFloating()},_p=function(i){return i.nodeType===Node.TEXT_NODE},Yi=function(i){return i.nodeType===Node.ELEMENT_NODE},Xa=function(i){return Yi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},lv=function(i){return i.tagName==="LI"},cv=function(i){return i.tagName==="OL"},hv=function(i){return i.tagName==="INPUT"},uv=function(i){return i.tagName==="HTML"},Dp=function(i){return i.tagName==="svg"},Ja=function(i){return i.tagName==="BODY"},Pp=function(i){return i.tagName==="CANVAS"},kp=function(i){return i.tagName==="VIDEO"},Za=function(i){return i.tagName==="IMG"},Np=function(i){return i.tagName==="IFRAME"},Op=function(i){return i.tagName==="STYLE"},pv=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Kp=function(i){return i.tagName==="SLOT"},Vp=function(i){return i.tagName.indexOf("-")>0},dv=(function(){function i(){this.counters={}}return i.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},i.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},i.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},i.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var l=t.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&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},i})(),zp={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"]},Wp={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},fv={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},mv={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},qi=function(i,e,t,A,r,n){return i<e||i>t?Rr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Rp=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},It=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Rp(Math.abs(i),n,A,function(s){return Ht(Math.floor(s%n)+e)})+r)},Hi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Rp(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},ji=1,di=2,fi=4,Wr=8,ei=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Rr(i,4,r.length>0);var s=Math.abs(i),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&kt(n,ji)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&kt(n,di)||c===1&&l===1&&kt(n,fi)&&i>100||c===1&&l>1&&kt(n,Wr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(i<0?A:"")+o},Gp="十百千萬",$p="拾佰仟萬",Xp="マイナス",Ya="마이너스",Rr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=It(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Hi(i,"〇一二三四五六七八九",r);case 6:return qi(i,1,3999,zp,3,A).toLowerCase();case 7:return qi(i,1,3999,zp,3,A);case 8:return It(i,945,969,!1,A);case 9:return It(i,97,122,!1,A);case 10:return It(i,65,90,!1,A);case 11:return It(i,1632,1641,!0,A);case 12:case 49:return qi(i,1,9999,Wp,3,A);case 35:return qi(i,1,9999,Wp,3,A).toLowerCase();case 13:return It(i,2534,2543,!0,A);case 14:case 30:return It(i,6112,6121,!0,A);case 15:return Hi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Hi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ei(i,"零一二三四五六七八九",Gp,"負",r,di|fi|Wr);case 47:return ei(i,"零壹貳參肆伍陸柒捌玖",$p,"負",r,ji|di|fi|Wr);case 42:return ei(i,"零一二三四五六七八九",Gp,"负",r,di|fi|Wr);case 41:return ei(i,"零壹贰叁肆伍陆柒捌玖",$p,"负",r,ji|di|fi|Wr);case 26:return ei(i,"〇一二三四五六七八九","十百千万",Xp,r,0);case 25:return ei(i,"零壱弐参四伍六七八九","拾百千万",Xp,r,ji|di|fi);case 31:return ei(i,"영일이삼사오육칠팔구","십백천만",Ya,n,ji|di|fi);case 33:return ei(i,"零一二三四五六七八九","十百千萬",Ya,n,0);case 32:return ei(i,"零壹貳參四五六七八九","拾百千",Ya,n,ji|di|fi);case 18:return It(i,2406,2415,!0,A);case 20:return qi(i,1,19999,mv,3,A);case 21:return It(i,2790,2799,!0,A);case 22:return It(i,2662,2671,!0,A);case 22:return qi(i,1,10999,fv,3,A);case 23:return Hi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Hi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return It(i,3302,3311,!0,A);case 28:return Hi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Hi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return It(i,3792,3801,!0,A);case 37:return It(i,6160,6169,!0,A);case 38:return It(i,4160,4169,!0,A);case 39:return It(i,2918,2927,!0,A);case 40:return It(i,1776,1785,!0,A);case 43:return It(i,3046,3055,!0,A);case 44:return It(i,3174,3183,!0,A);case 45:return It(i,3664,3673,!0,A);case 46:return It(i,3872,3881,!0,A);default:return It(i,48,57,!0,A)}},Jp="data-html2canvas-ignore",Zp=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new dv,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return i.prototype.toIFrame=function(e,t){var A=this,r=gv(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=yv(r).then(function(){return tA(A,void 0,void 0,function(){var h,g;return Zt(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(bv),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,g=this.clonedReferenceElement,typeof g>"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:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Bv(l)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,g)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(vv(document.doctype)+"<html></html>"),Tv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(Ia(e,2))debugger;if(Pp(e))return this.createCanvasClone(e);if(kp(e))return this.createVideoClone(e);if(Op(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Za(t)&&(Za(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Vp(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return qa(e.style,t),t},i.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var A=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=A,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},i.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var A=e.ownerDocument.createElement("img");try{return A.src=e.toDataURL(),A}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t: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 r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},i.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var A=t.getContext("2d");try{return A&&(A.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||A.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},i.prototype.appendChildNode=function(e,t,A){(!Yi(t)||!pv(t)&&!t.hasAttribute(Jp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Yi(t)||!Op(t))&&e.appendChild(this.cloneNode(t,A))},i.prototype.cloneChildNodes=function(e,t,A){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Yi(n)&&Kp(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},i.prototype.cloneNode=function(e,t){if(_p(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Yi(e)&&(Xa(e)||Us(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&Xa(r)&&(this.clonedReferenceElement=r),Ja(r)&&Fv(r);var l=this.counters.parse(new cp(this.context,n)),c=this.resolvePseudoContent(e,r,s,Gr.BEFORE);Vp(e)&&(t=!0),kp(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Gr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||Us(e))&&!Np(e)||t)&&qa(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ss(e)||Es(e))&&(Ss(r)||Es(r))&&(r.value=e.value),r}return e.cloneNode(!1)},i.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||A.display==="none")){this.counters.parse(new cp(this.context,A));var l=new lC(this.context,A),c=o.createElement("html2canvaspseudoelement");qa(A,c),l.content.forEach(function(g){if(g.type===0)c.appendChild(o.createTextNode(g.value));else if(g.type===22){var v=o.createElement("img");v.src=g.value,v.style.opacity="1",c.appendChild(v)}else if(g.type===18){if(g.name==="attr"){var x=g.values.filter(wt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(g.name==="counter"){var F=g.values.filter(Ji),T=F[0],S=F[1];if(T&&wt(T)){var I=n.counters.getCounterValue(T.value),Q=S&&wt(S)?Ha.parse(n.context,S.value):3;c.appendChild(o.createTextNode(Rr(I,Q,!1)))}}else if(g.name==="counters"){var N=g.values.filter(Ji),T=N[0],X=N[1],S=N[2];if(T&&wt(T)){var H=n.counters.getCounterValues(T.value),V=S&&wt(S)?Ha.parse(n.context,S.value):3,ne=X&&X.type===0?X.value:"",Z=H.map(function(oe){return Rr(oe,V,!1)}).join(ne);c.appendChild(o.createTextNode(Z))}}}else if(g.type===20)switch(g.value){case"open-quote":c.appendChild(o.createTextNode(lp(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(lp(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(g.value))}}),c.className=ja+" "+el;var h=r===Gr.BEFORE?" "+ja:" "+el;return Us(t)?t.className.baseValue+=h:t.className+=h,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Gr;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Gr||(Gr={}));var gv=function(i,e){var t=i.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(Jp,"true"),i.body.appendChild(t),t},wv=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},Bv=function(i){return Promise.all([].slice.call(i.images,0).map(wv))},yv=function(i){return new Promise(function(e,t){var A=i.contentWindow;if(!A)return t("No window assigned for iframe");var r=A.document;A.onload=i.onload=function(){A.onload=i.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(i))},50)}})},Cv=["all","d","content"],qa=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);Cv.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},vv=function(i){var e="";return i&&(e+="<!DOCTYPE ",i.name&&(e+=i.name),i.internalSubset&&(e+=i.internalSubset),i.publicId&&(e+='"'+i.publicId+'"'),i.systemId&&(e+='"'+i.systemId+'"'),e+=">"),e},Tv=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},bv=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},xv=":before",Qv=":after",ja="___html2canvas___pseudoelement_before",el="___html2canvas___pseudoelement_after",Yp=`{
|
|
1
|
+
(function(it,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(it=typeof globalThis<"u"?globalThis:it||self,a(it.ChartSDK={},it.jsxRuntime,it.React))})(this,(function(it,a,Y){"use strict";var Ys=typeof document<"u"?document.currentScript:null;const qt="17:00-17:00",jt="America/New_York",OA="24x7",NA="UTC",bl={EURUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},ETHUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},BNBUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},SOLUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},ADAUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},XRPUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},DOTUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},MATICUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"},LINKUSDT:{type:"crypto",session:OA,sessionTZ:NA,priceMode:"last"}},xl={type:"forex",sessionTZ:jt,session:qt,priceMode:"mid"};function sr(A){return A&&bl[A.toUpperCase()]||xl}function An(A){return sr(A).type==="forex"}function rn(A){return sr(A).type==="crypto"}function uf(A){return sr(A).session==="24x7"}function te(A){if(A==null)return null;if(typeof A=="number"){if(Number.isNaN(A)||!Number.isFinite(A))return null;let e;A>1e10?e=A/1e3:(A<1e9,e=A);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof A=="string"){const e=Date.parse(A);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof A=="object"&&"year"in A&&"month"in A&&"day"in A){const t=new Date(Date.UTC(A.year,A.month-1,A.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function pf(A,e){if(!A||A.length<2)return[];const t=[],i=2;for(let r=1;r<A.length;r++){const n=A[r-1].time,s=A[r].time,o=s-n;o>e*i&&t.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 t}function df(A,e="America/New_York"){const t=new Date(A*1e3),i=new Date(t.toLocaleString("en-US",{timeZone:e})),r=i.getDay();return!(r===0||r===6||r===5&&i.getHours()>=17)}function Ql(A){return Array.isArray(A)?A.map(e=>({...e,time:te(e.time)})).filter(e=>e.time!=null):[]}function ff(A){if(!A||A.length<2)return!0;for(let e=1;e<A.length;e++)if(A[e].time<=A[e-1].time)return!1;return!0}function Re(A,e){return!Number.isFinite(A)||!Number.isFinite(e)||e<=0?A:Math.floor(A/e)*e}function Fl(A){if(!A||typeof A!="object")return!1;const{time:e,open:t,high:i,low:r,close:n,volume:s}=A;return!(te(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof i!="number"||!Number.isFinite(i)||typeof r!="number"||!Number.isFinite(r)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||i<t||i<n||i<r||r>t||r>n||r>i||t<=0||i<=0||r<=0||n<=0)}function Ul(A){const e=s=>Math.round(s*1e5)/1e5;let t=e(A.open),i=e(A.high),r=e(A.low),n=e(A.close);return i=Math.max(i,t,n,r),r=Math.min(r,t,n,i),{...A,open:t,high:i,low:r,close:n,volume:A.volume!=null?Math.round(A.volume):A.volume}}function Sl(A){if(!Array.isArray(A)||A.length===0)return[];const e=new Map;return A.forEach(t=>{const i=te(t.time);if(i!=null)if(e.has(i)){const r=e.get(i);e.set(i,{...t,time:i,open:t.open,high:Math.max(r.high,t.high),low:Math.min(r.low,t.low),close:t.close,volume:(r.volume||0)+(t.volume||0)})}else e.set(i,{...t,time:i})}),Array.from(e.values())}function gf(A,e){if(!Array.isArray(A)||A.length===0)return A;const t=[],i=Math.max(e*10080,604800),r=1e4;for(let o=0;o<A.length;o++)if(t.push(A[o]),o<A.length-1){const l=A[o].time,c=A[o+1].time,h=c-l;if(h>i&&((h/3600).toFixed(1),(i/3600).toFixed(1)),h>e&&h<=i){const m=A[o];let v=l+e,x=0;for(v=Re(v,e);v<c&&x<r;){const F=Re(v,e);t.some(S=>S.time===F)||(t.push({time:F,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),x++),v+=e}if(v<c&&x>=r){const F=Re(c-e,e);t.some(S=>S.time===F)||t.push({time:F,open:m.close,high:m.close,low:m.close,close:m.close,volume:0})}}}t.sort((o,l)=>o.time-l.time);const n=[],s=new Set;for(const o of t)s.has(o.time)||(s.add(o.time),n.push(o));return n}function BA(A){if(!A||typeof A!="string")return 60;const e=A.toUpperCase();if(e==="MN")return 2592e3;let t=e.match(/^([MHDW])(\d+)$/);if(t){const i=t[1];return parseInt(t[2],10)*({M:60,H:3600,D:86400,W:604800}[i]||60)}if(t=A.match(/^(\d+)([mhdwy])$/i),t){const i=parseInt(t[1],10),r=t[2].toLowerCase();return i*({m:60,h:3600,d:86400,w:604800,y:31536e3}[r]||60)}return 60}function El(A,e,t){if(!Array.isArray(A)||A.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const i=sr(e),r=BA(t),o=Ql(A).map(Q=>({...Q,time:Re(Q.time,r)})).filter(Q=>Fl(Q)).map(Q=>Ul(Q)),l=Sl(o);l.sort((Q,N)=>Q.time-N.time);const c=Math.floor(Date.now()/1e3),h=l.filter(Q=>Q.time<=c),v=h.filter((Q,N)=>N===0?!0:Q.time>h[N-1].time),x=Sl(v);x.sort((Q,N)=>Q.time-N.time);const F=gf(x,r),T=[];for(let Q=1;Q<F.length;Q++){const N=F[Q].time-F[Q-1].time;N>r*2&&T.push({from:F[Q-1].time,to:F[Q].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(F[Q-1].time*1e3).toISOString(),toDate:new Date(F[Q].time*1e3).toISOString()})}const S=v.filter((Q,N)=>N===0?!1:Q.close===v[N-1].close&&Q.open===v[N-1].close).length,I={original:A.length,processed:F.length,duplicates:A.length-l.length,outliers:S,gaps:T,filledGaps:F.length-x.length,symbolConfig:i};return{candles:F,stats:I}}function Ll(A,e,t="1m"){if(!A||!e||!Fl(A))return null;const i=te(A.time);if(i==null)return null;const r=BA(t),n=Re(i,r);return Ul({...A,time:n})}function Ml(A,e=20,t=2){if(!A||A.length<e)return null;const i=[],r=[],n=[];for(let s=e-1;s<A.length;s++){let o=0;for(let v=s-e+1;v<=s;v++)o+=A[v].close;const l=o/e;let c=0;for(let v=s-e+1;v<=s;v++){const x=A[v].close-l;c+=x*x}const h=Math.sqrt(c/e),m=A[s].time;r.push({time:m,value:l}),i.push({time:m,value:l+t*h}),n.push({time:m,value:l-t*h})}return{upper:i,middle:r,lower:n}}function qs(A,e=20,t=2){if(!A||A.length<e)return null;const i=A.slice(-e);let r=0;for(let c=0;c<i.length;c++)r+=i[c].close;const n=r/e;let s=0;for(let c=0;c<i.length;c++){const h=i[c].close-n;s+=h*h}const o=Math.sqrt(s/e);return{time:A[A.length-1].time,upper:n+t*o,middle:n,lower:n-t*o}}function Ft(A){var e=A.width,t=A.height;if(e<0)throw new Error("Negative width is not allowed for Size");if(t<0)throw new Error("Negative height is not allowed for Size");return{width:e,height:t}}function Ti(A,e){return A.width===e.width&&A.height===e.height}var mf=(function(){function A(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return A.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(A.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),A.prototype.subscribe=function(e){var t=this,i={next:e};return this._observers.push(i),{unsubscribe:function(){t._observers=t._observers.filter(function(r){return r!==i})}}},A.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)},A.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},A.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},A.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},A})();function wf(A){return new mf(A)}var Bf=(function(){function A(e,t,i){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=Ft({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(r=i?.allowResizeObserver)!==null&&r!==void 0?r:!0,this._chooseAndInitObserver()}return A.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw new Error("Object is disposed");(e=this._canvasElementResizeObserver)===null||e===void 0||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)===null||t===void 0||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(A.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"bitmapSize",{get:function(){return Ft({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),A.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=Ft(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},A.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},A.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(A.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),A.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},A.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},A.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},A.prototype._resizeBitmap=function(e){var t=this.bitmapSize;Ti(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},A.prototype._emitBitmapSizeChanged=function(e,t){var i=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(i,e,t)})},A.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,i=Ft(this._transformBitmapSize(e,this._canvasElementClientSize)),r=Ti(this.bitmapSize,i)?null:i;t===null&&r===null||t!==null&&r!==null&&Ti(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},A.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var i=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(i,e,t)})},A.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}Cf().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},A.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Hl(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=wf(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},A.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var i=Hl(this._canvasElement);if(i!==null){var r=(t=(e=this._devicePixelRatioObservable)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:i.devicePixelRatio,n=this._canvasElement.getClientRects(),s=n[0]!==void 0?vf(n[0],r):Ft({width:this._canvasElementClientSize.width*r,height:this._canvasElementClientSize.height*r});this._suggestNewBitmapSize(s)}}},A.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var i=t.find(function(s){return s.target===e._canvasElement});if(!(!i||!i.devicePixelContentBoxSize||!i.devicePixelContentBoxSize[0])){var r=i.devicePixelContentBoxSize[0],n=Ft({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},A})();function yf(A,e){return new Bf(A,e.transform,e.options)}function Hl(A){return A.ownerDocument.defaultView}function Cf(){return new Promise(function(A){var e=new ResizeObserver(function(t){A(t.every(function(i){return"devicePixelContentBoxSize"in i})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function vf(A,e){return Ft({width:Math.round(A.left*e+A.width*e)-Math.round(A.left*e),height:Math.round(A.top*e+A.height*e)-Math.round(A.top*e)})}var Tf=(function(){function A(e,t,i){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,i.width===0||i.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=i,this._context=e}return A.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()}},A.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(A.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(A.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),A})();function bi(A,e){var t=A.canvasElementClientSize;if(t.width===0||t.height===0)return null;var i=A.bitmapSize;if(i.width===0||i.height===0)return null;var r=A.canvasElement.getContext("2d",e);return r===null?null:new Tf(r,t,i)}const bf={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},xf={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qf={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Ff={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},Uf={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},Sf={color:"#26a69a",base:0},Il={color:"#2196f3"},Pl={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 Dl,_l;function xi(A,e){const t={0:[],1:[A.lineWidth,A.lineWidth],2:[2*A.lineWidth,2*A.lineWidth],3:[6*A.lineWidth,6*A.lineWidth],4:[A.lineWidth,4*A.lineWidth]}[e];A.setLineDash(t)}function kl(A,e,t,i){A.beginPath();const r=A.lineWidth%2?.5:0;A.moveTo(t,e+r),A.lineTo(i,e+r),A.stroke()}function ai(A,e){if(!A)throw new Error("Assertion failed"+(e?": "+e:""))}function rA(A){if(A===void 0)throw new Error("Value is undefined");return A}function Fe(A){if(A===null)throw new Error("Value is null");return A}function ki(A){return Fe(rA(A))}(function(A){A[A.Simple=0]="Simple",A[A.WithSteps=1]="WithSteps",A[A.Curved=2]="Curved"})(Dl||(Dl={})),(function(A){A[A.Solid=0]="Solid",A[A.Dotted=1]="Dotted",A[A.Dashed=2]="Dashed",A[A.LargeDashed=3]="LargeDashed",A[A.SparseDotted=4]="SparseDotted"})(_l||(_l={}));const Ol={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(A){return A<0?0:A>255?255:Math.round(A)||0}function Nl(A){return A<=0||A>1?Math.min(Math.max(A,0),1):Math.round(1e4*A)/1e4}const Ef=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Lf=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Mf=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Hf=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function or(A){(A=A.toLowerCase())in Ol&&(A=Ol[A]);{const e=Hf.exec(A)||Mf.exec(A);if(e)return[vA(parseInt(e[1],10)),vA(parseInt(e[2],10)),vA(parseInt(e[3],10)),Nl(e.length<5?1:parseFloat(e[4]))]}{const e=Lf.exec(A);if(e)return[vA(parseInt(e[1],16)),vA(parseInt(e[2],16)),vA(parseInt(e[3],16)),1]}{const e=Ef.exec(A);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: ${A}`)}function Kl(A){return .199*A[0]+.687*A[1]+.114*A[2]}function nn(A){const e=or(A);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Kl(e)>160?"black":"white"}}class Ht{constructor(){this.h=[]}l(e,t,i){const r={o:e,_:t,u:i===!0};this.h.push(r)}v(e){const t=this.h.findIndex((i=>e===i.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,i){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,i)))}M(){return this.h.length>0}S(){this.h=[]}}function EA(A,...e){for(const t of e)for(const i in t)t[i]!==void 0&&Object.prototype.hasOwnProperty.call(t,i)&&!["__proto__","constructor","prototype"].includes(i)&&(typeof t[i]!="object"||A[i]===void 0||Array.isArray(t[i])?A[i]=t[i]:EA(A[i],t[i]));return A}function KA(A){return typeof A=="number"&&isFinite(A)}function ar(A){return typeof A=="number"&&A%1==0}function lr(A){return typeof A=="string"}function sn(A){return typeof A=="boolean"}function jA(A){const e=A;if(!e||typeof e!="object")return e;let t,i,r;for(i in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(i)&&(r=e[i],t[i]=r&&typeof r=="object"?jA(r):r);return t}function If(A){return A!==null}function cr(A){return A===null?void 0:A}const js="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function Oi(A,e,t){return e===void 0&&(e=js),`${t=t!==void 0?`${t} `:""}${A}px ${e}`}class Pf{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,t=this.j(),i=this.H();return e.P===t&&e.D===i||(e.P=t,e.D=i,e.R=Oi(t,i),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/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 eo{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,i){this.Y.forEach((r=>{r.X(e,t,i)}))}}class LA{X(e,t,i){e.useBitmapCoordinateSpace((r=>this.K(r,t,i)))}}class Df extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.G===null||this.G.tt===null)return;const r=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=l=>{e.beginPath();for(let c=r.to-1;c>=r.from;--c){const h=n.it[c],m=Math.round(h.nt*t)+s,v=h.st*i,x=l*i+s;e.moveTo(m,v),e.arc(m,v,x,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 _f(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const kf={from:0,to:1};class Of{constructor(e,t){this.ut=new eo,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(_f),this.ct=this.dt.map((i=>{const r=new Df;return r.J(i),r})),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,t=this.F.wt(),i=this.vt.xt(),r=this.F.St();t.forEach(((n,s)=>{var o;const l=this.dt[s],c=n.kt(i);if(e||c===null||!n.yt())return void(l.tt=null);const h=Fe(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,h.Vt),l.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(l.it[0].st/n.Dt().At()),l.it[0].ot=i,l.it[0].nt=r.It(i),l.tt=kf}))}}let Nf=class extends LA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){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*i),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*i),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,xi(e,this.zt.Lt.Nt),(function(c,h,m,v){c.beginPath();const x=c.lineWidth%2?.5:0;c.moveTo(h+x,m),c.lineTo(h+x,v),c.stroke()})(e,o,0,t.height)),s&&l>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*r),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,xi(e,this.zt.Et.Nt),kl(e,l,0,t.width))}};class Kf{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 Nf(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(),t=Fe(this.jt.Ht()),i=t.$t().W().crosshair,r=this.Ft;if(i.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=i.horzLine.width,r.Et.Nt=i.horzLine.style,r.Et.V=i.horzLine.color,r.Lt.et=i.vertLine.width,r.Lt.Nt=i.vertLine.style,r.Lt.V=i.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function zf(A,e,t,i,r,n){A.fillRect(e+n,t,i-2*n,n),A.fillRect(e+n,t+r-n,i-2*n,n),A.fillRect(e,t,n,r),A.fillRect(e+i-n,t,n,r)}function on(A,e,t,i,r,n){A.save(),A.globalCompositeOperation="copy",A.fillStyle=n,A.fillRect(e,t,i,r),A.restore()}function zl(A,e,t,i,r,n){A.beginPath(),A.roundRect?A.roundRect(e,t,i,r,n):(A.lineTo(e+i-n[1],t),n[1]!==0&&A.arcTo(e+i,t,e+i,t+n[1],n[1]),A.lineTo(e+i,t+r-n[2]),n[2]!==0&&A.arcTo(e+i,t+r,e+i-n[2],t+r,n[2]),A.lineTo(e+n[3],t+r),n[3]!==0&&A.arcTo(e,t+r,e,t+r-n[3],n[3]),A.lineTo(e,t+n[0]),n[0]!==0&&A.arcTo(e,t,e+n[0],t,n[0]))}function Vl(A,e,t,i,r,n,s=0,o=[0,0,0,0],l=""){if(A.save(),!s||!l||l===n)return zl(A,e,t,i,r,o),A.fillStyle=n,A.fill(),void A.restore();const c=s/2;var h;zl(A,e+c,t+c,i-s,r-s,(h=-c,o.map((m=>m===0?m:m+h)))),n!=="transparent"&&(A.fillStyle=n,A.fill()),l!=="transparent"&&(A.lineWidth=s,A.strokeStyle=l,A.closePath(),A.stroke()),A.restore()}function Wl(A,e,t,i,r,n,s){A.save(),A.globalCompositeOperation="copy";const o=A.createLinearGradient(0,0,0,r);o.addColorStop(0,n),o.addColorStop(1,s),A.fillStyle=o,A.fillRect(e,t,i,r),A.restore()}class Gl{constructor(e,t){this.J(e,t)}J(e,t){this.zt=e,this.Xt=t}At(e,t){return this.zt.yt?e.P+e.L+e.B:0}X(e,t,i,r){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((l=>{const c=l.context;c.font=t.R;const h=this.Gt(l,t,i,r),m=h.Jt;return h.Qt?Vl(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):Vl(c,m.ri,m.ii,m.ni,m.si,s,m.ei,[0,m.ht,m.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(m.ri,m.li,m.ai-m.ri,m.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),h}));e.useMediaCoordinateSpace((({context:l})=>{const c=o.di;l.font=t.R,l.textAlign=o.Qt?"right":"left",l.textBaseline="middle",l.fillStyle=n,l.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,i,r){var n;const{context:s,bitmapSize:o,mediaSize:l,horizontalPixelRatio:c,verticalPixelRatio:h}=e,m=this.zt.hi||!this.zt.mi?t.T:0,v=this.zt.bi?t.C:0,x=t.L+this.Xt.wi,F=t.B+this.Xt.gi,T=t.A,S=t.I,I=this.zt.Kt,Q=t.P,N=i.Mi(s,I),J=Math.ceil(i.xi(s,I)),H=Q+x+F,z=t.C+T+S+J+m,re=Math.max(1,Math.floor(h));let q=Math.round(H*h);q%2!=re%2&&(q+=1);const ie=v>0?Math.max(1,Math.floor(v*c)):0,G=Math.round(z*c),ne=Math.round(m*c),le=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,ee=Math.round(le*h)-Math.floor(.5*h),we=Math.floor(ee+re/2-q/2),j=we+q,ge=r==="right",ae=ge?l.width-v:v,pe=ge?o.width-ie:ie;let ue,oe,fe;return ge?(ue=pe-G,oe=pe-ne,fe=ae-m-T-v):(ue=pe+G,oe=pe+ne,fe=ae+m+T),{Qt:ge,Jt:{ii:we,li:ee,ci:j,ni:G,si:q,ht:2*c,ei:ie,ti:ue,ri:pe,ai:oe,oi:re,ui:o.width},di:{ii:we/h,ci:j/h,fi:fe,pi:N}}}}class an{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||Gl)(this.Ci,this.yi),this.Ri=new(e||Gl)(this.Ti,this.yi)}Kt(){return this.Di(),this.Ci.Kt}ki(){return this.Di(),this.yi.ki}bt(){this.ft=!0}At(e,t=!1){return Math.max(this.Pi.At(e,t),this.Ri.At(e,t))}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 Vf extends an{constructor(e,t,i){super(),this.jt=e,this.Li=t,this.Ei=i}zi(e,t,i){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=nn(r.labelBackgroundColor);i.t=s.t,e.V=s.i;const o=2/12*this.Li.P();i.wi=o,i.gi=o;const l=this.Ei(this.Li);i.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const Wf=/[1-9]/g;class Rl{constructor(){this.zt=null}J(e){this.zt=e}X(e,t){if(this.zt===null||this.zt.yt===!1||this.zt.Kt.length===0)return;const i=e.useMediaCoordinateSpace((({context:v})=>(v.font=t.R,Math.round(t.Wi.xi(v,Fe(this.zt).Kt,Wf)))));if(i<=0)return;const r=t.ji,n=i+2*r,s=n/2,o=this.zt.Hi;let l=this.zt.ki,c=Math.floor(l-s)+.5;c<0?(l+=Math.abs(0-c),c=Math.floor(l-s)+.5):c+n>o&&(l-=Math.abs(o-(c+n)),c=Math.floor(l-s)+.5);const h=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:v,horizontalPixelRatio:x,verticalPixelRatio:F})=>{const T=Fe(this.zt);v.fillStyle=T.t;const S=Math.round(c*x),I=Math.round(0*F),Q=Math.round(h*x),N=Math.round(m*F),J=Math.round(2*x);if(v.beginPath(),v.moveTo(S,I),v.lineTo(S,N-J),v.arcTo(S,N,S+J,N,J),v.lineTo(Q-J,N),v.arcTo(Q,N,Q,N-J,J),v.lineTo(Q,I),v.fill(),T.hi){const H=Math.round(T.ki*x),z=I,re=Math.round((z+t.T)*F);v.fillStyle=T.V;const q=Math.max(1,Math.floor(x)),ie=Math.floor(.5*x);v.fillRect(H-ie,z,q,re-z)}})),e.useMediaCoordinateSpace((({context:v})=>{const x=Fe(this.zt),F=0+t.C+t.T+t.L+t.P/2;v.font=t.R,v.textAlign="left",v.textBaseline="middle",v.fillStyle=x.V;const T=t.Wi.Mi(v,"Apr0");v.translate(c+r,F+T),v.fillText(x.Kt,0,0)}))}}class Gf{constructor(e,t,i){this.ft=!0,this.Wt=new Rl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=i}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const i=this.$i.St();if(i.Ni())return;e.Hi=i.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=i.Ui(this.vt.xt());e.Kt=i.qi(Fe(n)),e.yt=!0;const s=nn(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=i.W().ticksVisible}}class to{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 $l;(function(A){A[A.Normal=0]="Normal",A[A.Magnet=1]="Magnet",A[A.Hidden=2]="Hidden"})($l||($l={}));class Rf extends to{constructor(e,t){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=t,this.dn=new Of(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Fe(this.tn).vn())return{_t:l,ki:o};{const c=Fe(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const i=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new Gf(this,e,i),this.wn=new Kf(this)}W(){return this.cn}gn(e,t){this._n=e,this.un=t}Mn(){this._n=NaN,this.un=NaN}xn(){return this._n}Sn(){return this.un}kn(e,t,i){this.hn||(this.hn=!0),this.en=!0,this.yn(e,t,i)}xt(){return this.sn}Yt(){return this.ln}Zt(){return this.an}yt(){return this.en}Cn(){this.en=!1,this.Tn(),this.nn=NaN,this.ln=NaN,this.an=NaN,this.tn=null,this.Mn()}Pn(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,t){this.en&&this.tn===e||this.rn.clear();const i=[];return this.tn===e&&i.push(this.Dn(this.rn,t,this.fn)),i}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,t,i){this.Bn(e,t,i)&&this.Vn()}Bn(e,t,i){const r=this.ln,n=this.an,s=this.nn,o=this.sn,l=this.tn,c=this.On(i);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=i;const h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),r!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||l!==this.tn}Tn(){const e=this.$i.wt().map((i=>i.In().An())).filter(If),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,i){let r=e.get(t);return r===void 0&&(r=new Vf(this,t,i),e.set(t,r)),r}}function ln(A){return A==="left"||A==="right"}class Rt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const i=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,i)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.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 t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,i)=>{this.Nn(i,t)}))}static ss(){return new Rt(2)}static es(){return new Rt(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((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Xl=".";function ei(A,e){if(!KA(A))return"n/a";if(!ar(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?A.toString():("0000000000000000"+A.toString()).slice(-e)}class cn{constructor(e,t){if(t||(t=1),KA(e)&&ar(e)||(e=100),e<0)throw new TypeError("invalid base");this.Li=e,this.rs=t,this.hs()}format(e){const t=e<0?"−":"";return e=Math.abs(e),t+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 t=this.Li/this.rs;let i=Math.floor(e),r="";const n=this._s!==void 0?this._s:NaN;if(t>1){let s=+(Math.round(e*t)-i*t).toFixed(this._s);s>=t&&(s-=t,i+=1),r=Xl+ei(+s.toFixed(this._s)*this.rs,n)}else i=Math.round(i*t)/t,n>0&&(r=Xl+ei(0,n));return i.toFixed(0)+r}}class Jl extends cn{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class $f{constructor(e){this.us=e}format(e){let t="";return e<0&&(t="-",e=-e),e<995?t+this.cs(e):e<999995?t+this.cs(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),t+this.cs(e/1e6)+"M"):(e=1e6*Math.round(e/1e6),t+this.cs(e/1e9)+"B")}cs(e){let t;const i=Math.pow(10,this.us);return t=(e=Math.round(e*i)/i)>=1e-15&&e<1?e.toFixed(this.us).replace(/\.?0+$/,""):String(e),t.replace(/(\.[1-9]*)0+$/,((r,n)=>n))}}function Zl(A,e,t,i,r,n,s){if(e.length===0||i.from>=e.length||i.to<=0)return;const{context:o,horizontalPixelRatio:l,verticalPixelRatio:c}=A,h=e[i.from];let m=n(A,h),v=h;if(i.to-i.from<2){const x=r/2;o.beginPath();const F={nt:h.nt-x,st:h.st},T={nt:h.nt+x,st:h.st};o.moveTo(F.nt*l,F.st*c),o.lineTo(T.nt*l,T.st*c),s(A,m,F,T)}else{const x=(T,S)=>{s(A,m,v,S),o.beginPath(),m=T,v=S};let F=v;o.beginPath(),o.moveTo(h.nt*l,h.st*c);for(let T=i.from+1;T<i.to;++T){F=e[T];const S=n(A,F);switch(t){case 0:o.lineTo(F.nt*l,F.st*c);break;case 1:o.lineTo(F.nt*l,e[T-1].st*c),S!==m&&(x(S,F),o.lineTo(F.nt*l,e[T-1].st*c)),o.lineTo(F.nt*l,F.st*c);break;case 2:{const[I,Q]=Xf(e,T-1,T);o.bezierCurveTo(I.nt*l,I.st*c,Q.nt*l,Q.st*c,F.nt*l,F.st*c);break}}t!==1&&S!==m&&(x(S,F),o.moveTo(F.nt*l,F.st*c))}(v!==F||v===F&&t===1)&&s(A,m,v,F)}}const Yl=6;function Ao(A,e){return{nt:A.nt-e.nt,st:A.st-e.st}}function ql(A,e){return{nt:A.nt/e,st:A.st/e}}function Xf(A,e,t){const i=Math.max(0,e-1),r=Math.min(A.length-1,t+1);var n,s;return[(n=A[e],s=ql(Ao(A[t],A[i]),Yl),{nt:n.nt+s.nt,st:n.st+s.st}),Ao(A[t],ql(Ao(A[r],A[e]),Yl))]}function Jf(A,e,t,i,r){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(r.nt*s,A*o),n.lineTo(i.nt*s,A*o),n.closePath(),n.fillStyle=t,n.fill()}class jl extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:i,tt:r,ds:n,et:s,Nt:o,fs:l}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(r===null)return;const h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,xi(h,o),h.lineWidth=1,Zl(e,i,l,r,n,this.bs.bind(this),Jf.bind(null,c))}}function io(A,e,t){return Math.min(Math.max(A,e),t)}function hn(A,e,t){return e-A<=t}function ec(A){const e=Math.ceil(A);return e%2==0?e-1:e}class ro{ws(e,t){const i=this.gs,{Ms:r,xs:n,Ss:s,ks:o,ys:l,vs:c}=t;if(this.Cs===void 0||i===void 0||i.Ms!==r||i.xs!==n||i.Ss!==s||i.ks!==o||i.vs!==c||i.ys!==l){const h=e.context.createLinearGradient(0,0,0,l);if(h.addColorStop(0,r),c!=null){const m=io(c*e.verticalPixelRatio/l,0,1);h.addColorStop(m,n),h.addColorStop(m,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class Zf extends jl{constructor(){super(...arguments),this.Ts=new ro}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Yf(A,e){const t=A.context;t.strokeStyle=e,t.stroke()}class tc extends LA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:i,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(i===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,xi(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&Zl(e,t,n,i,r,h,Yf),l&&(function(m,v,x,F,T){const{horizontalPixelRatio:S,verticalPixelRatio:I,context:Q}=m;let N=null;const J=Math.max(1,Math.floor(S))%2/2,H=x*I+J;for(let z=F.to-1;z>=F.from;--z){const re=v[z];if(re){const q=T(m,re);q!==N&&(Q.beginPath(),N!==null&&Q.fill(),Q.fillStyle=q,N=q);const ie=Math.round(re.nt*S)+J,G=re.st*I;Q.moveTo(ie,G),Q.arc(ie,G,H,0,2*Math.PI)}}Q.fill()})(e,t,l,i,h)}}class Ac extends tc{Vs(e,t){return t.lt}}function ic(A,e,t,i,r=0,n=e.length){let s=n-r;for(;0<s;){const o=s>>1,l=r+o;i(e[l],t)===A?(r=l+1,s-=o+1):s=o}return r}const hr=ic.bind(null,!0),rc=ic.bind(null,!1);function qf(A,e){return A.ot<e}function jf(A,e){return e<A.ot}function nc(A,e,t){const i=e.Os(),r=e.ui(),n=hr(A,i,qf),s=rc(A,r,jf);if(!t)return{from:n,to:s};let o=n,l=s;return n>0&&n<A.length&&A[n].ot>=i&&(o=n-1),s>0&&s<A.length&&A[s-1].ot<=r&&(l=s+1),{from:o,to:l}}class no{constructor(e,t,i){this.Bs=!0,this.As=!0,this.Is=!0,this.zs=[],this.Ls=null,this.Es=e,this.Ns=t,this.Fs=i}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(),t=this.Ns.St();if(this.qs(),t.Ni()||e.Ni())return;const i=t.Xs();if(i===null||this.Es.In().Ks()===0)return;const r=this.Es.Ct();r!==null&&(this.Ls=nc(this.zs,i,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class un extends no{constructor(e,t){super(e,t,!0)}Gs(e,t,i){t.Qs(this.zs,cr(this.Ls)),e.te(this.zs,i,cr(this.Ls))}ie(e,t){return{ot:e,_t:t,nt:NaN,st:NaN}}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>{const i=t.Vt[3];return this.se(t.ee,i,e)}))}}class eg extends un{constructor(e,t){super(e,t),this.js=new eo,this.re=new Zf,this.he=new Ac,this.js.Z([this.re,this.he])}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$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 tg extends LA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;this.ae=this._e(t),this.ae>=2&&Math.max(1,Math.floor(t))%2!=this.ae%2&&this.ae--,this.oe=this.zt.ue?Math.min(this.ae,Math.floor(t)):this.ae;let r=null;const n=this.oe<=this.ae&&this.zt.le>=Math.floor(1.5*t);for(let s=this.zt.tt.from;s<this.zt.tt.to;++s){const o=this.zt.In[s];r!==o.ce&&(e.fillStyle=o.ce,r=o.ce);const l=Math.floor(.5*this.oe),c=Math.round(o.nt*t),h=c-l,m=this.oe,v=h+m-1,x=Math.min(o.de,o.fe),F=Math.max(o.de,o.fe),T=Math.round(x*i)-l,S=Math.round(F*i)+l,I=Math.max(S-T,this.oe);e.fillRect(h,T,m,I);const Q=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-Q;let re=Math.max(T,Math.round(o.pe*i)-l),q=re+m-1;q>T+I-1&&(q=T+I-1,re=q-m+1),e.fillRect(z,re,h-z,q-re+1)}const N=c+Q;let J=Math.max(T,Math.round(o.me*i)-l),H=J+m-1;H>T+I-1&&(H=T+I-1,J=H-m+1),e.fillRect(v+1,J,N-v,H-J+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(i,r){return Math.floor(.3*i*r)})(Fe(this.zt).le,e)))}}class sc extends no{constructor(e,t){super(e,t,!1)}Gs(e,t,i){t.Qs(this.zs,cr(this.Ls)),e.be(this.zs,i,cr(this.Ls))}we(e,t,i){return{ot:e,ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.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((t=>this.se(t.ee,t,e)))}}class Ag extends sc{constructor(){super(...arguments),this.js=new tg}se(e,t,i){return Object.assign(Object.assign({},this.we(e,t,i)),i.$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 ig extends jl{constructor(){super(...arguments),this.Ts=new ro}bs(e,t){const i=this.G;return this.Ts.ws(e,{Ms:t.ke,xs:t.ye,Ss:t.Ce,ks:t.Te,ys:e.bitmapSize.height,vs:i.vs})}}class rg extends tc{constructor(){super(...arguments),this.Pe=new ro}Vs(e,t){const i=this.G;return this.Pe.ws(e,{Ms:t.Re,xs:t.Re,Ss:t.De,ks:t.De,ys:e.bitmapSize.height,vs:i.vs})}}class ng extends un{constructor(e,t){super(e,t),this.js=new eo,this.Ve=new ig,this.Oe=new rg,this.js.Z([this.Ve,this.Oe])}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$s(e))}Js(){const e=this.Es.Ct();if(e===null)return;const t=this.Es.W(),i=this.Es.Dt().Rt(t.baseValue.price,e.Vt),r=this.Ns.St().le();this.Ve.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineType,vs:i,ps:!1,tt:this.Ls,ds:r}),this.Oe.J({it:this.zs,et:t.lineWidth,Nt:t.lineStyle,fs:t.lineVisible?t.lineType:void 0,Ds:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,vs:i,tt:this.Ls,ds:r})}}class sg extends LA{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:t}=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),c=Math.floor(n*s),h=Math.min(l,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const i=this.zt.In;this.zt.Be&&this.Ae(e,i,this.zt.tt),this.zt._i&&this.Ie(e,i,this.zt.tt);const r=this.ze(t);(!this.zt._i||this.ae>2*r)&&this.Le(e,i,this.zt.tt)}Ae(e,t,i){if(this.zt===null)return;const{context:r,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 c=Math.floor(.5*l);let h=null;for(let m=i.from;m<i.to;m++){const v=t[m];v.Ee!==o&&(r.fillStyle=v.Ee,o=v.Ee);const x=Math.round(Math.min(v.pe,v.me)*s),F=Math.round(Math.max(v.pe,v.me)*s),T=Math.round(v.de*s),S=Math.round(v.fe*s);let I=Math.round(n*v.nt)-c;const Q=I+l-1;h!==null&&(I=Math.max(h+1,I),I=Math.min(I,Q));const N=Q-I+1;r.fillRect(I,T,N,x-T),r.fillRect(I,F+1,N,S-F),h=Q}}ze(e){let t=Math.floor(1*e);this.ae<=2*t&&(t=Math.floor(.5*(this.ae-1)));const i=Math.max(Math.floor(e),t);return this.ae<=2*i?Math.max(Math.floor(e),Math.floor(1*e)):i}Ie(e,t,i){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);let c=null;for(let h=i.from;h<i.to;h++){const m=t[h];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let v=Math.round(m.nt*n)-Math.floor(.5*this.ae);const x=v+this.ae-1,F=Math.round(Math.min(m.pe,m.me)*s),T=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(v=Math.max(c+1,v),v=Math.min(v,x)),this.zt.le*n>2*l)zf(r,v,F,x-v+1,T-F+1,l);else{const S=x-v+1;r.fillRect(v,F,S,T-F+1)}c=x}}Le(e,t,i){if(this.zt===null)return;const{context:r,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const l=this.ze(n);for(let c=i.from;c<i.to;c++){const h=t[c];let m=Math.round(Math.min(h.pe,h.me)*s),v=Math.round(Math.max(h.pe,h.me)*s),x=Math.round(h.nt*n)-Math.floor(.5*this.ae),F=x+this.ae-1;if(h.ce!==o){const T=h.ce;r.fillStyle=T,o=T}this.zt._i&&(x+=l,m+=l,F-=l,v-=l),m>v||r.fillRect(x,m,F-x+1,v-m+1)}}}class og extends sc{constructor(){super(...arguments),this.js=new sg}se(e,t,i){return Object.assign(Object.assign({},this.we(e,t,i)),i.$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 ag{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,i){this.Fe.draw(e,this.Li,t,i)}}class so extends no{constructor(e,t,i){super(e,t,!1),this.wn=i,this.js=new ag(this.wn.renderer(),(r=>{const n=e.Ct();return n===null?null:e.Dt().Rt(r,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((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,cr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(lg),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function lg(A){return{x:A.nt,time:A.ot,originalData:A.He,barColor:A.ce}}class cg extends LA{constructor(){super(...arguments),this.zt=null,this.Ue=[]}J(e){this.zt=e,this.Ue=[]}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return;this.Ue.length||this.qe(t);const r=Math.max(1,Math.floor(i)),n=Math.round(this.zt.Ye*i)-Math.floor(r/2),s=n+r;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const l=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],h=Math.round(l.st*i);let m,v;e.fillStyle=l.ce,h<=n?(m=h,v=s):(m=n,v=h-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,v-m)}}qe(e){if(this.zt===null||this.zt.it.length===0||this.zt.tt===null)return void(this.Ue=[]);const t=Math.ceil(this.zt.le*e)<=1?0:Math.max(1,Math.floor(e)),i=Math.round(this.zt.le*e)-t;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,c;if(i%2){const h=(i-1)/2;l=o-h,c=o+h}else{const h=i/2;l=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:l,ui:c,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!==t+1&&(o.Ze>o.Xe?o.ui=s.Os-t-1:s.Os=o.ui+t+1)}let r=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;r=Math.min(o,r)}if(t>0&&r<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>r&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class hg extends un{constructor(){super(...arguments),this.js=new cg}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$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,Fe(this.Es.Ct()).Vt)};this.js.J(e)}}class ug extends un{constructor(){super(...arguments),this.js=new Ac}se(e,t,i){return Object.assign(Object.assign({},this.ie(e,t)),i.$s(e))}Js(){const e=this.Es.W(),t={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(t)}}const pg=/[2-9]/g;class ur{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,t,i){return this.sr(e,t,i).width}Mi(e,t,i){const r=this.sr(e,t,i);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}sr(e,t,i){const r=i||pg,n=String(t).replace(r,"0");if(this.tr.has(n))return rA(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&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class dg{constructor(e){this.hr=null,this.k=null,this.lr="right",this.ar=e}_r(e,t,i){this.hr=e,this.k=t,this.lr=i}X(e){this.k!==null&&this.hr!==null&&this.hr.X(e,this.k,this.ar,this.lr)}}class oc{constructor(e,t,i){this.ur=e,this.ar=new ur(50),this.cr=t,this.F=i,this.j=-1,this.Wt=new dg(this.ar)}gt(){const e=this.F.dr(this.cr);if(e===null)return null;const t=e.vr(this.cr)?e.pr():this.cr.Dt();if(t===null)return null;const i=e.mr(t);if(i==="overlay")return null;const r=this.F.br();return r.P!==this.j&&(this.j=r.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),r,i),this.Wt}}class fg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var i;if(!(!((i=this.zt)===null||i===void 0)&&i.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*i),xi(e,this.zt.Nt),kl(e,n,0,t.width))}}class oo{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new fg,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 gg extends oo{constructor(e){super(e)}yr(){this.Sr.yt=!1;const e=this.Es.Dt(),t=e.Cr().Cr;if(t!==2&&t!==3)return;const i=this.Es.W();if(!i.baseLineVisible||!this.Es.yt())return;const r=this.Es.Ct();r!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(r.Vt,r.Vt),this.Sr.V=i.baseLineColor,this.Sr.et=i.baseLineWidth,this.Sr.Nt=i.baseLineStyle)}}class mg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i}){const r=this.zt;if(r===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(r.Xe.x*t)+s,l=r.Xe.y*i;e.fillStyle=r.Tr,e.beginPath();const c=Math.max(2,1.5*r.Pr)*t;e.arc(o,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.Rr,e.beginPath(),e.arc(o,l,r.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=r.Dr,e.beginPath(),e.arc(o,l,r.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const wg=[{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 ac(A,e,t,i){return(function(r,n){if(r==="transparent")return r;const s=or(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(A,t+(i-t)*e)}function lc(A,e){const t=A%2600/2600;let i;for(const l of wg)if(t>=l.Vr&&t<=l.Or){i=l;break}ai(i!==void 0,"Last price animation internal logic error");const r=(t-i.Vr)/(i.Or-i.Vr);return{Rr:ac(e,r,i.Ir,i.zr),Dr:ac(e,r,i.Lr,i.Er),ht:(n=r,s=i.Br,o=i.Ar,s+(o-s)*n)};var n,s,o}class Bg{constructor(e){this.Wt=new mg,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(),t=this.Wr-e;if(t>0)return void(t<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(),t=e.Xs(),i=this.jr.Ct();if(t===null||i===null)return;const r=this.jr.Zr(!0);if(r.Xr||!t.Kr(r.ee))return;const n={x:e.It(r.ee),y:this.jr.Dt().Rt(r._t,i.Vt)},s=r.V,o=this.jr.W().lineWidth,l=lc(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 t=lc(this.Gr(),e.Tr);e.Rr=t.Rr,e.Dr=t.Dr,e.ht=t.ht}}Gr(){return this.qr()?performance.now()-this.Fr:2599}}function pr(A,e){return ec(Math.min(Math.max(A,12),30)*e)}function dr(A,e){switch(A){case"arrowDown":case"arrowUp":return pr(e,1);case"circle":return pr(e,.8);case"square":return pr(e,.7)}}function cc(A){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(pr(A,1))}function hc(A){return Math.max(pr(A,.1),3)}function uc(A,e,t){return e?A:t?Math.ceil(A/2):0}function pc(A,e,t,i,r){const n=dr("square",t),s=(n-1)/2,o=A-s,l=e-s;return i>=o&&i<=o+n&&r>=l&&r<=l+n}function dc(A,e,t,i){const r=(dr("arrowUp",i)-1)/2*t.Jr,n=(ec(i/2)-1)/2*t.Jr;e.beginPath(),A?(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st-r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+r),e.lineTo(t.nt-n,t.st+r),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-r,t.st),e.lineTo(t.nt,t.st+r),e.lineTo(t.nt+r,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-r),e.lineTo(t.nt-n,t.st-r),e.lineTo(t.nt-n,t.st)),e.fill()}function yg(A,e,t,i,r,n){return pc(e,t,i,r,n)}class Cg extends LA{constructor(){super(...arguments),this.zt=null,this.ar=new ur,this.j=-1,this.H="",this.Qr=""}J(e){this.zt=e}_r(e,t){this.j===e&&this.H===t||(this.j=e,this.H=t,this.Qr=Oi(e,t),this.ar.nr())}wr(e,t){if(this.zt===null||this.zt.tt===null)return null;for(let i=this.zt.tt.from;i<this.zt.tt.to;i++){const r=this.zt.it[i];if(Tg(r,e,t))return{Mr:r.th,gr:r.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:i},r,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),vg(o,e,t,i)}}}}function vg(A,e,t,i){e.fillStyle=A.V,A.Kt!==void 0&&(function(r,n,s,o,l,c){r.save(),r.scale(l,c),r.fillText(n,s,o),r.restore()})(e,A.Kt.ih,A.Kt.nt,A.Kt.st,t,i),(function(r,n,s){if(r.Ks!==0){switch(r.nh){case"arrowDown":return void dc(!1,n,s,r.Ks);case"arrowUp":return void dc(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const h=(dr("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,h*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const h=dr("square",c),m=(h-1)*l.Jr/2,v=l.nt-m,x=l.st-m;o.fillRect(v,x,h*l.Jr,h*l.Jr)})(n,s,r.Ks)}r.nh}})(A,e,(function(r,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(r.nt*n)+o,st:r.st*s,Jr:n}})(A,t,i))}function Tg(A,e,t){return!(A.Kt===void 0||!(function(i,r,n,s,o,l){const c=s/2;return o>=i&&o<=i+n&&l>=r-c&&l<=r+c})(A.Kt.nt,A.Kt.st,A.Kt.Hi,A.Kt.At,e,t))||(function(i,r,n){if(i.Ks===0)return!1;switch(i.nh){case"arrowDown":case"arrowUp":return yg(0,i.nt,i.st,i.Ks,r,n);case"circle":return(function(s,o,l,c,h){const m=2+dr("circle",l)/2,v=s-c,x=o-h;return Math.sqrt(v*v+x*x)<=m})(i.nt,i.st,i.Ks,r,n);case"square":return pc(i.nt,i.st,i.Ks,r,n)}})(A,e,t)}function bg(A,e,t,i,r,n,s,o,l){const c=KA(t)?t:t.Se,h=KA(t)?t:t.Me,m=KA(t)?t:t.xe,v=KA(e.size)?Math.max(e.size,0):1,x=cc(o.le())*v,F=x/2;switch(A.Ks=x,e.position){case"inBar":return A.st=s.Rt(c,l),void(A.Kt!==void 0&&(A.Kt.st=A.st+F+n+.6*r));case"aboveBar":return A.st=s.Rt(h,l)-F-i.sh,A.Kt!==void 0&&(A.Kt.st=A.st-F-.6*r,i.sh+=1.2*r),void(i.sh+=x+n);case"belowBar":return A.st=s.Rt(m,l)+F+i.eh,A.Kt!==void 0&&(A.Kt.st=A.st+F+n+.6*r,i.eh+=1.2*r),void(i.eh+=x+n)}e.position}class xg{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Cg,this.jr=e,this.$i=t,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 t=this.$i.W().layout;return this.Wt._r(t.fontSize,t.fontFamily),this.Wt.J(this.zt),this.Wt}uh(){if(this.hh){if(this.jr.dh().length>0){const e=this.$i.St().le(),t=hc(e),i=1.5*cc(e)+2*t,r=this.fh();this.ah={above:uc(i,r.aboveBar,r.inBar),below:uc(i,r.belowBar,r.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),i=this.jr.dh();this.rh&&(this.zt.it=i.map((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const r=this.$i.W().layout;this.zt.tt=null;const n=t.Xs();if(n===null)return;const s=this.jr.Ct();if(s===null||this.zt.it.length===0)return;let o=NaN;const l=hc(t.le()),c={sh:l,eh:l};this.zt.tt=nc(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const m=i[h];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const v=this.zt.it[h];v.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(v.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const x=this.jr.ph(m.time);x!==null&&bg(v,m,x,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Qg extends oo{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const i=this.Es.Zr(t.priceLineSource===0);i.Xr||(e.yt=!0,e.st=i.ki,e.V=this.Es.mh(i.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class Fg extends an{constructor(e){super(),this.jt=e}zi(e,t,i){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const h=r.mh(c.V),m=nn(h);i.t=m.t,i.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=h,e.V=m.i,t.V=m.i}gh(e,t,i,r){let n="";const s=this.jt.bh();return i&&s.length!==0&&(n+=`${s} `),t&&r&&(n+=this.jt.Dt().Mh()?e.xh:e.Sh),n.trim()}wh(e,t,i){return t?i?this.jt.Dt().Mh()?e.Sh:e.xh:e.Kt:""}}function fc(A,e,t,i){const r=Number.isFinite(e),n=Number.isFinite(t);return r&&n?A(e,t):r||n?r?e:t:i}class hA{constructor(e,t){this.kh=e,this.yh=t}Ch(e){return e!==null&&this.kh===e.kh&&this.yh===e.yh}Th(){return new hA(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 hA(fc(Math.min,this.Ph(),e.Ph(),-1/0),fc(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!KA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let i=this.yh-t,r=this.kh-t;i*=e,r*=e,this.yh=t+i,this.kh=t+r}Oh(e){KA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new hA(e.minValue,e.maxValue)}}class pn{constructor(e,t){this.Ih=e,this.zh=t||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 pn(hA.Ah(e.priceRange),e.margins)}}class Ug extends oo{constructor(e,t){super(e),this.Nh=t}yr(){const e=this.Sr;e.yt=!1;const t=this.Nh.W();if(!this.Es.yt()||!t.lineVisible)return;const i=this.Nh.Fh();i!==null&&(e.yt=!0,e.st=i,e.V=t.color,e.et=t.lineWidth,e.Nt=t.lineStyle,e.gr=this.Nh.W().id)}}class Sg extends an{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,i){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=nn(r.axisLabelColor||r.color);i.t=c.t;const h=r.axisLabelTextColor||c.i;e.V=h,t.V=h,i.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Eg{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Ug(e,this),this.ur=new Sg(e,this),this.Hh=new oc(this.ur,e,e.$t())}$h(e){EA(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,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const i=e.Ct();return i===null?null:t.Rt(this.cn.price,i.Vt)}}class Lg extends to{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Mg={Bar:(A,e,t,i)=>{var r;const n=e.upColor,s=e.downColor,o=Fe(A(t,i)),l=ki(o.Vt[0])<=ki(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(A,e,t,i)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,h=e.borderDownColor,m=e.wickUpColor,v=e.wickDownColor,x=Fe(A(t,i)),F=ki(x.Vt[0])<=ki(x.Vt[3]);return{ce:(r=x.V)!==null&&r!==void 0?r:F?o:l,Ne:(n=x.Ot)!==null&&n!==void 0?n:F?c:h,Ee:(s=x.Xh)!==null&&s!==void 0?s:F?m:v}},Custom:(A,e,t,i)=>{var r;return{ce:(r=Fe(A(t,i)).V)!==null&&r!==void 0?r:e.color}},Area:(A,e,t,i)=>{var r,n,s,o;const l=Fe(A(t,i));return{ce:(r=l.lt)!==null&&r!==void 0?r: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:(A,e,t,i)=>{var r,n,s,o,l,c;const h=Fe(A(t,i));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=h.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=h.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(A,e,t,i)=>{var r,n;const s=Fe(A(t,i));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(A,e,t,i)=>{var r;return{ce:(r=Fe(A(t,i)).V)!==null&&r!==void 0?r:e.color}}};class Hg{constructor(e){this.Kh=(t,i)=>i!==void 0?i.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Mg[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var gc;(function(A){A[A.NearestLeft=-1]="NearestLeft",A[A.None=0]="None",A[A.NearestRight=1]="NearestRight"})(gc||(gc={}));const li=30;class Ig{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,t=0){const i=this.hl(e,t);return i===null?null:Object.assign(Object.assign({},this.al(i)),{ee:this.rl(i)})}ne(){return this.tl}ol(e,t,i){if(this.Ni())return null;let r=null;for(const n of i)r=dn(r,this._l(e,t,n));return r}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,t){const i=this.ul(e);if(i===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return i}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return hr(this.tl,e,((t,i)=>t.ee<i))}vl(e){return rc(this.tl,e,((t,i)=>t.ee>i))}pl(e,t,i){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[i];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,i){if(this.Ni())return null;let r=null;const n=Fe(this.el()),s=Fe(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/li)*li,h=Math.max(c,Math.floor(l/li)*li);{const v=this.fl(o),x=this.vl(Math.min(l,c,t));r=dn(r,this.pl(v,x,i))}let m=this.il.get(i);m===void 0&&(m=new Map,this.il.set(i,m));for(let v=Math.max(c+1,o);v<h;v+=li){const x=Math.floor(v/li);let F=m.get(x);if(F===void 0){const T=this.fl(x*li),S=this.vl((x+1)*li-1);F=this.pl(T,S,i),m.set(x,F)}r=dn(r,F)}{const v=this.fl(h),x=this.vl(l);r=dn(r,this.pl(v,x,i))}return r}}function dn(A,e){return A===null?e:e===null?A:{ml:Math.min(A.ml,e.ml),bl:Math.max(A.bl,e.bl)}}class Pg{constructor(e){this.wl=e}X(e,t,i){this.wl.draw(e)}gl(e,t,i){var r,n;(n=(r=this.wl).drawBackground)===null||n===void 0||n.call(r,e)}}class ao{constructor(e){this.tr=null,this.wn=e}gt(){var e;const t=this.wn.renderer();if(t===null)return null;if(((e=this.tr)===null||e===void 0?void 0:e.Ml)===t)return this.tr.xl;const i=new Pg(t);return this.tr={Ml:t,xl:i},i}Sl(){var e,t,i;return(i=(t=(e=this.wn).zOrder)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:"normal"}}function mc(A){var e,t,i,r,n;return{Kt:A.text(),ki:A.coordinate(),Si:(e=A.fixedCoordinate)===null||e===void 0?void 0:e.call(A),V:A.textColor(),t:A.backColor(),yt:(i=(t=A.visible)===null||t===void 0?void 0:t.call(A))===null||i===void 0||i,hi:(n=(r=A.tickVisible)===null||r===void 0?void 0:r.call(A))===null||n===void 0||n}}class Dg{constructor(e,t){this.Wt=new Rl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},mc(this.kl))),this.Wt}}class _g extends an{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,i){const r=mc(this.kl);i.t=r.t,e.V=r.V;const n=2/12*this.Li.P();i.wi=n,i.gi=n,i.ki=r.ki,i.Si=r.Si,e.Kt=r.Kt,e.yt=r.yt,e.hi=r.hi}}class kg{constructor(e,t){this.Cl=null,this.Tl=null,this.Pl=null,this.Rl=null,this.Dl=null,this.Vl=e,this.jr=t}Ol(){return this.Vl}Vn(){var e,t;(t=(e=this.Vl).updateAllViews)===null||t===void 0||t.call(e)}Pn(){var e,t,i,r;const n=(i=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Cl)===null||r===void 0?void 0:r.Ml)===n)return this.Cl.xl;const s=n.map((o=>new ao(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,i,r;const n=(i=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Tl)===null||r===void 0?void 0:r.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((l=>new Dg(l,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,i,r;const n=(i=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Pl)===null||r===void 0?void 0:r.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((l=>new _g(l,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,i,r;const n=(i=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Rl)===null||r===void 0?void 0:r.Ml)===n)return this.Rl.xl;const s=n.map((o=>new ao(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,i,r;const n=(i=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:[];if(((r=this.Dl)===null||r===void 0?void 0:r.Ml)===n)return this.Dl.xl;const s=n.map((o=>new ao(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var i,r,n;return(n=(r=(i=this.Vl).autoscaleInfo)===null||r===void 0?void 0:r.call(i,e,t))!==null&&n!==void 0?n:null}wr(e,t){var i,r,n;return(n=(r=(i=this.Vl).hitTest)===null||r===void 0?void 0:r.call(i,e,t))!==null&&n!==void 0?n:null}}function lo(A,e,t,i){A.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&i.push(n)}))}))}function co(A){return A.Pn()}function Og(A){return A.Bl()}function Ng(A){return A.Al()}class ho extends Lg{constructor(e,t,i,r,n){super(e),this.zt=new Ig,this.jh=new Qg(this),this.zl=[],this.Ll=new gg(this),this.El=null,this.Nl=null,this.Fl=[],this.Wl=[],this.jl=null,this.Hl=[],this.cn=t,this.$l=i;const s=new Fg(this);this.rn=[s],this.Hh=new oc(s,this,e),i!=="Area"&&i!=="Line"&&i!=="Baseline"||(this.El=new Bg(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const t={Xr:!0},i=this.Dt();if(this.$t().St().Ni()||i.Ni()||this.zt.Ni())return t;const r=this.$t().St().Xs(),n=this.Ct();if(r===null||n===null)return t;let s,o;if(e){const m=this.zt.sl();if(m===null)return t;s=m,o=m.ee}else{const m=this.zt.ll(r.ui(),-1);if(m===null||(s=this.zt.Gh(m.ee),s===null))return t;o=m.ee}const l=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=i.Rt(l,n.Vt);return{Xr:!1,_t:l,Kt:i.Fi(l,n.Vt),xh:i.Yl(l),Sh:i.Zl(l,n.Vt),V:c.ce,ki:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new Hg(this)),this.Nl}W(){return this.cn}$h(e){const t=e.priceScaleId;t!==void 0&&t!==this.cn.priceScaleId&&this.$t().Xl(this,t),EA(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,t){this.zt.J(e),this.Ql(),this.wn.bt("data"),this.dn.bt("data"),this.El!==null&&(t&&t.ta?this.El.$r():e.length===0&&this.El.Hr());const i=this.$t().dr(this);this.$t().ia(i),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}na(e){this.Fl=e,this.Ql();const t=this.$t().dr(this);this.dn.bt("data"),this.$t().ia(t),this.$t().Gl(this),this.$t().Jl(),this.$t().Uh()}sa(){return this.Fl}dh(){return this.Wl}ea(e){const t=new Eg(this,e);return this.zl.push(t),this.$t().Gl(this),t}ra(e){const t=this.zl.indexOf(e);t!==-1&&this.zl.splice(t,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 t=e.Os();return this.zt.ll(t,1)}In(){return this.zt}ph(e){const t=this.zt.Gh(e);return t===null?null:this.$l==="Bar"||this.$l==="Candlestick"||this.$l==="Custom"?{ge:t.Vt[0],Me:t.Vt[1],xe:t.Vt[2],Se:t.Vt[3]}:t.Vt[3]}aa(e){const t=[];lo(this.Hl,co,"top",t);const i=this.El;return i!==null&&i.yt()&&(this.jl===null&&i.qr()&&(this.jl=setTimeout((()=>{this.jl=null,this.$t().oa()}),0)),i.Ur(),t.unshift(i)),t}Pn(){const e=[];this._a()||e.push(this.Ll),e.push(this.wn,this.jh,this.dn);const t=this.zl.map((i=>i.qh()));return e.push(...t),lo(this.Hl,co,"normal",e),e}ua(){return this.ca(co,"bottom")}da(e){return this.ca(Og,e)}fa(e){return this.ca(Ng,e)}va(e,t){return this.Hl.map((i=>i.wr(e,t))).filter((i=>i!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const i=[...this.rn];for(const r of this.zl)i.push(r.Zh());return this.Hl.forEach((r=>{i.push(...r.Rn())})),i}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const i=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return pn.Ah(i)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Fe(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.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 kg(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof so)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof so)return e=>this.wn.je(e)}_a(){return!ln(this.Dt().Pa())}pa(e,t){if(!ar(e)||!ar(t)||this.zt.Ni())return null;const i=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],r=this.zt.ol(e,t,i);let n=r!==null?new hA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new hA(o,o);n=n!==null?n.ts(l):l}let s=this.dn.uh();return this.Hl.forEach((o=>{const l=o.Il(e,t);if(l?.priceRange){const x=new hA(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(x):x}var c,h,m,v;l?.margins&&(c=s,h=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,h.above),below:Math.max((v=c?.below)!==null&&v!==void 0?v:0,h.below)})})),new pn(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 t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}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 $f(this.cn.priceFormat.precision);break;case"percent":this.wa=new Jl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new cn(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 t=Fe(this.zt.el());this.Wl=this.Fl.map(((i,r)=>{const n=Fe(e.Va(i.time,!0)),s=n<t?1:-1;return{time:Fe(this.zt.ll(n,s)).ee,position:i.position,shape:i.shape,color:i.color,id:i.id,th:r,text:i.text,size:i.size,originalTime:i.originalTime}}))}ql(e){switch(this.dn=new xg(this,this.$t()),this.$l){case"Bar":this.wn=new Ag(this,this.$t());break;case"Candlestick":this.wn=new og(this,this.$t());break;case"Line":this.wn=new ug(this,this.$t());break;case"Custom":this.wn=new so(this,this.$t(),rA(e));break;case"Area":this.wn=new eg(this,this.$t());break;case"Baseline":this.wn=new ng(this,this.$t());break;case"Histogram":this.wn=new hg(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const i=[];return lo(this.Hl,e,t,i),i}}class Kg{constructor(e){this.cn=e}Oa(e,t,i){let r=e;if(this.cn.mode===0)return r;const n=i.vn(),s=n.Ct();if(s===null)return r;const o=n.Rt(e,s),l=i.Ba().filter((h=>h instanceof ho)).reduce(((h,m)=>{if(i.vr(m)||!m.yt())return h;const v=m.Dt(),x=m.In();if(v.Ni()||!x.Kr(t))return h;const F=x.Gh(t);if(F===null)return h;const T=ki(m.Ct());return h.concat([v.Rt(F.Vt[3],T.Vt)])}),[]);if(l.length===0)return r;l.sort(((h,m)=>Math.abs(h-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class zg extends LA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(i));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Fe(this.zt);if(s.Aa){e.strokeStyle=s.Ia,xi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*i);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,xi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class Vg{constructor(e){this.Wt=new zg,this.ft=!0,this.tn=e}bt(){this.ft=!0}gt(){if(this.ft){const e=this.tn.$t().W().grid,t={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((i=>({Ea:i.coord})))};this.Wt.J(t),this.ft=!1}return this.Wt}}class Wg{constructor(e){this.wn=new Vg(e)}qh(){return this.wn}}const uo={$a:4,Ua:1e-4};function Ni(A,e){const t=100*(A-e)/e;return e<0?-t:t}function Gg(A,e){const t=Ni(A.Ph(),e),i=Ni(A.Rh(),e);return new hA(t,i)}function fr(A,e){const t=100*(A-e)/e+100;return e<0?-t:t}function Rg(A,e){const t=fr(A.Ph(),e),i=fr(A.Rh(),e);return new hA(t,i)}function fn(A,e){const t=Math.abs(A);if(t<1e-15)return 0;const i=Math.log10(t+e.Ua)+e.$a;return A<0?-i:i}function gr(A,e){const t=Math.abs(A);if(t<1e-15)return 0;const i=Math.pow(10,t-e.$a)-e.Ua;return A<0?-i:i}function mr(A,e){if(A===null)return null;const t=fn(A.Ph(),e),i=fn(A.Rh(),e);return new hA(t,i)}function gn(A,e){if(A===null)return null;const t=gr(A.Ph(),e),i=gr(A.Rh(),e);return new hA(t,i)}function po(A){if(A===null)return uo;const e=Math.abs(A.Rh()-A.Ph());if(e>=1||e<1e-15)return uo;const t=Math.ceil(Math.abs(Math.log10(e))),i=uo.$a+t;return{$a:i,Ua:1/Math.pow(10,i)}}class fo{constructor(e,t){if(this.qa=e,this.Ya=t,(function(i){if(i<0)return!1;for(let r=i;r>1;r/=10)if(r%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let i=this.qa;i!==1;){if(i%2==0)this.Za.push(2),i/=2;else{if(i%5!=0)throw new Error("unexpected base");this.Za.push(2,2.5),i/=5}if(this.Za.length>100)throw new Error("something wrong with base")}}}Xa(e,t,i){const r=this.qa===0?0:1/this.qa;let n=Math.pow(10,Math.max(0,Math.ceil(Math.log10(e-t)))),s=0,o=this.Ya[0];for(;;){const m=hn(n,r,1e-14)&&n>r+1e-14,v=hn(n,i*o,1e-14),x=hn(n,1,1e-14);if(!(m&&v&&x))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=r+1e-14&&(n=r),n=Math.max(1,n),this.Za.length>0&&(l=n,c=1,h=1e-14,Math.abs(l-c)<h))for(s=0,o=this.Za[0];hn(n,i*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,h;return n}}class wc{constructor(e,t,i,r){this.Ka=[],this.Li=e,this.qa=t,this.Ga=i,this.Ja=r}Xa(e,t){if(e<t)throw new Error("high < low");const i=this.Li.At(),r=(e-t)*this.Qa()/i,n=new fo(this.qa,[2,2.5,2]),s=new fo(this.qa,[2,2,2.5]),o=new fo(this.qa,[2.5,2,2]),l=[];return l.push(n.Xa(e,t,r),s.Xa(e,t,r),o.Xa(e,t,r)),(function(c){if(c.length<1)throw Error("array is empty");let h=c[0];for(let m=1;m<c.length;++m)c[m]<h&&(h=c[m]);return h})(l)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const i=e.At(),r=this.Ga(i-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,l=i-1-s,c=Math.max(r,n),h=Math.min(r,n);if(c===h)return void(this.Ka=[]);let m=this.Xa(c,h),v=c%m;v+=v<0?m:0;const x=c>=h?1:-1;let F=null,T=0;for(let S=c-v;S>h;S-=m){const I=this.Ja(S,t,!0);F!==null&&Math.abs(I-F)<this.Qa()||I<o||I>l||(T<this.Ka.length?(this.Ka[T].Ea=I,this.Ka[T].so=e.eo(S)):this.Ka.push({Ea:I,so:e.eo(S)}),T++,F=I,e.ro()&&(m=this.Xa(S*x,h)))}this.Ka.length=T}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Bc(A){return A.slice().sort(((e,t)=>Fe(e.Xi())-Fe(t.Xi())))}var yc;(function(A){A[A.Normal=0]="Normal",A[A.Logarithmic=1]="Logarithmic",A[A.Percentage=2]="Percentage",A[A.IndexedTo100=3]="IndexedTo100"})(yc||(yc={}));const Cc=new Jl,vc=new cn(100,1);class $g{constructor(e,t,i,r){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 Ht,this.vo=new Ht,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=vc,this.xo=po(null),this.So=e,this.cn=t,this.ko=i,this.yo=r,this.Co=new wc(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(EA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=rA(e.scaleMargins.top),i=rA(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(i<0||i>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${i}`);if(t+i>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+i}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let i=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),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=gr(n.Ph(),s),l=gr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(i=gn(this.Ih,this.xo),i!==null&&this.Ao(i)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(i=mr(this.Ih,this.xo),i!==null&&this.Ao(i));const r=t.Cr!==this.cn.mode;r&&(t.Cr===2||this.Mh())&&this.Ra(),r&&(t.Cr===3||this.Oo())&&this.Ra(),e.Bo!==void 0&&t.Bo!==e.Bo&&(this.cn.invertScale=e.Bo,this.Io()),this.vo.m(t,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,t){const i=this.Ih;(t||i===null&&e!==null||i!==null&&!i.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,t){return this.Mh()?e=Ni(e,t):this.Oo()&&(e=fr(e,t)),this.Po(e,t)}te(e,t,i){this.Wo();const r=this.Fo(),n=Fe(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),m=i===void 0?0:i.from,v=i===void 0?e.length:i.to,x=this.Ho();for(let F=m;F<v;F++){const T=e[F],S=T._t;if(isNaN(S))continue;let I=S;x!==null&&(I=x(T._t,t));const Q=r+h*(I-s),N=c?Q:this.ho-1-Q;T.st=N}}be(e,t,i){this.Wo();const r=this.Fo(),n=Fe(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),h=l/(o-s),m=i===void 0?0:i.from,v=i===void 0?e.length:i.to,x=this.Ho();for(let F=m;F<v;F++){const T=e[F];let S=T.ge,I=T.Me,Q=T.xe,N=T.Se;x!==null&&(S=x(T.ge,t),I=x(T.Me,t),Q=x(T.xe,t),N=x(T.Se,t));let J=r+h*(S-s),H=c?J:this.ho-1-J;T.pe=H,J=r+h*(I-s),H=c?J:this.ho-1-J,T.de=H,J=r+h*(Q-s),H=c?J:this.ho-1-J,T.fe=H,J=r+h*(N-s),H=c?J:this.ho-1-J,T.me=H}}pn(e,t){const i=this.To(e,t);return this.$o(i,t)}$o(e,t){let i=e;return this.Mh()?i=(function(r,n){return n<0&&(r=-r),r/100*n+n})(i,t):this.Oo()&&(i=(function(r,n){return r-=100,n<0&&(r=-r),r/100*n+n})(i,t)),i}Ba(){return this.po}Uo(){if(this.mo)return this.mo;let e=[];for(let t=0;t<this.po.length;t++){const i=this.po[t];i.Xi()===null&&i.Ki(t+1),e.push(i)}return e=Bc(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const i=t.Ct();i!==null&&(e===null||i.la<e.la)&&(e=i)}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 t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}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=Fe(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 t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const i=Fe(this.ao).Th();t=Math.max(t,.1),i.Vh(t),this.Ao(i)}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=Fe(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Fe(this.Lh()).Dh()/(this.Eo()-1);let i=e-this.Mo;this.Bo()&&(i*=-1);const r=i*t,n=Fe(this.ao).Th();n.Oh(r),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,t){switch(this.cn.mode){case 2:return this.s_(Ni(e,t));case 3:return this.ba().format(fr(e,t));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,Fe(this.e_()).ba())}Zl(e,t){return e=Ni(e,t),this.s_(e,Cc)}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 t=100;e!==null&&(t=Math.round(1/e.ma())),this.wa=vc,this.Mh()?(this.wa=Cc,t=100):this.Oo()?(this.wa=new cn(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new wc(this,t,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,t){if(this.Wo(),this.Ni())return 0;e=this.ro()&&e?fn(e,this.xo):e;const i=Fe(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-i.Ph())/i.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const i=this.jo(e),r=Fe(this.Lh()),n=r.Ph()+r.Dh()*((i-this.Fo())/(this.Eo()-1));return this.ro()?gr(n,this.xo):n}Io(){this.bo=null,this.Co.io()}l_(){const e=this.oo.uo;if(e===null)return;let t=null;const i=this.r_();let r=0,n=0;for(const l of i){if(!l.yt())continue;const c=l.Ct();if(c===null)continue;const h=l.Il(e.Os(),e.ui());let m=h&&h.Lh();if(m!==null){switch(this.cn.mode){case 1:m=mr(m,this.xo);break;case 2:m=Gg(m,c.Vt);break;case 3:m=Rg(m,c.Vt)}if(t=t===null?m:t.ts(Fe(m)),h!==null){const v=h.Eh();v!==null&&(r=Math.max(r,v.above),n=Math.max(n,v.below))}}}if(r===this.co&&n===this.do||(this.co=r,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const l=this.e_(),c=5*(l===null||this.Mh()||this.Oo()?1:l.ma());this.ro()&&(t=gn(t,this.xo)),t=new hA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=mr(t,this.xo))}if(this.ro()){const l=gn(t,this.xo),c=po(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?gn(this.ao,this.xo):null;this.xo=c,t=mr(l,c),h!==null&&(this.ao=mr(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new hA(-.5,.5)),this.xo=po(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ni:this.Oo()?fr:this.ro()?e=>fn(e,this.xo):null}a_(e,t,i){return t===void 0?(i===void 0&&(i=this.ba()),i.format(e)):t(e)}Wh(e,t){return this.a_(e,this.yo.priceFormatter,t)}s_(e,t){return this.a_(e,this.yo.percentageFormatter,t)}}class Xg{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Ht,this.yl=e,this.$i=t,this.d_=new Wg(this);const i=t.W();this.f_=this.v_("left",i.leftPriceScale),this.p_=this.v_("right",i.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(i)}b_(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 t=Array.from(this.o_.values());for(const i of t){const r=Fe(i[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?rA(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((t=>{if(this.vr(t)){const i=t.Dt();i!==null&&i.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,i){const r=i!==void 0?i:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ai(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const i=Fe(e.Dt()).Pa();if(this.o_.has(i)){const n=rA(this.o_.get(i)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(i))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),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,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),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 t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),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=Bc(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const i=this.yl.Xs();i!==null&&e.h_(i)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,i=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>i&&(i=n))}return{H_:t,y_:i}}T_(e,t,i){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!ln(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(i),this.P_(r),this.mo=null}m_(e,t,i){t.Cr!==i.Cr&&this.L_(e)}v_(e,t){const i=Object.assign({visible:!0,autoScale:!0},jA(t)),r=new $g(e,i,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Jg{constructor(e,t,i=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=i}Y_(e){const t=e.time,i=this.q_.cacheKey(t),r=this.tr.get(i);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(rA(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(i,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,i),this.Ke++,this.Ge++,n}}class wr{constructor(e,t){ai(e<=t,"right should be >= left"),this.X_=e,this.K_=t}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 Tc(A,e){return A===null||e===null?A===e:A.Ch(e)}class Zg{constructor(){this.J_=new Map,this.tr=null,this.Q_=!1}tu(e){this.Q_=e,this.tr=null}iu(e,t){this.nu(t),this.tr=null;for(let i=t;i<e.length;++i){const r=e[i];let n=this.J_.get(r.timeWeight);n===void 0&&(n=[],this.J_.set(r.timeWeight,n)),n.push({index:i,time:r.time,weight:r.timeWeight,originalTime:r.originalTime})}}su(e,t){const i=Math.ceil(t/e);return this.tr!==null&&this.tr.eu===i||(this.tr={Ha:this.ru(i),eu:i}),this.tr.Ha}nu(e){if(e===0)return void this.J_.clear();const t=[];this.J_.forEach(((i,r)=>{e<=i[0].index?t.push(r):i.splice(hr(i,e,(n=>n.index<e)),1/0)}));for(const i of t)this.J_.delete(i)}ru(e){let t=[];for(const i of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(i))continue;const r=t;t=[];const n=r.length;let s=0;const o=rA(this.J_.get(i)),l=o.length;let c=1/0,h=-1/0;for(let m=0;m<l;m++){const v=o[m],x=v.index;for(;s<n;){const F=r[s],T=F.index;if(!(T<x)){c=T;break}s++,t.push(F),h=T,c=1/0}if(c-x>=e&&x-h>=e)t.push(v),h=x;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class Ki{constructor(e){this.hu=e}lu(){return this.hu===null?null:new wr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new Ki(null)}}function Yg(A,e){return A.weight>e.weight?A:e}class qg{constructor(e,t,i,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Zg,this.du=new Map,this.fu=Ki.ou(),this.vu=!0,this.pu=new Ht,this.mu=new Ht,this.bu=new Ht,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=i,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){EA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var i;EA(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((i=e.barSpacing)!==null&&i!==void 0?i:this.Su),this.Cu(),this.ku(),this.bu.m()}mn(e){var t,i;return(i=(t=this.uu[e])===null||t===void 0?void 0:t.time)!==null&&i!==void 0?i:null}Ui(e){var t;return(t=this.uu[e])!==null&&t!==void 0?t:null}Va(e,t){if(this.uu.length<1)return null;if(this.q_.key(e)>this.q_.key(this.uu[this.uu.length-1].time))return t?this.uu.length-1:null;const i=hr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[i].time)?t?i:null:i}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),i=Math.round(e.to),r=Fe(this.Bu()),n=Fe(this.Au());return{from:Fe(this.Ui(Math.max(r,t))),to:Fe(this.Ui(Math.min(n,i)))}}Iu(e){return{from:Fe(this.Va(e.from,!0)),to:Fe(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),i=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&i!==0){const r=this.Su*e/i;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=i-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!ar(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const i=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=i+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}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,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),i=Math.round(t/e),r=Fe(this.Xs()),n=Math.max(r.Os(),r.Os()-i),s=Math.max(r.ui(),r.ui()-i),o=this.cu.su(e,t),l=this.Bu()+i,c=this.Au()-i,h=this.$u(),m=this.cn.fixLeftEdge||h,v=this.cn.fixRightEdge||h;let x=0;for(const F of o){if(!(n<=F.index&&F.index<=s))continue;let T;x<this.Mu.length?(T=this.Mu[x],T.coord=this.It(F.index),T.label=this.Uu(F),T.weight=F.weight):(T={needAlignCoordinate:!1,coord:this.It(F.index),label:this.Uu(F),weight:F.weight},this.Mu.push(T)),this.Su>t/2&&!h?T.needAlignCoordinate=!1:T.needAlignCoordinate=m&&F.index<=l||v&&F.index>=c,x++}return this.Mu.length=x,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,t){const i=this.Fu(e),r=this.le(),n=r+t*(r/10);this.Gn(n),this.cn.rightBarStaysOnScroll||this.Jn(this.Hu()+(i-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 t=io(this.__-e,0,this.__),i=io(this.__-Fe(this.wo),0,this.__);t!==0&&i!==0&&this.Gn(this.wu.le*t/i)}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 t=(this.Mo-e)/this.le();this.xu=Fe(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const i=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:i+(e-i)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new wr(e,t+this.cn.rightOffset))}lc(e){const t=new wr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.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 t=this.ac(e),i=this.Eu()+this.xu-t;return Math.round(1e6*i)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(Ki.ou());const e=this.Eu(),t=this.__/this.Su,i=this.xu+e,r=new wr(i-t+1,i);this._c(new Ki(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,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 t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-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 t=this.du.get(e.weight);return t===void 0&&(t=new Jg((i=>this.fc(i)),this.q_),this.du.set(e.weight,t)),t.Y_(e)}fc(e){return this.q_.formatTickmark(e,this.yo)}_c(e){const t=this.fu;this.fu=e,Tc(t.lu(),this.fu.lu())||this.pu.m(),Tc(t.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 t=this.Xs();if(t===null)return;const i=t.Os()-e;if(i<0){const r=this.xu-i-1;this.Jn(r)}this.zu()}Pu(){this.Lu(),this.zu()}}class jg{X(e,t,i){e.useMediaCoordinateSpace((r=>this.K(r,t,i)))}gl(e,t,i){e.useMediaCoordinateSpace((r=>this.vc(r,t,i)))}vc(e,t,i){}}class e0 extends jg{constructor(e){super(),this.mc=new Map,this.zt=e}K(e){}vc(e){if(!this.zt.yt)return;const{context:t,mediaSize:i}=e;let r=0;for(const s of this.zt.bc){if(s.Kt.length===0)continue;t.font=s.R;const o=this.wc(t,s.Kt);o>i.width?s.Zu=i.width/o:s.Zu=1,r+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((i.height-r)/2,0);break;case"bottom":n=Math.max(i.height-r,0)}t.fillStyle=this.zt.V;for(const s of this.zt.bc){t.save();let o=0;switch(this.zt.xc){case"left":t.textAlign="left",o=s.gc/2;break;case"center":t.textAlign="center",o=i.width/2;break;case"right":t.textAlign="right",o=i.width-1-s.gc/2}t.translate(o,n),t.textBaseline="top",t.font=s.R,t.scale(s.Zu,s.Zu),t.fillText(s.Kt,0,s.Sc),t.restore(),n+=s.gc*s.Zu}}wc(e,t){const i=this.kc(e.font);let r=i.get(t);return r===void 0&&(r=e.measureText(t).width,i.set(t,r)),r}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class t0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new e0(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(),t=this.Ft;t.yt=e.visible,t.yt&&(t.V=e.color,t.xc=e.horzAlign,t.Mc=e.vertAlign,t.bc=[{Kt:e.text,R:Oi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class A0 extends to{constructor(e,t){super(),this.cn=t,this.wn=new t0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var bc,xc,Qc,Fc,Uc;(function(A){A[A.OnTouchEnd=0]="OnTouchEnd",A[A.OnNextTap=1]="OnNextTap"})(bc||(bc={}));class i0{constructor(e,t,i){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Ht,this.Rc=new Ht,this.Dc=null,this.Vc=e,this.cn=t,this.q_=i,this.Oc=new Pf(this),this.yl=new qg(this,t.timeScale,this.cn.localization,i),this.vt=new Rf(this,t.crosshair),this.Bc=new Kg(t.crosshair),this.Ac=new A0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Rt.es())}Uh(){this.Nc(Rt.ss())}oa(){this.Nc(new Rt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){EA(this.cn,e),this.yc.forEach((t=>t.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,t){if(e==="left")return void this.$h({leftPriceScale:t});if(e==="right")return void this.$h({rightPriceScale:t});const i=this.Uc(e);i!==null&&(i.Dt.$h(t),this.Pc.m())}Uc(e){for(const t of this.yc){const i=t.w_(e);if(i!==null)return{Ht:t,Dt:i}}return null}St(){return this.yl}qc(){return this.yc}Yc(){return this.Ac}Zc(){return this.vt}Xc(){return this.Rc}Kc(e,t){e.Lo(t),this.Wu()}S_(e){this.__=e,this.yl.S_(this.__),this.yc.forEach((t=>t.S_(e))),this.Wu()}Ic(e){const t=new Xg(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const i=e===void 0?this.yc.length-1:e,r=Rt.es();return r.Nn(i,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,i){e.V_(t,i)}O_(e,t,i){e.O_(t,i),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,i){t.Vo()||e.A_(t,i)}I_(e,t,i){t.Vo()||(e.I_(t,i),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const i=this.St();if(i.Ni()||t===0)return;const r=i.Hi();e=Math.max(1,Math.min(e,r)),i.Zu(e,t),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,t,i,r,n){this.vt.gn(e,t);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 c=r.vn(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,r),this.vt.kn(o,s,r),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},i)}ad(e,t,i){const r=i.vn(),n=r.Ct(),s=r.Rt(e,Fe(n)),o=this.yl.Va(t,!0),l=this.yl.It(Fe(o));this.ld(l,s,null,i,!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 t=this.vt.xn(),i=this.vt.Sn();this.ld(t,i,null,e)}this.vt.Vn()}_d(e,t,i){const r=this.yl.mn(0);t!==void 0&&i!==void 0&&this.yl.bt(t,i);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),h=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,v=l&&(i!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!v){const x=e-s;this.yl.Jn(this.yl.Hu()-x)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((i=>i.Uo().includes(e)));return t===void 0?null:t}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,t,i){const r=this.yc[0],n=this.fd(t,e,r,i);return this.Cc.push(n),this.Cc.length===1?this.Kl():this.Uh(),n}vd(e){const t=this.dr(e),i=this.Cc.indexOf(e);ai(i!==-1,"Series not found"),this.Cc.splice(i,1),Fe(t).Zo(e),e.S&&e.S()}Xl(e,t){const i=Fe(this.dr(e));i.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();i.qo(e,t,n)}else{const n=r.Ht===i?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Rt.ss();e.$n(),this.Nc(e)}pd(e){const t=Rt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Rt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Rt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Rt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Rt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Rt.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 t=this.Ec,i=this.zc;if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==i||this.Dc.Rs!==t)this.Dc={Ps:i,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,h,m]=or(n),[v,x,F,T]=or(s),S=[vA(l+o*(v-l)),vA(c+o*(x-c)),vA(h+o*(F-h)),Nl(m+o*(T-m))];return`rgba(${S[0]}, ${S[1]}, ${S[2]}, ${S[3]})`})(i,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const i=new Rt(t);if(e!==null){const r=this.yc.indexOf(e);i.Nn(r,{Fn:t})}return i}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,i,r){const n=new ho(this,e,t,i,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return i.qo(n,s),ln(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function go(A){return!KA(A)&&!lr(A)}function Sc(A){return KA(A)}(function(A){A[A.Disabled=0]="Disabled",A[A.Continuous=1]="Continuous",A[A.OnDataUpdate=2]="OnDataUpdate"})(xc||(xc={})),(function(A){A[A.LastBar=0]="LastBar",A[A.LastVisible=1]="LastVisible"})(Qc||(Qc={})),(function(A){A.Solid="solid",A.VerticalGradient="gradient"})(Fc||(Fc={})),(function(A){A[A.Year=0]="Year",A[A.Month=1]="Month",A[A.DayOfMonth=2]="DayOfMonth",A[A.Time=3]="Time",A[A.TimeWithSeconds=4]="TimeWithSeconds"})(Uc||(Uc={}));const Ec=A=>A.getUTCFullYear();function r0(A,e,t){return e.replace(/yyyy/g,(i=>ei(Ec(i),4))(A)).replace(/yy/g,(i=>ei(Ec(i)%100,2))(A)).replace(/MMMM/g,((i,r)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(r,{month:"long"}))(A,t)).replace(/MMM/g,((i,r)=>new Date(i.getUTCFullYear(),i.getUTCMonth(),1).toLocaleString(r,{month:"short"}))(A,t)).replace(/MM/g,(i=>ei((r=>r.getUTCMonth()+1)(i),2))(A)).replace(/dd/g,(i=>ei((r=>r.getUTCDate())(i),2))(A))}class Lc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return r0(e,this.gd,this.Md)}}class n0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",ei(e.getUTCHours(),2)).replace("%m",ei(e.getUTCMinutes(),2)).replace("%s",ei(e.getUTCSeconds(),2))}}const s0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class o0{constructor(e={}){const t=Object.assign(Object.assign({},s0),e);this.Td=new Lc(t.Sd,t.Cd),this.Pd=new n0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function mn(A){return 60*A*60*1e3}function mo(A){return 60*A*1e3}const wn=[{Dd:(Mc=1,1e3*Mc),Vd:10},{Dd:mo(1),Vd:20},{Dd:mo(5),Vd:21},{Dd:mo(30),Vd:22},{Dd:mn(1),Vd:30},{Dd:mn(3),Vd:31},{Dd:mn(6),Vd:32},{Dd:mn(12),Vd:33}];var Mc;function Hc(A,e){if(A.getUTCFullYear()!==e.getUTCFullYear())return 70;if(A.getUTCMonth()!==e.getUTCMonth())return 60;if(A.getUTCDate()!==e.getUTCDate())return 50;for(let t=wn.length-1;t>=0;--t)if(Math.floor(e.getTime()/wn[t].Dd)!==Math.floor(A.getTime()/wn[t].Dd))return wn[t].Vd;return 0}function wo(A){let e=A;if(lr(A)&&(e=Bo(A)),!go(e))throw new Error("time must be of type BusinessDay");const t=new Date(Date.UTC(e.year,e.month-1,e.day,0,0,0,0));return{Od:Math.round(t.getTime()/1e3),Bd:e}}function Ic(A){if(!Sc(A))throw new Error("time must be of type isUTCTimestamp");return{Od:A}}function Bo(A){const e=new Date(A);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${A}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Pc(A){lr(A.time)&&(A.time=Bo(A.time))}class Dc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(Pc)})(e):Pc(e)}createConverterToInternalObj(e){return Fe((function(t){return t.length===0?null:go(t[0].time)||lr(t[0].time)?wo:Ic})(e))}key(e){return typeof e=="object"&&"Od"in e?e.Od:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){const t=e;return t.Bd===void 0?new Date(1e3*t.Od).getTime():new Date(Date.UTC(t.Bd.year,t.Bd.month-1,t.Bd.day)).getTime()}convertHorzItemToInternal(e){return Sc(t=e)?Ic(t):go(t)?wo(t):wo(Bo(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new o0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Lc(t,e.locale)}formatHorzItem(e){const t=e;return this.Ad.Y_(new Date(1e3*t.Od))}formatTickmark(e,t){const i=(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),r=this.cn.timeScale;if(r.tickMarkFormatter!==void 0){const n=r.tickMarkFormatter(e.originalTime,i,t.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 c=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(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()).toLocaleString(o,l)})(e.time,i,t.locale)}maxTickMarkWeight(e){let t=e.reduce(Yg,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(i,r=0){if(i.length===0)return;let n=r===0?null:i[r-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let l=r;l<i.length;++l){const c=i[l],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=Hc(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}if(r===0&&i.length>1){const l=Math.ceil(o/(i.length-1)),c=new Date(1e3*(i[0].time.Od-l));i[0].timeWeight=Hc(new Date(1e3*i[0].time.Od),c)}})(e,t)}static Id(e){return EA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const zi=typeof window<"u";function _c(){return!!zi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function yo(){return!!zi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Co(A){return A+A%2}function vo(A,e){return A.zd-e.zd}function To(A,e,t){const i=(A.zd-e.zd)/(A.ot-e.ot);return Math.sign(i)*Math.min(Math.abs(i),t)}class a0{constructor(e,t,i,r){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=t,this.qd=i,this.rs=r}Yd(e,t){if(this.Ld!==null){if(this.Ld.ot===t)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:t,zd:e}}Vr(e,t){if(this.Ld===null||this.Ed===null||t-this.Ld.ot>50)return;let i=0;const r=To(this.Ld,this.Ed,this.Ud),n=vo(this.Ld,this.Ed),s=[r],o=[n];if(i+=n,this.Nd!==null){const c=To(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const h=vo(this.Ed,this.Nd);if(s.push(c),o.push(h),i+=h,this.Fd!==null){const m=To(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const v=vo(this.Nd,this.Fd);s.push(m),o.push(v),i+=v}}}}let l=0;for(let c=0;c<s.length;++c)l+=o[c]/i*s[c];Math.abs(l)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=l,this.jd=(function(c,h){const m=Math.log(h);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Fe(this.Wd),i=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,i)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Fe(this.Wd).ot;return Math.min(t,this.jd)}}class l0{constructor(e,t){this.Xd=void 0,this.Kd=void 0,this.Gd=void 0,this.en=!1,this.Jd=e,this.Qd=t,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 Kl(or(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 Qi(A,e){const t=Fe(A.ownerDocument).createElement("canvas");A.appendChild(t);const i=yf(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return i.resizeCanvasElement(e),i}function Fi(A){var e;A.width=1,A.height=1,(e=A.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function bo(A,e,t,i){A.gl&&A.gl(e,t,i)}function Bn(A,e,t,i){A.X(e,t,i)}function xo(A,e,t,i){const r=A(t,i);for(const n of r){const s=n.gt();s!==null&&e(s)}}function c0(A){zi&&window.chrome!==void 0&&A.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Qo{constructor(e,t,i){this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY},this.df=null,this.ff=!1,this.vf=null,this.pf=null,this.mf=!1,this.bf=!1,this.wf=!1,this.gf=null,this.Mf=null,this.xf=null,this.Sf=null,this.kf=null,this.yf=null,this.Cf=null,this.Tf=0,this.Pf=!1,this.Rf=!1,this.Df=!1,this.Vf=0,this.Of=null,this.Bf=!yo(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(zA(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(zA(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=i,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(e){this.Sf&&this.Sf();const t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const i=this.Ef(e);this.Uf(i,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(e){if(this.Df||this.pf!==null||this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=Fo(e.changedTouches,Fe(this.Of));if(t===null||(this.Vf=yn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const i=this.Ff(zA(t),Fe(this.pf)),{nv:r,sv:n,Nf:s}=i;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Vi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(zA(e),Fe(this.vf)),{Nf:i}=t;if(i>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const i=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:i,sv:r,Nf:i+r}}ov(e){let t=Fo(e.changedTouches,Fe(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=yn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const i=this.Ef(e,t);if(this.Wf(i,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(zA(t),this.cf);r<30&&!this.wf&&this.Wf(i,this.Hf.jf),this.$f()}else this.wf||(this.Wf(i,this.Hf.uv),this.Hf.uv&&Vi(e));this._f===0&&Vi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Vi(e))}If(e){if(e.button!==0)return;const t=this.Ef(e);if(this.vf=null,this.Df=!1,this.kf&&(this.kf(),this.kf=null),_c()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:i}=this.Ff(zA(e),this.af);i<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=yn(e);const i=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=zA(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{i.removeEventListener("touchmove",n),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",n,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=zA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;_c()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=zA(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const i=this.Ef(e);this.Uf(i,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=zA(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=i=>{this.Hf.wv&&(i.composed&&this.Zf.contains(i.composedPath()[0])||i.target&&this.Zf.contains(i.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}yo()&&(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}),c0(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 t=kc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Vi(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 t=this.Zf.getBoundingClientRect()||{left:0,top:0};this.Cf={nt:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,st:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Tf=kc(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 t=this.Ef(e);this.Uf(t,this.Hf.Pv),this.Bf=!yo()}vv(e){const t=Fo(e.touches,Fe(this.Of));if(t===null)return;const i=this.Ef(e,t);this.Wf(i,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:yn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const i=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-r.left,localY:i.clientY-r.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:i.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Vi(e)}}}}function kc(A,e){const t=A.clientX-e.clientX,i=A.clientY-e.clientY;return Math.sqrt(t*t+i*i)}function Vi(A){A.cancelable&&A.preventDefault()}function zA(A){return{nt:A.pageX,st:A.pageY}}function yn(A){return A.timeStamp||performance.now()}function Fo(A,e){for(let t=0;t<A.length;++t)if(A[t].identifier===e)return A[t];return null}function Cn(A){return{Hc:A.Hc,Iv:{gr:A.zv.externalId},Lv:A.zv.cursorStyle}}function h0(A,e,t){for(const i of A){const r=i.gt();if(r!==null&&r.wr){const n=r.wr(e,t);if(n!==null)return{Bv:i,Iv:n}}}return null}function Uo(A,e){return t=>{var i,r,n,s;return((r=(i=t.Dt())===null||i===void 0?void 0:i.Pa())!==null&&r!==void 0?r:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,A))!==null&&s!==void 0?s:[]}}function Oc(A,e,t,i){if(!A.length)return;let r=0;const n=t/2,s=A[0].At(i,!0);let o=e===1?n-(A[0].Vi()-s/2):A[0].Vi()-s/2-n;o=Math.max(0,o);for(let l=1;l<A.length;l++){const c=A[l],h=A[l-1],m=h.At(i,!1),v=c.Vi(),x=h.Vi();if(e===1?v>x-m:v<x+m){const F=x-m*e;c.Oi(F);const T=F-e*m/2;if((e===1?T<0:T>t)&&o>0){const S=e===1?-1-T:T-t,I=Math.min(S,o);for(let Q=r;Q<A.length;Q++)A[Q].Oi(A[Q].Vi()+e*I);o-=I}}else r=l,o=e===1?x-m-v:v-(x+m)}}class Nc{constructor(e,t,i,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new ur(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=t,this.ko=t.layout,this.Oc=i,this.qv=r==="left",this.Yv=Uo("normal",r),this.Zv=Uo("top",r),this.Xv=Uo("bottom",r),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=Qi(this.Kv,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=Qi(this.Kv,Ft({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 Qo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(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 t=this.ap(),i=Fe(this.Gv.canvasElement.getContext("2d"));i.save();const r=this.Li.Ha();i.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(i,r[0].so),this.Fv.xi(i,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(i,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(i,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(i,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;i.restore();const l=e||34;return Co(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&Ti(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 Fe(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,Fe(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(i,this.Xv),this.wp(i),this.tn.bp(i,this.Yv),this.gp(i))}this.Jv.applySuggestedBitmapSize();const t=bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}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 t=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!0,t.V_(i,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),i=this.tn.fp(),r=this.Li;t.O_(i,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),i=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,i))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),i=this.tn.fp();this.Nv=!1,t.B_(i,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=[],t=this.Li===null?void 0:this.Li;return(i=>{for(let r=0;r<i.length;++r){const n=i[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:i,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?on(e,0,0,i,r,s):Wl(e,0,0,i,r,s,o)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:i}){if(this.Ev===null||this.Li===null||!this.Li.W().borderVisible)return;e.fillStyle=this.Li.W().borderColor;const r=Math.max(1,Math.floor(this.ap().C*i));let n;n=this.qv?t.width-r:0,e.fillRect(n,0,r,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),i=this.Li.W(),r=this.ap(),n=this.qv?this.Ev.width-r.T:0;i.borderVisible&&i.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{s.fillStyle=i.borderColor;const c=Math.max(1,Math.floor(l)),h=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const v of t)s.rect(Math.floor(n*o),Math.round(v.Ea*l)-h,m,c);s.fill()})),e.useMediaCoordinateSpace((({context:s})=>{var o;s.font=this._p(),s.fillStyle=(o=i.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-r.A):Math.round(n+r.T+r.A),c=t.map((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const m=t[h];s.fillText(m.so,l,m.Ea+c[h])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),i=this.tn.fp(),r=this.ap();this.Li===i.pr()&&this.tn.fp().Uo().forEach((s=>{i.vr(s)&&t.push(s)}));const n=this.Li;t.forEach((s=>{s.Rn(i,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,r)}yp(e,t){if(this.Ev===null)return;const i=this.Ev.height/2,r=e.filter((s=>s.ki()<=i)),n=e.filter((s=>s.ki()>i));r.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(t)/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)}Oc(r,1,this.Ev.height,t),Oc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),i=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Fe(this.Li)).X(e,i,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),i=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&i.push(n);const s=this.ap(),o=this.qv?"right":"left";i.forEach((l=>{l.forEach((c=>{c.gt(Fe(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 Oi(this.ko.fontSize,this.ko.fontFamily)}}function u0(A,e){var t,i;return(i=(t=A.ua)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function vn(A,e){var t,i;return(i=(t=A.Pn)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function p0(A,e){var t,i;return(i=(t=A.Ji)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}function d0(A,e){var t,i;return(i=(t=A.aa)===null||t===void 0?void 0:t.call(A,e))!==null&&i!==void 0?i:[]}class So{constructor(e,t){this.Ev=Ft({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Ht,this.Op=new Ht,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=t,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.style.position="relative",i.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(i),this.Gv=Qi(i,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=Qi(i,Ft({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const n=this.Jv.canvasElement;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0",this.$p=document.createElement("tr"),this.$p.appendChild(this.jp),this.$p.appendChild(this.Wp),this.$p.appendChild(this.Hp),this.Up(),this.hp=new Qo(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),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Fe(this.Np)}qp(e){var t,i;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(So.prototype.Fp.bind(this),this,!0),this.Up(),this.Qd.Yp().indexOf(this)===this.Qd.Yp().length-1?(this.Pp=(t=this.Pp)!==null&&t!==void 0?t:new l0(this.Wp,this.Qd),this.Pp.bt()):((i=this.Pp)===null||i===void 0||i.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Fe(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Fe(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 t=e.localX,i=e.localY;this.Gp(t,i,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const i=e.localX,r=e.localY;this.Gp(i,r,e);const n=this.wr(i,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t: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 t={x:e.localX,y:e.localY};this.rm(t,t,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,t){if(!this.Qd.W().handleScale.pinch)return;const i=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,i)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,i=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Fe(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(i-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,t){const i=this.Np;return i===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,h,m){var v,x;let F,T;for(const Q of c){const N=(x=(v=Q.va)===null||v===void 0?void 0:v.call(Q,h,m))!==null&&x!==void 0?x:[];for(const J of N)S=J.zOrder,(!(I=F?.zOrder)||S==="top"&&I!=="top"||S==="normal"&&I==="bottom")&&(F=J,T=Q)}var S,I;return F&&T?{zv:F,Hc:T}:null})(o,n,s);if(l?.zv.zOrder==="top")return Cn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Cn(l);const h=h0(c.Pn(r),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return Cn(l)}return l?.zv?Cn(l):null})(i,e,t)}_m(e,t){Fe(t==="left"?this.Cp:this.Tp).cp(Ft({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){Ti(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=Fe(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const i=t.Dt();i!==null&&e.P_(i),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}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 i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(i,u0),this.vm(i),this.pm(i),this.fm(i,vn),this.fm(i,p0)))}this.Jv.applySuggestedBitmapSize();const t=bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,d0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const i=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(i),{x:i,y:r},t)}mp({context:e,bitmapSize:t}){const{width:i,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?on(e,0,0,i,r,o):Wl(e,0,0,i,r,s,o)}vm(e){const t=Fe(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,vn,bo,t),this.Mm(e,vn,Bn,t)}bm(e){this.Mm(e,vn,Bn,this.$i().Zc())}fm(e,t){const i=Fe(this.Np).Uo();for(const r of i)this.Mm(e,t,bo,r);for(const r of i)this.Mm(e,t,Bn,r)}Mm(e,t,i,r){const n=Fe(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;xo(t,(c=>i(c,e,o,l)),r,n)}Zp(){if(this.Np===null)return;const e=this.Qd,t=this.Np.R_().W().visible,i=this.Np.D_().W().visible;t||this.Cp===null||(this.jp.removeChild(this.Cp.lp()),this.Cp.S(),this.Cp=null),i||this.Tp===null||(this.Hp.removeChild(this.Tp.lp()),this.Tp.S(),this.Tp=null);const r=e.$t().ud();t&&this.Cp===null&&(this.Cp=new Nc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),i&&this.Tp===null&&(this.Tp=new Nc(this,e.W(),r,"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,t,i){this.$i().ld(this.Sm(e),this.km(t),i,Fe(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,i){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,i);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),i=this.fp();if(t.z_(i,i.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Fe(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 t=this.$i(),i=t.St();if(i.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.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 c=i.le();this.Ep=new a0(.2/c,7/c,.997,15/c),this.Ep.Yd(i.Hu(),this.Rp.Od)}else this.Ep=null;o.Ni()||t.A_(this.Np,o,e.localY),t.nd(e.localX),this.Dp=!0}this.Dp&&(o.Ni()||t.I_(this.Np,o,e.localY),t.sd(e.localX),this.Ep!==null&&this.Ep.Yd(i.Hu(),l))}}class Kc{constructor(e,t,i,r,n){this.ft=!0,this.Ev=Ft({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=i.ud,this.cn=t,this.Tm=r,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=Qi(this.Kv,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){Ti(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 t=bi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:i,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*i),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){on(e,0,0,t.width,t.height,this.Pm())}}function Eo(A){return e=>{var t,i;return(i=(t=e.fa)===null||t===void 0?void 0:t.call(e,A))!==null&&i!==void 0?i:[]}}const f0=Eo("normal"),g0=Eo("top"),m0=Eo("bottom");class w0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=Ft({width:0,height:0}),this.Om=new Ht,this.Fv=new ur(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_=t,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=Qi(this.Im,Ft({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=Qi(this.Im,Ft({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const r=this.Jv.canvasElement;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.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 Qo(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),Fi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Fi(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 t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.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 t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.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,t,i){Ti(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(Ft({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(Ft({width:i,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,t,i){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,i)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const i=bi(this.Gv);i!==null&&(i.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(i,m0)})),this.wp(i),this.$m(i,f0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=bi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:i,bitmapSize:r})=>{i.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,g0))}$m(e,t){const i=this.Qd.$t().wt();for(const r of i)xo(t,(n=>bo(n,e,!1,void 0)),r,void 0);for(const r of i)xo(t,(n=>Bn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){on(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:i}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*i));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),i=t.Ha();if(!i||i.length===0)return;const r=this.q_.maxTickMarkWeight(i),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const h=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const v=Math.round(n.T*c);for(let x=i.length;x--;){const F=Math.round(i[x].coord*l);o.rect(F-m,0,h,v)}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 c of i)if(c.weight<r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of i)if(c.weight>=r){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,l)}}))}Ym(e,t,i){const r=this.Fv.xi(e,i),n=r/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+r>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+r))),t}Um(e,t){const i=this.jm();for(const r of e)for(const n of r.Qi())n.gt().X(t,i)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return Oi(this.j(),this.cn.fontFamily)}Zm(){return Oi(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 ur,Hm:0});const e=this.k,t=this._p();if(e.R!==t){const i=this.j();e.P=i,e.R=t,e.L=3*i/12,e.B=3*i/12,e.ji=9*i/12,e.N=0,e.Hm=4*i/12,e.Wi.nr()}return this.k}kp(e){this.Kv.style.cursor=e===1?"ew-resize":"default"}zm(){const e=this.Qd.$t(),t=e.W();t.leftPriceScale.visible||this.Rm===null||(this.Bm.removeChild(this.Rm.lp()),this.Rm.S(),this.Rm=null),t.rightPriceScale.visible||this.Dm===null||(this.Am.removeChild(this.Dm.lp()),this.Dm.S(),this.Dm=null);const i={ud:this.Qd.$t().ud()},r=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Kc("left",t,i,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Kc("right",t,i,r,n),this.Am.appendChild(this.Dm.lp()))}}const B0=!!zi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((A=>A.brand.includes("Chromium")))&&!!zi&&(!((Lo=navigator?.userAgentData)===null||Lo===void 0)&&Lo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Lo;class y0{constructor(e,t,i){var r;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 Ht,this.Op=new Ht,this.Rc=new Ht,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=i,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Mo(this.cn)&&this.hb(!0),this.$i=new i0(this.Vc.bind(this),this.cn,i),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new w0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.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=[],Fe(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,t,i=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return Ft({width:l-l%2,height:c-c%2})})(Ft({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Fe(this.Xd).style.height=n,Fe(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,i?this.mb(Rt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Rt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=Mo(this.cn);this.$i.$h(e);const i=Mo(this.cn);i!==t&&this.hb(i),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),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const i=Fe(t.getContext("2d"));return this.gb(i),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Fe(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 rA(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 t=0,i=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let h=0;h<this.Xm.length;h++){const m=this.Xm[h],v=Fe(o==="left"?m.wm():m.gm()),x=v.xp();e!==null&&v.Sp(e,l,c),c+=x.height}};this.xb()&&(n("left",0),t+=Fe(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,i),i+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Fe(r.gm()).xp().width);const s=(o,l,c)=>{Fe(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Fe(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,i),l=Fe(r.wm()).xp().width),this.ab.Sp(e,l,i),l+=o.width,this.Sb()&&s("right",l,i)}i+=o.height}return Ft({width:t,height:i})}Pb(){let e=0,t=0,i=0;for(const F of this.Xm)this.xb()&&(t=Math.max(t,Fe(F.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(i=Math.max(i,Fe(F.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=F.M_();t=Co(t),i=Co(i);const r=this.__,n=this.ho,s=Math.max(r-t-i,0),o=this.cn.timeScale.visible;let l=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;l=(c=l)+c%2;const h=0+l,m=n<h?0:n-h,v=m/e;let x=0;for(let F=0;F<this.Xm.length;++F){const T=this.Xm[F];T.qp(this.$i.qc()[F]);let S=0,I=0;I=F===this.Xm.length-1?m-x:Math.round(T.M_()*v),S=Math.max(I,2),x+=S,T.cp(Ft({width:s,height:S})),this.xb()&&T._m(t,"left"),this.Sb()&&T._m(i,"right"),T.fp()&&this.$i.Kc(T.fp(),S)}this.ab.Fm(Ft({width:o?s:0,height:l}),o?t:0,o?i:0),this.$i.S_(s),this.Gm!==t&&(this.Gm=t),this.Jm!==i&&(this.Jm=i)}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 B0?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),i=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}i!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*i)}mb(e,t){var i;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((i=this.Qm)===null||i===void 0?void 0:i.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const i of e.Qn())this.ns(i,t)}Vb(e){const t=this.$i.qc();for(let i=0;i<t.length;i++)e.Hn(i).Wn&&t[i].N_()}ns(e,t){const i=this.$i.St();switch(e.qn){case 0:i.hc();break;case 1:i.lc(e.Vt);break;case 2:i.Gn(e.Vt);break;case 3:i.Jn(e.Vt);break;case 4:i.qu();break;case 5:e.Vt.Qu(t)||i.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const i=this.Qm;this.Qm=null,this.mb(i,t);for(const r of i.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,i=this.Xm.length;for(let r=t;r<i;r++){const n=rA(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=i;r<t;r++){const n=new So(this,e[r]);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 r=0;r<t;r++){const n=e[r],s=this.Xm[r];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,i){var r;const n=new Map;e!==null&&this.$i.wt().forEach((h=>{const m=h.In().ll(e);m!==null&&n.set(h,m)}));let s;if(e!==null){const h=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof ho?o.Hc:void 0,c=o!==null&&o.Iv!==void 0?o.Iv.gr:void 0;return{zb:s,ee:e??void 0,Lb:t??void 0,Eb:l,Nb:n,Fb:c,Wb:i??void 0}}Bb(e,t,i){this.Vp.m((()=>this.Ib(e,t,i)))}Ab(e,t,i){this.Op.m((()=>this.Ib(e,t,i)))}lb(e,t,i){this.Rc.m((()=>this.Ib(e,t,i)))}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 t=e.find((i=>i.target===this.Jd));t&&this._b(t.contentRect.width,t.contentRect.height)})),this.ib.observe(this.Jd,{box:"border-box"}),!0)}pb(){this.ib!==null&&this.ib.disconnect(),this.ib=null}}function Mo(A){return!!(A.handleScroll.mouseWheel||A.handleScale.mouseWheel)}function C0(A){return(function(e){return e.open!==void 0})(A)||(function(e){return e.value!==void 0})(A)}function zc(A,e){var t={};for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&e.indexOf(i)<0&&(t[i]=A[i]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function"){var r=0;for(i=Object.getOwnPropertySymbols(A);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(A,i[r])&&(t[i[r]]=A[i[r]])}return t}function Vc(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};return t.color!==void 0&&(n.V=t.color),n}function v0(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};return t.lineColor!==void 0&&(n.lt=t.lineColor),t.topColor!==void 0&&(n.Ps=t.topColor),t.bottomColor!==void 0&&(n.Rs=t.bottomColor),n}function T0(A,e,t,i){const r=t.value,n={ee:e,ot:A,Vt:[r,r,r,r],zb:i};return t.topLineColor!==void 0&&(n.Re=t.topLineColor),t.bottomLineColor!==void 0&&(n.De=t.bottomLineColor),t.topFillColor1!==void 0&&(n.ke=t.topFillColor1),t.topFillColor2!==void 0&&(n.ye=t.topFillColor2),t.bottomFillColor1!==void 0&&(n.Ce=t.bottomFillColor1),t.bottomFillColor2!==void 0&&(n.Te=t.bottomFillColor2),n}function b0(A,e,t,i){const r={ee:e,ot:A,Vt:[t.open,t.high,t.low,t.close],zb:i};return t.color!==void 0&&(r.V=t.color),r}function x0(A,e,t,i){const r={ee:e,ot:A,Vt:[t.open,t.high,t.low,t.close],zb:i};return t.color!==void 0&&(r.V=t.color),t.borderColor!==void 0&&(r.Ot=t.borderColor),t.wickColor!==void 0&&(r.Xh=t.wickColor),r}function Q0(A,e,t,i,r){const n=rA(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],h=t,{time:m,color:v}=h;return{ee:e,ot:A,Vt:c,zb:i,$e:zc(h,["time","color"]),V:v}}function Tn(A){return A.Vt!==void 0}function Wc(A,e){return e.customValues!==void 0&&(A.jb=e.customValues),A}function Ui(A){return(e,t,i,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(i,s)?Wc({ot:e,ee:t,zb:r},i):Wc(A(e,t,i,r,n),i)}function Gc(A){return{Candlestick:Ui(x0),Bar:Ui(b0),Area:Ui(v0),Baseline:Ui(T0),Histogram:Ui(Vc),Line:Ui(Vc),Custom:Ui(Q0)}[A]}function Rc(A){return{ee:0,Hb:new Map,la:A}}function $c(A,e){if(A!==void 0&&A.length!==0)return{$b:e.key(A[0].ot),Ub:e.key(A[A.length-1].ot)}}function Xc(A){let e;return A.forEach((t=>{e===void 0&&(e=t.zb)})),rA(e)}class F0{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,t){let i=this.qb.size!==0,r=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)i=!1,r=!0,this.qb.clear();else for(const l of this.Xb)l.pointData.Hb.delete(e)&&(r=!0);let s=[];if(t.length!==0){const l=t.map((x=>x.time)),c=this.q_.createConverterToInternalObj(t),h=Gc(e.Qh()),m=e.Ca(),v=e.Ta();s=t.map(((x,F)=>{const T=c(x.time),S=this.q_.key(T);let I=this.qb.get(S);I===void 0&&(I=Rc(T),this.qb.set(S,I),r=!0);const Q=h(T,I.ee,x,l[F],m,v);return I.Hb.set(e,Q),Q}))}i&&this.Gb(),this.Jb(e,s);let o=-1;if(r){const l=[];this.qb.forEach((c=>{l.push({timeWeight:0,time:c.la,pointData:c,originalTime:Xc(c.Hb)})})),l.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,h){const m=$c(l,h),v=$c(c,h);if(m!==void 0&&v!==void 0)return{ta:m.Ub>=v.Ub&&m.$b>=v.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const i=t;(function(T){T.zb===void 0&&(T.zb=T.time)})(i),this.q_.preprocessData(t);const r=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(r)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${r}`);let s=this.qb.get(this.q_.key(r));const o=s===void 0;s===void 0&&(s=Rc(r),this.qb.set(this.q_.key(r),s));const l=Gc(e.Qh()),c=e.Ca(),h=e.Ta(),m=l(r,s.ee,t,i.zb,c,h);s.Hb.set(e,m),this.nw(e,m);const v={ta:Tn(m)};if(!o)return this.tw(e,-1,v);const x={timeWeight:0,time:s.la,pointData:s,originalTime:Xc(s.Hb)},F=hr(this.Xb,this.q_.key(x.time),((T,S)=>this.q_.key(T.time)<S));this.Xb.splice(F,0,x);for(let T=F;T<this.Xb.length;++T)Ho(this.Xb[T].pointData,T);return this.q_.fillWeightsForPoints(this.Xb,F),this.tw(e,F,v)}nw(e,t){let i=this.Yb.get(e);i===void 0&&(i=[],this.Yb.set(e,i));const r=i.length!==0?i[i.length-1]:null;r===null||this.q_.key(t.ot)>this.q_.key(r.ot)?Tn(t)&&i.push(t):Tn(t)?i[i.length-1]=t:i.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Tn)),this.Zb.set(e,t[t.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 t=-1;for(let i=0;i<this.Xb.length&&i<e.length;++i){const r=this.Xb[i],n=e[i];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=i;break}n.timeWeight=r.timeWeight,Ho(n.pointData,i)}if(t===-1&&this.Xb.length!==e.length&&(t=Math.min(this.Xb.length,e.length)),t===-1)return-1;for(let i=t;i<e.length;++i)Ho(e[i].pointData,i);return this.q_.fillWeightsForPoints(e,t),this.Xb=e,t}sw(){if(this.Yb.size===0)return null;let e=0;return this.Yb.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].ee))})),e}tw(e,t,i){const r={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{r.ew.set(s,{$e:n,rw:s===e?i:void 0})})),this.Yb.has(e)||r.ew.set(e,{$e:[],rw:i}),r.St.hw=this.Xb,r.St.lw=t;else{const n=this.Yb.get(e);r.ew.set(e,{$e:n||[],rw:i})}return r}}function Ho(A,e){A.ee=e,A.Hb.forEach((t=>{t.ee=e}))}function Io(A){const e={value:A.Vt[3],time:A.zb};return A.jb!==void 0&&(e.customValues=A.jb),e}function Jc(A){const e=Io(A);return A.V!==void 0&&(e.color=A.V),e}function U0(A){const e=Io(A);return A.lt!==void 0&&(e.lineColor=A.lt),A.Ps!==void 0&&(e.topColor=A.Ps),A.Rs!==void 0&&(e.bottomColor=A.Rs),e}function S0(A){const e=Io(A);return A.Re!==void 0&&(e.topLineColor=A.Re),A.De!==void 0&&(e.bottomLineColor=A.De),A.ke!==void 0&&(e.topFillColor1=A.ke),A.ye!==void 0&&(e.topFillColor2=A.ye),A.Ce!==void 0&&(e.bottomFillColor1=A.Ce),A.Te!==void 0&&(e.bottomFillColor2=A.Te),e}function Zc(A){const e={open:A.Vt[0],high:A.Vt[1],low:A.Vt[2],close:A.Vt[3],time:A.zb};return A.jb!==void 0&&(e.customValues=A.jb),e}function E0(A){const e=Zc(A);return A.V!==void 0&&(e.color=A.V),e}function L0(A){const e=Zc(A),{V:t,Ot:i,Xh:r}=A;return t!==void 0&&(e.color=t),i!==void 0&&(e.borderColor=i),r!==void 0&&(e.wickColor=r),e}function Po(A){return{Area:U0,Line:Jc,Baseline:S0,Histogram:Jc,Bar:E0,Candlestick:L0,Custom:M0}[A]}function M0(A){const e=A.zb;return Object.assign(Object.assign({},A.$e),{time:e})}const H0={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},I0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},P0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:js,attributionLogo:!0},Do={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},D0={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},_0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:js,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Yc(){return{width:0,height:0,autoSize:!1,layout:P0,crosshair:H0,grid:I0,overlayPriceScales:Object.assign({},Do),leftPriceScale:Object.assign(Object.assign({},Do),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Do),{visible:!0}),timeScale:D0,watermark:_0,localization:{locale:zi?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 k0{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return ln(this.ow)?this.aw.Mb(this.ow):0}Li(){return Fe(this.aw.$t().Uc(this.ow)).Dt}}function qc(A,e,t){const i=zc(A,["time","originalTime"]),r=Object.assign({time:e},i);return t!==void 0&&(r.originalTime=t),r}const O0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class N0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class K0{constructor(e,t,i,r,n){this.uw=new Ht,this.Es=e,this.cw=t,this.dw=i,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new Ki(new wr(e.from,e.to)).lu(),i=this.Es.In();if(i.Ni())return null;const r=i.ll(t.Os(),1),n=i.ll(t.ui(),-1),s=Fe(i.el()),o=Fe(i.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.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,t){const i=this.Es.In().ll(e,t);return i===null?null:Po(this.seriesType())(i)}data(){const e=Po(this.seriesType());return this.Es.In().ne().map((t=>e(t)))}subscribeDataChanged(e){this.uw.l(e)}unsubscribeDataChanged(e){this.uw.v(e)}setMarkers(e){this.q_;const t=e.map((i=>qc(i,this.q_.convertHorzItemToInternal(i.time),i.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>qc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return jA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=EA(jA(O0),e),i=this.Es.ea(t);return new N0(i)}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 z0{constructor(e,t,i){this.ww=new Ht,this.mu=new Ht,this.Om=new Ht,this.$i=e,this.yl=e.St(),this.ab=t,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=i}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(e,t){t?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 t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},i=this.yl.Iu(t);this.$i.pd(i)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ai(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 t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),i=this.yl.Va(t,!1);return i===null?null:this.yl.It(i)}coordinateToTime(e){const t=this.$i.St(),i=t.Nu(e),r=t.Ui(i);return r===null?null:r.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({},jA(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 V0(A){if(A===void 0||A.type==="custom")return;const e=A;e.minMove!==void 0&&e.precision===void 0&&(e.precision=(function(t){if(t>=1)return 0;let i=0;for(;i<8;i++){const r=Math.round(t);if(Math.abs(r-t)<1e-8)return i;t*=10}return i})(e.minMove))}function jc(A){return(function(e){if(sn(e.handleScale)){const i=e.handleScale;e.handleScale={axisDoubleClickReset:{time:i,price:i},axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:i,axisDoubleClickReset:r}=e.handleScale;sn(i)&&(e.handleScale.axisPressedMouseMove={time:i,price:i}),sn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;sn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(A),A}class W0{constructor(e,t,i){this.Sw=new Map,this.kw=new Map,this.yw=new Ht,this.Cw=new Ht,this.Tw=new Ht,this.Pw=new F0(t);const r=i===void 0?jA(Yc()):EA(jA(Yc()),jc(i));this.q_=t,this.aw=new y0(e,r,t),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 z0(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,t,i){this.autoSizeActive()||this.aw._b(e,t,i)}addCustomSeries(e,t){const i=ki(e),r=Object.assign(Object.assign({},Il),i.defaultOptions());return this.Vw("Custom",r,t,i)}addAreaSeries(e){return this.Vw("Area",Ff,e)}addBaselineSeries(e){return this.Vw("Baseline",Uf,e)}addBarSeries(e){return this.Vw("Bar",xf,e)}addCandlestickSeries(e={}){return(function(t){t.borderColor!==void 0&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),t.wickColor!==void 0&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)})(e),this.Vw("Candlestick",bf,e)}addHistogramSeries(e){return this.Vw("Histogram",Sf,e)}addLineSeries(e){return this.Vw("Line",Qf,e)}removeSeries(e){const t=rA(this.Sw.get(e)),i=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(i),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}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 k0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(jc(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,t,i){const r=this.Sw.get(i);if(r===void 0)return;const n=this.aw.$t().dr(r);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,i={},r){V0(i.priceFormat);const n=EA(jA(Pl),jA(t),i),s=this.aw.$t().dd(e,n,r),o=new K0(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((i,r)=>r.J(i.$e,i.rw))),t.Wu()}Bw(e){return rA(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=Po(s)(r);if(s!=="Custom")ai(C0(o));else{const l=n.Ta();ai(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const i=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:i,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function G0(A,e,t){let i;if(lr(A)){const n=document.getElementById(A);ai(n!==null,`Cannot find element in DOM with id=${A}`),i=n}else i=A;const r=new W0(i,e,t);return e.setOptions(r.options()),r}function R0(A,e){return G0(A,new Dc,Dc.Id(e))}Object.assign(Object.assign({},Pl),Il);function eh(A,e){return function(){return A.apply(e,arguments)}}const{toString:$0}=Object.prototype,{getPrototypeOf:_o}=Object,{iterator:bn,toStringTag:th}=Symbol,xn=(A=>e=>{const t=$0.call(e);return A[t]||(A[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),MA=A=>(A=A.toLowerCase(),e=>xn(e)===A),Qn=A=>e=>typeof e===A,{isArray:Wi}=Array,Gi=Qn("undefined");function Br(A){return A!==null&&!Gi(A)&&A.constructor!==null&&!Gi(A.constructor)&&uA(A.constructor.isBuffer)&&A.constructor.isBuffer(A)}const Ah=MA("ArrayBuffer");function X0(A){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(A):e=A&&A.buffer&&Ah(A.buffer),e}const J0=Qn("string"),uA=Qn("function"),ih=Qn("number"),yr=A=>A!==null&&typeof A=="object",Z0=A=>A===!0||A===!1,Fn=A=>{if(xn(A)!=="object")return!1;const e=_o(A);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(th in A)&&!(bn in A)},Y0=A=>{if(!yr(A)||Br(A))return!1;try{return Object.keys(A).length===0&&Object.getPrototypeOf(A)===Object.prototype}catch{return!1}},q0=MA("Date"),j0=MA("File"),em=MA("Blob"),tm=MA("FileList"),Am=A=>yr(A)&&uA(A.pipe),im=A=>{let e;return A&&(typeof FormData=="function"&&A instanceof FormData||uA(A.append)&&((e=xn(A))==="formdata"||e==="object"&&uA(A.toString)&&A.toString()==="[object FormData]"))},rm=MA("URLSearchParams"),[nm,sm,om,am]=["ReadableStream","Request","Response","Headers"].map(MA),lm=A=>A.trim?A.trim():A.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Cr(A,e,{allOwnKeys:t=!1}={}){if(A===null||typeof A>"u")return;let i,r;if(typeof A!="object"&&(A=[A]),Wi(A))for(i=0,r=A.length;i<r;i++)e.call(null,A[i],i,A);else{if(Br(A))return;const n=t?Object.getOwnPropertyNames(A):Object.keys(A),s=n.length;let o;for(i=0;i<s;i++)o=n[i],e.call(null,A[o],o,A)}}function rh(A,e){if(Br(A))return null;e=e.toLowerCase();const t=Object.keys(A);let i=t.length,r;for(;i-- >0;)if(r=t[i],e===r.toLowerCase())return r;return null}const Si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nh=A=>!Gi(A)&&A!==Si;function ko(){const{caseless:A,skipUndefined:e}=nh(this)&&this||{},t={},i=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=A&&rh(t,n)||n;Fn(t[s])&&Fn(r)?t[s]=ko(t[s],r):Fn(r)?t[s]=ko({},r):Wi(r)?t[s]=r.slice():(!e||!Gi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&Cr(arguments[r],i);return t}const cm=(A,e,t,{allOwnKeys:i}={})=>(Cr(e,(r,n)=>{t&&uA(r)?Object.defineProperty(A,n,{value:eh(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(A,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),A),hm=A=>(A.charCodeAt(0)===65279&&(A=A.slice(1)),A),um=(A,e,t,i)=>{A.prototype=Object.create(e.prototype,i),Object.defineProperty(A.prototype,"constructor",{value:A,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(A,"super",{value:e.prototype}),t&&Object.assign(A.prototype,t)},pm=(A,e,t,i)=>{let r,n,s;const o={};if(e=e||{},A==null)return e;do{for(r=Object.getOwnPropertyNames(A),n=r.length;n-- >0;)s=r[n],(!i||i(s,A,e))&&!o[s]&&(e[s]=A[s],o[s]=!0);A=t!==!1&&_o(A)}while(A&&(!t||t(A,e))&&A!==Object.prototype);return e},dm=(A,e,t)=>{A=String(A),(t===void 0||t>A.length)&&(t=A.length),t-=e.length;const i=A.indexOf(e,t);return i!==-1&&i===t},fm=A=>{if(!A)return null;if(Wi(A))return A;let e=A.length;if(!ih(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=A[e];return t},gm=(A=>e=>A&&e instanceof A)(typeof Uint8Array<"u"&&_o(Uint8Array)),mm=(A,e)=>{const i=(A&&A[bn]).call(A);let r;for(;(r=i.next())&&!r.done;){const n=r.value;e.call(A,n[0],n[1])}},wm=(A,e)=>{let t;const i=[];for(;(t=A.exec(e))!==null;)i.push(t);return i},Bm=MA("HTMLFormElement"),ym=A=>A.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),sh=(({hasOwnProperty:A})=>(e,t)=>A.call(e,t))(Object.prototype),Cm=MA("RegExp"),oh=(A,e)=>{const t=Object.getOwnPropertyDescriptors(A),i={};Cr(t,(r,n)=>{let s;(s=e(r,n,A))!==!1&&(i[n]=s||r)}),Object.defineProperties(A,i)},vm=A=>{oh(A,(e,t)=>{if(uA(A)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=A[t];if(uA(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Tm=(A,e)=>{const t={},i=r=>{r.forEach(n=>{t[n]=!0})};return Wi(A)?i(A):i(String(A).split(e)),t},bm=()=>{},xm=(A,e)=>A!=null&&Number.isFinite(A=+A)?A:e;function Qm(A){return!!(A&&uA(A.append)&&A[th]==="FormData"&&A[bn])}const Fm=A=>{const e=new Array(10),t=(i,r)=>{if(yr(i)){if(e.indexOf(i)>=0)return;if(Br(i))return i;if(!("toJSON"in i)){e[r]=i;const n=Wi(i)?[]:{};return Cr(i,(s,o)=>{const l=t(s,r+1);!Gi(l)&&(n[o]=l)}),e[r]=void 0,n}}return i};return t(A,0)},Um=MA("AsyncFunction"),Sm=A=>A&&(yr(A)||uA(A))&&uA(A.then)&&uA(A.catch),ah=((A,e)=>A?setImmediate:e?((t,i)=>(Si.addEventListener("message",({source:r,data:n})=>{r===Si&&n===t&&i.length&&i.shift()()},!1),r=>{i.push(r),Si.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",uA(Si.postMessage)),Em=typeof queueMicrotask<"u"?queueMicrotask.bind(Si):typeof process<"u"&&process.nextTick||ah,de={isArray:Wi,isArrayBuffer:Ah,isBuffer:Br,isFormData:im,isArrayBufferView:X0,isString:J0,isNumber:ih,isBoolean:Z0,isObject:yr,isPlainObject:Fn,isEmptyObject:Y0,isReadableStream:nm,isRequest:sm,isResponse:om,isHeaders:am,isUndefined:Gi,isDate:q0,isFile:j0,isBlob:em,isRegExp:Cm,isFunction:uA,isStream:Am,isURLSearchParams:rm,isTypedArray:gm,isFileList:tm,forEach:Cr,merge:ko,extend:cm,trim:lm,stripBOM:hm,inherits:um,toFlatObject:pm,kindOf:xn,kindOfTest:MA,endsWith:dm,toArray:fm,forEachEntry:mm,matchAll:wm,isHTMLForm:Bm,hasOwnProperty:sh,hasOwnProp:sh,reduceDescriptors:oh,freezeMethods:vm,toObjectSet:Tm,toCamelCase:ym,noop:bm,toFiniteNumber:xm,findKey:rh,global:Si,isContextDefined:nh,isSpecCompliantForm:Qm,toJSONObject:Fm,isAsyncFn:Um,isThenable:Sm,setImmediate:ah,asap:Em,isIterable:A=>A!=null&&uA(A[bn])};let tt=class cf extends Error{static from(e,t,i,r,n,s){const o=new cf(e.message,t||e.code,i,r,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,i,r,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),i&&(this.config=i),r&&(this.request=r),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:de.toJSONObject(this.config),code:this.code,status:this.status}}};tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",tt.ERR_BAD_OPTION="ERR_BAD_OPTION",tt.ECONNABORTED="ECONNABORTED",tt.ETIMEDOUT="ETIMEDOUT",tt.ERR_NETWORK="ERR_NETWORK",tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",tt.ERR_DEPRECATED="ERR_DEPRECATED",tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",tt.ERR_CANCELED="ERR_CANCELED",tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",tt.ERR_INVALID_URL="ERR_INVALID_URL";const Lm=null;function Oo(A){return de.isPlainObject(A)||de.isArray(A)}function lh(A){return de.endsWith(A,"[]")?A.slice(0,-2):A}function ch(A,e,t){return A?A.concat(e).map(function(r,n){return r=lh(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function Mm(A){return de.isArray(A)&&!A.some(Oo)}const Hm=de.toFlatObject(de,{},null,function(e){return/^is[A-Z]/.test(e)});function Un(A,e,t){if(!de.isObject(A))throw new TypeError("target must be an object");e=e||new FormData,t=de.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(T,S){return!de.isUndefined(S[T])});const i=t.metaTokens,r=t.visitor||h,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&de.isSpecCompliantForm(e);if(!de.isFunction(r))throw new TypeError("visitor must be a function");function c(F){if(F===null)return"";if(de.isDate(F))return F.toISOString();if(de.isBoolean(F))return F.toString();if(!l&&de.isBlob(F))throw new tt("Blob is not supported. Use a Buffer instead.");return de.isArrayBuffer(F)||de.isTypedArray(F)?l&&typeof Blob=="function"?new Blob([F]):Buffer.from(F):F}function h(F,T,S){let I=F;if(F&&!S&&typeof F=="object"){if(de.endsWith(T,"{}"))T=i?T:T.slice(0,-2),F=JSON.stringify(F);else if(de.isArray(F)&&Mm(F)||(de.isFileList(F)||de.endsWith(T,"[]"))&&(I=de.toArray(F)))return T=lh(T),I.forEach(function(N,J){!(de.isUndefined(N)||N===null)&&e.append(s===!0?ch([T],J,n):s===null?T:T+"[]",c(N))}),!1}return Oo(F)?!0:(e.append(ch(S,T,n),c(F)),!1)}const m=[],v=Object.assign(Hm,{defaultVisitor:h,convertValue:c,isVisitable:Oo});function x(F,T){if(!de.isUndefined(F)){if(m.indexOf(F)!==-1)throw Error("Circular reference detected in "+T.join("."));m.push(F),de.forEach(F,function(I,Q){(!(de.isUndefined(I)||I===null)&&r.call(e,I,de.isString(Q)?Q.trim():Q,T,v))===!0&&x(I,T?T.concat(Q):[Q])}),m.pop()}}if(!de.isObject(A))throw new TypeError("data must be an object");return x(A),e}function hh(A){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(A).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function No(A,e){this._pairs=[],A&&Un(A,this,e)}const uh=No.prototype;uh.append=function(e,t){this._pairs.push([e,t])},uh.toString=function(e){const t=e?function(i){return e.call(this,i,hh)}:hh;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Im(A){return encodeURIComponent(A).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ph(A,e,t){if(!e)return A;const i=t&&t.encode||Im,r=de.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=de.isURLSearchParams(e)?e.toString():new No(e,r).toString(i),s){const o=A.indexOf("#");o!==-1&&(A=A.slice(0,o)),A+=(A.indexOf("?")===-1?"?":"&")+s}return A}class dh{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){de.forEach(this.handlers,function(i){i!==null&&e(i)})}}const Ko={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Pm={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:No,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},zo=typeof window<"u"&&typeof document<"u",Vo=typeof navigator=="object"&&navigator||void 0,Dm=zo&&(!Vo||["ReactNative","NativeScript","NS"].indexOf(Vo.product)<0),_m=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",km=zo&&window.location.href||"http://localhost",eA={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zo,hasStandardBrowserEnv:Dm,hasStandardBrowserWebWorkerEnv:_m,navigator:Vo,origin:km},Symbol.toStringTag,{value:"Module"})),...Pm};function Om(A,e){return Un(A,new eA.classes.URLSearchParams,{visitor:function(t,i,r,n){return eA.isNode&&de.isBuffer(t)?(this.append(i,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function Nm(A){return de.matchAll(/\w+|\[(\w*)]/g,A).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Km(A){const e={},t=Object.keys(A);let i;const r=t.length;let n;for(i=0;i<r;i++)n=t[i],e[n]=A[n];return e}function fh(A){function e(t,i,r,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),l=n>=t.length;return s=!s&&de.isArray(r)?r.length:s,l?(de.hasOwnProp(r,s)?r[s]=[r[s],i]:r[s]=i,!o):((!r[s]||!de.isObject(r[s]))&&(r[s]=[]),e(t,i,r[s],n)&&de.isArray(r[s])&&(r[s]=Km(r[s])),!o)}if(de.isFormData(A)&&de.isFunction(A.entries)){const t={};return de.forEachEntry(A,(i,r)=>{e(Nm(i),r,t,0)}),t}return null}function zm(A,e,t){if(de.isString(A))try{return(e||JSON.parse)(A),de.trim(A)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(A)}const vr={transitional:Ko,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,n=de.isObject(e);if(n&&de.isHTMLForm(e)&&(e=new FormData(e)),de.isFormData(e))return r?JSON.stringify(fh(e)):e;if(de.isArrayBuffer(e)||de.isBuffer(e)||de.isStream(e)||de.isFile(e)||de.isBlob(e)||de.isReadableStream(e))return e;if(de.isArrayBufferView(e))return e.buffer;if(de.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Om(e,this.formSerializer).toString();if((o=de.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Un(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),zm(e)):e}],transformResponse:[function(e){const t=this.transitional||vr.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(de.isResponse(e)||de.isReadableStream(e))return e;if(e&&de.isString(e)&&(i&&!this.responseType||r)){const s=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?tt.from(o,tt.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:eA.classes.FormData,Blob:eA.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};de.forEach(["delete","get","head","post","put","patch"],A=>{vr.headers[A]={}});const Vm=de.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"]),Wm=A=>{const e={};let t,i,r;return A&&A.split(`
|
|
2
|
+
`).forEach(function(s){r=s.indexOf(":"),t=s.substring(0,r).trim().toLowerCase(),i=s.substring(r+1).trim(),!(!t||e[t]&&Vm[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e},gh=Symbol("internals");function Tr(A){return A&&String(A).trim().toLowerCase()}function Sn(A){return A===!1||A==null?A:de.isArray(A)?A.map(Sn):String(A)}function Gm(A){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(A);)e[i[1]]=i[2];return e}const Rm=A=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(A.trim());function Wo(A,e,t,i,r){if(de.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!de.isString(e)){if(de.isString(i))return e.indexOf(i)!==-1;if(de.isRegExp(i))return i.test(e)}}function $m(A){return A.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function Xm(A,e){const t=de.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(A,i+t,{value:function(r,n,s){return this[i].call(this,e,r,n,s)},configurable:!0})})}let pA=class{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function n(o,l,c){const h=Tr(l);if(!h)throw new Error("header name must be a non-empty string");const m=de.findKey(r,h);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=Sn(o))}const s=(o,l)=>de.forEach(o,(c,h)=>n(c,h,l));if(de.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(de.isString(e)&&(e=e.trim())&&!Rm(e))s(Wm(e),t);else if(de.isObject(e)&&de.isIterable(e)){let o={},l,c;for(const h of e){if(!de.isArray(h))throw TypeError("Object iterator must return a key-value pair");o[c=h[0]]=(l=o[c])?de.isArray(l)?[...l,h[1]]:[l,h[1]]:h[1]}s(o,t)}else e!=null&&n(t,e,i);return this}get(e,t){if(e=Tr(e),e){const i=de.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Gm(r);if(de.isFunction(t))return t.call(this,r,i);if(de.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Tr(e),e){const i=de.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||Wo(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function n(s){if(s=Tr(s),s){const o=de.findKey(i,s);o&&(!t||Wo(i,i[o],o,t))&&(delete i[o],r=!0)}}return de.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const n=t[i];(!e||Wo(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,i={};return de.forEach(this,(r,n)=>{const s=de.findKey(i,n);if(s){t[s]=Sn(r),delete t[n];return}const o=e?$m(n):String(n).trim();o!==n&&delete t[n],t[o]=Sn(r),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return de.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&de.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).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,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[gh]=this[gh]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=Tr(s);i[o]||(Xm(r,s),i[o]=!0)}return de.isArray(e)?e.forEach(n):n(e),this}};pA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(pA.prototype,({value:A},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>A,set(i){this[t]=i}}}),de.freezeMethods(pA);function Go(A,e){const t=this||vr,i=e||t,r=pA.from(i.headers);let n=i.data;return de.forEach(A,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function mh(A){return!!(A&&A.__CANCEL__)}let br=class extends tt{constructor(e,t,i){super(e??"canceled",tt.ERR_CANCELED,t,i),this.name="CanceledError",this.__CANCEL__=!0}};function wh(A,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?A(t):e(new tt("Request failed with status code "+t.status,[tt.ERR_BAD_REQUEST,tt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Jm(A){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(A);return e&&e[1]||""}function Zm(A,e){A=A||10;const t=new Array(A),i=new Array(A);let r=0,n=0,s;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),h=i[n];s||(s=c),t[r]=l,i[r]=c;let m=n,v=0;for(;m!==r;)v+=t[m++],m=m%A;if(r=(r+1)%A,r===n&&(n=(n+1)%A),c-s<e)return;const x=h&&c-h;return x?Math.round(v*1e3/x):void 0}}function Ym(A,e){let t=0,i=1e3/e,r,n;const s=(c,h=Date.now())=>{t=h,r=null,n&&(clearTimeout(n),n=null),A(...c)};return[(...c)=>{const h=Date.now(),m=h-t;m>=i?s(c,h):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},i-m)))},()=>r&&s(r)]}const En=(A,e,t=3)=>{let i=0;const r=Zm(50,250);return Ym(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-i,c=r(l),h=s<=o;i=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};A(m)},t)},Bh=(A,e)=>{const t=A!=null;return[i=>e[0]({lengthComputable:t,total:A,loaded:i}),e[1]]},yh=A=>(...e)=>de.asap(()=>A(...e)),qm=eA.hasStandardBrowserEnv?((A,e)=>t=>(t=new URL(t,eA.origin),A.protocol===t.protocol&&A.host===t.host&&(e||A.port===t.port)))(new URL(eA.origin),eA.navigator&&/(msie|trident)/i.test(eA.navigator.userAgent)):()=>!0,jm=eA.hasStandardBrowserEnv?{write(A,e,t,i,r,n,s){if(typeof document>"u")return;const o=[`${A}=${encodeURIComponent(e)}`];de.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),de.isString(i)&&o.push(`path=${i}`),de.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),de.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(A){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+A+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(A){this.write(A,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function e1(A){return typeof A!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(A)}function t1(A,e){return e?A.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):A}function Ch(A,e,t){let i=!e1(e);return A&&(i||t==!1)?t1(A,e):e}const vh=A=>A instanceof pA?{...A}:A;function Ei(A,e){e=e||{};const t={};function i(c,h,m,v){return de.isPlainObject(c)&&de.isPlainObject(h)?de.merge.call({caseless:v},c,h):de.isPlainObject(h)?de.merge({},h):de.isArray(h)?h.slice():h}function r(c,h,m,v){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c,m,v)}else return i(c,h,m,v)}function n(c,h){if(!de.isUndefined(h))return i(void 0,h)}function s(c,h){if(de.isUndefined(h)){if(!de.isUndefined(c))return i(void 0,c)}else return i(void 0,h)}function o(c,h,m){if(m in e)return i(c,h);if(m in A)return i(void 0,c)}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:(c,h,m)=>r(vh(c),vh(h),m,!0)};return de.forEach(Object.keys({...A,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const m=de.hasOwnProp(l,h)?l[h]:r,v=m(A[h],e[h],h);de.isUndefined(v)&&m!==o||(t[h]=v)}),t}const Th=A=>{const e=Ei({},A);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=pA.from(s),e.url=ph(Ch(e.baseURL,e.url,e.allowAbsoluteUrls),A.params,A.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),de.isFormData(t)){if(eA.hasStandardBrowserEnv||eA.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(de.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([h,m])=>{c.includes(h.toLowerCase())&&s.set(h,m)})}}if(eA.hasStandardBrowserEnv&&(i&&de.isFunction(i)&&(i=i(e)),i||i!==!1&&qm(e.url))){const l=r&&n&&jm.read(n);l&&s.set(r,l)}return e},A1=typeof XMLHttpRequest<"u"&&function(A){return new Promise(function(t,i){const r=Th(A);let n=r.data;const s=pA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,h,m,v,x,F;function T(){x&&x(),F&&F(),r.cancelToken&&r.cancelToken.unsubscribe(h),r.signal&&r.signal.removeEventListener("abort",h)}let S=new XMLHttpRequest;S.open(r.method.toUpperCase(),r.url,!0),S.timeout=r.timeout;function I(){if(!S)return;const N=pA.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),H={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:N,config:A,request:S};wh(function(re){t(re),T()},function(re){i(re),T()},H),S=null}"onloadend"in S?S.onloadend=I:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(I)},S.onabort=function(){S&&(i(new tt("Request aborted",tt.ECONNABORTED,A,S)),S=null)},S.onerror=function(J){const H=J&&J.message?J.message:"Network Error",z=new tt(H,tt.ERR_NETWORK,A,S);z.event=J||null,i(z),S=null},S.ontimeout=function(){let J=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const H=r.transitional||Ko;r.timeoutErrorMessage&&(J=r.timeoutErrorMessage),i(new tt(J,H.clarifyTimeoutError?tt.ETIMEDOUT:tt.ECONNABORTED,A,S)),S=null},n===void 0&&s.setContentType(null),"setRequestHeader"in S&&de.forEach(s.toJSON(),function(J,H){S.setRequestHeader(H,J)}),de.isUndefined(r.withCredentials)||(S.withCredentials=!!r.withCredentials),o&&o!=="json"&&(S.responseType=r.responseType),c&&([v,F]=En(c,!0),S.addEventListener("progress",v)),l&&S.upload&&([m,x]=En(l),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(r.cancelToken||r.signal)&&(h=N=>{S&&(i(!N||N.type?new br(null,A,S):N),S.abort(),S=null)},r.cancelToken&&r.cancelToken.subscribe(h),r.signal&&(r.signal.aborted?h():r.signal.addEventListener("abort",h)));const Q=Jm(r.url);if(Q&&eA.protocols.indexOf(Q)===-1){i(new tt("Unsupported protocol "+Q+":",tt.ERR_BAD_REQUEST,A));return}S.send(n||null)})},i1=(A,e)=>{const{length:t}=A=A?A.filter(Boolean):[];if(e||t){let i=new AbortController,r;const n=function(c){if(!r){r=!0,o();const h=c instanceof Error?c:this.reason;i.abort(h instanceof tt?h:new br(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new tt(`timeout of ${e}ms exceeded`,tt.ETIMEDOUT))},e);const o=()=>{A&&(s&&clearTimeout(s),s=null,A.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),A=null)};A.forEach(c=>c.addEventListener("abort",n));const{signal:l}=i;return l.unsubscribe=()=>de.asap(o),l}},r1=function*(A,e){let t=A.byteLength;if(t<e){yield A;return}let i=0,r;for(;i<t;)r=i+e,yield A.slice(i,r),i=r},n1=async function*(A,e){for await(const t of s1(A))yield*r1(t,e)},s1=async function*(A){if(A[Symbol.asyncIterator]){yield*A;return}const e=A.getReader();try{for(;;){const{done:t,value:i}=await e.read();if(t)break;yield i}}finally{await e.cancel()}},bh=(A,e,t,i)=>{const r=n1(A,e);let n=0,s,o=l=>{s||(s=!0,i&&i(l))};return new ReadableStream({async pull(l){try{const{done:c,value:h}=await r.next();if(c){o(),l.close();return}let m=h.byteLength;if(t){let v=n+=m;t(v)}l.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},xh=64*1024,{isFunction:Ln}=de,o1=(({Request:A,Response:e})=>({Request:A,Response:e}))(de.global),{ReadableStream:Qh,TextEncoder:Fh}=de.global,Uh=(A,...e)=>{try{return!!A(...e)}catch{return!1}},a1=A=>{A=de.merge.call({skipUndefined:!0},o1,A);const{fetch:e,Request:t,Response:i}=A,r=e?Ln(e):typeof fetch=="function",n=Ln(t),s=Ln(i);if(!r)return!1;const o=r&&Ln(Qh),l=r&&(typeof Fh=="function"?(F=>T=>F.encode(T))(new Fh):async F=>new Uint8Array(await new t(F).arrayBuffer())),c=n&&o&&Uh(()=>{let F=!1;const T=new t(eA.origin,{body:new Qh,method:"POST",get duplex(){return F=!0,"half"}}).headers.has("Content-Type");return F&&!T}),h=s&&o&&Uh(()=>de.isReadableStream(new i("").body)),m={stream:h&&(F=>F.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(F=>{!m[F]&&(m[F]=(T,S)=>{let I=T&&T[F];if(I)return I.call(T);throw new tt(`Response type '${F}' is not supported`,tt.ERR_NOT_SUPPORT,S)})});const v=async F=>{if(F==null)return 0;if(de.isBlob(F))return F.size;if(de.isSpecCompliantForm(F))return(await new t(eA.origin,{method:"POST",body:F}).arrayBuffer()).byteLength;if(de.isArrayBufferView(F)||de.isArrayBuffer(F))return F.byteLength;if(de.isURLSearchParams(F)&&(F=F+""),de.isString(F))return(await l(F)).byteLength},x=async(F,T)=>{const S=de.toFiniteNumber(F.getContentLength());return S??v(T)};return async F=>{let{url:T,method:S,data:I,signal:Q,cancelToken:N,timeout:J,onDownloadProgress:H,onUploadProgress:z,responseType:re,headers:q,withCredentials:ie="same-origin",fetchOptions:G}=Th(F),ne=e||fetch;re=re?(re+"").toLowerCase():"text";let le=i1([Q,N&&N.toAbortSignal()],J),ee=null;const we=le&&le.unsubscribe&&(()=>{le.unsubscribe()});let j;try{if(z&&c&&S!=="get"&&S!=="head"&&(j=await x(q,I))!==0){let fe=new t(T,{method:"POST",body:I,duplex:"half"}),Qe;if(de.isFormData(I)&&(Qe=fe.headers.get("content-type"))&&q.setContentType(Qe),fe.body){const[me,xe]=Bh(j,En(yh(z)));I=bh(fe.body,xh,me,xe)}}de.isString(ie)||(ie=ie?"include":"omit");const ge=n&&"credentials"in t.prototype,ae={...G,signal:le,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:I,duplex:"half",credentials:ge?ie:void 0};ee=n&&new t(T,ae);let pe=await(n?ne(ee,G):ne(T,ae));const ue=h&&(re==="stream"||re==="response");if(h&&(H||ue&&we)){const fe={};["status","statusText","headers"].forEach(Se=>{fe[Se]=pe[Se]});const Qe=de.toFiniteNumber(pe.headers.get("content-length")),[me,xe]=H&&Bh(Qe,En(yh(H),!0))||[];pe=new i(bh(pe.body,xh,me,()=>{xe&&xe(),we&&we()}),fe)}re=re||"text";let oe=await m[de.findKey(m,re)||"text"](pe,F);return!ue&&we&&we(),await new Promise((fe,Qe)=>{wh(fe,Qe,{data:oe,headers:pA.from(pe.headers),status:pe.status,statusText:pe.statusText,config:F,request:ee})})}catch(ge){throw we&&we(),ge&&ge.name==="TypeError"&&/Load failed|fetch/i.test(ge.message)?Object.assign(new tt("Network Error",tt.ERR_NETWORK,F,ee,ge&&ge.response),{cause:ge.cause||ge}):tt.from(ge,ge&&ge.code,F,ee,ge&&ge.response)}}},l1=new Map,Sh=A=>{let e=A&&A.env||{};const{fetch:t,Request:i,Response:r}=e,n=[i,r,t];let s=n.length,o=s,l,c,h=l1;for(;o--;)l=n[o],c=h.get(l),c===void 0&&h.set(l,c=o?new Map:a1(e)),h=c;return c};Sh();const Ro={http:Lm,xhr:A1,fetch:{get:Sh}};de.forEach(Ro,(A,e)=>{if(A){try{Object.defineProperty(A,"name",{value:e})}catch{}Object.defineProperty(A,"adapterName",{value:e})}});const Eh=A=>`- ${A}`,c1=A=>de.isFunction(A)||A===null||A===!1;function h1(A,e){A=de.isArray(A)?A:[A];const{length:t}=A;let i,r;const n={};for(let s=0;s<t;s++){i=A[s];let o;if(r=i,!c1(i)&&(r=Ro[(o=String(i)).toLowerCase()],r===void 0))throw new tt(`Unknown adapter '${o}'`);if(r&&(de.isFunction(r)||(r=r.get(e))))break;n[o||"#"+s]=r}if(!r){const s=Object.entries(n).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
4
|
+
`+s.map(Eh).join(`
|
|
5
|
+
`):" "+Eh(s[0]):"as no adapter specified";throw new tt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const Lh={getAdapter:h1,adapters:Ro};function $o(A){if(A.cancelToken&&A.cancelToken.throwIfRequested(),A.signal&&A.signal.aborted)throw new br(null,A)}function Mh(A){return $o(A),A.headers=pA.from(A.headers),A.data=Go.call(A,A.transformRequest),["post","put","patch"].indexOf(A.method)!==-1&&A.headers.setContentType("application/x-www-form-urlencoded",!1),Lh.getAdapter(A.adapter||vr.adapter,A)(A).then(function(i){return $o(A),i.data=Go.call(A,A.transformResponse,i),i.headers=pA.from(i.headers),i},function(i){return mh(i)||($o(A),i&&i.response&&(i.response.data=Go.call(A,A.transformResponse,i.response),i.response.headers=pA.from(i.response.headers))),Promise.reject(i)})}const Hh="1.13.5",Mn={};["object","boolean","number","function","string","symbol"].forEach((A,e)=>{Mn[A]=function(i){return typeof i===A||"a"+(e<1?"n ":" ")+A}});const Ih={};Mn.transitional=function(e,t,i){function r(n,s){return"[Axios v"+Hh+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,o)=>{if(e===!1)throw new tt(r(s," has been removed"+(t?" in "+t:"")),tt.ERR_DEPRECATED);return t&&!Ih[s]&&(Ih[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(n,s,o):!0}},Mn.spelling=function(e){return(t,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function u1(A,e,t){if(typeof A!="object")throw new tt("options must be an object",tt.ERR_BAD_OPTION_VALUE);const i=Object.keys(A);let r=i.length;for(;r-- >0;){const n=i[r],s=e[n];if(s){const o=A[n],l=o===void 0||s(o,n,A);if(l!==!0)throw new tt("option "+n+" must be "+l,tt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new tt("Unknown option "+n,tt.ERR_BAD_OPTION)}}const Hn={assertOptions:u1,validators:Mn},TA=Hn.validators;let Li=class{constructor(e){this.defaults=e||{},this.interceptors={request:new dh,response:new dh}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?n&&!String(i.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(i.stack+=`
|
|
6
|
+
`+n):i.stack=n}catch{}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ei(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:n}=t;i!==void 0&&Hn.assertOptions(i,{silentJSONParsing:TA.transitional(TA.boolean),forcedJSONParsing:TA.transitional(TA.boolean),clarifyTimeoutError:TA.transitional(TA.boolean),legacyInterceptorReqResOrdering:TA.transitional(TA.boolean)},!1),r!=null&&(de.isFunction(r)?t.paramsSerializer={serialize:r}:Hn.assertOptions(r,{encode:TA.function,serialize:TA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hn.assertOptions(t,{baseUrl:TA.spelling("baseURL"),withXsrfToken:TA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&de.merge(n.common,n[t.method]);n&&de.forEach(["delete","get","head","post","put","patch","common"],F=>{delete n[F]}),t.headers=pA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(t)===!1)return;l=l&&T.synchronous;const S=t.transitional||Ko;S&&S.legacyInterceptorReqResOrdering?o.unshift(T.fulfilled,T.rejected):o.push(T.fulfilled,T.rejected)});const c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});let h,m=0,v;if(!l){const F=[Mh.bind(this),void 0];for(F.unshift(...o),F.push(...c),v=F.length,h=Promise.resolve(t);m<v;)h=h.then(F[m++],F[m++]);return h}v=o.length;let x=t;for(;m<v;){const F=o[m++],T=o[m++];try{x=F(x)}catch(S){T.call(this,S);break}}try{h=Mh.call(this,x)}catch(F){return Promise.reject(F)}for(m=0,v=c.length;m<v;)h=h.then(c[m++],c[m++]);return h}getUri(e){e=Ei(this.defaults,e);const t=Ch(e.baseURL,e.url,e.allowAbsoluteUrls);return ph(t,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Li.prototype[e]=function(t,i){return this.request(Ei(i||{},{method:e,url:t,data:(i||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function t(i){return function(n,s,o){return this.request(Ei(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Li.prototype[e]=t(),Li.prototype[e+"Form"]=t(!0)});let p1=class hf{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(n){t=n});const i=this;this.promise.then(r=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](r);i._listeners=null}),this.promise.then=r=>{let n;const s=new Promise(o=>{i.subscribe(o),n=o}).then(r);return s.cancel=function(){i.unsubscribe(n)},s},e(function(n,s,o){i.reason||(i.reason=new br(n,s,o),t(i.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 t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hf(function(r){e=r}),cancel:e}}};function d1(A){return function(t){return A.apply(null,t)}}function f1(A){return de.isObject(A)&&A.isAxiosError===!0}const Xo={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(Xo).forEach(([A,e])=>{Xo[e]=A});function Ph(A){const e=new Li(A),t=eh(Li.prototype.request,e);return de.extend(t,Li.prototype,e,{allOwnKeys:!0}),de.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Ph(Ei(A,r))},t}const Bt=Ph(vr);Bt.Axios=Li,Bt.CanceledError=br,Bt.CancelToken=p1,Bt.isCancel=mh,Bt.VERSION=Hh,Bt.toFormData=Un,Bt.AxiosError=tt,Bt.Cancel=Bt.CanceledError,Bt.all=function(e){return Promise.all(e)},Bt.spread=d1,Bt.isAxiosError=f1,Bt.mergeConfig=Ei,Bt.AxiosHeaders=pA,Bt.formToJSON=A=>fh(de.isHTMLForm(A)?new FormData(A):A),Bt.getAdapter=Lh.getAdapter,Bt.HttpStatusCode=Xo,Bt.default=Bt;const{Axios:Yb,AxiosError:qb,CanceledError:jb,isCancel:ex,CancelToken:tx,VERSION:Ax,all:ix,Cancel:rx,isAxiosError:nx,spread:sx,toFormData:ox,AxiosHeaders:ax,HttpStatusCode:lx,formToJSON:cx,getAdapter:hx,mergeConfig:ux}=Bt,VA=Object.create(null);VA.open="0",VA.close="1",VA.ping="2",VA.pong="3",VA.message="4",VA.upgrade="5",VA.noop="6";const In=Object.create(null);Object.keys(VA).forEach(A=>{In[VA[A]]=A});const Jo={type:"error",data:"parser error"},Dh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_h=typeof ArrayBuffer=="function",kh=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A&&A.buffer instanceof ArrayBuffer,Zo=({type:A,data:e},t,i)=>Dh&&e instanceof Blob?t?i(e):Oh(e,i):_h&&(e instanceof ArrayBuffer||kh(e))?t?i(e):Oh(new Blob([e]),i):i(VA[A]+(e||"")),Oh=(A,e)=>{const t=new FileReader;return t.onload=function(){const i=t.result.split(",")[1];e("b"+(i||""))},t.readAsDataURL(A)};function Nh(A){return A instanceof Uint8Array?A:A instanceof ArrayBuffer?new Uint8Array(A):new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}let Yo;function g1(A,e){if(Dh&&A.data instanceof Blob)return A.data.arrayBuffer().then(Nh).then(e);if(_h&&(A.data instanceof ArrayBuffer||kh(A.data)))return e(Nh(A.data));Zo(A,!1,t=>{Yo||(Yo=new TextEncoder),e(Yo.encode(t))})}const Kh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let A=0;A<Kh.length;A++)xr[Kh.charCodeAt(A)]=A;const m1=A=>{let e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(i=0;i<t;i+=4)n=xr[A.charCodeAt(i)],s=xr[A.charCodeAt(i+1)],o=xr[A.charCodeAt(i+2)],l=xr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},w1=typeof ArrayBuffer=="function",qo=(A,e)=>{if(typeof A!="string")return{type:"message",data:zh(A,e)};const t=A.charAt(0);return t==="b"?{type:"message",data:B1(A.substring(1),e)}:In[t]?A.length>1?{type:In[t],data:A.substring(1)}:{type:In[t]}:Jo},B1=(A,e)=>{if(w1){const t=m1(A);return zh(t,e)}else return{base64:!0,data:A}},zh=(A,e)=>e==="blob"?A instanceof Blob?A:new Blob([A]):A instanceof ArrayBuffer?A:A.buffer,Vh="",y1=(A,e)=>{const t=A.length,i=new Array(t);let r=0;A.forEach((n,s)=>{Zo(n,!1,o=>{i[s]=o,++r===t&&e(i.join(Vh))})})},C1=(A,e)=>{const t=A.split(Vh),i=[];for(let r=0;r<t.length;r++){const n=qo(t[r],e);if(i.push(n),n.type==="error")break}return i};function v1(){return new TransformStream({transform(A,e){g1(A,t=>{const i=t.length;let r;if(i<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,i);else if(i<65536){r=new Uint8Array(3);const n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{r=new Uint8Array(9);const n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}A.data&&typeof A.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let jo;function Pn(A){return A.reduce((e,t)=>e+t.length,0)}function Dn(A,e){if(A[0].length===e)return A.shift();const t=new Uint8Array(e);let i=0;for(let r=0;r<e;r++)t[r]=A[0][i++],i===A[0].length&&(A.shift(),i=0);return A.length&&i<A[0].length&&(A[0]=A[0].slice(i)),t}function T1(A,e){jo||(jo=new TextDecoder);const t=[];let i=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(i===0){if(Pn(t)<1)break;const l=Dn(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?i=3:r===126?i=1:i=2}else if(i===1){if(Pn(t)<2)break;const l=Dn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),i=3}else if(i===2){if(Pn(t)<8)break;const l=Dn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(Jo);break}r=h*Math.pow(2,32)+c.getUint32(4),i=3}else{if(Pn(t)<r)break;const l=Dn(t,r);o.enqueue(qo(n?l:jo.decode(l),e)),i=0}if(r===0||r>A){o.enqueue(Jo);break}}}})}const Wh=4;function kt(A){if(A)return b1(A)}function b1(A){for(var e in kt.prototype)A[e]=kt.prototype[e];return A}kt.prototype.on=kt.prototype.addEventListener=function(A,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+A]=this._callbacks["$"+A]||[]).push(e),this},kt.prototype.once=function(A,e){function t(){this.off(A,t),e.apply(this,arguments)}return t.fn=e,this.on(A,t),this},kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(A,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+A];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+A],this;for(var i,r=0;r<t.length;r++)if(i=t[r],i===e||i.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+A],this},kt.prototype.emit=function(A){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+A],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(t){t=t.slice(0);for(var i=0,r=t.length;i<r;++i)t[i].apply(this,e)}return this},kt.prototype.emitReserved=kt.prototype.emit,kt.prototype.listeners=function(A){return this._callbacks=this._callbacks||{},this._callbacks["$"+A]||[]},kt.prototype.hasListeners=function(A){return!!this.listeners(A).length};const _n=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),bA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),x1="arraybuffer";function px(){}function Gh(A,...e){return e.reduce((t,i)=>(A.hasOwnProperty(i)&&(t[i]=A[i]),t),{})}const Q1=bA.setTimeout,F1=bA.clearTimeout;function kn(A,e){e.useNativeTimers?(A.setTimeoutFn=Q1.bind(bA),A.clearTimeoutFn=F1.bind(bA)):(A.setTimeoutFn=bA.setTimeout.bind(bA),A.clearTimeoutFn=bA.clearTimeout.bind(bA))}const U1=1.33;function S1(A){return typeof A=="string"?E1(A):Math.ceil((A.byteLength||A.size)*U1)}function E1(A){let e=0,t=0;for(let i=0,r=A.length;i<r;i++)e=A.charCodeAt(i),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(i++,t+=4);return t}function Rh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function L1(A){let e="";for(let t in A)A.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(A[t]));return e}function M1(A){let e={},t=A.split("&");for(let i=0,r=t.length;i<r;i++){let n=t[i].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class H1 extends Error{constructor(e,t,i){super(e),this.description=t,this.context=i,this.type="TransportError"}}class ea extends kt{constructor(e){super(),this.writable=!1,kn(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,i){return super.emitReserved("error",new H1(e,t,i)),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 t=qo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_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 t=L1(e);return t.length?"?"+t:""}}class I1 extends ea{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||t()})),this.writable||(i++,this.once("drain",function(){--i||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};C1(e,this.socket.binaryType).forEach(t),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,y1(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Rh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $h=!1;try{$h=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const P1=$h;function D1(){}class _1 extends I1{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let i=location.port;i||(i=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,t){const i=this.request({method:"POST",data:e});i.on("success",t),i.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,i)=>{this.onError("xhr poll error",t,i)}),this.pollXhr=e}}class WA extends kt{constructor(e,t,i){super(),this.createRequest=e,kn(this,i),this._opts=i,this._method=i.method||"GET",this._uri=t,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const t=Gh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(t);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&i.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var r;i.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=WA.requestsCount++,WA.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=D1,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete WA.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(WA.requestsCount=0,WA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xh);else if(typeof addEventListener=="function"){const A="onpagehide"in bA?"pagehide":"unload";addEventListener(A,Xh,!1)}}function Xh(){for(let A in WA.requests)WA.requests.hasOwnProperty(A)&&WA.requests[A].abort()}const k1=(function(){const A=Jh({xdomain:!1});return A&&A.responseType!==null})();class O1 extends _1{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=k1&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new WA(Jh,this.uri(),e)}}function Jh(A){const e=A.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||P1))return new XMLHttpRequest}catch{}if(!e)try{return new bA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Zh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class N1 extends ea{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,i=Zh?{}:Gh(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,i)}catch(r){return this.emitReserved("error",r)}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 t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;Zo(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}r&&_n(()=>{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",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Rh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ta=bA.WebSocket||bA.MozWebSocket;class K1 extends N1{createSocket(e,t,i){return Zh?new ta(e,t,i):t?new ta(e,t):new ta(e)}doWrite(e,t){this.ws.send(t)}}class z1 extends ea{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 t=T1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(t).getReader(),r=v1();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const n=()=>{i.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 t=0;t<e.length;t++){const i=e[t],r=t===e.length-1;this._writer.write(i).then(()=>{r&&_n(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const V1={websocket:K1,webtransport:z1,polling:O1},W1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,G1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Aa(A){if(A.length>8e3)throw"URI too long";const e=A,t=A.indexOf("["),i=A.indexOf("]");t!=-1&&i!=-1&&(A=A.substring(0,t)+A.substring(t,i).replace(/:/g,";")+A.substring(i,A.length));let r=W1.exec(A||""),n={},s=14;for(;s--;)n[G1[s]]=r[s]||"";return t!=-1&&i!=-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=R1(n,n.path),n.queryKey=$1(n,n.query),n}function R1(A,e){const t=/\/{2,9}/g,i=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function $1(A,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,r,n){r&&(t[r]=n)}),t}const ia=typeof addEventListener=="function"&&typeof removeEventListener=="function",On=[];ia&&addEventListener("offline",()=>{On.forEach(A=>A())},!1);class ci extends kt{constructor(e,t){if(super(),this.binaryType=x1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const i=Aa(e);t.hostname=i.host,t.secure=i.protocol==="https"||i.protocol==="wss",t.port=i.port,i.query&&(t.query=i.query)}else t.host&&(t.hostname=Aa(t.host).host);kn(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(i=>{const r=i.prototype.name;this.transports.push(r),this._transportsByName[r]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=M1(this.opts.query)),ia&&(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"})},On.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Wh,t.transport=e,this.id&&(t.sid=this.id);const i=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ci.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}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",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ci.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 t=new Error("server error");t.code=e.data,this._onError(t);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 t=1;for(let i=0;i<this.writeBuffer.length;i++){const r=this.writeBuffer[i].data;if(r&&(t+=S1(r)),i>0&&t>this._maxPayload)return this.writeBuffer.slice(0,i);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,_n(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,i){return this._sendPacket("message",e,t,i),this}send(e,t,i){return this._sendPacket("message",e,t,i),this}_sendPacket(e,t,i,r){if(typeof t=="function"&&(r=t,t=void 0),typeof i=="function"&&(r=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const n={type:e,data:t,options:i};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},i=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(ci.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,t){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(),ia&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=On.indexOf(this._offlineEventListener);i!==-1&&On.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ci.protocol=Wh;class X1 extends ci{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 t=this.createTransport(e),i=!1;ci.priorWebsocketSuccess=!1;const r=()=>{i||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ci.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function n(){i||(i=!0,h(),t.close(),t=null)}const s=m=>{const v=new Error("probe error: "+m);v.transport=t.name,n(),this.emitReserved("upgradeError",v)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const h=()=>{t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",o),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",s),t.once("close",o),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&t.push(e[i]);return t}}let J1=class extends X1{constructor(e,t={}){const i=typeof e=="object"?e:t;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(r=>V1[r]).filter(r=>!!r)),super(e,i)}};function Z1(A,e="",t){let i=A;t=t||typeof location<"u"&&location,A==null&&(A=t.protocol+"//"+t.host),typeof A=="string"&&(A.charAt(0)==="/"&&(A.charAt(1)==="/"?A=t.protocol+A:A=t.host+A),/^(https?|wss?):\/\//.test(A)||(typeof t<"u"?A=t.protocol+"//"+A:A="https://"+A),i=Aa(A)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+e,i.href=i.protocol+"://"+n+(t&&t.port===i.port?"":":"+i.port),i}const Y1=typeof ArrayBuffer=="function",q1=A=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(A):A.buffer instanceof ArrayBuffer,Yh=Object.prototype.toString,j1=typeof Blob=="function"||typeof Blob<"u"&&Yh.call(Blob)==="[object BlobConstructor]",ew=typeof File=="function"||typeof File<"u"&&Yh.call(File)==="[object FileConstructor]";function ra(A){return Y1&&(A instanceof ArrayBuffer||q1(A))||j1&&A instanceof Blob||ew&&A instanceof File}function Nn(A,e){if(!A||typeof A!="object")return!1;if(Array.isArray(A)){for(let t=0,i=A.length;t<i;t++)if(Nn(A[t]))return!0;return!1}if(ra(A))return!0;if(A.toJSON&&typeof A.toJSON=="function"&&arguments.length===1)return Nn(A.toJSON(),!0);for(const t in A)if(Object.prototype.hasOwnProperty.call(A,t)&&Nn(A[t]))return!0;return!1}function tw(A){const e=[],t=A.data,i=A;return i.data=na(t,e),i.attachments=e.length,{packet:i,buffers:e}}function na(A,e){if(!A)return A;if(ra(A)){const t={_placeholder:!0,num:e.length};return e.push(A),t}else if(Array.isArray(A)){const t=new Array(A.length);for(let i=0;i<A.length;i++)t[i]=na(A[i],e);return t}else if(typeof A=="object"&&!(A instanceof Date)){const t={};for(const i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=na(A[i],e));return t}return A}function Aw(A,e){return A.data=sa(A.data,e),delete A.attachments,A}function sa(A,e){if(!A)return A;if(A&&A._placeholder===!0){if(typeof A.num=="number"&&A.num>=0&&A.num<e.length)return e[A.num];throw new Error("illegal attachments")}else if(Array.isArray(A))for(let t=0;t<A.length;t++)A[t]=sa(A[t],e);else if(typeof A=="object")for(const t in A)Object.prototype.hasOwnProperty.call(A,t)&&(A[t]=sa(A[t],e));return A}const iw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(function(A){A[A.CONNECT=0]="CONNECT",A[A.DISCONNECT=1]="DISCONNECT",A[A.EVENT=2]="EVENT",A[A.ACK=3]="ACK",A[A.CONNECT_ERROR=4]="CONNECT_ERROR",A[A.BINARY_EVENT=5]="BINARY_EVENT",A[A.BINARY_ACK=6]="BINARY_ACK"})(ct||(ct={}));class rw{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&Nn(e)?this.encodeAsBinary({type:e.type===ct.EVENT?ct.BINARY_EVENT:ct.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ct.BINARY_EVENT||e.type===ct.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=tw(e),i=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(i),r}}class oa extends kt{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const i=t.type===ct.BINARY_EVENT;i||t.type===ct.BINARY_ACK?(t.type=i?ct.EVENT:ct.ACK,this.reconstructor=new nw(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ra(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const i={type:Number(e.charAt(0))};if(ct[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ct.BINARY_EVENT||i.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");i.attachments=Number(s)}if(e.charAt(t+1)==="/"){const n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););i.nsp=e.substring(n,t)}else i.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const n=t+1;for(;++t;){const s=e.charAt(t);if(s==null||Number(s)!=s){--t;break}if(t===e.length)break}i.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){const n=this.tryParse(e.substr(t));if(oa.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case ct.CONNECT:return qh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||qh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&iw.indexOf(t[0])===-1);case ct.ACK:case ct.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class nw{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Aw(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function qh(A){return Object.prototype.toString.call(A)==="[object Object]"}const sw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:oa,Encoder:rw,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function HA(A,e,t){return A.on(e,t),function(){A.off(e,t)}}const ow=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class jh extends kt{constructor(e,t,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[HA(e,"open",this.onopen.bind(this)),HA(e,"packet",this.onpacket.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(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,...t){var i,r,n;if(ow.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:ct.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,m=t.pop();this._registerAckCallback(h,m),s.id=h}const o=(r=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||r===void 0?void 0:r.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,t){var i;const r=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;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);t.call(this,new Error("operation has timed out"))},r),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((i,r)=>{const n=(s,o)=>s?r(s):i(o);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...n)=>(this._queue[0],r!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.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:ct.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,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ct.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 ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const i of t)i.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 t=this;let i=!1;return function(...r){i||(i=!0,t.packet({type:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,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:ct.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 t=this._anyListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,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 t=this._anyOutgoingListeners;for(let i=0;i<t.length;i++)if(e===t[i])return t.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const i of t)i.apply(this,e.data)}}}function Ri(A){A=A||{},this.ms=A.min||100,this.max=A.max||1e4,this.factor=A.factor||2,this.jitter=A.jitter>0&&A.jitter<=1?A.jitter:0,this.attempts=0}Ri.prototype.duration=function(){var A=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*A);A=(Math.floor(e*10)&1)==0?A-t:A+t}return Math.min(A,this.max)|0},Ri.prototype.reset=function(){this.attempts=0},Ri.prototype.setMin=function(A){this.ms=A},Ri.prototype.setMax=function(A){this.max=A},Ri.prototype.setJitter=function(A){this.jitter=A};class aa extends kt{constructor(e,t){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kn(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((i=t.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Ri({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||sw;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.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 t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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 J1(this.uri,this.opts);const t=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const r=HA(t,"open",function(){i.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=HA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,l=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),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(HA(e,"ping",this.onping.bind(this)),HA(e,"data",this.ondata.bind(this)),HA(e,"error",this.onerror.bind(this)),HA(e,"close",this.onclose.bind(this)),HA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){_n(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new jh(this,e,t),this.nsps[e]=i),i}_destroy(e){const t=Object.keys(this.nsps);for(const i of t)if(this.nsps[i].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let i=0;i<t.length;i++)this.engine.write(t[i],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,t){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),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 t=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Qr={};function Kn(A,e){typeof A=="object"&&(e=A,A=void 0),e=e||{};const t=Z1(A,e.path||"/socket.io"),i=t.source,r=t.id,n=t.path,s=Qr[r]&&n in Qr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new aa(i,e):(Qr[r]||(Qr[r]=new aa(i,e)),l=Qr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Kn,{Manager:aa,Socket:jh,io:Kn,connect:Kn});function la(A){if(!A)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(A,e),i=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${i}`}catch{return String(A).trim().replace(/\/+$/,"")}}let yA=la("http://localhost:8000");function eu(A){const e=la(A);e&&e!==yA&&(yA=e,Mt&&(Mt.disconnect(),Mt.removeAllListeners(),Mt=null))}let Mt=null;function aw(){const A=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=A();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:yA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Kn(yA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),i=()=>{const r=A();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:yA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:yA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=i();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:yA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:yA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function ca(){const A=la(Mt?.io?.uri||null);return!Mt||Mt.io&&A&&yA&&A!==yA?(Mt&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:A,newBaseUrl:yA,wasConnected:Mt.connected,reason:"baseUrl changed"}),Mt.disconnect(),Mt.removeAllListeners(),Mt=null),Mt=aw()):Mt.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Mt.id,connected:Mt.connected,baseUrl:yA,uri:A}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Mt.id,baseUrl:yA}),Mt}function lw(A,e){const t=ca();return t.on(A,e),()=>t.off(A,e)}function cw(A,e){Mt&&Mt.off(A,e)}function hw(A,e){ca().emit(A,e)}function uw(){return Mt?Mt.connected?"connected":"connecting":"disconnected"}const zn={getSocket:ca,on:lw,off:cw,emit:hw,getStatus:uw,setBaseUrl:eu},pw={},tu=Y.createContext(),$t=()=>{const A=Y.useContext(tu);if(!A)throw new Error("useTrading must be used within TradingProvider");return A},dw=({children:A,baseUrl:e,endpoints:t,accountId:i,initialSymbol:r,initialTimeframe:n,indicators:s,indicatorSettings:o})=>{const l=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Ys&&Ys.tagName.toUpperCase()==="SCRIPT"&&Ys.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pw?.VITE_BASE_URL)??"http://localhost:5002";zn.setBaseUrl(l);const h={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[v,x]=Y.useState(r||"BTC/USD"),[F,T]=Y.useState(n||"M1"),[S,I]=Y.useState([]),[Q,N]=Y.useState(!0),[J,H]=Y.useState([]),[z,re]=Y.useState(!1),[q,ie]=Y.useState(1e5),[G,ne]=Y.useState(null),[le,ee]=Y.useState([]),[we,j]=Y.useState(!0),[ge,ae]=Y.useState(!1),[pe,ue]=Y.useState(!0),[oe,fe]=Y.useState("candles"),[Qe,me]=Y.useState(!1),[xe,Se]=Y.useState(null),[Me,$e]=Y.useState("dark"),[Ye,Ie]=Y.useState(null),[We,De]=Y.useState(!1),[Ze,nt]=Y.useState(!1),[dt,He]=Y.useState(!1),[zt,ye]=Y.useState(!1),[Te,ve]=Y.useState(!1),[be,Le]=Y.useState(!1),[Ee,Ke]=Y.useState(!1),[wt,Dt]=Y.useState(!1),[ni,ZA]=Y.useState(!1),[aA,si]=Y.useState(!1),[_A,YA]=Y.useState([]),Zt=Y.useRef(null),Yt=Y.useRef(new Map),Qt=Y.useRef(null),Lt=1e3,Ct=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;re(!0);const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice===null||Ge.closePrice===void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,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}));H(st)}catch(ze){console.error("❌ Error fetching orders:",ze.response?.data||ze.message),H([])}finally{re(!1)}},[l,i]),Ut=Y.useCallback((ze,Ve)=>!Ve||!ze.price||isNaN(Ve)||isNaN(ze.price)?ze.profit||0:(ze?.type?.toUpperCase()==="BUY"?Ve-ze.price:ze.price-Ve)*ze.volume,[]),Vt=Y.useCallback(async()=>{try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}${h.account}`,{headers:{Authorization:`Bearer ${ze}`}});if(Ve.data&&Ve.data.data){const At=parseFloat(Ve.data.data.balance);isNaN(At)||ie(At)}}catch(ze){console.error("❌ Error fetching user balance:",ze.response?.data||ze.message)}},[l]),je=Y.useCallback(async()=>{if(i)try{const ze=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ze)return;const Ve=await Bt.get(`${l}/trades/account/${i}`,{headers:{Authorization:`Bearer ${ze}`}});let At=[];Array.isArray(Ve.data)?At=Ve.data:Ve.data?.data&&Array.isArray(Ve.data.data)&&(At=Ve.data.data);const st=At.filter(Ge=>Ge.closePrice!==null&&Ge.closePrice!==void 0).map(Ge=>({id:Ge.id,ticket:23,symbol:Ge.symbol,type:Ge.type,volume:Ge.volume,openPrice:Ge.openPrice??Ge.price,closePrice:Ge.closePrice,stopLoss:Ge.stopLoss,takeProfit:Ge.takeProfit,profit:Ge.profit??Ge.profitLoss??0,profitCurrency:"USD",openAt:Ge.openedAt||Ge.openAt,closeAt:Ge.closedAt||Ge.closeAt,closeReason:Ge.closeReason||"",status:"CLOSED"}));YA(st)}catch(ze){console.error("❌ Error fetching history orders:",ze.response?.data||ze.message),YA([])}},[l,i]),_e=Y.useMemo(()=>{const ze=q,Ve=J.reduce((at,Ne)=>at+Ne.volume*Ne.price*.01,0),At=J.reduce((at,Ne)=>{const Wt=S.find(lA=>lA.symbol===Ne.symbol);if(Wt){const lA=Ne.type?.toUpperCase()==="BUY"?parseFloat(Wt.bid||0):parseFloat(Wt.ask||0);if(lA&&lA>0&&!isNaN(lA))return at+Ut(Ne,lA)}return at+(Ne.profit||0)},0),st=ze+At,Ge=st-Ve,ft=Ve>0?st/Ve*100:0;return{balance:ze,equity:st,margin:Ve,freeMargin:Ge,level:ft.toFixed(2)}},[J,S,q,Ut]);Y.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&i&&(Ct(),Vt(),je())},[Ct,Vt,je,i]),Y.useEffect(()=>{(async()=>{try{N(!0);const Ve=h.symbols.includes("?")?`${l}${h.symbols}`:`${l}${h.symbols}`,At=localStorage.getItem("token")??localStorage.getItem("authToken"),st=await Bt.get(Ve,{headers:At?{Authorization:`Bearer ${At}`}:{}});let Ge=[];Array.isArray(st.data)?Ge=st.data:st.data&&st.data.data&&Array.isArray(st.data.data)?Ge=st.data.data:st.data&&st.data.prices&&Array.isArray(st.data.prices)?Ge=st.data.prices:st.data&&Array.isArray(st.data)&&(Ge=st.data);const ft=Ge.map(at=>{const Ne=at.symbol||at.name||"",Wt=at.category||null;return Ne&&(at.bid!==void 0||at.price!==void 0)?{symbol:Ne,bid:at.bid??at.price??0,ask:at.ask??at.price??0,change:at.change??0,category:Wt}:{...at,symbol:Ne,category:Wt}});ft.length>0?(I(ft),ft.find(Ne=>Ne.symbol===v)||x(ft[0].symbol)):I([])}catch(Ve){console.error("❌ Error fetching symbols:",Ve.response?.data||Ve.message),I([])}finally{N(!1)}})()},[l,h.symbols]);const Je=Y.useCallback(()=>{const ze=Yt.current;if(ze.size===0)return;const Ve=new Map(ze);ze.clear(),I(At=>At.map(st=>{const Ge=Ve.get(st.symbol);return Ge?{...st,...Ge}:st})),H(At=>{let st=!1;const Ge=At.map(ft=>{const at=Ve.get(ft.symbol);if(!at)return ft;const Ne=ft.type?.toUpperCase()==="BUY"?parseFloat(at.bid||0):parseFloat(at.ask||0);if(!Ne||isNaN(Ne)||Ne<=0)return ft;const Wt=Ut(ft,Ne);return Wt===ft.profit?ft:(st=!0,{...ft,profit:Wt})});return st?Ge:At})},[Ut]);Y.useEffect(()=>{Zt.current||(Zt.current=zn.getSocket());const ze=Zt.current,Ve=()=>{console.log("✅ TradingContext: Connected"),i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)})},At=()=>console.log("⚠️ TradingContext: Disconnected"),st=ft=>{ft?.symbol&&(Yt.current.set(ft.symbol,ft),Qt.current||(Qt.current=setTimeout(()=>{Qt.current=null,Je()},Lt)))},Ge=async ft=>{if(ft){if(ft.newBalance!==void 0){const at=parseFloat(ft.newBalance);isNaN(at)||ie(at)}if(window.notify){const at=ft.profitLoss||ft.profit||0,Ne=at>=0?`+${at.toFixed(2)}`:at.toFixed(2),Wt=ft.symbol||"Trade",lA=ft.reason||"Closed";window.notify(`Trade Closed: ${lA} | ${Wt} | P/L: ${Ne} USD`,at>=0?"success":"error")}ft.tradeId&&H(at=>at.filter(Ne=>Ne.id!==ft.tradeId)),await Ct(),await Vt()}};return ze.on("connect",Ve),ze.on("disconnect",At),ze.on("priceUpdate",st),ze.on("tradeClosed",Ge),ze.connected&&i&&Number.isFinite(Number(i))&&ze.emit("joinUserRoom",{userId:Number(i)}),()=>{ze.off("connect",Ve),ze.off("disconnect",At),ze.off("priceUpdate",st),ze.off("tradeClosed",Ge),Qt.current&&(clearTimeout(Qt.current),Qt.current=null),Yt.current.clear()}},[Je,Ct,Vt]),Y.useEffect(()=>{try{const ze=document.documentElement;if(!ze)return;ze.dataset.theme=Me}catch{}},[Me]);const et=Y.useMemo(()=>S.find(ze=>ze.symbol===v)||{bid:"0.00000",ask:"0.00000",change:0},[S,v]),bt=Y.useMemo(()=>({selectedSymbol:v,setSelectedSymbol:x,selectedTimeframe:F,setSelectedTimeframe:T,symbols:S,setSymbols:I,symbolsLoading:Q,orders:J,setOrders:H,ordersLoading:z,fetchOrders:Ct,fetchUserBalance:Vt,userBalance:q,setUserBalance:ie,accountSummary:_e,currentSymbolData:et,activeTool:G,setActiveTool:ne,chartObjects:le,setChartObjects:ee,showGrid:we,setShowGrid:j,snapToGrid:ge,setSnapToGrid:ae,drawingsVisible:pe,setDrawingsVisible:ue,chartType:oe,setChartType:fe,chartLocked:Qe,setChartLocked:me,selectedTradeForModify:xe,setSelectedTradeForModify:Se,theme:Me,setTheme:$e,candleColors:Ye,setCandleColors:Ie,showTradeOrders:We,setShowTradeOrders:De,showTradePosition:Ze,setShowTradePosition:nt,showTradeHistory:dt,setShowTradeHistory:He,showSLTP:zt,setShowSLTP:ye,showAskPrice:Te,setShowAskPrice:ve,showChartControls:be,setShowChartControls:Le,showTradeNotification:Ee,setShowTradeNotification:Ke,showCrosshair:wt,setShowCrosshair:Dt,showOHLC:ni,setShowOHLC:ZA,baseUrl:l,endpoints:h,endpointParams:m,accountId:i,isShow:aA,setIsShow:si,historyOrders:_A,setHistoryOrders:YA,fetchHistoryOrders:je,indicators:s,indicatorSettings:o}),[v,F,S,Q,J,z,Ct,Vt,q,_e,et,G,le,we,ge,pe,oe,Qe,xe,Me,Ye,We,Ze,dt,zt,Te,be,Ee,wt,ni,l,h,m,aA,_A,je,s,o]);return a.jsx(tu.Provider,{value:bt,children:A})};var Au={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},iu=Y.createContext&&Y.createContext(Au),fw=["attr","size","title"];function gw(A,e){if(A==null)return{};var t=mw(A,e),i,r;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(A);for(r=0;r<n.length;r++)i=n[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(A,i)&&(t[i]=A[i])}return t}function mw(A,e){if(A==null)return{};var t={};for(var i in A)if(Object.prototype.hasOwnProperty.call(A,i)){if(e.indexOf(i)>=0)continue;t[i]=A[i]}return t}function Vn(){return Vn=Object.assign?Object.assign.bind():function(A){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(A[i]=t[i])}return A},Vn.apply(this,arguments)}function ru(A,e){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(A);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(A,r).enumerable})),t.push.apply(t,i)}return t}function Wn(A){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ru(Object(t),!0).forEach(function(i){ww(A,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(i){Object.defineProperty(A,i,Object.getOwnPropertyDescriptor(t,i))})}return A}function ww(A,e,t){return e=Bw(e),e in A?Object.defineProperty(A,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[e]=t,A}function Bw(A){var e=yw(A,"string");return typeof e=="symbol"?e:e+""}function yw(A,e){if(typeof A!="object"||!A)return A;var t=A[Symbol.toPrimitive];if(t!==void 0){var i=t.call(A,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(A)}function nu(A){return A&&A.map((e,t)=>Y.createElement(e.tag,Wn({key:t},e.attr),nu(e.child)))}function nA(A){return e=>Y.createElement(Cw,Vn({attr:Wn({},A.attr)},e),nu(A.child))}function Cw(A){var e=t=>{var{attr:i,size:r,title:n}=A,s=gw(A,fw),o=r||t.size||"1em",l;return t.className&&(l=t.className),A.className&&(l=(l?l+" ":"")+A.className),Y.createElement("svg",Vn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,i,s,{className:l,style:Wn(Wn({color:A.color||t.color},t.style),A.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),A.children)};return iu!==void 0?Y.createElement(iu.Consumer,null,t=>e(t)):e(Au)}function vw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(A)}function Tw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(A)}function bw(A){return nA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(A)}function xw(A){return nA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(A)}function su(A){return nA({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:[]}]})(A)}function Qw(A){return nA({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:[]}]})(A)}function Fw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(A)}function Uw(A){return nA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(A)}function Sw(A){return nA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(A)}function Ew(A){return nA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(A)}const Lw={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ou=({bidPrice:A,askPrice:e,userAccountId:t,onTradeExecuted:i,onExecuteTrade:r,forceParentExecution:n=!1})=>{const{theme:s,selectedSymbol:o,fetchOrders:l,baseUrl:c,endpoints:h}=$t(),m=s==="light",[v,x]=Y.useState("0.01"),[F,T]=Y.useState(""),[S,I]=Y.useState(!1),Q=m?"bg-slate-100":"bg-[#12161d]",N=m?"text-slate-700":"text-white",J=m?"hover:bg-slate-200":"hover:bg-[#1e2635]",H=re=>{const q=parseFloat(v)||.01,ie=Math.max(.01,q+re);x(ie.toFixed(2))},z=async re=>{T("");const q=re,ie=parseFloat(q==="BUY"?e:A),G=parseFloat(v);if(!G||G<=0||isNaN(G)){T("Please enter a valid volume (minimum 0.01)");return}if(G<.01){T("Volume must be at least 0.01");return}if(!ie||ie<=0||isNaN(ie)){T("Invalid price. Please refresh and try again.");return}const ne=localStorage.getItem("token")??localStorage.getItem("authToken");if(!ne){T("Please login to place trades");return}I(!0);const le=typeof o=="object"?o?.symbol:o;if(r){try{await Promise.resolve(r({symbol:le,type:q,lotSize:G,entryPrice:ie,stopLoss:null,takeProfit:null})),l&&l(),i&&i()}catch(we){const j=we?.message||"Trade execution failed";T(j)}finally{I(!1)}return}if(n){T("Trade handler not configured"),I(!1);return}const ee={accountId:t,symbol:le,type:q,volume:G,openPrice:ie,takeProfit:null,stopLoss:null};try{const we=c||Lw?.VITE_BASE_URL||"http://localhost:8000",j=h?.trades||"/api/trades",ge=await Bt.post(`${we}${j}`,ee,{headers:{Authorization:`Bearer ${ne}`,"Content-Type":"application/json"}});if(ge.status<200||ge.status>=300){T(ge.data?.message||`Failed to place trade (${ge.status})`);return}l&&l(),i&&i()}catch(we){const j=we?.response?.data?.message||we?.message||"Network error. Please try again.";T(j)}finally{I(!1)}};return a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[a.jsxs("button",{onClick:()=>z("SELL"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:A?Number(A).toFixed(5):"—"}),a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),a.jsxs("div",{className:`flex items-stretch ${Q}`,children:[a.jsx("button",{type:"button",onClick:()=>H(-.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(su,{size:8})}),a.jsx("input",{type:"number",value:v,onChange:re=>{const q=re.target.value;(q===""||/^\d*\.?\d{0,2}$/.test(q))&&x(q)},onBlur:()=>{const re=parseFloat(v);x(isNaN(re)||re<.01?"0.01":re.toFixed(2))},className:`w-14 text-center focus:outline-none ${Q} ${N}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>H(.01),className:`w-5 flex items-center justify-center ${N} ${J} transition-colors`,children:a.jsx(Qw,{size:8})})]}),a.jsxs("button",{onClick:()=>z("BUY"),disabled:S,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[a.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),a.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),F&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:F})]})},Mw={},au=({isOpen:A,onClose:e,orderType:t,bidPrice:i,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:m,selectedTimeframe:v,setOrders:x,symbols:F,fetchOrders:T,theme:S,baseUrl:I,endpoints:Q}=$t(),N=S==="light",J={getContractSpec:be=>{const Le=String(be||"").toUpperCase();return Le.includes("BTC")||Le.includes("ETH")||Le.includes("SOL")||Le.includes("XRP")||Le.includes("ADA")||Le.includes("DOGE")||Le.includes("BNB")||Le.includes("AVAX")||Le.includes("DOT")||Le.includes("LINK")||Le.endsWith("USDT")?{contractSize:1}:Le.includes("XAU")||Le.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:be,volume:Le})=>{const Ee=J.getContractSpec(be);return(parseFloat(Le)||0)*(Ee.contractSize||1)}},H=h||J,[z,re]=Y.useState("0.01"),[q,ie]=Y.useState(""),[G,ne]=Y.useState(""),[le,ee]=Y.useState(""),[we,j]=Y.useState(!1),[ge,ae]=Y.useState(null),[pe,ue]=Y.useState(""),[oe,fe]=Y.useState(t||"BUY"),[Qe,me]=Y.useState(parseFloat(i)||0),[xe,Se]=Y.useState(parseFloat(r)||0),[Me,$e]=Y.useState("text-white"),[Ye,Ie]=Y.useState("text-white"),We=Y.useRef(parseFloat(i)||0),De=Y.useRef(parseFloat(r)||0);Y.useEffect(()=>{if(!A)return;const be=zn.getSocket(),Le=Ke=>{if(!(!Ke||!Ke.symbol)&&Ke.symbol.toUpperCase()===m?.toUpperCase()){const wt=parseFloat(Ke.bid)||0,Dt=parseFloat(Ke.ask)||0;wt>0&&(wt>We.current?($e("text-green-400"),setTimeout(()=>$e("text-white"),500)):wt<We.current&&We.current>0&&($e("text-red-400"),setTimeout(()=>$e("text-white"),500)),me(wt),We.current=wt),Dt>0&&(Dt>De.current?(Ie("text-green-400"),setTimeout(()=>Ie("text-white"),500)):Dt<De.current&&De.current>0&&(Ie("text-red-400"),setTimeout(()=>Ie("text-white"),500)),Se(Dt),De.current=Dt)}};be.on("priceUpdate",Le);const Ee=F.find(Ke=>Ke.symbol===m);if(Ee){const Ke=parseFloat(Ee.bid)||0,wt=parseFloat(Ee.ask)||0;Ke>0&&(me(Ke),We.current=Ke),wt>0&&(Se(wt),De.current=wt)}return()=>{be.off("priceUpdate",Le)}},[A,m,F]),Y.useEffect(()=>{if(A){re(o?String(o):"0.01"),ie(""),ne(""),ee(""),ue(""),fe(t||"BUY");const be=parseFloat(i)||0,Le=parseFloat(r)||0;be>0&&(me(be),We.current=be),Le>0&&(Se(Le),De.current=Le)}},[A,t,o]);const Ze=Qe||0,nt=xe||0,dt=be=>{const Le=parseFloat(z)||.01,Ee=Math.max(.01,Le+be);re(Ee.toFixed(2))},He=be=>{const Le=parseFloat(q)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)):Ke=Math.max(Ee+1e-5,Ke),ie(Ke>0?Ke.toFixed(5):""),ue("")},zt=be=>{const Le=parseFloat(G)||0,Ee=parseFloat(oe==="BUY"?xe:Qe)||0;if(!Ee){ue("Current price not available. Please wait...");return}let Ke=Le+be;oe==="BUY"?Ke=Math.max(Ee+1e-5,Ke):Ke=Math.max(1e-5,Math.min(Ke,Ee-1e-5)),ne(Ke>0?Ke.toFixed(5):""),ue("")},ye=async be=>{ue("");const Le=be||oe,Ee=parseFloat(Le==="BUY"?xe:Qe),Ke=parseFloat(z),wt=q?parseFloat(q):null,Dt=G?parseFloat(G):null;if(!Ke||Ke<=0||isNaN(Ke)){ue("Please enter a valid volume (minimum 0.01)");return}if(Ke<.01){ue("Volume must be at least 0.01");return}if(!Ee||Ee<=0||isNaN(Ee)){ue("Invalid price. Please refresh and try again.");return}if(wt!==null&&wt!==""){if(isNaN(wt)||wt<=0){ue("Stop Loss must be a valid positive number");return}if(Le==="BUY"&&wt>=Ee){ue("Stop Loss must be below the current price for BUY orders");return}if(Le==="SELL"&&wt<=Ee){ue("Stop Loss must be above the current price for SELL orders");return}}if(Dt!==null&&Dt!==""){if(isNaN(Dt)||Dt<=0){ue("Take Profit must be a valid positive number");return}if(Le==="BUY"){if(Dt<=Ee){ue(`Take Profit must be above the entry price (${Ee.toFixed(5)}) for BUY orders`);return}}else if(Le==="SELL"&&Dt>=Ee){ue(`Take Profit must be below the entry price (${Ee.toFixed(5)}) for SELL orders`);return}}fe(Le),ae(Le),j(!0);const ni=new Date,ZA=ni.toLocaleTimeString(),aA=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,si=localStorage.getItem("token")??localStorage.getItem("authToken");if(!si){ue("Please login to place trades"),j(!1),ae(null);return}const _A={accountId:s,symbol:m,type:Le,volume:Ke,price:Ee,takeProfit:Dt,stopLoss:wt,comment:le.trim()||null},YA={ticket:aA.substring(0,8),symbol:m,type:Le,volume:parseFloat(Ke),price:parseFloat(Ee),time:ZA,stopLoss:wt?parseFloat(wt):null,takeProfit:Dt?parseFloat(Dt):null,swap:0,profit:0,profitCurrency:"USD",comment:le.trim()||"",id:aA,status:"OPEN",openAt:ni.toISOString()};if(!l&&x&&x(Zt=>[...Zt,YA]),c&&!n){ue("Execution handler is required in forceParentExecution mode"),j(!1),ae(null);return}if(n){j(!1),ae(null),e();const Zt={symbol:m,type:Le,lotSize:Ke,entryPrice:Ee,stopLoss:wt,takeProfit:Dt,comment:le.trim()||null};Promise.resolve(n(Zt)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),T&&T()}).catch(Yt=>{console.error("❌ Trade execution failed:",Yt),!l&&x&&x(Qt=>Qt.filter(Lt=>Lt.id!==aA))})}else{if(c){ue("Fallback API path disabled in forceParentExecution mode"),j(!1),ae(null);return}j(!1),ae(null),e();const Zt=I||Mw?.VITE_BASE_URL||"http://localhost:8000",Yt=Q?.trades||"/api/trades";Bt.post(`${Zt}${Yt}`,_A,{headers:{Authorization:`Bearer ${si}`,"Content-Type":"application/json"}}).then(Qt=>{if(Qt.data&&Qt.data.data){const Lt=Qt.data.data.trade;!l&&x&&x(Ct=>Ct.map(Ut=>Ut.id===aA?{...Ut,id:Lt.id,ticket:Lt.id.substring(0,8),time:ZA,openAt:Lt.openAt}:Ut)),console.log("✅ Trade saved successfully:",Lt),window.notify&&window.notify(`Trade placed successfully: ${Lt.symbol} ${Lt.type}`,"success")}else{!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));const Lt=Qt.data?.message||"Failed to place trade";window.notify&&window.notify(Lt,"error")}}).catch(Qt=>{console.error("Error placing trade:",Qt),!l&&x&&x(Ct=>Ct.filter(Ut=>Ut.id!==aA));let Lt="Failed to place trade";if(Qt.response){const Ct=Qt.response.status,Ut=Qt.response.data;Ct===400?Lt=Ut?.message||"Invalid trade data. Please check your inputs.":Ct===401?Lt="Authentication failed. Please login again.":Ct===404?Lt=Ut?.message||"Symbol not found. Please select a valid symbol.":Ct===500?Lt="Server error. Please try again later.":Lt=Ut?.message||`Error: ${Ct}`}else Qt.request&&(Lt="Network error. Please check your internet connection.");window.notify&&window.notify(Lt,"error")})}},ve=(H?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return A?a.jsxs("div",{className:`w-full flex flex-col pointer-events-auto z-30 h-full ${N?"bg-white border-r border-slate-300":"bg-[#12161d] border-r border-slate-700"}`,children:[a.jsxs("div",{className:`px-4 py-2.5 flex items-center justify-between border-b ${N?"border-slate-300 bg-white":"border-slate-700 bg-[#12161d]"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),a.jsx("button",{onClick:e,className:`p-1 rounded transition-colors ${N?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-white hover:text-white hover:bg-[#12161d]"}`,children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[pe&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:pe}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[ve," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>dt(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d{0,2}$/.test(Le))&&(re(Le),ue(""))},onBlur:()=>{const be=parseFloat(z);re(isNaN(be)||be<.01?"0.01":be.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"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"}),a.jsx("button",{type:"button",onClick:()=>dt(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>He(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:q,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ie(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ie(Le.toFixed(5)):be.target.value===""&&ie("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>He(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase SL",children:"+"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>zt(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:G,onChange:be=>{const Le=be.target.value;(Le===""||/^\d*\.?\d*$/.test(Le))&&(ne(Le),ue(""))},onBlur:be=>{const Le=parseFloat(be.target.value);!isNaN(Le)&&Le>0?ne(Le.toFixed(5)):be.target.value===""&&ne("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>zt(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:le,onChange:be=>ee(be.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 ${N?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Me} font-medium transition-colors duration-400`,children:Ze>0?Ze.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Ye} font-medium transition-colors duration-400`,children:nt>0?nt.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>ye("SELL"),disabled:we,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:we&&ge==="SELL"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.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"}),a.jsx("button",{onClick:()=>ye("BUY"),disabled:we,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:we&&ge==="BUY"?a.jsxs("span",{className:"flex items-center justify-center gap-2",children:[a.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[a.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),a.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},Hw={text:"Text",trendline:"Trend Line",parallellines:"Parallel Channel",fibonacci:"Fibonacci Retracement",rectangle:"Rectangle",pricelevel:"Horizontal Line",horizontalray:"Horizontal Ray",verticalline:"Vertical Line",infoline:"Info Line",rulerline:"Ruler Line",arrowedline:"Arrowed Line",rayline:"Ray",extendedline:"Extended Line",crossline:"Cross Line",trendbyangle:"Trend By Angle",disjointchannel:"Disjoint Channel",flattopbottom:"Flat Top/Bottom",regressionchannel:"Regression Channel",stddevchannel:"StdDev Channel",andrewspitchfork:"Andrew's Pitchfork",gannline:"Gann Line",gannfan:"Gann Fan",ganngrid:"Gann Grid",circle:"Circle",triangle:"Triangle",ellipse:"Ellipse",equidistantchannel:"Equidistant Channel"},Iw=[10,11,12,14,16,20,24,28,30,40],Gn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],hi={width:"78%",height:"78%",display:"block"},lu={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Pw(A){return A?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function Nt(A,e="#5f8f96"){if(typeof A!="string")return e;const t=A.trim();if(!t)return e;const i=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(i)?i.toLowerCase():e}const Dw=()=>a.jsx(Sw,{style:hi}),_w=()=>a.jsx(Ew,{style:hi}),kw=()=>a.jsx(xw,{style:hi}),Ow=()=>a.jsx(Uw,{style:hi}),Nw=()=>a.jsx(Tw,{style:hi}),Kw=()=>a.jsx(vw,{style:hi}),zw=()=>a.jsx(bw,{style:hi}),Vw=()=>a.jsx(su,{style:hi}),ha=({size:A,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:A,height:A},children:e});function Fr({checked:A,onClick:e,hideLeftBorder:t,tokens:i,children:r,title:n}){return a.jsx("button",{type:"button",onClick:e,title:n,style:{display:"flex",width:30,height:30,alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,borderLeftWidth:t?0:1,background:A?i.activeFill:"transparent",color:A?i.activeText:i.text,cursor:"pointer",padding:0},children:a.jsx(ha,{size:"18px",children:r})})}function ke({checked:A,onChange:e,label:t,tokens:i,disabled:r=!1}){return a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:r?.5:1,cursor:r?"default":"pointer"},children:[a.jsx("input",{type:"checkbox",checked:A,onChange:n=>e(n.target.checked),disabled:r,style:lu}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${i.border}`,background:i.fieldBg},children:A&&a.jsx("span",{style:{width:10,height:10,background:i.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:i.text},children:t})]})}function ht({value:A,onChange:e,onBlur:t,disabled:i=!1,tokens:r}){const n=Nt(A,"#5f8f96"),s=(A||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:i?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:i?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:i,style:{...lu,position:"absolute"}}),a.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),a.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const m=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:i,style:c})]})}function mt({tokens:A,disabled:e=!1,style:t={},...i}){return a.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?A.fieldDisabledBg:A.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?A.fieldDisabledBg:A.fieldBg,color:e?A.fieldDisabledText:A.text,...t},...i})}function ui({value:A,onChange:e,tokens:t,disabled:i=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:A,onChange:e,disabled:i,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${i?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:i?t.fieldDisabledBg:t.fieldBg,color:i?t.fieldDisabledText:t.text,cursor:i?"default":"pointer",opacity:i?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(Vw,{})})]})}function Ww({draft:A,setDraft:e,tokens:t}){const i=A.visibleTimeframes?.length===Gn.length,r=()=>{e(s=>({...s,visibleTimeframes:i?[]:Gn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(ke,{checked:i,onChange:r,label:"Show on all the timeframes",tokens:t}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:Gn.map(s=>a.jsx(ke,{checked:(A.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:i},s.key))})]})}function Gw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{i(n,Nt(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.color||"#5f8f96",onChange:n=>i("color",n),onBlur:()=>r("color",A.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:A.fontSize||12,onChange:n=>i("fontSize",Number(n.target.value)),tokens:t,width:84,children:Iw.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.fontWeight==="bold",onClick:()=>i("fontWeight",A.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(kw,{})}),a.jsx(Fr,{checked:A.fontStyle==="italic",onClick:()=>i("fontStyle",A.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Ow,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Fr,{checked:A.textAlign==="left",onClick:()=>i("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Nw,{})}),a.jsx(Fr,{checked:A.textAlign==="center",onClick:()=>i("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Kw,{})}),a.jsx(Fr,{checked:A.textAlign==="right",onClick:()=>i("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zw,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(ke,{checked:!!A.textWrap,onChange:n=>i("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.borderEnabled,onChange:n=>i("borderEnabled",n),label:"Border",tokens:t}),a.jsx(ht,{value:A.borderColor||"#5f8f96",onChange:n=>i("borderColor",n),onBlur:()=>r("borderColor",A.borderColor,"#5f8f96"),disabled:!A.borderEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.borderEnabled,value:A.borderOpacity??.1,onChange:n=>i("borderOpacity",Number(n.target.value))}),a.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!A.borderEnabled,value:A.borderWidth??1,onChange:n=>i("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:A.borderWidth??1})]}),a.jsx(ke,{checked:!!A.bgEnabled,onChange:n=>i("bgEnabled",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.bgColor||"#5f8f96",onChange:n=>i("bgColor",n),onBlur:()=>r("bgColor",A.bgColor,"#5f8f96"),disabled:!A.bgEnabled,tokens:t}),a.jsx(mt,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!A.bgEnabled,value:A.bgOpacity??.1,onChange:n=>i("bgOpacity",Number(n.target.value))}),a.jsx("div",{})]}),a.jsx("textarea",{value:A.text||"",onChange:n=>i("text",n.target.value),placeholder:"Your text",rows:4,style:{width:"100%",resize:"none",border:`1px solid ${t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text}})]})}function Rw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Rn({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#22c55e",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $w({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showArea!==!1,onChange:n=>i("showArea",n),label:"Show area",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsBarsRange,onChange:n=>i("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(ke,{checked:!!A.statsDateRange,onChange:n=>i("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(ke,{checked:!!A.statsAngle,onChange:n=>i("statsAngle",n),label:"Angle",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Jw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function dA(A){if(!A)return"";const e=new Date(A*1e3),t=i=>String(i).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function xA({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]})]})}function cu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=!A.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:s=>i("lineColor",s),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:s=>i("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showPrice!==!1,onChange:s=>i("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(ke,{checked:!!A.showText,onChange:s=>i("showText",s),label:"Show text",tokens:t}),a.jsx(ht,{value:A.textColor||"#ffffff",onChange:s=>i("textColor",s),onBlur:()=>r("textColor",A.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{value:A.textHAlign??"center",onChange:s=>i("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(ui,{value:A.textVAlign??"top",onChange:s=>i("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:A.textContent||"",onChange:s=>i("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function Zw({draft:A,setDraft:e,tokens:t}){return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"Price"}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:i=>{const r=Number(i.target.value);Number.isFinite(r)&&e(n=>({...n,price:r}))},style:{width:180}})]})})}function Yw({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.originTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function qw({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#3b82f6",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:A.showDate!==!1,onChange:n=>i("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jw({draft:A,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:t})]})})}function eB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#7aa6ae",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#7aa6ae"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(ht,{value:A.statsColor||"#5f8f96",onChange:n=>i("statsColor",n),onBlur:()=>r("statsColor",A.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{value:A.statsPosition??"right",onChange:n=>i("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(ke,{checked:!!A.statsShowAlways,onChange:n=>i("statsShowAlways",n),label:"Show always",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60,flexShrink:0},children:"Properties"}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx(ke,{checked:!!A.statsPriceRange,onChange:n=>i("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(ke,{checked:!!A.statsDistance,onChange:n=>i("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function tB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#06a0e3",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(ke,{checked:!!A.showTime,onChange:n=>i("showTime",n),label:"Show time",tokens:t}),a.jsx(ke,{checked:!!A.showPrice,onChange:n=>i("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function AB({draft:A,setDraft:e,tokens:t}){const i={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.rawTime),style:r}),a.jsx(mt,{tokens:t,value:A.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function iB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l,c,h,m)=>a.jsxs(a.Fragment,{children:[a.jsx(ke,{checked:!!A[h],onChange:v=>i(h,v),label:s,tokens:t}),a.jsx(ht,{value:A[o]||m,onChange:v=>i(o,v),onBlur:()=>r(o,A[o],m),tokens:t}),a.jsx(mt,{tokens:t,value:A[l]??.35,onChange:v=>{const x=parseFloat(v.target.value);Number.isFinite(x)&&i(l,Math.max(0,Math.min(1,x)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A[c]??1,onChange:v=>i(c,Number(v.target.value)),style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A[c]??1})]})]});return a.jsxs("div",{style:{padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14,marginBottom:14},children:[n("Base line","baseLineColor","baseLineOpacity","baseLineWidth","showBaseLine","#ff0000"),n("Upper line","upperLineColor","upperLineOpacity","upperLineWidth","showUpperLine","#0000ff"),n("Lower line","lowerLineColor","lowerLineOpacity","lowerLineWidth","showLowerLine","#0000ff")]}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Opacity"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:70},children:"Extension"}),a.jsx(ke,{checked:!!A.extendLeft,onChange:s=>i("extendLeft",s),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.extendRight,onChange:s=>i("extendRight",s),label:"Right",tokens:t})]}),a.jsx(ke,{checked:!!A.showPearsonsR,onChange:s=>i("showPearsonsR",s),label:"Show Pearson's R",tokens:t})]})]})}function rB({draft:A,tokens:e}){const t={height:30,width:"100%",border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},i={display:"grid",gridTemplateColumns:"100px 1fr",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:t})]}),a.jsxs("div",{style:i,children:[a.jsx("span",{style:{fontSize:12,color:e.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:t})]})]})}function nB({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||"#8b5cf6",onChange:n=>i("strokeColor",n),onBlur:()=>r("strokeColor",A.strokeColor,"#8b5cf6"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr auto 2fr",gap:14},children:[a.jsx(ke,{checked:!!A.showMiddleLine,onChange:n=>i("showMiddleLine",n),label:"Middle line",tokens:t}),a.jsx(ht,{value:A.middleLineColor||"#8b5cf6",onChange:n=>i("middleLineColor",n),onBlur:()=>r("middleLineColor",A.middleLineColor,"#8b5cf6"),tokens:t,disabled:!A.showMiddleLine}),a.jsx(mt,{tokens:t,disabled:!A.showMiddleLine,value:A.middleLineOpacity??.5,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("middleLineOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.middleLineWidth??1,onChange:n=>i("middleLineWidth",Number(n.target.value)),disabled:!A.showMiddleLine,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.middleLineWidth??1})]}),a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||"#b4a7d6",onChange:n=>i("backgroundColor",n),onBlur:()=>r("backgroundColor",A.backgroundColor,"#b4a7d6"),tokens:t,disabled:!A.showBackground}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("backgroundOpacity",Math.max(0,Math.min(1,s)))},style:{width:60}}),a.jsx("div",{})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]})]})}function sB({draft:A,setDraft:e,tokens:t}){const i=(o,l)=>{const c=parseFloat(l);Number.isFinite(c)&&e(h=>({...h,[o]:c}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},s={display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:o=>i("point1Price",o.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:o=>i("point2Price",o.target.value)})]}),a.jsxs("div",{style:s,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:o=>i("point3Price",o.target.value)})]})]})}function oB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>e(c=>{const h=c.rays?[...c.rays]:[];return h[s]={...h[s],[o]:l},{...c,rays:h}}),n=[...A.rays??[]].reverse();return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsx("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr 2fr 1fr",gap:8,alignItems:"center"},children:n.map((s,o)=>{const l=(A.rays??[]).findIndex(c=>c.ratio===s.ratio);return a.jsxs(Y.Fragment,{children:[a.jsx(mt,{tokens:t,value:s.label,onChange:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&r(l,"ratio",h),r(l,"label",c.target.value)},onBlur:c=>{const h=parseFloat(c.target.value);Number.isFinite(h)&&h>0&&(r(l,"ratio",h),r(l,"label",h%1===0?h.toFixed(2):String(h)))},style:{width:60}}),a.jsx(ht,{value:s.color||"#888888",onChange:c=>r(l,"color",c),onBlur:()=>r(l,"color",Nt(s.color,"#888888")),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:c=>r(l,"width",Number(c.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]}),a.jsx("div",{})]},o)})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.backgroundColor||"#3b82f6",onChange:s=>i("backgroundColor",s),onBlur:()=>i("backgroundColor",Nt(A.backgroundColor,"#3b82f6")),tokens:t}),a.jsx("span",{style:{fontSize:12,color:t.text},children:"Background"}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]}),a.jsx(ke,{checked:!!A.showLabels,onChange:s=>i("showLabels",s),label:"Show labels",tokens:t})]})}function aB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Divisions"}),a.jsx(mt,{tokens:t,value:A.divisions??8,min:2,max:50,step:1,onChange:r=>i("divisions",Number(r.target.value)),onBlur:r=>i("divisions",Math.max(2,Math.min(50,parseInt(r.target.value)||8))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line color"}),a.jsx(ht,{value:A.lineColor??"#94a3b8",onChange:r=>i("lineColor",r),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Line width"}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsx(ke,{label:"Show background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("label",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Background"}),a.jsx(ht,{value:A.backgroundColor??"#3b82f6",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.08,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",parseFloat(r.target.value)||0),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r.target.value)||0))),style:{width:60}})]})]})}function lB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>i(s,Nt(o,l)),n=(s,o,l)=>e(c=>{const h=c.levels?[...c.levels]:[];return h[s]={...h[s],[o]:l},{...c,levels:h}});return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.medianColor||"#a50000",onChange:s=>i("medianColor",s),onBlur:()=>r("medianColor",A.medianColor,"#a50000"),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.medianWidth??1,onChange:s=>i("medianWidth",Number(s.target.value)),style:{flex:1,width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:A.medianWidth??1})]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"auto 40px 1fr 2fr",gap:8,alignItems:"center"},children:(A.levels??[]).map((s,o)=>a.jsxs(Y.Fragment,{children:[a.jsx("input",{type:"checkbox",checked:!!s.enabled,onChange:l=>n(o,"enabled",l.target.checked),style:{accentColor:t.headerBlue,margin:0}}),a.jsx("span",{style:{fontSize:12,color:t.text},children:s.label}),a.jsx(ht,{value:s.color||"#888888",onChange:l=>n(o,"color",l),onBlur:()=>n(o,"color",Nt(s.color,"#888888")),tokens:t,disabled:!s.enabled}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:s.width??1,onChange:l=>n(o,"width",Number(l.target.value)),disabled:!s.enabled,style:{width:80,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:12,fontSize:12,color:t.text,textAlign:"right"},children:s.width??1})]})]},s.k))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:s=>i("showBackground",s),label:"Background",tokens:t}),a.jsx(mt,{tokens:t,disabled:!A.showBackground,value:A.backgroundOpacity??.1,onChange:s=>{const o=parseFloat(s.target.value);Number.isFinite(o)&&i("backgroundOpacity",Math.max(0,Math.min(1,o)))},style:{width:60}})]})]})}function cB({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=parseFloat(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText},n={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:r}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:r}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:n,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point3Time),style:r}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function ua({draft:A,setDraft:e,tokens:t,strokeDefault:i="#7aa6ae",bgDefault:r="#b4a7d6"}){const n=(s,o)=>e(l=>({...l,[s]:o}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ht,{value:A.strokeColor||i,onChange:s=>n("strokeColor",s),onBlur:()=>n("strokeColor",Nt(A.strokeColor,i)),tokens:t}),a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??1,onChange:s=>n("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{fontSize:12,color:t.text,minWidth:12,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:A.showBackground!==!1,onChange:s=>n("showBackground",s),label:"Background",tokens:t}),a.jsx(ht,{value:A.backgroundColor||r,onChange:s=>n("backgroundColor",s),onBlur:()=>n("backgroundColor",Nt(A.backgroundColor,r)),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.1,min:0,max:1,step:.01,onChange:s=>n("backgroundOpacity",parseFloat(s.target.value)||0),onBlur:s=>n("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(s.target.value)||0))),style:{width:60}})]})]})}function hB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function uB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function pB({draft:A,setDraft:e,tokens:t}){return a.jsx(ua,{draft:A,setDraft:e,tokens:t})}function dB({draft:A,setDraft:e,tokens:t}){const i=(h,m)=>e(v=>({...v,[h]:m})),r=h=>{if(!h)return"";const m=new Date(h*1e3),v=String(m.getUTCDate()).padStart(2,"0"),x=String(m.getUTCMonth()+1).padStart(2,"0"),F=m.getUTCFullYear(),T=String(m.getUTCHours()).padStart(2,"0"),S=String(m.getUTCMinutes()).padStart(2,"0"),I=String(m.getUTCSeconds()).padStart(2,"0");return`${v}.${x}.${F} ${T}:${S}:${I}`},n={display:"grid",gridTemplateColumns:"110px 1fr 100px",gap:8,alignItems:"center",marginBottom:6},s={fontSize:12,color:t.mutedText},o={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldDisabledBg,color:t.fieldDisabledText,boxSizing:"border-box"},l={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 6px",fontSize:12,background:t.fieldBg,color:t.text,boxSizing:"border-box",outline:"none"},c=[{label:"#1 (Bar, Price)",timeKey:"point1Time",priceKey:"point1Price"},{label:"#2 (Bar, Price)",timeKey:"point2Time",priceKey:"point2Price"},{label:"#3 (Bar, Price)",timeKey:"point3Time",priceKey:"point3Price"}];return a.jsx("div",{style:{padding:"12px 16px"},children:c.map(({label:h,timeKey:m,priceKey:v})=>a.jsxs("div",{style:n,children:[a.jsx("span",{style:s,children:h}),a.jsx("input",{style:o,value:r(A[m]),readOnly:!0}),a.jsx("input",{type:"number",style:l,value:A[v]??0,step:"0.00001",onChange:x=>i(v,parseFloat(x.target.value)||0)})]},h))})}function fB({draft:A,setDraft:e,tokens:t}){const i=(r,n)=>e(s=>({...s,[r]:n}));return a.jsxs("div",{style:{padding:"12px 16px",display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ht,{value:A.strokeColor??"#7aa6ae",onChange:r=>i("strokeColor",r),tokens:t}),a.jsx("input",{type:"range",min:1,max:5,step:1,value:A.lineWidth??1,onChange:r=>i("lineWidth",Number(r.target.value)),style:{flex:1}}),a.jsx("span",{style:{fontSize:11,color:t.mutedText,minWidth:16,textAlign:"right"},children:A.lineWidth??1})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx(ke,{label:"Background",checked:A.showBackground!==!1,onChange:r=>i("showBackground",r),tokens:t}),a.jsx(ht,{value:A.backgroundColor??"#94a3b8",onChange:r=>i("backgroundColor",r),tokens:t}),a.jsx(mt,{tokens:t,value:A.backgroundOpacity??.18,min:0,max:1,step:.01,onChange:r=>i("backgroundOpacity",r),onBlur:r=>i("backgroundOpacity",Math.max(0,Math.min(1,parseFloat(r)||0))),style:{width:60}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[a.jsx("span",{style:{fontSize:12,color:t.mutedText,minWidth:90},children:"Extension"}),a.jsx(ke,{label:"Left",checked:!!A.extendLeft,onChange:r=>i("extendLeft",r),tokens:t}),a.jsx(ke,{label:"Right",checked:!!A.extendRight,onChange:r=>i("extendRight",r),tokens:t})]})]})}function gB({draft:A,tokens:e}){const t=[{label:"#1 (Bar, Price)",time:A.point1Time,price:A.point1Price},{label:"#2 (Bar, Price)",time:A.point1Time,price:A.point4Price},{label:"#3 (Bar, Price)",time:A.point2Time,price:A.point1Price},{label:"#4 (Bar, Price)",time:A.point2Time,price:A.point4Price}],i={height:28,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText},r={height:28,width:80,border:`1px solid ${e.fieldBorder}`,padding:"0 6px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,padding:"12px 16px"},children:t.map((n,s)=>a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"110px 1fr 80px",alignItems:"center",gap:6},children:[a.jsx("span",{style:{fontSize:12,color:e.mutedText},children:n.label}),a.jsx("input",{readOnly:!0,value:n.time?new Date(n.time*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).replace(",",""):"—",style:i}),a.jsx("input",{readOnly:!0,value:n.price!=null?Number(n.price).toFixed(5):"—",style:r})]},s))})}function hu({draft:A,setDraft:e,tokens:t}){const i=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>i(n,Nt(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(ht,{value:A.lineColor||"#129f5c",onChange:n=>i("lineColor",n),onBlur:()=>r("lineColor",A.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:A.lineWidth??2,onChange:n=>i("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:A.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showBackground,onChange:n=>i("showBackground",n),label:"Background",tokens:t}),a.jsx(ht,{value:A.fillColor||"#6aa84f",onChange:n=>i("fillColor",n),onBlur:()=>r("fillColor",A.fillColor,"#6aa84f"),tokens:t}),a.jsx(mt,{tokens:t,value:A.fillOpacity??.1,onChange:n=>{const s=parseFloat(n.target.value);Number.isFinite(s)&&i("fillOpacity",Math.max(0,Math.min(1,s)))},style:{width:52}})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(ke,{checked:!!A.showPrices,onChange:n=>i("showPrices",n),label:"Prices",tokens:t}),a.jsx(ht,{value:A.pricesColor||"#129f5c",onChange:n=>i("pricesColor",n),onBlur:()=>r("pricesColor",A.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(ke,{checked:!!A.rayLeft,onChange:n=>i("rayLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.rayRight,onChange:n=>i("rayRight",n),label:"Right",tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(ke,{checked:!!A.arrowLeft,onChange:n=>i("arrowLeft",n),label:"Left",tokens:t}),a.jsx(ke,{checked:!!A.arrowRight,onChange:n=>i("arrowRight",n),label:"Right",tokens:t})]})]})}function uu({draft:A,setDraft:e,tokens:t}){const i=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point1Time),style:n}),a.jsx(mt,{tokens:t,value:A.point1Price??"",onChange:s=>i("point1Price",s.target.value)})]}),a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#2 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:dA(A.point2Time),style:n}),a.jsx(mt,{tokens:t,value:A.point2Price??"",onChange:s=>i("point2Price",s.target.value)})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 110px",alignItems:"center",gap:8},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#3 (Bar, Price)"}),a.jsx(mt,{tokens:t,value:A.point3Price??"",onChange:s=>i("point3Price",s.target.value)})]})]})}function mB(A){if(!A)return{};const e={visibleTimeframes:A.visibleTimeframes||Gn.map(t=>t.key)};if(A.type==="gannline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#7aa6ae",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="trendline"){const t=typeof A.series?.options=="function"?A.series.options():{};return{...e,lineColor:t.color??A.lineColor??"#22c55e",lineWidth:t.lineWidth??A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.point1?.price??0,point1Time:A.point1?.rawTime??A.point1?.time??0,point2Price:A.point2?.price??0,point2Time:A.point2?.rawTime??A.point2?.time??0}}if(A.type==="text")return{...e,text:A.primitive?.text??A.text??"Text",color:A.primitive?.color??"#5f8f96",fontSize:A.primitive?.fontSize??12,fontWeight:A.primitive?.fontWeight??"normal",fontStyle:A.primitive?.fontStyle??"normal",textAlign:A.primitive?.textAlign??"center",textWrap:A.primitive?.textWrap??!1,borderEnabled:A.primitive?.borderEnabled??!1,borderColor:A.primitive?.borderColor??"#5f8f96",borderOpacity:A.primitive?.borderOpacity??.1,borderWidth:A.primitive?.borderWidth??1,bgEnabled:A.primitive?.bgEnabled??!1,bgColor:A.primitive?.bgColor??"#5f8f96",bgOpacity:A.primitive?.bgOpacity??.1,price:A.price};if(A.type==="pricelevel")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price};if(A.type==="horizontalray")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showPrice:A.showPrice??!0,showText:A.showText??!1,textContent:A.textContent??"",textColor:A.textColor??"#ffffff",textHAlign:A.textHAlign??"center",textVAlign:A.textVAlign??"top",price:A.price,originTime:A.rawOriginTime??A.originTime};if(A.type==="verticalline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,showDate:A.showDate!==!1,rawTime:A.rawTime};if(A.type==="infoline")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!0,statsPriceRange:A.statsPriceRange??!0,statsBarsRange:A.statsBarsRange??!0,statsDateRange:A.statsDateRange??!0,statsAngle:A.statsAngle??!0,statsDistance:A.statsDistance??!0,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="arrowedline")return{...e,lineColor:A.lineColor??"#f59e0b",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight!==!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="rayline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="extendedline")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft!==!1,rayRight:A.rayRight!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsBarsRange:A.statsBarsRange??!1,statsDateRange:A.statsDateRange??!1,statsAngle:A.statsAngle??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="crossline")return{...e,lineColor:A.lineColor??"#06a0e3",lineWidth:A.lineWidth??2,showTime:A.showTime??!1,showPrice:A.showPrice??!1,rawTime:A.p?.rawTime??0,price:A.p?.price??0};if(A.type==="trendbyangle")return{...e,lineColor:A.lineColor??"#7aa6ae",lineWidth:A.lineWidth??2,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways??!1,statsPriceRange:A.statsPriceRange??!1,statsDistance:A.statsDistance??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0};if(A.type==="disjointchannel")return{...e,lineColor:A.lineColor??"#129f5c",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#6aa84f",fillOpacity:A.fillOpacity??.1,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#129f5c",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="flattopbottom")return{...e,lineColor:A.lineColor??"#3b82f6",lineWidth:A.lineWidth??2,fillColor:A.fillColor??"#3b82f6",fillOpacity:A.fillOpacity??.12,showBackground:A.showBackground!==!1,showPrices:A.showPrices!==!1,pricesColor:A.pricesColor??"#3b82f6",rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,arrowLeft:A.arrowLeft??!1,arrowRight:A.arrowRight??!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p3?.price??0,point2Time:A.p3?.rawTime??0,point3Price:A.p2?.price??0};if(A.type==="gannfan"){const t=A.primitive,i=[{ratio:.125,label:"0.13",color:"#a06b00",width:1},{ratio:.25,label:"0.25",color:"#699e00",width:1},{ratio:.333333,label:"0.30",color:"#009b00",width:1},{ratio:.5,label:"0.50",color:"#009965",width:1},{ratio:1,label:"1.00",color:"#808080",width:1},{ratio:2,label:"2.00",color:"#006599",width:1},{ratio:3,label:"3.00",color:"#000099",width:1},{ratio:4,label:"4.00",color:"#660099",width:1},{ratio:8,label:"8.00",color:"#a50000",width:1}],r=A.rays??(t?._rays?t._rays.map(n=>({...n})):i);return{...e,rays:r,showLabels:t?t.showLabels??!0:A.showLabels??!0,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="ganngrid"){const t=A.primitive;return{...e,divisions:t?.divisions??A.divisions??8,lineColor:t?.lineColor??A.lineColor??"#94a3b8",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#3b82f6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.08,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}}if(A.type==="triangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0,point3Time:A.p3?.rawTime??0,point3Price:A.p3?.price??0}}if(A.type==="circle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="ellipse"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#b4a7d6",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point2Price:A.p2?.price??0}}if(A.type==="rectangle"){const t=A.primitive;return{...e,strokeColor:t?.strokeColor??A.strokeColor??"#7aa6ae",lineWidth:t?.lineWidth??A.lineWidth??1,showBackground:t?t.showBackground!==!1:A.showBackground!==!1,backgroundColor:t?.backgroundColor??A.backgroundColor??"#94a3b8",backgroundOpacity:t?.backgroundOpacity??A.backgroundOpacity??.18,extendLeft:t?.extendLeft??A.extendLeft??!1,extendRight:t?.extendRight??A.extendRight??!1,point1Time:A.p1?.rawTime??0,point1Price:A.p1?.price??0,point2Time:A.p2?.rawTime??0,point4Price:A.p2?.price??0}}return A.type==="andrewspitchfork"?{...e,medianColor:A.medianColor??"#a50000",medianWidth:A.medianWidth??1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,levels:A.levels??[{k:.25,label:"0.25",color:"#a06b00",width:1,enabled:!0},{k:.38,label:"0.38",color:"#699e00",width:1,enabled:!0},{k:.5,label:"0.50",color:"#009b00",width:1,enabled:!0},{k:.62,label:"0.62",color:"#009965",width:1,enabled:!0},{k:.75,label:"0.75",color:"#006599",width:1,enabled:!0},{k:1,label:"1.00",color:"#000099",width:1,enabled:!0},{k:1.5,label:"1.50",color:"#660099",width:1,enabled:!0},{k:1.75,label:"1.75",color:"#990066",width:1,enabled:!0},{k:2,label:"2.00",color:"#a50000",width:1,enabled:!0}],point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point3Time:A.p3?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="equidistantchannel"?{...e,strokeColor:A.strokeColor??"#8b5cf6",lineWidth:A.lineWidth??1,showMiddleLine:A.showMiddleLine??!1,middleLineColor:A.middleLineColor??"#8b5cf6",middleLineOpacity:A.middleLineOpacity??.5,middleLineWidth:A.middleLineWidth??1,showBackground:A.showBackground!==!1,backgroundColor:A.backgroundColor??"#b4a7d6",backgroundOpacity:A.backgroundOpacity??.1,rayLeft:A.rayLeft??!1,rayRight:A.rayRight??!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0,point1Price:A.p1?.price??0,point2Price:A.p2?.price??0,point3Price:A.p3?.price??0}:A.type==="regressionchannel"||A.type==="stddevchannel"?{...e,baseLineColor:A.baseLineColor??"#ff0000",baseLineOpacity:A.baseLineOpacity??.35,baseLineWidth:A.baseLineWidth??1,showBaseLine:A.showBaseLine!==!1,upperLineColor:A.upperLineColor??"#0000ff",upperLineOpacity:A.upperLineOpacity??.35,upperLineWidth:A.upperLineWidth??1,showUpperLine:A.showUpperLine!==!1,lowerLineColor:A.lowerLineColor??"#0000ff",lowerLineOpacity:A.lowerLineOpacity??.35,lowerLineWidth:A.lowerLineWidth??1,showLowerLine:A.showLowerLine!==!1,showBackground:A.showBackground!==!1,backgroundOpacity:A.backgroundOpacity??.1,extendLeft:A.extendLeft??!1,extendRight:A.extendRight??!1,showPearsonsR:A.showPearsonsR!==!1,point1Time:A.p1?.rawTime??0,point2Time:A.p2?.rawTime??0}:A.type==="rulerline"?{...e,lineColor:A.lineColor??"#3b82f6",showArea:A.showArea!==!1,statsColor:A.statsColor??"#5f8f96",statsPosition:A.statsPosition??"right",statsShowAlways:A.statsShowAlways!==!1,statsPriceRange:A.statsPriceRange!==!1,statsBarsRange:A.statsBarsRange!==!1,statsDateRange:A.statsDateRange!==!1,point1Price:A.p1?.price??0,point1Time:A.p1?.rawTime??0,point2Price:A.p2?.price??0,point2Time:A.p2?.rawTime??0}:e}const pu=({isOpen:A,onClose:e,chartObject:t,onUpdate:i})=>{const{theme:r}=$t(),s=Pw(r==="light"),[o,l]=Y.useState("style"),[c,h]=Y.useState({}),[m,v]=Y.useState(null),x=Y.useRef(null),F=Y.useRef(null);Y.useEffect(()=>{t&&(h(mB(t)),l("style"))},[t]),Y.useEffect(()=>{A||v(null)},[A]);const T=H=>{if(H.button!==0)return;H.preventDefault();const z=x.current;if(!z)return;const re=z.offsetParent,q=re?re.getBoundingClientRect():{left:0,top:0},ie=z.getBoundingClientRect(),G=ie.left-q.left,ne=ie.top-q.top;F.current={startMX:H.clientX,startMY:H.clientY,startX:G,startY:ne},v({x:G,y:ne});const le=we=>{const{startMX:j,startMY:ge,startX:ae,startY:pe}=F.current;v({x:ae+we.clientX-j,y:pe+we.clientY-ge})},ee=()=>{F.current=null,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",ee)};document.addEventListener("mousemove",le),document.addEventListener("mouseup",ee)};if(!A||!t)return null;const S=Hw[t.type]||t.type,I=["style","coordinates","visualization"],Q=()=>{if(o==="visualization")return a.jsx(Ww,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Jw,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannline"){if(o==="style")return a.jsx(Rw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Zw,{draft:c,setDraft:h,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(cu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(Yw,{draft:c,setDraft:h,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(jw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xw,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($w,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Rn,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(tB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(AB,{draft:c,setDraft:h,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(eB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(hu,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(uu,{draft:c,setDraft:h,tokens:s})}if(t.type==="gannfan"){if(o==="style")return a.jsx(oB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ganngrid"){if(o==="style")return a.jsx(aB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="triangle"){if(o==="style")return a.jsx(uB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(dB,{draft:c,setDraft:h,tokens:s})}if(t.type==="circle"){if(o==="style")return a.jsx(hB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="ellipse"){if(o==="style")return a.jsx(pB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(xA,{draft:c,setDraft:h,tokens:s})}if(t.type==="rectangle"){if(o==="style")return a.jsx(fB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(gB,{draft:c,tokens:s})}if(t.type==="andrewspitchfork"){if(o==="style")return a.jsx(lB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(cB,{draft:c,setDraft:h,tokens:s})}if(t.type==="equidistantchannel"){if(o==="style")return a.jsx(nB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(sB,{draft:c,setDraft:h,tokens:s})}if(t.type==="regressionchannel"||t.type==="stddevchannel"){if(o==="style")return a.jsx(iB,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return a.jsx(rB,{draft:c,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},N=()=>{i(c),e()};return a.jsxs("div",{ref:x,style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",...m===null?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:m.y,left:m.x,transform:"none"},width:450,maxWidth:"calc(100vw - 24px)",maxHeight:"calc(100vh - 24px)",background:s.background,border:`1px solid ${s.border}`,borderTop:`2px solid ${s.headerBlue}`,boxShadow:"0 18px 40px rgba(0, 0, 0, 0.45)"},children:[a.jsxs("div",{style:{display:"flex",flexShrink:0},children:[a.jsx("div",{onMouseDown:T,style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText,cursor:"grab"},children:a.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:S}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(ha,{size:"18px",children:a.jsx(Dw,{})})})]})}),a.jsx("button",{type:"button",onClick:e,title:"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",background:s.headerBlue,color:s.headerText,border:"none",cursor:"pointer"},children:a.jsx(ha,{size:"20px",children:a.jsx(_w,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:I.map(H=>{const z=o===H;return a.jsxs("button",{type:"button",onClick:()=>l(H),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:z?s.text:s.mutedText,cursor:"pointer"},children:[H.charAt(0).toUpperCase()+H.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},H)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:Q()}),a.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[a.jsx("button",{type:"button",onClick:N,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,border:"none",cursor:"pointer",background:s.greenHover,color:"#ffffff",boxShadow:`inset 0 0 0 1px ${s.greenActive}`},children:"Update"}),a.jsx("button",{type:"button",onClick:e,style:{display:"inline-flex",height:36,alignItems:"center",justifyContent:"center",padding:"0 12px",fontSize:12,cursor:"pointer",border:`1px solid ${s.green}`,background:"transparent",color:s.green},children:"Cancel"})]})]})};var pa=function(A,e){return pa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])},pa(A,e)};function IA(A,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");pa(A,e);function t(){this.constructor=A}A.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var da=function(){return da=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},da.apply(this,arguments)};function sA(A,e,t,i){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(i.next(h))}catch(m){s(m)}}function l(h){try{c(i.throw(h))}catch(m){s(m)}}function c(h){h.done?n(h.value):r(h.value).then(o,l)}c((i=i.apply(A,[])).next())})}function tA(A,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,r,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(c){return function(h){return l([c,h])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(n=c[0]&2?r.return:c[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,c[1])).done)return n;switch(r=0,n&&(c=[c[0]&2,n.value]),c[0]){case 0:case 1:n=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!n||c[1]>n[0]&&c[1]<n[3])){t.label=c[1];break}if(c[0]===6&&t.label<n[1]){t.label=n[1],n=c;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(c);break}n[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(A,t)}catch(h){c=[6,h],r=0}finally{i=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $n(A,e,t){if(arguments.length===2)for(var i=0,r=e.length,n;i<r;i++)(n||!(i in e))&&(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return A.concat(n||e)}for(var ti=(function(){function A(e,t,i,r){this.left=e,this.top=t,this.width=i,this.height=r}return A.prototype.add=function(e,t,i,r){return new A(this.left+e,this.top+t,this.width+i,this.height+r)},A.fromClientRect=function(e,t){return new A(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},A.fromDOMRectList=function(e,t){var i=Array.from(t).find(function(r){return r.width!==0});return i?new A(i.left+e.windowBounds.left,i.top+e.windowBounds.top,i.width,i.height):A.EMPTY},A.EMPTY=new A(0,0,0,0),A})(),Xn=function(A,e){return ti.fromClientRect(A,e.getBoundingClientRect())},wB=function(A){var e=A.body,t=A.documentElement;if(!e||!t)throw new Error("Unable to get document size");var i=Math.max(Math.max(e.scrollWidth,t.scrollWidth),Math.max(e.offsetWidth,t.offsetWidth),Math.max(e.clientWidth,t.clientWidth)),r=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new ti(0,0,i,r)},Jn=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},It=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},du="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<du.length;Zn++)BB[du.charCodeAt(Zn)]=Zn;for(var fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),Yn=0;Yn<fu.length;Yn++)Ur[fu.charCodeAt(Yn)]=Yn;for(var yB=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Ur[A.charCodeAt(i)],s=Ur[A.charCodeAt(i+1)],o=Ur[A.charCodeAt(i+2)],l=Ur[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},CB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},vB=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Mi=5,fa=11,ga=2,TB=fa-Mi,gu=65536>>Mi,bB=1<<Mi,ma=bB-1,xB=1024>>Mi,QB=gu+xB,FB=QB,UB=32,SB=FB+UB,EB=65536>>fa,LB=1<<TB,MB=LB-1,mu=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},HB=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},IB=function(A,e){var t=yB(A),i=Array.isArray(t)?vB(t):new Uint32Array(t),r=Array.isArray(t)?CB(t):new Uint16Array(t),n=24,s=mu(r,n/2,i[4]/2),o=i[5]===2?mu(r,(n+i[4])/2):HB(i,Math.ceil((n+i[4])/4));return new PB(i[0],i[1],i[2],i[3],s,o)},PB=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[gu+(e-55296>>Mi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=SB-EB+(e>>fa),t=this.index[t],t+=e>>Mi&MB,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),wu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",DB=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<wu.length;qn++)DB[wu.charCodeAt(qn)]=qn;var _B="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==",Bu=50,kB=1,yu=2,Cu=3,OB=4,NB=5,vu=7,Tu=8,bu=9,pi=10,wa=11,xu=12,Ba=13,KB=14,Sr=15,ya=16,jn=17,Er=18,zB=19,Qu=20,Ca=21,Lr=22,va=23,$i=24,CA=25,Mr=26,Hr=27,Xi=28,VB=29,Hi=30,WB=31,es=32,ts=33,Ta=34,ba=35,xa=36,Ir=37,Qa=38,As=39,is=40,Fa=41,Fu=42,GB=43,RB=[9001,65288],Uu="!",lt="×",rs="÷",Ua=IB(_B),Ai=[Hi,xa],Sa=[kB,yu,Cu,NB],Su=[pi,Tu],Eu=[Hr,Mr],$B=Sa.concat(Su),Lu=[Qa,As,is,Ta,ba],XB=[Sr,Ba],JB=function(A,e){e===void 0&&(e="strict");var t=[],i=[],r=[];return A.forEach(function(n,s){var o=Ua.get(n);if(o>Bu?(r.push(!0),o-=Bu):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return i.push(s),t.push(ya);if(o===OB||o===wa){if(s===0)return i.push(s),t.push(Hi);var l=t[s-1];return $B.indexOf(l)===-1?(i.push(i[s-1]),t.push(l)):(i.push(s),t.push(Hi))}if(i.push(s),o===WB)return t.push(e==="strict"?Ca:Ir);if(o===Fu||o===VB)return t.push(Hi);if(o===GB)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Ir):t.push(Hi);t.push(o)}),[i,t,r]},Ea=function(A,e,t,i){var r=i[t];if(Array.isArray(A)?A.indexOf(r)!==-1:A===r)for(var n=t;n<=i.length;){n++;var s=i[n];if(s===e)return!0;if(s!==pi)break}if(r===pi)for(var n=t;n>0;){n--;var o=i[n];if(Array.isArray(A)?A.indexOf(o)!==-1:A===o)for(var l=t;l<=i.length;){l++;var s=i[l];if(s===e)return!0;if(s!==pi)break}if(o!==pi)break}return!1},Mu=function(A,e){for(var t=A;t>=0;){var i=e[t];if(i===pi)t--;else return i}return 0},ZB=function(A,e,t,i,r){if(t[i]===0)return lt;var n=i-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,h=e[o];if(l===yu&&h===Cu)return lt;if(Sa.indexOf(l)!==-1)return Uu;if(Sa.indexOf(h)!==-1||Su.indexOf(h)!==-1)return lt;if(Mu(n,e)===Tu)return rs;if(Ua.get(A[n])===wa||(l===es||l===ts)&&Ua.get(A[o])===wa||l===vu||h===vu||l===bu||[pi,Ba,Sr].indexOf(l)===-1&&h===bu||[jn,Er,zB,$i,Xi].indexOf(h)!==-1||Mu(n,e)===Lr||Ea(va,Lr,n,e)||Ea([jn,Er],Ca,n,e)||Ea(xu,xu,n,e))return lt;if(l===pi)return rs;if(l===va||h===va)return lt;if(h===ya||l===ya)return rs;if([Ba,Sr,Ca].indexOf(h)!==-1||l===KB||c===xa&&XB.indexOf(l)!==-1||l===Xi&&h===xa||h===Qu||Ai.indexOf(h)!==-1&&l===CA||Ai.indexOf(l)!==-1&&h===CA||l===Hr&&[Ir,es,ts].indexOf(h)!==-1||[Ir,es,ts].indexOf(l)!==-1&&h===Mr||Ai.indexOf(l)!==-1&&Eu.indexOf(h)!==-1||Eu.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||[Hr,Mr].indexOf(l)!==-1&&(h===CA||[Lr,Sr].indexOf(h)!==-1&&e[o+1]===CA)||[Lr,Sr].indexOf(l)!==-1&&h===CA||l===CA&&[CA,Xi,$i].indexOf(h)!==-1)return lt;if([CA,Xi,$i,jn,Er].indexOf(h)!==-1)for(var m=n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if([Hr,Mr].indexOf(h)!==-1)for(var m=[jn,Er].indexOf(l)!==-1?s:n;m>=0;){var v=e[m];if(v===CA)return lt;if([Xi,$i].indexOf(v)!==-1)m--;else break}if(Qa===l&&[Qa,As,Ta,ba].indexOf(h)!==-1||[As,Ta].indexOf(l)!==-1&&[As,is].indexOf(h)!==-1||[is,ba].indexOf(l)!==-1&&h===is||Lu.indexOf(l)!==-1&&[Qu,Mr].indexOf(h)!==-1||Lu.indexOf(h)!==-1&&l===Hr||Ai.indexOf(l)!==-1&&Ai.indexOf(h)!==-1||l===$i&&Ai.indexOf(h)!==-1||Ai.concat(CA).indexOf(l)!==-1&&h===Lr&&RB.indexOf(A[o])===-1||Ai.concat(CA).indexOf(h)!==-1&&l===Er)return lt;if(l===Fa&&h===Fa){for(var x=t[n],F=1;x>0&&(x--,e[x]===Fa);)F++;if(F%2!==0)return lt}return l===es&&h===ts?lt:rs},YB=function(A,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=JB(A,e.lineBreak),i=t[0],r=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(r=r.map(function(o){return[CA,Hi,Fu].indexOf(o)!==-1?Ir:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,l){return o&&A[l]>=19968&&A[l]<=40959}):void 0;return[i,r,s]},qB=(function(){function A(e,t,i,r){this.codePoints=e,this.required=t===Uu,this.start=i,this.end=r}return A.prototype.slice=function(){return It.apply(void 0,this.codePoints.slice(this.start,this.end))},A})(),jB=function(A,e){var t=Jn(A),i=YB(t,e),r=i[0],n=i[1],s=i[2],o=t.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=lt;c<o&&(h=ZB(t,n,r,++c,s))===lt;);if(h!==lt||c===o){var m=new qB(t,h,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},e2=1,t2=2,Pr=4,Hu=8,ns=10,Iu=47,Dr=92,A2=9,i2=32,ss=34,_r=61,r2=35,n2=36,s2=37,os=39,as=40,kr=41,o2=95,fA=45,a2=33,l2=60,c2=62,h2=64,u2=91,p2=93,d2=61,f2=123,ls=63,g2=125,Pu=124,m2=126,w2=128,Du=65533,La=42,Ii=43,B2=44,y2=58,C2=59,Or=46,v2=0,T2=8,b2=11,x2=14,Q2=31,F2=127,GA=-1,_u=48,ku=97,Ou=101,U2=102,S2=117,E2=122,Nu=65,Ku=69,zu=70,L2=85,M2=90,AA=function(A){return A>=_u&&A<=57},H2=function(A){return A>=55296&&A<=57343},Ji=function(A){return AA(A)||A>=Nu&&A<=zu||A>=ku&&A<=U2},I2=function(A){return A>=ku&&A<=E2},P2=function(A){return A>=Nu&&A<=M2},D2=function(A){return I2(A)||P2(A)},_2=function(A){return A>=w2},cs=function(A){return A===ns||A===A2||A===i2},hs=function(A){return D2(A)||_2(A)||A===o2},Vu=function(A){return hs(A)||AA(A)||A===fA},k2=function(A){return A>=v2&&A<=T2||A===b2||A>=x2&&A<=Q2||A===F2},di=function(A,e){return A!==Dr?!1:e!==ns},us=function(A,e,t){return A===fA?hs(e)||di(e,t):hs(A)?!0:!!(A===Dr&&di(A,e))},Ma=function(A,e,t){return A===Ii||A===fA?AA(e)?!0:e===Or&&AA(t):AA(A===Or?e:A)},O2=function(A){var e=0,t=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(t=-1),e++);for(var i=[];AA(A[e]);)i.push(A[e++]);var r=i.length?parseInt(It.apply(void 0,i),10):0;A[e]===Or&&e++;for(var n=[];AA(A[e]);)n.push(A[e++]);var s=n.length,o=s?parseInt(It.apply(void 0,n),10):0;(A[e]===Ku||A[e]===Ou)&&e++;var l=1;(A[e]===Ii||A[e]===fA)&&(A[e]===fA&&(l=-1),e++);for(var c=[];AA(A[e]);)c.push(A[e++]);var h=c.length?parseInt(It.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*h)},N2={type:2},K2={type:3},z2={type:4},V2={type:13},W2={type:8},G2={type:21},R2={type:9},$2={type:10},X2={type:11},J2={type:12},Z2={type:14},ps={type:23},Y2={type:1},q2={type:25},j2={type:24},ey={type:26},ty={type:27},Ay={type:28},iy={type:29},ry={type:31},Ha={type:32},Wu=(function(){function A(){this._value=[]}return A.prototype.write=function(e){this._value=this._value.concat(Jn(e))},A.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ha;)e.push(t),t=this.consumeToken();return e},A.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ss:return this.consumeStringToken(ss);case r2:var t=this.peekCodePoint(0),i=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Vu(t)||di(i,r)){var n=us(t,i,r)?t2:e2,s=this.consumeName();return{type:5,value:s,flags:n}}break;case n2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),V2;break;case os:return this.consumeStringToken(os);case as:return N2;case kr:return K2;case La:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),Z2;break;case Ii:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case B2:return z2;case fA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Ma(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(us(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===fA&&c===c2)return this.consumeCodePoint(),this.consumeCodePoint(),j2;break;case Or:if(Ma(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Iu:if(this.peekCodePoint(0)===La)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===La&&(h=this.consumeCodePoint(),h===Iu))return this.consumeToken();if(h===GA)return this.consumeToken()}break;case y2:return ey;case C2:return ty;case l2:if(this.peekCodePoint(0)===a2&&this.peekCodePoint(1)===fA&&this.peekCodePoint(2)===fA)return this.consumeCodePoint(),this.consumeCodePoint(),q2;break;case h2:var m=this.peekCodePoint(0),v=this.peekCodePoint(1),x=this.peekCodePoint(2);if(us(m,v,x)){var s=this.consumeName();return{type:7,value:s}}break;case u2:return Ay;case Dr:if(di(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case p2:return iy;case d2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),W2;break;case f2:return X2;case g2:return J2;case S2:case L2:var F=this.peekCodePoint(0),T=this.peekCodePoint(1);return F===Ii&&(Ji(T)||T===ls)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),R2;if(this.peekCodePoint(0)===Pu)return this.consumeCodePoint(),G2;break;case m2:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),$2;break;case GA:return Ha}return cs(e)?(this.consumeWhiteSpace(),ry):AA(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):hs(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:It(e)}},A.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},A.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},A.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},A.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ji(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var i=!1;t===ls&&e.length<6;)e.push(t),t=this.consumeCodePoint(),i=!0;if(i){var r=parseInt(It.apply(void 0,e.map(function(l){return l===ls?_u:l})),16),n=parseInt(It.apply(void 0,e.map(function(l){return l===ls?zu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(It.apply(void 0,e),16);if(this.peekCodePoint(0)===fA&&Ji(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Ji(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(It.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},A.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===as?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===as?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},A.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===os||t===ss){var i=this.consumeStringToken(this.consumeCodePoint());return i.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr)?(this.consumeCodePoint(),{type:22,value:i.value}):(this.consumeBadUrlRemnants(),ps)}for(;;){var r=this.consumeCodePoint();if(r===GA||r===kr)return{type:22,value:It.apply(void 0,e)};if(cs(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===GA||this.peekCodePoint(0)===kr?(this.consumeCodePoint(),{type:22,value:It.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ps);if(r===ss||r===os||r===as||k2(r))return this.consumeBadUrlRemnants(),ps;if(r===Dr)if(di(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ps;else e.push(r)}},A.prototype.consumeWhiteSpace=function(){for(;cs(this.peekCodePoint(0));)this.consumeCodePoint()},A.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===kr||e===GA)return;di(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},A.prototype.consumeStringSlice=function(e){for(var t=5e4,i="";e>0;){var r=Math.min(t,e);i+=It.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),i},A.prototype.consumeStringToken=function(e){var t="",i=0;do{var r=this._value[i];if(r===GA||r===void 0||r===e)return t+=this.consumeStringSlice(i),{type:0,value:t};if(r===ns)return this._value.splice(0,i),Y2;if(r===Dr){var n=this._value[i+1];n!==GA&&n!==void 0&&(n===ns?(t+=this.consumeStringSlice(i),i=-1,this._value.shift()):di(r,n)&&(t+=this.consumeStringSlice(i),t+=It(this.consumeEscapedCodePoint()),i=-1))}i++}while(!0)},A.prototype.consumeNumber=function(){var e=[],t=Pr,i=this.peekCodePoint(0);for((i===Ii||i===fA)&&e.push(this.consumeCodePoint());AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(i===Or&&AA(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());i=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((i===Ku||i===Ou)&&((r===Ii||r===fA)&&AA(n)||AA(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Hu;AA(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[O2(e),t]},A.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],i=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(us(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:i,unit:o}}return r===s2?(this.consumeCodePoint(),{type:16,number:t,flags:i}):{type:17,number:t,flags:i}},A.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ji(e)){for(var t=It(e);Ji(this.peekCodePoint(0))&&t.length<6;)t+=It(this.consumeCodePoint());cs(this.peekCodePoint(0))&&this.consumeCodePoint();var i=parseInt(t,16);return i===0||H2(i)||i>1114111?Du:i}return e===GA?Du:e},A.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Vu(t))e+=It(t);else if(di(t,this.peekCodePoint(0)))e+=It(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},A})(),Gu=(function(){function A(e){this._tokens=e}return A.create=function(e){var t=new Wu;return t.write(e),new A(t.read())},A.parseValue=function(e){return A.create(e).parseComponentValue()},A.parseValues=function(e){return A.create(e).parseComponentValues()},A.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 t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},A.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},A.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},A.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},i=this.consumeToken();;){if(i.type===32||sy(i,e))return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue()),i=this.consumeToken()}},A.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var i=this.consumeToken();if(i.type===32||i.type===3)return t;this.reconsumeToken(i),t.values.push(this.consumeComponentValue())}},A.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Ha:e},A.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},A})(),Nr=function(A){return A.type===15},Zi=function(A){return A.type===17},yt=function(A){return A.type===20},ny=function(A){return A.type===0},Ia=function(A,e){return yt(A)&&A.value===e},Ru=function(A){return A.type!==31},Yi=function(A){return A.type!==31&&A.type!==4},RA=function(A){var e=[],t=[];return A.forEach(function(i){if(i.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}i.type!==31&&t.push(i)}),t.length&&e.push(t),e},sy=function(A,e){return e===11&&A.type===12||e===28&&A.type===29?!0:e===2&&A.type===3},fi=function(A){return A.type===17||A.type===15},Ot=function(A){return A.type===16||fi(A)},$u=function(A){return A.length>1?[A[0],A[1]]:[A[0]]},Xt={type:17,number:0,flags:Pr},Pa={type:16,number:50,flags:Pr},gi={type:16,number:100,flags:Pr},Kr=function(A,e,t){var i=A[0],r=A[1];return[xt(i,e),xt(typeof r<"u"?r:i,t)]},xt=function(A,e){if(A.type===16)return A.number/100*e;if(Nr(A))switch(A.unit){case"rem":case"em":return 16*A.number;default:return A.number}return A.number},Xu="deg",Ju="grad",Zu="rad",Yu="turn",ds={name:"angle",parse:function(A,e){if(e.type===15)switch(e.unit){case Xu:return Math.PI*e.number/180;case Ju:return Math.PI/200*e.number;case Zu:return e.number;case Yu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},qu=function(A){return A.type===15&&(A.unit===Xu||A.unit===Ju||A.unit===Zu||A.unit===Yu)},ju=function(A){var e=A.filter(yt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Xt,Xt];case"to top":case"bottom":return QA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Xt,gi];case"to right":case"left":return QA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[gi,gi];case"to bottom":case"top":return QA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[gi,Xt];case"to left":case"right":return QA(270)}return 0},QA=function(A){return Math.PI*A/180},mi={name:"color",parse:function(A,e){if(e.type===18){var t=oy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(A,e.values)}if(e.type===5){if(e.value.length===3){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),1)}if(e.value.length===4){var i=e.value.substring(0,1),r=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return Bi(parseInt(i+i,16),parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),1)}if(e.value.length===8){var i=e.value.substring(0,2),r=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return Bi(parseInt(i,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ii[e.value.toUpperCase()];if(typeof o<"u")return o}return ii.TRANSPARENT}},wi=function(A){return(255&A)===0},Gt=function(A){var e=255&A,t=255&A>>8,i=255&A>>16,r=255&A>>24;return e<255?"rgba("+r+","+i+","+t+","+e/255+")":"rgb("+r+","+i+","+t+")"},Bi=function(A,e,t,i){return(A<<24|e<<16|t<<8|Math.round(i*255)<<0)>>>0},ep=function(A,e){if(A.type===17)return A.number;if(A.type===16){var t=e===3?1:255;return e===3?A.number/100*t:Math.round(A.number/100*t)}return 0},tp=function(A,e){var t=e.filter(Yi);if(t.length===3){var i=t.map(ep),r=i[0],n=i[1],s=i[2];return Bi(r,n,s,1)}if(t.length===4){var o=t.map(ep),r=o[0],n=o[1],s=o[2],l=o[3];return Bi(r,n,s,l)}return 0};function Da(A,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-A)*t*6+A:t<1/2?e:t<2/3?(e-A)*6*(2/3-t)+A:A}var Ap=function(A,e){var t=e.filter(Yi),i=t[0],r=t[1],n=t[2],s=t[3],o=(i.type===17?QA(i.number):ds.parse(A,i))/(Math.PI*2),l=Ot(r)?r.number/100:0,c=Ot(n)?n.number/100:0,h=typeof s<"u"&&Ot(s)?xt(s,1):1;if(l===0)return Bi(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,v=c*2-m,x=Da(v,m,o+1/3),F=Da(v,m,o),T=Da(v,m,o-1/3);return Bi(x*255,F*255,T*255,h)},oy={hsl:Ap,hsla:Ap,rgb:tp,rgba:tp},zr=function(A,e){return mi.parse(A,Gu.create(e).parseComponentValue())},ii={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},ay={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ly={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},fs=function(A,e){var t=mi.parse(A,e[0]),i=e[1];return i&&Ot(i)?{color:t,stop:i}:{color:t,stop:null}},ip=function(A,e){var t=A[0],i=A[A.length-1];t.stop===null&&(t.stop=Xt),i.stop===null&&(i.stop=gi);for(var r=[],n=0,s=0;s<A.length;s++){var o=A[s].stop;if(o!==null){var l=xt(o,e);l>n?r.push(l):r.push(n),n=l}else r.push(null)}for(var c=null,s=0;s<r.length;s++){var h=r[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,v=r[c-1],x=(h-v)/(m+1),F=1;F<=m;F++)r[c+F-1]=x*F;c=null}}return A.map(function(T,S){var I=T.color;return{color:I,stop:Math.max(Math.min(1,r[S]/e),0)}})},cy=function(A,e,t){var i=e/2,r=t/2,n=xt(A[0],e)-i,s=r-xt(A[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},hy=function(A,e,t){var i=typeof A=="number"?A:cy(A,e,t),r=Math.abs(e*Math.sin(i))+Math.abs(t*Math.cos(i)),n=e/2,s=t/2,o=r/2,l=Math.sin(i-Math.PI/2)*o,c=Math.cos(i-Math.PI/2)*o;return[r,n-c,n+c,s-l,s+l]},PA=function(A,e){return Math.sqrt(A*A+e*e)},rp=function(A,e,t,i,r){var n=[[0,0],[0,e],[A,0],[A,e]];return n.reduce(function(s,o){var l=o[0],c=o[1],h=PA(t-l,i-c);return(r?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},uy=function(A,e,t,i,r){var n=0,s=0;switch(A.size){case 0:A.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-i)),s=Math.min(Math.abs(t),Math.abs(t-r)));break;case 2:if(A.shape===0)n=s=Math.min(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-r))/Math.min(Math.abs(e),Math.abs(e-i)),l=rp(i,r,e,t,!0),c=l[0],h=l[1];n=PA(c-e,(h-t)/o),s=o*n}break;case 1:A.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-i),Math.abs(t),Math.abs(t-r)):A.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-i)),s=Math.max(Math.abs(t),Math.abs(t-r)));break;case 3:if(A.shape===0)n=s=Math.max(PA(e,t),PA(e,t-r),PA(e-i,t),PA(e-i,t-r));else if(A.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-r))/Math.max(Math.abs(e),Math.abs(e-i)),m=rp(i,r,e,t,!1),c=m[0],h=m[1];n=PA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(A.size)&&(n=xt(A.size[0],i),s=A.size.length===2?xt(A.size[1],r):n),[n,s]},py=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=ju(r);return}else if(qu(s)){t=ds.parse(A,s);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},gs=function(A,e){var t=QA(180),i=[];return RA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=ju(r);return}else if(qu(s)){t=(ds.parse(A,s)+QA(270))%QA(360);return}}var o=fs(A,r);i.push(o)}),{angle:t,stops:i,type:1}},dy=function(A,e){var t=QA(180),i=[],r=1,n=0,s=3,o=[];return RA(e).forEach(function(l,c){var h=l[0];if(c===0){if(yt(h)&&h.value==="linear"){r=1;return}else if(yt(h)&&h.value==="radial"){r=2;return}}if(h.type===18){if(h.name==="from"){var m=mi.parse(A,h.values[0]);i.push({stop:Xt,color:m})}else if(h.name==="to"){var m=mi.parse(A,h.values[0]);i.push({stop:gi,color:m})}else if(h.name==="color-stop"){var v=h.values.filter(Yi);if(v.length===2){var m=mi.parse(A,v[1]),x=v[0];Zi(x)&&i.push({stop:{type:16,number:x.number*100,flags:x.flags},color:m})}}}}),r===1?{angle:(t+QA(180))%QA(360),stops:i,type:r}:{size:s,shape:n,stops:i,position:o,type:r}},np="closest-side",sp="farthest-side",op="closest-corner",ap="farthest-corner",lp="circle",cp="ellipse",hp="cover",up="contain",fy=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,v){if(c)if(yt(v))switch(v.value){case"center":return n.push(Pa),m;case"top":case"left":return n.push(Xt),m;case"right":case"bottom":return n.push(gi),m}else(Ot(v)||fi(v))&&n.push(v);else if(yt(v))switch(v.value){case lp:return t=0,!1;case cp:return t=1,!1;case"at":return c=!0,!1;case np:return i=0,!1;case hp:case sp:return i=1,!1;case up:case op:return i=2,!1;case ap:return i=3,!1}else if(fi(v)||Ot(v))return Array.isArray(i)||(i=[]),i.push(v),!1;return m},l)}if(l){var h=fs(A,s);r.push(h)}}),{size:i,shape:t,stops:r,position:n,type:2}},ms=function(A,e){var t=0,i=3,r=[],n=[];return RA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(h,m){if(yt(m))switch(m.value){case"center":return n.push(Pa),!1;case"top":case"left":return n.push(Xt),!1;case"right":case"bottom":return n.push(gi),!1}else if(Ot(m)||fi(m))return n.push(m),!1;return h},l):o===1&&(l=s.reduce(function(h,m){if(yt(m))switch(m.value){case lp:return t=0,!1;case cp:return t=1,!1;case up:case np:return i=0,!1;case sp:return i=1,!1;case op:return i=2,!1;case hp:case ap:return i=3,!1}else if(fi(m)||Ot(m))return Array.isArray(i)||(i=[]),i.push(m),!1;return h},l)),l){var c=fs(A,s);r.push(c)}}),{size:i,shape:t,stops:r,position:n,type:2}},gy=function(A){return A.type===1},my=function(A){return A.type===2},_a={name:"image",parse:function(A,e){if(e.type===22){var t={url:e.value,type:0};return A.cache.addImage(e.value),t}if(e.type===18){var i=pp[e.name];if(typeof i>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return i(A,e.values)}throw new Error("Unsupported image type "+e.type)}};function wy(A){return!(A.type===20&&A.value==="none")&&(A.type!==18||!!pp[A.name])}var pp={"linear-gradient":py,"-moz-linear-gradient":gs,"-ms-linear-gradient":gs,"-o-linear-gradient":gs,"-webkit-linear-gradient":gs,"radial-gradient":fy,"-moz-radial-gradient":ms,"-ms-radial-gradient":ms,"-o-radial-gradient":ms,"-webkit-radial-gradient":ms,"-webkit-gradient":dy},By={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(i){return Yi(i)&&wy(i)}).map(function(i){return _a.parse(A,i)})}},yy={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(A,e){return e.map(function(t){if(yt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Cy={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(A,e){return RA(e).map(function(t){return t.filter(Ot)}).map($u)}},vy={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(yt).map(function(i){return i.value}).join(" ")}).map(Ty)}},Ty=function(A){switch(A){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}},qi;(function(A){A.AUTO="auto",A.CONTAIN="contain",A.COVER="cover"})(qi||(qi={}));var by={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(A,e){return RA(e).map(function(t){return t.filter(xy)})}},xy=function(A){return yt(A)||Ot(A)},ws=function(A){return{name:"border-"+A+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Qy=ws("top"),Fy=ws("right"),Uy=ws("bottom"),Sy=ws("left"),Bs=function(A){return{name:"border-radius-"+A,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return $u(t.filter(Ot))}}},Ey=Bs("top-left"),Ly=Bs("top-right"),My=Bs("bottom-right"),Hy=Bs("bottom-left"),ys=function(A){return{name:"border-"+A+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Iy=ys("top"),Py=ys("right"),Dy=ys("bottom"),_y=ys("left"),Cs=function(A){return{name:"border-"+A+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},ky=Cs("top"),Oy=Cs("right"),Ny=Cs("bottom"),Ky=Cs("left"),zy={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(A,e){return e==="rtl"?1:0}},Wy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).reduce(function(t,i){return t|Gy(i.value)},0)}},Gy=function(A){switch(A){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},Ry={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$y={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(A,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},vs;(function(A){A.NORMAL="normal",A.STRICT="strict"})(vs||(vs={}));var Xy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="strict"?vs.STRICT:vs.NORMAL}},Jy={name:"line-height",initialValue:"normal",prefix:!1,type:4},dp=function(A,e){return yt(A)&&A.value==="normal"?1.2*e:A.type===17?e*A.number:Ot(A)?xt(A,e):e},Zy={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(A,e){return e.type===20&&e.value==="none"?null:_a.parse(A,e)}},Yy={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(A,e){return e==="inside"?0:1}},ka={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(A,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}}},Ts=function(A){return{name:"margin-"+A,initialValue:"0",prefix:!1,type:4}},qy=Ts("top"),jy=Ts("right"),eC=Ts("bottom"),tC=Ts("left"),AC={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},iC={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){return e==="break-word"?"break-word":"normal"}},bs=function(A){return{name:"padding-"+A,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},rC=bs("top"),nC=bs("right"),sC=bs("bottom"),oC=bs("left"),aC={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(A,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},lC={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(A,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},cC={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:ii.TRANSPARENT,offsetX:Xt,offsetY:Xt,blur:Xt},r=0,n=0;n<t.length;n++){var s=t[n];fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:i.blur=s,r++):i.color=mi.parse(A,s)}return i})}},hC={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},uC={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(A,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=fC[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},pC=function(A){var e=A.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dC=function(A){var e=A.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],i=e[1];e[2],e[3];var r=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?[t,i,r,n,s,o]:null},fC={matrix:pC,matrix3d:dC},fp={type:16,number:50,flags:Pr},gC=[fp,fp],mC={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(A,e){var t=e.filter(Ot);return t.length!==2?gC:[t[0],t[1]]}},wC={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(A,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},Vr;(function(A){A.NORMAL="normal",A.BREAK_ALL="break-all",A.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var BC={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},yC={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(A,e){if(e.type===20)return{auto:!0,order:0};if(Zi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},gp={name:"time",parse:function(A,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")}},CC={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:1}},vC={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},TC={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(A,e){return e.filter(yt).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},bC={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(A,e){var t=[],i=[];return e.forEach(function(r){switch(r.type){case 20:case 0:t.push(r.value);break;case 17:t.push(r.number.toString());break;case 4:i.push(t.join(" ")),t.length=0;break}}),t.length&&i.push(t.join(" ")),i.map(function(r){return r.indexOf(" ")===-1?r:"'"+r+"'"})}},xC={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},QC={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(A,e){return Zi(e)?e.number:yt(e)&&e.value==="bold"?700:400}},FC={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.filter(yt).map(function(t){return t.value})}},UC={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(A,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Kt=function(A,e){return(A&e)!==0},SC={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(A,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},EC={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var i=[],r=e.filter(Ru),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Zi(o)?o.number:1;i.push({counter:s.value,increment:l})}}return i}},LC={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return[];for(var t=[],i=e.filter(Ru),r=0;r<i.length;r++){var n=i[r],s=i[r+1];if(yt(n)&&n.value!=="none"){var o=s&&Zi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},MC={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(A,e){return e.filter(Nr).map(function(t){return gp.parse(A,t)})}},HC={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(A,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var i=[],r=e.filter(ny);if(r.length%2!==0)return null;for(var n=0;n<r.length;n+=2){var s=r[n].value,o=r[n+1].value;i.push({open:s,close:o})}return i}},mp=function(A,e,t){if(!A)return"";var i=A[Math.min(e,A.length-1)];return i?t?i.open:i.close:""},IC={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(A,e){return e.length===1&&Ia(e[0],"none")?[]:RA(e).map(function(t){for(var i={color:255,offsetX:Xt,offsetY:Xt,blur:Xt,spread:Xt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];Ia(s,"inset")?i.inset=!0:fi(s)?(r===0?i.offsetX=s:r===1?i.offsetY=s:r===2?i.blur=s:i.spread=s,r++):i.color=mi.parse(A,s)}return i})}},PC={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(A,e){var t=[0,1,2],i=[];return e.filter(yt).forEach(function(r){switch(r.value){case"stroke":i.push(1);break;case"fill":i.push(0);break;case"markers":i.push(2);break}}),t.forEach(function(r){i.indexOf(r)===-1&&i.push(r)}),i}},DC={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_C={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(A,e){return Nr(e)?e.number:0}},kC=(function(){function A(e,t){var i,r;this.animationDuration=Oe(e,MC,t.animationDuration),this.backgroundClip=Oe(e,ay,t.backgroundClip),this.backgroundColor=Oe(e,ly,t.backgroundColor),this.backgroundImage=Oe(e,By,t.backgroundImage),this.backgroundOrigin=Oe(e,yy,t.backgroundOrigin),this.backgroundPosition=Oe(e,Cy,t.backgroundPosition),this.backgroundRepeat=Oe(e,vy,t.backgroundRepeat),this.backgroundSize=Oe(e,by,t.backgroundSize),this.borderTopColor=Oe(e,Qy,t.borderTopColor),this.borderRightColor=Oe(e,Fy,t.borderRightColor),this.borderBottomColor=Oe(e,Uy,t.borderBottomColor),this.borderLeftColor=Oe(e,Sy,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,Ey,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,Ly,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,My,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,Hy,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,Iy,t.borderTopStyle),this.borderRightStyle=Oe(e,Py,t.borderRightStyle),this.borderBottomStyle=Oe(e,Dy,t.borderBottomStyle),this.borderLeftStyle=Oe(e,_y,t.borderLeftStyle),this.borderTopWidth=Oe(e,ky,t.borderTopWidth),this.borderRightWidth=Oe(e,Oy,t.borderRightWidth),this.borderBottomWidth=Oe(e,Ny,t.borderBottomWidth),this.borderLeftWidth=Oe(e,Ky,t.borderLeftWidth),this.boxShadow=Oe(e,IC,t.boxShadow),this.color=Oe(e,zy,t.color),this.direction=Oe(e,Vy,t.direction),this.display=Oe(e,Wy,t.display),this.float=Oe(e,Ry,t.cssFloat),this.fontFamily=Oe(e,bC,t.fontFamily),this.fontSize=Oe(e,xC,t.fontSize),this.fontStyle=Oe(e,UC,t.fontStyle),this.fontVariant=Oe(e,FC,t.fontVariant),this.fontWeight=Oe(e,QC,t.fontWeight),this.letterSpacing=Oe(e,$y,t.letterSpacing),this.lineBreak=Oe(e,Xy,t.lineBreak),this.lineHeight=Oe(e,Jy,t.lineHeight),this.listStyleImage=Oe(e,Zy,t.listStyleImage),this.listStylePosition=Oe(e,Yy,t.listStylePosition),this.listStyleType=Oe(e,ka,t.listStyleType),this.marginTop=Oe(e,qy,t.marginTop),this.marginRight=Oe(e,jy,t.marginRight),this.marginBottom=Oe(e,eC,t.marginBottom),this.marginLeft=Oe(e,tC,t.marginLeft),this.opacity=Oe(e,CC,t.opacity);var n=Oe(e,AC,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,iC,t.overflowWrap),this.paddingTop=Oe(e,rC,t.paddingTop),this.paddingRight=Oe(e,nC,t.paddingRight),this.paddingBottom=Oe(e,sC,t.paddingBottom),this.paddingLeft=Oe(e,oC,t.paddingLeft),this.paintOrder=Oe(e,PC,t.paintOrder),this.position=Oe(e,lC,t.position),this.textAlign=Oe(e,aC,t.textAlign),this.textDecorationColor=Oe(e,vC,(i=t.textDecorationColor)!==null&&i!==void 0?i:t.color),this.textDecorationLine=Oe(e,TC,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,cC,t.textShadow),this.textTransform=Oe(e,hC,t.textTransform),this.transform=Oe(e,uC,t.transform),this.transformOrigin=Oe(e,mC,t.transformOrigin),this.visibility=Oe(e,wC,t.visibility),this.webkitTextStrokeColor=Oe(e,DC,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,_C,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,BC,t.wordBreak),this.zIndex=Oe(e,yC,t.zIndex)}return A.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},A.prototype.isTransparent=function(){return wi(this.backgroundColor)},A.prototype.isTransformed=function(){return this.transform!==null},A.prototype.isPositioned=function(){return this.position!==0},A.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},A.prototype.isFloating=function(){return this.float!==0},A.prototype.isInlineLevel=function(){return Kt(this.display,4)||Kt(this.display,33554432)||Kt(this.display,268435456)||Kt(this.display,536870912)||Kt(this.display,67108864)||Kt(this.display,134217728)},A})(),OC=(function(){function A(e,t){this.content=Oe(e,SC,t.content),this.quotes=Oe(e,HC,t.quotes)}return A})(),wp=(function(){function A(e,t){this.counterIncrement=Oe(e,EC,t.counterIncrement),this.counterReset=Oe(e,LC,t.counterReset)}return A})(),Oe=function(A,e,t){var i=new Wu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;i.write(r);var n=new Gu(i.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(A,yt(s)?s.value:e.initialValue);case 0:return e.parse(A,n.parseComponentValue());case 1:return e.parse(A,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return ds.parse(A,n.parseComponentValue());case"color":return mi.parse(A,n.parseComponentValue());case"image":return _a.parse(A,n.parseComponentValue());case"length":var o=n.parseComponentValue();return fi(o)?o:Xt;case"length-percentage":var l=n.parseComponentValue();return Ot(l)?l:Xt;case"time":return gp.parse(A,n.parseComponentValue())}break}},NC="data-html2canvas-debug",KC=function(A){var e=A.getAttribute(NC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Oa=function(A,e){var t=KC(A);return t===1||e===t},$A=(function(){function A(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Oa(t,3))debugger;this.styles=new kC(e,window.getComputedStyle(t,null)),ja(t)&&(this.styles.animationDuration.some(function(i){return i>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Xn(this.context,t),Oa(t,4)&&(this.flags|=16)}return A})(),zC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Bp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wr=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<Bp.length;xs++)Wr[Bp.charCodeAt(xs)]=xs;for(var VC=function(A){var e=A.length*.75,t=A.length,i,r=0,n,s,o,l;A[A.length-1]==="="&&(e--,A[A.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(i=0;i<t;i+=4)n=Wr[A.charCodeAt(i)],s=Wr[A.charCodeAt(i+1)],o=Wr[A.charCodeAt(i+2)],l=Wr[A.charCodeAt(i+3)],h[r++]=n<<2|s>>4,h[r++]=(s&15)<<4|o>>2,h[r++]=(o&3)<<6|l&63;return c},WC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=2)t.push(A[i+1]<<8|A[i]);return t},GC=function(A){for(var e=A.length,t=[],i=0;i<e;i+=4)t.push(A[i+3]<<24|A[i+2]<<16|A[i+1]<<8|A[i]);return t},Pi=5,Na=11,Ka=2,RC=Na-Pi,yp=65536>>Pi,$C=1<<Pi,za=$C-1,XC=1024>>Pi,JC=yp+XC,ZC=JC,YC=32,qC=ZC+YC,jC=65536>>Na,ev=1<<RC,tv=ev-1,Cp=function(A,e,t){return A.slice?A.slice(e,t):new Uint16Array(Array.prototype.slice.call(A,e,t))},Av=function(A,e,t){return A.slice?A.slice(e,t):new Uint32Array(Array.prototype.slice.call(A,e,t))},iv=function(A,e){var t=VC(A),i=Array.isArray(t)?GC(t):new Uint32Array(t),r=Array.isArray(t)?WC(t):new Uint16Array(t),n=24,s=Cp(r,n/2,i[4]/2),o=i[5]===2?Cp(r,(n+i[4])/2):Av(i,Math.ceil((n+i[4])/4));return new rv(i[0],i[1],i[2],i[3],s,o)},rv=(function(){function A(e,t,i,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=i,this.highValueIndex=r,this.index=n,this.data=s}return A.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Pi],t=(t<<Ka)+(e&za),this.data[t];if(e<=65535)return t=this.index[yp+(e-55296>>Pi)],t=(t<<Ka)+(e&za),this.data[t];if(e<this.highStart)return t=qC-jC+(e>>Na),t=this.index[t],t+=e>>Pi&tv,t=this.index[t],t=(t<<Ka)+(e&za),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},A})(),vp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nv=typeof Uint8Array>"u"?[]:new Uint8Array(256),Qs=0;Qs<vp.length;Qs++)nv[vp.charCodeAt(Qs)]=Qs;var sv=1,Va=2,Wa=3,Tp=4,bp=5,ov=7,xp=8,Ga=9,Ra=10,Qp=11,Fp=12,Up=13,Sp=14,$a=15,av=function(A){for(var e=[],t=0,i=A.length;t<i;){var r=A.charCodeAt(t++);if(r>=55296&&r<=56319&&t<i){var n=A.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},lv=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,A);var t=A.length;if(!t)return"";for(var i=[],r=-1,n="";++r<t;){var s=A[r];s<=65535?i.push(s):(s-=65536,i.push((s>>10)+55296,s%1024+56320)),(r+1===t||i.length>16384)&&(n+=String.fromCharCode.apply(String,i),i.length=0)}return n},cv=iv(zC),FA="×",Xa="÷",hv=function(A){return cv.get(A)},uv=function(A,e,t){var i=t-2,r=e[i],n=e[t-1],s=e[t];if(n===Va&&s===Wa)return FA;if(n===Va||n===Wa||n===Tp||s===Va||s===Wa||s===Tp)return Xa;if(n===xp&&[xp,Ga,Qp,Fp].indexOf(s)!==-1||(n===Qp||n===Ga)&&(s===Ga||s===Ra)||(n===Fp||n===Ra)&&s===Ra||s===Up||s===bp||s===ov||n===sv)return FA;if(n===Up&&s===Sp){for(;r===bp;)r=e[--i];if(r===Sp)return FA}if(n===$a&&s===$a){for(var o=0;r===$a;)o++,r=e[--i];if(o%2===0)return FA}return Xa},pv=function(A){var e=av(A),t=e.length,i=0,r=0,n=e.map(hv);return{next:function(){if(i>=t)return{done:!0,value:null};for(var s=FA;i<t&&(s=uv(e,n,++i))===FA;);if(s!==FA||i===t){var o=lv.apply(null,e.slice(r,i));return r=i,{value:o,done:!1}}return{done:!0,value:null}}}},dv=function(A){for(var e=pv(A),t=[],i;!(i=e.next()).done;)i.value&&t.push(i.value.slice());return t},fv=function(A){var e=123;if(A.createRange){var t=A.createRange();if(t.getBoundingClientRect){var i=A.createElement("boundtest");i.style.height=e+"px",i.style.display="block",A.body.appendChild(i),t.selectNode(i);var r=t.getBoundingClientRect(),n=Math.round(r.height);if(A.body.removeChild(i),n===e)return!0}}return!1},gv=function(A){var e=A.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",A.body.appendChild(e);var t=A.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var i=e.firstChild,r=Jn(i.data).map(function(l){return It(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(i,n),t.setEnd(i,n+l.length);var h=t.getBoundingClientRect();n+=l.length;var m=h.x>s.x||h.y>s.y;return s=h,c===0?!0:m});return A.body.removeChild(e),o},mv=function(){return typeof new Image().crossOrigin<"u"},wv=function(){return typeof new XMLHttpRequest().responseType=="string"},Bv=function(A){var e=new Image,t=A.createElement("canvas"),i=t.getContext("2d");if(!i)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{i.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},Ep=function(A){return A[0]===0&&A[1]===255&&A[2]===0&&A[3]===255},yv=function(A){var e=A.createElement("canvas"),t=100;e.width=t,e.height=t;var i=e.getContext("2d");if(!i)return Promise.reject(!1);i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,t,t);var r=new Image,n=e.toDataURL();r.src=n;var s=Ja(t,t,0,0,r);return i.fillStyle="red",i.fillRect(0,0,t,t),Lp(s).then(function(o){i.drawImage(o,0,0);var l=i.getImageData(0,0,t,t).data;i.fillStyle="red",i.fillRect(0,0,t,t);var c=A.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",Ep(l)?Lp(Ja(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return i.drawImage(o,0,0),Ep(i.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Ja=function(A,e,t,i,r){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",A.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",i.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(r),s},Lp=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){return e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},Jt={get SUPPORT_RANGE_BOUNDS(){var A=fv(document);return Object.defineProperty(Jt,"SUPPORT_RANGE_BOUNDS",{value:A}),A},get SUPPORT_WORD_BREAKING(){var A=Jt.SUPPORT_RANGE_BOUNDS&&gv(document);return Object.defineProperty(Jt,"SUPPORT_WORD_BREAKING",{value:A}),A},get SUPPORT_SVG_DRAWING(){var A=Bv(document);return Object.defineProperty(Jt,"SUPPORT_SVG_DRAWING",{value:A}),A},get SUPPORT_FOREIGNOBJECT_DRAWING(){var A=typeof Array.from=="function"&&typeof window.fetch=="function"?yv(document):Promise.resolve(!1);return Object.defineProperty(Jt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:A}),A},get SUPPORT_CORS_IMAGES(){var A=mv();return Object.defineProperty(Jt,"SUPPORT_CORS_IMAGES",{value:A}),A},get SUPPORT_RESPONSE_TYPE(){var A=wv();return Object.defineProperty(Jt,"SUPPORT_RESPONSE_TYPE",{value:A}),A},get SUPPORT_CORS_XHR(){var A="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Jt,"SUPPORT_CORS_XHR",{value:A}),A},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var A=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Jt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:A}),A}},Gr=(function(){function A(e,t){this.text=e,this.bounds=t}return A})(),Cv=function(A,e,t,i){var r=bv(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Jt.SUPPORT_RANGE_BOUNDS){var l=Mp(i,s,o.length).getClientRects();if(l.length>1){var c=Za(o),h=0;c.forEach(function(v){n.push(new Gr(v,ti.fromDOMRectList(A,Mp(i,h+s,v.length).getClientRects()))),h+=v.length})}else n.push(new Gr(o,ti.fromDOMRectList(A,l)))}else{var m=i.splitText(o.length);n.push(new Gr(o,vv(A,i))),i=m}else Jt.SUPPORT_RANGE_BOUNDS||(i=i.splitText(o.length));s+=o.length}),n},vv=function(A,e){var t=e.ownerDocument;if(t){var i=t.createElement("html2canvaswrapper");i.appendChild(e.cloneNode(!0));var r=e.parentNode;if(r){r.replaceChild(i,e);var n=Xn(A,i);return i.firstChild&&r.replaceChild(i.firstChild,i),n}}return ti.EMPTY},Mp=function(A,e,t){var i=A.ownerDocument;if(!i)throw new Error("Node has no owner document");var r=i.createRange();return r.setStart(A,e),r.setEnd(A,e+t),r},Za=function(A){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(A)).map(function(t){return t.segment})}return dv(A)},Tv=function(A,e){if(Jt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(A)).map(function(i){return i.segment})}return Qv(A,e)},bv=function(A,e){return e.letterSpacing!==0?Za(A):Tv(A,e)},xv=[32,160,4961,65792,65793,4153,4241],Qv=function(A,e){for(var t=jB(A,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),i=[],r,n=function(){if(r.value){var s=r.value.slice(),o=Jn(s),l="";o.forEach(function(c){xv.indexOf(c)===-1?l+=It(c):(l.length&&i.push(l),i.push(It(c)),l="")}),l.length&&i.push(l)}};!(r=t.next()).done;)n();return i},Fv=(function(){function A(e,t,i){this.text=Uv(t.data,i.textTransform),this.textBounds=Cv(e,this.text,i,t)}return A})(),Uv=function(A,e){switch(e){case 1:return A.toLowerCase();case 3:return A.replace(Sv,Ev);case 2:return A.toUpperCase();default:return A}},Sv=/(^|\s|:|-|\(|\))([a-z])/g,Ev=function(A,e,t){return A.length>0?e+t.toUpperCase():A},Hp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.src=i.currentSrc||i.src,r.intrinsicWidth=i.naturalWidth,r.intrinsicHeight=i.naturalHeight,r.context.cache.addImage(r.src),r}return e})($A),Ip=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i,r.intrinsicWidth=i.width,r.intrinsicHeight=i.height,r}return e})($A),Pp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=new XMLSerializer,s=Xn(t,i);return i.setAttribute("width",s.width+"px"),i.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(i)),r.intrinsicWidth=i.width.baseVal.value,r.intrinsicHeight=i.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})($A),Dp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Ya=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.start=i.start,r.reversed=typeof i.reversed=="boolean"&&i.reversed===!0,r}return e})($A),Lv=[{type:15,flags:0,unit:"px",number:3}],Mv=[{type:16,flags:0,number:50}],Hv=function(A){return A.width>A.height?new ti(A.left+(A.width-A.height)/2,A.top,A.height,A.height):A.width<A.height?new ti(A.left,A.top+(A.height-A.width)/2,A.width,A.width):A},Iv=function(A){var e=A.type===Pv?new Array(A.value.length+1).join("•"):A.value;return e.length===0?A.placeholder||"":e},Fs="checkbox",Us="radio",Pv="password",_p=707406591,qa=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;switch(r.type=i.type.toLowerCase(),r.checked=i.checked,r.value=Iv(i),(r.type===Fs||r.type===Us)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=Hv(r.bounds)),r.type){case Fs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Lv;break;case Us:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=Mv;break}return r}return e})($A),kp=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this,n=i.options[i.selectedIndex||0];return r.value=n&&n.text||"",r}return e})($A),Op=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.value=i.value,r}return e})($A),Np=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;r.src=i.src,r.width=parseInt(i.width,10)||0,r.height=parseInt(i.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(i.contentWindow&&i.contentWindow.document&&i.contentWindow.document.documentElement){r.tree=zp(t,i.contentWindow.document.documentElement);var n=i.contentWindow.document.documentElement?zr(t,getComputedStyle(i.contentWindow.document.documentElement).backgroundColor):ii.TRANSPARENT,s=i.contentWindow.document.body?zr(t,getComputedStyle(i.contentWindow.document.body).backgroundColor):ii.TRANSPARENT;r.backgroundColor=wi(n)?wi(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})($A),Dv=["OL","UL","MENU"],Ss=function(A,e,t,i){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,Vp(r)&&r.data.trim().length>0)t.textNodes.push(new Fv(A,r,t.styles));else if(ji(r))if(Jp(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Ss(A,o,t,i)});else{var s=Kp(A,r);s.styles.isVisible()&&(_v(r,s,i)?s.flags|=4:kv(s.styles)&&(s.flags|=2),Dv.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Ss(A,r.shadowRoot,s,i):!Ls(r)&&!Wp(r)&&!Ms(r)&&Ss(A,r,s,i))}},Kp=function(A,e){return tl(e)?new Hp(A,e):Gp(e)?new Ip(A,e):Wp(e)?new Pp(A,e):Ov(e)?new Dp(A,e):Nv(e)?new Ya(A,e):Kv(e)?new qa(A,e):Ms(e)?new kp(A,e):Ls(e)?new Op(A,e):$p(e)?new Np(A,e):new $A(A,e)},zp=function(A,e){var t=Kp(A,e);return t.flags|=4,Ss(A,e,t,t),t},_v=function(A,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||el(A)&&t.styles.isTransparent()},kv=function(A){return A.isPositioned()||A.isFloating()},Vp=function(A){return A.nodeType===Node.TEXT_NODE},ji=function(A){return A.nodeType===Node.ELEMENT_NODE},ja=function(A){return ji(A)&&typeof A.style<"u"&&!Es(A)},Es=function(A){return typeof A.className=="object"},Ov=function(A){return A.tagName==="LI"},Nv=function(A){return A.tagName==="OL"},Kv=function(A){return A.tagName==="INPUT"},zv=function(A){return A.tagName==="HTML"},Wp=function(A){return A.tagName==="svg"},el=function(A){return A.tagName==="BODY"},Gp=function(A){return A.tagName==="CANVAS"},Rp=function(A){return A.tagName==="VIDEO"},tl=function(A){return A.tagName==="IMG"},$p=function(A){return A.tagName==="IFRAME"},Xp=function(A){return A.tagName==="STYLE"},Vv=function(A){return A.tagName==="SCRIPT"},Ls=function(A){return A.tagName==="TEXTAREA"},Ms=function(A){return A.tagName==="SELECT"},Jp=function(A){return A.tagName==="SLOT"},Zp=function(A){return A.tagName.indexOf("-")>0},Wv=(function(){function A(){this.counters={}}return A.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},A.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},A.prototype.pop=function(e){var t=this;e.forEach(function(i){return t.counters[i].pop()})},A.prototype.parse=function(e){var t=this,i=e.counterIncrement,r=e.counterReset,n=!0;i!==null&&i.forEach(function(o){var l=t.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&&r.forEach(function(o){var l=t.counters[o.counter];s.push(o.counter),l||(l=t.counters[o.counter]=[]),l.push(o.reset)}),s},A})(),Yp={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"]},qp={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Gv={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Rv={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},er=function(A,e,t,i,r,n){return A<e||A>t?$r(A,r,n.length>0):i.integers.reduce(function(s,o,l){for(;A>=o;)A-=o,s+=i.values[l];return s},"")+n},jp=function(A,e,t,i){var r="";do t||A--,r=i(A)+r,A/=e;while(A*e>=e);return r},Pt=function(A,e,t,i,r){var n=t-e+1;return(A<0?"-":"")+(jp(Math.abs(A),n,i,function(s){return It(Math.floor(s%n)+e)})+r)},Di=function(A,e,t){t===void 0&&(t=". ");var i=e.length;return jp(Math.abs(A),i,!1,function(r){return e[Math.floor(r%i)]})+t},tr=1,yi=2,Ci=4,Rr=8,ri=function(A,e,t,i,r,n){if(A<-9999||A>9999)return $r(A,4,r.length>0);var s=Math.abs(A),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&Kt(n,tr)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Kt(n,yi)||c===1&&l===1&&Kt(n,Ci)&&A>100||c===1&&l>1&&Kt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(A<0?i:"")+o},ed="十百千萬",td="拾佰仟萬",Ad="マイナス",Al="마이너스",$r=function(A,e,t){var i=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=Pt(A,48,57,!0,i);return o.length<4?"0"+o:o;case 4:return Di(A,"〇一二三四五六七八九",r);case 6:return er(A,1,3999,Yp,3,i).toLowerCase();case 7:return er(A,1,3999,Yp,3,i);case 8:return Pt(A,945,969,!1,i);case 9:return Pt(A,97,122,!1,i);case 10:return Pt(A,65,90,!1,i);case 11:return Pt(A,1632,1641,!0,i);case 12:case 49:return er(A,1,9999,qp,3,i);case 35:return er(A,1,9999,qp,3,i).toLowerCase();case 13:return Pt(A,2534,2543,!0,i);case 14:case 30:return Pt(A,6112,6121,!0,i);case 15:return Di(A,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Di(A,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return ri(A,"零一二三四五六七八九",ed,"負",r,yi|Ci|Rr);case 47:return ri(A,"零壹貳參肆伍陸柒捌玖",td,"負",r,tr|yi|Ci|Rr);case 42:return ri(A,"零一二三四五六七八九",ed,"负",r,yi|Ci|Rr);case 41:return ri(A,"零壹贰叁肆伍陆柒捌玖",td,"负",r,tr|yi|Ci|Rr);case 26:return ri(A,"〇一二三四五六七八九","十百千万",Ad,r,0);case 25:return ri(A,"零壱弐参四伍六七八九","拾百千万",Ad,r,tr|yi|Ci);case 31:return ri(A,"영일이삼사오육칠팔구","십백천만",Al,n,tr|yi|Ci);case 33:return ri(A,"零一二三四五六七八九","十百千萬",Al,n,0);case 32:return ri(A,"零壹貳參四五六七八九","拾百千",Al,n,tr|yi|Ci);case 18:return Pt(A,2406,2415,!0,i);case 20:return er(A,1,19999,Rv,3,i);case 21:return Pt(A,2790,2799,!0,i);case 22:return Pt(A,2662,2671,!0,i);case 22:return er(A,1,10999,Gv,3,i);case 23:return Di(A,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Di(A,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Pt(A,3302,3311,!0,i);case 28:return Di(A,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Di(A,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return Pt(A,3792,3801,!0,i);case 37:return Pt(A,6160,6169,!0,i);case 38:return Pt(A,4160,4169,!0,i);case 39:return Pt(A,2918,2927,!0,i);case 40:return Pt(A,1776,1785,!0,i);case 43:return Pt(A,3046,3055,!0,i);case 44:return Pt(A,3174,3183,!0,i);case 45:return Pt(A,3664,3673,!0,i);case 46:return Pt(A,3872,3881,!0,i);default:return Pt(A,48,57,!0,i)}},id="data-html2canvas-ignore",rd=(function(){function A(e,t,i){if(this.context=e,this.options=i,this.scrolledElements=[],this.referenceElement=t,this.counters=new Wv,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return A.prototype.toIFrame=function(e,t){var i=this,r=$v(e,t);if(!r.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=r.contentWindow,l=o.document,c=Zv(r).then(function(){return sA(i,void 0,void 0,function(){var h,m;return tA(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(eT),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,m=this.clonedReferenceElement,typeof m>"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:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Jv(l)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(qv(document.doctype)+"<html></html>"),jv(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},A.prototype.createElementClone=function(e){if(Oa(e,2))debugger;if(Gp(e))return this.createCanvasClone(e);if(Rp(e))return this.createVideoClone(e);if(Xp(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return tl(t)&&(tl(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Zp(t)?this.createCustomElementClone(t):t},A.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return il(e.style,t),t},A.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var i=[].slice.call(t.cssRules,0).reduce(function(n,s){return s&&typeof s.cssText=="string"?n+s.cssText:n},""),r=e.cloneNode(!1);return r.textContent=i,r}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},A.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var i=e.ownerDocument.createElement("img");try{return i.src=e.toDataURL(),i}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t: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 r}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},A.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var i=t.getContext("2d");try{return i&&(i.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||i.getImageData(0,0,t.width,t.height)),t}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},A.prototype.appendChildNode=function(e,t,i){(!ji(t)||!Vv(t)&&!t.hasAttribute(id)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!ji(t)||!Xp(t))&&e.appendChild(this.cloneNode(t,i))},A.prototype.cloneChildNodes=function(e,t,i){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(ji(n)&&Jp(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return r.appendChildNode(t,o,i)})}else this.appendChildNode(t,n,i)},A.prototype.cloneNode=function(e,t){if(Vp(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var i=e.ownerDocument.defaultView;if(i&&ji(e)&&(ja(e)||Es(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=i.getComputedStyle(e),s=i.getComputedStyle(e,":before"),o=i.getComputedStyle(e,":after");this.referenceElement===e&&ja(r)&&(this.clonedReferenceElement=r),el(r)&&iT(r);var l=this.counters.parse(new wp(this.context,n)),c=this.resolvePseudoContent(e,r,s,Xr.BEFORE);Zp(e)&&(t=!0),Rp(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var h=this.resolvePseudoContent(e,r,o,Xr.AFTER);return h&&r.appendChild(h),this.counters.pop(l),(n&&(this.options.copyStyles||Es(e))&&!$p(e)||t)&&il(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ls(e)||Ms(e))&&(Ls(r)||Ms(r))&&(r.value=e.value),r}return e.cloneNode(!1)},A.prototype.resolvePseudoContent=function(e,t,i,r){var n=this;if(i){var s=i.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||i.display==="none")){this.counters.parse(new wp(this.context,i));var l=new OC(this.context,i),c=o.createElement("html2canvaspseudoelement");il(i,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var v=o.createElement("img");v.src=m.value,v.style.opacity="1",c.appendChild(v)}else if(m.type===18){if(m.name==="attr"){var x=m.values.filter(yt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(m.name==="counter"){var F=m.values.filter(Yi),T=F[0],S=F[1];if(T&&yt(T)){var I=n.counters.getCounterValue(T.value),Q=S&&yt(S)?ka.parse(n.context,S.value):3;c.appendChild(o.createTextNode($r(I,Q,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Yi),T=N[0],J=N[1],S=N[2];if(T&&yt(T)){var H=n.counters.getCounterValues(T.value),z=S&&yt(S)?ka.parse(n.context,S.value):3,re=J&&J.type===0?J.value:"",q=H.map(function(ne){return $r(ne,z,!1)}).join(re);c.appendChild(o.createTextNode(q))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(mp(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(mp(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=rl+" "+nl;var h=r===Xr.BEFORE?" "+rl:" "+nl;return Es(t)?t.className.baseValue+=h:t.className+=h,c}}},A.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},A})(),Xr;(function(A){A[A.BEFORE=0]="BEFORE",A[A.AFTER=1]="AFTER"})(Xr||(Xr={}));var $v=function(A,e){var t=A.createElement("iframe");return t.className="html2canvas-container",t.style.visibility="hidden",t.style.position="fixed",t.style.left="-10000px",t.style.top="0px",t.style.border="0",t.width=e.width.toString(),t.height=e.height.toString(),t.scrolling="no",t.setAttribute(id,"true"),A.body.appendChild(t),t},Xv=function(A){return new Promise(function(e){if(A.complete){e();return}if(!A.src){e();return}A.onload=e,A.onerror=e})},Jv=function(A){return Promise.all([].slice.call(A.images,0).map(Xv))},Zv=function(A){return new Promise(function(e,t){var i=A.contentWindow;if(!i)return t("No window assigned for iframe");var r=i.document;i.onload=A.onload=function(){i.onload=A.onload=null;var n=setInterval(function(){r.body.childNodes.length>0&&r.readyState==="complete"&&(clearInterval(n),e(A))},50)}})},Yv=["all","d","content"],il=function(A,e){for(var t=A.length-1;t>=0;t--){var i=A.item(t);Yv.indexOf(i)===-1&&e.style.setProperty(i,A.getPropertyValue(i))}return e},qv=function(A){var e="";return A&&(e+="<!DOCTYPE ",A.name&&(e+=A.name),A.internalSubset&&(e+=A.internalSubset),A.publicId&&(e+='"'+A.publicId+'"'),A.systemId&&(e+='"'+A.systemId+'"'),e+=">"),e},jv=function(A,e,t){A&&A.defaultView&&(e!==A.defaultView.pageXOffset||t!==A.defaultView.pageYOffset)&&A.defaultView.scrollTo(e,t)},eT=function(A){var e=A[0],t=A[1],i=A[2];e.scrollLeft=t,e.scrollTop=i},tT=":before",AT=":after",rl="___html2canvas___pseudoelement_before",nl="___html2canvas___pseudoelement_after",nd=`{
|
|
7
7
|
content: "" !important;
|
|
8
8
|
display: none !important;
|
|
9
|
-
}`,
|
|
10
|
-
.`+el+Qv+Yp)},Uv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},qp=(function(){function i(){}return i.getOrigin=function(e){var t=i._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},i.isSameOrigin=function(e){return i.getOrigin(e)===i._origin},i.setContext=function(e){i._link=e.document.createElement("a"),i._origin=i.getOrigin(e.location.href)},i._origin="about:blank",i})(),Sv=(function(){function i(e,t){this.context=e,this._options=t,this._cache={}}return i.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(Al(e)||Hv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Zt(this,function(o){switch(o.label){case 0:return t=qp.isSameOrigin(e),A=!tl(e)&&this._options.useCORS===!0&&Wt.SUPPORT_CORS_IMAGES&&!t,r=!tl(e)&&!t&&!Al(e)&&typeof this._options.proxy=="string"&&Wt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!tl(e)&&!Al(e)&&!r&&!A?[2]:(n=e,r?[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,c){var h=new Image;h.onload=function(){return l(h)},h.onerror=c,(Iv(n)||A)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},i.prototype.has=function(e){return typeof this._cache[e]<"u"},i.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},i.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Wt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var g=new FileReader;g.addEventListener("load",function(){return n(g.result)},!1),g.addEventListener("error",function(v){return s(v)},!1),g.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(l.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},i})(),Ev=/^data:image\/svg\+xml/i,Lv=/^data:image\/.*;base64,/i,Mv=/^data:image\/.*/i,Hv=function(i){return Wt.SUPPORT_SVG_DRAWING||!_v(i)},tl=function(i){return Mv.test(i)},Iv=function(i){return Lv.test(i)},Al=function(i){return i.substr(0,4)==="blob"},_v=function(i){return i.substr(-3).toLowerCase()==="svg"||Ev.test(i)},Ne=(function(){function i(e,t){this.type=0,this.x=e,this.y=t}return i.prototype.add=function(e,t){return new i(this.x+e,this.y+t)},i})(),er=function(i,e,t){return new Ne(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=er(this.start,this.startControl,e),r=er(this.startControl,this.endControl,e),n=er(this.endControl,this.end,e),s=er(A,r,e),o=er(r,n,e),l=er(s,o,e);return t?new i(this.start,A,s,l):new i(l,o,n,this.end)},i.prototype.add=function(e,t){return new i(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},i.prototype.reverse=function(){return new i(this.end,this.endControl,this.startControl,this.start)},i})(),vA=function(i){return i.type===1},Dv=(function(){function i(e){var t=e.styles,A=e.bounds,r=Nr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Nr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],h=Nr(t.borderBottomRightRadius,A.width,A.height),g=h[0],v=h[1],x=Nr(t.borderBottomLeftRadius,A.width,A.height),F=x[0],T=x[1],S=[];S.push((n+l)/A.width),S.push((F+g)/A.width),S.push((s+T)/A.height),S.push((c+v)/A.height);var I=Math.max.apply(Math,S);I>1&&(n/=I,s/=I,l/=I,c/=I,g/=I,v/=I,F/=I,T/=I);var Q=A.width-l,N=A.height-v,X=A.width-g,H=A.height-T,V=t.borderTopWidth,ne=t.borderRightWidth,Z=t.borderBottomWidth,re=t.borderLeftWidth,R=Tt(t.paddingTop,e.bounds.width),oe=Tt(t.paddingRight,e.bounds.width),le=Tt(t.paddingBottom,e.bounds.width),ee=Tt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Qt(A.left+re/3,A.top+V/3,n-re/3,s-V/3,ft.TOP_LEFT):new Ne(A.left+re/3,A.top+V/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Qt(A.left+Q,A.top+V/3,l-ne/3,c-V/3,ft.TOP_RIGHT):new Ne(A.left+A.width-ne/3,A.top+V/3),this.bottomRightBorderDoubleOuterBox=g>0||v>0?Qt(A.left+X,A.top+N,g-ne/3,v-Z/3,ft.BOTTOM_RIGHT):new Ne(A.left+A.width-ne/3,A.top+A.height-Z/3),this.bottomLeftBorderDoubleOuterBox=F>0||T>0?Qt(A.left+re/3,A.top+H,F-re/3,T-Z/3,ft.BOTTOM_LEFT):new Ne(A.left+re/3,A.top+A.height-Z/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Qt(A.left+re*2/3,A.top+V*2/3,n-re*2/3,s-V*2/3,ft.TOP_LEFT):new Ne(A.left+re*2/3,A.top+V*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Qt(A.left+Q,A.top+V*2/3,l-ne*2/3,c-V*2/3,ft.TOP_RIGHT):new Ne(A.left+A.width-ne*2/3,A.top+V*2/3),this.bottomRightBorderDoubleInnerBox=g>0||v>0?Qt(A.left+X,A.top+N,g-ne*2/3,v-Z*2/3,ft.BOTTOM_RIGHT):new Ne(A.left+A.width-ne*2/3,A.top+A.height-Z*2/3),this.bottomLeftBorderDoubleInnerBox=F>0||T>0?Qt(A.left+re*2/3,A.top+H,F-re*2/3,T-Z*2/3,ft.BOTTOM_LEFT):new Ne(A.left+re*2/3,A.top+A.height-Z*2/3),this.topLeftBorderStroke=n>0||s>0?Qt(A.left+re/2,A.top+V/2,n-re/2,s-V/2,ft.TOP_LEFT):new Ne(A.left+re/2,A.top+V/2),this.topRightBorderStroke=n>0||s>0?Qt(A.left+Q,A.top+V/2,l-ne/2,c-V/2,ft.TOP_RIGHT):new Ne(A.left+A.width-ne/2,A.top+V/2),this.bottomRightBorderStroke=g>0||v>0?Qt(A.left+X,A.top+N,g-ne/2,v-Z/2,ft.BOTTOM_RIGHT):new Ne(A.left+A.width-ne/2,A.top+A.height-Z/2),this.bottomLeftBorderStroke=F>0||T>0?Qt(A.left+re/2,A.top+H,F-re/2,T-Z/2,ft.BOTTOM_LEFT):new Ne(A.left+re/2,A.top+A.height-Z/2),this.topLeftBorderBox=n>0||s>0?Qt(A.left,A.top,n,s,ft.TOP_LEFT):new Ne(A.left,A.top),this.topRightBorderBox=l>0||c>0?Qt(A.left+Q,A.top,l,c,ft.TOP_RIGHT):new Ne(A.left+A.width,A.top),this.bottomRightBorderBox=g>0||v>0?Qt(A.left+X,A.top+N,g,v,ft.BOTTOM_RIGHT):new Ne(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=F>0||T>0?Qt(A.left,A.top+H,F,T,ft.BOTTOM_LEFT):new Ne(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Qt(A.left+re,A.top+V,Math.max(0,n-re),Math.max(0,s-V),ft.TOP_LEFT):new Ne(A.left+re,A.top+V),this.topRightPaddingBox=l>0||c>0?Qt(A.left+Math.min(Q,A.width-ne),A.top+V,Q>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-V),ft.TOP_RIGHT):new Ne(A.left+A.width-ne,A.top+V),this.bottomRightPaddingBox=g>0||v>0?Qt(A.left+Math.min(X,A.width-re),A.top+Math.min(N,A.height-Z),Math.max(0,g-ne),Math.max(0,v-Z),ft.BOTTOM_RIGHT):new Ne(A.left+A.width-ne,A.top+A.height-Z),this.bottomLeftPaddingBox=F>0||T>0?Qt(A.left+re,A.top+Math.min(H,A.height-Z),Math.max(0,F-re),Math.max(0,T-Z),ft.BOTTOM_LEFT):new Ne(A.left+re,A.top+A.height-Z),this.topLeftContentBox=n>0||s>0?Qt(A.left+re+ee,A.top+V+R,Math.max(0,n-(re+ee)),Math.max(0,s-(V+R)),ft.TOP_LEFT):new Ne(A.left+re+ee,A.top+V+R),this.topRightContentBox=l>0||c>0?Qt(A.left+Math.min(Q,A.width+re+ee),A.top+V+R,Q>A.width+re+ee?0:l-re+ee,c-(V+R),ft.TOP_RIGHT):new Ne(A.left+A.width-(ne+oe),A.top+V+R),this.bottomRightContentBox=g>0||v>0?Qt(A.left+Math.min(X,A.width-(re+ee)),A.top+Math.min(N,A.height+V+R),Math.max(0,g-(ne+oe)),v-(Z+le),ft.BOTTOM_RIGHT):new Ne(A.left+A.width-(ne+oe),A.top+A.height-(Z+le)),this.bottomLeftContentBox=F>0||T>0?Qt(A.left+re+ee,A.top+H,Math.max(0,F-(re+ee)),T-(Z+le),ft.BOTTOM_LEFT):new Ne(A.left+re+ee,A.top+A.height-(Z+le))}return i})(),ft;(function(i){i[i.TOP_LEFT=0]="TOP_LEFT",i[i.TOP_RIGHT=1]="TOP_RIGHT",i[i.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",i[i.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(ft||(ft={}));var Qt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case ft.TOP_LEFT:return new Ls(new Ne(i,c),new Ne(i,c-o),new Ne(l-s,e),new Ne(l,e));case ft.TOP_RIGHT:return new Ls(new Ne(i,e),new Ne(i+s,e),new Ne(l,c-o),new Ne(l,c));case ft.BOTTOM_RIGHT:return new Ls(new Ne(l,e),new Ne(l,e+o),new Ne(i+s,c),new Ne(i,c));case ft.BOTTOM_LEFT:default:return new Ls(new Ne(l,c),new Ne(l-s,c),new Ne(i,e+o),new Ne(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},Pv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},kv=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Is=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),Nv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),Ov=function(i){return i.type===0},jp=function(i){return i.type===1},Kv=function(i){return i.type===2},ed=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},Vv=function(i,e,t,A,r){return i.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+A,t);case 2:return n.add(e+A,t+r);case 3:return n.add(e,t+r)}return n})},td=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Ad=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Dv(this.container),this.container.styles.opacity<1&&this.effects.push(new Nv(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new kv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);ed(s,o)?this.effects.push(new Is(s,6)):(this.effects.push(new Is(s,2)),this.effects.push(new Is(o,4)))}}return i.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(l){return!jp(l)});if(t||A.container.styles.position!==0||!A.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=Ms(A.curves),o=Hs(A.curves);ed(s,o)||r.unshift(new Is(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return kt(l.target,e)})},i})(),il=function(i,e,t,A){i.container.elements.forEach(function(r){var n=kt(r.flags,4),s=kt(r.flags,2),o=new Ad(r,i);kt(r.styles.display,2048)&&A.push(o);var l=kt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,h=new td(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var g=r.styles.zIndex.order;if(g<0){var v=0;c.negativeZIndex.some(function(F,T){return g>F.element.container.styles.zIndex.order?(v=T,!1):v>0}),c.negativeZIndex.splice(v,0,h)}else if(g>0){var x=0;c.positiveZIndex.some(function(F,T){return g>=F.element.container.styles.zIndex.order?(x=T+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);il(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),il(o,e,t,l);kt(r.flags,8)&&id(r,l)})},id=function(i,e){for(var t=i instanceof Ga?i.start:1,A=i instanceof Ga?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Up&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Rr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},zv=function(i){var e=new Ad(i,null),t=new td(e),A=[];return il(e,t,t,A),id(e.container,A),t},rd=function(i,e){switch(e){case 0:return TA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return TA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return TA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return TA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Wv=function(i,e){switch(e){case 0:return TA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return TA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return TA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return TA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},Rv=function(i,e){switch(e){case 0:return TA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return TA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return TA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return TA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Gv=function(i,e){switch(e){case 0:return _s(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return _s(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return _s(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return _s(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},_s=function(i,e){var t=[];return vA(i)?t.push(i.subdivide(.5,!1)):t.push(i),vA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},TA=function(i,e,t,A){var r=[];return vA(i)?r.push(i.subdivide(.5,!1)):r.push(i),vA(t)?r.push(t.subdivide(.5,!0)):r.push(t),vA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),vA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},nd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Ds=function(i){var e=i.styles,t=i.bounds,A=Tt(e.paddingLeft,t.width),r=Tt(e.paddingRight,t.width),n=Tt(e.paddingTop,t.width),s=Tt(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},$v=function(i,e){return i===0?e.bounds:i===2?Ds(e):nd(e)},Xv=function(i,e){return i===0?e.bounds:i===2?Ds(e):nd(e)},rl=function(i,e,t){var A=$v(Ar(i.styles.backgroundOrigin,e),i),r=Xv(Ar(i.styles.backgroundClip,e),i),n=Jv(Ar(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Nr(Ar(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=Zv(Ar(i.styles.backgroundRepeat,e),l,n,A,r),h=Math.round(A.left+l[0]),g=Math.round(A.top+l[1]);return[c,h,g,s,o]},tr=function(i){return wt(i)&&i.value===Zi.AUTO},Ps=function(i){return typeof i=="number"},Jv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[Tt(s,t.width),Tt(o,t.height)];var l=Ps(n);if(wt(s)&&(s.value===Zi.CONTAIN||s.value===Zi.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Zi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=Ps(A),g=Ps(r),v=h||g;if(tr(s)&&(!o||tr(o))){if(h&&g)return[A,r];if(!l&&!v)return[t.width,t.height];if(v&&l){var x=h?A:r*n,F=g?r:A/n;return[x,F]}var T=h?A:t.width,S=g?r:t.height;return[T,S]}if(l){var I=0,Q=0;return Pt(s)?I=Tt(s,t.width):Pt(o)&&(Q=Tt(o,t.height)),tr(s)?I=Q*n:(!o||tr(o))&&(Q=I/n),[I,Q]}var N=null,X=null;if(Pt(s)?N=Tt(s,t.width):o&&Pt(o)&&(X=Tt(o,t.height)),N!==null&&(!o||tr(o))&&(X=h&&g?N/A*r:t.height),X!==null&&tr(s)&&(N=h&&g?X/r*A:t.width),N!==null&&X!==null)return[N,X];throw new Error("Unable to calculate background-size for element")},Ar=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},Zv=function(i,e,t,A,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(i){case 2:return[new Ne(Math.round(A.left),Math.round(A.top+s)),new Ne(Math.round(A.left+A.width),Math.round(A.top+s)),new Ne(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Ne(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Ne(Math.round(A.left+n),Math.round(A.top)),new Ne(Math.round(A.left+n+o),Math.round(A.top)),new Ne(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Ne(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Ne(Math.round(A.left+n),Math.round(A.top+s)),new Ne(Math.round(A.left+n+o),Math.round(A.top+s)),new Ne(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Ne(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Ne(Math.round(r.left),Math.round(r.top)),new Ne(Math.round(r.left+r.width),Math.round(r.top)),new Ne(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Ne(Math.round(r.left),Math.round(r.height+r.top))]}},Yv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",sd="Hidden Text",qv=(function(){function i(e){this._data={},this._document=e}return i.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;A.style.visibility="hidden",A.style.fontFamily=e,A.style.fontSize=t,A.style.margin="0",A.style.padding="0",A.style.whiteSpace="nowrap",s.appendChild(A),r.src=Yv,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(sd)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(sd)),A.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:l}},i.prototype.getMetrics=function(e,t){var A=e+" "+t;return typeof this._data[A]>"u"&&(this._data[A]=this.parseMetrics(e,t)),this._data[A]},i})(),od=(function(){function i(e,t){this.context=e,this.options=t}return i})(),jv=1e4,eT=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r._activeEffects=[],r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),A.canvas||(r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px"),r.fontMetrics=new qv(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),r}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return A.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),Kv(t)&&(this.ctx.globalAlpha=t.opacity),Ov(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),jp(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Zt(this,function(A){switch(A.label){case 0:if(kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Ra(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=nT(t.fontFamily).join(", "),n=kr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,h,g,v=this;return Zt(this,function(x){return r=this.createFontStyle(A),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,h=l.middle,g=A.paintOrder,t.textBounds.forEach(function(F){g.forEach(function(T){switch(T){case 0:v.ctx.fillStyle=Ot(A.color),v.renderTextWithLetterSpacing(F,A.letterSpacing,c);var S=A.textShadow;S.length&&F.text.trim().length&&(S.slice(0).reverse().forEach(function(I){v.ctx.shadowColor=Ot(I.color),v.ctx.shadowOffsetX=I.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=I.offsetY.number*v.options.scale,v.ctx.shadowBlur=I.blur.number,v.renderTextWithLetterSpacing(F,A.letterSpacing,c)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),A.textDecorationLine.length&&(v.ctx.fillStyle=Ot(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(I){switch(I){case 1:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top+c),F.bounds.width,1);break;case 2:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top),F.bounds.width,1);break;case 3:v.ctx.fillRect(F.bounds.left,Math.ceil(F.bounds.top+h),F.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&F.text.trim().length&&(v.ctx.strokeStyle=Ot(A.webkitTextStrokeColor),v.ctx.lineWidth=A.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(F.text,F.bounds.left,F.bounds.top+c)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=Ds(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,Q,Q,c,h,g,v,X,x,F,H,T,S,I,Q,N,X,H;return Zt(this,function(V){switch(V.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.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(!(A instanceof xp))return[3,8];V.label=5;case 5:return V.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return Q=V.sent(),this.renderReplacedElement(A,r,Q),[3,8];case 7:return V.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Qp&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof Fp))return[3,12];V.label=9;case 9:return V.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return Q=V.sent(),this.renderReplacedElement(A,r,Q),[3,12];case 11:return V.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof Mp&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:h=V.sent(),A.width&&A.height&&this.ctx.drawImage(h,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),V.label=14;case 14:if(A instanceof $a&&(g=Math.min(A.bounds.width,A.bounds.height),A.type===xs?A.checked&&(this.ctx.save(),this.path([new Ne(A.bounds.left+g*.39363,A.bounds.top+g*.79),new Ne(A.bounds.left+g*.16,A.bounds.top+g*.5549),new Ne(A.bounds.left+g*.27347,A.bounds.top+g*.44071),new Ne(A.bounds.left+g*.39694,A.bounds.top+g*.5649),new Ne(A.bounds.left+g*.72983,A.bounds.top+g*.23),new Ne(A.bounds.left+g*.84,A.bounds.top+g*.34085),new Ne(A.bounds.left+g*.39363,A.bounds.top+g*.79)]),this.ctx.fillStyle=Ot(Sp),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+g/2,A.bounds.top+g/2,g/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ot(Sp),this.ctx.fill(),this.ctx.restore())),tT(A)&&A.value.length){switch(v=this.createFontStyle(n),X=v[0],x=v[1],F=this.fontMetrics.getMetrics(X,x).baseline,this.ctx.font=X,this.ctx.fillStyle=Ot(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=iT(A.styles.textAlign),H=Ds(A),T=0,A.styles.textAlign){case 1:T+=H.width/2;break;case 2:T+=H.width;break}S=H.add(T,0,0,-H.height/2+1),this.ctx.save(),this.path([new Ne(H.left,H.top),new Ne(H.left+H.width,H.top),new Ne(H.left+H.width,H.top+H.height),new Ne(H.left,H.top+H.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new zr(A.value,S),n.letterSpacing,F),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!kt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(I=A.styles.listStyleImage,I.type!==0)return[3,18];Q=void 0,N=I.url,V.label=15;case 15:return V.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return Q=V.sent(),this.ctx.drawImage(Q,A.bounds.left-(Q.width+10),A.bounds.top),[3,18];case 17:return V.sent(),this.context.logger.error("Error loading list-style-image "+N),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(X=this.createFontStyle(n)[0],this.ctx.font=X,this.ctx.fillStyle=Ot(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",H=new YA(A.bounds.left,A.bounds.top+Tt(A.styles.paddingTop,A.bounds.width),A.bounds.width,sp(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new zr(t.listValue,H),n.letterSpacing,sp(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(t){return tA(this,void 0,void 0,function(){var A,r,I,n,s,I,o,l,I,c,h,I,g,v,I,x,F,I,T,S,I;return Zt(this,function(Q){switch(Q.label){case 0:if(kt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),A=0,r=t.negativeZIndex,Q.label=2;case 2:return A<r.length?(I=r[A],[4,this.renderStack(I)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),n=0,s=t.nonInlineLevel,Q.label=7;case 7:return n<s.length?(I=s[n],[4,this.renderNode(I)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,Q.label=11;case 11:return o<l.length?(I=l[o],[4,this.renderStack(I)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<h.length?(I=h[c],[4,this.renderStack(I)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:g=0,v=t.inlineLevel,Q.label=19;case 19:return g<v.length?(I=v[g],[4,this.renderNode(I)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return g++,[3,19];case 22:x=0,F=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return x<F.length?(I=F[x],[4,this.renderStack(I)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return x++,[3,23];case 26:T=0,S=t.positiveZIndex,Q.label=27;case 27:return T<S.length?(I=S[T],[4,this.renderStack(I)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){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(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var A=this;t.forEach(function(r,n){var s=vA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),vA(r)&&A.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,A,r,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,A,r){var n;if(t.width===A&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,A),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,A,r),o},e.prototype.renderBackgroundImage=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Zt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(h){var g,v,x,R,se,Ae,ee,fe,Z,F,R,se,Ae,ee,fe,T,S,I,Q,N,X,H,V,ne,Z,re,R,oe,le,ee,fe,j,se,Ae,ue,ae,Be,be,xe,me,ve,Qe;return Zt(this,function(Ee){switch(Ee.label){case 0:if(h.type!==0)return[3,5];g=void 0,v=h.url,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,n.context.cache.match(v)];case 2:return g=Ee.sent(),[3,4];case 3:return Ee.sent(),n.context.logger.error("Error loading background-image "+v),[3,4];case 4:return g&&(x=rl(t,A,[g.width,g.height,g.width/g.height]),R=x[0],se=x[1],Ae=x[2],ee=x[3],fe=x[4],Z=n.ctx.createPattern(n.resizeImage(g,ee,fe),"repeat"),n.renderRepeat(R,Z,se,Ae)),[3,6];case 5:O2(h)?(F=rl(t,A,[null,null,null]),R=F[0],se=F[1],Ae=F[2],ee=F[3],fe=F[4],T=_2(h.angle,ee,fe),S=T[0],I=T[1],Q=T[2],N=T[3],X=T[4],H=document.createElement("canvas"),H.width=ee,H.height=fe,V=H.getContext("2d"),ne=V.createLinearGradient(I,N,Q,X),Ju(h.stops,S).forEach(function(Me){return ne.addColorStop(Me.stop,Ot(Me.color))}),V.fillStyle=ne,V.fillRect(0,0,ee,fe),ee>0&&fe>0&&(Z=n.ctx.createPattern(H,"repeat"),n.renderRepeat(R,Z,se,Ae))):K2(h)&&(re=rl(t,A,[null,null,null]),R=re[0],oe=re[1],le=re[2],ee=re[3],fe=re[4],j=h.position.length===0?[Ea]:h.position,se=Tt(j[0],ee),Ae=Tt(j[j.length-1],fe),ue=D2(h,se,Ae,ee,fe),ae=ue[0],Be=ue[1],ae>0&&Be>0&&(be=n.ctx.createRadialGradient(oe+se,le+Ae,0,oe+se,le+Ae,ae),Ju(h.stops,ae*2).forEach(function(Me){return be.addColorStop(Me.stop,Ot(Me.color))}),n.path(R),n.ctx.fillStyle=be,ae!==Be?(xe=t.bounds.left+.5*t.bounds.width,me=t.bounds.top+.5*t.bounds.height,ve=Be/ae,Qe=1/ve,n.ctx.save(),n.ctx.translate(xe,me),n.ctx.transform(1,0,0,ve,0,0),n.ctx.translate(-xe,-me),n.ctx.fillRect(oe,Qe*(le-me)+me,ee,fe*Qe),n.ctx.restore()):n.ctx.fill())),Ee.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Zt(this,function(n){return this.path(rd(r,A)),this.ctx.fillStyle=Ot(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Zt(this,function(l){switch(l.label){case 0:return A<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=Wv(n,r),this.path(s),this.ctx.fillStyle=Ot(t),this.ctx.fill(),o=Rv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,h,g=this;return Zt(this,function(v){switch(v.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!ui(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=AT(Ar(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),ui(A.backgroundColor)||(this.ctx.fillStyle=Ot(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(x){g.ctx.save();var F=Ms(t.curves),T=x.inset?0:jv,S=Vv(F,-T+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(g.path(F),g.ctx.clip(),g.mask(S)):(g.mask(F),g.ctx.clip(),g.path(S)),g.ctx.shadowOffsetX=x.offsetX.number+T,g.ctx.shadowOffsetY=x.offsetY.number,g.ctx.shadowColor=Ot(x.color),g.ctx.shadowBlur=x.blur.number,g.ctx.fillStyle=x.inset?Ot(x.color):"rgba(0,0,0,1)",g.ctx.fill(),g.ctx.restore()}),v.label=2;case 2:o=0,l=0,c=n,v.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!ui(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return v.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:v.sent(),v.label=11;case 11:o++,v.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return tA(this,void 0,void 0,function(){var o,l,c,h,g,v,x,F,T,S,I,Q,N,X,H,V,H,V;return Zt(this,function(ne){return this.ctx.save(),o=Gv(n,r),l=rd(n,r),s===2&&(this.path(l),this.ctx.clip()),vA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),vA(l[1])?(g=l[1].end.x,v=l[1].end.y):(g=l[1].x,v=l[1].y),r===0||r===2?x=Math.abs(c-g):x=Math.abs(h-v),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),F=A<3?A*3:A*2,T=A<3?A*2:A,s===3&&(F=A,T=A),S=!0,x<=F*2?S=!1:x<=F*2+T?(I=x/(2*F+T),F*=I,T*=I):(Q=Math.floor((x+T)/(F+T)),N=(x-Q*F)/(Q-1),X=(x-(Q+1)*F)/Q,T=X<=0||Math.abs(T-N)<Math.abs(T-X)?N:X),S&&(s===3?this.ctx.setLineDash([0,F+T]):this.ctx.setLineDash([F,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Ot(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(vA(l[0])&&(H=l[3],V=l[0],this.ctx.beginPath(),this.formatPath([new Ne(H.end.x,H.end.y),new Ne(V.start.x,V.start.y)]),this.ctx.stroke()),vA(l[1])&&(H=l[1],V=l[2],this.ctx.beginPath(),this.formatPath([new Ne(H.end.x,H.end.y),new Ne(V.start.x,V.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Zt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=zv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(od),tT=function(i){return i instanceof Lp||i instanceof Ep?!0:i instanceof $a&&i.type!==Qs&&i.type!==xs},AT=function(i,e){switch(i){case 0:return Ms(e);case 2:return Pv(e);default:return Hs(e)}},iT=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},rT=["-apple-system","system-ui"],nT=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return rT.indexOf(e)===-1}):i},sT=(function(i){EA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=A,r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),r}return e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A,r;return Zt(this,function(n){switch(n.label){case 0:return A=Wa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,oT(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(od),oT=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},aT=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];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))},i.prototype.getTime=function(){return Date.now()-this.start},i.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Rn([this.id,this.getTime()+"ms"],e))},i.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];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))},i.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];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))},i.instances={},i})(),lT=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new aT({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new Sv(this,e)}return i.instanceCount=1,i})(),cT=function(i,e){return e===void 0&&(e={}),hT(i,e)};typeof window<"u"&&qp.setContext(window);var hT=function(i,e){return tA(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,h,g,v,x,F,T,S,I,Q,N,X,H,ne,V,ne,Z,re,R,oe,le,ee,fe,j,se,Ae,ue,ae,Be,be,xe,me,ve;return Zt(this,function(Qe){switch(Qe.label){case 0:if(!i||typeof i!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=i.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(A=t.defaultView,!A)throw new Error("Document is not attached to a Window");return r={allowTaint:(Z=e.allowTaint)!==null&&Z!==void 0?Z:!1,imageTimeout:(re=e.imageTimeout)!==null&&re!==void 0?re:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1},n=la({logging:(oe=e.logging)!==null&&oe!==void 0?oe:!0,cache:e.cache},r),s={windowWidth:(le=e.windowWidth)!==null&&le!==void 0?le:A.innerWidth,windowHeight:(ee=e.windowHeight)!==null&&ee!==void 0?ee:A.innerHeight,scrollX:(fe=e.scrollX)!==null&&fe!==void 0?fe:A.pageXOffset,scrollY:(j=e.scrollY)!==null&&j!==void 0?j:A.pageYOffset},o=new YA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new lT(n,o),c=(se=e.foreignObjectRendering)!==null&&se!==void 0?se:!1,h={allowTaint:(Ae=e.allowTaint)!==null&&Ae!==void 0?Ae:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),g=new Zp(l,i,h),v=g.clonedReferenceElement,v?[4,g.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=Qe.sent(),F=Ja(v)||uv(v)?Vw(v.ownerDocument):Gn(l,v),T=F.width,S=F.height,I=F.left,Q=F.top,N=uT(l,v,e.backgroundColor),X={canvas:e.canvas,backgroundColor:N,scale:(ae=(ue=e.scale)!==null&&ue!==void 0?ue:A.devicePixelRatio)!==null&&ae!==void 0?ae:1,x:((Be=e.x)!==null&&Be!==void 0?Be:0)+I,y:((be=e.y)!==null&&be!==void 0?be:0)+Q,width:(xe=e.width)!==null&&xe!==void 0?xe:Math.ceil(T),height:(me=e.height)!==null&&me!==void 0?me:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ne=new sT(l,X),[4,ne.render(v)]):[3,3];case 2:return H=Qe.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+I+","+Q+" with size "+T+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),V=Ip(l,v),N===V.styles.backgroundColor&&(V.styles.backgroundColor=jA.TRANSPARENT),l.logger.debug("Starting renderer for element at "+X.x+","+X.y+" with size "+X.width+"x"+X.height),ne=new eT(l,X),[4,ne.render(V)];case 4:H=Qe.sent(),Qe.label=5;case 5:return(!((ve=e.removeContainer)!==null&&ve!==void 0)||ve)&&(Zp.destroy(x)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,H]}})})},uT=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Or(i,getComputedStyle(A.documentElement).backgroundColor):jA.TRANSPARENT,n=A.body?Or(i,getComputedStyle(A.body).backgroundColor):jA.TRANSPARENT,s=typeof t=="string"?Or(i,t):t===null?jA.TRANSPARENT:4294967295;return e===A.documentElement?ui(r)?ui(n)?s:n:r:s};const pT=new Set(["primitive","series","priceLine","decoration","textPrimitive","firstLine","secondLine","baseLine","parallelLine"]);function dT(i){const e={};for(const[t,A]of Object.entries(i))pT.has(t)||(e[t]=A);return e}function fT(i,e,t){if(!e)return;const A=`chart_drawings_${e}_${t||"default"}`;try{const r=i.map(dT);localStorage.setItem(A,JSON.stringify(r))}catch{}}function mT(i,e){if(!i)return[];const t=`chart_drawings_${i}_${e||"default"}`;try{const A=localStorage.getItem(t);if(!A)return[];const r=JSON.parse(A);return Array.isArray(r)?r:[]}catch{return[]}}function gT(i,e){if(!i)return;const t=`chart_drawings_${i}_${e||"default"}`;try{localStorage.removeItem(t)}catch{}}class ad{constructor(e,t,A="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=r,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,c=n._chart,h=n._series;if(!c||!h)return;const g=h.priceToCoordinate(n.price);if(g==null)return;const v=Math.round(g*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),F=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),T=o.bitmapSize.width;if(F>=T)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(F,v),l.lineTo(T,v),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(F,v,S,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ld{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!A.visible||!A.text||!A._series)return;const c=A._series.priceToCoordinate(A.price);if(c==null)return;const h=Math.round(A.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const g=Math.round(8*o),v=Math.round(14*l),x=s.width;let F;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const I=A._chart.timeScale().timeToCoordinate(A.originTime);F=I!=null?Math.round(I*o):g,n.textAlign="right"}else F=g,n.textAlign="left";else A.hAlign==="right"?(F=x-g,n.textAlign="right"):(F=x/2,n.textAlign="center");const T=Math.round(c*l);let S;A.vAlign==="top"?S=T-v:A.vAlign==="bottom"?S=T+v:S=T,n.fillStyle=A.textColor,n.fillText(A.text,F,S)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cd{constructor(e,t,A,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,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 c=s._chart,h=s._series;if(!c||!h)return;const g=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*g),Q=Math.round(T*v),N=Math.round(F*g),X=Math.round(S*v),H=l.context;if(H.save(),H.beginPath(),H.strokeStyle=s.color,H.lineWidth=s.lineWidth*v,H.setLineDash([]),H.moveTo(I,Q),H.lineTo(N,X),H.stroke(),H.beginPath(),H.fillStyle=s.color,H.arc(I,Q,3*v,0,Math.PI*2),H.fill(),H.beginPath(),H.arc(N,X,3*v,0,Math.PI*2),H.fill(),!s.statsShowAlways&&!s.isActive){H.restore();return}const{priceDiff:V,pricePct:ne,bars:Z,days:re,angle:R}=s.info,oe=V>=0?"+":"",le=[];if(s.statsPriceRange!==!1&&le.push(`${oe}${V.toFixed(5)} (${oe}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&le.push(`${Z} bars`),s.statsDateRange!==!1&&le.push(`${re} days`),s.statsAngle!==!1&&le.push(`∠ ${R.toFixed(1)}°`),s.statsDistance&&le.push(`Δ ${Math.abs(V).toFixed(5)}`),le.length===0){H.restore();return}const ee=Math.round(11*v);H.font=`${ee}px sans-serif`;const fe=ee*1.6,j=8*v,se=Math.max(...le.map(Ke=>H.measureText(Ke).width))+j*2,Ae=le.length*fe+j*2,ue=s.statsPosition??"right";let ae,Be;ue==="left"?(ae=I,Be=Q):ue==="center"?(ae=Math.round((I+N)/2),Be=Math.round((Q+X)/2)):(ae=N,Be=X);let be,xe;ue==="left"?(be=ae-se-10*g,xe=Be-Ae-4*v):ue==="center"?(be=ae-se/2,xe=Be-Ae-8*v):(be=ae+10*g,xe=Be-Ae-4*v);const me=l.bitmapSize.width,ve=l.bitmapSize.height,Qe=Math.min(Math.max(0,be),me-se-4*g),Ee=Math.min(Math.max(4*v,xe),ve-Ae-4*v),Me=4*v;H.beginPath(),H.moveTo(Qe+Me,Ee),H.lineTo(Qe+se-Me,Ee),H.quadraticCurveTo(Qe+se,Ee,Qe+se,Ee+Me),H.lineTo(Qe+se,Ee+Ae-Me),H.quadraticCurveTo(Qe+se,Ee+Ae,Qe+se-Me,Ee+Ae),H.lineTo(Qe+Me,Ee+Ae),H.quadraticCurveTo(Qe,Ee+Ae,Qe,Ee+Ae-Me),H.lineTo(Qe,Ee+Me),H.quadraticCurveTo(Qe,Ee,Qe+Me,Ee),H.closePath(),H.fillStyle="rgba(30, 41, 59, 0.92)",H.fill(),H.strokeStyle=s.statsColor||s.color,H.lineWidth=1*v,H.stroke(),H.fillStyle="#e2e8f0",H.textAlign="left",le.forEach((Ke,Re)=>{H.fillText(Ke,Qe+j,Ee+j+ee+Re*fe)}),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class nl{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const g=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*g),Q=Math.round(T*v),N=Math.round(F*g),X=Math.round(S*v),H=s.lineColor??s.color,V=l.context;if(V.save(),s.showArea&&(V.fillStyle=s.fillColor,V.fillRect(Math.min(I,N),Math.min(Q,X),Math.abs(N-I),Math.abs(X-Q)),V.strokeStyle=H,V.lineWidth=1*v,V.setLineDash([]),V.strokeRect(Math.min(I,N),Math.min(Q,X),Math.abs(N-I),Math.abs(X-Q))),V.beginPath(),V.strokeStyle=H,V.lineWidth=2*v,V.moveTo(I,Q),V.lineTo(N,X),V.stroke(),V.fillStyle=H,V.beginPath(),V.arc(I,Q,3*v,0,Math.PI*2),V.fill(),V.beginPath(),V.arc(N,X,3*v,0,Math.PI*2),V.fill(),!s.statsShowAlways&&!s.isActive){V.restore();return}const{priceDiff:ne,pricePct:Z,bars:re,days:R}=s.info,oe=ne>=0?"+":"",le=[];if(s.statsPriceRange&&le.push(oe+ne.toFixed(5)+" ("+oe+Z.toFixed(2)+"%)"),s.statsBarsRange&&le.push(re+" bars"),s.statsDateRange&&le.push(R+" days"),le.length===0){V.restore();return}const ee=Math.round(11*v);V.font=ee+"px sans-serif";const fe=ee*1.6,j=8*v,se=Math.max(...le.map(Qe=>V.measureText(Qe).width))+j*2,Ae=le.length*fe+j*2,ue=l.bitmapSize.width,ae=l.bitmapSize.height;let Be,be;if(s.statsPosition==="left")Be=I-se-10*g,be=Q-Ae-4*v;else if(s.statsPosition==="center"){const Qe=(I+N)/2,Ee=(Q+X)/2;Be=Qe-se/2,be=Ee-Ae-4*v}else Be=N+10*g,be=X-Ae-4*v;const xe=Math.min(Math.max(0,Be),ue-se-4*g),me=Math.min(Math.max(4*v,be),ae-Ae-4*v),ve=4*v;V.beginPath(),V.moveTo(xe+ve,me),V.lineTo(xe+se-ve,me),V.quadraticCurveTo(xe+se,me,xe+se,me+ve),V.lineTo(xe+se,me+Ae-ve),V.quadraticCurveTo(xe+se,me+Ae,xe+se-ve,me+Ae),V.lineTo(xe+ve,me+Ae),V.quadraticCurveTo(xe,me+Ae,xe,me+Ae-ve),V.lineTo(xe,me+ve),V.quadraticCurveTo(xe,me,xe+ve,me),V.closePath(),V.fillStyle="rgba(30, 41, 59, 0.92)",V.fill(),V.strokeStyle=s.statsColor||H,V.lineWidth=1*v,V.stroke(),V.fillStyle="#e2e8f0",V.textAlign="left",le.forEach((Qe,Ee)=>{V.fillText(Qe,xe+j,me+j+ee+Ee*fe)}),V.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.fillColor=A.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=Math.min(g,v)*c,S=Math.max(g,v)*c,I=Math.min(x,F)*h,Q=Math.max(x,F)*h,N=S-T,X=Q-I;if(N<.5||X<.5)return;const H=s.context;H.save(),H.fillStyle=r.fillColor,H.fillRect(T,I,N,X),H.strokeStyle=r.strokeColor,H.lineWidth=r.lineWidth*h,H.setLineDash([]),H.strokeRect(T,I,N,X),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ud{constructor(e,t,A={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=g*c,S=v*h,I=x*c,Q=F*h,N=Math.hypot(I-T,Q-S);if(N<.5)return;const X=s.context;X.save(),X.strokeStyle=r.strokeColor,X.lineWidth=r.lineWidth*h,X.setLineDash([]),X.beginPath(),X.arc(T,S,N,0,Math.PI*2),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class pd{constructor(e,t,A,r={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.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,c=n._series;if(!l||!c)return;const h=o.horizontalPixelRatio,g=o.verticalPixelRatio,v=l.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),F=l.timeScale().timeToCoordinate(n.p2.rawTime),T=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),I=c.priceToCoordinate(n.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*h,N=x*g,X=F*h,H=T*g,V=S*h,ne=I*g,Z=o.context;Z.save(),Z.beginPath(),Z.moveTo(Q,N),Z.lineTo(X,H),Z.lineTo(V,ne),Z.closePath(),Z.fillStyle=n.fillColor,Z.fill(),Z.strokeStyle=n.strokeColor,Z.lineWidth=n.lineWidth*g,Z.setLineDash([]),Z.stroke(),Z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.minorRatio=A.minorRatio??.45,this.previewAsLine=A.previewAsLine??!1,this.visible=!0,this.strokeColor=A.strokeColor??"#7aa6ae",this.lineWidth=A.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=g*c,S=v*h,I=x*c,Q=F*h,N=I-T,X=Q-S,H=Math.hypot(N,X);if(H<.5)return;const V=s.context;if(V.save(),V.strokeStyle=r.strokeColor,V.lineWidth=r.lineWidth*h,V.setLineDash([]),r.previewAsLine)V.beginPath(),V.moveTo(T,S),V.lineTo(I,Q),V.stroke();else{const ne=(T+I)/2,Z=(S+Q)/2,re=Math.atan2(X,N),R=H/2,oe=Math.max(1,R*Math.max(.05,r.minorRatio));V.beginPath(),V.ellipse(ne,Z,R,oe,re,0,Math.PI*2),V.stroke()}V.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sl{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#f59e0b",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight!==!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=Math.round(g*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,X=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const V=Math.abs(N)<1e-4?0:X/N;if(r.rayLeft){const le=S+V*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const oe=s.bitmapSize.width,le=Q+V*(oe-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const ne=Math.atan2(Q-S,I-T),Z=(r.lineWidth*4+4)*h,re=Math.PI/7;if(r.arrowRight){const oe=I-Z*Math.cos(ne-re),le=Q-Z*Math.sin(ne-re),ee=I-Z*Math.cos(ne+re),fe=Q-Z*Math.sin(ne+re);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.lineTo(ee,fe),H.closePath(),H.fill()}if(r.arrowLeft){const oe=ne+Math.PI,le=T-Z*Math.cos(oe-re),ee=S-Z*Math.sin(oe-re),fe=T-Z*Math.cos(oe+re),j=S-Z*Math.sin(oe+re);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(fe,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const oe=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,fe=r.p2.price,j=[];if(r.statsPriceRange){const Ae=Math.abs(fe-ee),ue=ee!==0?Math.abs((fe-ee)/ee*100):0,ae=Ae<1e-4?6:Ae<.01?5:Ae<1?4:2;j.push("↕ "+Ae.toFixed(ae)+" ("+ue.toFixed(2)+"%)")}const se=[];if(r.statsBarsRange)try{const Ae=o.timeScale().timeToCoordinate(oe),ue=o.timeScale().timeToCoordinate(le);if(Ae!=null&&ue!=null){const ae=o.timeScale().coordinateToLogical(Ae),Be=o.timeScale().coordinateToLogical(ue);ae!=null&&Be!=null&&se.push("↔ "+Math.abs(Math.round(Be-ae))+" bars")}}catch{}if(r.statsDateRange){const Ae=Math.abs(le-oe),ue=Math.floor(Ae/86400),ae=Math.floor(Ae%86400/3600),Be=Math.floor(Ae%3600/60);let be=ue>0?ue+" day"+(ue!==1?"s":""):"";ae>0&&(be+=(be?" ":"")+ae+" hour"+(ae!==1?"s":"")),!ue&&!ae&&(be=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&se.length>0?se[se.length-1]+=" ("+be+")":se.push(be)}if(r.statsDistance){const Ae=N/c,ue=X/h;se.push("distance: "+Math.sqrt(Ae*Ae+ue*ue).toFixed(2))}if(se.length>0&&j.push(se.join(", ")),r.statsAngle){const Ae=N/c,ue=X/h,ae=Math.atan2(ue,Ae)*180/Math.PI;j.push("∠ "+ae.toFixed(0)+"°")}if(j.length>0){const Ae=Math.min(c,h),ue=11*Ae,ae=ue*1.5,Be=5*Ae;H.font=ue+"px sans-serif";const xe=j.reduce((At,Fe)=>Math.max(At,H.measureText(Fe).width),0)+Be*2,me=j.length*ae+Be*2,[ve,Qe,Ee,Me]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ke,Re;r.statsPosition==="left"?(Ke=ve,Re=Qe):r.statsPosition==="center"?(Ke=(ve+Ee)/2,Re=(Qe+Me)/2):(Ke=Ee,Re=Me);const $e=Ke-xe/2,Ce=Re-me-12*Ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect($e,Ce,xe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*Ae,H.strokeRect($e,Ce,xe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((At,Fe)=>{H.fillText(At,$e+Be,Ce+Be+Fe*ae)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class fd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=Math.round(g*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,X=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const V=Math.abs(N)<1e-4?0:X/N;if(r.rayLeft){const le=S+V*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const oe=s.bitmapSize.width,le=Q+V*(oe-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const ne=Math.atan2(Q-S,I-T),Z=(r.lineWidth*4+4)*h,re=Math.PI/7;if(r.arrowRight){const oe=I-Z*Math.cos(ne-re),le=Q-Z*Math.sin(ne-re),ee=I-Z*Math.cos(ne+re),fe=Q-Z*Math.sin(ne+re);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.lineTo(ee,fe),H.closePath(),H.fill()}if(r.arrowLeft){const oe=ne+Math.PI,le=T-Z*Math.cos(oe-re),ee=S-Z*Math.sin(oe-re),fe=T-Z*Math.cos(oe+re),j=S-Z*Math.sin(oe+re);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(fe,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const oe=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,fe=r.p2.price,j=[];if(r.statsPriceRange){const Ae=Math.abs(fe-ee),ue=ee!==0?Math.abs((fe-ee)/ee*100):0,ae=Ae<1e-4?6:Ae<.01?5:Ae<1?4:2;j.push("↕ "+Ae.toFixed(ae)+" ("+ue.toFixed(2)+"%)")}const se=[];if(r.statsBarsRange)try{const Ae=o.timeScale().timeToCoordinate(oe),ue=o.timeScale().timeToCoordinate(le);if(Ae!=null&&ue!=null){const ae=o.timeScale().coordinateToLogical(Ae),Be=o.timeScale().coordinateToLogical(ue);ae!=null&&Be!=null&&se.push("↔ "+Math.abs(Math.round(Be-ae))+" bars")}}catch{}if(r.statsDateRange){const Ae=Math.abs(le-oe),ue=Math.floor(Ae/86400),ae=Math.floor(Ae%86400/3600),Be=Math.floor(Ae%3600/60);let be=ue>0?ue+" day"+(ue!==1?"s":""):"";ae>0&&(be+=(be?" ":"")+ae+" hour"+(ae!==1?"s":"")),!ue&&!ae&&(be=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&se.length>0?se[se.length-1]+=" ("+be+")":se.push(be)}if(r.statsDistance){const Ae=N/c,ue=X/h;se.push("distance: "+Math.sqrt(Ae*Ae+ue*ue).toFixed(2))}if(se.length>0&&j.push(se.join(", ")),r.statsAngle){const Ae=N/c,ue=X/h,ae=Math.atan2(ue,Ae)*180/Math.PI;j.push("∠ "+ae.toFixed(0)+"°")}if(j.length>0){const Ae=Math.min(c,h),ue=11*Ae,ae=ue*1.5,Be=5*Ae;H.font=ue+"px sans-serif";const xe=j.reduce((At,Fe)=>Math.max(At,H.measureText(Fe).width),0)+Be*2,me=j.length*ae+Be*2,[ve,Qe,Ee,Me]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ke,Re;r.statsPosition==="left"?(Ke=ve,Re=Qe):r.statsPosition==="center"?(Ke=(ve+Ee)/2,Re=(Qe+Me)/2):(Ke=Ee,Re=Me);const $e=Ke-xe/2,Ce=Re-me-12*Ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect($e,Ce,xe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*Ae,H.strokeRect($e,Ce,xe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((At,Fe)=>{H.fillText(At,$e+Be,Ce+Be+Fe*ae)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class md{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft!==!1,this.rayRight=A.rayRight!==!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsBarsRange=A.statsBarsRange??!1,this.statsDateRange=A.statsDateRange??!1,this.statsAngle=A.statsAngle??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=Math.round(g*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,X=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const V=Math.abs(N)<1e-4?0:X/N;if(r.rayLeft){const le=S+V*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const oe=s.bitmapSize.width,le=Q+V*(oe-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const ne=Math.atan2(Q-S,I-T),Z=(r.lineWidth*4+4)*h,re=Math.PI/7;if(r.arrowRight){const oe=I-Z*Math.cos(ne-re),le=Q-Z*Math.sin(ne-re),ee=I-Z*Math.cos(ne+re),fe=Q-Z*Math.sin(ne+re);H.beginPath(),H.moveTo(I,Q),H.lineTo(oe,le),H.lineTo(ee,fe),H.closePath(),H.fill()}if(r.arrowLeft){const oe=ne+Math.PI,le=T-Z*Math.cos(oe-re),ee=S-Z*Math.sin(oe-re),fe=T-Z*Math.cos(oe+re),j=S-Z*Math.sin(oe+re);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(fe,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const oe=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,fe=r.p2.price,j=[];if(r.statsPriceRange){const Ae=Math.abs(fe-ee),ue=ee!==0?Math.abs((fe-ee)/ee*100):0,ae=Ae<1e-4?6:Ae<.01?5:Ae<1?4:2;j.push("↕ "+Ae.toFixed(ae)+" ("+ue.toFixed(2)+"%)")}const se=[];if(r.statsBarsRange)try{const Ae=o.timeScale().timeToCoordinate(oe),ue=o.timeScale().timeToCoordinate(le);if(Ae!=null&&ue!=null){const ae=o.timeScale().coordinateToLogical(Ae),Be=o.timeScale().coordinateToLogical(ue);ae!=null&&Be!=null&&se.push("↔ "+Math.abs(Math.round(Be-ae))+" bars")}}catch{}if(r.statsDateRange){const Ae=Math.abs(le-oe),ue=Math.floor(Ae/86400),ae=Math.floor(Ae%86400/3600),Be=Math.floor(Ae%3600/60);let be=ue>0?ue+" day"+(ue!==1?"s":""):"";ae>0&&(be+=(be?" ":"")+ae+" hour"+(ae!==1?"s":"")),!ue&&!ae&&(be=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&se.length>0?se[se.length-1]+=" ("+be+")":se.push(be)}if(r.statsDistance){const Ae=N/c,ue=X/h;se.push("distance: "+Math.sqrt(Ae*Ae+ue*ue).toFixed(2))}if(se.length>0&&j.push(se.join(", ")),r.statsAngle){const Ae=N/c,ue=X/h,ae=Math.atan2(ue,Ae)*180/Math.PI;j.push("∠ "+ae.toFixed(0)+"°")}if(j.length>0){const Ae=Math.min(c,h),ue=11*Ae,ae=ue*1.5,Be=5*Ae;H.font=ue+"px sans-serif";const xe=j.reduce((At,Fe)=>Math.max(At,H.measureText(Fe).width),0)+Be*2,me=j.length*ae+Be*2,[ve,Qe,Ee,Me]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ke,Re;r.statsPosition==="left"?(Ke=ve,Re=Qe):r.statsPosition==="center"?(Ke=(ve+Ee)/2,Re=(Qe+Me)/2):(Ke=Ee,Re=Me);const $e=Ke-xe/2,Ce=Re-me-12*Ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect($e,Ce,xe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*Ae,H.strokeRect($e,Ce,xe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((At,Fe)=>{H.fillText(At,$e+Be,Ce+Be+Fe*ae)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class gd{constructor(e,t,A="#22c55e",r=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,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.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const h=n._chart,g=n._series;if(!h||!g)return;const v=o.horizontalPixelRatio,x=o.verticalPixelRatio,F=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),T=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=g.priceToCoordinate(n.p1.price),I=g.priceToCoordinate(n.p2.price);if(F==null||T==null||S==null||I==null)return;const Q=F*v,N=S*x,X=T*v,H=I*x,[V,ne,Z,re]=Q<=X?[Q,N,X,H]:[X,H,Q,N];let R=Z-V,oe=re-ne;Math.abs(R)<1e-4&&(R=1e-4);const le=oe/R,ee=o.context;if(ee.save(),ee.strokeStyle=n.color,ee.fillStyle=n.color,ee.lineWidth=n.lineWidth*x,ee.setLineDash([]),n.rayLeft){const ue=ne+le*(0-V);ee.beginPath(),ee.moveTo(0,ue),ee.lineTo(V,ne),ee.stroke()}if(n.rayRight){const Ae=o.bitmapSize.width,ue=re+le*(Ae-Z);ee.beginPath(),ee.moveTo(Z,re),ee.lineTo(Ae,ue),ee.stroke()}const fe=Math.atan2(oe,R),j=(n.lineWidth*4+4)*x,se=Math.PI/7;if(n.arrowRight){const Ae=Z-j*Math.cos(fe-se),ue=re-j*Math.sin(fe-se),ae=Z-j*Math.cos(fe+se),Be=re-j*Math.sin(fe+se);ee.beginPath(),ee.moveTo(Z,re),ee.lineTo(Ae,ue),ee.lineTo(ae,Be),ee.closePath(),ee.fill()}if(n.arrowLeft){const Ae=fe+Math.PI,ue=V-j*Math.cos(Ae-se),ae=ne-j*Math.sin(Ae-se),Be=V-j*Math.cos(Ae+se),be=ne-j*Math.sin(Ae+se);ee.beginPath(),ee.moveTo(V,ne),ee.lineTo(ue,ae),ee.lineTo(Be,be),ee.closePath(),ee.fill()}if(c){const Ae=n.p1.rawTime??n.p1.time,ue=n.p2.rawTime??n.p2.time,ae=n.p1.price,Be=n.p2.price,be=[];if(n.statsPriceRange){const me=Math.abs(Be-ae),ve=ae!==0?Math.abs((Be-ae)/ae*100):0,Qe=me<1e-4?6:me<.01?5:me<1?4:2;be.push("↕ "+me.toFixed(Qe)+" ("+ve.toFixed(2)+"%)")}const xe=[];if(n.statsBarsRange)try{const me=h.timeScale().timeToCoordinate(Ae),ve=h.timeScale().timeToCoordinate(ue);if(me!=null&&ve!=null){const Qe=h.timeScale().coordinateToLogical(me),Ee=h.timeScale().coordinateToLogical(ve);Qe!=null&&Ee!=null&&xe.push("↔ "+Math.abs(Math.round(Ee-Qe))+" bars")}}catch{}if(n.statsDateRange){const me=Math.abs(ue-Ae),ve=Math.floor(me/86400),Qe=Math.floor(me%86400/3600),Ee=Math.floor(me%3600/60);let Me=ve>0?ve+" day"+(ve!==1?"s":""):"";Qe>0&&(Me+=(Me?" ":"")+Qe+" hour"+(Qe!==1?"s":"")),!ve&&!Qe&&(Me=Ee+" min"+(Ee!==1?"s":"")),n.statsBarsRange&&xe.length>0?xe[xe.length-1]+=" ("+Me+")":xe.push(Me)}if(n.statsDistance){const me=(X-Q)/v,ve=(H-N)/x;xe.push("distance: "+Math.sqrt(me*me+ve*ve).toFixed(2))}if(xe.length>0&&be.push(xe.join(", ")),n.statsAngle){const me=R/v,ve=oe/x,Qe=Math.atan2(ve,me)*180/Math.PI;be.push("∠ "+Qe.toFixed(0)+"°")}if(be.length>0){const me=Math.min(v,x),ve=11*me,Qe=ve*1.5,Ee=5*me;ee.font=ve+"px sans-serif";const Ke=be.reduce((Ie,dt)=>Math.max(Ie,ee.measureText(dt).width),0)+Ee*2,Re=be.length*Qe+Ee*2;let $e,Ce;n.statsPosition==="left"?($e=V,Ce=ne):n.statsPosition==="center"?($e=(V+Z)/2,Ce=(ne+re)/2):($e=Z,Ce=re);const At=$e-Ke/2,Fe=Ce-Re-12*me;ee.fillStyle="rgba(20, 20, 30, 0.72)",ee.fillRect(At,Fe,Ke,Re),ee.strokeStyle=n.statsColor,ee.lineWidth=1*me,ee.strokeRect(At,Fe,Ke,Re),ee.fillStyle=n.statsColor,ee.textBaseline="top",ee.textAlign="left",be.forEach((Ie,dt)=>{ee.fillText(Ie,At+Ee,Fe+Ee+dt*Qe)})}}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wd{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=s.timeScale().timeToCoordinate(A.center.rawTime),g=o.priceToCoordinate(A.center.price);if(h==null||g==null)return;const v=Math.round(h*l),x=Math.round(g*c),F=n.bitmapSize.width,T=n.bitmapSize.height,S=n.context;if(S.save(),S.strokeStyle=A.color,S.lineWidth=A.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,x),S.lineTo(F,x),S.stroke(),S.beginPath(),S.moveTo(v,0),S.lineTo(v,T),S.stroke(),A.showPrice){const I=A.center.price.toFixed(5),Q=Math.round(11*c);S.font=Q+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="left";const N=S.measureText(I).width,X=Math.round(6*l),H=Math.round(3*c),V=Q+2*H,ne=N+2*X,Z=F-ne-Math.round(2*l),re=x-V/2;S.fillStyle=A.color,S.fillRect(Z,re,ne,V),S.fillStyle="#ffffff",S.fillText(I,Z+X,x)}if(A.showTime){const I=A.center.rawTime,Q=new Date(I*1e3),N=ee=>String(ee).padStart(2,"0"),X=N(Q.getUTCDate())+"."+N(Q.getUTCMonth()+1)+"."+Q.getUTCFullYear()+" "+N(Q.getUTCHours())+":"+N(Q.getUTCMinutes())+":"+N(Q.getUTCSeconds()),H=Math.round(11*c);S.font=H+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const V=S.measureText(X).width,ne=Math.round(6*l),Z=Math.round(3*c),re=H+2*Z,R=V+2*ne,oe=v-R/2,le=T-re-Math.round(4*c);S.fillStyle=A.color,S.fillRect(oe,le,R,re),S.fillStyle="#ffffff",S.fillText(X,v,le+re/2)}S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Bd{constructor(e,t,A={}){this.p1=e,this.p2=t,this.color=A.color??"#7aa6ae",this.lineWidth=A.lineWidth??2,this.arrowLeft=A.arrowLeft??!1,this.arrowRight=A.arrowRight??!1,this.rayLeft=A.rayLeft??!1,this.rayRight=A.rayRight??!1,this.statsShowAlways=A.statsShowAlways??!1,this.statsColor=A.statsColor??"#5f8f96",this.statsPosition=A.statsPosition??"right",this.statsPriceRange=A.statsPriceRange??!1,this.statsDistance=A.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(g==null||v==null||x==null||F==null)return;const T=g*c,S=x*h,I=v*c,Q=F*h,N=T-I,X=S-Q,H=I-T,V=Q-S;if(Math.hypot(N,X)<1e-4)return;const Z=Math.atan2(X,N),re=Math.round(Math.abs(Z*180/Math.PI)),R=s.context;R.save(),R.strokeStyle=r.color,R.fillStyle=r.color,R.lineWidth=r.lineWidth*h,R.setLineDash([]);const oe=Math.abs(H)<1e-4?0:V/H;if(r.rayLeft){const Be=S+oe*(0-T);R.beginPath(),R.moveTo(0,Be),R.lineTo(T,S),R.stroke()}if(r.rayRight){const ae=s.bitmapSize.width,Be=Q+oe*(ae-I);R.beginPath(),R.moveTo(I,Q),R.lineTo(ae,Be),R.stroke()}R.beginPath(),R.moveTo(T,S),R.lineTo(I,Q),R.stroke();const le=Math.atan2(V,H),ee=(r.lineWidth*4+4)*h,fe=Math.PI/7;if(r.arrowRight){const ae=I-ee*Math.cos(le-fe),Be=Q-ee*Math.sin(le-fe),be=I-ee*Math.cos(le+fe),xe=Q-ee*Math.sin(le+fe);R.beginPath(),R.moveTo(I,Q),R.lineTo(ae,Be),R.lineTo(be,xe),R.closePath(),R.fill()}if(r.arrowLeft){const ae=le+Math.PI,Be=T-ee*Math.cos(ae-fe),be=S-ee*Math.sin(ae-fe),xe=T-ee*Math.cos(ae+fe),me=S-ee*Math.sin(ae+fe);R.beginPath(),R.moveTo(T,S),R.lineTo(Be,be),R.lineTo(xe,me),R.closePath(),R.fill()}const j=28*h;R.strokeStyle="rgba(122,166,174,0.55)",R.fillStyle=r.color,R.lineWidth=1*h,R.beginPath(),R.moveTo(I,Q),R.lineTo(I+j,Q),R.stroke(),R.beginPath(),R.strokeStyle="rgba(122,166,174,0.45)",R.arc(I,Q,j,0,Z,Z<0),R.stroke(),R.fillStyle="#4b7c86",R.font=`${Math.round(10*h)}px sans-serif`,R.textAlign="left",R.textBaseline="middle";const se=I+(j+10*h)*Math.cos(Z/2),Ae=Q+(j+10*h)*Math.sin(Z/2);if(R.fillText(`${re}°`,se,Ae),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const ae=r.p1.price,Be=r.p2.price,be=[];if(r.statsPriceRange){const me=Math.abs(Be-ae),ve=ae!==0?Math.abs((Be-ae)/ae*100):0,Qe=me<1e-4?6:me<.01?5:me<1?4:2;be.push("↕ "+me.toFixed(Qe)+" ("+ve.toFixed(2)+"%)")}const xe=[];if(r.statsDistance){const me=H/c,ve=V/h;xe.push("distance: "+Math.sqrt(me*me+ve*ve).toFixed(2))}if(xe.length>0&&be.push(xe.join(", ")),be.length>0){const me=Math.min(c,h),ve=11*me,Qe=ve*1.5,Ee=5*me;R.font=ve+"px sans-serif";const Ke=be.reduce((Pe,we)=>Math.max(Pe,R.measureText(we).width),0)+Ee*2,Re=be.length*Qe+Ee*2,[$e,Ce,At,Fe]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ie,dt;r.statsPosition==="left"?(Ie=$e,dt=Ce):r.statsPosition==="center"?(Ie=($e+At)/2,dt=(Ce+Fe)/2):(Ie=At,dt=Fe);const lt=Ie-Ke/2,Xe=dt-Re-12*me;R.fillStyle="rgba(20, 20, 30, 0.72)",R.fillRect(lt,Xe,Ke,Re),R.strokeStyle=r.statsColor,R.lineWidth=1*me,R.strokeRect(lt,Xe,Ke,Re),R.fillStyle=r.statsColor,R.textBaseline="top",R.textAlign="left",be.forEach((Pe,we)=>{R.fillText(Pe,lt+Ee,Xe+Ee+we*Qe)})}}R.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class yd{constructor(e,t,A){this.p1=e,this.p2=t,this.p3=A,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 r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),I=l.priceToCoordinate(r.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*c,N=x*h,X=F*c,H=T*h,V=S*c,ne=I*h,Z=(X+V)/2,re=(H+ne)/2;let R=Z-Q,oe=re-N;Math.abs(R)<1e-4&&(R=1e-4);const le=oe/R,ee=s.bitmapSize.width,fe=(X-V)/2,j=(H-ne)/2,se=me=>({x:Z+fe*me,y:re+j*me}),Ae=(me,ve)=>({x:ee,y:ve+le*(ee-me)}),ue=se(1),ae=se(-1),Be=Ae(ue.x,ue.y),be=Ae(ae.x,ae.y);g.save(),g.beginPath(),g.moveTo(ue.x,ue.y),g.lineTo(Be.x,Be.y),g.lineTo(be.x,be.y),g.lineTo(ae.x,ae.y),g.closePath(),g.fillStyle="rgba(148, 163, 184, 0.2)",g.fill(),g.beginPath(),g.strokeStyle="rgba(148, 163, 184, 0.9)",g.lineWidth=1*h,g.moveTo(X,H),g.lineTo(V,ne),g.stroke(),r._levels.forEach(me=>{const ve=se(me.k),Qe=Ae(ve.x,ve.y);g.beginPath(),g.strokeStyle=me.color,g.lineWidth=me.width*h,g.moveTo(ve.x,ve.y),g.lineTo(Qe.x,Qe.y),g.stroke()});const xe=Ae(Q,N);g.beginPath(),g.strokeStyle="rgba(161, 98, 7, 0.9)",g.lineWidth=1.1*h,g.moveTo(Q,N),g.lineTo(xe.x,xe.y),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Cd{constructor(e,t){this.p1=e,this.p2=t,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 A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,g=s.timeScale().timeToCoordinate(A.p1.rawTime),v=o.priceToCoordinate(A.p1.price),x=s.timeScale().timeToCoordinate(A.p2.rawTime),F=o.priceToCoordinate(A.p2.price);if(g==null||v==null||x==null||F==null)return;const T=g*l,S=v*c,I=x*l,Q=F*c,N=n.bitmapSize.width,X=Math.abs(I-T)<1e-4?1:I-T,H=(Q-S)/X,V=I>=T?1:-1,ne=V>0?N:0,Z=T+V*Math.min(220*l,Math.max(80*l,N*.35)),re=A._rays.map(oe=>{const le=H*oe.ratio;return{...oe,yEnd:S+le*(ne-T),yLabel:S+le*(Z-T)}});h.save();const R=(oe,le,ee)=>{!oe||!le||(h.beginPath(),h.moveTo(T,S),h.lineTo(ne,oe.yEnd),h.lineTo(ne,le.yEnd),h.closePath(),h.fillStyle=ee,h.fill())};R(re[0],re[3],"rgba(161, 98, 7, 0.10)"),R(re[3],re[4],"rgba(5, 150, 105, 0.10)"),R(re[4],re[5],"rgba(107, 114, 128, 0.12)"),re.forEach(oe=>{h.beginPath(),h.strokeStyle=oe.color,h.lineWidth=1*c,h.moveTo(T,S),h.lineTo(ne,oe.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=V>0?"left":"right",h.textBaseline="middle",re.forEach(oe=>{h.fillStyle=oe.color;const le=Z+(V>0?4*l:-4*l),ee=oe.yLabel;ee<-20||ee>n.bitmapSize.height+20||h.fillText(oe.label,le,ee)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,A=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,A),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,g=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(v==null||x==null||F==null||T==null)return;const S=v*c,I=x*h,Q=F*c,N=T*h,X=Q-S,H=N-I,V=Math.hypot(X,H);if(V<1e-4)return;const ne=X/V,Z=H/V,re=-Z,R=ne,oe=Q+re*V,le=N+R*V,ee=S+re*V,fe=I+R*V,j=(Ae,ue)=>({x:S+ne*V*Ae+re*V*ue,y:I+Z*V*Ae+R*V*ue});g.save();const se=["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 Ae=0;Ae<r.divisions;Ae++){const ue=Ae/r.divisions,ae=(Ae+1)/r.divisions,Be=j(0,ue),be=j(1,ue),xe=j(1,ae),me=j(0,ae);g.beginPath(),g.moveTo(Be.x,Be.y),g.lineTo(be.x,be.y),g.lineTo(xe.x,xe.y),g.lineTo(me.x,me.y),g.closePath(),g.fillStyle=se[Ae%se.length],g.fill()}g.lineWidth=1*h,g.strokeStyle="rgba(148, 163, 184, 0.55)";for(let Ae=0;Ae<=r.divisions;Ae++){const ue=Ae/r.divisions,ae=j(0,ue),Be=j(1,ue),be=j(ue,0),xe=j(ue,1);g.beginPath(),g.moveTo(ae.x,ae.y),g.lineTo(Be.x,Be.y),g.stroke(),g.beginPath(),g.moveTo(be.x,be.y),g.lineTo(xe.x,xe.y),g.stroke()}g.strokeStyle="rgba(100, 116, 139, 0.85)",g.lineWidth=1*h,g.beginPath(),g.moveTo(S,I),g.lineTo(oe,le),g.stroke(),g.beginPath(),g.moveTo(Q,N),g.lineTo(ee,fe),g.stroke(),g.strokeStyle="rgba(122, 166, 174, 0.95)",g.lineWidth=1.2*h,g.beginPath(),g.moveTo(S,I),g.lineTo(Q,N),g.lineTo(oe,le),g.lineTo(ee,fe),g.closePath(),g.stroke(),g.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ks{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:h=!0,showPrices:g=!0,pricesColor:v="#129f5c",rayLeft:x=!1,rayRight:F=!1,arrowLeft:T=!1,arrowRight:S=!1}=n;this.p1=e,this.p2=t,this.p3=A,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=h,this.showPrices=g,this.pricesColor=v,this.rayLeft=x,this.rayRight=F,this.arrowLeft=T,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const I=this;this._paneView={renderer(){return{draw(Q){Q.useBitmapCoordinateSpace(N=>{if(!I.visible)return;const X=I._chart,H=I._series;if(!X||!H)return;const V=N.horizontalPixelRatio,ne=N.verticalPixelRatio,Z=[I.p1,I.p3,I.p4,I.p2].map(Re=>{const $e=X.timeScale().timeToCoordinate(Re.rawTime),Ce=H.priceToCoordinate(Re.price);return $e==null||Ce==null?null:{x:$e*V,y:Ce*ne}}).filter(Boolean);if(Z.length!==4)return;const[re,R,oe,le]=Z,ee=N.context;ee.save();const fe=R.x-re.x,j=R.y-re.y,se=Math.sqrt(fe*fe+j*j)||1,Ae=fe/se,ue=j/se,ae=oe.x-le.x,Be=oe.y-le.y,be=Math.sqrt(ae*ae+Be*Be)||1,xe=ae/be,me=Be/be,ve=1e5,Qe=I.rayLeft?{x:re.x-Ae*ve,y:re.y-ue*ve}:re,Ee=I.rayRight?{x:R.x+Ae*ve,y:R.y+ue*ve}:R,Me=I.rayLeft?{x:le.x-xe*ve,y:le.y-me*ve}:le,Ke=I.rayRight?{x:oe.x+xe*ve,y:oe.y+me*ve}:oe;if(I.showBackground){const Re=I.fillColor||"#6aa84f",$e=parseInt(Re.slice(1,3),16),Ce=parseInt(Re.slice(3,5),16),At=parseInt(Re.slice(5,7),16);ee.beginPath(),ee.moveTo(re.x,re.y),ee.lineTo(R.x,R.y),ee.lineTo(oe.x,oe.y),ee.lineTo(le.x,le.y),ee.closePath(),ee.fillStyle=`rgba(${$e},${Ce},${At},${I.fillOpacity??.1})`,ee.fill()}if(ee.strokeStyle=I.lineColor,ee.lineWidth=I.lineWidth*ne,ee.setLineDash([]),ee.beginPath(),ee.moveTo(Qe.x,Qe.y),ee.lineTo(Ee.x,Ee.y),ee.moveTo(Me.x,Me.y),ee.lineTo(Ke.x,Ke.y),ee.moveTo(re.x,re.y),ee.lineTo(le.x,le.y),ee.moveTo(R.x,R.y),ee.lineTo(oe.x,oe.y),ee.stroke(),I.arrowLeft||I.arrowRight){const Re=8*ne,$e=(Ce,At,Fe)=>{ee.save(),ee.translate(Ce,At),ee.rotate(Fe),ee.beginPath(),ee.moveTo(0,0),ee.lineTo(-Re,-Re/2),ee.lineTo(-Re,Re/2),ee.closePath(),ee.fillStyle=I.lineColor,ee.fill(),ee.restore()};I.arrowLeft&&($e(Qe.x,Qe.y,Math.atan2(-ue,-Ae)),$e(Me.x,Me.y,Math.atan2(-me,-xe))),I.arrowRight&&($e(Ee.x,Ee.y,Math.atan2(ue,Ae)),$e(Ke.x,Ke.y,Math.atan2(me,xe)))}if(ee.fillStyle="#ffffff",ee.strokeStyle="#3b82f6",ee.lineWidth=2*ne,[re,R,oe,le].forEach(Re=>{ee.beginPath(),ee.arc(Re.x,Re.y,6*ne,0,Math.PI*2),ee.fill(),ee.stroke()}),I.showPrices){const Re=[I.p1,I.p3,I.p2,I.p4],$e=[re,R,le,oe];ee.fillStyle=I.pricesColor||I.lineColor,ee.font=`${Math.round(10*ne)}px sans-serif`,ee.textAlign="left",ee.textBaseline="middle",$e.forEach((Ce,At)=>{const Fe=Re[At]?.price;typeof Fe=="number"&&ee.fillText(Fe.toFixed(5),Ce.x+8*V,Ce.y)})}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ol extends ks{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class al{constructor(e,t,A,r,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=r,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(c=>{if(!o.visible)return;const h=o._chart,g=o._series;if(!h||!g)return;const v=c.horizontalPixelRatio,x=c.verticalPixelRatio,F=c.context,T=X=>{const H=h.timeScale().timeToCoordinate(X.rawTime),V=g.priceToCoordinate(X.price);return H==null||V==null?null:{x:H*v,y:V*x}},S=T(o.p1),I=T(o.p2),Q=T(o.b2),N=T(o.b1);!S||!I||!Q||!N||(F.save(),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.lineTo(Q.x,Q.y),F.lineTo(N.x,N.y),F.closePath(),F.fillStyle=o.fillColor,F.fill(),F.strokeStyle=o.strokeColor,F.lineWidth=o.lineWidth*x,F.setLineDash([]),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.stroke(),F.beginPath(),F.moveTo(N.x,N.y),F.lineTo(Q.x,Q.y),F.stroke(),F.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ns{constructor(e,t,A,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=r,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(c){c.useBitmapCoordinateSpace(h=>{if(!l.visible)return;const g=l._chart,v=l._series;if(!g||!v)return;const x=h.horizontalPixelRatio,F=h.verticalPixelRatio,T=h.context,S=Z=>{const re=g.timeScale().timeToCoordinate(Z.rawTime),R=v.priceToCoordinate(Z.price);return re==null||R==null?null:{x:re*x,y:R*F}},I=S(l.mid1),Q=S(l.mid2),N=S(l.top1),X=S(l.top2),H=S(l.bot1),V=S(l.bot2);if(!I||!Q||!N||!X||!H||!V)return;T.save(),T.beginPath(),T.moveTo(I.x,I.y),T.lineTo(Q.x,Q.y),T.lineTo(X.x,X.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=l.upperFillColor,T.fill(),T.beginPath(),T.moveTo(H.x,H.y),T.lineTo(V.x,V.y),T.lineTo(Q.x,Q.y),T.lineTo(I.x,I.y),T.closePath(),T.fillStyle=l.lowerFillColor,T.fill();const ne=(Z,re,R)=>{T.beginPath(),T.strokeStyle=R,T.lineWidth=l.lineWidth*F,T.setLineDash([]),T.moveTo(Z.x,Z.y),T.lineTo(re.x,re.y),T.stroke()};if(ne(N,X,l.upperStrokeColor),ne(I,Q,l.centerStrokeColor),ne(H,V,l.lowerStrokeColor),l.showDeviationLabel){const Z=Math.abs(l.top1.price-l.mid1.price),re=Number.isFinite(Z)?Z.toFixed(5):null;if(re){const R=Math.max(10,Math.round(10*F));T.fillStyle=l.labelColor,T.font=`${R}px sans-serif`,T.textAlign="left",T.textBaseline="top",T.fillText(re,H.x+2*x,H.y+10*F)}}T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ll extends Ns{}class cl{constructor(e,t){this.p1=e,this.p2=t,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 A=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,g=n.bitmapSize.width;n.bitmapSize.height;const v=A.p1.price,x=A.p2.price,F=v-x,T=Z=>x+F*Z,S=s.timeScale().timeToCoordinate(A.p1.rawTime),I=s.timeScale().timeToCoordinate(A.p2.rawTime),Q=o.priceToCoordinate(v),N=o.priceToCoordinate(x),X=S!=null&&I!=null?Math.round(Math.min(S,I)*l):0,H=S!=null&&I!=null?Math.round(Math.max(S,I)*l):g,V=H-X;h.save(),A._zoneFills.forEach(({from:Z,to:re,color:R})=>{const oe=T(Z),le=T(re),ee=o.priceToCoordinate(oe),fe=o.priceToCoordinate(le);if(ee==null||fe==null)return;const j=Math.round(ee*c),se=Math.round(fe*c);h.fillStyle=R,h.fillRect(X,Math.min(j,se),V,Math.abs(se-j))}),A._levels.forEach(({ratio:Z,label:re})=>{const R=T(Z),oe=o.priceToCoordinate(R);if(oe==null)return;const le=Math.round(oe*c),ee=A._levelColors[Z]||"#888888";h.beginPath(),h.strokeStyle=ee,h.lineWidth=Z===0||Z===1?1.5*c:1*c,Z!==0&&Z!==1&&Z<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(X,le),h.lineTo(H,le),h.stroke(),h.setLineDash([])});const ne=Math.round(11*c);if(h.font=`${ne}px sans-serif`,h.textAlign="left",A._levels.forEach(({ratio:Z,label:re})=>{const R=T(Z),oe=o.priceToCoordinate(R);if(oe==null)return;const le=Math.round(oe*c),ee=A._levelColors[Z]||"#888888",fe=`${re} (${R.toFixed(5)})`;h.fillStyle=ee,h.textAlign="right",h.fillText(fe,X-4*l,le-4*c)}),S!=null&&I!=null&&Q!=null&&N!=null){const Z=Math.round(S*l),re=Math.round(Q*c),R=Math.round(I*l),oe=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(Z,re),h.lineTo(R,oe),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(Z,re,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(R,oe,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Td{constructor(e,t="#3b82f6",A=2,r=!0){this.time=e,this.color=t,this.lineWidth=A,this.showDate=r,this.showDot=!1,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;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const h=Math.round(c*o.horizontalPixelRatio),g=o.bitmapSize.height,v=o.context;v.save(),v.beginPath(),v.strokeStyle=n.color,v.lineWidth=n.lineWidth*o.horizontalPixelRatio,v.setLineDash([]),v.moveTo(h,0),v.lineTo(h,g),v.stroke();const x=Math.round(g/2);if(n.midYCss=x/o.verticalPixelRatio,n.showDot){v.beginPath(),v.strokeStyle=n.color,v.lineWidth=1.5*o.horizontalPixelRatio;const F=5*o.horizontalPixelRatio;v.arc(h,x,F,0,Math.PI*2),v.stroke()}if(n.showDate!==!1){const F=n.time,T=new Date(typeof F=="number"?F*1e3:F),S=R=>String(R).padStart(2,"0"),I=`${S(T.getUTCDate())}.${S(T.getUTCMonth()+1)}.${T.getUTCFullYear()} ${S(T.getUTCHours())}:${S(T.getUTCMinutes())}:${S(T.getUTCSeconds())}`,Q=Math.round(11*o.verticalPixelRatio);v.font=`${Q}px ui-sans-serif, system-ui, sans-serif`,v.textBaseline="middle",v.textAlign="center";const N=v.measureText(I).width,X=Math.round(6*o.horizontalPixelRatio),H=Math.round(3*o.verticalPixelRatio),V=Q+2*H,ne=N+2*X,Z=h-ne/2,re=g-V-Math.round(4*o.verticalPixelRatio);v.fillStyle=n.color,v.fillRect(Z,re,ne,V),v.fillStyle="#ffffff",v.fillText(I,h,re+V/2)}v.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function bd(i,e){const t=typeof i=="string"?i.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const r=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function wT(i,e,t){const A=`${i??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let h=c;for(;h.length>s;){let g=h.lastIndexOf(" ",s);g<=0&&(g=s),o.push(h.slice(0,g)),h=h.slice(g).trimStart()}o.push(h)};return A.split(`
|
|
11
|
-
`).forEach(l),o.length===0&&o.push(""),o}function
|
|
12
|
-
`).forEach(X),N.length===0&&N.push("");const H=N.map(ue=>T.measureText(ue).width),V=Math.max(...H,20*g),ne=8*g,Z=5*v,re=V+ne*2,R=S*1.2,oe=R*N.length+Z*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",ee=x-re/2,fe=F-oe;r.bgEnabled&&(T.fillStyle=bd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),T.beginPath(),T.rect(ee,fe,re,oe),T.fill()),r.borderEnabled&&(T.strokeStyle=bd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),T.lineWidth=Math.max(.5,(r.borderWidth??1)*v),T.beginPath(),T.rect(ee,fe,re,oe),T.stroke()),T.fillStyle=r.color,T.textAlign=le,T.textBaseline="middle";const j=le==="left"?ee+ne:le==="right"?ee+re-ne:ee+re/2;for(let ue=0;ue<N.length;ue++)T.fillText(N[ue],j,fe+Z+R*(ue+.5));const se=5*v,Ae=F+10*v;T.beginPath(),T.strokeStyle="#3b82f6",T.lineWidth=1.5*v,T.arc(x,Ae,se,0,Math.PI*2),T.stroke(),T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const BT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Fd(i){return i?BT[i]??7:7}function yT(i,e){const t=String(i||"").toUpperCase(),A=e||Fd(i),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(A*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const MA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:te(A.time)})).filter(A=>A.time!=null);e.sort((A,r)=>A.time-r.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,r)=>A.time-r.time)},CT=300,Ud=24,vT=150,Sd=150;function hl(i,e,t=CT){if(!Array.isArray(i)||i.length===0)return[];const A=pA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=te(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function TT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=te(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function bT(i,e){let t=0,A=i.length;for(;t<A;){const r=t+A>>1;i[r]<e?t=r+1:A=r}return t}function Os(i,e,t,A){const r=te(e),n=te(t),s=pA(A)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(i)||i.length===0)return l;if(r==null||n==null)return 1;const c=v=>{const x=bT(i,v);if(x<=0)return 0;if(x>=i.length)return i.length-1;const F=i[x-1],T=i[x];return Math.abs(v-F)<=Math.abs(T-v)?x-1:x},h=c(r),g=c(n);return Math.max(1,Math.abs(g-h)+1)}function Ed(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=TT(e);if(r==null)return!1;const n=A.timeToCoordinate(r);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const h=A.getVisibleLogicalRange(),g=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,v=Number.isFinite(g)&&g>20?g:120,x=Math.min(Sd,v/2),F=Math.max(20,v-x),T={from:c-F,to:c+x};try{return A.setVisibleLogicalRange(T),!0}catch{}}}const s=pA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-vT*o,to:r+Sd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}function ut(i,e,t,A,r,n){const s=r-t,o=n-A,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/(l*l);c=Math.max(0,Math.min(1,c));const h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}function xT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);let c=((i-t)*s+(e-A)*o)/l;c<0&&(c=0);const h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}function QT(i,e,t,A,r,n){const s=r-t,o=n-A,l=s*s+o*o;if(l===0)return Math.hypot(i-t,e-A);const c=((i-t)*s+(e-A)*o)/l,h=t+c*s,g=A+c*o;return Math.hypot(i-h,e-g)}function mi(i,e,t){let A=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&i<(l-s)*(e-o)/(c-o)+s&&(A=!A)}return A}function Ld(i,e,t){if(!i||!e||!t)return null;const A=(i.normalizedTime+e.normalizedTime)/2,r=(i.price+e.price)/2,n=t.price-r,s={rawTime:i.rawTime,normalizedTime:i.normalizedTime,price:i.price+n},o={rawTime:e.rawTime,normalizedTime:e.normalizedTime,price:e.price+n},l={rawTime:t.rawTime??te(A),normalizedTime:te(A),price:r+n};return{b1:s,b2:o,bottomMid:l}}function $r(i,e,t,A=1){if(!i||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.filter(ne=>{const Z=te(ne.time);return Z!=null&&Z>=s&&Z<=o});if(l.length<2)return null;const c=l.length;let h=0,g=0,v=0,x=0;l.forEach((ne,Z)=>{h+=Z,g+=ne.close,v+=Z*ne.close,x+=Z*Z});const F=(c*v-h*g)/(c*x-h*h),T=(g-F*h)/c;let S=0;l.forEach((ne,Z)=>{const re=T+F*Z;S+=(ne.close-re)**2});const I=Math.sqrt(S/c),Q=I*A,N=T,X=T+F*(c-1),H=l[0].time,V=l[c-1].time;return{p1:{rawTime:H,normalizedTime:te(H),price:N},p2:{rawTime:V,normalizedTime:te(V),price:X},top1:{rawTime:H,normalizedTime:te(H),price:N+Q},top2:{rawTime:V,normalizedTime:te(V),price:X+Q},bot1:{rawTime:H,normalizedTime:te(H),price:N-Q},bot2:{rawTime:V,normalizedTime:te(V),price:X-Q},slope:F,intercept:T,stdDev:I,offset:Q,barCount:c}}function Xr(i,e,t,A=1){if(!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=(i||[]).filter(S=>{const I=te(S.time);return I!=null&&I>=s&&I<=o});if(l.length<2)return null;const c=e.rawTime,h=t.rawTime,g=l.length,v=(t.price-e.price)/(g-1||1);let x=0;l.forEach((S,I)=>{const Q=e.price+v*I;x+=(S.close-Q)**2});const F=Math.sqrt(x/g),T=F*A;return{p1:{rawTime:c,normalizedTime:r,price:e.price},p2:{rawTime:h,normalizedTime:n,price:t.price},top1:{rawTime:c,normalizedTime:r,price:e.price+T},top2:{rawTime:h,normalizedTime:n,price:t.price+T},bot1:{rawTime:c,normalizedTime:r,price:e.price-T},bot2:{rawTime:h,normalizedTime:n,price:t.price-T},slope:v,stdDev:F,offset:T,barCount:g}}const FT={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},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},UT={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",pricelevel:"#3b82f6"};function ST(i,e){if(!i||!i.type)return!1;const t=FT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function ET(i){return i?UT[i]??"#22c55e":"#22c55e"}function ul(i,e){if(i.length<e)return[];const t=2/(e+1);let A=i.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:i[e-1].time,value:A}];for(let n=e;n<i.length;n++)A=i[n].close*t+A*(1-t),r.push({time:i[n].time,value:A});return r}function Ks(i,e){if(i.length<e)return null;const t=i[i.length-1],A=i.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:A}}function Md(i,e){const t=ul(i,e);return t.length?t[t.length-1]:null}function Hd(i,e){if(i.length<e+1)return null;let t=0,A=0;for(let s=1;s<=e;s++){const o=i[s].close-i[s-1].close;o>0?t+=o:A-=o}t/=e,A/=e;for(let s=e+1;s<i.length;s++){const o=i[s].close-i[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,A=(A*(e-1)+Math.max(-o,0))/e}const r=i[i.length-1],n=A===0?100:100-100/(1+t/A);return{time:r.time,value:n}}function Id(i,e=12,t=26,A=9){if(i.length<t+A)return null;const r=ul(i,e),n=ul(i,t);if(!r.length||!n.length)return null;const s=n.map((h,g)=>{const v=r[r.length-n.length+g];return{time:h.time,value:v.value-h.value}});if(s.length<A)return null;const o=2/(A+1);let l=s.slice(0,A).reduce((h,g)=>h+g.value,0)/A;for(let h=A;h<s.length;h++)l=s[h].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const LT={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},MT=q.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=q.useRef(null),l=q.useRef(null),c=q.useRef(null),h=q.useRef(null),g=q.useRef(null),v=q.useRef(null),x=q.useRef([]),F=q.useRef(null),T=q.useRef(!1),S=q.useRef(null),I=q.useRef(null),Q=q.useRef(null),N=q.useRef(null),X=q.useRef([]),[H,V]=q.useState(null),[ne,Z]=q.useState(null),[re,R]=q.useState([]),[oe,le]=q.useState(null),[ee,fe]=q.useState([]),j=q.useRef(null),se=q.useRef(null),Ae=q.useRef(null),ue=q.useRef(!1),ae=q.useRef(!1);q.useEffect(()=>{Ae.current=H;let f=!1;x.current.forEach(u=>{if(u.type==="trendline"&&u.decoration){const O=u===H;u.decoration.isSelected!==O&&(u.decoration.isSelected=O,f=!0)}}),f&&c.current?.applyOptions({})},[H]);const Be=q.useRef(new Map),be=q.useRef(null),xe=q.useRef(null),me=(f,u)=>`${f}_${u}`,ve=()=>{const f=me(Fe,Ie);return Be.current.get(f)||null},Qe=f=>{if(!f)return;const u=me(Fe,Ie);Be.current.set(u,f)},{activeTool:Ee,setActiveTool:Me,showGrid:Ke,snapToGrid:Re,chartObjects:$e,setChartObjects:Ce,orders:At,selectedSymbol:Fe,selectedTimeframe:Ie,drawingsVisible:dt,chartType:lt,chartLocked:Xe,theme:Pe,candleColors:we,showTradeOrders:He,showTradePosition:_e,showTradeHistory:Ge,showSLTP:qe,showAskPrice:mt,showChartControls:Et,showCrosshair:bA,showOHLC:ti,currentSymbolData:iA,baseUrl:hA,endpoints:xA,endpointParams:GA,indicators:xt,indicatorSettings:Rt}=Vt(),vt=q.useRef({}),[it,Ut]=q.useState({}),Lt=q.useRef(0),Ii=q.useRef(xt),Ze=q.useRef(Rt);Ii.current=xt,Ze.current=Rt;const ke=q.useRef([]),[rt,Ue]=q.useState(!1),[ze,nt]=q.useState(null),[Te,De]=q.useState([]),[st,ot]=q.useState(!0),[Bt,Gt]=q.useState(null),[$A,Pb]=q.useState(0),zs=q.useMemo(()=>{const f=Te.map(u=>te(u?.time)).filter(u=>Number.isFinite(u));return f.sort((u,O)=>u-O),f},[Te]),Ws=q.useRef(null),Ai=q.useRef(new Map);q.useRef(null);const Kd=q.useRef(0),HA=q.useRef(null),ir=q.useRef(!1),jr=q.useRef(!1);q.useEffect(()=>{const f=g.current;f&&f.setData(hl(Te,Ie))},[Te,Ie]),q.useImperativeHandle(s,()=>({zoomIn:()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,de=(u.from+u.to)/2,y=O*.8;try{f.setVisibleRange({from:de-y/2,to:de+y/2}),Qe(f.getVisibleRange())}catch{}},zoomOut:()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,de=(u.from+u.to)/2,y=O*1.25;try{f.setVisibleRange({from:de-y/2,to:de+y/2}),Qe(f.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const f=o.current;if(!f){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const u=Pe==="light"?"#ffffff":"#12161d",O=`chart-${Fe}-${Ie}-${Date.now()}.png`;cT(f,{useCORS:!0,allowTaint:!0,backgroundColor:u,scale:2,logging:!1}).then(de=>{const y=document.createElement("a");y.download=O,y.href=de.toDataURL("image/png"),y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(de=>{console.error("Chart screenshot failed",de),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Fe,Ie,Pe]);const fl=q.useMemo(()=>Te.length===0?[]:lt==="line"||lt==="area"?Te.map(f=>({time:f.time,value:f.close})):Te,[Te,lt]),tb=f=>{r?r(f):(nt("BUY"),Ue(!0))},Ab=f=>{n?n(f):(nt("SELL"),Ue(!0))},ib=()=>{Ue(!1),nt(null)},rb=f=>{const u=ne;if(!u||!f)return;const O=(G,W)=>{if(typeof G!="string")return W;const Y=G.trim(),ce=Y.startsWith("#")?Y:`#${Y}`;return/^#[0-9A-Fa-f]{6}$/.test(ce)?ce.toLowerCase():W},de=(G,W)=>{const Y=Number(G);return Number.isFinite(Y)?Math.max(0,Math.min(1,Y)):W};let y={...u,visibleTimeframes:Array.isArray(f.visibleTimeframes)?[...f.visibleTimeframes]:u.visibleTimeframes};if(u.type==="text"){const G=Number.isFinite(Number(f.price))?Number(f.price):u.price,W=u.primitive;W&&(W.text=typeof f.text=="string"?f.text:W.text,W.color=O(f.color,W.color??"#5f8f96"),W.fontSize=Number.isFinite(Number(f.fontSize))?Number(f.fontSize):W.fontSize,W.fontWeight=f.fontWeight==="bold"?"bold":"normal",W.fontStyle=f.fontStyle==="italic"?"italic":"normal",W.textAlign=["left","center","right"].includes(f.textAlign)?f.textAlign:W.textAlign,W.textWrap=!!f.textWrap,W.borderEnabled=!!f.borderEnabled,W.borderColor=O(f.borderColor,W.borderColor??"#5f8f96"),W.borderOpacity=de(f.borderOpacity,W.borderOpacity??.1),W.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(f.borderWidth))?Number(f.borderWidth):1)),W.bgEnabled=!!f.bgEnabled,W.bgColor=O(f.bgColor,W.bgColor??"#5f8f96"),W.bgOpacity=de(f.bgOpacity,W.bgOpacity??.1),W.price=G),y={...y,price:G,text:typeof f.text=="string"?f.text:u.text}}if(u.type==="trendline"){const G=O(f.lineColor,"#22c55e"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2));if(u.series)try{u.series.applyOptions({color:G,lineWidth:W})}catch{}const Y=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.point1?.price,ce=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.point2?.price;if(u.series&&u.point1&&u.point2){const $=u.point1.time??u.point1.rawTime,C=u.point2.time??u.point2.rawTime;try{const B=MA([{time:$,value:Y},{time:C,value:ce}]);B.length>0&&u.series.setData(B)}catch{}}const E={...u.point1,price:Y},P={...u.point2,price:ce};u.decoration&&(u.decoration.color=G,u.decoration.lineWidth=W,u.decoration.arrowLeft=!!f.arrowLeft,u.decoration.arrowRight=!!f.arrowRight,u.decoration.rayLeft=!!f.rayLeft,u.decoration.rayRight=!!f.rayRight,u.decoration.statsColor=O(f.statsColor,"#5f8f96"),u.decoration.statsPosition=f.statsPosition??"right",u.decoration.statsShowAlways=!!f.statsShowAlways,u.decoration.statsPriceRange=!!f.statsPriceRange,u.decoration.statsBarsRange=!!f.statsBarsRange,u.decoration.statsDateRange=!!f.statsDateRange,u.decoration.statsAngle=!!f.statsAngle,u.decoration.statsDistance=!!f.statsDistance,u.decoration.p1=E,u.decoration.p2=P),y={...y,lineColor:G,lineWidth:W,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,statsColor:O(f.statsColor,"#5f8f96"),statsPosition:f.statsPosition??"right",statsShowAlways:!!f.statsShowAlways,statsPriceRange:!!f.statsPriceRange,statsBarsRange:!!f.statsBarsRange,statsDateRange:!!f.statsDateRange,statsAngle:!!f.statsAngle,statsDistance:!!f.statsDistance,point1:E,point2:P,decoration:u.decoration}}if(u.type==="pricelevel"){const G=O(f.lineColor,"#3b82f6"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=f.showPrice!==!1,ce=!!f.showText,E=typeof f.textContent=="string"?f.textContent:"",P=O(f.textColor,"#ffffff"),$=["left","center","right"].includes(f.textHAlign)?f.textHAlign:"center",C=["top","middle","bottom"].includes(f.textVAlign)?f.textVAlign:"top",B=Number.isFinite(Number(f.price))?Number(f.price):u.price;if(u.priceLine)try{u.priceLine.applyOptions({price:B,color:G,lineWidth:W,axisLabelVisible:Y,title:Y&&typeof B=="number"?B.toFixed(5):""})}catch{}const d=h.current;if(ce&&E&&d)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=P,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B;else{const L=new ld(B,{text:E,textColor:P,hAlign:$,vAlign:C});try{d.attachPrimitive(L)}catch{}u.textPrimitive=L}else if(u.textPrimitive&&d){try{d.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:G,lineWidth:W,showPrice:Y,showText:ce,textContent:E,textColor:P,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="horizontalray"){const G=O(f.lineColor,"#3b82f6"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=f.showPrice!==!1,ce=!!f.showText,E=typeof f.textContent=="string"?f.textContent:"",P=O(f.textColor,"#ffffff"),$=["left","center","right"].includes(f.textHAlign)?f.textHAlign:"center",C=["top","middle","bottom"].includes(f.textVAlign)?f.textVAlign:"top",B=Number.isFinite(Number(f.price))?Number(f.price):u.price,d=u.primitive;if(d&&(d.price=B,d.color=G,d.lineWidth=W),u.priceLine)try{u.priceLine.applyOptions({price:B,color:G,axisLabelVisible:Y,title:Y&&typeof B=="number"?B.toFixed(5):""})}catch{}const L=h.current;if(ce&&E&&L)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=P,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B,u.textPrimitive.originTime=u.rawOriginTime;else{const w=new ld(B,{text:E,textColor:P,hAlign:$,vAlign:C,originTime:u.rawOriginTime});try{L.attachPrimitive(w)}catch{}u.textPrimitive=w}else if(u.textPrimitive&&L){try{L.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:G,lineWidth:W,showPrice:Y,showText:ce,textContent:E,textColor:P,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="verticalline"){const G=O(f.lineColor,"#3b82f6"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=f.showDate!==!1,ce=u.primitive;ce&&(ce.color=G,ce.lineWidth=W,ce.showDate=Y),y={...y,lineColor:G,lineWidth:W,showDate:Y}}if(u.type==="infoline"){const G=O(f.lineColor,"#3b82f6"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=f.statsShowAlways!==!1,ce=O(f.statsColor,"#5f8f96"),E=["left","center","right"].includes(f.statsPosition)?f.statsPosition:"right",P=!!f.statsPriceRange,$=!!f.statsBarsRange,C=!!f.statsDateRange,B=!!f.statsAngle,d=!!f.statsDistance,L=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,w=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p2.price,p=u.p1.rawTime,D=u.p2.rawTime,_=w-L,U=L!==0?_/Math.abs(L)*100:0,b=u.p1.normalizedTime??0,m=u.p2.normalizedTime??0,M=pA(Ie)||3600,k=Math.abs(m-b),K=Math.max(1,Math.round(k/M)),z=Math.max(1,Math.round(k/86400)),J=c.current,ie=h.current,he=J?J.timeScale().timeToCoordinate(p):null,ge=ie?ie.priceToCoordinate(L):null,ye=J?J.timeScale().timeToCoordinate(D):null,Le=ie?ie.priceToCoordinate(w):null,Je=he!=null&&ge!=null&&ye!=null&&Le!=null?Math.atan2(-(Le-ge),ye-he)*(180/Math.PI):u.primitive?.info?.angle??0,tt={priceDiff:_,pricePct:U,bars:K,days:z,angle:Je},We=u.primitive;We&&(We.color=G,We.lineWidth=W,We.statsShowAlways=Y,We.statsColor=ce,We.statsPosition=E,We.statsPriceRange=P,We.statsBarsRange=$,We.statsDateRange=C,We.statsAngle=B,We.statsDistance=d,We.p1={...u.p1,price:L},We.p2={...u.p2,price:w},We.info=tt),y={...y,lineColor:G,lineWidth:W,statsShowAlways:Y,statsColor:ce,statsPosition:E,statsPriceRange:P,statsBarsRange:$,statsDateRange:C,statsAngle:B,statsDistance:d,p1:{...u.p1,price:L},p2:{...u.p2,price:w}}}if(u.type==="rulerline"){const G=O(f.lineColor,"#3b82f6"),W=f.showArea!==!1,Y=!!f.statsShowAlways,ce=O(f.statsColor,"#5f8f96"),E=["left","center","right"].includes(f.statsPosition)?f.statsPosition:"right",P=!!f.statsPriceRange,$=!!f.statsBarsRange,C=!!f.statsDateRange,B=u.primitive;B&&(B.lineColor=G,B.showArea=W,B.statsShowAlways=Y,B.statsColor=ce,B.statsPosition=E,B.statsPriceRange=P,B.statsBarsRange=$,B.statsDateRange=C),y={...y,lineColor:G,showArea:W,statsShowAlways:Y,statsColor:ce,statsPosition:E,statsPriceRange:P,statsBarsRange:$,statsDateRange:C}}if(u.type==="arrowedline"){const G=O(f.lineColor,"#f59e0b"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,ce=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p2.price,E=u.primitive;E&&(E.color=G,E.lineWidth=W,E.arrowLeft=!!f.arrowLeft,E.arrowRight=!!f.arrowRight,E.rayLeft=!!f.rayLeft,E.rayRight=!!f.rayRight,E.statsShowAlways=!!f.statsShowAlways,E.statsColor=O(f.statsColor,"#5f8f96"),E.statsPosition=f.statsPosition??"right",E.statsPriceRange=!!f.statsPriceRange,E.statsBarsRange=!!f.statsBarsRange,E.statsDateRange=!!f.statsDateRange,E.statsAngle=!!f.statsAngle,E.statsDistance=!!f.statsDistance,E.p1={...u.p1,price:Y},E.p2={...u.p2,price:ce}),y={...y,lineColor:G,lineWidth:W,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,statsShowAlways:!!f.statsShowAlways,statsColor:O(f.statsColor,"#5f8f96"),statsPosition:f.statsPosition??"right",statsPriceRange:!!f.statsPriceRange,statsBarsRange:!!f.statsBarsRange,statsDateRange:!!f.statsDateRange,statsAngle:!!f.statsAngle,statsDistance:!!f.statsDistance,p1:{...u.p1,price:Y},p2:{...u.p2,price:ce}}}if(u.type==="rayline"){const G=O(f.lineColor,"#7aa6ae"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,ce=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p2.price,E=u.primitive;E&&(E.color=G,E.lineWidth=W,E.arrowLeft=!!f.arrowLeft,E.arrowRight=!!f.arrowRight,E.rayLeft=!!f.rayLeft,E.rayRight=!!f.rayRight,E.statsShowAlways=!!f.statsShowAlways,E.statsColor=O(f.statsColor,"#5f8f96"),E.statsPosition=f.statsPosition??"right",E.statsPriceRange=!!f.statsPriceRange,E.statsBarsRange=!!f.statsBarsRange,E.statsDateRange=!!f.statsDateRange,E.statsAngle=!!f.statsAngle,E.statsDistance=!!f.statsDistance,E.p1={...u.p1,price:Y},E.p2={...u.p2,price:ce}),y={...y,lineColor:G,lineWidth:W,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,statsShowAlways:!!f.statsShowAlways,statsColor:O(f.statsColor,"#5f8f96"),statsPosition:f.statsPosition??"right",statsPriceRange:!!f.statsPriceRange,statsBarsRange:!!f.statsBarsRange,statsDateRange:!!f.statsDateRange,statsAngle:!!f.statsAngle,statsDistance:!!f.statsDistance,p1:{...u.p1,price:Y},p2:{...u.p2,price:ce}}}if(u.type==="extendedline"){const G=O(f.lineColor,"#7aa6ae"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,ce=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p2.price,E=u.primitive;E&&(E.color=G,E.lineWidth=W,E.arrowLeft=!!f.arrowLeft,E.arrowRight=!!f.arrowRight,E.rayLeft=!!f.rayLeft,E.rayRight=!!f.rayRight,E.statsShowAlways=!!f.statsShowAlways,E.statsColor=O(f.statsColor,"#5f8f96"),E.statsPosition=f.statsPosition??"right",E.statsPriceRange=!!f.statsPriceRange,E.statsBarsRange=!!f.statsBarsRange,E.statsDateRange=!!f.statsDateRange,E.statsAngle=!!f.statsAngle,E.statsDistance=!!f.statsDistance,E.p1={...u.p1,price:Y},E.p2={...u.p2,price:ce}),y={...y,lineColor:G,lineWidth:W,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,statsShowAlways:!!f.statsShowAlways,statsColor:O(f.statsColor,"#5f8f96"),statsPosition:f.statsPosition??"right",statsPriceRange:!!f.statsPriceRange,statsBarsRange:!!f.statsBarsRange,statsDateRange:!!f.statsDateRange,statsAngle:!!f.statsAngle,statsDistance:!!f.statsDistance,p1:{...u.p1,price:Y},p2:{...u.p2,price:ce}}}if(u.type==="crossline"){const G=O(f.lineColor,"#06a0e3"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=Number.isFinite(Number(f.price))?Number(f.price):u.p.price,ce=u.primitive;ce&&(ce.color=G,ce.lineWidth=W,ce.showTime=!!f.showTime,ce.showPrice=!!f.showPrice,ce.center={...u.p,price:Y}),y={...y,lineColor:G,lineWidth:W,showTime:!!f.showTime,showPrice:!!f.showPrice,p:{...u.p,price:Y}}}if(u.type==="trendbyangle"){const G=O(f.lineColor,"#7aa6ae"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,ce=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p2.price,E=u.primitive;E&&(E.color=G,E.lineWidth=W,E.arrowLeft=!!f.arrowLeft,E.arrowRight=!!f.arrowRight,E.rayLeft=!!f.rayLeft,E.rayRight=!!f.rayRight,E.statsShowAlways=!!f.statsShowAlways,E.statsColor=O(f.statsColor,"#5f8f96"),E.statsPosition=f.statsPosition??"right",E.statsPriceRange=!!f.statsPriceRange,E.statsDistance=!!f.statsDistance,E.p1={...u.p1,price:Y},E.p2={...u.p2,price:ce}),y={...y,lineColor:G,lineWidth:W,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,statsShowAlways:!!f.statsShowAlways,statsColor:O(f.statsColor,"#5f8f96"),statsPosition:f.statsPosition??"right",statsPriceRange:!!f.statsPriceRange,statsDistance:!!f.statsDistance,p1:{...u.p1,price:Y},p2:{...u.p2,price:ce}}}if(u.type==="disjointchannel"){const G=O(f.lineColor,"#129f5c"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=O(f.fillColor,"#6aa84f"),ce=de(f.fillOpacity,.1),E=O(f.pricesColor,"#129f5c"),P=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,$=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p3.price,C=Number.isFinite(Number(f.point3Price))?Number(f.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=G,B.lineWidth=W,B.fillColor=Y,B.fillOpacity=ce,B.showBackground=!!f.showBackground,B.showPrices=!!f.showPrices,B.pricesColor=E,B.rayLeft=!!f.rayLeft,B.rayRight=!!f.rayRight,B.arrowLeft=!!f.arrowLeft,B.arrowRight=!!f.arrowRight,B.p1={...u.p1,price:P},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:G,lineWidth:W,fillColor:Y,fillOpacity:ce,showBackground:!!f.showBackground,showPrices:!!f.showPrices,pricesColor:E,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,p1:{...u.p1,price:P},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}if(u.type==="flattopbottom"){const G=O(f.lineColor,"#3b82f6"),W=Math.max(1,Math.min(5,Number.isFinite(Number(f.lineWidth))?Number(f.lineWidth):2)),Y=O(f.fillColor,"#3b82f6"),ce=de(f.fillOpacity,.12),E=O(f.pricesColor,"#3b82f6"),P=Number.isFinite(Number(f.point1Price))?Number(f.point1Price):u.p1.price,$=Number.isFinite(Number(f.point2Price))?Number(f.point2Price):u.p3.price,C=Number.isFinite(Number(f.point3Price))?Number(f.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=G,B.lineWidth=W,B.fillColor=Y,B.fillOpacity=ce,B.showBackground=!!f.showBackground,B.showPrices=!!f.showPrices,B.pricesColor=E,B.rayLeft=!!f.rayLeft,B.rayRight=!!f.rayRight,B.arrowLeft=!!f.arrowLeft,B.arrowRight=!!f.arrowRight,B.p1={...u.p1,price:P},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:G,lineWidth:W,fillColor:Y,fillOpacity:ce,showBackground:!!f.showBackground,showPrices:!!f.showPrices,pricesColor:E,rayLeft:!!f.rayLeft,rayRight:!!f.rayRight,arrowLeft:!!f.arrowLeft,arrowRight:!!f.arrowRight,p1:{...u.p1,price:P},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}Ce(G=>{const W=G.map(Y=>Y===u?y:Y);return x.current=W,W}),Ae.current===u&&(Ae.current=y),V(G=>G===u?y:G),le(G=>G===u?y:G),Z(y);try{c.current?.applyOptions({})}catch{}};q.useEffect(()=>{const f=o.current;if(!f)return;const u=f.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},de=Pe==="light",y=Lm(f,{width:u.width||f.clientWidth,height:u.height||f.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:de?"#FFFFFF":"#0d1117",type:"solid"},textColor:de?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ke,color:Ke?de?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ke?2:0},horzLines:{visible:Ke,color:Ke?de?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ke?2:0}},rightPriceScale:{borderColor:de?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:de?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:de?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:0,vertLine:{width:1,color:de?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:de?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:de?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:de?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Ee===1,horzLineVisible:Ee===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Ee===null||Ee===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}}),G=(typeof Fe=="string"?Fe:Fe?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),W=G.includes("JPY"),Y=tn(G),ce=en(G);let E,P;W?(E=.001,P=w=>Math.abs(Number(w)).toFixed(3)):Y?G.startsWith("BTC")||G.startsWith("ETH")?(E=.01,P=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,P=w=>Math.abs(Number(w)).toFixed(4)):ce&&(G.startsWith("XAU")||G.startsWith("XAG"))?(E=.01,P=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,P=w=>Math.abs(Number(w)).toFixed(5));const $=y.addCandlestickSeries({upColor:de?"#089981":"#26a69a",downColor:de?"#f23645":"#ef5350",wickUpColor:de?"#089981":"#26a69a",wickDownColor:de?"#f23645":"#ef5350",borderUpColor:de?"#089981":"#26a69a",borderDownColor:de?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:E,formatter:P}}),C=y.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=y,h.current=$,g.current=C,C.setData(hl(Te,Ie)),requestAnimationFrame(()=>{if(f&&y){const w=f.getBoundingClientRect();w.width>0&&w.height>0&&y.resize(w.width,w.height)}});const B=y.timeScale(),d=()=>{if(ae.current&&Ai.current.size>0){const w=B.getVisibleRange();w&&Qe(w)}};B.subscribeVisibleTimeRangeChange(d);const L=new ResizeObserver(w=>{for(const p of w){const{width:D,height:_}=p.contentRect;if(D>0&&_>0&&y){const U=B.getVisibleRange();y.resize(D,_),U&&setTimeout(()=>{try{B.setVisibleRange(U)}catch{}},0)}}});return L.observe(f),()=>{B.unsubscribeVisibleTimeRangeChange(d),L.disconnect(),y.remove(),c.current=null,h.current=null,g.current=null,v.current=null,x.current=[],HA.current&&clearTimeout(HA.current)}},[]),q.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ke,color:Ke?"rgba(110, 118, 129, 0.15)":"transparent",style:Ke?2:0},horzLines:{visible:Ke,color:Ke?"rgba(110, 118, 129, 0.15)":"transparent",style:Ke?2:0}}})},[Ke]),q.useEffect(()=>{const f=c.current;if(!f)return;const u=Pe==="light";f.applyOptions({layout:{background:{color:u?"#FFFFFF":"#12161d"},textColor:u?"#020617":"#fff"},grid:{vertLines:{color:Ke?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ke?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:u?"#e5e7eb":"#1e293b"},timeScale:{borderColor:u?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1},horzLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1}}})},[Pe,Ke]),q.useEffect(()=>{const f=h.current;!f||!we||f.applyOptions({upColor:we.upColor,downColor:we.downColor,wickUpColor:we.upColor,wickDownColor:we.downColor,borderUpColor:we.upColor,borderDownColor:we.downColor})},[we]),q.useEffect(()=>{if(!c.current)return;const u=!Xe&&!(Ee!==null&&Ee!==1&&Ee!==0),O=!Xe;c.current.applyOptions({crosshair:{mode:0,vertLine:{visible:Ee===1||bA,width:1,color:Pe==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Pe==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Ee===1||bA,width:1,color:Pe==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Pe==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:u,horzTouchDrag:u,vertTouchDrag:u},handleScale:{axisPressedMouseMove:{time:u,price:u},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:u,price:u},mouseWheel:O,pinch:O}})},[Ee,Xe,bA,Pe]);const nb=(f=!1)=>{const u=h.current,O=c.current;x.current.forEach(de=>{if(de.primitive)try{u&&u.detachPrimitive(de.primitive)}catch{}if(de.series&&de.series!==u&&O)try{O.removeSeries(de.series)}catch{}if(de.priceLine&&u)try{u.removePriceLine(de.priceLine)}catch{}if(de.textPrimitive&&u)try{u.detachPrimitive(de.textPrimitive)}catch{}}),x.current=[],Ce([]),Me(null),f&&gT(Fe,Ie)},Vd=(f,u=!1)=>{f&&x.current.forEach(O=>{if(O.primitive){try{f.detachPrimitive(O.primitive)}catch{}try{f.attachPrimitive(O.primitive)}catch{}}if(u&&O.type==="pricelevel"&&O.priceLine)try{const de=O.showPrice!==!1,y=f.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:de,title:de&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}if(u&&O.type==="horizontalray"&&O.priceLine)try{const de=O.showPrice!==!1,y=f.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:de,title:de&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}})},Rs=q.useCallback(()=>{fT(x.current,Fe,Ie)},[Fe,Ie]),sb=q.useCallback(()=>{const f=c.current,u=h.current;if(!f||!u)return;const O=mT(Fe,Ie);if(!O.length)return;const de=[];for(const y of O)try{let G=null;switch(y.type){case"pricelevel":{const W=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});G={...y,priceLine:W};break}case"horizontalray":{const W=new ad(y.price,y.rawOriginTime);u.attachPrimitive(W);const Y=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});G={...y,primitive:W,priceLine:Y};break}case"verticalline":{const W=new Td(y.rawTime);u.attachPrimitive(W),G={...y,primitive:W};break}case"text":{const W=new Qd(y.rawTime,y.price);y.text&&(W.text=y.text),u.attachPrimitive(W),G={...y,primitive:W};break}case"crossline":{const W=new wd({rawTime:y.p.rawTime,price:y.p.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"infoline":{const W=y.info||{},Y=new cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},W);u.attachPrimitive(Y),G={...y,primitive:Y};break}case"rulerline":{const W=y.info||{},Y=new nl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},W);u.attachPrimitive(Y),G={...y,primitive:Y};break}case"arrowedline":{const W=new sl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"rayline":{const W=new fd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"extendedline":{const W=new md({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"trendbyangle":{const W=new Bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"trendline":case"gannline":{const W=y.type==="gannline"?"#7aa6ae":"#22c55e",Y=f.addLineSeries({color:W,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),ce=MA([{time:y.point1.time,value:y.point1.price},{time:y.point2.time,value:y.point2.price}]);ce.length>0&&Y.setData(ce);const E=new gd(y.point1,y.point2,W,2);try{Y.attachPrimitive(E)}catch{}G={...y,series:Y,decoration:E};break}case"rectangle":{const W=new hd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(W),G={...y,primitive:W};break}case"circle":{const W=new ud({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1});u.attachPrimitive(W),G={...y,primitive:W};break}case"triangle":{const W=new pd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(W),G={...y,primitive:W};break}case"ellipse":{const W=new dd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1,minorRatio:y.minorRatio??.45,previewAsLine:!1});u.attachPrimitive(W),G={...y,primitive:W};break}case"fibonacci":{const W=new cl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"equidistantchannel":{const W=new al({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.b1.rawTime,price:y.b1.price},{rawTime:y.b2.rawTime,price:y.b2.price},{rawTime:y.bottomMid.rawTime,price:y.bottomMid.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"disjointchannel":{const W=new ks({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"flattopbottom":{const W=new ol({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"regressionchannel":{const W=new Ns({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"stddevchannel":{const W=new ll({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"andrewspitchfork":{const W=new yd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"gannfan":{const W=new Cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}case"ganngrid":{const W=new vd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(W),G={...y,primitive:W};break}default:continue}G&&de.push(G)}catch{}de.length&&(x.current.push(...de),Ce(y=>[...y,...de]))},[Fe,Ie,Ce]);q.useEffect(()=>{const f=`${Fe}_${Ie}`;F.current===f&&Rs()},[$e,Rs,Fe,Ie]),q.useEffect(()=>{(async()=>{if(!Fe||!Ie){De([]),ae.current=!1;return}try{if(HA.current&&(clearTimeout(HA.current),HA.current=null),ir.current=!0,ot(!0),Gt(null),De([]),ae.current=!1,jr.current=!1,xe.current!==null&&xe.current!==Fe&&(F.current=null,nb()),xe.current=Fe,h.current)try{h.current.setData([])}catch{}const u=Fd(Ie),O=yT(Ie,u),de=hA||LT?.VITE_BASE_URL||"http://localhost:5002",y=xA?.candles||"/api/chart/candles",G=GA?.candles||{},W={symbol:G.symbol||"symbol",timeframe:G.timeframe||"timeframe",limit:G.limit||"limit",daysBack:G.daysBack||"daysBack"},Y={};Y[W.symbol]=Fe,Y[W.timeframe]=Ie,Y[W.limit]=O,G.daysBack!==!1&&(Y[W.daysBack]=u);const ce=localStorage.getItem("token")??localStorage.getItem("authToken"),E=await gt.get(`${de}${y}`,{params:Y,timeout:1e4,headers:ce?{Authorization:`Bearer ${ce}`}:{}});let P=[];if(Array.isArray(E.data)?P=E.data:E.data&&E.data.data&&Array.isArray(E.data.data)?P=E.data.data:E.data&&Array.isArray(E.data)&&(P=E.data),P&&P.length>0){const{candles:$,stats:C}=vl(P,Fe,Ie);$.length>0?(De($),Ai.current=new Map,$.forEach(B=>{Ai.current.set(B.time,B)}),jr.current=!0,ir.current=!1,Ws.current?.connected&&Fe&&Ie&&Ws.current.emit("subscribeCandles",{symbol:Fe,timeframe:Ie})):(console.warn(`⚠️ No valid candles after processing for ${Fe}`),ir.current=!1,De([]))}else console.warn(`⚠️ No candle data returned for ${Fe}`),ir.current=!1,De([])}catch(u){console.error(`❌ Error fetching ${Fe}:`,u.message);const O=u.code==="ECONNABORTED"||u.message&&u.message.includes("timeout");Gt(O?"Request timed out. No data available for this symbol.":u.message||"Failed to load candles."),ir.current=!1,De([]),ot(!1)}})()},[Fe,Ie,$A]),q.useEffect(()=>{Ws.current=On.getSocket();const f=Ws.current,u=()=>{if(jr.current&&Fe&&Ie&&f.connected){const Y={symbol:Fe,timeframe:Ie};f.emit("subscribeCandles",Y)}},O=()=>{setTimeout(()=>{Fe&&Ie&&u()},200)},de=Y=>{},y=Y=>{};f.on("connect",O),f.on("disconnect",de),f.on("connect_error",y),f.on("subscription:confirmed",Y=>{Y.type});const G=Y=>{if(!jr.current||!Y||!Y.candle||!Y.symbol)return;const ce=D=>String(D||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ce(Y.symbol)!==ce(Fe)||Y.timeframe&&Y.timeframe!==Ie)return;const{candle:E}=Y,P=Tl(E,Fe,Ie);if(!P)return;const $=Date.now();if($-Kd.current<200)return;Kd.current=$;const C=c.current?.timeScale(),B=C?.getVisibleRange(),d=h.current,L=c.current;if(!(!d||!L||!ae.current&&!jr.current||d?.seriesType?.()!==(lt==="line"?"Line":lt==="area"?"Area":lt==="bars"?"Bar":"Candlestick")))try{const D=Ai.current.get(P.time),_=!D,U=D?{time:P.time,open:D.open,high:Math.max(D.high,P.high),low:Math.min(D.low,P.low),close:P.close}:P;Ai.current.set(P.time,U),_&&g.current&&g.current.setData(hl(Array.from(Ai.current.values()),Ie));try{lt==="line"||lt==="area"?d.update({time:U.time,value:U.close}):d.update(U),C&&B&&Qe(B)}catch(k){throw k}const b=Ii.current||{},m=Ze.current||{},M=vt.current;if(Object.keys(M).length>0){const k=Array.from(Ai.current.values()).sort((K,z)=>K.time-z.time);if(b.sma20&&M.sma20){const K=Ks(k,m.smaPeriod||20);if(K)try{M.sma20.update(K)}catch{}}if(b.sma50&&M.sma50){const K=Ks(k,50);if(K)try{M.sma50.update(K)}catch{}}if(b.ema12&&M.ema12){const K=Md(k,m.emaPeriod||12);if(K)try{M.ema12.update(K)}catch{}}if(b.rsi&&M.rsi){const K=Hd(k,m.rsiPeriod||14);if(K){try{M.rsi.update(K)}catch{}if(M.rsi70)try{M.rsi70.update({time:K.time,value:70})}catch{}if(M.rsi30)try{M.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&M.macdLine){const K=Id(k,12,26,9);if(K){try{M.macdLine.update({time:K.time,value:K.value})}catch{}try{M.macdSignal.update({time:K.time,value:K.signal})}catch{}try{M.macdHist.update({time:K.time,value:K.histogram,color:K.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(b.bollinger&&M.bbMiddle){const K=Xs(k,m.bbPeriod||20,m.bbStdDev||2);if(K){try{M.bbUpper.update({time:K.time,value:K.upper})}catch{}try{M.bbMiddle.update({time:K.time,value:K.middle})}catch{}try{M.bbLower.update({time:K.time,value:K.lower})}catch{}}}}}catch{}};f.on("candleUpdate",G);const W=()=>{f.connected&&Fe&&Ie&&u()};if(f.connected)W();else{const Y=()=>{setTimeout(W,200)};f.once("connect",Y),setTimeout(()=>{f.connected&&W()},500)}return()=>{f.off("candleUpdate",G),f.off("connect",O),f.off("disconnect",de),f.off("connect_error",y),f.off("subscription:confirmed"),Fe&&Ie&&f.connected&&f.emit("unsubscribeCandles",{symbol:Fe,timeframe:Ie})}},[Fe,Ie,hA]),q.useEffect(()=>{const f=h.current,u=c.current;if(!(!f||!u)&&!(ir.current&&Te.length>0)&&!(Te.length===0&&ae.current)){if(Te.length===0&&!ae.current){if(st)return;const O=u.timeScale();f.setData([]),O.fitContent(),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>ot(!1)),400);return}if(!ae.current){const O=(typeof Fe=="string"?Fe:Fe?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),de=O.includes("JPY"),y=en(O),G=tn(O);let W,Y;de?(W=.001,Y=d=>Math.abs(Number(d)).toFixed(3)):G?O.startsWith("BTC")||O.startsWith("ETH")?(W=.01,Y=d=>Math.abs(Number(d)).toFixed(2)):(W=1e-4,Y=d=>Math.abs(Number(d)).toFixed(4)):y&&(O.startsWith("XAU")||O.startsWith("XAG"))?(W=.01,Y=d=>Math.abs(Number(d)).toFixed(2)):(W=1e-4,Y=d=>Math.abs(Number(d)).toFixed(5));try{f.applyOptions({priceFormat:{type:"custom",minMove:W,formatter:Y}})}catch{}const ce=u.timeScale(),E=me(Fe,Ie);be.current,be.current=E;const P=[...Te].sort((d,L)=>d.time-L.time);if(lt==="line"||lt==="area"){const d=P?.map(L=>({time:L.time,value:L.close})).filter(L=>L.time!=null);d.length>0&&f.setData(d)}else P?.length>0&&f.setData(P);we&&f.applyOptions({upColor:we.upColor,downColor:we.downColor,wickUpColor:we.upColor,wickDownColor:we.downColor,borderUpColor:we.upColor,borderDownColor:we.downColor}),Vd(f);const $=`${Fe}_${Ie}`;F.current!==$&&(F.current=$,sb());const C=pA(Ie)||60;if(x.current.forEach(d=>{if(d.type==="horizontalray"&&d.primitive){const U=d.rawOriginTime??d.primitive.originTime,b=Ve(U,C);d.primitive.originTime=b,d.originTime=b;return}if(d.type==="verticalline"&&d.primitive){const U=d.rawTime??d.primitive.time,b=Ve(U,C);d.primitive.time=b,d.time=te(b);return}if(d.type==="infoline"&&d.primitive&&d.p1&&d.p2){const U=d.rawP1Time??d.p1.rawTime,b=d.rawP2Time??d.p2.rawTime,m=P.length>0?P[0].time:null,M=P.length>0?P[P.length-1].time:null,k=J=>{const ie=Ve(J,C);return m==null||M==null?ie:Math.min(Math.max(ie,m),M)},K=k(U),z=k(b);d.p1.rawTime=K,d.p1.normalizedTime=te(K),d.p2.rawTime=z,d.p2.normalizedTime=te(z),d.primitive.p1={rawTime:K,price:d.p1.price},d.primitive.p2={rawTime:z,price:d.p2.price};return}if(d.type==="rulerline"&&d.primitive&&d.p1&&d.p2){const U=d.rawP1Time??d.p1.rawTime,b=d.rawP2Time??d.p2.rawTime,m=P.length>0?P[0].time:null,M=P.length>0?P[P.length-1].time:null,k=ge=>{const ye=Ve(ge,C);return m==null||M==null?ye:Math.min(Math.max(ye,m),M)},K=k(U),z=k(b);d.p1.rawTime=K,d.p2.rawTime=z,d.primitive.p1={rawTime:K,price:d.p1.price},d.primitive.p2={rawTime:z,price:d.p2.price};const J=te(K),ie=te(z),he=Math.abs((ie??0)-(J??0));d.primitive.info={priceDiff:d.p2.price-d.p1.price,pricePct:(d.p2.price-d.p1.price)/Math.abs(d.p1.price||1)*100,bars:Os(zs,K,z,Ie),days:Math.max(1,Math.round(he/86400))};return}if(d.type==="arrowedline"&&d.primitive&&d.p1&&d.p2){const U=d.p1.rawTime,b=d.p2.rawTime,m=Ve(U,C),M=Ve(b,C);d.p1.rawTime=m,d.p1.normalizedTime=te(m),d.p2.rawTime=M,d.p2.normalizedTime=te(M),d.primitive.p1={rawTime:m,price:d.p1.price},d.primitive.p2={rawTime:M,price:d.p2.price};return}if(d.type==="rayline"&&d.primitive&&d.p1&&d.p2){const U=d.p1.rawTime,b=d.p2.rawTime,m=Ve(U,C),M=Ve(b,C);d.p1.rawTime=m,d.p1.normalizedTime=te(m),d.p2.rawTime=M,d.p2.normalizedTime=te(M),d.primitive.p1={rawTime:m,price:d.p1.price},d.primitive.p2={rawTime:M,price:d.p2.price};return}if(d.type==="extendedline"&&d.primitive&&d.p1&&d.p2){const U=d.p1.rawTime,b=d.p2.rawTime,m=Ve(U,C),M=Ve(b,C);d.p1.rawTime=m,d.p1.normalizedTime=te(m),d.p2.rawTime=M,d.p2.normalizedTime=te(M),d.primitive.p1={rawTime:m,price:d.p1.price},d.primitive.p2={rawTime:M,price:d.p2.price};return}if(d.type==="trendbyangle"&&d.primitive&&d.p1&&d.p2){const U=d.p1.rawTime,b=d.p2.rawTime,m=Ve(U,C),M=Ve(b,C);d.p1.rawTime=m,d.p1.normalizedTime=te(m),d.p2.rawTime=M,d.p2.normalizedTime=te(M),d.primitive.p1={rawTime:m,price:d.p1.price},d.primitive.p2={rawTime:M,price:d.p2.price};return}if(d.type==="disjointchannel"&&d.primitive&&d.p1&&d.p2&&d.p3&&d.p4){const U=b=>{const m=Ve(b.rawTime,C);b.rawTime=m,b.normalizedTime=te(m)};U(d.p1),U(d.p2),U(d.p3),U(d.p4),d.primitive.p1={rawTime:d.p1.rawTime,price:d.p1.price},d.primitive.p2={rawTime:d.p2.rawTime,price:d.p2.price},d.primitive.p3={rawTime:d.p3.rawTime,price:d.p3.price},d.primitive.p4={rawTime:d.p4.rawTime,price:d.p4.price};return}if(d.type==="flattopbottom"&&d.primitive&&d.p1&&d.p2&&d.p3&&d.p4){const U=b=>{const m=Ve(b.rawTime,C);b.rawTime=m,b.normalizedTime=te(m)};U(d.p1),U(d.p2),U(d.p3),U(d.p4),d.primitive.p1={rawTime:d.p1.rawTime,price:d.p1.price},d.primitive.p2={rawTime:d.p2.rawTime,price:d.p2.price},d.primitive.p3={rawTime:d.p3.rawTime,price:d.p3.price},d.primitive.p4={rawTime:d.p4.rawTime,price:d.p4.price};return}if(d.type==="regressionchannel"&&d.primitive&&d.p1&&d.p2){const U=$r(P,d.p1,d.p2,d.stdMultiplier??1);if(!U)return;const b=d.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},d.p1=U.p1,d.p2=U.p2,d.top1=U.top1,d.top2=U.top2,d.bot1=U.bot1,d.bot2=U.bot2,d.slope=U.slope,d.intercept=U.intercept,d.stdDev=U.stdDev,d.offset=U.offset,d.barCount=U.barCount;return}if(d.type==="stddevchannel"&&d.primitive&&d.p1&&d.p2){const U=Xr(P,d.p1,d.p2,d.stdMultiplier??1);if(!U)return;const b=d.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},d.p1=U.p1,d.p2=U.p2,d.top1=U.top1,d.top2=U.top2,d.bot1=U.bot1,d.bot2=U.bot2,d.slope=U.slope,d.stdDev=U.stdDev,d.offset=U.offset,d.barCount=U.barCount;return}if(d.type==="andrewspitchfork"&&d.primitive&&d.p1&&d.p2&&d.p3){const U=Ve(d.p1.rawTime,C),b=Ve(d.p2.rawTime,C),m=Ve(d.p3.rawTime,C);d.p1.rawTime=U,d.p1.normalizedTime=te(U),d.p2.rawTime=b,d.p2.normalizedTime=te(b),d.p3.rawTime=m,d.p3.normalizedTime=te(m),d.primitive.p1={rawTime:U,price:d.p1.price},d.primitive.p2={rawTime:b,price:d.p2.price},d.primitive.p3={rawTime:m,price:d.p3.price};return}if((d.type==="gannfan"||d.type==="ganngrid")&&d.primitive&&d.p1&&d.p2){const U=Ve(d.p1.rawTime,C),b=Ve(d.p2.rawTime,C);d.p1.rawTime=U,d.p1.normalizedTime=te(U),d.p2.rawTime=b,d.p2.normalizedTime=te(b),d.primitive.p1={rawTime:U,price:d.p1.price},d.primitive.p2={rawTime:b,price:d.p2.price};return}if((d.type==="circle"||d.type==="ellipse")&&d.primitive&&d.p1&&d.p2){const U=Ve(d.p1.rawTime,C),b=Ve(d.p2.rawTime,C);d.p1.rawTime=U,d.p1.normalizedTime=te(U),d.p2.rawTime=b,d.p2.normalizedTime=te(b),d.primitive.p1={rawTime:U,price:d.p1.price},d.primitive.p2={rawTime:b,price:d.p2.price};return}if(d.type==="triangle"&&d.primitive&&d.p1&&d.p2&&d.p3){const U=Ve(d.p1.rawTime,C),b=Ve(d.p2.rawTime,C),m=Ve(d.p3.rawTime,C);d.p1.rawTime=U,d.p1.normalizedTime=te(U),d.p2.rawTime=b,d.p2.normalizedTime=te(b),d.p3.rawTime=m,d.p3.normalizedTime=te(m),d.primitive.p1={rawTime:U,price:d.p1.price},d.primitive.p2={rawTime:b,price:d.p2.price},d.primitive.p3={rawTime:m,price:d.p3.price};return}if((d.type==="fibonacci"||d.type==="rectangle")&&d.primitive&&d.p1&&d.p2){const U=Ve(d.p1.rawTime,C),b=Ve(d.p2.rawTime,C);d.p1.rawTime=U,d.p1.normalizedTime=te(U),d.p2.rawTime=b,d.p2.normalizedTime=te(b),d.primitive.p1={rawTime:U,price:d.p1.price},d.primitive.p2={rawTime:b,price:d.p2.price};return}if(d.type!=="trendline"&&d.type!=="gannline"||!d.series||!d.point1||!d.point2)return;const L=d.point1.rawTime??d.point1.time,w=d.point2.rawTime??d.point2.time,p=Ve(L,C),D=Ve(w,C);d.point1.time=p,d.point2.time=D;const _=MA([{time:p,value:d.point1.price},{time:D,value:d.point2.price}]);try{_.length>0&&d.series.setData(_)}catch{}}),P?.length>0){const d=P[P?.length-1].time,L=pA(Ie)||60,p=d-(Ie==="M1"?150:Ie==="M5"?120:100)*L;try{ce.setVisibleRange({from:p,to:d+L*Ud})}catch{ce.fitContent()}}else ce.fitContent();try{u.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0;const B=ce.getVisibleRange();Qe(B),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>ot(!1)),400)}}},[Te.length,lt,Fe,Ie]),q.useEffect(()=>{const f=c.current;if(!f||!ae.current||Te.length===0)return;const u=f.timeScale(),O=u.getVisibleRange()||ve();if(h.current)try{f.removeSeries(h.current)}catch{}if(v.current)try{f.removeSeries(v.current),v.current=null}catch{}let de;const y=(typeof Fe=="string"?Fe:Fe?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),G=y.includes("JPY"),W=en(y),Y=tn(y);let ce,E;G?(ce=.001,E=C=>Math.abs(Number(C)).toFixed(3)):Y?y.startsWith("BTC")||y.startsWith("ETH")?(ce=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(ce=1e-4,E=C=>Math.abs(Number(C)).toFixed(4)):W&&(y.startsWith("XAU")||y.startsWith("XAG"))?(ce=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(ce=1e-4,E=C=>Math.abs(Number(C)).toFixed(5));const P={type:"custom",minMove:ce,formatter:E};if(lt==="bars"){const C=Pe==="light";de=f.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:P,scaleMargins:{top:.1,bottom:.1}});const B=[...Te].sort((d,L)=>d.time-L.time);B?.length>0&&de.setData(B)}else if(lt==="line"){de=f.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:P,scaleMargins:{top:.1,bottom:.1}});const C=MA(fl);C.length>0&&de.setData(C)}else if(lt==="area"){de=f.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:P,scaleMargins:{top:.1,bottom:.1}});const C=MA(fl);C.length>0&&de.setData(C)}else if(lt==="volume ticks"||lt==="volume"){const C=Pe==="light";de=f.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:P,priceScaleId:"right"});const B=[...Te].sort((w,p)=>w.time-p.time);B?.length>0&&de.setData(B);const d=f.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});f.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),f.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const L=B?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));L.length>0&&d.setData(L),v.current=d}else{const C=Pe==="light";de=f.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:P,scaleMargins:{top:.1,bottom:.1}});const B=[...Te].sort((d,L)=>d.time-L.time);B?.length>0&&de.setData(B)}if(h.current=de,we&&de)try{de.applyOptions({upColor:we.upColor,downColor:we.downColor,wickUpColor:we.upColor,wickDownColor:we.downColor,borderUpColor:we.upColor,borderDownColor:we.downColor})}catch{}Vd(de,!0);const $=pA(Ie)||60;if(x.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const U=C.rawOriginTime??C.primitive.originTime,b=Ve(U,$);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const U=C.rawTime??C.primitive.time,b=Ve(U,$);C.primitive.time=b,C.time=te(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,m=[...Te].sort((ie,he)=>ie.time-he.time),M=m.length>0?m[0].time:null,k=m.length>0?m[m.length-1].time:null,K=ie=>{const he=Ve(ie,$);return M==null||k==null?he:Math.min(Math.max(he,M),k)},z=K(U),J=K(b);C.p1.rawTime=z,C.p1.normalizedTime=te(z),C.p2.rawTime=J,C.p2.normalizedTime=te(J),C.primitive.p1={rawTime:z,price:C.p1.price},C.primitive.p2={rawTime:J,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,m=[...Te].sort((ye,Le)=>ye.time-Le.time),M=m.length>0?m[0].time:null,k=m.length>0?m[m.length-1].time:null,K=ye=>{const Le=Ve(ye,$);return M==null||k==null?Le:Math.min(Math.max(Le,M),k)},z=K(U),J=K(b);C.p1.rawTime=z,C.p2.rawTime=J,C.primitive.p1={rawTime:z,price:C.p1.price},C.primitive.p2={rawTime:J,price:C.p2.price};const ie=te(z),he=te(J),ge=Math.abs((he??0)-(ie??0));C.primitive.info={priceDiff:C.p2.price-C.p1.price,pricePct:(C.p2.price-C.p1.price)/Math.abs(C.p1.price||1)*100,bars:Os(zs,z,J,Ie),days:Math.max(1,Math.round(ge/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,m=Ve(U,$),M=Ve(b,$);C.p1.rawTime=m,C.p1.normalizedTime=te(m),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,m=Ve(U,$),M=Ve(b,$);C.p1.rawTime=m,C.p1.normalizedTime=te(m),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,m=Ve(U,$),M=Ve(b,$);C.p1.rawTime=m,C.p1.normalizedTime=te(m),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,m=Ve(U,$),M=Ve(b,$);C.p1.rawTime=m,C.p1.normalizedTime=te(m),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:m,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const m=Ve(b.rawTime,$);b.rawTime=m,b.normalizedTime=te(m)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="flattopbottom"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const m=Ve(b.rawTime,$);b.rawTime=m,b.normalizedTime=te(m)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="regressionchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Te].sort((M,k)=>M.time-k.time),b=$r(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const m=C.primitive;m.mid1={rawTime:b.p1.rawTime,price:b.p1.price},m.mid2={rawTime:b.p2.rawTime,price:b.p2.price},m.top1={rawTime:b.top1.rawTime,price:b.top1.price},m.top2={rawTime:b.top2.rawTime,price:b.top2.price},m.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},m.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.intercept=b.intercept,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Te].sort((M,k)=>M.time-k.time),b=Xr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const m=C.primitive;m.mid1={rawTime:b.p1.rawTime,price:b.p1.price},m.mid2={rawTime:b.p2.rawTime,price:b.p2.price},m.top1={rawTime:b.top1.rawTime,price:b.top1.price},m.top2={rawTime:b.top2.rawTime,price:b.top2.price},m.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},m.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Ve(C.p1.rawTime,$),b=Ve(C.p2.rawTime,$),m=Ve(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=m,C.p3.normalizedTime=te(m),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:m,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const U=Ve(C.p1.rawTime,$),b=Ve(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const U=Ve(C.p1.rawTime,$),b=Ve(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Ve(C.p1.rawTime,$),b=Ve(C.p2.rawTime,$),m=Ve(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=m,C.p3.normalizedTime=te(m),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:m,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const U=Ve(C.p1.rawTime,$),b=Ve(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type!=="trendline"&&C.type!=="gannline"||!C.series||!C.point1||!C.point2)return;const B=C.type==="gannline"?"#7aa6ae":"#22c55e";try{f.removeSeries(C.series)}catch{}const d=f.addLineSeries({color:C.lineColor??B,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),L=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=Ve(L,$),D=Ve(w,$);C.point1.time=p,C.point2.time=D;const _=MA([{time:p,value:C.point1.price},{time:D,value:C.point2.price}]);try{_.length>0&&d.setData(_)}catch{}if(C.decoration)try{d.attachPrimitive(C.decoration)}catch{}C.series=d}),O&&ae.current)setTimeout(()=>{try{u.setVisibleRange(O),Qe(O)}catch{if(Te.length>0)try{const B=Te[Te.length-1].time,d=pA(Ie)||60,L=B-100*d;u.setVisibleRange({from:L,to:B+d*Ud}),Qe(u.getVisibleRange())}catch{u.fitContent(),Qe(u.getVisibleRange())}}try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!ae.current){u.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}ae.current=!0,Qe(u.getVisibleRange())}},[lt,Te.length,fl.length,Fe,we]),q.useEffect(()=>{const f=c.current,u=v.current;if(!f||!u||!ae.current||Te.length===0||lt!=="volume"&<!=="volume ticks")return;const de=[...Te].sort((y,G)=>y.time-G.time)?.map(y=>({time:y.time,value:y.volume||0,color:y.close>=y.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));de.length>0&&u.setData(de)},[Te,lt]),q.useEffect(()=>{if(!Fe||!Ie||!xt)return;const u=Object.entries(xt).filter(([Y,ce])=>ce).map(([Y])=>Y).filter(Y=>Y.startsWith("sma")||Y.startsWith("ema")||Y==="rsi"||Y==="macd");if(u.length===0){Ut({});return}const O=u.map(Y=>Y==="sma20"?`sma:${Rt?.smaPeriod||20}`:Y==="sma50"?"sma:50":Y==="ema12"?`ema:${Rt?.emaPeriod||12}`:Y==="rsi"?`rsi:${Rt?.rsiPeriod||14}`:Y==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const de=++Lt.current,y=hA||"http://localhost:5002",G=xA?.indicators||"/api/market-data/indicators",W=localStorage.getItem("token")??localStorage.getItem("authToken");gt.get(`${y}${G}`,{params:{symbol:Fe,timeframe:Ie,indicators:O},headers:W?{Authorization:`Bearer ${W}`}:{}}).then(Y=>{de===Lt.current&&Ut(Y.data?.data||{})}).catch(Y=>{console.error("[ChartArea] Indicator fetch error:",Y?.message),de===Lt.current&&Ut({})})},[Fe,Ie,xt,Rt,hA,xA]),q.useEffect(()=>{const f=c.current;if(!f||!ae.current)return;const u=vt.current,O=(P,$)=>(u[P]||(u[P]=f.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...$})),u[P]),de=P=>{if(u[P]){try{f.removeSeries(u[P])}catch{}delete u[P]}},y=()=>{["macdLine","macdSignal","macdHist"].forEach(de)},G=xt||{};if(G.sma20&&it.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(it.sma20.data.map($=>({time:$.time,value:$.value}))):de("sma20"),G.sma50&&it.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(it.sma50.data.map($=>({time:$.time,value:$.value}))):de("sma50"),G.ema12&&it.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(it.ema12.data.map($=>({time:$.time,value:$.value}))):de("ema12"),G.rsi&&it.rsi?.data?.length){const P=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:d=>d.toFixed(1)}});f.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),P.setData(it.rsi.data.map(d=>({time:d.time,value:d.value}))),u.rsi70||(u.rsi70=f.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),u.rsi30||(u.rsi30=f.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const $=it.rsi.data,C=$[0]?.time,B=$[$.length-1]?.time;C&&B&&(u.rsi70.setData([{time:C,value:70},{time:B,value:70}]),u.rsi30.setData([{time:C,value:30},{time:B,value:30}]))}else de("rsi"),de("rsi70"),de("rsi30");if(G.macd&&it.macd?.data?.length){const P=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:d=>d.toFixed(4)}}),$=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});u.macdHist||(u.macdHist=f.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:d=>d.toFixed(4)}}));const C=G.rsi?.65:.8;f.priceScale("macd").applyOptions({scaleMargins:{top:C,bottom:0},borderVisible:!1,autoScale:!0}),G.rsi&&f.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const B=it.macd.data;P.setData(B.map(d=>({time:d.time,value:d.value}))),$.setData(B.map(d=>({time:d.time,value:d.signal}))),u.macdHist.setData(B.map(d=>({time:d.time,value:d.histogram,color:d.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else y();const W=()=>{["bbUpper","bbMiddle","bbLower"].forEach(de)};if(G.bollinger){const P=Array.from(Ai.current.values()).sort((d,L)=>d.time-L.time),$=Ze.current?.bbPeriod||20,C=Ze.current?.bbStdDev||2,B=bl(P,$,C);if(B){const d=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),L=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});d.setData(B.upper),L.setData(B.middle),w.setData(B.lower)}}else W();const Y=Array.from(Ai.current.values()).sort((P,$)=>P.time-$.time);if(Y.length>0){const P=Ze.current||{};if(G.sma20&&u.sma20){const $=Ks(Y,P.smaPeriod||20);if($)try{u.sma20.update($)}catch{}}if(G.sma50&&u.sma50){const $=Ks(Y,50);if($)try{u.sma50.update($)}catch{}}if(G.ema12&&u.ema12){const $=Md(Y,P.emaPeriod||12);if($)try{u.ema12.update($)}catch{}}if(G.rsi&&u.rsi){const $=Hd(Y,P.rsiPeriod||14);if($){try{u.rsi.update($)}catch{}if(u.rsi70)try{u.rsi70.update({time:$.time,value:70})}catch{}if(u.rsi30)try{u.rsi30.update({time:$.time,value:30})}catch{}}}if(G.macd&&u.macdLine){const $=Id(Y,12,26,9);if($){try{u.macdLine.update({time:$.time,value:$.value})}catch{}try{u.macdSignal.update({time:$.time,value:$.signal})}catch{}try{u.macdHist.update({time:$.time,value:$.histogram,color:$.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(G.bollinger&&u.bbMiddle){const $=Xs(Y,P.bbPeriod||20,P.bbStdDev||2);if($){try{u.bbUpper.update({time:$.time,value:$.upper})}catch{}try{u.bbMiddle.update({time:$.time,value:$.middle})}catch{}try{u.bbLower.update({time:$.time,value:$.lower})}catch{}}}}const ce=G.rsi&&it.rsi?.data?.length||G.macd&&it.macd?.data?.length,E=G.rsi&&it.rsi?.data?.length&&G.macd&&it.macd?.data?.length;try{f.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:E?.4:ce?.25:.05}})}catch{}},[it,xt,Te.length]),q.useEffect(()=>()=>{const f=c.current;if(!f)return;const u=vt.current;Object.keys(u).forEach(O=>{try{f.removeSeries(u[O])}catch{}}),vt.current={}},[Fe,Ie]),q.useEffect(()=>{const f=c.current,u=h.current,O=o.current;if(!f||!u||!O)return;const y=Ee!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,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"][Ee]:null,G=(E,P)=>{const $=Math.min(E.time,P.time),C=Math.max(E.time,P.time),B=E.time<=P.time?E.rawTime:P.rawTime,d=E.time<=P.time?P.rawTime:E.rawTime,L=Math.max(E.price,P.price),w=Math.min(E.price,P.price),p=te(Math.round(($+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:L},p2:{rawTime:B,normalizedTime:$,price:w},p3:{rawTime:d,normalizedTime:C,price:w}}};if(!y){if(T.current=!1,S.current=null,I.current=null,N.current=null,Q.current?.series)try{f.removeSeries(Q.current.series)}catch{}if(Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null;return}if(y==="pricelevel"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const p={type:"pricelevel",priceLine:u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:L.toFixed(5)}),price:L,showPrice:!0,showText:!1};Ce(D=>[...D,p]),x.current.push(p),Me(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(y==="horizontalray"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=new ad(L,d);u.attachPrimitive(w);const p=u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof L=="number"?L.toFixed(5):""}),D=te(d),_={type:"horizontalray",primitive:w,priceLine:p,price:L,originTime:D,rawOriginTime:d,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Ce(U=>[...U,_]),x.current.push(_),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="verticalline"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=f.timeScale().coordinateToTime(C);if(B==null)return;const d=new Td(B);u.attachPrimitive(d);const L=te(B),w={type:"verticalline",primitive:d,time:L,rawTime:B,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Ce(p=>[...p,w]),x.current.push(w),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="text"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=new Qd(d,L);u.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:d,price:L,text:"Text"};Ce(D=>[...D,p]),x.current.push(p),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="infoline"){let E=null,P=null;const $=B=>{if(!E)return;const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(p==null||D==null)return;P||(P=f.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const _=E.normalizedTime,U=te(p);if(_==null||U==null||_===U)return;const b=_<=U?[{time:_,value:E.price},{time:U,value:D}]:[{time:U,value:D},{time:_,value:E.price}];try{P.setData(b)}catch{}},C=B=>{const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(p==null||D==null)return;if(!E){E={rawTime:p,price:D,normalizedTime:te(p),x:L,y:w};return}if(P){try{f.removeSeries(P)}catch{}P=null}const _=E.normalizedTime,U=te(p);if(_==null||U==null)return;const b=D-E.price,m=b/Math.abs(E.price)*100,M=pA(Ie)||3600,k=Math.abs(U-_),K=Math.max(1,Math.round(k/M)),z=Math.max(1,Math.round(k/86400)),J=E.x,ie=E.y,he=L,ye=Math.atan2(-(w-ie),he-J)*(180/Math.PI),Le={priceDiff:b,pricePct:m,bars:K,days:z,angle:ye},Je=new cd({rawTime:E.rawTime,price:E.price},{rawTime:p,price:D},Le);u.attachPrimitive(Je);const tt={type:"infoline",primitive:Je,rawP1Time:E.rawTime,rawP2Time:p,p1:{rawTime:E.rawTime,normalizedTime:_,price:E.price},p2:{rawTime:p,normalizedTime:U,price:D},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Ce(We=>[...We,tt]),x.current.push(tt),E=null,Me(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),P)try{f.removeSeries(P)}catch{}}}if(y==="rulerline"){let E=null,P=null;const $=(d,L,w,p)=>{const D=te(d),_=te(w),U=p-L,b=U/Math.abs(L)*100,m=Os(zs,d,w,Ie),M=Math.abs((_??0)-(D??0)),k=Math.max(1,Math.round(M/86400));return{priceDiff:U,pricePct:b,bars:m,days:k}},C=d=>{if(!E)return;const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;const U=te(D);if(U==null||U===E.normalizedTime)return;const b=$(E.rawTime,E.price,D,_);if(!P)P=new nl({rawTime:E.rawTime,price:E.price},{rawTime:D,price:_},b),u.attachPrimitive(P);else{P.p2={rawTime:D,price:_},P.info=b;const m=_>=E.price;P.color=m?"#3b82f6":"#ef5350",P.fillColor=m?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},B=d=>{const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;if(!E){E={rawTime:D,price:_,normalizedTime:te(D)};return}if(P){try{u.detachPrimitive(P)}catch{}P=null}const U=E.normalizedTime,b=te(D);if(U==null||b==null)return;const m=$(E.rawTime,E.price,D,_),M=new nl({rawTime:E.rawTime,price:E.price},{rawTime:D,price:_},m);u.attachPrimitive(M);const k={type:"rulerline",primitive:M,rawP1Time:E.rawTime,rawP2Time:D,p1:{rawTime:E.rawTime,normalizedTime:U,price:E.price},p2:{rawTime:D,normalizedTime:b,price:_},lineColor:_>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Ce(K=>[...K,k]),x.current.push(k),E=null,Me(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),P)try{u.detachPrimitive(P)}catch{}}}if(y==="arrowedline"){let E=null,P=null;const $=B=>{if(!E)return;const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(p==null||D==null)return;const _=te(p);if(!(_==null||_===E.normalizedTime))if(!P)P=new sl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:D}),u.attachPrimitive(P);else{P.p2={rawTime:p,price:D};try{c.current?.applyOptions({})}catch{}}},C=B=>{const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(p==null||D==null)return;if(!E){E={rawTime:p,price:D,normalizedTime:te(p)};return}if(P){try{u.detachPrimitive(P)}catch{}P=null}const _=E.normalizedTime,U=te(p);if(_==null||U==null||_===U)return;const b=new sl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:D});u.attachPrimitive(b);const m={type:"arrowedline",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:_,price:E.price},p2:{rawTime:p,normalizedTime:U,price:D},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(M=>[...M,m]),x.current.push(m),E=null,Me(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),P)try{u.detachPrimitive(P)}catch{}}}if(y==="rayline"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=C+140,p=f.timeScale().coordinateToTime(w);if(p==null)return;const D=te(d),_=te(p);if(D==null||_==null)return;const U=new fd({rawTime:d,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"rayline",primitive:U,p1:{rawTime:d,normalizedTime:D,price:L},p2:{rawTime:p,normalizedTime:_,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(m=>[...m,b]),x.current.push(b),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="extendedline"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=C+140,p=f.timeScale().coordinateToTime(w);if(p==null)return;const D=te(d),_=te(p);if(D==null||_==null)return;const U=new md({rawTime:d,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"extendedline",primitive:U,p1:{rawTime:d,normalizedTime:D,price:L},p2:{rawTime:p,normalizedTime:_,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};Ce(m=>[...m,b]),x.current.push(b),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="crossline"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=te(d);if(w==null)return;const p=new wd({rawTime:d,price:L});u.attachPrimitive(p);const D={type:"crossline",primitive:p,p:{rawTime:d,normalizedTime:w,price:L},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Ce(_=>[..._,D]),x.current.push(D),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendbyangle"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=C+140,p=f.timeScale().coordinateToTime(w);if(p==null)return;const D=te(d),_=te(p);if(D==null||_==null)return;const U=new Bd({rawTime:d,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"trendbyangle",primitive:U,p1:{rawTime:d,normalizedTime:D,price:L},p2:{rawTime:p,normalizedTime:_,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Ce(m=>[...m,b]),x.current.push(b),Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="disjointchannel"){let E=null,P=null,$=null,C=null,B=0,d=null;const L=(D,_,U,b)=>{if(!d)d=new ks(D,_,U,b),u.attachPrimitive(d);else{d.p1=D,d.p2=_,d.p3=U,d.p4=b;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(B===0||!E)return;const _=O.getBoundingClientRect(),U=D.clientX-_.left,b=D.clientY-_.top;if(B===1){const m=u.coordinateToPrice(b);if(m==null)return;P={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:m},L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price});return}if(B===2&&P){const m=f.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(m==null||M==null)return;const k=te(m);if(k==null)return;const K=(E.price+P.price)/2;M>=K?($={rawTime:m,normalizedTime:k,price:M},C={rawTime:m,normalizedTime:k,price:2*K-M}):(C={rawTime:m,normalizedTime:k,price:M},$={rawTime:m,normalizedTime:k,price:2*K-M}),L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=D=>{const _=O.getBoundingClientRect(),U=D.clientX-_.left,b=D.clientY-_.top,m=f.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(m==null||M==null)return;const k=te(m);if(k!=null){if(B===0){E={rawTime:m,normalizedTime:k,price:M},P={rawTime:m,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;P={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&d){try{u.detachPrimitive(d)}catch{}const K=new ks(d.p1,d.p2,d.p3,d.p4);u.attachPrimitive(K);const z={type:"disjointchannel",primitive:K,p1:E,p2:P,p3:{rawTime:d.p3.rawTime,normalizedTime:te(d.p3.rawTime),price:d.p3.price},p4:{rawTime:d.p4.rawTime,normalizedTime:te(d.p4.rawTime),price:d.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Ce(J=>[...J,z]),x.current.push(z),Me(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),d)try{u.detachPrimitive(d)}catch{}}}if(y==="flattopbottom"){let E=null,P=null,$=null,C=null,B=0,d=null;const L=(D,_,U,b)=>{if(!d)d=new ol(D,_,U,b),u.attachPrimitive(d);else{d.p1=D,d.p2=_,d.p3=U,d.p4=b;try{c.current?.applyOptions({})}catch{}}},w=D=>{if(B===0||!E)return;const _=O.getBoundingClientRect(),U=D.clientX-_.left,b=D.clientY-_.top;if(B===1){const m=u.coordinateToPrice(b);if(m==null)return;P={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:m},L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price});return}if(B===2&&P){const m=f.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(m==null||M==null)return;const k=te(m);if(k==null)return;$={rawTime:m,normalizedTime:k,price:M},C={rawTime:m,normalizedTime:k,price:P.price},L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=D=>{const _=O.getBoundingClientRect(),U=D.clientX-_.left,b=D.clientY-_.top,m=f.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(m==null||M==null)return;const k=te(m);if(k!=null){if(B===0){E={rawTime:m,normalizedTime:k,price:M},P={rawTime:m,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;P={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&d){try{u.detachPrimitive(d)}catch{}const K=new ol(d.p1,d.p2,d.p3,d.p4);u.attachPrimitive(K);const z={type:"flattopbottom",primitive:K,p1:E,p2:P,p3:{rawTime:d.p3.rawTime,normalizedTime:te(d.p3.rawTime),price:d.p3.price},p4:{rawTime:d.p4.rawTime,normalizedTime:te(d.p4.rawTime),price:d.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Ce(J=>[...J,z]),x.current.push(z),Me(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),d)try{u.detachPrimitive(d)}catch{}}}if(y==="regressionchannel"){let E=null,P=null;const $=(d,L)=>{d.mid1={rawTime:L.p1.rawTime,price:L.p1.price},d.mid2={rawTime:L.p2.rawTime,price:L.p2.price},d.top1={rawTime:L.top1.rawTime,price:L.top1.price},d.top2={rawTime:L.top2.rawTime,price:L.top2.price},d.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},d.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=d=>{if(!E)return;const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;const U=te(D);if(U==null)return;const m=$r(Te,E,{rawTime:D,normalizedTime:U},1);if(m)if(!P)P=new Ns({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),u.attachPrimitive(P);else{$(P,m);try{f.applyOptions({})}catch{}}},B=d=>{const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;const U=te(D);if(U==null)return;if(!E){E={rawTime:D,normalizedTime:U,price:_};return}const m=$r(Te,E,{rawTime:D,normalizedTime:U},1);if(!m)return;if(P){try{u.detachPrimitive(P)}catch{}P=null}const M=new Ns({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});u.attachPrimitive(M);const k={type:"regressionchannel",primitive:M,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,intercept:m.intercept,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Ce(K=>[...K,k]),x.current.push(k),E=null,Me(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),P)try{u.detachPrimitive(P)}catch{}}}if(y==="stddevchannel"){let E=null,P=null;const $=(d,L)=>{d.mid1={rawTime:L.p1.rawTime,price:L.p1.price},d.mid2={rawTime:L.p2.rawTime,price:L.p2.price},d.top1={rawTime:L.top1.rawTime,price:L.top1.price},d.top2={rawTime:L.top2.rawTime,price:L.top2.price},d.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},d.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=d=>{if(!E)return;const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;const U=te(D);if(U==null)return;const m=Xr(Te,E,{rawTime:D,normalizedTime:U,price:_},1);if(m)if(!P)P=new ll({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price}),u.attachPrimitive(P);else{$(P,m);try{f.applyOptions({})}catch{}}},B=d=>{const L=O.getBoundingClientRect(),w=d.clientX-L.left,p=d.clientY-L.top,D=f.timeScale().coordinateToTime(w),_=u.coordinateToPrice(p);if(D==null||_==null)return;const U=te(D);if(U==null)return;if(!E){E={rawTime:D,normalizedTime:U,price:_};return}const m=Xr(Te,E,{rawTime:D,normalizedTime:U,price:_},1);if(!m)return;if(P){try{u.detachPrimitive(P)}catch{}P=null}const M=new ll({rawTime:m.p1.rawTime,price:m.p1.price},{rawTime:m.p2.rawTime,price:m.p2.price},{rawTime:m.top1.rawTime,price:m.top1.price},{rawTime:m.top2.rawTime,price:m.top2.price},{rawTime:m.bot1.rawTime,price:m.bot1.price},{rawTime:m.bot2.rawTime,price:m.bot2.price});u.attachPrimitive(M);const k={type:"stddevchannel",primitive:M,p1:m.p1,p2:m.p2,top1:m.top1,top2:m.top2,bot1:m.bot1,bot2:m.bot2,slope:m.slope,stdDev:m.stdDev,offset:m.offset,barCount:m.barCount,stdMultiplier:1};Ce(K=>[...K,k]),x.current.push(k),E=null,Me(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),P)try{u.detachPrimitive(P)}catch{}}}if(y==="andrewspitchfork"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=te(d);if(w==null)return;const p=C+140,D=f.timeScale().coordinateToTime(p);if(D==null)return;const _=te(D);if(_==null)return;const U={rawTime:d,normalizedTime:w,price:L},b={rawTime:D,normalizedTime:_,price:L},m={rawTime:d,normalizedTime:w,price:L},M=new yd({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:m.rawTime,price:m.price});u.attachPrimitive(M);const k={type:"andrewspitchfork",primitive:M,p1:U,p2:b,p3:m};Ce(K=>[...K,k]),x.current.push(k),V(k),Ae.current=k,Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="gannfan"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=te(d);if(w==null)return;const p={rawTime:d,normalizedTime:w,price:L},D={rawTime:d,normalizedTime:w,price:L},_=new Cd({rawTime:p.rawTime,price:p.price},{rawTime:D.rawTime,price:D.price});u.attachPrimitive(_);const U={type:"gannfan",primitive:_,p1:p,p2:D};Ce(b=>[...b,U]),x.current.push(U),V(U),Ae.current=U,Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="ganngrid"){const E=P=>{const $=O.getBoundingClientRect(),C=P.clientX-$.left,B=P.clientY-$.top,d=f.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(d==null||L==null)return;const w=te(d);if(w==null)return;const p={rawTime:d,normalizedTime:w,price:L},D={rawTime:d,normalizedTime:w,price:L},_=new vd({rawTime:p.rawTime,price:p.price},{rawTime:D.rawTime,price:D.price});u.attachPrimitive(_);const U={type:"ganngrid",primitive:_,p1:p,p2:D};Ce(b=>[...b,U]),x.current.push(U),V(U),Ae.current=U,Me(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendline"||y==="gannline"){const E=y,P=E==="gannline"?"#7aa6ae":"#22c55e",$=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,D=L.clientY-w.top;let _=f.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(D);if(!(_==null||U==null)&&(_=te(_),_!=null))if(N.current===null){N.current={time:_,price:U};const b=f.addLineSeries({color:P,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:E,series:b},b.setData([{time:_,value:U}])}else{const b=N.current,m={time:_,price:U},M=1,k=1e-5,K=Math.abs(m.time-b.time),z=Math.abs(m.price-b.price);if(K<M&&z<k){try{f.removeSeries(Q.current.series)}catch{}N.current=null,Q.current=null;return}const J={time:b.time,rawTime:b.time,price:b.price},ie={time:m.time,rawTime:m.time,price:m.price},he=MA([{time:J.time,value:J.price},{time:ie.time,value:ie.price}]);if(he.length>0){Q.current.series.setData(he);const ge=new gd(J,ie,P,2);try{Q.current.series.attachPrimitive(ge)}catch{}const ye={type:E,series:Q.current.series,point1:J,point2:ie,decoration:ge};Ce(Le=>[...Le,ye]),x.current.push(ye)}Me(null),N.current=null,Q.current=null}},C=L=>{if(N.current===null||Q.current?.type!=="trendline"&&Q.current?.type!=="gannline")return;L.preventDefault(),L.stopPropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,D=L.clientY-w.top;let _=f.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(D);if(_==null||U==null||(_=te(_),_==null))return;const b=N.current,m=MA([{time:b.time,value:b.price},{time:_,value:U}]);m.length>0&&Q.current.series.setData(m)},B=L=>{L.stopPropagation()},d={capture:!0,passive:!1};return O.addEventListener("click",$,d),O.addEventListener("mousemove",C,d),O.addEventListener("mousemove",B,d),()=>{if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{f.removeSeries(Q.current.series)}catch{}Q.current=null}O.removeEventListener("click",$,d),O.removeEventListener("mousemove",C,d),O.removeEventListener("mousemove",B,d)}}if(y==="parallellines"){let E=null,P=null,$=null,C=0,B=null;const d=(U,b,m,M)=>{U.p1={rawTime:b.rawTime,price:b.price},U.p2={rawTime:m.rawTime,price:m.price},U.b1={rawTime:M.b1.rawTime,price:M.b1.price},U.b2={rawTime:M.b2.rawTime,price:M.b2.price},U.p3={rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}},L=(U,b,m)=>{const M=Ld(U,b,m);if(!M)return null;if(!B)B=new al({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:M.b1.rawTime,price:M.b1.price},{rawTime:M.b2.rawTime,price:M.b2.price},{rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}),u.attachPrimitive(B);else{d(B,U,b,M);try{f.applyOptions({})}catch{}}return M},w=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const b=O.getBoundingClientRect(),m=U.clientX-b.left,M=U.clientY-b.top,k=f.timeScale().coordinateToTime(m),K=u.coordinateToPrice(M);if(k==null||K==null)return;const z=te(k);if(z!=null){if(C===0){E={rawTime:k,normalizedTime:z,price:K},C=1;return}if(C===1){if(P={rawTime:k,normalizedTime:z,price:K},Math.abs(P.normalizedTime-E.normalizedTime)<1)return;const J=te((E.normalizedTime+P.normalizedTime)/2);if(J==null)return;const ie=(E.price+P.price)/2;$={rawTime:J,normalizedTime:J,price:ie},L(E,P,$),C=2;return}if(C===2&&E&&P){$={rawTime:k,normalizedTime:z,price:K};const J=L(E,P,$);if(!J||!B)return;try{u.detachPrimitive(B)}catch{}const ie=new al({rawTime:E.rawTime,price:E.price},{rawTime:P.rawTime,price:P.price},{rawTime:J.b1.rawTime,price:J.b1.price},{rawTime:J.b2.rawTime,price:J.b2.price},{rawTime:J.bottomMid.rawTime,price:J.bottomMid.price});u.attachPrimitive(ie);const he={type:"equidistantchannel",primitive:ie,p1:E,p2:P,p3:J.bottomMid,b1:J.b1,b2:J.b2,bottomMid:J.bottomMid};Ce(ge=>[...ge,he]),x.current.push(he),Me(null),C=0,E=null,P=null,$=null,B=null}}},p=U=>{if(C===0||!E)return;const b=O.getBoundingClientRect(),m=U.clientX-b.left,M=U.clientY-b.top,k=f.timeScale().coordinateToTime(m),K=u.coordinateToPrice(M);if(k==null||K==null)return;const z=te(k);if(z!=null){if(C===1){const J={rawTime:k,normalizedTime:z,price:K},ie=te((E.normalizedTime+J.normalizedTime)/2);if(ie==null)return;const he=(E.price+J.price)/2;L(E,J,{rawTime:ie,price:he});return}C===2&&P&&L(E,P,{rawTime:k,price:K})}},D=U=>{U.stopPropagation()},_={capture:!0,passive:!1};return O.addEventListener("click",w,_),O.addEventListener("mousemove",p,_),O.addEventListener("mousemove",D,_),()=>{if(C=0,E=null,P=null,$=null,X.current=[],B)try{u.detachPrimitive(B)}catch{}B=null,O.removeEventListener("click",w,_),O.removeEventListener("mousemove",p,_),O.removeEventListener("mousemove",D,_)}}if(y==="fibonacci"){let E=null,P=null;const $=B=>{if(!E)return;const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(!(p==null||D==null))if(!P)P=new cl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:D}),u.attachPrimitive(P);else{P.p2={rawTime:p,price:D};try{f.applyOptions({})}catch{}}},C=B=>{const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=f.timeScale().coordinateToTime(L),D=u.coordinateToPrice(w);if(p==null||D==null)return;if(!E){E={rawTime:p,price:D,normalizedTime:te(p)};return}if(P){try{u.detachPrimitive(P)}catch{}P=null}const _=E.normalizedTime,U=te(p);if(_==null||U==null)return;if(Math.abs(D-E.price)<1e-5){E=null;return}const b=new cl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:D});u.attachPrimitive(b);const m={type:"fibonacci",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:_,price:E.price},p2:{rawTime:p,normalizedTime:U,price:D}};Ce(M=>[...M,m]),x.current.push(m),E=null,Me(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),P)try{u.detachPrimitive(P)}catch{}}}if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{f.removeSeries(Q.current.series)}catch{}Q.current=null}const W=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),y==="trendline"||y==="gannline"||y==="parallellines"||y==="fibonacci"||y!=="rectangle"&&y!=="circle"&&y!=="triangle"&&y!=="ellipse")return;const P=O.getBoundingClientRect(),$=E.clientX-P.left,C=E.clientY-P.top;let B=f.timeScale().coordinateToTime($);const d=u.coordinateToPrice(C);if(B==null||d==null)return;const L=B;if(B=te(B),B!=null){if(T.current=!0,S.current={time:B,normalizedTime:B,rawTime:L,price:d},I.current=null,y==="rectangle"){const w=new hd({rawTime:L,price:d},{rawTime:L,price:d},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"rectangle",primitive:w}}if(y==="circle"){const w=new ud({rawTime:L,price:d},{rawTime:L,price:d},{strokeColor:"#7aa6ae",lineWidth:1});u.attachPrimitive(w),Q.current={type:"circle",primitive:w}}if(y==="triangle"){const w=new pd({rawTime:L,price:d},{rawTime:L,price:d},{rawTime:L,price:d},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"triangle",primitive:w}}if(y==="ellipse"){const w=new dd({rawTime:L,price:d},{rawTime:L,price:d},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});u.attachPrimitive(w),Q.current={type:"ellipse",primitive:w}}if(y==="parallellines"){const w=f.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},Y=E=>{if(!T.current||!S.current||!Q.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const P=O.getBoundingClientRect(),$=E.clientX-P.left,C=E.clientY-P.top;let B=f.timeScale().coordinateToTime($);const d=u.coordinateToPrice(C);if(B==null||d==null)return;const L=B;if(B=te(B),B==null)return;I.current={time:B,normalizedTime:B,rawTime:L,price:d};const w=S.current;if(Q.current.type==="rectangle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:d};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="circle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:d};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="triangle"){const p=Q.current.primitive,D=G(w,{time:B,rawTime:L,price:d});if(!D)return;p.p1={rawTime:D.p1.rawTime,price:D.p1.price},p.p2={rawTime:D.p2.rawTime,price:D.p2.price},p.p3={rawTime:D.p3.rawTime,price:D.p3.price};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="ellipse"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:d};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="parallellines")if(Q.current.firstLine){const p=Q.current.firstLine;p.endTime-p.startTime;const D=p.endPrice-p.startPrice,_=d,U=_+D;if(Q.current.secondLine)Q.current.secondLine.setData([{time:w.time,value:_},{time:B,value:U}]);else{const b=f.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:_},{time:B,value:U}]),Q.current.secondLine=b}}else Q.current.series.setData([{time:w.time,value:w.price},{time:B,value:d}])},ce=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!T.current||!Q.current||!S.current)return;const P=S.current,$=I.current||P;if(Q.current.type==="parallellines")if(Q.current.firstLine){const C={type:"parallellines",firstLine:Q.current.series,secondLine:Q.current.secondLine,firstLineData:Q.current.firstLine};Ce(B=>[...B,C]),x.current.push(C),Me(null),Q.current=null,T.current=!1,S.current=null,I.current=null;return}else{Q.current.firstLine={startTime:P.time,startPrice:P.price,endTime:$.time,endPrice:$.price},T.current=!1,S.current=null,I.current=null;return}if(Q.current.type==="rectangle"){const C=S.current,B=I.current||C,d=Math.max(C.price,B.price),L=Math.min(C.price,B.price),w=te(Math.min(C.time,B.time)),p=te(Math.max(C.time,B.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(d-L)>=1e-5){const D=Q.current.primitive,_=C.time<=B.time?C.rawTime:B.rawTime,U=C.time<=B.time?B.rawTime:C.rawTime,b={rawTime:_,normalizedTime:w,price:d},m={rawTime:U,normalizedTime:p,price:L};D.p1={rawTime:b.rawTime,price:b.price},D.p2={rawTime:m.rawTime,price:m.price};const M={type:"rectangle",primitive:D,p1:b,p2:m};Ce(k=>[...k,M]),x.current.push(M),Me(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="circle"){const C=Q.current.primitive,B={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},d={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=f.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=f.timeScale().timeToCoordinate(d.rawTime),D=u.priceToCoordinate(d.price);if((L!=null&&w!=null&&p!=null&&D!=null?Math.hypot(p-L,D-w):0)>=3){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:d.rawTime,price:d.price};const U={type:"circle",primitive:C,p1:B,p2:d};Ce(b=>[...b,U]),x.current.push(U),Me(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="triangle"){const C=Q.current.primitive,B=G(P,$);if(B){const d=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),L=Math.abs(B.p1.price-B.p2.price);if(d>=1&&L>=1e-5){C.p1={rawTime:B.p1.rawTime,price:B.p1.price},C.p2={rawTime:B.p2.rawTime,price:B.p2.price},C.p3={rawTime:B.p3.rawTime,price:B.p3.price};const w={type:"triangle",primitive:C,p1:B.p1,p2:B.p2,p3:B.p3};Ce(p=>[...p,w]),x.current.push(w),Me(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="ellipse"){const C=Q.current.primitive,B={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},d={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=f.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=f.timeScale().timeToCoordinate(d.rawTime),D=u.priceToCoordinate(d.price);if((L!=null&&w!=null&&p!=null&&D!=null?Math.hypot(p-L,D-w):0)>=4){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:d.rawTime,price:d.price},C.previewAsLine=!1,C.minorRatio=.45;const U={type:"ellipse",primitive:C,p1:B,p2:d,minorRatio:.45};Ce(b=>[...b,U]),x.current.push(U),Me(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}T.current=!1,S.current=null,I.current=null,Q.current=null};if(y==="rectangle"||y==="circle"||y==="triangle"||y==="ellipse"){const E={capture:!0,passive:!1},P=$=>{T.current||$.stopPropagation()};return O.addEventListener("mousedown",W,E),O.addEventListener("mousemove",Y,E),O.addEventListener("mousemove",P,E),O.addEventListener("mouseup",ce,E),()=>{if((Q.current?.type==="rectangle"||Q.current?.type==="circle"||Q.current?.type==="triangle"||Q.current?.type==="ellipse")&&Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null,T.current=!1,S.current=null,I.current=null,O.removeEventListener("mousedown",W,E),O.removeEventListener("mousemove",Y,E),O.removeEventListener("mousemove",P,E),O.removeEventListener("mouseup",ce,E)}}},[Ee,Te,Ce,Me]),q.useEffect(()=>{const f=c.current,u=h.current,O=o.current,de=Ee===null||Ee===1;if(!de||!f||!u||!O){de||(V(null),R([]),le(null),fe([]));return}const y=10,G=8;function W(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const d=f.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=f.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="gannline"&&B.point1&&B.point2){const d=f.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=f.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:(d+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="rectangle"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(d==null||L==null||w==null||p==null)return[];const D=Math.min(d,w),_=Math.max(d,w),U=Math.min(L,p),b=Math.max(L,p),m=(D+_)/2,M=(U+b)/2;return[{x:D,y:U},{x:m,y:U},{x:_,y:U},{x:D,y:M},{x:_,y:M},{x:D,y:b},{x:m,y:b},{x:_,y:b}]}if(B.type==="circle"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),D=f.timeScale().timeToCoordinate(B.p3.rawTime),_=u.priceToCoordinate(B.p3.price);return d==null||L==null||w==null||p==null||D==null||_==null?[]:[{x:d,y:L},{x:w,y:p},{x:D,y:_}]}if(B.type==="ellipse"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(d==null||L==null||w==null||p==null)return[];const D=(d+w)/2,_=(L+p)/2,U=w-d,b=p-L,m=Math.hypot(U,b);if(m<.001)return[];const M=U/m,k=b/m,K=-k,z=M,J=m/2,ie=J*Math.max(.05,B.minorRatio??.45);return[{x:D-M*J,y:_-k*J},{x:D+K*ie,y:_+z*ie},{x:D+M*J,y:_+k*J},{x:D-K*ie,y:_-z*ie}]}if(B.type==="gannfan"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="rayline"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="extendedline"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="crossline"&&B.p){const d=f.timeScale().timeToCoordinate(B.p.rawTime),L=u.priceToCoordinate(B.p.price);return d==null||L==null?[]:[{x:d,y:L}]}if(B.type==="pricelevel"&&B.price!=null){const d=u.priceToCoordinate(B.price);return d==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:d}]}if(B.type==="text"&&B.rawTime!=null&&B.price!=null){const d=f.timeScale().timeToCoordinate(B.rawTime),L=u.priceToCoordinate(B.price);return d==null||L==null?[]:[{x:d,y:L}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),D=f.timeScale().timeToCoordinate(B.p3.rawTime),_=u.priceToCoordinate(B.p3.price);return d==null||L==null||w==null||p==null||D==null||_==null?[]:[{x:d,y:L},{x:w,y:p},{x:D,y:_}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),D=f.timeScale().timeToCoordinate(B.b1.rawTime),_=u.priceToCoordinate(B.b1.price),U=f.timeScale().timeToCoordinate(B.b2.rawTime),b=u.priceToCoordinate(B.b2.price);return d==null||L==null||w==null||p==null||D==null||_==null||U==null||b==null?[]:[{x:d,y:L},{x:w,y:p},{x:(D+U)/2,y:(_+b)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),D=f.timeScale().timeToCoordinate(B.p3.rawTime),_=u.priceToCoordinate(B.p3.price),U=f.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return d==null||L==null||w==null||p==null||D==null||_==null||U==null||b==null?[]:[{x:d,y:L},{x:w,y:p},{x:D,y:_},{x:U,y:b}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),D=f.timeScale().timeToCoordinate(B.p3.rawTime),_=u.priceToCoordinate(B.p3.price),U=f.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return d==null||L==null||w==null||p==null||D==null||_==null||U==null||b==null?[]:[{x:d,y:L},{x:w,y:p},{x:D,y:_},{x:U,y:b}]}if(B.type==="infoline"&&B.p1&&B.p2){const d=B.p1.rawTime??B.p1.time,L=B.p2.rawTime??B.p2.time,w=f.timeScale().timeToCoordinate(d),p=u.priceToCoordinate(B.p1.price),D=f.timeScale().timeToCoordinate(L),_=u.priceToCoordinate(B.p2.price);return w==null||p==null||D==null||_==null?[]:[{x:w,y:p},{x:D,y:_}]}if(B.type==="rulerline"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:(d+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const d=f.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=f.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return d==null||L==null||w==null||p==null?[]:[{x:d,y:L},{x:w,y:p}]}if(B.type==="horizontalray"&&B.primitive){const d=B.primitive,L=f.timeScale().timeToCoordinate(d.originTime),w=u.priceToCoordinate(d.price);return L==null||w==null?[]:[{x:L,y:w}]}if(B.type==="verticalline"&&B.primitive){const d=B.primitive,L=f.timeScale().timeToCoordinate(d.time);if(L==null)return[];const w=d.midYCss??200;return[{x:L,y:w}]}return[]}function Y(B,d){for(let L=$e.length-1;L>=0;L--){const w=$e[L];if(w.type==="trendline"&&w.point1&&w.point2){const p=f.timeScale().timeToCoordinate(w.point1.time),D=u.priceToCoordinate(w.point1.price),_=f.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=f.timeScale().timeToCoordinate(w.point1.time),D=u.priceToCoordinate(w.point1.price),_=f.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||D==null||_==null||U==null)continue;const b=(p+_)/2,m=(D+U)/2,M=Math.hypot(B-p,d-D),k=Math.hypot(B-_,d-U),K=Math.hypot(B-b,d-m);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.min(p,_),m=Math.max(p,_),M=Math.min(D,U),k=Math.max(D,U),K=(b+m)/2,z=(M+k)/2,J=[{x:b,y:M,mode:"handle1"},{x:K,y:M,mode:"handle2"},{x:m,y:M,mode:"handle3"},{x:b,y:z,mode:"handle4"},{x:m,y:z,mode:"handle5"},{x:b,y:k,mode:"handle6"},{x:K,y:k,mode:"handle7"},{x:m,y:k,mode:"handle8"}];for(const Le of J)if(Math.hypot(B-Le.x,d-Le.y)<y)return{object:w,mode:Le.mode};const ie=ut(B,d,b,M,m,M),he=ut(B,d,b,k,m,k),ge=ut(B,d,b,M,b,k),ye=ut(B,d,m,M,m,k);if(ie<G||he<G||ge<G||ye<G||mi(B,d,[{x:b,y:M},{x:m,y:M},{x:m,y:k},{x:b,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(_-p,U-D);if(b<2)continue;const m=Math.hypot(B-p,d-D),M=Math.hypot(B-_,d-U);if(m<y)return{object:w,mode:"handle1"};if(M<y)return{object:w,mode:"handle2"};if(Math.abs(m-b)<G||m<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.p3.rawTime),m=u.priceToCoordinate(w.p3.price);if(p==null||D==null||_==null||U==null||b==null||m==null)continue;const M=Math.hypot(B-p,d-D),k=Math.hypot(B-_,d-U),K=Math.hypot(B-b,d-m);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const z=ut(B,d,p,D,_,U),J=ut(B,d,_,U,b,m),ie=ut(B,d,b,m,p,D);if(z<G||J<G||ie<G||mi(B,d,[{x:p,y:D},{x:_,y:U},{x:b,y:m}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=(p+_)/2,m=(D+U)/2,M=_-p,k=U-D,K=Math.hypot(M,k);if(K<2)continue;const z=M/K,J=k/K,ie=-J,he=z,ge=K/2,ye=ge*Math.max(.05,w.minorRatio??.45);if(ge<2||ye<2)continue;const Le=b-z*ge,Je=m-J*ge,tt=b+ie*ye,We=m+he*ye,yt=b+z*ge,pt=m+J*ge,Ct=b-ie*ye,_t=m-he*ye,qt=Math.hypot(B-Le,d-Je),rA=Math.hypot(B-tt,d-We),uA=Math.hypot(B-yt,d-pt),XA=Math.hypot(B-Ct,d-_t);if(qt<y)return{object:w,mode:"handle1"};if(rA<y)return{object:w,mode:"handle2"};if(uA<y)return{object:w,mode:"handle3"};if(XA<y)return{object:w,mode:"handle4"};const _i=(B-b)*z+(d-m)*J,Gs=(B-b)*ie+(d-m)*he,Rd=_i/ge,Gd=Gs/ye,$d=Rd*Rd+Gd*Gd;if(Math.abs($d-1)<.2||$d<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-_,d-U),m=Math.hypot(B-p,d-D);if(b<y)return{object:w,mode:"handle2"};if(m<y)return{object:w,mode:"handle1"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-_,d-U),m=Math.hypot(B-p,d-D);if(b<y)return{object:w,mode:"handle2"};if(m<y)return{object:w,mode:"handle1"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(xT(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(QT(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=f.timeScale().timeToCoordinate(w.p.rawTime),D=u.priceToCoordinate(w.p.price);if(p==null||D==null)continue;if(Math.hypot(B-p,d-D)<y)return{object:w,mode:"handle1"};const U=Math.abs(d-D),b=Math.abs(B-p);if(U<G||b<G)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=f.timeScale().timeToCoordinate(w.rawTime),D=u.priceToCoordinate(w.price);if(p==null||D==null)continue;const _=xd(w,p,D);if(B>=_.left&&B<=_.right&&d>=_.top&&d<=_.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.b1.rawTime),m=u.priceToCoordinate(w.b1.price),M=f.timeScale().timeToCoordinate(w.b2.rawTime),k=u.priceToCoordinate(w.b2.price),K=b!=null&&M!=null?(b+M)/2:null,z=m!=null&&k!=null?(m+k)/2:null;if(p==null||D==null||_==null||U==null||K==null||z==null||b==null||m==null||M==null||k==null)continue;const J=Math.hypot(B-p,d-D),ie=Math.hypot(B-_,d-U),he=Math.hypot(B-K,d-z),ge=Math.hypot(p-K,D-z)<y*1.5;if(ge&&Math.min(J,he)<y*1.5)return{object:w,mode:"handle3"};if(he<y)return{object:w,mode:"handle3"};if(ie<y)return{object:w,mode:"handle2"};if(ge)continue;if(J<y)return{object:w,mode:"handle1"};const ye=ut(B,d,p,D,_,U),Le=ut(B,d,b,m,M,k);if(ye<G||Le<G||mi(B,d,[{x:p,y:D},{x:_,y:U},{x:M,y:k},{x:b,y:m}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.top1.rawTime),m=u.priceToCoordinate(w.top1.price),M=f.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=f.timeScale().timeToCoordinate(w.bot1.rawTime),z=u.priceToCoordinate(w.bot1.price),J=f.timeScale().timeToCoordinate(w.bot2.rawTime),ie=u.priceToCoordinate(w.bot2.price);if(p==null||D==null||_==null||U==null||b==null||m==null||M==null||k==null||K==null||z==null||J==null||ie==null)continue;const he=Math.hypot(B-p,d-D),ge=Math.hypot(B-_,d-U);if(he<y)return{object:w,mode:"handle1"};if(ge<y)return{object:w,mode:"handle2"};const ye=ut(B,d,p,D,_,U),Le=ut(B,d,b,m,M,k),Je=ut(B,d,K,z,J,ie);if(ye<G||Le<G||Je<G||mi(B,d,[{x:b,y:m},{x:M,y:k},{x:J,y:ie},{x:K,y:z}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.top1.rawTime),m=u.priceToCoordinate(w.top1.price),M=f.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=f.timeScale().timeToCoordinate(w.bot1.rawTime),z=u.priceToCoordinate(w.bot1.price),J=f.timeScale().timeToCoordinate(w.bot2.rawTime),ie=u.priceToCoordinate(w.bot2.price);if(p==null||D==null||_==null||U==null||b==null||m==null||M==null||k==null||K==null||z==null||J==null||ie==null)continue;const he=Math.hypot(B-p,d-D),ge=Math.hypot(B-_,d-U);if(he<y)return{object:w,mode:"handle1"};if(ge<y)return{object:w,mode:"handle2"};const ye=ut(B,d,p,D,_,U),Le=ut(B,d,b,m,M,k),Je=ut(B,d,K,z,J,ie);if(ye<G||Le<G||Je<G||mi(B,d,[{x:b,y:m},{x:M,y:k},{x:J,y:ie},{x:K,y:z}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.p3.rawTime),m=u.priceToCoordinate(w.p3.price);if(p==null||D==null||_==null||U==null||b==null||m==null)continue;const M=Math.hypot(B-p,d-D),k=Math.hypot(B-_,d-U),K=Math.hypot(B-b,d-m);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const z=(_+b)/2,J=(U+m)/2;let ie=z-p,he=J-D;Math.abs(ie)<1e-4&&(ie=1e-4);const ge=he/ie,ye=O.clientWidth,Le=U+ge*(ye-_),Je=m+ge*(ye-b),tt=ut(B,d,_,U,ye,Le),We=ut(B,d,b,m,ye,Je);if(tt<G||We<G||mi(B,d,[{x:_,y:U},{x:ye,y:Le},{x:ye,y:Je},{x:b,y:m}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.p3.rawTime),m=u.priceToCoordinate(w.p3.price),M=f.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||D==null||_==null||U==null||b==null||m==null||M==null||k==null)continue;const K=Math.hypot(B-p,d-D),z=Math.hypot(B-_,d-U),J=Math.hypot(B-b,d-m),ie=Math.hypot(B-M,d-k);if(K<y)return{object:w,mode:"handle1"};if(z<y)return{object:w,mode:"handle2"};if(J<y)return{object:w,mode:"handle3"};if(ie<y)return{object:w,mode:"handle4"};const he=ut(B,d,p,D,b,m),ge=ut(B,d,_,U,M,k),ye=ut(B,d,p,D,_,U),Le=ut(B,d,b,m,M,k);if(he<G||ge<G||ye<G||Le<G||mi(B,d,[{x:p,y:D},{x:b,y:m},{x:M,y:k},{x:_,y:U}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=f.timeScale().timeToCoordinate(w.p3.rawTime),m=u.priceToCoordinate(w.p3.price),M=f.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||D==null||_==null||U==null||b==null||m==null||M==null||k==null)continue;const K=Math.hypot(B-p,d-D),z=Math.hypot(B-_,d-U),J=Math.hypot(B-b,d-m),ie=Math.hypot(B-M,d-k);if(K<y)return{object:w,mode:"handle1"};if(z<y)return{object:w,mode:"handle2"};if(J<y)return{object:w,mode:"handle3"};if(ie<y)return{object:w,mode:"handle4"};const he=ut(B,d,p,D,b,m),ge=ut(B,d,_,U,M,k),ye=ut(B,d,p,D,_,U),Le=ut(B,d,b,m,M,k);if(he<G||ge<G||ye<G||Le<G||mi(B,d,[{x:p,y:D},{x:b,y:m},{x:M,y:k},{x:_,y:U}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=(p+_)/2,m=(D+U)/2,M=Math.hypot(B-p,d-D),k=Math.hypot(B-_,d-U),K=Math.hypot(B-b,d-m);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,D=w.p2.rawTime??w.p2.time,_=f.timeScale().timeToCoordinate(p),U=u.priceToCoordinate(w.p1.price),b=f.timeScale().timeToCoordinate(D),m=u.priceToCoordinate(w.p2.price);if(_==null||U==null||b==null||m==null)continue;const M=Math.hypot(B-_,d-U),k=Math.hypot(B-b,d-m);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(ut(B,d,_,U,b,m)<G)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=f.timeScale().timeToCoordinate(w.p1.rawTime),D=u.priceToCoordinate(w.p1.price),_=f.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||D==null||_==null||U==null)continue;const b=Math.hypot(B-p,d-D),m=Math.hypot(B-_,d-U);if(b<y)return{object:w,mode:"handle1"};if(m<y)return{object:w,mode:"handle2"};if(ut(B,d,p,D,_,U)<G)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,D=f.timeScale().timeToCoordinate(p.originTime),_=u.priceToCoordinate(p.price);if(_==null)continue;if(D!=null&&Math.hypot(B-D,d-_)<y)return{object:w,mode:"handle1"};const U=D==null?0:Math.max(0,D);if(B>=U&&Math.abs(d-_)<G)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,D=f.timeScale().timeToCoordinate(p.time);if(D==null)continue;const _=p.midYCss??200;if(Math.hypot(B-D,d-_)<y)return{object:w,mode:"handle1"};if(Math.abs(B-D)<G)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=u.priceToCoordinate(w.price);if(p==null)continue;const _=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(B-_,d-p)<y)return{object:w,mode:"line"};if(Math.abs(d-p)<G)return{object:w,mode:"line"}}}return null}const ce=B=>{const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top,p=Y(L,w);if(p){if(B.preventDefault(),B.stopPropagation(),B.detail>=2){ue.current=!0,Z(p.object),j.current=null,se.current=null;return}V(p.object),le(null),fe([]),j.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(se.current={x:L,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(se.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="equidistantchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="andrewspitchfork"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="regressionchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="disjointchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="flattopbottom"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="fibonacci"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="rectangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4"||p.mode==="handle5"||p.mode==="handle6"||p.mode==="handle7"||p.mode==="handle8")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="triangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="ellipse"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}),p.object.type==="horizontalray"&&(p.mode==="handle1"||p.mode==="line")&&(se.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}),p.object.type==="verticalline"&&(p.mode==="handle1"||p.mode==="line")&&(se.current={x:L,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?se.current={x:L,y:w,p:{...p.object.p}}:p.object.type==="text"?se.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="flattopbottom"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="fibonacci"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?se.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?se.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?se.current={x:L,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?se.current={y:w,price:p.object.price}:se.current={x:L,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else V(null),j.current=null,R([]),le(null),fe([])},E=B=>{const d=O.getBoundingClientRect(),L=B.clientX-d.left,w=B.clientY-d.top;if(!j.current){const b=Y(L,w);if(b?.object&&!Ae.current){const m=W(b.object);le(M=>M===b.object?M:b.object),fe(M=>M.length===m.length&&M.every((k,K)=>k.x===m[K].x&&k.y===m[K].y)?M:m)}else le(m=>m==null?m:null),fe(m=>m.length===0?m:[]);return}const p=Ae.current;if(!p)return;const D=f.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(D==null||_==null)return;let U=te(D);if(U!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const z=K.rawTime??K.time,J=K.normalizedTime??te(z);return{rawTime:z,normalizedTime:J,price:K.price}},m=(K,z)=>{const J=K.normalizedTime??te(K.rawTime),ie=z.normalizedTime??te(z.rawTime);if(J==null||ie==null)return;const he=z.price-K.price,ge=he/Math.abs(K.price)*100,ye=pA(Ie)||3600,Le=Math.abs(ie-J),Je=Math.max(1,Math.round(Le/ye)),tt=Math.max(1,Math.round(Le/86400)),We=f.timeScale().timeToCoordinate(K.rawTime),yt=u.priceToCoordinate(K.price),pt=f.timeScale().timeToCoordinate(z.rawTime),Ct=u.priceToCoordinate(z.price),_t=We!=null&&yt!=null&&pt!=null&&Ct!=null?Math.atan2(-(Ct-yt),pt-We)*(180/Math.PI):p.primitive?.info?.angle??0,qt={priceDiff:he,pricePct:ge,bars:Je,days:tt,angle:_t},rA=p.primitive;if(rA){rA.p1={rawTime:K.rawTime,price:K.price},rA.p2={rawTime:z.rawTime,price:z.price},rA.info=qt;try{c.current?.applyOptions({})}catch{}}const uA={...p,rawP1Time:K.rawTime,rawP2Time:z.rawTime,p1:{rawTime:K.rawTime,normalizedTime:J,price:K.price},p2:{rawTime:z.rawTime,normalizedTime:ie,price:z.price}};Ce(XA=>{const _i=XA.map(Gs=>Gs===p?uA:Gs);return x.current=_i,_i}),V(uA),Ae.current=uA,We!=null&&yt!=null&&pt!=null&&Ct!=null&&R([{x:We,y:yt},{x:pt,y:Ct}])},M=b(p.p1),k=b(p.p2);if(M.rawTime==null||M.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(j.current==="handle1"){const K=f.timeScale().coordinateToTime(L)??D;m({rawTime:K,normalizedTime:U,price:_},k)}else if(j.current==="handle2"){const K=f.timeScale().coordinateToTime(L)??D;m(M,{rawTime:K,normalizedTime:U,price:_})}else if(j.current==="line"){const K=se.current;if(!K)return;const z=b(K.p1),J=b(K.p2);if(z.rawTime==null||z.normalizedTime==null||J.rawTime==null||J.normalizedTime==null)return;const ie=f.timeScale().coordinateToTime(K.x)??z.rawTime,he=u.coordinateToPrice(K.y);if(ie==null||he==null)return;const ge=te(ie)??z.normalizedTime;if(ge==null)return;const ye=U-ge,Le=_-he,Je=te(z.normalizedTime+ye),tt=te(J.normalizedTime+ye);if(Je==null||tt==null)return;const We=D-ie;m({rawTime:z.rawTime+We,normalizedTime:Je,price:z.price+Le},{rawTime:J.rawTime+We,normalizedTime:tt,price:J.price+Le})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(m,M)=>{const k=m.normalizedTime??m.rawTime,K=M.normalizedTime??M.rawTime,z=M.price-m.price,J=z/Math.abs(m.price)*100,ie=Os(zs,m.rawTime,M.rawTime,Ie),he=Math.abs(K-k),ge=Math.max(1,Math.round(he/86400)),ye={priceDiff:z,pricePct:J,bars:ie,days:ge},Le=p.primitive;if(Le){Le.p1={rawTime:m.rawTime,price:m.price},Le.p2={rawTime:M.rawTime,price:M.price},Le.info=ye;const Ct=M.price>=m.price;Le.color=Ct?"#3b82f6":"#ef5350",Le.fillColor=Ct?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const Je={...p,rawP1Time:m.rawTime,rawP2Time:M.rawTime,p1:m,p2:M};Ce(Ct=>{const _t=Ct.map(qt=>qt===p?Je:qt);return x.current=_t,_t}),V(Je),Ae.current=Je;const tt=f.timeScale().timeToCoordinate(m.rawTime),We=u.priceToCoordinate(m.price),yt=f.timeScale().timeToCoordinate(M.rawTime),pt=u.priceToCoordinate(M.price);tt!=null&&We!=null&&yt!=null&&pt!=null&&R([{x:tt,y:We},{x:(tt+yt)/2,y:(We+pt)/2},{x:yt,y:pt}])};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(ge=>{const ye=ge.map(Le=>Le===p?K:Le);return x.current=ye,ye}),V(K),Ae.current=K;const z=f.timeScale().timeToCoordinate(m.rawTime),J=u.priceToCoordinate(m.price),ie=f.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);z!=null&&J!=null&&ie!=null&&he!=null&&R([{x:z,y:J},{x:ie,y:he}])};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(ge=>{const ye=ge.map(Le=>Le===p?K:Le);return x.current=ye,ye}),V(K),Ae.current=K;const z=f.timeScale().timeToCoordinate(m.rawTime),J=u.priceToCoordinate(m.price),ie=f.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);z!=null&&J!=null&&ie!=null&&he!=null&&R([{x:z,y:J},{x:ie,y:he}])};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;const M=te(m);if(M==null)return;b(p.p1,{rawTime:m,normalizedTime:M,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(ge=>{const ye=ge.map(Le=>Le===p?K:Le);return x.current=ye,ye}),V(K),Ae.current=K;const z=f.timeScale().timeToCoordinate(m.rawTime),J=u.priceToCoordinate(m.price),ie=f.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);z!=null&&J!=null&&ie!=null&&he!=null&&R([{x:z,y:J},{x:ie,y:he}])};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="crossline"&&p.p){const b=M=>{const k=p.primitive;if(k){k.center={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:M};Ce(ie=>{const he=ie.map(ge=>ge===p?K:ge);return x.current=he,he}),V(K),Ae.current=K;const z=f.timeScale().timeToCoordinate(M.rawTime),J=u.priceToCoordinate(M.price);z!=null&&J!=null&&R([{x:z,y:J}])},m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_});return}if(p.type==="pricelevel"&&p.price!=null){const b=u.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const m=c.current?c.current.paneSize().width:400,M=u.priceToCoordinate(b);M!=null&&R([{x:m/2,y:M}]);const k={...p,price:b};Ce(K=>{const z=K.map(J=>J===p?k:J);return x.current=z,z}),V(k),Ae.current=k;return}if(p.type==="text"){const b=f.timeScale().coordinateToTime(L);if(b==null)return;const m=p.primitive;if(m){m.rawTime=b,m.price=_;try{c.current?.applyOptions({})}catch{}}const M={...p,rawTime:b,price:_};Ce(k=>{const K=k.map(z=>z===p?M:z);return x.current=K,K}),V(M),Ae.current=M;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(ge=>{const ye=ge.map(Le=>Le===p?K:Le);return x.current=ye,ye}),V(K),Ae.current=K;const z=f.timeScale().timeToCoordinate(m.rawTime),J=u.priceToCoordinate(m.price),ie=f.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);z!=null&&J!=null&&ie!=null&&he!=null&&R([{x:z,y:J},{x:ie,y:he}])};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"||j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(m,M,k)=>{const K=Ld(m,M,k);if(!K)return;const z=p.primitive;if(z){z.p1={rawTime:m.rawTime,price:m.price},z.p2={rawTime:M.rawTime,price:M.price},z.b1={rawTime:K.b1.rawTime,price:K.b1.price},z.b2={rawTime:K.b2.rawTime,price:K.b2.price},z.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const J={...p,p1:m,p2:M,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};Ce(ie=>{const he=ie.map(ge=>ge===p?J:ge);return x.current=he,he}),V(J),Ae.current=J};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2,p.p3);return}if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??te(p.p3.rawTime),price:_});return}if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K),he=te(m.p3.normalizedTime+K);if(J==null||ie==null||he==null)return;const ge=D-M;b({rawTime:m.p1.rawTime+ge,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:ie,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,price:m.p3.price+z});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(m,M)=>{const k=$r(Te,m,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};Ce(J=>{const ie=J.map(he=>he===p?z:he);return x.current=ie,ie}),V(z),Ae.current=z};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U},p.p2);return}if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U});return}if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(m,M)=>{const k=Xr(Te,m,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const z={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};Ce(J=>{const ie=J.map(he=>he===p?z:he);return x.current=ie,ie}),V(z),Ae.current=z};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2);return}if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_});return}if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(m,M,k)=>{const K=p.primitive;if(K){K.p1={rawTime:m.rawTime,price:m.price},K.p2={rawTime:M.rawTime,price:M.price},K.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const z={...p,p1:m,p2:M,p3:k};Ce(J=>{const ie=J.map(he=>he===p?z:he);return x.current=ie,ie}),V(z),Ae.current=z};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2,p.p3);return}if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_},p.p3);return}if(j.current==="handle3"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,p.p2,{rawTime:m,normalizedTime:U,price:_});return}if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K),he=te(m.p3.normalizedTime+K);if(J==null||ie==null||he==null)return;const ge=D-M;b({rawTime:m.p1.rawTime+ge,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+ge,normalizedTime:ie,price:m.p2.price+z},{rawTime:m.p3.rawTime+ge,normalizedTime:he,price:m.p3.price+z});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(z,J,ie,he)=>{const ge=p.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:J.rawTime,price:J.price},ge.p3={rawTime:ie.rawTime,price:ie.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const ye={...p,p1:z,p2:J,p3:ie,p4:he};Ce(Le=>{const Je=Le.map(tt=>tt===p?ye:tt);return x.current=Je,Je}),V(ye),Ae.current=ye},m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(z,J,ie,he)=>{const ge=z.normalizedTime??te(z.rawTime);if(ge==null)return null;const ye=te(ge+ie);return ye==null?null:{rawTime:z.rawTime+J,normalizedTime:ye,price:z.price+he}};if(j.current==="line"){const z=f.timeScale().coordinateToTime(m.x),J=u.coordinateToPrice(m.y);if(z==null||J==null)return;const ie=te(z);if(ie==null)return;const he=M-z,ge=k-ie,ye=_-J,Le=K(m.p1,he,ge,ye),Je=K(m.p2,he,ge,ye),tt=K(m.p3,he,ge,ye),We=K(m.p4,he,ge,ye);if(!Le||!Je||!tt||!We)return;b(Le,Je,tt,We);return}if(j.current==="handle1"){const z=(m.p1.price+m.p2.price)/2,J={rawTime:M,normalizedTime:k,price:_},ie={rawTime:M,normalizedTime:k,price:2*z-_};b(J,ie,m.p3,m.p4);return}if(j.current==="handle3"){const z=(m.p3.price+m.p4.price)/2,J={rawTime:M,normalizedTime:k,price:_},ie={rawTime:M,normalizedTime:k,price:2*z-_};b(m.p1,m.p2,J,ie);return}if(j.current==="handle2"){const z=(m.p1.price+m.p2.price)/2,J={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??te(m.p1.rawTime),price:_};if(J.normalizedTime==null)return;const ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??te(m.p1.rawTime),price:2*z-_};if(ie.normalizedTime==null)return;b(ie,J,m.p3,m.p4);return}if(j.current==="handle4"){const z=_-m.p4.price,J={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??te(m.p3.rawTime),price:m.p4.price+z};if(J.normalizedTime==null)return;const ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??te(m.p1.rawTime),price:m.p2.price+z};if(ie.normalizedTime==null)return;b(m.p1,ie,m.p3,J);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(z,J,ie,he)=>{const ge=p.primitive;if(ge){ge.p1={rawTime:z.rawTime,price:z.price},ge.p2={rawTime:J.rawTime,price:J.price},ge.p3={rawTime:ie.rawTime,price:ie.price},ge.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const ye={...p,p1:z,p2:J,p3:ie,p4:he};Ce(Le=>{const Je=Le.map(tt=>tt===p?ye:tt);return x.current=Je,Je}),V(ye),Ae.current=ye},m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(z,J,ie,he)=>{const ge=z.normalizedTime??te(z.rawTime);if(ge==null)return null;const ye=te(ge+ie);return ye==null?null:{rawTime:z.rawTime+J,normalizedTime:ye,price:z.price+he}};if(j.current==="line"){const z=f.timeScale().coordinateToTime(m.x),J=u.coordinateToPrice(m.y);if(z==null||J==null)return;const ie=te(z);if(ie==null)return;const he=M-z,ge=k-ie,ye=_-J,Le=K(m.p1,he,ge,ye),Je=K(m.p2,he,ge,ye),tt=K(m.p3,he,ge,ye),We=K(m.p4,he,ge,ye);if(!Le||!Je||!tt||!We)return;b(Le,Je,tt,We);return}if(j.current==="handle1"){const z={rawTime:M,normalizedTime:k,price:_},J={rawTime:M,normalizedTime:k,price:m.p2.price};b(z,J,m.p3,m.p4);return}if(j.current==="handle3"){const z={rawTime:M,normalizedTime:k,price:_},J={rawTime:M,normalizedTime:k,price:m.p4.price};b(m.p1,m.p2,z,J);return}if(j.current==="handle2"||j.current==="handle4"){const z=j.current==="handle2"?m.p2:m.p4,J=_-z.price,ie={rawTime:m.p1.rawTime,normalizedTime:m.p1.normalizedTime??te(m.p1.rawTime),price:m.p2.price+J},he={rawTime:m.p3.rawTime,normalizedTime:m.p3.normalizedTime??te(m.p3.rawTime),price:m.p4.price+J};if(ie.normalizedTime==null||he.normalizedTime==null)return;b(m.p1,ie,m.p3,he);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(z=>{const J=z.map(ie=>ie===p?K:ie);return x.current=J,J}),V(K),Ae.current=K};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,Ct)=>{const _t=p.primitive;if(_t){_t.p1={rawTime:pt.rawTime,price:pt.price},_t.p2={rawTime:Ct.rawTime,price:Ct.price};try{c.current?.applyOptions({})}catch{}}const qt={...p,p1:pt,p2:Ct};Ce(rA=>{const uA=rA.map(XA=>XA===p?qt:XA);return x.current=uA,uA}),V(qt),Ae.current=qt},m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const pt=f.timeScale().coordinateToTime(m.x),Ct=u.coordinateToPrice(m.y);if(pt==null||Ct==null)return;const _t=te(pt);if(_t==null)return;const qt=k-_t,rA=_-Ct,uA=te(m.p1.normalizedTime+qt),XA=te(m.p2.normalizedTime+qt);if(uA==null||XA==null)return;const _i=D-pt;b({rawTime:m.p1.rawTime+_i,normalizedTime:uA,price:m.p1.price+rA},{rawTime:m.p2.rawTime+_i,normalizedTime:XA,price:m.p2.price+rA});return}const K=Math.min(m.p1.normalizedTime,m.p2.normalizedTime),z=Math.max(m.p1.normalizedTime,m.p2.normalizedTime),J=Math.max(m.p1.price,m.p2.price),ie=Math.min(m.p1.price,m.p2.price),he=m.p1.normalizedTime<=m.p2.normalizedTime?m.p1.rawTime:m.p2.rawTime,ge=m.p1.normalizedTime<=m.p2.normalizedTime?m.p2.rawTime:m.p1.rawTime;let ye=K,Le=z,Je=J,tt=ie,We=he,yt=ge;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(ye=k,We=M),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Le=k,yt=M),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&(Je=_),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(tt=_),ye>Le){const pt=ye,Ct=We;ye=Le,We=yt,Le=pt,yt=Ct}if(Je<tt){const pt=Je;Je=tt,tt=pt}b({rawTime:We,normalizedTime:ye,price:Je},{rawTime:yt,normalizedTime:Le,price:tt});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(Je,tt)=>{const We=p.primitive;if(We){We.p1={rawTime:Je.rawTime,price:Je.price},We.p2={rawTime:tt.rawTime,price:tt.price};try{c.current?.applyOptions({})}catch{}}const yt={...p,p1:Je,p2:tt};Ce(pt=>{const Ct=pt.map(_t=>_t===p?yt:_t);return x.current=Ct,Ct}),V(yt),Ae.current=yt},m=f.timeScale().coordinateToTime(L);if(m==null)return;const M=te(m);if(M==null)return;if(j.current==="handle2"){b(p.p1,{rawTime:m,normalizedTime:M,price:_});return}const k=se.current;if(!k)return;const K=f.timeScale().coordinateToTime(k.x),z=u.coordinateToPrice(k.y);if(K==null||z==null)return;const J=te(K);if(J==null)return;const ie=M-J,he=_-z,ge=te(k.p1.normalizedTime+ie),ye=te(k.p2.normalizedTime+ie);if(ge==null||ye==null)return;const Le=D-K;b({rawTime:k.p1.rawTime+Le,normalizedTime:ge,price:k.p1.price+he},{rawTime:k.p2.rawTime+Le,normalizedTime:ye,price:k.p2.price+he});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(We,yt,pt)=>{const Ct=p.primitive;if(Ct){Ct.p1={rawTime:We.rawTime,price:We.price},Ct.p2={rawTime:yt.rawTime,price:yt.price},Ct.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const _t={...p,p1:We,p2:yt,p3:pt};Ce(qt=>{const rA=qt.map(uA=>uA===p?_t:uA);return x.current=rA,rA}),V(_t),Ae.current=_t},m=f.timeScale().coordinateToTime(L);if(m==null)return;const M=te(m);if(M==null)return;if(j.current==="handle1"){b({rawTime:m,normalizedTime:M,price:_},p.p2,p.p3);return}if(j.current==="handle2"){b(p.p1,{rawTime:m,normalizedTime:M,price:_},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:m,normalizedTime:M,price:_});return}const k=se.current;if(!k)return;const K=f.timeScale().coordinateToTime(k.x),z=u.coordinateToPrice(k.y);if(K==null||z==null)return;const J=te(K);if(J==null)return;const ie=M-J,he=_-z,ge=D-K,ye=We=>{const yt=We.normalizedTime??te(We.rawTime);if(yt==null)return null;const pt=te(yt+ie);return pt==null?null:{rawTime:We.rawTime+ge,normalizedTime:pt,price:We.price+he}},Le=ye(k.p1),Je=ye(k.p2),tt=ye(k.p3);if(!Le||!Je||!tt)return;b(Le,Je,tt);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,z,J=p.minorRatio??.45)=>{const ie=p.primitive;if(ie){ie.p1={rawTime:K.rawTime,price:K.price},ie.p2={rawTime:z.rawTime,price:z.price},ie.minorRatio=Math.max(.05,J);try{c.current?.applyOptions({})}catch{}}const he={...p,p1:K,p2:z,minorRatio:Math.max(.05,J)};Ce(ge=>{const ye=ge.map(Le=>Le===p?he:Le);return x.current=ye,ye}),V(he),Ae.current=he},m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const K=f.timeScale().coordinateToTime(m.x),z=u.coordinateToPrice(m.y);if(K==null||z==null)return;const J=te(K);if(J==null)return;const ie=k-J,he=_-z,ge=te(m.p1.normalizedTime+ie),ye=te(m.p2.normalizedTime+ie);if(ge==null||ye==null)return;const Le=D-K;b({rawTime:m.p1.rawTime+Le,normalizedTime:ge,price:m.p1.price+he},{rawTime:m.p2.rawTime+Le,normalizedTime:ye,price:m.p2.price+he},m.minorRatio??p.minorRatio??.45);return}if(j.current==="handle1"){b({rawTime:M,normalizedTime:k,price:_},p.p2,p.minorRatio??.45);return}if(j.current==="handle3"){b(p.p1,{rawTime:M,normalizedTime:k,price:_},p.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=f.timeScale().timeToCoordinate(p.p1.rawTime),z=u.priceToCoordinate(p.p1.price),J=f.timeScale().timeToCoordinate(p.p2.rawTime),ie=u.priceToCoordinate(p.p2.price);if(K==null||z==null||J==null||ie==null)return;const he=(K+J)/2,ge=(z+ie)/2,ye=J-K,Le=ie-z,Je=Math.hypot(ye,Le);if(Je<.001)return;const tt=-Le/Je,We=ye/Je,yt=Math.abs((L-he)*tt+(w-ge)*We),pt=Math.max(.05,yt*2/Je);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(z=>{const J=z.map(ie=>ie===p?K:ie);return x.current=J,J}),V(K),Ae.current=K};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(m,M)=>{const k=p.primitive;if(k){k.p1={rawTime:m.rawTime,price:m.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:m,p2:M};Ce(z=>{const J=z.map(ie=>ie===p?K:ie);return x.current=J,J}),V(K),Ae.current=K};if(j.current==="handle1"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b({rawTime:m,normalizedTime:U,price:_},p.p2)}else if(j.current==="handle2"){const m=f.timeScale().coordinateToTime(L);if(m==null)return;b(p.p1,{rawTime:m,normalizedTime:U,price:_})}else if(j.current==="line"){const m=se.current;if(!m)return;const M=f.timeScale().coordinateToTime(m.x),k=u.coordinateToPrice(m.y);if(M==null||k==null)return;const K=U-te(M),z=_-k,J=te(m.p1.normalizedTime+K),ie=te(m.p2.normalizedTime+K);if(J==null||ie==null)return;const he=D-M;b({rawTime:m.p1.rawTime+he,normalizedTime:J,price:m.p1.price+z},{rawTime:m.p2.rawTime+he,normalizedTime:ie,price:m.p2.price+z})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=D;const m={...p,time:te(D),rawTime:D};Ce(k=>{const K=k.map(z=>z===p?m:z);return x.current=K,K}),V(m),Ae.current=m;const M=f.timeScale().timeToCoordinate(D);M!=null&&R([{x:M,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,m=se.current;if(!m)return;if(j.current==="handle1"){if(b.price=_,b.originTime=D,p.priceLine)try{p.priceLine.applyOptions({price:_,title:p.showPrice!==!1?_.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=_,p.textPrimitive.originTime=D);const M={...p,price:b.price,originTime:b.originTime,rawOriginTime:D};Ce(k=>{const K=k.map(z=>z===p?M:z);return x.current=K,K}),V(M),Ae.current=M,c.current?.applyOptions({})}else if(j.current==="line"){const M=u.coordinateToPrice(m.y);if(M==null)return;const k=_-M;if(b.price=m.price+k,p.priceLine)try{p.priceLine.applyOptions({price:b.price,title:p.showPrice!==!1?b.price.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=b.price);const K={...p,price:b.price};Ce(z=>{const J=z.map(ie=>ie===p?K:ie);return x.current=J,J}),V(K),Ae.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(j.current==="handle1"){const b={time:U,price:_},m=MA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);m.length>0&&p.series.setData(m),p.decoration&&(p.decoration.p1=b);const M={...p,point1:b};Ce(k=>{const K=k.map(z=>z===p?M:z);return x.current=K,K}),V(M),Ae.current=M}else if(j.current==="handle2"){const b={time:U,price:_},m=MA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);m.length>0&&p.series.setData(m),p.decoration&&(p.decoration.p2=b);const M={...p,point2:b};Ce(k=>{const K=k.map(z=>z===p?M:z);return x.current=K,K}),V(M),Ae.current=M}else if(j.current==="line"){const b=se.current;if(!b)return;const m=f.timeScale().coordinateToTime(b.x),M=u.coordinateToPrice(b.y);if(m==null||M==null)return;const k=U-m,K=_-M,z={time:te(b.point1.time+k),price:b.point1.price+K},J={time:te(b.point2.time+k),price:b.point2.price+K},ie=MA([{time:z.time,value:z.price},{time:J.time,value:J.price}]);ie.length>0&&p.series.setData(ie),p.decoration&&(p.decoration.p1=z,p.decoration.p2=J);const he={...p,point1:z,point2:J};Ce(ge=>{const ye=ge.map(Le=>Le===p?he:Le);return x.current=ye,ye}),V(he),Ae.current=he}}}},P=()=>{j.current=null,se.current=null},$=()=>{j.current||Ae.current||(le(null),fe([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",ce,C),O.addEventListener("mousemove",E,C),O.addEventListener("mouseup",P,C),O.addEventListener("mouseleave",$,C),()=>{O.removeEventListener("mousedown",ce,C),O.removeEventListener("mousemove",E,C),O.removeEventListener("mouseup",P,C),O.removeEventListener("mouseleave",$,C)}},[Ee,Te,$e,Ce]),q.useEffect(()=>{const f=c.current,u=h.current;if(!f||!u)return;const O=()=>{const y=H;if(!y){R([]);return}const G=f.timeScale();if(y.type==="infoline"&&y.p1&&y.p2){const W=y.p1.rawTime??y.p1.time,Y=y.p2.rawTime??y.p2.time,ce=G.timeToCoordinate(W),E=u.priceToCoordinate(y.p1.price),P=G.timeToCoordinate(Y),$=u.priceToCoordinate(y.p2.price);ce!=null&&E!=null&&P!=null&&$!=null?R([{x:ce,y:E},{x:P,y:$}]):R([]);return}if(y.type==="rulerline"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:(W+ce)/2,y:(Y+E)/2},{x:ce,y:E}]):R([]);return}if(y.type==="arrowedline"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="rayline"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="extendedline"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="crossline"&&y.p){const W=G.timeToCoordinate(y.p.rawTime),Y=u.priceToCoordinate(y.p.price);W!=null&&Y!=null?R([{x:W,y:Y}]):R([]);return}if(y.type==="text"&&y.rawTime!=null&&y.price!=null){const W=G.timeToCoordinate(y.rawTime),Y=u.priceToCoordinate(y.price);W!=null&&Y!=null?R([{x:W,y:Y}]):R([]);return}if(y.type==="trendbyangle"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="equidistantchannel"&&y.p1&&y.p2&&y.b1&&y.b2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),P=G.timeToCoordinate(y.b1.rawTime),$=u.priceToCoordinate(y.b1.price),C=G.timeToCoordinate(y.b2.rawTime),B=u.priceToCoordinate(y.b2.price);W!=null&&Y!=null&&ce!=null&&E!=null&&P!=null&&$!=null&&C!=null&&B!=null?R([{x:W,y:Y},{x:ce,y:E},{x:(P+C)/2,y:($+B)/2}]):R([]);return}if(y.type==="regressionchannel"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="stddevchannel"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="andrewspitchfork"&&y.p1&&y.p2&&y.p3){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),P=G.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);W!=null&&Y!=null&&ce!=null&&E!=null&&P!=null&&$!=null?R([{x:W,y:Y},{x:ce,y:E},{x:P,y:$}]):R([]);return}if(y.type==="disjointchannel"&&y.p1&&y.p2&&y.p3&&y.p4){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),P=G.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=G.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);W!=null&&Y!=null&&ce!=null&&E!=null&&P!=null&&$!=null&&C!=null&&B!=null?R([{x:W,y:Y},{x:ce,y:E},{x:P,y:$},{x:C,y:B}]):R([]);return}if(y.type==="flattopbottom"&&y.p1&&y.p2&&y.p3&&y.p4){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),P=G.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=G.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);W!=null&&Y!=null&&ce!=null&&E!=null&&P!=null&&$!=null&&C!=null&&B!=null?R([{x:W,y:Y},{x:ce,y:E},{x:P,y:$},{x:C,y:B}]):R([]);return}if(y.type==="fibonacci"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="trendline"&&y.point1&&y.point2){const W=G.timeToCoordinate(y.point1.time),Y=u.priceToCoordinate(y.point1.price),ce=G.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="gannline"&&y.point1&&y.point2){const W=G.timeToCoordinate(y.point1.time),Y=u.priceToCoordinate(y.point1.price),ce=G.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:(W+ce)/2,y:(Y+E)/2},{x:ce,y:E}]):R([]);return}if(y.type==="rectangle"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(W!=null&&Y!=null&&ce!=null&&E!=null){const P=Math.min(W,ce),$=Math.max(W,ce),C=Math.min(Y,E),B=Math.max(Y,E),d=(P+$)/2,L=(C+B)/2;R([{x:P,y:C},{x:d,y:C},{x:$,y:C},{x:P,y:L},{x:$,y:L},{x:P,y:B},{x:d,y:B},{x:$,y:B}])}else R([]);return}if(y.type==="circle"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="triangle"&&y.p1&&y.p2&&y.p3){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),P=G.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);W!=null&&Y!=null&&ce!=null&&E!=null&&P!=null&&$!=null?R([{x:W,y:Y},{x:ce,y:E},{x:P,y:$}]):R([]);return}if(y.type==="ellipse"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(W!=null&&Y!=null&&ce!=null&&E!=null){const P=(W+ce)/2,$=(Y+E)/2,C=ce-W,B=E-Y,d=Math.hypot(C,B);if(d<.001){R([]);return}const L=C/d,w=B/d,p=-w,D=L,_=d/2,U=_*Math.max(.05,y.minorRatio??.45);R([{x:P-L*_,y:$-w*_},{x:P+p*U,y:$+D*U},{x:P+L*_,y:$+w*_},{x:P-p*U,y:$-D*U}])}else R([]);return}if(y.type==="gannfan"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="ganngrid"&&y.p1&&y.p2){const W=G.timeToCoordinate(y.p1.rawTime),Y=u.priceToCoordinate(y.p1.price),ce=G.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);W!=null&&Y!=null&&ce!=null&&E!=null?R([{x:W,y:Y},{x:ce,y:E}]):R([]);return}if(y.type==="horizontalray"&&y.primitive){const W=y.primitive,Y=G.timeToCoordinate(W.originTime),ce=u.priceToCoordinate(W.price);Y!=null&&ce!=null?R([{x:Y,y:ce}]):R([]);return}if(y.type==="verticalline"&&y.primitive){const W=y.primitive,Y=G.timeToCoordinate(W.time);if(Y!=null){const ce=W.midYCss??200;R([{x:Y,y:ce}])}else R([]);return}if(y.type==="pricelevel"&&y.priceLine){const W=h.current?.priceToCoordinate(y.price);if(W!=null){const Y=c.current?c.current.paneSize().width:400;R([{x:Y/2,y:W}])}else R([]);return}R([])};O();const de=f.timeScale();return de.subscribeVisibleTimeRangeChange(O),()=>{de.unsubscribeVisibleTimeRangeChange(O)}},[H]),q.useEffect(()=>{let f=!1;x.current.forEach(u=>{if(u.type==="verticalline"&&u.primitive){const O=u===H||u===oe;u.primitive.showDot!==O&&(u.primitive.showDot=O,f=!0)}}),f&&c.current?.applyOptions({})},[H,oe]),q.useEffect(()=>{let f=!1;x.current.forEach(u=>{if((u.type==="infoline"||u.type==="rulerline"||u.type==="arrowedline"||u.type==="rayline"||u.type==="extendedline"||u.type==="trendbyangle")&&u.primitive){const O=u===H||u===oe;u.primitive.isActive!==O&&(u.primitive.isActive=O,f=!0)}}),f&&c.current?.applyOptions({})},[H,oe]),q.useEffect(()=>{!c.current||!h.current||x.current.forEach(f=>{if(f.series&&f.series.applyOptions({visible:dt}),f.priceLine){const u=dt&&f.showPrice!==!1;f.priceLine.applyOptions(dt?{color:f.lineColor??"#3b82f6",axisLabelVisible:u,title:u&&typeof f.price=="number"?f.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(f.type==="fibonacci"&&f.primitive){f.primitive.visible=dt;try{c.current?.applyOptions({})}catch{}}if(f.type==="rectangle"&&f.primitive){f.primitive.visible=dt;try{c.current?.applyOptions({})}catch{}}if(f.type==="parallellines"&&(f.baseLine&&f.baseLine.applyOptions({visible:dt}),f.parallelLine&&f.parallelLine.applyOptions({visible:dt}),f.firstLine&&f.firstLine.applyOptions({visible:dt}),f.secondLine&&f.secondLine.applyOptions({visible:dt})),(f.type==="horizontalray"||f.type==="verticalline"||f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="crossline"||f.type==="trendbyangle"||f.type==="equidistantchannel"||f.type==="regressionchannel"||f.type==="stddevchannel"||f.type==="gannfan"||f.type==="ganngrid"||f.type==="andrewspitchfork"||f.type==="disjointchannel"||f.type==="flattopbottom"||f.type==="circle"||f.type==="triangle"||f.type==="ellipse"||f.type==="text")&&f.primitive){f.primitive.visible=dt;try{c.current?.applyOptions({})}catch{}}})},[dt,$e]),q.useEffect(()=>{!dt&&H&&(V(null),R([]))},[dt,H]),q.useEffect(()=>{if(x.current.length>$e.length){const f=x.current.filter((u,O)=>!$e.includes(u));H&&f.some(u=>u===H)&&(V(null),R([])),f.forEach(u=>{if(u.series&&c.current?.removeSeries(u.series),u.priceLine&&h.current?.removePriceLine(u.priceLine),u.textPrimitive)try{h.current?.detachPrimitive(u.textPrimitive)}catch{}if(u.type==="horizontalray"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="verticalline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="infoline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rulerline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="arrowedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rayline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="extendedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="crossline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="trendbyangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="equidistantchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="regressionchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="stddevchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="gannfan"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ganngrid"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="andrewspitchfork"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="disjointchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="flattopbottom"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="fibonacci"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rectangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="circle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="triangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ellipse"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="text"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="parallellines")try{u.baseLine&&c.current?.removeSeries(u.baseLine),u.parallelLine&&c.current?.removeSeries(u.parallelLine),u.firstLine&&c.current?.removeSeries(u.firstLine),u.secondLine&&c.current?.removeSeries(u.secondLine)}catch{}}),x.current=$e,Rs()}},[$e,H,Rs]),q.useEffect(()=>{const f=h.current;return f?(ke.current.forEach(O=>{try{f.removePriceLine(O)}catch{}}),ke.current=[],At.filter(O=>O.symbol===Fe).forEach(O=>{const de=parseFloat(O.openPrice??O.price),G=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(He&&!isNaN(de)&&ke.current.push(f.createPriceLine({price:de,color:G,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),qe){const W=parseFloat(O.stopLoss),Y=parseFloat(O.takeProfit);!isNaN(W)&&W>0&&ke.current.push(f.createPriceLine({price:W,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(Y)&&Y>0&&ke.current.push(f.createPriceLine({price:Y,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{ke.current.forEach(O=>{try{f.removePriceLine(O)}catch{}}),ke.current=[]}):void 0},[At,Fe,He,qe]),q.useEffect(()=>{const f=h.current;if(!f||!mt)return;const u=parseFloat(iA?.ask);if(isNaN(u)||u<=0)return;let O;try{O=f.createPriceLine({price:u,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{f.removePriceLine(O)}catch{}}},[mt,iA]),q.useEffect(()=>{const f=o.current;if(!f)return;const u=O=>{if(ue.current){ue.current=!1;return}if(T.current||!c.current)return;const de=c.current,y=h.current;if(de&&y&&x.current.length>0){const G=f.getBoundingClientRect(),W=O.clientX-G.left,Y=O.clientY-G.top,ce=15;for(let E=x.current.length-1;E>=0;E--){const P=x.current[E];let $=!1;if(P.type==="text"&&P.rawTime!=null&&P.price!=null){const C=de.timeScale().timeToCoordinate(P.rawTime),B=y.priceToCoordinate(P.price);if(C!=null&&B!=null){const d=xd(P,C,B);W>=d.left&&W<=d.right&&Y>=d.top&&Y<=d.bottom&&($=!0)}}else if(P.point1&&P.point2){const C=de.timeScale().timeToCoordinate(P.point1.time??P.point1.rawTime),B=y.priceToCoordinate(P.point1.price),d=de.timeScale().timeToCoordinate(P.point2.time??P.point2.rawTime),L=y.priceToCoordinate(P.point2.price);if(C!=null&&B!=null&&d!=null&&L!=null){const w=Math.hypot(W-C,Y-B),p=Math.hypot(W-d,Y-L),D=(C+d)/2,_=(B+L)/2,U=Math.hypot(W-D,Y-_);(w<ce||p<ce||U<ce)&&($=!0)}}else if(P.p1&&P.p2){const C=de.timeScale().timeToCoordinate(P.p1.rawTime),B=y.priceToCoordinate(P.p1.price),d=de.timeScale().timeToCoordinate(P.p2.rawTime),L=y.priceToCoordinate(P.p2.price);if(C!=null&&B!=null&&d!=null&&L!=null){const w=Math.min(C,d),p=Math.max(C,d),D=Math.min(B,L),_=Math.max(B,L);W>=w-5&&W<=p+5&&Y>=D-5&&Y<=_+5&&($=!0)}}else if(P.p){const C=de.timeScale().timeToCoordinate(P.p.rawTime),B=y.priceToCoordinate(P.p.price);C!=null&&B!=null&&Math.hypot(W-C,Y-B)<ce&&($=!0)}else if(P.type==="pricelevel"&&P.price!=null){const C=y.priceToCoordinate(P.price);C!=null&&Math.abs(Y-C)<ce&&($=!0)}if($){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),Z(P);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;Ed(c.current,Te,Ie)||c.current.timeScale().fitContent();const W=c.current.timeScale().getVisibleRange();Qe(W)},80)};return f.addEventListener("dblclick",u,!0),()=>{f.removeEventListener("dblclick",u,!0)}},[Te,Ie]);const zd=H??oe,Wd=H?re:ee,ob=dt&&ST(zd,Wd),ab=ET(zd?.type);q.useEffect(()=>{const f=o.current,u=l.current;if(!f||!u)return;const O=80,de=G=>{const W=f.getBoundingClientRect();u.style.opacity=W.bottom-G.clientY<=O?"1":"0"},y=()=>{u.style.opacity="0"};return f.addEventListener("mousemove",de),f.addEventListener("mouseleave",y),()=>{f.removeEventListener("mousemove",de),f.removeEventListener("mouseleave",y)}},[]);const lb=q.useCallback(()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,de=(u.from+u.to)/2,y=O*.8;try{f.setVisibleRange({from:de-y/2,to:de+y/2}),Qe(f.getVisibleRange())}catch{}},[Qe]),cb=q.useCallback(()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,de=(u.from+u.to)/2,y=O*1.25;try{f.setVisibleRange({from:de-y/2,to:de+y/2}),Qe(f.getVisibleRange())}catch{}},[Qe]),hb=q.useCallback(()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{f.setVisibleLogicalRange({from:u.from-O,to:u.to-O})}catch{}},[]),ub=q.useCallback(()=>{const f=c.current?.timeScale();if(!f)return;const u=f.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{f.setVisibleLogicalRange({from:u.from+O,to:u.to+O})}catch{}},[]),pb=q.useCallback(()=>{if(!c.current)return;Ed(c.current,Te,Ie)||c.current.timeScale().fitContent();const u=c.current.timeScale().getVisibleRange();Qe(u)},[Te,Ie,Qe]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Pe==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Ee===1||Ee!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[st&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof Fe=="object"?Fe?.symbol:Fe,"..."]})]})}),!st&&Bt&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:Pe==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:Pe==="light"?"#64748b":"#94a3b8"},children:Bt})]})}),!st&&!Bt&&Te.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:Pe==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Fe=="object"?Fe?.symbol:Fe]})})}),ti&&Te.length>0&&(()=>{const f=Te[Te.length-1],u=O=>{const de=Number(O);return Number.isFinite(de)?de>=100?de.toFixed(2):de.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:Pe==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:Pe==="light"?"#1e293b":"#e2e8f0"},children:u(f?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:u(f?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:u(f?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:Pe==="light"?"#1e293b":"#e2e8f0"},children:u(f?.close)})]})]})})(),(A||Et)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(jh,{bidPrice:e,askPrice:t,onBuyClick:tb,onSellClick:Ab})}),a.jsx(eu,{isOpen:rt,onClose:ib,orderType:ze,bidPrice:e,askPrice:t}),a.jsx(nu,{isOpen:ne!==null,onClose:()=>Z(null),chartObject:ne,onUpdate:rb}),st&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),ob&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:Wd.map((f,u)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:f.x-5,top:f.y-5,backgroundColor:ab}},u))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:cb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:lb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:hb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:ub,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:pb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:f,onClick:u,icon:O})=>a.jsx("button",{title:f,onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:Pe==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:Pe==="light"?"#374151":"#94a3b8",border:"1px solid "+(Pe==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:de=>{de.currentTarget.style.backgroundColor=Pe==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",de.currentTarget.style.color=Pe==="light"?"#111827":"#e2e8f0"},onMouseLeave:de=>{de.currentTarget.style.backgroundColor=Pe==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",de.currentTarget.style.color=Pe==="light"?"#374151":"#94a3b8"},children:O},f))})]})})}),Ft={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 _d({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Vt(),[s,o]=q.useState(!1),[l,c]=q.useState(""),[h,g]=q.useState(-1),v=q.useRef(null),x=q.useRef(null);q.useEffect(()=>{const Q=N=>{v.current&&!v.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]),q.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const F=r.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),T=F.filter(Q=>!Q.symbol.endsWith("USDT")),S=F.filter(Q=>Q.symbol.endsWith("USDT")),I=Q=>{A(Q),o(!1),c("")};return r.find(Q=>Q.symbol===t),a.jsxs("div",{ref:v,style:{...Ft.container,...i},className:e,children:[a.jsxs("button",{style:Ft.button,onClick:()=>o(!s),onMouseEnter:Q=>Object.assign(Q.currentTarget.style,Ft.buttonHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Ft.arrow,...s?Ft.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Ft.dropdown,children:[a.jsx("div",{style:Ft.searchContainer,children:a.jsx("input",{ref:x,style:Ft.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:Q=>c(Q.target.value)})}),a.jsx("div",{style:Ft.list,children:F.length===0?a.jsx("div",{style:Ft.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Forex & Metals"}),T.map(Q=>a.jsxs("div",{style:{...Ft.item,...Q.symbol===t?Ft.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(Q.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(Q.bid).toFixed(5)})]},Q.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Crypto"}),S.map(Q=>a.jsxs("div",{style:{...Ft.item,...Q.symbol===t?Ft.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Ft.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(Q.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(Q.bid).toFixed(2)})]},Q.symbol))]})]})})]})]})}const WA={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"}},HT=[.01,.05,.1,.5,1];function Dd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=HT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[g,v]=q.useState(.1),x=i!==void 0?i:g,F=q.useCallback(Q=>{const N=Math.max(t,Math.min(A,parseFloat(Q)||t)),X=Math.round(N/r)*r,H=parseFloat(X.toFixed(8));i!==void 0||v(H),e?.(H)},[t,A,r,i,e]),T=()=>F(x+r),S=()=>F(x-r),I=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...WA.container,...c},className:h,children:[o&&a.jsx("span",{style:WA.label,children:l}),a.jsx("button",{style:WA.btn,onClick:S,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,WA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:WA.input,type:"text",value:I,onChange:Q=>{const N=Q.target.value;if(N===""||N==="."||N==="0.")return;const X=parseFloat(N);isNaN(X)||F(X)},onBlur:()=>F(x)}),a.jsx("button",{style:WA.btn,onClick:T,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,WA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:WA.presets,children:n.map(Q=>a.jsx("button",{style:{...WA.preset,...Math.abs(x-Q)<1e-4?WA.presetActive:{}},onClick:()=>F(Q),onMouseEnter:N=>{Math.abs(x-Q)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-Q)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:Q},Q))})]})}const lA={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 Pd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:h,className:g}){const{currentSymbolData:v}=Vt(),[x,F]=q.useState(""),[T,S]=q.useState(!1),[I,Q]=q.useState("price"),N=i!==void 0?i:x,X=t!==void 0?t:T,H=r!==void 0?r:I,V=q.useCallback(oe=>{t!==void 0||S(oe),A?.(oe)},[t,A]),ne=q.useCallback(oe=>{r!==void 0||Q(oe),n?.(oe)},[r,n]),Z=q.useCallback(oe=>{i!==void 0||F(oe),e?.(oe)},[i,e]),re=oe=>{const le=oe.target.value;if(le===""||le==="."||le==="0."){Z(le);return}const ee=parseFloat(le);isNaN(ee)||Z(le)},R=H==="price"?v?.bid?parseFloat(v.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...h},className:g,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...X?lA.toggleOn:lA.toggleOff},onClick:()=>V(!X),children:a.jsx("div",{style:{...lA.toggleKnob,...X?lA.knobOn:lA.knobOff}})}),(X||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:N,onChange:re,placeholder:R,onFocus:oe=>oe.currentTarget.style.borderColor="#EF5350",onBlur:oe=>oe.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...lA.modeBtn,...H==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...H==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const cA={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 kd({value:i,onChange:e,enabled:t,onEnabledChange:A,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:h,className:g}){const{currentSymbolData:v}=Vt(),[x,F]=q.useState(""),[T,S]=q.useState(!1),[I,Q]=q.useState("price"),N=i!==void 0?i:x,X=t!==void 0?t:T,H=r!==void 0?r:I,V=q.useCallback(oe=>{t!==void 0||S(oe),A?.(oe)},[t,A]),ne=q.useCallback(oe=>{r!==void 0||Q(oe),n?.(oe)},[r,n]),Z=q.useCallback(oe=>{i!==void 0||F(oe),e?.(oe)},[i,e]),re=oe=>{const le=oe.target.value;if(le===""||le==="."||le==="0."){Z(le);return}const ee=parseFloat(le);isNaN(ee)||Z(le)},R=H==="price"?v?.ask?parseFloat(v.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...cA.container,...h},className:g,children:[l&&a.jsx("span",{style:cA.label,children:c}),s&&a.jsx("button",{style:{...cA.toggle,...X?cA.toggleOn:cA.toggleOff},onClick:()=>V(!X),children:a.jsx("div",{style:{...cA.toggleKnob,...X?cA.knobOn:cA.knobOff}})}),(X||!s)&&a.jsxs("div",{style:cA.inputGroup,children:[a.jsx("input",{style:cA.input,type:"text",value:N,onChange:re,placeholder:R,onFocus:oe=>oe.currentTarget.style.borderColor="#26A69A",onBlur:oe=>oe.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...cA.modeBtn,...H==="price"?cA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...cA.modeBtn,...H==="pips"?cA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const IT=[{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:"─"}],RA={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 Nd({showLabel:i=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:h,chartObjects:g,setChartObjects:v}=Vt(),[x,F]=q.useState(null),T=A||IT,S=N=>{l(o===N?null:N)},I=()=>{v([]),l(null)},Q=()=>{h(!c)};return a.jsxs("div",{style:{...RA.container,...n},className:s,children:[i&&a.jsx("span",{style:RA.label,children:r}),T.map(N=>a.jsxs("button",{style:{...RA.btn,...o===N.id?RA.btnActive:{}},onClick:()=>S(N.id),onMouseEnter:X=>{F(N.id),o!==N.id&&Object.assign(X.currentTarget.style,RA.btnHover)},onMouseLeave:X=>{F(null),o!==N.id&&(X.currentTarget.style.borderColor="#334155",X.currentTarget.style.backgroundColor="#1e293b",X.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&a.jsx("div",{style:RA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:RA.divider}),t&&a.jsx("button",{style:{...RA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:Q,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:RA.deleteBtn,onClick:I,onMouseEnter:N=>Object.assign(N.currentTarget.style,RA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Od={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 _T({showCoinSelector:i=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:g,takeProfit:v,onTakeProfitChange:x,takeProfitEnabled:F,onTakeProfitEnabledChange:T,coinSelectorProps:S={},volumeControlProps:I={},stopLossProps:Q={},takeProfitProps:N={},drawingToolsProps:X={},style:H,className:V}){const ne=[];i&&ne.push(a.jsx(_d,{...S},"coin")),e&&ne.push(a.jsx(Dd,{value:s,onChange:o,...I},"volume")),t&&ne.push(a.jsx(Pd,{value:l,onChange:c,enabled:h,onEnabledChange:g,...Q},"sl")),A&&ne.push(a.jsx(kd,{value:v,onChange:x,enabled:F,onEnabledChange:T,...N},"tp")),r&&ne.push(a.jsx(Nd,{...X},"draw"));const Z=[];return ne.forEach((re,R)=>{Z.push(re),n&&R<ne.length-1&&Z.push(a.jsx("div",{style:Od.divider},`div-${R}`))}),a.jsx("div",{style:{...Od.toolbar,...H},className:V,children:Z})}const DT=[{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"}],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"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function PT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Vt();return a.jsx("div",{style:{...pl.container,...i},className:e,children:DT.map(r=>a.jsx("button",{style:{...pl.btn,...t===r.value?pl.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const kT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],dl={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 NT({style:i,className:e}){const{chartType:t,setChartType:A}=Vt();return a.jsx("div",{style:{...dl.container,...i},className:e,children:kT.map(r=>a.jsxs("button",{style:{...dl.btn,...t===r.value?dl.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={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 OT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Vt(),[h,g]=q.useState(null),v=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),F=x>0&&v>0?Math.abs(x-v):0,T=Q=>!Q||Q===0?"-.-----":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5),S=Q=>Q===0?"-":Q>=1?Q.toFixed(1):Q>=.01?Q.toFixed(3):(Q*1e4).toFixed(1)+"p",I=q.useCallback(Q=>{if(!s)return;const N=Q==="BUY"?x:v;if(!N||N<=0){g({type:"error",message:"No price available"});return}const X={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:Q,volume:i,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(V=>[...V,X]);const H=i*N*.01;c(V=>V-H),g({type:"success",message:`${Q} executed`}),A?.(X),setTimeout(()=>g(null),3e3)},[s,x,v,i,e,t,l,c,A]);return a.jsxs("div",{style:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>I("SELL"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,AA.sellBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d",Q.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:T(v)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:S(F)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:T(x)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>I("BUY"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,AA.buyBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#14532d",Q.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...AA.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const at={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 KT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Vt(),[l,c]=q.useState(null),h=A.filter(T=>T.status==="OPEN"||!T.closeAt),g=q.useCallback((T,S)=>{const I=n.find(Q=>Q.symbol===T);return I?S?.toUpperCase()==="BUY"?parseFloat(I.bid||0):parseFloat(I.ask||0):0},[n]),v=q.useCallback(T=>{if(l)return;c(T.id);const S=g(T.symbol,T.type),Q=(T.type?.toUpperCase()==="BUY"?S-T.price:T.price-S)*T.volume,N=T.volume*T.price*.01;r(X=>X.filter(H=>H.id!==T.id)),o(X=>X+N+Q),c(null)},[l,g,r,o]),x=T=>{const S=parseFloat(T);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},F=T=>{const S=parseFloat(T);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...at.container,...i},className:e,children:[a.jsxs("div",{style:at.header,children:[a.jsxs("span",{style:at.headerTitle,children:["Positions (",h.length,")"]}),a.jsxs("div",{style:at.summary,children:[a.jsxs("div",{style:at.summaryItem,children:[a.jsx("span",{style:at.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...at.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:at.summaryItem,children:[a.jsx("span",{style:at.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...at.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:at.summaryItem,children:[a.jsx("span",{style:at.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...at.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...at.scrollArea,maxHeight:t},children:a.jsxs("table",{style:at.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:at.th,children:"Symbol"}),a.jsx("th",{style:at.th,children:"Type"}),a.jsx("th",{style:at.th,children:"Volume"}),a.jsx("th",{style:at.th,children:"Open Price"}),a.jsx("th",{style:at.th,children:"Current"}),a.jsx("th",{style:at.th,children:"SL"}),a.jsx("th",{style:at.th,children:"TP"}),a.jsx("th",{style:at.th,children:"Profit"}),a.jsx("th",{style:at.th,children:"Action"})]})}),a.jsx("tbody",{children:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:at.emptyRow,children:"No open positions"})}):h.map(T=>{const S=g(T.symbol,T.type),I=T.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...at.td,fontWeight:700,color:"#e2e8f0"},children:T.symbol}),a.jsx("td",{style:{...at.td,...T.type?.toUpperCase()==="BUY"?at.typeBuy:at.typeSell},children:T.type}),a.jsx("td",{style:at.td,children:T.volume}),a.jsx("td",{style:at.td,children:x(T.price)}),a.jsx("td",{style:at.td,children:x(S)}),a.jsx("td",{style:at.td,children:T.stopLoss?x(T.stopLoss):"-"}),a.jsx("td",{style:at.td,children:T.takeProfit?x(T.takeProfit):"-"}),a.jsx("td",{style:{...at.td,color:I>=0?"#26A69A":"#EF5350",fontWeight:700},children:F(I)}),a.jsx("td",{style:at.td,children:a.jsx("button",{style:{...at.closeBtn,...l===T.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>v(T),disabled:l===T.id,onMouseEnter:Q=>{l!==T.id&&(Q.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d"},children:l===T.id?"...":"Close"})})]},T.id)})})]})})]})}function VT(i){return eA({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:[]}]})(i)}function zT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function WT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function RT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const GT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:g=!0,onToggleMarketWatch:v,buySellPanelOpen:x,onMove:F})=>{const{theme:T}=Vt(),S=T==="light",I=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],Q={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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"}),a.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:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.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 a.jsx("div",{className:`overflow-x-auto border-b ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:S?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
13
|
-
${
|
|
9
|
+
}`,iT=function(A){rT(A,"."+rl+tT+nd+`
|
|
10
|
+
.`+nl+AT+nd)},rT=function(A,e){var t=A.ownerDocument;if(t){var i=t.createElement("style");i.textContent=e,A.appendChild(i)}},sd=(function(){function A(){}return A.getOrigin=function(e){var t=A._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},A.isSameOrigin=function(e){return A.getOrigin(e)===A._origin},A.setContext=function(e){A._link=e.document.createElement("a"),A._origin=A.getOrigin(e.location.href)},A._origin="about:blank",A})(),nT=(function(){function A(e,t){this.context=e,this._options=t,this._cache={}}return A.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ol(e)||lT(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},A.prototype.match=function(e){return this._cache[e]},A.prototype.loadImage=function(e){return sA(this,void 0,void 0,function(){var t,i,r,n,s=this;return tA(this,function(o){switch(o.label){case 0:return t=sd.isSameOrigin(e),i=!sl(e)&&this._options.useCORS===!0&&Jt.SUPPORT_CORS_IMAGES&&!t,r=!sl(e)&&!t&&!ol(e)&&typeof this._options.proxy=="string"&&Jt.SUPPORT_CORS_XHR&&!i,!t&&this._options.allowTaint===!1&&!sl(e)&&!ol(e)&&!r&&!i?[2]:(n=e,r?[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,c){var h=new Image;h.onload=function(){return l(h)},h.onerror=c,(cT(n)||i)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return l(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},A.prototype.has=function(e){return typeof this._cache[e]<"u"},A.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},A.prototype.proxy=function(e){var t=this,i=this._options.proxy;if(!i)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var o=Jt.SUPPORT_RESPONSE_TYPE?"blob":"text",l=new XMLHttpRequest;l.onload=function(){if(l.status===200)if(o==="text")n(l.response);else{var m=new FileReader;m.addEventListener("load",function(){return n(m.result)},!1),m.addEventListener("error",function(v){return s(v)},!1),m.readAsDataURL(l.response)}else s("Failed to proxy resource "+r+" with status code "+l.status)},l.onerror=s;var c=i.indexOf("?")>-1?"&":"?";if(l.open("GET",""+i+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&l instanceof XMLHttpRequest&&(l.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;l.timeout=h,l.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+r)}}l.send()})},A})(),sT=/^data:image\/svg\+xml/i,oT=/^data:image\/.*;base64,/i,aT=/^data:image\/.*/i,lT=function(A){return Jt.SUPPORT_SVG_DRAWING||!hT(A)},sl=function(A){return aT.test(A)},cT=function(A){return oT.test(A)},ol=function(A){return A.substr(0,4)==="blob"},hT=function(A){return A.substr(-3).toLowerCase()==="svg"||sT.test(A)},Pe=(function(){function A(e,t){this.type=0,this.x=e,this.y=t}return A.prototype.add=function(e,t){return new A(this.x+e,this.y+t)},A})(),Ar=function(A,e,t){return new Pe(A.x+(e.x-A.x)*t,A.y+(e.y-A.y)*t)},Hs=(function(){function A(e,t,i,r){this.type=1,this.start=e,this.startControl=t,this.endControl=i,this.end=r}return A.prototype.subdivide=function(e,t){var i=Ar(this.start,this.startControl,e),r=Ar(this.startControl,this.endControl,e),n=Ar(this.endControl,this.end,e),s=Ar(i,r,e),o=Ar(r,n,e),l=Ar(s,o,e);return t?new A(this.start,i,s,l):new A(l,o,n,this.end)},A.prototype.add=function(e,t){return new A(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},A.prototype.reverse=function(){return new A(this.end,this.endControl,this.startControl,this.start)},A})(),UA=function(A){return A.type===1},uT=(function(){function A(e){var t=e.styles,i=e.bounds,r=Kr(t.borderTopLeftRadius,i.width,i.height),n=r[0],s=r[1],o=Kr(t.borderTopRightRadius,i.width,i.height),l=o[0],c=o[1],h=Kr(t.borderBottomRightRadius,i.width,i.height),m=h[0],v=h[1],x=Kr(t.borderBottomLeftRadius,i.width,i.height),F=x[0],T=x[1],S=[];S.push((n+l)/i.width),S.push((F+m)/i.width),S.push((s+T)/i.height),S.push((c+v)/i.height);var I=Math.max.apply(Math,S);I>1&&(n/=I,s/=I,l/=I,c/=I,m/=I,v/=I,F/=I,T/=I);var Q=i.width-l,N=i.height-v,J=i.width-m,H=i.height-T,z=t.borderTopWidth,re=t.borderRightWidth,q=t.borderBottomWidth,ie=t.borderLeftWidth,G=xt(t.paddingTop,e.bounds.width),ne=xt(t.paddingRight,e.bounds.width),le=xt(t.paddingBottom,e.bounds.width),ee=xt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?St(i.left+ie/3,i.top+z/3,n-ie/3,s-z/3,gt.TOP_LEFT):new Pe(i.left+ie/3,i.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?St(i.left+Q,i.top+z/3,l-re/3,c-z/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re/3,i.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||v>0?St(i.left+J,i.top+N,m-re/3,v-q/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/3,i.top+i.height-q/3),this.bottomLeftBorderDoubleOuterBox=F>0||T>0?St(i.left+ie/3,i.top+H,F-ie/3,T-q/3,gt.BOTTOM_LEFT):new Pe(i.left+ie/3,i.top+i.height-q/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?St(i.left+ie*2/3,i.top+z*2/3,n-ie*2/3,s-z*2/3,gt.TOP_LEFT):new Pe(i.left+ie*2/3,i.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?St(i.left+Q,i.top+z*2/3,l-re*2/3,c-z*2/3,gt.TOP_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||v>0?St(i.left+J,i.top+N,m-re*2/3,v-q*2/3,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re*2/3,i.top+i.height-q*2/3),this.bottomLeftBorderDoubleInnerBox=F>0||T>0?St(i.left+ie*2/3,i.top+H,F-ie*2/3,T-q*2/3,gt.BOTTOM_LEFT):new Pe(i.left+ie*2/3,i.top+i.height-q*2/3),this.topLeftBorderStroke=n>0||s>0?St(i.left+ie/2,i.top+z/2,n-ie/2,s-z/2,gt.TOP_LEFT):new Pe(i.left+ie/2,i.top+z/2),this.topRightBorderStroke=n>0||s>0?St(i.left+Q,i.top+z/2,l-re/2,c-z/2,gt.TOP_RIGHT):new Pe(i.left+i.width-re/2,i.top+z/2),this.bottomRightBorderStroke=m>0||v>0?St(i.left+J,i.top+N,m-re/2,v-q/2,gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re/2,i.top+i.height-q/2),this.bottomLeftBorderStroke=F>0||T>0?St(i.left+ie/2,i.top+H,F-ie/2,T-q/2,gt.BOTTOM_LEFT):new Pe(i.left+ie/2,i.top+i.height-q/2),this.topLeftBorderBox=n>0||s>0?St(i.left,i.top,n,s,gt.TOP_LEFT):new Pe(i.left,i.top),this.topRightBorderBox=l>0||c>0?St(i.left+Q,i.top,l,c,gt.TOP_RIGHT):new Pe(i.left+i.width,i.top),this.bottomRightBorderBox=m>0||v>0?St(i.left+J,i.top+N,m,v,gt.BOTTOM_RIGHT):new Pe(i.left+i.width,i.top+i.height),this.bottomLeftBorderBox=F>0||T>0?St(i.left,i.top+H,F,T,gt.BOTTOM_LEFT):new Pe(i.left,i.top+i.height),this.topLeftPaddingBox=n>0||s>0?St(i.left+ie,i.top+z,Math.max(0,n-ie),Math.max(0,s-z),gt.TOP_LEFT):new Pe(i.left+ie,i.top+z),this.topRightPaddingBox=l>0||c>0?St(i.left+Math.min(Q,i.width-re),i.top+z,Q>i.width+re?0:Math.max(0,l-re),Math.max(0,c-z),gt.TOP_RIGHT):new Pe(i.left+i.width-re,i.top+z),this.bottomRightPaddingBox=m>0||v>0?St(i.left+Math.min(J,i.width-ie),i.top+Math.min(N,i.height-q),Math.max(0,m-re),Math.max(0,v-q),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-re,i.top+i.height-q),this.bottomLeftPaddingBox=F>0||T>0?St(i.left+ie,i.top+Math.min(H,i.height-q),Math.max(0,F-ie),Math.max(0,T-q),gt.BOTTOM_LEFT):new Pe(i.left+ie,i.top+i.height-q),this.topLeftContentBox=n>0||s>0?St(i.left+ie+ee,i.top+z+G,Math.max(0,n-(ie+ee)),Math.max(0,s-(z+G)),gt.TOP_LEFT):new Pe(i.left+ie+ee,i.top+z+G),this.topRightContentBox=l>0||c>0?St(i.left+Math.min(Q,i.width+ie+ee),i.top+z+G,Q>i.width+ie+ee?0:l-ie+ee,c-(z+G),gt.TOP_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+z+G),this.bottomRightContentBox=m>0||v>0?St(i.left+Math.min(J,i.width-(ie+ee)),i.top+Math.min(N,i.height+z+G),Math.max(0,m-(re+ne)),v-(q+le),gt.BOTTOM_RIGHT):new Pe(i.left+i.width-(re+ne),i.top+i.height-(q+le)),this.bottomLeftContentBox=F>0||T>0?St(i.left+ie+ee,i.top+H,Math.max(0,F-(ie+ee)),T-(q+le),gt.BOTTOM_LEFT):new Pe(i.left+ie+ee,i.top+i.height-(q+le))}return A})(),gt;(function(A){A[A.TOP_LEFT=0]="TOP_LEFT",A[A.TOP_RIGHT=1]="TOP_RIGHT",A[A.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",A[A.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(gt||(gt={}));var St=function(A,e,t,i,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=i*n,l=A+t,c=e+i;switch(r){case gt.TOP_LEFT:return new Hs(new Pe(A,c),new Pe(A,c-o),new Pe(l-s,e),new Pe(l,e));case gt.TOP_RIGHT:return new Hs(new Pe(A,e),new Pe(A+s,e),new Pe(l,c-o),new Pe(l,c));case gt.BOTTOM_RIGHT:return new Hs(new Pe(l,e),new Pe(l,e+o),new Pe(A+s,c),new Pe(A,c));case gt.BOTTOM_LEFT:default:return new Hs(new Pe(l,c),new Pe(l-s,c),new Pe(A,e+o),new Pe(A,e))}},Is=function(A){return[A.topLeftBorderBox,A.topRightBorderBox,A.bottomRightBorderBox,A.bottomLeftBorderBox]},pT=function(A){return[A.topLeftContentBox,A.topRightContentBox,A.bottomRightContentBox,A.bottomLeftContentBox]},Ps=function(A){return[A.topLeftPaddingBox,A.topRightPaddingBox,A.bottomRightPaddingBox,A.bottomLeftPaddingBox]},dT=(function(){function A(e,t,i){this.offsetX=e,this.offsetY=t,this.matrix=i,this.type=0,this.target=6}return A})(),Ds=(function(){function A(e,t){this.path=e,this.target=t,this.type=1}return A})(),fT=(function(){function A(e){this.opacity=e,this.type=2,this.target=6}return A})(),gT=function(A){return A.type===0},od=function(A){return A.type===1},mT=function(A){return A.type===2},ad=function(A,e){return A.length===e.length?A.some(function(t,i){return t===e[i]}):!1},wT=function(A,e,t,i,r){return A.map(function(n,s){switch(s){case 0:return n.add(e,t);case 1:return n.add(e+i,t);case 2:return n.add(e+i,t+r);case 3:return n.add(e,t+r)}return n})},ld=(function(){function A(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return A})(),cd=(function(){function A(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new uT(this.container),this.container.styles.opacity<1&&this.effects.push(new fT(this.container.styles.opacity)),this.container.styles.transform!==null){var i=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new dT(i,r,n))}if(this.container.styles.overflowX!==0){var s=Is(this.curves),o=Ps(this.curves);ad(s,o)?this.effects.push(new Ds(s,6)):(this.effects.push(new Ds(s,2)),this.effects.push(new Ds(o,4)))}}return A.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,i=this.parent,r=this.effects.slice(0);i;){var n=i.effects.filter(function(l){return!od(l)});if(t||i.container.styles.position!==0||!i.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(i.container.styles.position)===-1,i.container.styles.overflowX!==0){var s=Is(i.curves),o=Ps(i.curves);ad(s,o)||r.unshift(new Ds(o,6))}}else r.unshift.apply(r,n);i=i.parent}return r.filter(function(l){return Kt(l.target,e)})},A})(),al=function(A,e,t,i){A.container.elements.forEach(function(r){var n=Kt(r.flags,4),s=Kt(r.flags,2),o=new cd(r,A);Kt(r.styles.display,2048)&&i.push(o);var l=Kt(r.flags,8)?[]:i;if(n||s){var c=n||r.styles.isPositioned()?t:e,h=new ld(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var v=0;c.negativeZIndex.some(function(F,T){return m>F.element.container.styles.zIndex.order?(v=T,!1):v>0}),c.negativeZIndex.splice(v,0,h)}else if(m>0){var x=0;c.positiveZIndex.some(function(F,T){return m>=F.element.container.styles.zIndex.order?(x=T+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else r.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);al(o,h,n?h:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),al(o,e,t,l);Kt(r.flags,8)&&hd(r,l)})},hd=function(A,e){for(var t=A instanceof Ya?A.start:1,i=A instanceof Ya?A.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Dp&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=$r(t,n.container.styles.listStyleType,!0),t+=i?-1:1}},BT=function(A){var e=new cd(A,null),t=new ld(e),i=[];return al(e,t,t,i),hd(e.container,i),t},ud=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftPaddingBox,A.topRightBorderBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderBox,A.topRightPaddingBox,A.bottomRightBorderBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightPaddingBox,A.bottomLeftBorderBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftPaddingBox,A.topLeftBorderBox,A.topLeftPaddingBox)}},yT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox,A.topRightBorderBox,A.topRightBorderDoubleOuterBox);case 1:return SA(A.topRightBorderBox,A.topRightBorderDoubleOuterBox,A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox);case 2:return SA(A.bottomRightBorderBox,A.bottomRightBorderDoubleOuterBox,A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox);default:return SA(A.bottomLeftBorderBox,A.bottomLeftBorderDoubleOuterBox,A.topLeftBorderBox,A.topLeftBorderDoubleOuterBox)}},CT=function(A,e){switch(e){case 0:return SA(A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox,A.topRightBorderDoubleInnerBox,A.topRightPaddingBox);case 1:return SA(A.topRightBorderDoubleInnerBox,A.topRightPaddingBox,A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox);case 2:return SA(A.bottomRightBorderDoubleInnerBox,A.bottomRightPaddingBox,A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox);default:return SA(A.bottomLeftBorderDoubleInnerBox,A.bottomLeftPaddingBox,A.topLeftBorderDoubleInnerBox,A.topLeftPaddingBox)}},vT=function(A,e){switch(e){case 0:return _s(A.topLeftBorderStroke,A.topRightBorderStroke);case 1:return _s(A.topRightBorderStroke,A.bottomRightBorderStroke);case 2:return _s(A.bottomRightBorderStroke,A.bottomLeftBorderStroke);default:return _s(A.bottomLeftBorderStroke,A.topLeftBorderStroke)}},_s=function(A,e){var t=[];return UA(A)?t.push(A.subdivide(.5,!1)):t.push(A),UA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},SA=function(A,e,t,i){var r=[];return UA(A)?r.push(A.subdivide(.5,!1)):r.push(A),UA(t)?r.push(t.subdivide(.5,!0)):r.push(t),UA(i)?r.push(i.subdivide(.5,!0).reverse()):r.push(i),UA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},pd=function(A){var e=A.bounds,t=A.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ks=function(A){var e=A.styles,t=A.bounds,i=xt(e.paddingLeft,t.width),r=xt(e.paddingRight,t.width),n=xt(e.paddingTop,t.width),s=xt(e.paddingBottom,t.width);return t.add(i+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+i+r),-(e.borderTopWidth+e.borderBottomWidth+n+s))},TT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},bT=function(A,e){return A===0?e.bounds:A===2?ks(e):pd(e)},ll=function(A,e,t){var i=TT(rr(A.styles.backgroundOrigin,e),A),r=bT(rr(A.styles.backgroundClip,e),A),n=xT(rr(A.styles.backgroundSize,e),t,i),s=n[0],o=n[1],l=Kr(rr(A.styles.backgroundPosition,e),i.width-s,i.height-o),c=QT(rr(A.styles.backgroundRepeat,e),l,n,i,r),h=Math.round(i.left+l[0]),m=Math.round(i.top+l[1]);return[c,h,m,s,o]},ir=function(A){return yt(A)&&A.value===qi.AUTO},Os=function(A){return typeof A=="number"},xT=function(A,e,t){var i=e[0],r=e[1],n=e[2],s=A[0],o=A[1];if(!s)return[0,0];if(Ot(s)&&o&&Ot(o))return[xt(s,t.width),xt(o,t.height)];var l=Os(n);if(yt(s)&&(s.value===qi.CONTAIN||s.value===qi.COVER)){if(Os(n)){var c=t.width/t.height;return c<n!=(s.value===qi.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=Os(i),m=Os(r),v=h||m;if(ir(s)&&(!o||ir(o))){if(h&&m)return[i,r];if(!l&&!v)return[t.width,t.height];if(v&&l){var x=h?i:r*n,F=m?r:i/n;return[x,F]}var T=h?i:t.width,S=m?r:t.height;return[T,S]}if(l){var I=0,Q=0;return Ot(s)?I=xt(s,t.width):Ot(o)&&(Q=xt(o,t.height)),ir(s)?I=Q*n:(!o||ir(o))&&(Q=I/n),[I,Q]}var N=null,J=null;if(Ot(s)?N=xt(s,t.width):o&&Ot(o)&&(J=xt(o,t.height)),N!==null&&(!o||ir(o))&&(J=h&&m?N/i*r:t.height),J!==null&&ir(s)&&(N=h&&m?J/r*i:t.width),N!==null&&J!==null)return[N,J];throw new Error("Unable to calculate background-size for element")},rr=function(A,e){var t=A[e];return typeof t>"u"?A[0]:t},QT=function(A,e,t,i,r){var n=e[0],s=e[1],o=t[0],l=t[1];switch(A){case 2:return[new Pe(Math.round(i.left),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(i.top+s)),new Pe(Math.round(i.left+i.width),Math.round(l+i.top+s)),new Pe(Math.round(i.left),Math.round(l+i.top+s))];case 3:return[new Pe(Math.round(i.left+n),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.top)),new Pe(Math.round(i.left+n+o),Math.round(i.height+i.top)),new Pe(Math.round(i.left+n),Math.round(i.height+i.top))];case 1:return[new Pe(Math.round(i.left+n),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s)),new Pe(Math.round(i.left+n+o),Math.round(i.top+s+l)),new Pe(Math.round(i.left+n),Math.round(i.top+s+l))];default:return[new Pe(Math.round(r.left),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.top)),new Pe(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Pe(Math.round(r.left),Math.round(r.height+r.top))]}},FT="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",dd="Hidden Text",UT=(function(){function A(e){this._data={},this._document=e}return A.prototype.parseMetrics=function(e,t){var i=this._document.createElement("div"),r=this._document.createElement("img"),n=this._document.createElement("span"),s=this._document.body;i.style.visibility="hidden",i.style.fontFamily=e,i.style.fontSize=t,i.style.margin="0",i.style.padding="0",i.style.whiteSpace="nowrap",s.appendChild(i),r.src=FT,r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(dd)),i.appendChild(n),i.appendChild(r);var o=r.offsetTop-n.offsetTop+2;i.removeChild(n),i.appendChild(this._document.createTextNode(dd)),i.style.lineHeight="normal",r.style.verticalAlign="super";var l=r.offsetTop-i.offsetTop+2;return s.removeChild(i),{baseline:o,middle:l}},A.prototype.getMetrics=function(e,t){var i=e+" "+t;return typeof this._data[i]>"u"&&(this._data[i]=this.parseMetrics(e,t)),this._data[i]},A})(),fd=(function(){function A(e,t){this.context=e,this.options=t}return A})(),ST=1e4,ET=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r._activeEffects=[],r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),i.canvas||(r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px"),r.fontMetrics=new UT(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+i.width+"x"+i.height+") with scale "+i.scale),r}return e.prototype.applyEffects=function(t){for(var i=this;this._activeEffects.length;)this.popEffect();t.forEach(function(r){return i.applyEffect(r)})},e.prototype.applyEffect=function(t){this.ctx.save(),mT(t)&&(this.ctx.globalAlpha=t.opacity),gT(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),od(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return i=t.element.container.styles,i.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return sA(this,void 0,void 0,function(){return tA(this,function(i){switch(i.label){case 0:if(Kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return i.sent(),[4,this.renderNodeContent(t)];case 2:i.sent(),i.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,i,r){var n=this;if(i===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=Za(t.text);s.reduce(function(o,l){return n.ctx.fillText(l,o,t.bounds.top+r),o+n.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var i=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),r=PT(t.fontFamily).join(", "),n=Nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,i,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,i){return sA(this,void 0,void 0,function(){var r,n,s,o,l,c,h,m,v=this;return tA(this,function(x){return r=this.createFontStyle(i),n=r[0],s=r[1],o=r[2],this.ctx.font=n,this.ctx.direction=i.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(s,o),c=l.baseline,h=l.middle,m=i.paintOrder,t.textBounds.forEach(function(F){m.forEach(function(T){switch(T){case 0:v.ctx.fillStyle=Gt(i.color),v.renderTextWithLetterSpacing(F,i.letterSpacing,c);var S=i.textShadow;S.length&&F.text.trim().length&&(S.slice(0).reverse().forEach(function(I){v.ctx.shadowColor=Gt(I.color),v.ctx.shadowOffsetX=I.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=I.offsetY.number*v.options.scale,v.ctx.shadowBlur=I.blur.number,v.renderTextWithLetterSpacing(F,i.letterSpacing,c)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),i.textDecorationLine.length&&(v.ctx.fillStyle=Gt(i.textDecorationColor||i.color),i.textDecorationLine.forEach(function(I){switch(I){case 1:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top+c),F.bounds.width,1);break;case 2:v.ctx.fillRect(F.bounds.left,Math.round(F.bounds.top),F.bounds.width,1);break;case 3:v.ctx.fillRect(F.bounds.left,Math.ceil(F.bounds.top+h),F.bounds.width,1);break}}));break;case 1:i.webkitTextStrokeWidth&&F.text.trim().length&&(v.ctx.strokeStyle=Gt(i.webkitTextStrokeColor),v.ctx.lineWidth=i.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(F.text,F.bounds.left,F.bounds.top+c)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,i,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ks(t),s=Ps(i);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l,Q,Q,c,h,m,v,J,x,F,H,T,S,I,Q,N,J,H;return tA(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),i=t.container,r=t.curves,n=i.styles,s=0,o=i.textNodes,z.label=1;case 1:return s<o.length?(l=o[s],[4,this.renderTextNode(l,n)]):[3,4];case 2:z.sent(),z.label=3;case 3:return s++,[3,1];case 4:if(!(i instanceof Hp))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(i.src)];case 6:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+i.src),[3,8];case 8:if(i instanceof Ip&&this.renderReplacedElement(i,r,i.canvas),!(i instanceof Pp))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(i.svg)];case 10:return Q=z.sent(),this.renderReplacedElement(i,r,Q),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+i.svg.substring(0,255)),[3,12];case 12:return i instanceof Np&&i.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:i.backgroundColor,x:0,y:0,width:i.width,height:i.height}),[4,c.render(i.tree)]):[3,14];case 13:h=z.sent(),i.width&&i.height&&this.ctx.drawImage(h,0,0,i.width,i.height,i.bounds.left,i.bounds.top,i.bounds.width,i.bounds.height),z.label=14;case 14:if(i instanceof qa&&(m=Math.min(i.bounds.width,i.bounds.height),i.type===Fs?i.checked&&(this.ctx.save(),this.path([new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79),new Pe(i.bounds.left+m*.16,i.bounds.top+m*.5549),new Pe(i.bounds.left+m*.27347,i.bounds.top+m*.44071),new Pe(i.bounds.left+m*.39694,i.bounds.top+m*.5649),new Pe(i.bounds.left+m*.72983,i.bounds.top+m*.23),new Pe(i.bounds.left+m*.84,i.bounds.top+m*.34085),new Pe(i.bounds.left+m*.39363,i.bounds.top+m*.79)]),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore()):i.type===Us&&i.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(i.bounds.left+m/2,i.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Gt(_p),this.ctx.fill(),this.ctx.restore())),LT(i)&&i.value.length){switch(v=this.createFontStyle(n),J=v[0],x=v[1],F=this.fontMetrics.getMetrics(J,x).baseline,this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=HT(i.styles.textAlign),H=ks(i),T=0,i.styles.textAlign){case 1:T+=H.width/2;break;case 2:T+=H.width;break}S=H.add(T,0,0,-H.height/2+1),this.ctx.save(),this.path([new Pe(H.left,H.top),new Pe(H.left+H.width,H.top),new Pe(H.left+H.width,H.top+H.height),new Pe(H.left,H.top+H.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Gr(i.value,S),n.letterSpacing,F),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Kt(i.styles.display,2048))return[3,20];if(i.styles.listStyleImage===null)return[3,19];if(I=i.styles.listStyleImage,I.type!==0)return[3,18];Q=void 0,N=I.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return Q=z.sent(),this.ctx.drawImage(Q,i.bounds.left-(Q.width+10),i.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+N),[3,18];case 18:return[3,20];case 19:t.listValue&&i.styles.listStyleType!==-1&&(J=this.createFontStyle(n)[0],this.ctx.font=J,this.ctx.fillStyle=Gt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",H=new ti(i.bounds.left,i.bounds.top+xt(i.styles.paddingTop,i.bounds.width),i.bounds.width,dp(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Gr(t.listValue,H),n.letterSpacing,dp(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),z.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return sA(this,void 0,void 0,function(){var i,r,I,n,s,I,o,l,I,c,h,I,m,v,I,x,F,I,T,S,I;return tA(this,function(Q){switch(Q.label){case 0:if(Kt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:Q.sent(),i=0,r=t.negativeZIndex,Q.label=2;case 2:return i<r.length?(I=r[i],[4,this.renderStack(I)]):[3,5];case 3:Q.sent(),Q.label=4;case 4:return i++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:Q.sent(),n=0,s=t.nonInlineLevel,Q.label=7;case 7:return n<s.length?(I=s[n],[4,this.renderNode(I)]):[3,10];case 8:Q.sent(),Q.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,Q.label=11;case 11:return o<l.length?(I=l[o],[4,this.renderStack(I)]):[3,14];case 12:Q.sent(),Q.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,Q.label=15;case 15:return c<h.length?(I=h[c],[4,this.renderStack(I)]):[3,18];case 16:Q.sent(),Q.label=17;case 17:return c++,[3,15];case 18:m=0,v=t.inlineLevel,Q.label=19;case 19:return m<v.length?(I=v[m],[4,this.renderNode(I)]):[3,22];case 20:Q.sent(),Q.label=21;case 21:return m++,[3,19];case 22:x=0,F=t.zeroOrAutoZIndexOrTransformedOrOpacity,Q.label=23;case 23:return x<F.length?(I=F[x],[4,this.renderStack(I)]):[3,26];case 24:Q.sent(),Q.label=25;case 25:return x++,[3,23];case 26:T=0,S=t.positiveZIndex,Q.label=27;case 27:return T<S.length?(I=S[T],[4,this.renderStack(I)]):[3,30];case 28:Q.sent(),Q.label=29;case 29:return T++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){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(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var i=this;t.forEach(function(r,n){var s=UA(r)?r.start:r;n===0?i.ctx.moveTo(s.x,s.y):i.ctx.lineTo(s.x,s.y),UA(r)&&i.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,i,r,n){this.path(t),this.ctx.fillStyle=i,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,i,r){var n;if(t.width===i&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,i),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,i,r),o},e.prototype.renderBackgroundImage=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l;return tA(this,function(c){switch(c.label){case 0:i=t.styles.backgroundImage.length-1,r=function(h){var m,v,x,G,ge,ae,ee,we,q,F,G,ge,ae,ee,we,T,S,I,Q,N,J,H,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe,Se;return tA(this,function(Me){switch(Me.label){case 0:if(h.type!==0)return[3,5];m=void 0,v=h.url,Me.label=1;case 1:return Me.trys.push([1,3,,4]),[4,n.context.cache.match(v)];case 2:return m=Me.sent(),[3,4];case 3:return Me.sent(),n.context.logger.error("Error loading background-image "+v),[3,4];case 4:return m&&(x=ll(t,i,[m.width,m.height,m.width/m.height]),G=x[0],ge=x[1],ae=x[2],ee=x[3],we=x[4],q=n.ctx.createPattern(n.resizeImage(m,ee,we),"repeat"),n.renderRepeat(G,q,ge,ae)),[3,6];case 5:gy(h)?(F=ll(t,i,[null,null,null]),G=F[0],ge=F[1],ae=F[2],ee=F[3],we=F[4],T=hy(h.angle,ee,we),S=T[0],I=T[1],Q=T[2],N=T[3],J=T[4],H=document.createElement("canvas"),H.width=ee,H.height=we,z=H.getContext("2d"),re=z.createLinearGradient(I,N,Q,J),ip(h.stops,S).forEach(function($e){return re.addColorStop($e.stop,Gt($e.color))}),z.fillStyle=re,z.fillRect(0,0,ee,we),ee>0&&we>0&&(q=n.ctx.createPattern(H,"repeat"),n.renderRepeat(G,q,ge,ae))):my(h)&&(ie=ll(t,i,[null,null,null]),G=ie[0],ne=ie[1],le=ie[2],ee=ie[3],we=ie[4],j=h.position.length===0?[Pa]:h.position,ge=xt(j[0],ee),ae=xt(j[j.length-1],we),pe=uy(h,ge,ae,ee,we),ue=pe[0],oe=pe[1],ue>0&&oe>0&&(fe=n.ctx.createRadialGradient(ne+ge,le+ae,0,ne+ge,le+ae,ue),ip(h.stops,ue*2).forEach(function($e){return fe.addColorStop($e.stop,Gt($e.color))}),n.path(G),n.ctx.fillStyle=fe,ue!==oe?(Qe=t.bounds.left+.5*t.bounds.width,me=t.bounds.top+.5*t.bounds.height,xe=oe/ue,Se=1/xe,n.ctx.save(),n.ctx.translate(Qe,me),n.ctx.transform(1,0,0,xe,0,0),n.ctx.translate(-Qe,-me),n.ctx.fillRect(ne,Se*(le-me)+me,ee,we*Se),n.ctx.restore()):n.ctx.fill())),Me.label=6;case 6:return i--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,i,r){return sA(this,void 0,void 0,function(){return tA(this,function(n){return this.path(ud(r,i)),this.ctx.fillStyle=Gt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,i,r,n){return sA(this,void 0,void 0,function(){var s,o;return tA(this,function(l){switch(l.label){case 0:return i<3?[4,this.renderSolidBorder(t,r,n)]:[3,2];case 1:return l.sent(),[2];case 2:return s=yT(n,r),this.path(s),this.ctx.fillStyle=Gt(t),this.ctx.fill(),o=CT(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return sA(this,void 0,void 0,function(){var i,r,n,s,o,l,c,h,m=this;return tA(this,function(v){switch(v.label){case 0:return this.applyEffects(t.getEffects(2)),i=t.container.styles,r=!wi(i.backgroundColor)||i.backgroundImage.length,n=[{style:i.borderTopStyle,color:i.borderTopColor,width:i.borderTopWidth},{style:i.borderRightStyle,color:i.borderRightColor,width:i.borderRightWidth},{style:i.borderBottomStyle,color:i.borderBottomColor,width:i.borderBottomWidth},{style:i.borderLeftStyle,color:i.borderLeftColor,width:i.borderLeftWidth}],s=MT(rr(i.backgroundClip,0),t.curves),r||i.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),wi(i.backgroundColor)||(this.ctx.fillStyle=Gt(i.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),i.boxShadow.slice(0).reverse().forEach(function(x){m.ctx.save();var F=Is(t.curves),T=x.inset?0:ST,S=wT(F,-T+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(m.path(F),m.ctx.clip(),m.mask(S)):(m.mask(F),m.ctx.clip(),m.path(S)),m.ctx.shadowOffsetX=x.offsetX.number+T,m.ctx.shadowOffsetY=x.offsetY.number,m.ctx.shadowColor=Gt(x.color),m.ctx.shadowBlur=x.blur.number,m.ctx.fillStyle=x.inset?Gt(x.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),v.label=2;case 2:o=0,l=0,c=n,v.label=3;case 3:return l<c.length?(h=c[l],h.style!==0&&!wi(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return v.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:v.sent(),v.label=11;case 11:o++,v.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,i,r,n,s){return sA(this,void 0,void 0,function(){var o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,z,H,z;return tA(this,function(re){return this.ctx.save(),o=vT(n,r),l=ud(n,r),s===2&&(this.path(l),this.ctx.clip()),UA(l[0])?(c=l[0].start.x,h=l[0].start.y):(c=l[0].x,h=l[0].y),UA(l[1])?(m=l[1].end.x,v=l[1].end.y):(m=l[1].x,v=l[1].y),r===0||r===2?x=Math.abs(c-m):x=Math.abs(h-v),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),F=i<3?i*3:i*2,T=i<3?i*2:i,s===3&&(F=i,T=i),S=!0,x<=F*2?S=!1:x<=F*2+T?(I=x/(2*F+T),F*=I,T*=I):(Q=Math.floor((x+T)/(F+T)),N=(x-Q*F)/(Q-1),J=(x-(Q+1)*F)/Q,T=J<=0||Math.abs(T-N)<Math.abs(T-J)?N:J),S&&(s===3?this.ctx.setLineDash([0,F+T]):this.ctx.setLineDash([F,T])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=i):this.ctx.lineWidth=i*2+1.1,this.ctx.strokeStyle=Gt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(UA(l[0])&&(H=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke()),UA(l[1])&&(H=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Pe(H.end.x,H.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i;return tA(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Gt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),i=BT(t),[4,this.renderStack(i)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(fd),LT=function(A){return A instanceof Op||A instanceof kp?!0:A instanceof qa&&A.type!==Us&&A.type!==Fs},MT=function(A,e){switch(A){case 0:return Is(e);case 2:return pT(e);default:return Ps(e)}},HT=function(A){switch(A){case 1:return"center";case 2:return"right";default:return"left"}},IT=["-apple-system","system-ui"],PT=function(A){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?A.filter(function(e){return IT.indexOf(e)===-1}):A},DT=(function(A){IA(e,A);function e(t,i){var r=A.call(this,t,i)||this;return r.canvas=i.canvas?i.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=i,r.canvas.width=Math.floor(i.width*i.scale),r.canvas.height=Math.floor(i.height*i.scale),r.canvas.style.width=i.width+"px",r.canvas.style.height=i.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-i.x,-i.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+i.width+"x"+i.height+" at "+i.x+","+i.y+") with scale "+i.scale),r}return e.prototype.render=function(t){return sA(this,void 0,void 0,function(){var i,r;return tA(this,function(n){switch(n.label){case 0:return i=Ja(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,_T(i)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Gt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(fd),_T=function(A){return new Promise(function(e,t){var i=new Image;i.onload=function(){e(i)},i.onerror=t,i.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(A))})},kT=(function(){function A(e){var t=e.id,i=e.enabled;this.id=t,this.enabled=i,this.start=Date.now()}return A.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.getTime=function(){return Date.now()-this.start},A.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,$n([this.id,this.getTime()+"ms"],e))},A.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,$n([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},A.instances={},A})(),OT=(function(){function A(e,t){var i;this.windowBounds=t,this.instanceName="#"+A.instanceCount++,this.logger=new kT({id:this.instanceName,enabled:e.logging}),this.cache=(i=e.cache)!==null&&i!==void 0?i:new nT(this,e)}return A.instanceCount=1,A})(),NT=function(A,e){return e===void 0&&(e={}),KT(A,e)};typeof window<"u"&&sd.setContext(window);var KT=function(A,e){return sA(void 0,void 0,void 0,function(){var t,i,r,n,s,o,l,c,h,m,v,x,F,T,S,I,Q,N,J,H,re,z,re,q,ie,G,ne,le,ee,we,j,ge,ae,pe,ue,oe,fe,Qe,me,xe;return tA(this,function(Se){switch(Se.label){case 0:if(!A||typeof A!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=A.ownerDocument,!t)throw new Error("Element is not attached to a Document");if(i=t.defaultView,!i)throw new Error("Document is not attached to a Window");return r={allowTaint:(q=e.allowTaint)!==null&&q!==void 0?q:!1,imageTimeout:(ie=e.imageTimeout)!==null&&ie!==void 0?ie:15e3,proxy:e.proxy,useCORS:(G=e.useCORS)!==null&&G!==void 0?G:!1},n=da({logging:(ne=e.logging)!==null&&ne!==void 0?ne:!0,cache:e.cache},r),s={windowWidth:(le=e.windowWidth)!==null&&le!==void 0?le:i.innerWidth,windowHeight:(ee=e.windowHeight)!==null&&ee!==void 0?ee:i.innerHeight,scrollX:(we=e.scrollX)!==null&&we!==void 0?we:i.pageXOffset,scrollY:(j=e.scrollY)!==null&&j!==void 0?j:i.pageYOffset},o=new ti(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new OT(n,o),c=(ge=e.foreignObjectRendering)!==null&&ge!==void 0?ge:!1,h={allowTaint:(ae=e.allowTaint)!==null&&ae!==void 0?ae:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},l.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),m=new rd(l,A,h),v=m.clonedReferenceElement,v?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=Se.sent(),F=el(v)||zv(v)?wB(v.ownerDocument):Xn(l,v),T=F.width,S=F.height,I=F.left,Q=F.top,N=zT(l,v,e.backgroundColor),J={canvas:e.canvas,backgroundColor:N,scale:(ue=(pe=e.scale)!==null&&pe!==void 0?pe:i.devicePixelRatio)!==null&&ue!==void 0?ue:1,x:((oe=e.x)!==null&&oe!==void 0?oe:0)+I,y:((fe=e.y)!==null&&fe!==void 0?fe:0)+Q,width:(Qe=e.width)!==null&&Qe!==void 0?Qe:Math.ceil(T),height:(me=e.height)!==null&&me!==void 0?me:Math.ceil(S)},c?(l.logger.debug("Document cloned, using foreign object rendering"),re=new DT(l,J),[4,re.render(v)]):[3,3];case 2:return H=Se.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+I+","+Q+" with size "+T+"x"+S+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=zp(l,v),N===z.styles.backgroundColor&&(z.styles.backgroundColor=ii.TRANSPARENT),l.logger.debug("Starting renderer for element at "+J.x+","+J.y+" with size "+J.width+"x"+J.height),re=new ET(l,J),[4,re.render(z)];case 4:H=Se.sent(),Se.label=5;case 5:return(!((xe=e.removeContainer)!==null&&xe!==void 0)||xe)&&(rd.destroy(x)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,H]}})})},zT=function(A,e,t){var i=e.ownerDocument,r=i.documentElement?zr(A,getComputedStyle(i.documentElement).backgroundColor):ii.TRANSPARENT,n=i.body?zr(A,getComputedStyle(i.body).backgroundColor):ii.TRANSPARENT,s=typeof t=="string"?zr(A,t):t===null?ii.TRANSPARENT:4294967295;return e===i.documentElement?wi(r)?wi(n)?s:n:r:s};const VT=new Set(["primitive","series","priceLine","decoration","textPrimitive","firstLine","secondLine","baseLine","parallelLine"]);function WT(A){const e={};for(const[t,i]of Object.entries(A))VT.has(t)||(e[t]=i);return e}function GT(A,e,t){if(!e)return;const i=`chart_drawings_${e}_${t||"default"}`;try{const r=A.map(WT);localStorage.setItem(i,JSON.stringify(r))}catch{}}function RT(A,e){if(!A)return[];const t=`chart_drawings_${A}_${e||"default"}`;try{const i=localStorage.getItem(t);if(!i)return[];const r=JSON.parse(i);return Array.isArray(r)?r:[]}catch{return[]}}function $T(A,e){if(!A)return;const t=`chart_drawings_${A}_${e||"default"}`;try{localStorage.removeItem(t)}catch{}}class gd{constructor(e,t,i="#3b82f6",r=2){this.price=e,this.originTime=t,this.color=i,this.lineWidth=r,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,c=n._chart,h=n._series;if(!c||!h)return;const m=h.priceToCoordinate(n.price);if(m==null)return;const v=Math.round(m*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),F=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),T=o.bitmapSize.width;if(F>=T)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(F,v),l.lineTo(T,v),l.stroke(),l.beginPath(),l.fillStyle=n.color;const S=3*o.verticalPixelRatio;l.arc(F,v,S,0,Math.PI*2),l.fill(),l.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class md{constructor(e,t={}){this.price=e,this.text=t.text??"",this.textColor=t.textColor??"#ffffff",this.fontSize=t.fontSize??12,this.hAlign=t.hAlign??"center",this.vAlign=t.vAlign??"top",this.originTime=t.originTime??null,this.visible=!0,this._series=null,this._chart=null;const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(({context:n,bitmapSize:s,horizontalPixelRatio:o,verticalPixelRatio:l})=>{if(!i.visible||!i.text||!i._series)return;const c=i._series.priceToCoordinate(i.price);if(c==null)return;const h=Math.round(i.fontSize*l);n.font=`${h}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),v=Math.round(14*l),x=s.width;let F;if(i.hAlign==="left")if(i.originTime!=null&&i._chart){const I=i._chart.timeScale().timeToCoordinate(i.originTime);F=I!=null?Math.round(I*o):m,n.textAlign="right"}else F=m,n.textAlign="left";else i.hAlign==="right"?(F=x-m,n.textAlign="right"):(F=x/2,n.textAlign="center");const T=Math.round(c*l);let S;i.vAlign==="top"?S=T-v:i.vAlign==="bottom"?S=T+v:S=T,n.fillStyle=i.textColor,n.fillText(i.text,F,S)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wd{constructor(e,t,i,r="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=i,this.color=r,this.lineWidth=n,this.statsShowAlways=!0,this.statsColor="#5f8f96",this.statsPosition="right",this.statsPriceRange=!0,this.statsBarsRange=!0,this.statsDateRange=!0,this.statsAngle=!0,this.statsDistance=!0,this.isActive=!1,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 c=s._chart,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=l.context;if(H.save(),H.beginPath(),H.strokeStyle=s.color,H.lineWidth=s.lineWidth*v,H.setLineDash([]),H.moveTo(I,Q),H.lineTo(N,J),H.stroke(),H.beginPath(),H.fillStyle=s.color,H.arc(I,Q,3*v,0,Math.PI*2),H.fill(),H.beginPath(),H.arc(N,J,3*v,0,Math.PI*2),H.fill(),!s.statsShowAlways&&!s.isActive){H.restore();return}const{priceDiff:z,pricePct:re,bars:q,days:ie,angle:G}=s.info,ne=z>=0?"+":"",le=[];if(s.statsPriceRange!==!1&&le.push(`${ne}${z.toFixed(5)} (${ne}${re.toFixed(2)}%)`),s.statsBarsRange!==!1&&le.push(`${q} bars`),s.statsDateRange!==!1&&le.push(`${ie} days`),s.statsAngle!==!1&&le.push(`∠ ${G.toFixed(1)}°`),s.statsDistance&&le.push(`Δ ${Math.abs(z).toFixed(5)}`),le.length===0){H.restore();return}const ee=Math.round(11*v);H.font=`${ee}px sans-serif`;const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Ye=>H.measureText(Ye).width))+j*2,ae=le.length*we+j*2,pe=s.statsPosition??"right";let ue,oe;pe==="left"?(ue=I,oe=Q):pe==="center"?(ue=Math.round((I+N)/2),oe=Math.round((Q+J)/2)):(ue=N,oe=J);let fe,Qe;pe==="left"?(fe=ue-ge-10*m,Qe=oe-ae-4*v):pe==="center"?(fe=ue-ge/2,Qe=oe-ae-8*v):(fe=ue+10*m,Qe=oe-ae-4*v);const me=l.bitmapSize.width,xe=l.bitmapSize.height,Se=Math.min(Math.max(0,fe),me-ge-4*m),Me=Math.min(Math.max(4*v,Qe),xe-ae-4*v),$e=4*v;H.beginPath(),H.moveTo(Se+$e,Me),H.lineTo(Se+ge-$e,Me),H.quadraticCurveTo(Se+ge,Me,Se+ge,Me+$e),H.lineTo(Se+ge,Me+ae-$e),H.quadraticCurveTo(Se+ge,Me+ae,Se+ge-$e,Me+ae),H.lineTo(Se+$e,Me+ae),H.quadraticCurveTo(Se,Me+ae,Se,Me+ae-$e),H.lineTo(Se,Me+$e),H.quadraticCurveTo(Se,Me,Se+$e,Me),H.closePath(),H.fillStyle="rgba(30, 41, 59, 0.92)",H.fill(),H.strokeStyle=s.statsColor||s.color,H.lineWidth=1*v,H.stroke(),H.fillStyle="#e2e8f0",H.textAlign="left",le.forEach((Ye,Ie)=>{H.fillText(Ye,Se+j,Me+j+ee+Ie*we)}),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cl{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.info=i,this.visible=!0,this._chart=null,this._series=null,this.lineColor=r.lineColor??null,this.showArea=r.showArea!==!1,this.statsShowAlways=r.statsShowAlways!==!1,this.isActive=!1,this.statsColor=r.statsColor??"#5f8f96",this.statsPosition=r.statsPosition??"right",this.statsPriceRange=r.statsPriceRange!==!1,this.statsBarsRange=r.statsBarsRange!==!1,this.statsDateRange=r.statsDateRange!==!1;const n=t.price>=e.price;this.color=n?"#3b82f6":"#ef5350",this.fillColor=n?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(l=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const m=l.horizontalPixelRatio,v=l.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),F=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),T=h.priceToCoordinate(s.p1.price),S=h.priceToCoordinate(s.p2.price);if(x==null||F==null||T==null||S==null)return;const I=Math.round(x*m),Q=Math.round(T*v),N=Math.round(F*m),J=Math.round(S*v),H=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q)),z.strokeStyle=H,z.lineWidth=1*v,z.setLineDash([]),z.strokeRect(Math.min(I,N),Math.min(Q,J),Math.abs(N-I),Math.abs(J-Q))),z.beginPath(),z.strokeStyle=H,z.lineWidth=2*v,z.moveTo(I,Q),z.lineTo(N,J),z.stroke(),z.fillStyle=H,z.beginPath(),z.arc(I,Q,3*v,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,J,3*v,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:re,pricePct:q,bars:ie,days:G}=s.info,ne=re>=0?"+":"",le=[];if(s.statsPriceRange&&le.push(ne+re.toFixed(5)+" ("+ne+q.toFixed(2)+"%)"),s.statsBarsRange&&le.push(ie+" bars"),s.statsDateRange&&le.push(G+" days"),le.length===0){z.restore();return}const ee=Math.round(11*v);z.font=ee+"px sans-serif";const we=ee*1.6,j=8*v,ge=Math.max(...le.map(Se=>z.measureText(Se).width))+j*2,ae=le.length*we+j*2,pe=l.bitmapSize.width,ue=l.bitmapSize.height;let oe,fe;if(s.statsPosition==="left")oe=I-ge-10*m,fe=Q-ae-4*v;else if(s.statsPosition==="center"){const Se=(I+N)/2,Me=(Q+J)/2;oe=Se-ge/2,fe=Me-ae-4*v}else oe=N+10*m,fe=J-ae-4*v;const Qe=Math.min(Math.max(0,oe),pe-ge-4*m),me=Math.min(Math.max(4*v,fe),ue-ae-4*v),xe=4*v;z.beginPath(),z.moveTo(Qe+xe,me),z.lineTo(Qe+ge-xe,me),z.quadraticCurveTo(Qe+ge,me,Qe+ge,me+xe),z.lineTo(Qe+ge,me+ae-xe),z.quadraticCurveTo(Qe+ge,me+ae,Qe+ge-xe,me+ae),z.lineTo(Qe+xe,me+ae),z.quadraticCurveTo(Qe,me+ae,Qe,me+ae-xe),z.lineTo(Qe,me+xe),z.quadraticCurveTo(Qe,me,Qe+xe,me),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||H,z.lineWidth=1*v,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",le.forEach((Se,Me)=>{z.fillText(Se,Qe+j,me+j+ee+Me*we)}),z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Bd{constructor(e,t,i={}){this.p1=e,this.p2=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 r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.min(m,v)*c,S=Math.max(m,v)*c,I=Math.min(x,F)*h,Q=Math.max(x,F)*h,N=S-T,J=Q-I;if(N<.5||J<.5)return;const H=s.context;H.save(),H.fillStyle=r.fillColor,H.fillRect(T,I,N,J),H.strokeStyle=r.strokeColor,H.lineWidth=r.lineWidth*h,H.setLineDash([]),H.strokeRect(T,I,N,J),H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class yd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=Math.hypot(I-T,Q-S);if(N<.5)return;const J=s.context;J.save(),J.strokeStyle=r.strokeColor,J.lineWidth=r.lineWidth*h,J.setLineDash([]),J.beginPath(),J.arc(T,S,N,0,Math.PI*2),J.stroke(),J.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Cd{constructor(e,t,i,r={}){this.p1=e,this.p2=t,this.p3=i,this.visible=!0,this.strokeColor=r.strokeColor??"#7aa6ae",this.fillColor=r.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=r.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,c=n._series;if(!l||!c)return;const h=o.horizontalPixelRatio,m=o.verticalPixelRatio,v=l.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),F=l.timeScale().timeToCoordinate(n.p2.rawTime),T=c.priceToCoordinate(n.p2.price),S=l.timeScale().timeToCoordinate(n.p3.rawTime),I=c.priceToCoordinate(n.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*h,N=x*m,J=F*h,H=T*m,z=S*h,re=I*m,q=o.context;q.save(),q.beginPath(),q.moveTo(Q,N),q.lineTo(J,H),q.lineTo(z,re),q.closePath(),q.fillStyle=n.fillColor,q.fill(),q.strokeStyle=n.strokeColor,q.lineWidth=n.lineWidth*m,q.setLineDash([]),q.stroke(),q.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.minorRatio=i.minorRatio??.45,this.previewAsLine=i.previewAsLine??!1,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),x=o.timeScale().timeToCoordinate(r.p2.rawTime),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=v*h,I=x*c,Q=F*h,N=I-T,J=Q-S,H=Math.hypot(N,J);if(H<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*h,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(T,S),z.lineTo(I,Q),z.stroke();else{const re=(T+I)/2,q=(S+Q)/2,ie=Math.atan2(J,N),G=H/2,ne=Math.max(1,G*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(re,q,G,ne,ie,0,Math.PI*2),z.stroke()}z.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hl{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#f59e0b",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight!==!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Td{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft!==!1,this.rayRight=i.rayRight!==!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsBarsRange=i.statsBarsRange??!1,this.statsDateRange=i.statsDateRange??!1,this.statsAngle=i.statsAngle??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=Math.round(m*c),S=Math.round(x*h),I=Math.round(v*c),Q=Math.round(F*h),N=I-T,J=Q-S,H=s.context;H.save(),H.strokeStyle=r.color,H.fillStyle=r.color,H.lineWidth=r.lineWidth*h,H.setLineDash([]);const z=Math.abs(N)<1e-4?0:J/N;if(r.rayLeft){const le=S+z*(0-T);H.beginPath(),H.moveTo(0,le),H.lineTo(T,S),H.stroke()}if(r.rayRight){const ne=s.bitmapSize.width,le=Q+z*(ne-I);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.stroke()}H.beginPath(),H.moveTo(T,S),H.lineTo(I,Q),H.stroke();const re=Math.atan2(Q-S,I-T),q=(r.lineWidth*4+4)*h,ie=Math.PI/7;if(r.arrowRight){const ne=I-q*Math.cos(re-ie),le=Q-q*Math.sin(re-ie),ee=I-q*Math.cos(re+ie),we=Q-q*Math.sin(re+ie);H.beginPath(),H.moveTo(I,Q),H.lineTo(ne,le),H.lineTo(ee,we),H.closePath(),H.fill()}if(r.arrowLeft){const ne=re+Math.PI,le=T-q*Math.cos(ne-ie),ee=S-q*Math.sin(ne-ie),we=T-q*Math.cos(ne+ie),j=S-q*Math.sin(ne+ie);H.beginPath(),H.moveTo(T,S),H.lineTo(le,ee),H.lineTo(we,j),H.closePath(),H.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const ne=r.p1.rawTime,le=r.p2.rawTime,ee=r.p1.price,we=r.p2.price,j=[];if(r.statsPriceRange){const ae=Math.abs(we-ee),pe=ee!==0?Math.abs((we-ee)/ee*100):0,ue=ae<1e-4?6:ae<.01?5:ae<1?4:2;j.push("↕ "+ae.toFixed(ue)+" ("+pe.toFixed(2)+"%)")}const ge=[];if(r.statsBarsRange)try{const ae=o.timeScale().timeToCoordinate(ne),pe=o.timeScale().timeToCoordinate(le);if(ae!=null&&pe!=null){const ue=o.timeScale().coordinateToLogical(ae),oe=o.timeScale().coordinateToLogical(pe);ue!=null&&oe!=null&&ge.push("↔ "+Math.abs(Math.round(oe-ue))+" bars")}}catch{}if(r.statsDateRange){const ae=Math.abs(le-ne),pe=Math.floor(ae/86400),ue=Math.floor(ae%86400/3600),oe=Math.floor(ae%3600/60);let fe=pe>0?pe+" day"+(pe!==1?"s":""):"";ue>0&&(fe+=(fe?" ":"")+ue+" hour"+(ue!==1?"s":"")),!pe&&!ue&&(fe=oe+" min"+(oe!==1?"s":"")),r.statsBarsRange&&ge.length>0?ge[ge.length-1]+=" ("+fe+")":ge.push(fe)}if(r.statsDistance){const ae=N/c,pe=J/h;ge.push("distance: "+Math.sqrt(ae*ae+pe*pe).toFixed(2))}if(ge.length>0&&j.push(ge.join(", ")),r.statsAngle){const ae=N/c,pe=J/h,ue=Math.atan2(pe,ae)*180/Math.PI;j.push("∠ "+ue.toFixed(0)+"°")}if(j.length>0){const ae=Math.min(c,h),pe=11*ae,ue=pe*1.5,oe=5*ae;H.font=pe+"px sans-serif";const Qe=j.reduce((Ze,nt)=>Math.max(Ze,H.measureText(nt).width),0)+oe*2,me=j.length*ue+oe*2,[xe,Se,Me,$e]=T<=I?[T,S,I,Q]:[I,Q,T,S];let Ye,Ie;r.statsPosition==="left"?(Ye=xe,Ie=Se):r.statsPosition==="center"?(Ye=(xe+Me)/2,Ie=(Se+$e)/2):(Ye=Me,Ie=$e);const We=Ye-Qe/2,De=Ie-me-12*ae;H.fillStyle="rgba(20, 20, 30, 0.72)",H.fillRect(We,De,Qe,me),H.strokeStyle=r.statsColor,H.lineWidth=1*ae,H.strokeRect(We,De,Qe,me),H.fillStyle=r.statsColor,H.textBaseline="top",H.textAlign="left",j.forEach((Ze,nt)=>{H.fillText(Ze,We+oe,De+oe+nt*ue)})}}H.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xd{constructor(e,t,i="#22c55e",r=2){this.p1=e,this.p2=t,this.color=i,this.lineWidth=r,this.arrowLeft=!1,this.arrowRight=!1,this.rayLeft=!1,this.rayRight=!1,this.statsPriceRange=!1,this.statsBarsRange=!1,this.statsDateRange=!1,this.statsDistance=!1,this.statsAngle=!1,this.statsPosition="right",this.statsColor="#5f8f96",this.statsShowAlways=!1,this.isSelected=!1,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.arrowLeft||n.arrowRight||n.rayLeft||n.rayRight,c=(n.statsShowAlways||n.isSelected)&&(n.statsPriceRange||n.statsBarsRange||n.statsDateRange||n.statsDistance||n.statsAngle);if(!l&&!c)return;const h=n._chart,m=n._series;if(!h||!m)return;const v=o.horizontalPixelRatio,x=o.verticalPixelRatio,F=h.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),T=h.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),S=m.priceToCoordinate(n.p1.price),I=m.priceToCoordinate(n.p2.price);if(F==null||T==null||S==null||I==null)return;const Q=F*v,N=S*x,J=T*v,H=I*x,[z,re,q,ie]=Q<=J?[Q,N,J,H]:[J,H,Q,N];let G=q-z,ne=ie-re;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=o.context;if(ee.save(),ee.strokeStyle=n.color,ee.fillStyle=n.color,ee.lineWidth=n.lineWidth*x,ee.setLineDash([]),n.rayLeft){const pe=re+le*(0-z);ee.beginPath(),ee.moveTo(0,pe),ee.lineTo(z,re),ee.stroke()}if(n.rayRight){const ae=o.bitmapSize.width,pe=ie+le*(ae-q);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.stroke()}const we=Math.atan2(ne,G),j=(n.lineWidth*4+4)*x,ge=Math.PI/7;if(n.arrowRight){const ae=q-j*Math.cos(we-ge),pe=ie-j*Math.sin(we-ge),ue=q-j*Math.cos(we+ge),oe=ie-j*Math.sin(we+ge);ee.beginPath(),ee.moveTo(q,ie),ee.lineTo(ae,pe),ee.lineTo(ue,oe),ee.closePath(),ee.fill()}if(n.arrowLeft){const ae=we+Math.PI,pe=z-j*Math.cos(ae-ge),ue=re-j*Math.sin(ae-ge),oe=z-j*Math.cos(ae+ge),fe=re-j*Math.sin(ae+ge);ee.beginPath(),ee.moveTo(z,re),ee.lineTo(pe,ue),ee.lineTo(oe,fe),ee.closePath(),ee.fill()}if(c){const ae=n.p1.rawTime??n.p1.time,pe=n.p2.rawTime??n.p2.time,ue=n.p1.price,oe=n.p2.price,fe=[];if(n.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(n.statsBarsRange)try{const me=h.timeScale().timeToCoordinate(ae),xe=h.timeScale().timeToCoordinate(pe);if(me!=null&&xe!=null){const Se=h.timeScale().coordinateToLogical(me),Me=h.timeScale().coordinateToLogical(xe);Se!=null&&Me!=null&&Qe.push("↔ "+Math.abs(Math.round(Me-Se))+" bars")}}catch{}if(n.statsDateRange){const me=Math.abs(pe-ae),xe=Math.floor(me/86400),Se=Math.floor(me%86400/3600),Me=Math.floor(me%3600/60);let $e=xe>0?xe+" day"+(xe!==1?"s":""):"";Se>0&&($e+=($e?" ":"")+Se+" hour"+(Se!==1?"s":"")),!xe&&!Se&&($e=Me+" min"+(Me!==1?"s":"")),n.statsBarsRange&&Qe.length>0?Qe[Qe.length-1]+=" ("+$e+")":Qe.push($e)}if(n.statsDistance){const me=(J-Q)/v,xe=(H-N)/x;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),n.statsAngle){const me=G/v,xe=ne/x,Se=Math.atan2(xe,me)*180/Math.PI;fe.push("∠ "+Se.toFixed(0)+"°")}if(fe.length>0){const me=Math.min(v,x),xe=11*me,Se=xe*1.5,Me=5*me;ee.font=xe+"px sans-serif";const Ye=fe.reduce((dt,He)=>Math.max(dt,ee.measureText(He).width),0)+Me*2,Ie=fe.length*Se+Me*2;let We,De;n.statsPosition==="left"?(We=z,De=re):n.statsPosition==="center"?(We=(z+q)/2,De=(re+ie)/2):(We=q,De=ie);const Ze=We-Ye/2,nt=De-Ie-12*me;ee.fillStyle="rgba(20, 20, 30, 0.72)",ee.fillRect(Ze,nt,Ye,Ie),ee.strokeStyle=n.statsColor,ee.lineWidth=1*me,ee.strokeRect(Ze,nt,Ye,Ie),ee.fillStyle=n.statsColor,ee.textBaseline="top",ee.textAlign="left",fe.forEach((dt,He)=>{ee.fillText(dt,Ze+Me,nt+Me+He*Se)})}}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Qd{constructor(e,t={}){this.center=e,this.color=t.color??"#06a0e3",this.lineWidth=t.lineWidth??2,this.showTime=t.showTime??!1,this.showPrice=t.showPrice??!1,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=s.timeScale().timeToCoordinate(i.center.rawTime),m=o.priceToCoordinate(i.center.price);if(h==null||m==null)return;const v=Math.round(h*l),x=Math.round(m*c),F=n.bitmapSize.width,T=n.bitmapSize.height,S=n.context;if(S.save(),S.strokeStyle=i.color,S.lineWidth=i.lineWidth*c,S.setLineDash([]),S.beginPath(),S.moveTo(0,x),S.lineTo(F,x),S.stroke(),S.beginPath(),S.moveTo(v,0),S.lineTo(v,T),S.stroke(),i.showPrice){const I=i.center.price.toFixed(5),Q=Math.round(11*c);S.font=Q+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="left";const N=S.measureText(I).width,J=Math.round(6*l),H=Math.round(3*c),z=Q+2*H,re=N+2*J,q=F-re-Math.round(2*l),ie=x-z/2;S.fillStyle=i.color,S.fillRect(q,ie,re,z),S.fillStyle="#ffffff",S.fillText(I,q+J,x)}if(i.showTime){const I=i.center.rawTime,Q=new Date(I*1e3),N=ee=>String(ee).padStart(2,"0"),J=N(Q.getUTCDate())+"."+N(Q.getUTCMonth()+1)+"."+Q.getUTCFullYear()+" "+N(Q.getUTCHours())+":"+N(Q.getUTCMinutes())+":"+N(Q.getUTCSeconds()),H=Math.round(11*c);S.font=H+"px ui-sans-serif, system-ui, sans-serif",S.textBaseline="middle",S.textAlign="center";const z=S.measureText(J).width,re=Math.round(6*l),q=Math.round(3*c),ie=H+2*q,G=z+2*re,ne=v-G/2,le=T-ie-Math.round(4*c);S.fillStyle=i.color,S.fillRect(ne,le,G,ie),S.fillStyle="#ffffff",S.fillText(J,v,le+ie/2)}S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Fd{constructor(e,t,i={}){this.p1=e,this.p2=t,this.color=i.color??"#7aa6ae",this.lineWidth=i.lineWidth??2,this.arrowLeft=i.arrowLeft??!1,this.arrowRight=i.arrowRight??!1,this.rayLeft=i.rayLeft??!1,this.rayRight=i.rayRight??!1,this.statsShowAlways=i.statsShowAlways??!1,this.statsColor=i.statsColor??"#5f8f96",this.statsPosition=i.statsPosition??"right",this.statsPriceRange=i.statsPriceRange??!1,this.statsDistance=i.statsDistance??!1,this.isActive=!1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),v=o.timeScale().timeToCoordinate(r.p2.rawTime),x=l.priceToCoordinate(r.p1.price),F=l.priceToCoordinate(r.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*c,S=x*h,I=v*c,Q=F*h,N=T-I,J=S-Q,H=I-T,z=Q-S;if(Math.hypot(N,J)<1e-4)return;const q=Math.atan2(J,N),ie=Math.round(Math.abs(q*180/Math.PI)),G=s.context;G.save(),G.strokeStyle=r.color,G.fillStyle=r.color,G.lineWidth=r.lineWidth*h,G.setLineDash([]);const ne=Math.abs(H)<1e-4?0:z/H;if(r.rayLeft){const oe=S+ne*(0-T);G.beginPath(),G.moveTo(0,oe),G.lineTo(T,S),G.stroke()}if(r.rayRight){const ue=s.bitmapSize.width,oe=Q+ne*(ue-I);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.stroke()}G.beginPath(),G.moveTo(T,S),G.lineTo(I,Q),G.stroke();const le=Math.atan2(z,H),ee=(r.lineWidth*4+4)*h,we=Math.PI/7;if(r.arrowRight){const ue=I-ee*Math.cos(le-we),oe=Q-ee*Math.sin(le-we),fe=I-ee*Math.cos(le+we),Qe=Q-ee*Math.sin(le+we);G.beginPath(),G.moveTo(I,Q),G.lineTo(ue,oe),G.lineTo(fe,Qe),G.closePath(),G.fill()}if(r.arrowLeft){const ue=le+Math.PI,oe=T-ee*Math.cos(ue-we),fe=S-ee*Math.sin(ue-we),Qe=T-ee*Math.cos(ue+we),me=S-ee*Math.sin(ue+we);G.beginPath(),G.moveTo(T,S),G.lineTo(oe,fe),G.lineTo(Qe,me),G.closePath(),G.fill()}const j=28*h;G.strokeStyle="rgba(122,166,174,0.55)",G.fillStyle=r.color,G.lineWidth=1*h,G.beginPath(),G.moveTo(I,Q),G.lineTo(I+j,Q),G.stroke(),G.beginPath(),G.strokeStyle="rgba(122,166,174,0.45)",G.arc(I,Q,j,0,q,q<0),G.stroke(),G.fillStyle="#4b7c86",G.font=`${Math.round(10*h)}px sans-serif`,G.textAlign="left",G.textBaseline="middle";const ge=I+(j+10*h)*Math.cos(q/2),ae=Q+(j+10*h)*Math.sin(q/2);if(G.fillText(`${ie}°`,ge,ae),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const ue=r.p1.price,oe=r.p2.price,fe=[];if(r.statsPriceRange){const me=Math.abs(oe-ue),xe=ue!==0?Math.abs((oe-ue)/ue*100):0,Se=me<1e-4?6:me<.01?5:me<1?4:2;fe.push("↕ "+me.toFixed(Se)+" ("+xe.toFixed(2)+"%)")}const Qe=[];if(r.statsDistance){const me=H/c,xe=z/h;Qe.push("distance: "+Math.sqrt(me*me+xe*xe).toFixed(2))}if(Qe.length>0&&fe.push(Qe.join(", ")),fe.length>0){const me=Math.min(c,h),xe=11*me,Se=xe*1.5,Me=5*me;G.font=xe+"px sans-serif";const Ye=fe.reduce((Te,ve)=>Math.max(Te,G.measureText(ve).width),0)+Me*2,Ie=fe.length*Se+Me*2,[We,De,Ze,nt]=T<=I?[T,S,I,Q]:[I,Q,T,S];let dt,He;r.statsPosition==="left"?(dt=We,He=De):r.statsPosition==="center"?(dt=(We+Ze)/2,He=(De+nt)/2):(dt=Ze,He=nt);const zt=dt-Ye/2,ye=He-Ie-12*me;G.fillStyle="rgba(20, 20, 30, 0.72)",G.fillRect(zt,ye,Ye,Ie),G.strokeStyle=r.statsColor,G.lineWidth=1*me,G.strokeRect(zt,ye,Ye,Ie),G.fillStyle=r.statsColor,G.textBaseline="top",G.textAlign="left",fe.forEach((Te,ve)=>{G.fillText(Te,zt+Me,ye+Me+ve*Se)})}}G.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ud{constructor(e,t,i){this.p1=e,this.p2=t,this.p3=i,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 r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price),S=o.timeScale().timeToCoordinate(r.p3.rawTime),I=l.priceToCoordinate(r.p3.price);if(v==null||x==null||F==null||T==null||S==null||I==null)return;const Q=v*c,N=x*h,J=F*c,H=T*h,z=S*c,re=I*h,q=(J+z)/2,ie=(H+re)/2;let G=q-Q,ne=ie-N;Math.abs(G)<1e-4&&(G=1e-4);const le=ne/G,ee=s.bitmapSize.width,we=(J-z)/2,j=(H-re)/2,ge=me=>({x:q+we*me,y:ie+j*me}),ae=(me,xe)=>({x:ee,y:xe+le*(ee-me)}),pe=ge(1),ue=ge(-1),oe=ae(pe.x,pe.y),fe=ae(ue.x,ue.y);m.save(),m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(ue.x,ue.y),m.closePath(),m.fillStyle="rgba(148, 163, 184, 0.2)",m.fill(),m.beginPath(),m.strokeStyle="rgba(148, 163, 184, 0.9)",m.lineWidth=1*h,m.moveTo(J,H),m.lineTo(z,re),m.stroke(),r._levels.forEach(me=>{const xe=ge(me.k),Se=ae(xe.x,xe.y);m.beginPath(),m.strokeStyle=me.color,m.lineWidth=me.width*h,m.moveTo(xe.x,xe.y),m.lineTo(Se.x,Se.y),m.stroke()});const Qe=ae(Q,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*h,m.moveTo(Q,N),m.lineTo(Qe.x,Qe.y),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Sd{constructor(e,t){this.p1=e,this.p2=t,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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=s.timeScale().timeToCoordinate(i.p1.rawTime),v=o.priceToCoordinate(i.p1.price),x=s.timeScale().timeToCoordinate(i.p2.rawTime),F=o.priceToCoordinate(i.p2.price);if(m==null||v==null||x==null||F==null)return;const T=m*l,S=v*c,I=x*l,Q=F*c,N=n.bitmapSize.width,J=Math.abs(I-T)<1e-4?1:I-T,H=(Q-S)/J,z=I>=T?1:-1,re=z>0?N:0,q=T+z*Math.min(220*l,Math.max(80*l,N*.35)),ie=i._rays.map(ne=>{const le=H*ne.ratio;return{...ne,yEnd:S+le*(re-T),yLabel:S+le*(q-T)}});h.save();const G=(ne,le,ee)=>{!ne||!le||(h.beginPath(),h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.lineTo(re,le.yEnd),h.closePath(),h.fillStyle=ee,h.fill())};G(ie[0],ie[3],"rgba(161, 98, 7, 0.10)"),G(ie[3],ie[4],"rgba(5, 150, 105, 0.10)"),G(ie[4],ie[5],"rgba(107, 114, 128, 0.12)"),ie.forEach(ne=>{h.beginPath(),h.strokeStyle=ne.color,h.lineWidth=1*c,h.moveTo(T,S),h.lineTo(re,ne.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=z>0?"left":"right",h.textBaseline="middle",ie.forEach(ne=>{h.fillStyle=ne.color;const le=q+(z>0?4*l:-4*l),ee=ne.yLabel;ee<-20||ee>n.bitmapSize.height+20||h.fillText(ne.label,le,ee)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ed{constructor(e,t,i=8){this.p1=e,this.p2=t,this.divisions=Math.max(2,i),this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,m=s.context,v=o.timeScale().timeToCoordinate(r.p1.rawTime),x=l.priceToCoordinate(r.p1.price),F=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(v==null||x==null||F==null||T==null)return;const S=v*c,I=x*h,Q=F*c,N=T*h,J=Q-S,H=N-I,z=Math.hypot(J,H);if(z<1e-4)return;const re=J/z,q=H/z,ie=-q,G=re,ne=Q+ie*z,le=N+G*z,ee=S+ie*z,we=I+G*z,j=(ae,pe)=>({x:S+re*z*ae+ie*z*pe,y:I+q*z*ae+G*z*pe});m.save();const ge=["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 ae=0;ae<r.divisions;ae++){const pe=ae/r.divisions,ue=(ae+1)/r.divisions,oe=j(0,pe),fe=j(1,pe),Qe=j(1,ue),me=j(0,ue);m.beginPath(),m.moveTo(oe.x,oe.y),m.lineTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.lineTo(me.x,me.y),m.closePath(),m.fillStyle=ge[ae%ge.length],m.fill()}m.lineWidth=1*h,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let ae=0;ae<=r.divisions;ae++){const pe=ae/r.divisions,ue=j(0,pe),oe=j(1,pe),fe=j(pe,0),Qe=j(pe,1);m.beginPath(),m.moveTo(ue.x,ue.y),m.lineTo(oe.x,oe.y),m.stroke(),m.beginPath(),m.moveTo(fe.x,fe.y),m.lineTo(Qe.x,Qe.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*h,m.beginPath(),m.moveTo(S,I),m.lineTo(ne,le),m.stroke(),m.beginPath(),m.moveTo(Q,N),m.lineTo(ee,we),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*h,m.beginPath(),m.moveTo(S,I),m.lineTo(Q,N),m.lineTo(ne,le),m.lineTo(ee,we),m.closePath(),m.stroke(),m.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ns{constructor(e,t,i,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:h=!0,showPrices:m=!0,pricesColor:v="#129f5c",rayLeft:x=!1,rayRight:F=!1,arrowLeft:T=!1,arrowRight:S=!1}=n;this.p1=e,this.p2=t,this.p3=i,this.p4=r,this.lineColor=s,this.lineWidth=o,this.fillColor=l,this.fillOpacity=c,this.showBackground=h,this.showPrices=m,this.pricesColor=v,this.rayLeft=x,this.rayRight=F,this.arrowLeft=T,this.arrowRight=S,this.visible=!0,this._chart=null,this._series=null;const I=this;this._paneView={renderer(){return{draw(Q){Q.useBitmapCoordinateSpace(N=>{if(!I.visible)return;const J=I._chart,H=I._series;if(!J||!H)return;const z=N.horizontalPixelRatio,re=N.verticalPixelRatio,q=[I.p1,I.p3,I.p4,I.p2].map(Ie=>{const We=J.timeScale().timeToCoordinate(Ie.rawTime),De=H.priceToCoordinate(Ie.price);return We==null||De==null?null:{x:We*z,y:De*re}}).filter(Boolean);if(q.length!==4)return;const[ie,G,ne,le]=q,ee=N.context;ee.save();const we=G.x-ie.x,j=G.y-ie.y,ge=Math.sqrt(we*we+j*j)||1,ae=we/ge,pe=j/ge,ue=ne.x-le.x,oe=ne.y-le.y,fe=Math.sqrt(ue*ue+oe*oe)||1,Qe=ue/fe,me=oe/fe,xe=1e5,Se=I.rayLeft?{x:ie.x-ae*xe,y:ie.y-pe*xe}:ie,Me=I.rayRight?{x:G.x+ae*xe,y:G.y+pe*xe}:G,$e=I.rayLeft?{x:le.x-Qe*xe,y:le.y-me*xe}:le,Ye=I.rayRight?{x:ne.x+Qe*xe,y:ne.y+me*xe}:ne;if(I.showBackground){const Ie=I.fillColor||"#6aa84f",We=parseInt(Ie.slice(1,3),16),De=parseInt(Ie.slice(3,5),16),Ze=parseInt(Ie.slice(5,7),16);ee.beginPath(),ee.moveTo(ie.x,ie.y),ee.lineTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.lineTo(le.x,le.y),ee.closePath(),ee.fillStyle=`rgba(${We},${De},${Ze},${I.fillOpacity??.1})`,ee.fill()}if(ee.strokeStyle=I.lineColor,ee.lineWidth=I.lineWidth*re,ee.setLineDash([]),ee.beginPath(),ee.moveTo(Se.x,Se.y),ee.lineTo(Me.x,Me.y),ee.moveTo($e.x,$e.y),ee.lineTo(Ye.x,Ye.y),ee.moveTo(ie.x,ie.y),ee.lineTo(le.x,le.y),ee.moveTo(G.x,G.y),ee.lineTo(ne.x,ne.y),ee.stroke(),I.arrowLeft||I.arrowRight){const Ie=8*re,We=(De,Ze,nt)=>{ee.save(),ee.translate(De,Ze),ee.rotate(nt),ee.beginPath(),ee.moveTo(0,0),ee.lineTo(-Ie,-Ie/2),ee.lineTo(-Ie,Ie/2),ee.closePath(),ee.fillStyle=I.lineColor,ee.fill(),ee.restore()};I.arrowLeft&&(We(Se.x,Se.y,Math.atan2(-pe,-ae)),We($e.x,$e.y,Math.atan2(-me,-Qe))),I.arrowRight&&(We(Me.x,Me.y,Math.atan2(pe,ae)),We(Ye.x,Ye.y,Math.atan2(me,Qe)))}if(ee.fillStyle="#ffffff",ee.strokeStyle="#3b82f6",ee.lineWidth=2*re,[ie,G,ne,le].forEach(Ie=>{ee.beginPath(),ee.arc(Ie.x,Ie.y,6*re,0,Math.PI*2),ee.fill(),ee.stroke()}),I.showPrices){const Ie=[I.p1,I.p3,I.p2,I.p4],We=[ie,G,le,ne];ee.fillStyle=I.pricesColor||I.lineColor,ee.font=`${Math.round(10*re)}px sans-serif`,ee.textAlign="left",ee.textBaseline="middle",We.forEach((De,Ze)=>{const nt=Ie[Ze]?.price;typeof nt=="number"&&ee.fillText(nt.toFixed(5),De.x+8*z,De.y)})}ee.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ul extends Ns{constructor(e,t,i,r,n={}){super(e,t,i,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class pl{constructor(e,t,i,r,n,s={}){this.p1=e,this.p2=t,this.b1=i,this.b2=r,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(c=>{if(!o.visible)return;const h=o._chart,m=o._series;if(!h||!m)return;const v=c.horizontalPixelRatio,x=c.verticalPixelRatio,F=c.context,T=J=>{const H=h.timeScale().timeToCoordinate(J.rawTime),z=m.priceToCoordinate(J.price);return H==null||z==null?null:{x:H*v,y:z*x}},S=T(o.p1),I=T(o.p2),Q=T(o.b2),N=T(o.b1);!S||!I||!Q||!N||(F.save(),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.lineTo(Q.x,Q.y),F.lineTo(N.x,N.y),F.closePath(),F.fillStyle=o.fillColor,F.fill(),F.strokeStyle=o.strokeColor,F.lineWidth=o.lineWidth*x,F.setLineDash([]),F.beginPath(),F.moveTo(S.x,S.y),F.lineTo(I.x,I.y),F.stroke(),F.beginPath(),F.moveTo(N.x,N.y),F.lineTo(Q.x,Q.y),F.stroke(),F.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ks{constructor(e,t,i,r,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=i,this.top2=r,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(c){c.useBitmapCoordinateSpace(h=>{if(!l.visible)return;const m=l._chart,v=l._series;if(!m||!v)return;const x=h.horizontalPixelRatio,F=h.verticalPixelRatio,T=h.context,S=q=>{const ie=m.timeScale().timeToCoordinate(q.rawTime),G=v.priceToCoordinate(q.price);return ie==null||G==null?null:{x:ie*x,y:G*F}},I=S(l.mid1),Q=S(l.mid2),N=S(l.top1),J=S(l.top2),H=S(l.bot1),z=S(l.bot2);if(!I||!Q||!N||!J||!H||!z)return;T.save(),T.beginPath(),T.moveTo(I.x,I.y),T.lineTo(Q.x,Q.y),T.lineTo(J.x,J.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=l.upperFillColor,T.fill(),T.beginPath(),T.moveTo(H.x,H.y),T.lineTo(z.x,z.y),T.lineTo(Q.x,Q.y),T.lineTo(I.x,I.y),T.closePath(),T.fillStyle=l.lowerFillColor,T.fill();const re=(q,ie,G)=>{T.beginPath(),T.strokeStyle=G,T.lineWidth=l.lineWidth*F,T.setLineDash([]),T.moveTo(q.x,q.y),T.lineTo(ie.x,ie.y),T.stroke()};if(re(N,J,l.upperStrokeColor),re(I,Q,l.centerStrokeColor),re(H,z,l.lowerStrokeColor),l.showDeviationLabel){const q=Math.abs(l.top1.price-l.mid1.price),ie=Number.isFinite(q)?q.toFixed(5):null;if(ie){const G=Math.max(10,Math.round(10*F));T.fillStyle=l.labelColor,T.font=`${G}px sans-serif`,T.textAlign="left",T.textBaseline="top",T.fillText(ie,H.x+2*x,H.y+10*F)}}T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dl extends Ks{}class fl{constructor(e,t){this.p1=e,this.p2=t,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 i=this;this._paneView={renderer(){return{draw(r){r.useBitmapCoordinateSpace(n=>{if(!i.visible)return;const s=i._chart,o=i._series;if(!s||!o)return;const l=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const v=i.p1.price,x=i.p2.price,F=v-x,T=q=>x+F*q,S=s.timeScale().timeToCoordinate(i.p1.rawTime),I=s.timeScale().timeToCoordinate(i.p2.rawTime),Q=o.priceToCoordinate(v),N=o.priceToCoordinate(x),J=S!=null&&I!=null?Math.round(Math.min(S,I)*l):0,H=S!=null&&I!=null?Math.round(Math.max(S,I)*l):m,z=H-J;h.save(),i._zoneFills.forEach(({from:q,to:ie,color:G})=>{const ne=T(q),le=T(ie),ee=o.priceToCoordinate(ne),we=o.priceToCoordinate(le);if(ee==null||we==null)return;const j=Math.round(ee*c),ge=Math.round(we*c);h.fillStyle=G,h.fillRect(J,Math.min(j,ge),z,Math.abs(ge-j))}),i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888";h.beginPath(),h.strokeStyle=ee,h.lineWidth=q===0||q===1?1.5*c:1*c,q!==0&&q!==1&&q<1?h.setLineDash([4*l,4*l]):h.setLineDash([]),h.moveTo(J,le),h.lineTo(H,le),h.stroke(),h.setLineDash([])});const re=Math.round(11*c);if(h.font=`${re}px sans-serif`,h.textAlign="left",i._levels.forEach(({ratio:q,label:ie})=>{const G=T(q),ne=o.priceToCoordinate(G);if(ne==null)return;const le=Math.round(ne*c),ee=i._levelColors[q]||"#888888",we=`${ie} (${G.toFixed(5)})`;h.fillStyle=ee,h.textAlign="right",h.fillText(we,J-4*l,le-4*c)}),S!=null&&I!=null&&Q!=null&&N!=null){const q=Math.round(S*l),ie=Math.round(Q*c),G=Math.round(I*l),ne=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(q,ie),h.lineTo(G,ne),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(q,ie,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(G,ne,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ld{constructor(e,t="#3b82f6",i=2,r=!0){this.time=e,this.color=t,this.lineWidth=i,this.showDate=r,this.showDot=!1,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;if(!l)return;const c=l.timeScale().timeToCoordinate(n.time);if(c==null)return;const h=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,v=o.context;v.save(),v.beginPath(),v.strokeStyle=n.color,v.lineWidth=n.lineWidth*o.horizontalPixelRatio,v.setLineDash([]),v.moveTo(h,0),v.lineTo(h,m),v.stroke();const x=Math.round(m/2);if(n.midYCss=x/o.verticalPixelRatio,n.showDot){v.beginPath(),v.strokeStyle=n.color,v.lineWidth=1.5*o.horizontalPixelRatio;const F=5*o.horizontalPixelRatio;v.arc(h,x,F,0,Math.PI*2),v.stroke()}if(n.showDate!==!1){const F=n.time,T=new Date(typeof F=="number"?F*1e3:F),S=G=>String(G).padStart(2,"0"),I=`${S(T.getUTCDate())}.${S(T.getUTCMonth()+1)}.${T.getUTCFullYear()} ${S(T.getUTCHours())}:${S(T.getUTCMinutes())}:${S(T.getUTCSeconds())}`,Q=Math.round(11*o.verticalPixelRatio);v.font=`${Q}px ui-sans-serif, system-ui, sans-serif`,v.textBaseline="middle",v.textAlign="center";const N=v.measureText(I).width,J=Math.round(6*o.horizontalPixelRatio),H=Math.round(3*o.verticalPixelRatio),z=Q+2*H,re=N+2*J,q=h-re/2,ie=m-z-Math.round(4*o.verticalPixelRatio);v.fillStyle=n.color,v.fillRect(q,ie,re,z),v.fillStyle="#ffffff",v.fillText(I,h,ie+z/2)}v.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Md(A,e){const t=typeof A=="string"?A.trim():"",i=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(i))return`rgba(95, 143, 150, ${e})`;const r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16);return`rgba(${r}, ${n}, ${s}, ${e})`}function XT(A,e,t){const i=`${A??""}`,r=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/r)),o=[],l=c=>{if(!t||c.length<=s){o.push(c);return}let h=c;for(;h.length>s;){let m=h.lastIndexOf(" ",s);m<=0&&(m=s),o.push(h.slice(0,m)),h=h.slice(m).trimStart()}o.push(h)};return i.split(`
|
|
11
|
+
`).forEach(l),o.length===0&&o.push(""),o}function Hd(A,e,t){const i=A?.primitive??{},r=Number(i.fontSize)||12,n=!!i.textWrap,s=XT(i.text??A?.text??"Text",r,n),o=s.reduce((F,T)=>Math.max(F,T.length),1),c=Math.max(20,o*r*.58)+16,h=r*1.2,m=s.length*h+10,v=e-c/2,x=t-m;return{left:v,right:v+c,top:x,bottom:x+m+12}}class Id{constructor(e,t,i={}){this.rawTime=e,this.price=t,this.text=i.text??"Text",this.color=i.color??"#5f8f96",this.fontSize=i.fontSize??12,this.fontWeight=i.fontWeight??"normal",this.fontStyle=i.fontStyle??"normal",this.textAlign=i.textAlign??"center",this.textWrap=i.textWrap??!1,this.borderEnabled=i.borderEnabled??!1,this.borderColor=i.borderColor??"#5f8f96",this.borderOpacity=i.borderOpacity??.1,this.borderWidth=i.borderWidth??1,this.bgEnabled=i.bgEnabled??!1,this.bgColor=i.bgColor??"#5f8f96",this.bgOpacity=i.bgOpacity??.1,this.visible=!0,this._chart=null,this._series=null;const r=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!r.visible)return;const o=r._chart,l=r._series;if(!o||!l)return;const c=o.timeScale().timeToCoordinate(r.rawTime),h=l.priceToCoordinate(r.price);if(c==null||h==null)return;const m=s.horizontalPixelRatio,v=s.verticalPixelRatio,x=Math.round(c*m),F=Math.round(h*v),T=s.context;T.save();const S=Math.round(r.fontSize*v);T.font=`${r.fontStyle} ${r.fontWeight} ${S}px sans-serif`;const I=`${r.text??""}`,Q=220*m,N=[],J=pe=>{if(!r.textWrap||pe.length===0){N.push(pe);return}const ue=pe.split(/\s+/);let oe="";for(const fe of ue){const Qe=oe?`${oe} ${fe}`:fe;T.measureText(Qe).width<=Q||!oe?oe=Qe:(N.push(oe),oe=fe)}N.push(oe)};I.split(`
|
|
12
|
+
`).forEach(J),N.length===0&&N.push("");const H=N.map(pe=>T.measureText(pe).width),z=Math.max(...H,20*m),re=8*m,q=5*v,ie=z+re*2,G=S*1.2,ne=G*N.length+q*2,le=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",ee=x-ie/2,we=F-ne;r.bgEnabled&&(T.fillStyle=Md(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),T.beginPath(),T.rect(ee,we,ie,ne),T.fill()),r.borderEnabled&&(T.strokeStyle=Md(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),T.lineWidth=Math.max(.5,(r.borderWidth??1)*v),T.beginPath(),T.rect(ee,we,ie,ne),T.stroke()),T.fillStyle=r.color,T.textAlign=le,T.textBaseline="middle";const j=le==="left"?ee+re:le==="right"?ee+ie-re:ee+ie/2;for(let pe=0;pe<N.length;pe++)T.fillText(N[pe],j,we+q+G*(pe+.5));const ge=5*v,ae=F+10*v;T.beginPath(),T.strokeStyle="#3b82f6",T.lineWidth=1.5*v,T.arc(x,ae,ge,0,Math.PI*2),T.stroke(),T.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const JT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Pd(A){return A?JT[A]??7:7}function ZT(A,e){const t=String(A||"").toUpperCase(),i=e||Pd(A),r={M1:1440,M5:288,M15:96,M30:48,H1:24,H4:6,D1:1,W1:1/7,MN:1/30}[t]||96,n=Math.ceil(i*(typeof r=="number"?r:96));return Math.min(Math.max(n,500),5e3)}const DA=A=>{if(!Array.isArray(A)||A.length===0)return[];const e=A.map(i=>({...i,time:te(i.time)})).filter(i=>i.time!=null);e.sort((i,r)=>i.time-r.time);const t=new Map;for(const i of e)t.set(i.time,i);return Array.from(t.values()).sort((i,r)=>i.time-r.time)},YT=300,Dd=24,qT=150,_d=150;function gl(A,e,t=YT){if(!Array.isArray(A)||A.length===0)return[];const i=BA(e),r=Number.isFinite(i)&&i>0?i:60;let n=null;for(const o of A){const l=te(o?.time);l!=null&&(n==null||l>n)&&(n=l)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+r*o});return s}function jT(A){if(!Array.isArray(A)||A.length===0)return null;let e=null;for(const t of A){const i=te(t?.time);i!=null&&(e==null||i>e)&&(e=i)}return e}function eb(A,e){let t=0,i=A.length;for(;t<i;){const r=t+i>>1;A[r]<e?t=r+1:i=r}return t}function zs(A,e,t,i){const r=te(e),n=te(t),s=BA(i)||3600,o=Math.abs((n??0)-(r??0)),l=Math.max(1,Math.round(o/s));if(!Array.isArray(A)||A.length===0)return l;if(r==null||n==null)return 1;const c=v=>{const x=eb(A,v);if(x<=0)return 0;if(x>=A.length)return A.length-1;const F=A[x-1],T=A[x];return Math.abs(v-F)<=Math.abs(T-v)?x-1:x},h=c(r),m=c(n);return Math.max(1,Math.abs(m-h)+1)}function kd(A,e,t){if(!A)return!1;const i=A.timeScale();if(!i)return!1;const r=jT(e);if(r==null)return!1;const n=i.timeToCoordinate(r);if(Number.isFinite(n)){const c=i.coordinateToLogical(n);if(Number.isFinite(c)){const h=i.getVisibleLogicalRange(),m=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,v=Number.isFinite(m)&&m>20?m:120,x=Math.min(_d,v/2),F=Math.max(20,v-x),T={from:c-F,to:c+x};try{return i.setVisibleLogicalRange(T),!0}catch{}}}const s=BA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-qT*o,to:r+_d*o};try{return i.setVisibleRange(l),!0}catch{return!1}}function ut(A,e,t,i,r,n){const s=r-t,o=n-i,l=Math.sqrt(s*s+o*o);if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/(l*l);c=Math.max(0,Math.min(1,c));const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function tb(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);let c=((A-t)*s+(e-i)*o)/l;c<0&&(c=0);const h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function Ab(A,e,t,i,r,n){const s=r-t,o=n-i,l=s*s+o*o;if(l===0)return Math.hypot(A-t,e-i);const c=((A-t)*s+(e-i)*o)/l,h=t+c*s,m=i+c*o;return Math.hypot(A-h,e-m)}function vi(A,e,t){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){const s=t[r].x,o=t[r].y,l=t[n].x,c=t[n].y;o>e!=c>e&&A<(l-s)*(e-o)/(c-o)+s&&(i=!i)}return i}function Od(A,e,t){if(!A||!e||!t)return null;const i=(A.normalizedTime+e.normalizedTime)/2,r=(A.price+e.price)/2,n=t.price-r,s={rawTime:A.rawTime,normalizedTime:A.normalizedTime,price:A.price+n},o={rawTime:e.rawTime,normalizedTime:e.normalizedTime,price:e.price+n},l={rawTime:t.rawTime??te(i),normalizedTime:te(i),price:r+n};return{b1:s,b2:o,bottomMid:l}}function Jr(A,e,t,i=1){if(!A||!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=A.filter(re=>{const q=te(re.time);return q!=null&&q>=s&&q<=o});if(l.length<2)return null;const c=l.length;let h=0,m=0,v=0,x=0;l.forEach((re,q)=>{h+=q,m+=re.close,v+=q*re.close,x+=q*q});const F=(c*v-h*m)/(c*x-h*h),T=(m-F*h)/c;let S=0;l.forEach((re,q)=>{const ie=T+F*q;S+=(re.close-ie)**2});const I=Math.sqrt(S/c),Q=I*i,N=T,J=T+F*(c-1),H=l[0].time,z=l[c-1].time;return{p1:{rawTime:H,normalizedTime:te(H),price:N},p2:{rawTime:z,normalizedTime:te(z),price:J},top1:{rawTime:H,normalizedTime:te(H),price:N+Q},top2:{rawTime:z,normalizedTime:te(z),price:J+Q},bot1:{rawTime:H,normalizedTime:te(H),price:N-Q},bot2:{rawTime:z,normalizedTime:te(z),price:J-Q},slope:F,intercept:T,stdDev:I,offset:Q,barCount:c}}function Zr(A,e,t,i=1){if(!e||!t)return null;const r=e.normalizedTime??te(e.rawTime),n=t.normalizedTime??te(t.rawTime);if(r==null||n==null||r===n)return null;const s=Math.min(r,n),o=Math.max(r,n),l=(A||[]).filter(S=>{const I=te(S.time);return I!=null&&I>=s&&I<=o});if(l.length<2)return null;const c=e.rawTime,h=t.rawTime,m=l.length,v=(t.price-e.price)/(m-1||1);let x=0;l.forEach((S,I)=>{const Q=e.price+v*I;x+=(S.close-Q)**2});const F=Math.sqrt(x/m),T=F*i;return{p1:{rawTime:c,normalizedTime:r,price:e.price},p2:{rawTime:h,normalizedTime:n,price:t.price},top1:{rawTime:c,normalizedTime:r,price:e.price+T},top2:{rawTime:h,normalizedTime:n,price:t.price+T},bot1:{rawTime:c,normalizedTime:r,price:e.price-T},bot2:{rawTime:h,normalizedTime:n,price:t.price-T},slope:v,stdDev:F,offset:T,barCount:m}}const ib={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},horizontalray:{requiredKeys:["primitive"],handleCount:1},verticalline:{requiredKeys:["primitive"],handleCount:1},pricelevel:{requiredKeys:["priceLine"],handleCount:1}},rb={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",pricelevel:"#3b82f6"};function nb(A,e){if(!A||!A.type)return!1;const t=ib[A.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(i=>!!A[i])}function sb(A){return A?rb[A]??"#22c55e":"#22c55e"}function ml(A,e){if(A.length<e)return[];const t=2/(e+1);let i=A.slice(0,e).reduce((n,s)=>n+s.close,0)/e;const r=[{time:A[e-1].time,value:i}];for(let n=e;n<A.length;n++)i=A[n].close*t+i*(1-t),r.push({time:A[n].time,value:i});return r}function Vs(A,e){if(A.length<e)return null;const t=A[A.length-1],i=A.slice(-e).reduce((r,n)=>r+n.close,0)/e;return{time:t.time,value:i}}function Nd(A,e){const t=ml(A,e);return t.length?t[t.length-1]:null}function Kd(A,e){if(A.length<e+1)return null;let t=0,i=0;for(let s=1;s<=e;s++){const o=A[s].close-A[s-1].close;o>0?t+=o:i-=o}t/=e,i/=e;for(let s=e+1;s<A.length;s++){const o=A[s].close-A[s-1].close;t=(t*(e-1)+Math.max(o,0))/e,i=(i*(e-1)+Math.max(-o,0))/e}const r=A[A.length-1],n=i===0?100:100-100/(1+t/i);return{time:r.time,value:n}}function zd(A,e=12,t=26,i=9){if(A.length<t+i)return null;const r=ml(A,e),n=ml(A,t);if(!r.length||!n.length)return null;const s=n.map((h,m)=>{const v=r[r.length-n.length+m];return{time:h.time,value:v.value-h.value}});if(s.length<i)return null;const o=2/(i+1);let l=s.slice(0,i).reduce((h,m)=>h+m.value,0)/i;for(let h=i;h<s.length;h++)l=s[h].value*o+l*(1-o);const c=s[s.length-1];return{time:c.time,value:c.value,signal:l,histogram:c.value-l}}const ob={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ab=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:i=!0,onBuyClick:r,onSellClick:n},s){const o=Y.useRef(null),l=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),m=Y.useRef(null),v=Y.useRef(null),x=Y.useRef([]),F=Y.useRef(null),T=Y.useRef(!1),S=Y.useRef(null),I=Y.useRef(null),Q=Y.useRef(null),N=Y.useRef(null),J=Y.useRef([]),[H,z]=Y.useState(null),[re,q]=Y.useState(null),[ie,G]=Y.useState([]),[ne,le]=Y.useState(null);Y.useRef(null);const[ee,we]=Y.useState([]),j=Y.useRef(null),ge=Y.useRef({tp:null,sl:null,entry:null}),ae=Y.useRef(null),pe=Y.useRef(0),ue=Y.useRef(0),oe=Y.useRef(null),fe=Y.useRef(null),Qe=Y.useRef(!1),me=Y.useRef(!1);Y.useEffect(()=>{fe.current=H;let d=!1;x.current.forEach(u=>{if(u.type==="trendline"&&u.decoration){const O=u===H;u.decoration.isSelected!==O&&(u.decoration.isSelected=O,d=!0)}}),d&&c.current?.applyOptions({})},[H]);const xe=Y.useRef(new Map),Se=Y.useRef(null),Me=Y.useRef(null),$e=(d,u)=>`${d}_${u}`,Ye=()=>{const d=$e(ye,Te);return xe.current.get(d)||null},Ie=d=>{if(!d)return;const u=$e(ye,Te);xe.current.set(u,d)},{activeTool:We,setActiveTool:De,showGrid:Ze,snapToGrid:nt,chartObjects:dt,setChartObjects:He,orders:zt,selectedSymbol:ye,selectedTimeframe:Te,drawingsVisible:ve,chartType:be,chartLocked:Le,theme:Ee,candleColors:Ke,showTradeOrders:wt,showTradePosition:Dt,showTradeHistory:ni,showSLTP:ZA,showAskPrice:aA,showChartControls:si,showCrosshair:_A,showOHLC:YA,currentSymbolData:Zt,baseUrl:Yt,endpoints:Qt,endpointParams:Lt,indicators:Ct,indicatorSettings:Ut,selectedTradeForModify:Vt,setSelectedTradeForModify:je}=$t(),_e=Y.useRef({}),[Je,et]=Y.useState({}),bt=Y.useRef(0),ze=Y.useRef(Ct),Ve=Y.useRef(Ut);ze.current=Ct,Ve.current=Ut;const At=Y.useRef([]),[st,Ge]=Y.useState(!1),[ft,at]=Y.useState(null),[Ne,Wt]=Y.useState([]),[lA,Gs]=Y.useState(!0),[yl,Jd]=Y.useState(null),[Lb,dx]=Y.useState(0),Rs=Y.useMemo(()=>{const d=Ne.map(u=>te(u?.time)).filter(u=>Number.isFinite(u));return d.sort((u,O)=>u-O),d},[Ne]),$s=Y.useRef(null),oi=Y.useRef(new Map);Y.useRef(null);const Zd=Y.useRef(0),kA=Y.useRef(null),nr=Y.useRef(!1),tn=Y.useRef(!1);Y.useEffect(()=>{const d=m.current;d&&d.setData(gl(Ne,Te))},[Ne,Te]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},zoomOut:()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u||!u.from||!u.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const d=o.current;if(!d){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const u=Ee==="light"?"#ffffff":"#12161d",O=`chart-${ye}-${Te}-${Date.now()}.png`;NT(d,{useCORS:!0,allowTaint:!0,backgroundColor:u,scale:2,logging:!1}).then(ce=>{const y=document.createElement("a");y.download=O,y.href=ce.toDataURL("image/png"),y.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(ce=>{console.error("Chart screenshot failed",ce),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,Te,Ee]);const Cl=Y.useMemo(()=>Ne.length===0?[]:be==="line"||be==="area"?Ne.map(d=>({time:d.time,value:d.close})):Ne,[Ne,be]),Mb=d=>{r?r(d):(at("BUY"),Ge(!0))},Hb=d=>{n?n(d):(at("SELL"),Ge(!0))},Ib=()=>{Ge(!1),at(null)},Pb=d=>{const u=re;if(!u||!d)return;const O=(R,V)=>{if(typeof R!="string")return V;const X=R.trim(),se=X.startsWith("#")?X:`#${X}`;return/^#[0-9A-Fa-f]{6}$/.test(se)?se.toLowerCase():V},ce=(R,V)=>{const X=Number(R);return Number.isFinite(X)?Math.max(0,Math.min(1,X)):V};let y={...u,visibleTimeframes:Array.isArray(d.visibleTimeframes)?[...d.visibleTimeframes]:u.visibleTimeframes};if(u.type==="text"){const R=Number.isFinite(Number(d.price))?Number(d.price):u.price,V=u.primitive;V&&(V.text=typeof d.text=="string"?d.text:V.text,V.color=O(d.color,V.color??"#5f8f96"),V.fontSize=Number.isFinite(Number(d.fontSize))?Number(d.fontSize):V.fontSize,V.fontWeight=d.fontWeight==="bold"?"bold":"normal",V.fontStyle=d.fontStyle==="italic"?"italic":"normal",V.textAlign=["left","center","right"].includes(d.textAlign)?d.textAlign:V.textAlign,V.textWrap=!!d.textWrap,V.borderEnabled=!!d.borderEnabled,V.borderColor=O(d.borderColor,V.borderColor??"#5f8f96"),V.borderOpacity=ce(d.borderOpacity,V.borderOpacity??.1),V.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(d.borderWidth))?Number(d.borderWidth):1)),V.bgEnabled=!!d.bgEnabled,V.bgColor=O(d.bgColor,V.bgColor??"#5f8f96"),V.bgOpacity=ce(d.bgOpacity,V.bgOpacity??.1),V.price=R),y={...y,price:R,text:typeof d.text=="string"?d.text:u.text}}if(u.type==="trendline"){const R=O(d.lineColor,"#22c55e"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2));if(u.series)try{u.series.applyOptions({color:R,lineWidth:V})}catch{}const X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.point1?.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.point2?.price;if(u.series&&u.point1&&u.point2){const $=u.point1.time??u.point1.rawTime,C=u.point2.time??u.point2.rawTime;try{const B=DA([{time:$,value:X},{time:C,value:se}]);B.length>0&&u.series.setData(B)}catch{}}const E={...u.point1,price:X},D={...u.point2,price:se};u.decoration&&(u.decoration.color=R,u.decoration.lineWidth=V,u.decoration.arrowLeft=!!d.arrowLeft,u.decoration.arrowRight=!!d.arrowRight,u.decoration.rayLeft=!!d.rayLeft,u.decoration.rayRight=!!d.rayRight,u.decoration.statsColor=O(d.statsColor,"#5f8f96"),u.decoration.statsPosition=d.statsPosition??"right",u.decoration.statsShowAlways=!!d.statsShowAlways,u.decoration.statsPriceRange=!!d.statsPriceRange,u.decoration.statsBarsRange=!!d.statsBarsRange,u.decoration.statsDateRange=!!d.statsDateRange,u.decoration.statsAngle=!!d.statsAngle,u.decoration.statsDistance=!!d.statsDistance,u.decoration.p1=E,u.decoration.p2=D),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsShowAlways:!!d.statsShowAlways,statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,point1:E,point2:D,decoration:u.decoration}}if(u.type==="pricelevel"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price;if(u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,lineWidth:V,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const f=h.current;if(se&&E&&f)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B;else{const L=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C});try{f.attachPrimitive(L)}catch{}u.textPrimitive=L}else if(u.textPrimitive&&f){try{f.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="horizontalray"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showPrice!==!1,se=!!d.showText,E=typeof d.textContent=="string"?d.textContent:"",D=O(d.textColor,"#ffffff"),$=["left","center","right"].includes(d.textHAlign)?d.textHAlign:"center",C=["top","middle","bottom"].includes(d.textVAlign)?d.textVAlign:"top",B=Number.isFinite(Number(d.price))?Number(d.price):u.price,f=u.primitive;if(f&&(f.price=B,f.color=R,f.lineWidth=V),u.priceLine)try{u.priceLine.applyOptions({price:B,color:R,axisLabelVisible:X,title:X&&typeof B=="number"?B.toFixed(5):""})}catch{}const L=h.current;if(se&&E&&L)if(u.textPrimitive)u.textPrimitive.text=E,u.textPrimitive.textColor=D,u.textPrimitive.hAlign=$,u.textPrimitive.vAlign=C,u.textPrimitive.price=B,u.textPrimitive.originTime=u.rawOriginTime;else{const w=new md(B,{text:E,textColor:D,hAlign:$,vAlign:C,originTime:u.rawOriginTime});try{L.attachPrimitive(w)}catch{}u.textPrimitive=w}else if(u.textPrimitive&&L){try{L.detachPrimitive(u.textPrimitive)}catch{}u.textPrimitive=null}y={...y,price:B,lineColor:R,lineWidth:V,showPrice:X,showText:se,textContent:E,textColor:D,textHAlign:$,textVAlign:C,textPrimitive:u.textPrimitive}}if(u.type==="verticalline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.showDate!==!1,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showDate=X),y={...y,lineColor:R,lineWidth:V,showDate:X}}if(u.type==="infoline"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=d.statsShowAlways!==!1,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=!!d.statsAngle,f=!!d.statsDistance,L=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,w=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,p=u.p1.rawTime,_=u.p2.rawTime,P=w-L,U=L!==0?P/Math.abs(L)*100:0,b=u.p1.normalizedTime??0,g=u.p2.normalizedTime??0,M=BA(Te)||3600,k=Math.abs(g-b),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=c.current,Ae=h.current,he=Z?Z.timeScale().timeToCoordinate(p):null,Be=Ae?Ae.priceToCoordinate(L):null,Ce=Z?Z.timeScale().timeToCoordinate(_):null,Ue=Ae?Ae.priceToCoordinate(w):null,qe=he!=null&&Be!=null&&Ce!=null&&Ue!=null?Math.atan2(-(Ue-Be),Ce-he)*(180/Math.PI):u.primitive?.info?.angle??0,rt={priceDiff:P,pricePct:U,bars:K,days:W,angle:qe},Xe=u.primitive;Xe&&(Xe.color=R,Xe.lineWidth=V,Xe.statsShowAlways=X,Xe.statsColor=se,Xe.statsPosition=E,Xe.statsPriceRange=D,Xe.statsBarsRange=$,Xe.statsDateRange=C,Xe.statsAngle=B,Xe.statsDistance=f,Xe.p1={...u.p1,price:L},Xe.p2={...u.p2,price:w},Xe.info=rt),y={...y,lineColor:R,lineWidth:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C,statsAngle:B,statsDistance:f,p1:{...u.p1,price:L},p2:{...u.p2,price:w}}}if(u.type==="rulerline"){const R=O(d.lineColor,"#3b82f6"),V=d.showArea!==!1,X=!!d.statsShowAlways,se=O(d.statsColor,"#5f8f96"),E=["left","center","right"].includes(d.statsPosition)?d.statsPosition:"right",D=!!d.statsPriceRange,$=!!d.statsBarsRange,C=!!d.statsDateRange,B=u.primitive;B&&(B.lineColor=R,B.showArea=V,B.statsShowAlways=X,B.statsColor=se,B.statsPosition=E,B.statsPriceRange=D,B.statsBarsRange=$,B.statsDateRange=C),y={...y,lineColor:R,showArea:V,statsShowAlways:X,statsColor:se,statsPosition:E,statsPriceRange:D,statsBarsRange:$,statsDateRange:C}}if(u.type==="arrowedline"){const R=O(d.lineColor,"#f59e0b"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="rayline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="extendedline"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsBarsRange=!!d.statsBarsRange,E.statsDateRange=!!d.statsDateRange,E.statsAngle=!!d.statsAngle,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsBarsRange:!!d.statsBarsRange,statsDateRange:!!d.statsDateRange,statsAngle:!!d.statsAngle,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="crossline"){const R=O(d.lineColor,"#06a0e3"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.price))?Number(d.price):u.p.price,se=u.primitive;se&&(se.color=R,se.lineWidth=V,se.showTime=!!d.showTime,se.showPrice=!!d.showPrice,se.center={...u.p,price:X}),y={...y,lineColor:R,lineWidth:V,showTime:!!d.showTime,showPrice:!!d.showPrice,p:{...u.p,price:X}}}if(u.type==="trendbyangle"){const R=O(d.lineColor,"#7aa6ae"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,se=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p2.price,E=u.primitive;E&&(E.color=R,E.lineWidth=V,E.arrowLeft=!!d.arrowLeft,E.arrowRight=!!d.arrowRight,E.rayLeft=!!d.rayLeft,E.rayRight=!!d.rayRight,E.statsShowAlways=!!d.statsShowAlways,E.statsColor=O(d.statsColor,"#5f8f96"),E.statsPosition=d.statsPosition??"right",E.statsPriceRange=!!d.statsPriceRange,E.statsDistance=!!d.statsDistance,E.p1={...u.p1,price:X},E.p2={...u.p2,price:se}),y={...y,lineColor:R,lineWidth:V,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,statsShowAlways:!!d.statsShowAlways,statsColor:O(d.statsColor,"#5f8f96"),statsPosition:d.statsPosition??"right",statsPriceRange:!!d.statsPriceRange,statsDistance:!!d.statsDistance,p1:{...u.p1,price:X},p2:{...u.p2,price:se}}}if(u.type==="disjointchannel"){const R=O(d.lineColor,"#129f5c"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#6aa84f"),se=ce(d.fillOpacity,.1),E=O(d.pricesColor,"#129f5c"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}if(u.type==="flattopbottom"){const R=O(d.lineColor,"#3b82f6"),V=Math.max(1,Math.min(5,Number.isFinite(Number(d.lineWidth))?Number(d.lineWidth):2)),X=O(d.fillColor,"#3b82f6"),se=ce(d.fillOpacity,.12),E=O(d.pricesColor,"#3b82f6"),D=Number.isFinite(Number(d.point1Price))?Number(d.point1Price):u.p1.price,$=Number.isFinite(Number(d.point2Price))?Number(d.point2Price):u.p3.price,C=Number.isFinite(Number(d.point3Price))?Number(d.point3Price):u.p2.price,B=u.primitive;B&&(B.lineColor=R,B.lineWidth=V,B.fillColor=X,B.fillOpacity=se,B.showBackground=!!d.showBackground,B.showPrices=!!d.showPrices,B.pricesColor=E,B.rayLeft=!!d.rayLeft,B.rayRight=!!d.rayRight,B.arrowLeft=!!d.arrowLeft,B.arrowRight=!!d.arrowRight,B.p1={...u.p1,price:D},B.p3={...u.p3,price:$},B.p2={...u.p2,price:C}),y={...y,lineColor:R,lineWidth:V,fillColor:X,fillOpacity:se,showBackground:!!d.showBackground,showPrices:!!d.showPrices,pricesColor:E,rayLeft:!!d.rayLeft,rayRight:!!d.rayRight,arrowLeft:!!d.arrowLeft,arrowRight:!!d.arrowRight,p1:{...u.p1,price:D},p3:{...u.p3,price:$},p2:{...u.p2,price:C}}}He(R=>{const V=R.map(X=>X===u?y:X);return x.current=V,V}),fe.current===u&&(fe.current=y),z(R=>R===u?y:R),le(R=>R===u?y:R),q(y);try{c.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const d=o.current;if(!d)return;const u=d.getBoundingClientRect(),O=w=>{const p=Math.abs(Number(w));return Number.isFinite(p)?p>=1e3?p.toFixed(2):p.toFixed(5):"0"},ce=Ee==="light",y=R0(d,{width:u.width||d.clientWidth,height:u.height||d.clientHeight,autoSize:!0,localization:{priceFormatter:O},layout:{background:{color:ce?"#FFFFFF":"#0d1117",type:"solid"},textColor:ce?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}},rightPriceScale:{borderColor:ce?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ce?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ce?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:0,vertLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ce?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:We===1,horzLineVisible:We===1},handleScroll:{mouseWheel:!0,pressedMouseMove:We===null||We===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}}),R=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),V=R.includes("JPY"),X=rn(R),se=An(R);let E,D;V?(E=.001,D=w=>Math.abs(Number(w)).toFixed(3)):X?R.startsWith("BTC")||R.startsWith("ETH")?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(4)):se&&(R.startsWith("XAU")||R.startsWith("XAG"))?(E=.01,D=w=>Math.abs(Number(w)).toFixed(2)):(E=1e-4,D=w=>Math.abs(Number(w)).toFixed(5));const $=y.addCandlestickSeries({upColor:ce?"#089981":"#26a69a",downColor:ce?"#f23645":"#ef5350",wickUpColor:ce?"#089981":"#26a69a",wickDownColor:ce?"#f23645":"#ef5350",borderUpColor:ce?"#089981":"#26a69a",borderDownColor:ce?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:E,formatter:D}}),C=y.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=y,h.current=$,m.current=C,C.setData(gl(Ne,Te)),requestAnimationFrame(()=>{if(d&&y){const w=d.getBoundingClientRect();w.width>0&&w.height>0&&y.resize(w.width,w.height)}});const B=y.timeScale(),f=()=>{if(me.current&&oi.current.size>0){const w=B.getVisibleRange();w&&Ie(w)}};B.subscribeVisibleTimeRangeChange(f);const L=new ResizeObserver(w=>{for(const p of w){const{width:_,height:P}=p.contentRect;if(_>0&&P>0&&y){const U=B.getVisibleRange();y.resize(_,P),U&&setTimeout(()=>{try{B.setVisibleRange(U)}catch{}},0)}}});return L.observe(d),()=>{B.unsubscribeVisibleTimeRangeChange(f),L.disconnect(),y.remove(),c.current=null,h.current=null,m.current=null,v.current=null,x.current=[],kA.current&&clearTimeout(kA.current)}},[]),Y.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0},horzLines:{visible:Ze,color:Ze?"rgba(110, 118, 129, 0.15)":"transparent",style:Ze?2:0}}})},[Ze]),Y.useEffect(()=>{const d=c.current;if(!d)return;const u=Ee==="light";d.applyOptions({layout:{background:{color:u?"#FFFFFF":"#12161d"},textColor:u?"#020617":"#fff"},grid:{vertLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ze?u?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:u?"#e5e7eb":"#1e293b"},timeScale:{borderColor:u?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1},horzLine:{color:u?"#3b82f6":"#58a6ff",labelBackgroundColor:u?"#eff6ff":"#161b22",width:1}}})},[Ee,Ze]),Y.useEffect(()=>{const d=h.current;!d||!Ke||d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})},[Ke]),Y.useEffect(()=>{if(!c.current)return;const u=!Le&&!(We!==null&&We!==1&&We!==0),O=!Le;c.current.applyOptions({crosshair:{mode:0,vertLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:We===1||_A,width:1,color:Ee==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ee==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:O,pressedMouseMove:u,horzTouchDrag:u,vertTouchDrag:u},handleScale:{axisPressedMouseMove:{time:u,price:u},axisDoubleClickReset:{time:!1,price:O},axisTouch:{time:u,price:u},mouseWheel:O,pinch:O}})},[We,Le,_A,Ee]);const Db=(d=!1)=>{const u=h.current,O=c.current;x.current.forEach(ce=>{if(ce.primitive)try{u&&u.detachPrimitive(ce.primitive)}catch{}if(ce.series&&ce.series!==u&&O)try{O.removeSeries(ce.series)}catch{}if(ce.priceLine&&u)try{u.removePriceLine(ce.priceLine)}catch{}if(ce.textPrimitive&&u)try{u.detachPrimitive(ce.textPrimitive)}catch{}}),x.current=[],He([]),De(null),d&&$T(ye,Te)},Yd=(d,u=!1)=>{d&&x.current.forEach(O=>{if(O.primitive){try{d.detachPrimitive(O.primitive)}catch{}try{d.attachPrimitive(O.primitive)}catch{}}if(u&&O.type==="pricelevel"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}if(u&&O.type==="horizontalray"&&O.priceLine)try{const ce=O.showPrice!==!1,y=d.createPriceLine({price:O.price,color:O.lineColor??"#3b82f6",lineWidth:O.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ce,title:ce&&typeof O.price=="number"?O.price.toFixed(5):""});O.priceLine=y}catch{}})},Xs=Y.useCallback(()=>{GT(x.current,ye,Te)},[ye,Te]),_b=Y.useCallback(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=RT(ye,Te);if(!O.length)return;const ce=[];for(const y of O)try{let R=null;switch(y.type){case"pricelevel":{const V=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,priceLine:V};break}case"horizontalray":{const V=new gd(y.price,y.rawOriginTime);u.attachPrimitive(V);const X=u.createPriceLine({price:y.price,color:y.lineColor??"#3b82f6",lineWidth:y.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:y.showPrice!==!1,title:typeof y.price=="number"?y.price.toFixed(5):""});R={...y,primitive:V,priceLine:X};break}case"verticalline":{const V=new Ld(y.rawTime);u.attachPrimitive(V),R={...y,primitive:V};break}case"text":{const V=new Id(y.rawTime,y.price);y.text&&(V.text=y.text),u.attachPrimitive(V),R={...y,primitive:V};break}case"crossline":{const V=new Qd({rawTime:y.p.rawTime,price:y.p.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"infoline":{const V=y.info||{},X=new wd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"rulerline":{const V=y.info||{},X=new cl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},V);u.attachPrimitive(X),R={...y,primitive:X};break}case"arrowedline":{const V=new hl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"rayline":{const V=new Td({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"extendedline":{const V=new bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendbyangle":{const V=new Fd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"trendline":case"gannline":{const V=y.type==="gannline"?"#7aa6ae":"#22c55e",X=d.addLineSeries({color:V,lineWidth:y.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),se=DA([{time:y.point1.time,value:y.point1.price},{time:y.point2.time,value:y.point2.price}]);se.length>0&&X.setData(se);const E=new xd(y.point1,y.point2,V,2);try{X.attachPrimitive(E)}catch{}R={...y,series:X,decoration:E};break}case"rectangle":{const V=new Bd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"circle":{const V=new yd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"triangle":{const V=new Cd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{strokeColor:y.strokeColor??"#7aa6ae",fillColor:y.fillColor??"rgba(148, 163, 184, 0.18)",lineWidth:y.lineWidth??1});u.attachPrimitive(V),R={...y,primitive:V};break}case"ellipse":{const V=new vd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{strokeColor:y.strokeColor??"#7aa6ae",lineWidth:y.lineWidth??1,minorRatio:y.minorRatio??.45,previewAsLine:!1});u.attachPrimitive(V),R={...y,primitive:V};break}case"fibonacci":{const V=new fl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"equidistantchannel":{const V=new pl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.b1.rawTime,price:y.b1.price},{rawTime:y.b2.rawTime,price:y.b2.price},{rawTime:y.bottomMid.rawTime,price:y.bottomMid.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"disjointchannel":{const V=new Ns({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"flattopbottom":{const V=new ul({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price},{rawTime:y.p4.rawTime,price:y.p4.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"regressionchannel":{const V=new Ks({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"stddevchannel":{const V=new dl({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.top1.rawTime,price:y.top1.price},{rawTime:y.top2.rawTime,price:y.top2.price},{rawTime:y.bot1.rawTime,price:y.bot1.price},{rawTime:y.bot2.rawTime,price:y.bot2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"andrewspitchfork":{const V=new Ud({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price},{rawTime:y.p3.rawTime,price:y.p3.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"gannfan":{const V=new Sd({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}case"ganngrid":{const V=new Ed({rawTime:y.p1.rawTime,price:y.p1.price},{rawTime:y.p2.rawTime,price:y.p2.price});u.attachPrimitive(V),R={...y,primitive:V};break}default:continue}R&&ce.push(R)}catch{}ce.length&&(x.current.push(...ce),He(y=>[...y,...ce]))},[ye,Te,He]);Y.useEffect(()=>{const d=`${ye}_${Te}`;F.current===d&&Xs()},[dt,Xs,ye,Te]),Y.useEffect(()=>{(async()=>{if(!ye||!Te){Wt([]),me.current=!1;return}try{if(kA.current&&(clearTimeout(kA.current),kA.current=null),nr.current=!0,Gs(!0),Jd(null),Wt([]),me.current=!1,tn.current=!1,Me.current!==null&&Me.current!==ye&&(F.current=null,Db()),Me.current=ye,h.current)try{h.current.setData([])}catch{}const u=Pd(Te),O=ZT(Te,u),ce=Yt||ob?.VITE_BASE_URL||"http://localhost:5002",y=Qt?.candles||"/api/chart/candles",R=Lt?.candles||{},V={symbol:R.symbol||"symbol",timeframe:R.timeframe||"timeframe",limit:R.limit||"limit",daysBack:R.daysBack||"daysBack"},X={};X[V.symbol]=ye,X[V.timeframe]=Te,X[V.limit]=O,R.daysBack!==!1&&(X[V.daysBack]=u);const se=localStorage.getItem("token")??localStorage.getItem("authToken"),E=await Bt.get(`${ce}${y}`,{params:X,timeout:1e4,headers:se?{Authorization:`Bearer ${se}`}:{}});let D=[];if(Array.isArray(E.data)?D=E.data:E.data&&E.data.data&&Array.isArray(E.data.data)?D=E.data.data:E.data&&Array.isArray(E.data)&&(D=E.data),D&&D.length>0){const{candles:$,stats:C}=El(D,ye,Te);$.length>0?(Wt($),oi.current=new Map,$.forEach(B=>{oi.current.set(B.time,B)}),tn.current=!0,nr.current=!1,$s.current?.connected&&ye&&Te&&$s.current.emit("subscribeCandles",{symbol:ye,timeframe:Te})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),nr.current=!1,Wt([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),nr.current=!1,Wt([])}catch(u){console.error(`❌ Error fetching ${ye}:`,u.message);const O=u.code==="ECONNABORTED"||u.message&&u.message.includes("timeout");Jd(O?"Request timed out. No data available for this symbol.":u.message||"Failed to load candles."),nr.current=!1,Wt([]),Gs(!1)}})()},[ye,Te,Lb]),Y.useEffect(()=>{$s.current=zn.getSocket();const d=$s.current,u=()=>{if(tn.current&&ye&&Te&&d.connected){const X={symbol:ye,timeframe:Te};d.emit("subscribeCandles",X)}},O=()=>{setTimeout(()=>{ye&&Te&&u()},200)},ce=X=>{},y=X=>{};d.on("connect",O),d.on("disconnect",ce),d.on("connect_error",y),d.on("subscription:confirmed",X=>{X.type});const R=X=>{if(!tn.current||!X||!X.candle||!X.symbol)return;const se=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(se(X.symbol)!==se(ye)||X.timeframe&&X.timeframe!==Te)return;const{candle:E}=X,D=Ll(E,ye,Te);if(!D)return;const $=Date.now();if($-Zd.current<200)return;Zd.current=$;const C=c.current?.timeScale(),B=C?.getVisibleRange(),f=h.current,L=c.current;if(!(!f||!L||!me.current&&!tn.current||f?.seriesType?.()!==(be==="line"?"Line":be==="area"?"Area":be==="bars"?"Bar":"Candlestick")))try{const _=oi.current.get(D.time),P=!_,U=_?{time:D.time,open:_.open,high:Math.max(_.high,D.high),low:Math.min(_.low,D.low),close:D.close}:D;oi.current.set(D.time,U),P&&m.current&&m.current.setData(gl(Array.from(oi.current.values()),Te));try{be==="line"||be==="area"?f.update({time:U.time,value:U.close}):f.update(U),C&&B&&Ie(B)}catch(k){throw k}const b=ze.current||{},g=Ve.current||{},M=_e.current;if(Object.keys(M).length>0){const k=Array.from(oi.current.values()).sort((K,W)=>K.time-W.time);if(b.sma20&&M.sma20){const K=Vs(k,g.smaPeriod||20);if(K)try{M.sma20.update(K)}catch{}}if(b.sma50&&M.sma50){const K=Vs(k,50);if(K)try{M.sma50.update(K)}catch{}}if(b.ema12&&M.ema12){const K=Nd(k,g.emaPeriod||12);if(K)try{M.ema12.update(K)}catch{}}if(b.rsi&&M.rsi){const K=Kd(k,g.rsiPeriod||14);if(K){try{M.rsi.update(K)}catch{}if(M.rsi70)try{M.rsi70.update({time:K.time,value:70})}catch{}if(M.rsi30)try{M.rsi30.update({time:K.time,value:30})}catch{}}}if(b.macd&&M.macdLine){const K=zd(k,12,26,9);if(K){try{M.macdLine.update({time:K.time,value:K.value})}catch{}try{M.macdSignal.update({time:K.time,value:K.signal})}catch{}try{M.macdHist.update({time:K.time,value:K.histogram,color:K.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(b.bollinger&&M.bbMiddle){const K=qs(k,g.bbPeriod||20,g.bbStdDev||2);if(K){try{M.bbUpper.update({time:K.time,value:K.upper})}catch{}try{M.bbMiddle.update({time:K.time,value:K.middle})}catch{}try{M.bbLower.update({time:K.time,value:K.lower})}catch{}}}}}catch{}};d.on("candleUpdate",R);const V=()=>{d.connected&&ye&&Te&&u()};if(d.connected)V();else{const X=()=>{setTimeout(V,200)};d.once("connect",X),setTimeout(()=>{d.connected&&V()},500)}return()=>{d.off("candleUpdate",R),d.off("connect",O),d.off("disconnect",ce),d.off("connect_error",y),d.off("subscription:confirmed"),ye&&Te&&d.connected&&d.emit("unsubscribeCandles",{symbol:ye,timeframe:Te})}},[ye,Te,Yt]),Y.useEffect(()=>{const d=h.current,u=c.current;if(!(!d||!u)&&!(nr.current&&Ne.length>0)&&!(Ne.length===0&&me.current)){if(Ne.length===0&&!me.current){if(lA)return;const O=u.timeScale();d.setData([]),O.fitContent(),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400);return}if(!me.current){const O=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ce=O.includes("JPY"),y=An(O),R=rn(O);let V,X;ce?(V=.001,X=f=>Math.abs(Number(f)).toFixed(3)):R?O.startsWith("BTC")||O.startsWith("ETH")?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(4)):y&&(O.startsWith("XAU")||O.startsWith("XAG"))?(V=.01,X=f=>Math.abs(Number(f)).toFixed(2)):(V=1e-4,X=f=>Math.abs(Number(f)).toFixed(5));try{d.applyOptions({priceFormat:{type:"custom",minMove:V,formatter:X}})}catch{}const se=u.timeScale(),E=$e(ye,Te);Se.current,Se.current=E;const D=[...Ne].sort((f,L)=>f.time-L.time);if(be==="line"||be==="area"){const f=D?.map(L=>({time:L.time,value:L.close})).filter(L=>L.time!=null);f.length>0&&d.setData(f)}else D?.length>0&&d.setData(D);Ke&&d.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor}),Yd(d);const $=`${ye}_${Te}`;F.current!==$&&(F.current=$,_b());const C=BA(Te)||60;if(x.current.forEach(f=>{if(f.type==="horizontalray"&&f.primitive){const U=f.rawOriginTime??f.primitive.originTime,b=Re(U,C);f.primitive.originTime=b,f.originTime=b;return}if(f.type==="verticalline"&&f.primitive){const U=f.rawTime??f.primitive.time,b=Re(U,C);f.primitive.time=b,f.time=te(b);return}if(f.type==="infoline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Z=>{const Ae=Re(Z,C);return g==null||M==null?Ae:Math.min(Math.max(Ae,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p1.normalizedTime=te(K),f.p2.rawTime=W,f.p2.normalizedTime=te(W),f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};return}if(f.type==="rulerline"&&f.primitive&&f.p1&&f.p2){const U=f.rawP1Time??f.p1.rawTime,b=f.rawP2Time??f.p2.rawTime,g=D.length>0?D[0].time:null,M=D.length>0?D[D.length-1].time:null,k=Be=>{const Ce=Re(Be,C);return g==null||M==null?Ce:Math.min(Math.max(Ce,g),M)},K=k(U),W=k(b);f.p1.rawTime=K,f.p2.rawTime=W,f.primitive.p1={rawTime:K,price:f.p1.price},f.primitive.p2={rawTime:W,price:f.p2.price};const Z=te(K),Ae=te(W),he=Math.abs((Ae??0)-(Z??0));f.primitive.info={priceDiff:f.p2.price-f.p1.price,pricePct:(f.p2.price-f.p1.price)/Math.abs(f.p1.price||1)*100,bars:zs(Rs,K,W,Te),days:Math.max(1,Math.round(he/86400))};return}if(f.type==="arrowedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="rayline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="extendedline"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="trendbyangle"&&f.primitive&&f.p1&&f.p2){const U=f.p1.rawTime,b=f.p2.rawTime,g=Re(U,C),M=Re(b,C);f.p1.rawTime=g,f.p1.normalizedTime=te(g),f.p2.rawTime=M,f.p2.normalizedTime=te(M),f.primitive.p1={rawTime:g,price:f.p1.price},f.primitive.p2={rawTime:M,price:f.p2.price};return}if(f.type==="disjointchannel"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="flattopbottom"&&f.primitive&&f.p1&&f.p2&&f.p3&&f.p4){const U=b=>{const g=Re(b.rawTime,C);b.rawTime=g,b.normalizedTime=te(g)};U(f.p1),U(f.p2),U(f.p3),U(f.p4),f.primitive.p1={rawTime:f.p1.rawTime,price:f.p1.price},f.primitive.p2={rawTime:f.p2.rawTime,price:f.p2.price},f.primitive.p3={rawTime:f.p3.rawTime,price:f.p3.price},f.primitive.p4={rawTime:f.p4.rawTime,price:f.p4.price};return}if(f.type==="regressionchannel"&&f.primitive&&f.p1&&f.p2){const U=Jr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.intercept=U.intercept,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="stddevchannel"&&f.primitive&&f.p1&&f.p2){const U=Zr(D,f.p1,f.p2,f.stdMultiplier??1);if(!U)return;const b=f.primitive;b.mid1={rawTime:U.p1.rawTime,price:U.p1.price},b.mid2={rawTime:U.p2.rawTime,price:U.p2.price},b.top1={rawTime:U.top1.rawTime,price:U.top1.price},b.top2={rawTime:U.top2.rawTime,price:U.top2.price},b.bot1={rawTime:U.bot1.rawTime,price:U.bot1.price},b.bot2={rawTime:U.bot2.rawTime,price:U.bot2.price},f.p1=U.p1,f.p2=U.p2,f.top1=U.top1,f.top2=U.top2,f.bot1=U.bot1,f.bot2=U.bot2,f.slope=U.slope,f.stdDev=U.stdDev,f.offset=U.offset,f.barCount=U.barCount;return}if(f.type==="andrewspitchfork"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="gannfan"||f.type==="ganngrid")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if((f.type==="circle"||f.type==="ellipse")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type==="triangle"&&f.primitive&&f.p1&&f.p2&&f.p3){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C),g=Re(f.p3.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.p3.rawTime=g,f.p3.normalizedTime=te(g),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price},f.primitive.p3={rawTime:g,price:f.p3.price};return}if((f.type==="fibonacci"||f.type==="rectangle")&&f.primitive&&f.p1&&f.p2){const U=Re(f.p1.rawTime,C),b=Re(f.p2.rawTime,C);f.p1.rawTime=U,f.p1.normalizedTime=te(U),f.p2.rawTime=b,f.p2.normalizedTime=te(b),f.primitive.p1={rawTime:U,price:f.p1.price},f.primitive.p2={rawTime:b,price:f.p2.price};return}if(f.type!=="trendline"&&f.type!=="gannline"||!f.series||!f.point1||!f.point2)return;const L=f.point1.rawTime??f.point1.time,w=f.point2.rawTime??f.point2.time,p=Re(L,C),_=Re(w,C);f.point1.time=p,f.point2.time=_;const P=DA([{time:p,value:f.point1.price},{time:_,value:f.point2.price}]);try{P.length>0&&f.series.setData(P)}catch{}}),D?.length>0){const f=D[D?.length-1].time,L=BA(Te)||60,p=f-(Te==="M1"?150:Te==="M5"?120:100)*L;try{se.setVisibleRange({from:p,to:f+L*Dd})}catch{se.fitContent()}}else se.fitContent();try{u.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0;const B=se.getVisibleRange();Ie(B),kA.current&&clearTimeout(kA.current),kA.current=setTimeout(()=>requestAnimationFrame(()=>Gs(!1)),400)}}},[Ne.length,be,ye,Te]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current||Ne.length===0)return;const u=d.timeScale(),O=u.getVisibleRange()||Ye();if(h.current)try{d.removeSeries(h.current)}catch{}if(v.current)try{d.removeSeries(v.current),v.current=null}catch{}let ce;const y=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),R=y.includes("JPY"),V=An(y),X=rn(y);let se,E;R?(se=.001,E=C=>Math.abs(Number(C)).toFixed(3)):X?y.startsWith("BTC")||y.startsWith("ETH")?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(4)):V&&(y.startsWith("XAU")||y.startsWith("XAG"))?(se=.01,E=C=>Math.abs(Number(C)).toFixed(2)):(se=1e-4,E=C=>Math.abs(Number(C)).toFixed(5));const D={type:"custom",minMove:se,formatter:E};if(be==="bars"){const C=Ee==="light";ce=d.addBarSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}else if(be==="line"){ce=d.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="area"){ce=d.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const C=DA(Cl);C.length>0&&ce.setData(C)}else if(be==="volume ticks"||be==="volume"){const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,priceScaleId:"right"});const B=[...Ne].sort((w,p)=>w.time-p.time);B?.length>0&&ce.setData(B);const f=d.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),d.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const L=B?.map(w=>({time:w.time,value:w.volume||0,color:w.close>=w.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));L.length>0&&f.setData(L),v.current=f}else{const C=Ee==="light";ce=d.addCandlestickSeries({upColor:C?"#089981":"#26A69A",downColor:C?"#f23645":"#EF5350",wickUpColor:C?"#089981":"#26A69A",wickDownColor:C?"#f23645":"#EF5350",borderUpColor:C?"#089981":"#26A69A",borderDownColor:C?"#f23645":"#EF5350",borderVisible:!0,priceFormat:D,scaleMargins:{top:.1,bottom:.1}});const B=[...Ne].sort((f,L)=>f.time-L.time);B?.length>0&&ce.setData(B)}if(h.current=ce,Ke&&ce)try{ce.applyOptions({upColor:Ke.upColor,downColor:Ke.downColor,wickUpColor:Ke.upColor,wickDownColor:Ke.downColor,borderUpColor:Ke.upColor,borderDownColor:Ke.downColor})}catch{}Yd(ce,!0);const $=BA(Te)||60;if(x.current.forEach(C=>{if(C.type==="horizontalray"&&C.primitive){const U=C.rawOriginTime??C.primitive.originTime,b=Re(U,$);C.primitive.originTime=b,C.originTime=b;return}if(C.type==="verticalline"&&C.primitive){const U=C.rawTime??C.primitive.time,b=Re(U,$);C.primitive.time=b,C.time=te(b);return}if(C.type==="infoline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ae,he)=>Ae.time-he.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ae=>{const he=Re(Ae,$);return M==null||k==null?he:Math.min(Math.max(he,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p1.normalizedTime=te(W),C.p2.rawTime=Z,C.p2.normalizedTime=te(Z),C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};return}if(C.type==="rulerline"&&C.primitive&&C.p1&&C.p2){const U=C.rawP1Time??C.p1.rawTime,b=C.rawP2Time??C.p2.rawTime,g=[...Ne].sort((Ce,Ue)=>Ce.time-Ue.time),M=g.length>0?g[0].time:null,k=g.length>0?g[g.length-1].time:null,K=Ce=>{const Ue=Re(Ce,$);return M==null||k==null?Ue:Math.min(Math.max(Ue,M),k)},W=K(U),Z=K(b);C.p1.rawTime=W,C.p2.rawTime=Z,C.primitive.p1={rawTime:W,price:C.p1.price},C.primitive.p2={rawTime:Z,price:C.p2.price};const Ae=te(W),he=te(Z),Be=Math.abs((he??0)-(Ae??0));C.primitive.info={priceDiff:C.p2.price-C.p1.price,pricePct:(C.p2.price-C.p1.price)/Math.abs(C.p1.price||1)*100,bars:zs(Rs,W,Z,Te),days:Math.max(1,Math.round(Be/86400))};return}if(C.type==="arrowedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="rayline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="extendedline"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="trendbyangle"&&C.primitive&&C.p1&&C.p2){const U=C.p1.rawTime,b=C.p2.rawTime,g=Re(U,$),M=Re(b,$);C.p1.rawTime=g,C.p1.normalizedTime=te(g),C.p2.rawTime=M,C.p2.normalizedTime=te(M),C.primitive.p1={rawTime:g,price:C.p1.price},C.primitive.p2={rawTime:M,price:C.p2.price};return}if(C.type==="disjointchannel"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="flattopbottom"&&C.primitive&&C.p1&&C.p2&&C.p3&&C.p4){const U=b=>{const g=Re(b.rawTime,$);b.rawTime=g,b.normalizedTime=te(g)};U(C.p1),U(C.p2),U(C.p3),U(C.p4),C.primitive.p1={rawTime:C.p1.rawTime,price:C.p1.price},C.primitive.p2={rawTime:C.p2.rawTime,price:C.p2.price},C.primitive.p3={rawTime:C.p3.rawTime,price:C.p3.price},C.primitive.p4={rawTime:C.p4.rawTime,price:C.p4.price};return}if(C.type==="regressionchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Jr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.intercept=b.intercept,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="stddevchannel"&&C.primitive&&C.p1&&C.p2){const U=[...Ne].sort((M,k)=>M.time-k.time),b=Zr(U,C.p1,C.p2,C.stdMultiplier??1);if(!b)return;const g=C.primitive;g.mid1={rawTime:b.p1.rawTime,price:b.p1.price},g.mid2={rawTime:b.p2.rawTime,price:b.p2.price},g.top1={rawTime:b.top1.rawTime,price:b.top1.price},g.top2={rawTime:b.top2.rawTime,price:b.top2.price},g.bot1={rawTime:b.bot1.rawTime,price:b.bot1.price},g.bot2={rawTime:b.bot2.rawTime,price:b.bot2.price},C.p1=b.p1,C.p2=b.p2,C.top1=b.top1,C.top2=b.top2,C.bot1=b.bot1,C.bot2=b.bot2,C.slope=b.slope,C.stdDev=b.stdDev,C.offset=b.offset,C.barCount=b.barCount;return}if(C.type==="andrewspitchfork"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="gannfan"||C.type==="ganngrid")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if((C.type==="circle"||C.type==="ellipse")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type==="triangle"&&C.primitive&&C.p1&&C.p2&&C.p3){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$),g=Re(C.p3.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.p3.rawTime=g,C.p3.normalizedTime=te(g),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price},C.primitive.p3={rawTime:g,price:C.p3.price};return}if((C.type==="fibonacci"||C.type==="rectangle")&&C.primitive&&C.p1&&C.p2){const U=Re(C.p1.rawTime,$),b=Re(C.p2.rawTime,$);C.p1.rawTime=U,C.p1.normalizedTime=te(U),C.p2.rawTime=b,C.p2.normalizedTime=te(b),C.primitive.p1={rawTime:U,price:C.p1.price},C.primitive.p2={rawTime:b,price:C.p2.price};return}if(C.type!=="trendline"&&C.type!=="gannline"||!C.series||!C.point1||!C.point2)return;const B=C.type==="gannline"?"#7aa6ae":"#22c55e";try{d.removeSeries(C.series)}catch{}const f=d.addLineSeries({color:C.lineColor??B,lineWidth:C.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),L=C.point1.rawTime??C.point1.time,w=C.point2.rawTime??C.point2.time,p=Re(L,$),_=Re(w,$);C.point1.time=p,C.point2.time=_;const P=DA([{time:p,value:C.point1.price},{time:_,value:C.point2.price}]);try{P.length>0&&f.setData(P)}catch{}if(C.decoration)try{f.attachPrimitive(C.decoration)}catch{}C.series=f}),O&&me.current)setTimeout(()=>{try{u.setVisibleRange(O),Ie(O)}catch{if(Ne.length>0)try{const B=Ne[Ne.length-1].time,f=BA(Te)||60,L=B-100*f;u.setVisibleRange({from:L,to:B+f*Dd}),Ie(u.getVisibleRange())}catch{u.fitContent(),Ie(u.getVisibleRange())}}try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!me.current){u.fitContent();try{d.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}me.current=!0,Ie(u.getVisibleRange())}},[be,Ne.length,Cl.length,ye,Ke]),Y.useEffect(()=>{const d=c.current,u=v.current;if(!d||!u||!me.current||Ne.length===0||be!=="volume"&&be!=="volume ticks")return;const ce=[...Ne].sort((y,R)=>y.time-R.time)?.map(y=>({time:y.time,value:y.volume||0,color:y.close>=y.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));ce.length>0&&u.setData(ce)},[Ne,be]),Y.useEffect(()=>{if(!ye||!Te||!Ct)return;const u=Object.entries(Ct).filter(([X,se])=>se).map(([X])=>X).filter(X=>X.startsWith("sma")||X.startsWith("ema")||X==="rsi"||X==="macd");if(u.length===0){et({});return}const O=u.map(X=>X==="sma20"?`sma:${Ut?.smaPeriod||20}`:X==="sma50"?"sma:50":X==="ema12"?`ema:${Ut?.emaPeriod||12}`:X==="rsi"?`rsi:${Ut?.rsiPeriod||14}`:X==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!O)return;const ce=++bt.current,y=Yt||"http://localhost:5002",R=Qt?.indicators||"/api/market-data/indicators",V=localStorage.getItem("token")??localStorage.getItem("authToken");Bt.get(`${y}${R}`,{params:{symbol:ye,timeframe:Te,indicators:O},headers:V?{Authorization:`Bearer ${V}`}:{}}).then(X=>{ce===bt.current&&et(X.data?.data||{})}).catch(X=>{console.error("[ChartArea] Indicator fetch error:",X?.message),ce===bt.current&&et({})})},[ye,Te,Ct,Ut,Yt,Qt]),Y.useEffect(()=>{const d=c.current;if(!d||!me.current)return;const u=_e.current,O=(D,$)=>(u[D]||(u[D]=d.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...$})),u[D]),ce=D=>{if(u[D]){try{d.removeSeries(u[D])}catch{}delete u[D]}},y=()=>{["macdLine","macdSignal","macdHist"].forEach(ce)},R=Ct||{};if(R.sma20&&Je.sma20?.data?.length?O("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Je.sma20.data.map($=>({time:$.time,value:$.value}))):ce("sma20"),R.sma50&&Je.sma50?.data?.length?O("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Je.sma50.data.map($=>({time:$.time,value:$.value}))):ce("sma50"),R.ema12&&Je.ema12?.data?.length?O("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Je.ema12.data.map($=>({time:$.time,value:$.value}))):ce("ema12"),R.rsi&&Je.rsi?.data?.length){const D=O("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:f=>f.toFixed(1)}});d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),D.setData(Je.rsi.data.map(f=>({time:f.time,value:f.value}))),u.rsi70||(u.rsi70=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),u.rsi30||(u.rsi30=d.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const $=Je.rsi.data,C=$[0]?.time,B=$[$.length-1]?.time;C&&B&&(u.rsi70.setData([{time:C,value:70},{time:B,value:70}]),u.rsi30.setData([{time:C,value:30},{time:B,value:30}]))}else ce("rsi"),ce("rsi70"),ce("rsi30");if(R.macd&&Je.macd?.data?.length){const D=O("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}),$=O("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});u.macdHist||(u.macdHist=d.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:f=>f.toFixed(4)}}));const C=R.rsi?.65:.8;d.priceScale("macd").applyOptions({scaleMargins:{top:C,bottom:0},borderVisible:!1,autoScale:!0}),R.rsi&&d.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const B=Je.macd.data;D.setData(B.map(f=>({time:f.time,value:f.value}))),$.setData(B.map(f=>({time:f.time,value:f.signal}))),u.macdHist.setData(B.map(f=>({time:f.time,value:f.histogram,color:f.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else y();const V=()=>{["bbUpper","bbMiddle","bbLower"].forEach(ce)};if(R.bollinger){const D=Array.from(oi.current.values()).sort((f,L)=>f.time-L.time),$=Ve.current?.bbPeriod||20,C=Ve.current?.bbStdDev||2,B=Ml(D,$,C);if(B){const f=O("bbUpper",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2}),L=O("bbMiddle",{color:"rgba(33,150,243,0.8)",lineWidth:1.5}),w=O("bbLower",{color:"rgba(33,150,243,0.5)",lineWidth:1,lineStyle:2});f.setData(B.upper),L.setData(B.middle),w.setData(B.lower)}}else V();const X=Array.from(oi.current.values()).sort((D,$)=>D.time-$.time);if(X.length>0){const D=Ve.current||{};if(R.sma20&&u.sma20){const $=Vs(X,D.smaPeriod||20);if($)try{u.sma20.update($)}catch{}}if(R.sma50&&u.sma50){const $=Vs(X,50);if($)try{u.sma50.update($)}catch{}}if(R.ema12&&u.ema12){const $=Nd(X,D.emaPeriod||12);if($)try{u.ema12.update($)}catch{}}if(R.rsi&&u.rsi){const $=Kd(X,D.rsiPeriod||14);if($){try{u.rsi.update($)}catch{}if(u.rsi70)try{u.rsi70.update({time:$.time,value:70})}catch{}if(u.rsi30)try{u.rsi30.update({time:$.time,value:30})}catch{}}}if(R.macd&&u.macdLine){const $=zd(X,12,26,9);if($){try{u.macdLine.update({time:$.time,value:$.value})}catch{}try{u.macdSignal.update({time:$.time,value:$.signal})}catch{}try{u.macdHist.update({time:$.time,value:$.histogram,color:$.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})}catch{}}}if(R.bollinger&&u.bbMiddle){const $=qs(X,D.bbPeriod||20,D.bbStdDev||2);if($){try{u.bbUpper.update({time:$.time,value:$.upper})}catch{}try{u.bbMiddle.update({time:$.time,value:$.middle})}catch{}try{u.bbLower.update({time:$.time,value:$.lower})}catch{}}}}const se=R.rsi&&Je.rsi?.data?.length||R.macd&&Je.macd?.data?.length,E=R.rsi&&Je.rsi?.data?.length&&R.macd&&Je.macd?.data?.length;try{d.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:E?.4:se?.25:.05}})}catch{}},[Je,Ct,Ne.length]),Y.useEffect(()=>()=>{const d=c.current;if(!d)return;const u=_e.current;Object.keys(u).forEach(O=>{try{d.removeSeries(u[O])}catch{}}),_e.current={}},[ye,Te]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current;if(!d||!u||!O)return;const y=We!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,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"][We]:null,R=(E,D)=>{const $=Math.min(E.time,D.time),C=Math.max(E.time,D.time),B=E.time<=D.time?E.rawTime:D.rawTime,f=E.time<=D.time?D.rawTime:E.rawTime,L=Math.max(E.price,D.price),w=Math.min(E.price,D.price),p=te(Math.round(($+C)/2));return p==null?null:{p1:{rawTime:p,normalizedTime:p,price:L},p2:{rawTime:B,normalizedTime:$,price:w},p3:{rawTime:f,normalizedTime:C,price:w}}};if(!y){if(T.current=!1,S.current=null,I.current=null,N.current=null,Q.current?.series)try{d.removeSeries(Q.current.series)}catch{}if(Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null;return}if(y==="pricelevel"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const p={type:"pricelevel",priceLine:u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:L.toFixed(5)}),price:L,showPrice:!0,showText:!1};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>{O.removeEventListener("click",E)}}if(y==="horizontalray"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new gd(L,f);u.attachPrimitive(w);const p=u.createPriceLine({price:L,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof L=="number"?L.toFixed(5):""}),_=te(f),P={type:"horizontalray",primitive:w,priceLine:p,price:L,originTime:_,rawOriginTime:f,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};He(U=>[...U,P]),x.current.push(P),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="verticalline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=d.timeScale().coordinateToTime(C);if(B==null)return;const f=new Ld(B);u.attachPrimitive(f);const L=te(B),w={type:"verticalline",primitive:f,time:L,rawTime:B,lineColor:"#3b82f6",lineWidth:2,showDate:!0};He(p=>[...p,w]),x.current.push(w),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="text"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=new Id(f,L);u.attachPrimitive(w);const p={type:"text",primitive:w,rawTime:f,price:L,text:"Text"};He(_=>[..._,p]),x.current.push(p),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="infoline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;D||(D=d.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=P<=U?[{time:P,value:E.price},{time:U,value:_}]:[{time:U,value:_},{time:P,value:E.price}];try{D.setData(b)}catch{}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p),x:L,y:w};return}if(D){try{d.removeSeries(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;const b=_-E.price,g=b/Math.abs(E.price)*100,M=BA(Te)||3600,k=Math.abs(U-P),K=Math.max(1,Math.round(k/M)),W=Math.max(1,Math.round(k/86400)),Z=E.x,Ae=E.y,he=L,Ce=Math.atan2(-(w-Ae),he-Z)*(180/Math.PI),Ue={priceDiff:b,pricePct:g,bars:K,days:W,angle:Ce},qe=new wd({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_},Ue);u.attachPrimitive(qe);const rt={type:"infoline",primitive:qe,rawP1Time:E.rawTime,rawP2Time:p,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};He(Xe=>[...Xe,rt]),x.current.push(rt),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{d.removeSeries(D)}catch{}}}if(y==="rulerline"){let E=null,D=null;const $=(f,L,w,p)=>{const _=te(f),P=te(w),U=p-L,b=U/Math.abs(L)*100,g=zs(Rs,f,w,Te),M=Math.abs((P??0)-(_??0)),k=Math.max(1,Math.round(M/86400));return{priceDiff:U,pricePct:b,bars:g,days:k}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null||U===E.normalizedTime)return;const b=$(E.rawTime,E.price,_,P);if(!D)D=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},b),u.attachPrimitive(D);else{D.p2={rawTime:_,price:P},D.info=b;const g=P>=E.price;D.color=g?"#3b82f6":"#ef5350",D.fillColor=g?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;if(!E){E={rawTime:_,price:P,normalizedTime:te(_)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const U=E.normalizedTime,b=te(_);if(U==null||b==null)return;const g=$(E.rawTime,E.price,_,P),M=new cl({rawTime:E.rawTime,price:E.price},{rawTime:_,price:P},g);u.attachPrimitive(M);const k={type:"rulerline",primitive:M,rawP1Time:E.rawTime,rawP2Time:_,p1:{rawTime:E.rawTime,normalizedTime:U,price:E.price},p2:{rawTime:_,normalizedTime:b,price:P},lineColor:P>=E.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="arrowedline"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;const P=te(p);if(!(P==null||P===E.normalizedTime))if(!D)D=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{c.current?.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null||P===U)return;const b=new hl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"arrowedline",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_},lineColor:"#f59e0b",lineWidth:2,arrowLeft:!1,arrowRight:!0,rayLeft:!1,rayRight:!1,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(y==="rayline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Td({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"rayline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="extendedline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new bd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"extendedline",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!0,rayRight:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!1,statsPriceRange:!1,statsBarsRange:!1,statsDateRange:!1,statsAngle:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="crossline"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=new Qd({rawTime:f,price:L});u.attachPrimitive(p);const _={type:"crossline",primitive:p,p:{rawTime:f,normalizedTime:w,price:L},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};He(P=>[...P,_]),x.current.push(_),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendbyangle"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=C+140,p=d.timeScale().coordinateToTime(w);if(p==null)return;const _=te(f),P=te(p);if(_==null||P==null)return;const U=new Fd({rawTime:f,price:L},{rawTime:p,price:L});u.attachPrimitive(U);const b={type:"trendbyangle",primitive:U,p1:{rawTime:f,normalizedTime:_,price:L},p2:{rawTime:p,normalizedTime:P,price:L},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};He(g=>[...g,b]),x.current.push(b),De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="disjointchannel"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new Ns(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;const K=(E.price+D.price)/2;M>=K?($={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:2*K-M}):(C={rawTime:g,normalizedTime:k,price:M},$={rawTime:g,normalizedTime:k,price:2*K-M}),L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new Ns(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="flattopbottom"){let E=null,D=null,$=null,C=null,B=0,f=null;const L=(_,P,U,b)=>{if(!f)f=new ul(_,P,U,b),u.attachPrimitive(f);else{f.p1=_,f.p2=P,f.p3=U,f.p4=b;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(B===0||!E)return;const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top;if(B===1){const g=u.coordinateToPrice(b);if(g==null)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:g},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===2&&D){const g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k==null)return;$={rawTime:g,normalizedTime:k,price:M},C={rawTime:g,normalizedTime:k,price:D.price},L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:$.rawTime,price:$.price},{rawTime:C.rawTime,price:C.price})}},p=_=>{const P=O.getBoundingClientRect(),U=_.clientX-P.left,b=_.clientY-P.top,g=d.timeScale().coordinateToTime(U),M=u.coordinateToPrice(b);if(g==null||M==null)return;const k=te(g);if(k!=null){if(B===0){E={rawTime:g,normalizedTime:k,price:M},D={rawTime:g,normalizedTime:k,price:M},B=1,L({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price},{rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.price});return}if(B===1){const K=u.coordinateToPrice(b);if(K==null||Math.abs(K-E.price)<1e-7)return;D={rawTime:E.rawTime,normalizedTime:E.normalizedTime,price:K},B=2;return}if(B===2&&f){try{u.detachPrimitive(f)}catch{}const K=new ul(f.p1,f.p2,f.p3,f.p4);u.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:E,p2:D,p3:{rawTime:f.p3.rawTime,normalizedTime:te(f.p3.rawTime),price:f.p3.price},p4:{rawTime:f.p4.rawTime,normalizedTime:te(f.p4.rawTime),price:f.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};He(Z=>[...Z,W]),x.current.push(W),De(null)}}};return O.addEventListener("mousemove",w),O.addEventListener("click",p),()=>{if(O.removeEventListener("mousemove",w),O.removeEventListener("click",p),f)try{u.detachPrimitive(f)}catch{}}}if(y==="regressionchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(g)if(!D)D=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Jr(Ne,E,{rawTime:_,normalizedTime:U},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new Ks({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"regressionchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,intercept:g.intercept,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="stddevchannel"){let E=null,D=null;const $=(f,L)=>{f.mid1={rawTime:L.p1.rawTime,price:L.p1.price},f.mid2={rawTime:L.p2.rawTime,price:L.p2.price},f.top1={rawTime:L.top1.rawTime,price:L.top1.price},f.top2={rawTime:L.top2.rawTime,price:L.top2.price},f.bot1={rawTime:L.bot1.rawTime,price:L.bot1.price},f.bot2={rawTime:L.bot2.rawTime,price:L.bot2.price}},C=f=>{if(!E)return;const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(g)if(!D)D=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),u.attachPrimitive(D);else{$(D,g);try{d.applyOptions({})}catch{}}},B=f=>{const L=O.getBoundingClientRect(),w=f.clientX-L.left,p=f.clientY-L.top,_=d.timeScale().coordinateToTime(w),P=u.coordinateToPrice(p);if(_==null||P==null)return;const U=te(_);if(U==null)return;if(!E){E={rawTime:_,normalizedTime:U,price:P};return}const g=Zr(Ne,E,{rawTime:_,normalizedTime:U,price:P},1);if(!g)return;if(D){try{u.detachPrimitive(D)}catch{}D=null}const M=new dl({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});u.attachPrimitive(M);const k={type:"stddevchannel",primitive:M,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};He(K=>[...K,k]),x.current.push(k),E=null,De(null)};return O.addEventListener("mousemove",C),O.addEventListener("click",B),()=>{if(O.removeEventListener("mousemove",C),O.removeEventListener("click",B),D)try{u.detachPrimitive(D)}catch{}}}if(y==="andrewspitchfork"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p=C+140,_=d.timeScale().coordinateToTime(p);if(_==null)return;const P=te(_);if(P==null)return;const U={rawTime:f,normalizedTime:w,price:L},b={rawTime:_,normalizedTime:P,price:L},g={rawTime:f,normalizedTime:w,price:L},M=new Ud({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:g.rawTime,price:g.price});u.attachPrimitive(M);const k={type:"andrewspitchfork",primitive:M,p1:U,p2:b,p3:g};He(K=>[...K,k]),x.current.push(k),z(k),fe.current=k,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="gannfan"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Sd({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"gannfan",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="ganngrid"){const E=D=>{const $=O.getBoundingClientRect(),C=D.clientX-$.left,B=D.clientY-$.top,f=d.timeScale().coordinateToTime(C),L=u.coordinateToPrice(B);if(f==null||L==null)return;const w=te(f);if(w==null)return;const p={rawTime:f,normalizedTime:w,price:L},_={rawTime:f,normalizedTime:w,price:L},P=new Ed({rawTime:p.rawTime,price:p.price},{rawTime:_.rawTime,price:_.price});u.attachPrimitive(P);const U={type:"ganngrid",primitive:P,p1:p,p2:_};He(b=>[...b,U]),x.current.push(U),z(U),fe.current=U,De(null)};return O.addEventListener("click",E),()=>O.removeEventListener("click",E)}if(y==="trendline"||y==="gannline"){const E=y,D=E==="gannline"?"#7aa6ae":"#22c55e",$=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(!(P==null||U==null)&&(P=te(P),P!=null))if(N.current===null){N.current={time:P,price:U};const b=d.addLineSeries({color:D,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:E,series:b},b.setData([{time:P,value:U}])}else{const b=N.current,g={time:P,price:U},M=1,k=1e-5,K=Math.abs(g.time-b.time),W=Math.abs(g.price-b.price);if(K<M&&W<k){try{d.removeSeries(Q.current.series)}catch{}N.current=null,Q.current=null;return}const Z={time:b.time,rawTime:b.time,price:b.price},Ae={time:g.time,rawTime:g.time,price:g.price},he=DA([{time:Z.time,value:Z.price},{time:Ae.time,value:Ae.price}]);if(he.length>0){Q.current.series.setData(he);const Be=new xd(Z,Ae,D,2);try{Q.current.series.attachPrimitive(Be)}catch{}const Ce={type:E,series:Q.current.series,point1:Z,point2:Ae,decoration:Be};He(Ue=>[...Ue,Ce]),x.current.push(Ce)}De(null),N.current=null,Q.current=null}},C=L=>{if(N.current===null||Q.current?.type!=="trendline"&&Q.current?.type!=="gannline")return;L.preventDefault(),L.stopPropagation();const w=O.getBoundingClientRect(),p=L.clientX-w.left,_=L.clientY-w.top;let P=d.timeScale().coordinateToTime(p);const U=u.coordinateToPrice(_);if(P==null||U==null||(P=te(P),P==null))return;const b=N.current,g=DA([{time:b.time,value:b.price},{time:P,value:U}]);g.length>0&&Q.current.series.setData(g)},B=L=>{L.stopPropagation()},f={capture:!0,passive:!1};return O.addEventListener("click",$,f),O.addEventListener("mousemove",C,f),O.addEventListener("mousemove",B,f),()=>{if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}O.removeEventListener("click",$,f),O.removeEventListener("mousemove",C,f),O.removeEventListener("mousemove",B,f)}}if(y==="parallellines"){let E=null,D=null,$=null,C=0,B=null;const f=(U,b,g,M)=>{U.p1={rawTime:b.rawTime,price:b.price},U.p2={rawTime:g.rawTime,price:g.price},U.b1={rawTime:M.b1.rawTime,price:M.b1.price},U.b2={rawTime:M.b2.rawTime,price:M.b2.price},U.p3={rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}},L=(U,b,g)=>{const M=Od(U,b,g);if(!M)return null;if(!B)B=new pl({rawTime:U.rawTime,price:U.price},{rawTime:b.rawTime,price:b.price},{rawTime:M.b1.rawTime,price:M.b1.price},{rawTime:M.b2.rawTime,price:M.b2.price},{rawTime:M.bottomMid.rawTime,price:M.bottomMid.price}),u.attachPrimitive(B);else{f(B,U,b,M);try{d.applyOptions({})}catch{}}return M},w=U=>{U.preventDefault(),U.stopPropagation(),U.stopImmediatePropagation();const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===0){E={rawTime:k,normalizedTime:W,price:K},C=1;return}if(C===1){if(D={rawTime:k,normalizedTime:W,price:K},Math.abs(D.normalizedTime-E.normalizedTime)<1)return;const Z=te((E.normalizedTime+D.normalizedTime)/2);if(Z==null)return;const Ae=(E.price+D.price)/2;$={rawTime:Z,normalizedTime:Z,price:Ae},L(E,D,$),C=2;return}if(C===2&&E&&D){$={rawTime:k,normalizedTime:W,price:K};const Z=L(E,D,$);if(!Z||!B)return;try{u.detachPrimitive(B)}catch{}const Ae=new pl({rawTime:E.rawTime,price:E.price},{rawTime:D.rawTime,price:D.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});u.attachPrimitive(Ae);const he={type:"equidistantchannel",primitive:Ae,p1:E,p2:D,p3:Z.bottomMid,b1:Z.b1,b2:Z.b2,bottomMid:Z.bottomMid};He(Be=>[...Be,he]),x.current.push(he),De(null),C=0,E=null,D=null,$=null,B=null}}},p=U=>{if(C===0||!E)return;const b=O.getBoundingClientRect(),g=U.clientX-b.left,M=U.clientY-b.top,k=d.timeScale().coordinateToTime(g),K=u.coordinateToPrice(M);if(k==null||K==null)return;const W=te(k);if(W!=null){if(C===1){const Z={rawTime:k,normalizedTime:W,price:K},Ae=te((E.normalizedTime+Z.normalizedTime)/2);if(Ae==null)return;const he=(E.price+Z.price)/2;L(E,Z,{rawTime:Ae,price:he});return}C===2&&D&&L(E,D,{rawTime:k,price:K})}},_=U=>{U.stopPropagation()},P={capture:!0,passive:!1};return O.addEventListener("click",w,P),O.addEventListener("mousemove",p,P),O.addEventListener("mousemove",_,P),()=>{if(C=0,E=null,D=null,$=null,J.current=[],B)try{u.detachPrimitive(B)}catch{}B=null,O.removeEventListener("click",w,P),O.removeEventListener("mousemove",p,P),O.removeEventListener("mousemove",_,P)}}if(y==="fibonacci"){let E=null,D=null;const $=B=>{if(!E)return;const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(!(p==null||_==null))if(!D)D=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_}),u.attachPrimitive(D);else{D.p2={rawTime:p,price:_};try{d.applyOptions({})}catch{}}},C=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=d.timeScale().coordinateToTime(L),_=u.coordinateToPrice(w);if(p==null||_==null)return;if(!E){E={rawTime:p,price:_,normalizedTime:te(p)};return}if(D){try{u.detachPrimitive(D)}catch{}D=null}const P=E.normalizedTime,U=te(p);if(P==null||U==null)return;if(Math.abs(_-E.price)<1e-5){E=null;return}const b=new fl({rawTime:E.rawTime,price:E.price},{rawTime:p,price:_});u.attachPrimitive(b);const g={type:"fibonacci",primitive:b,p1:{rawTime:E.rawTime,normalizedTime:P,price:E.price},p2:{rawTime:p,normalizedTime:U,price:_}};He(M=>[...M,g]),x.current.push(g),E=null,De(null)};return O.addEventListener("mousemove",$),O.addEventListener("click",C),()=>{if(O.removeEventListener("mousemove",$),O.removeEventListener("click",C),D)try{u.detachPrimitive(D)}catch{}}}if(N.current=null,(Q.current?.type==="trendline"||Q.current?.type==="gannline")&&Q.current?.series){try{d.removeSeries(Q.current.series)}catch{}Q.current=null}const V=E=>{if(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),y==="trendline"||y==="gannline"||y==="parallellines"||y==="fibonacci"||y!=="rectangle"&&y!=="circle"&&y!=="triangle"&&y!=="ellipse")return;const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B!=null){if(T.current=!0,S.current={time:B,normalizedTime:B,rawTime:L,price:f},I.current=null,y==="rectangle"){const w=new Bd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"rectangle",primitive:w}}if(y==="circle"){const w=new yd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1});u.attachPrimitive(w),Q.current={type:"circle",primitive:w}}if(y==="triangle"){const w=new Cd({rawTime:L,price:f},{rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});u.attachPrimitive(w),Q.current={type:"triangle",primitive:w}}if(y==="ellipse"){const w=new vd({rawTime:L,price:f},{rawTime:L,price:f},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});u.attachPrimitive(w),Q.current={type:"ellipse",primitive:w}}if(y==="parallellines"){const w=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});Q.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},X=E=>{if(!T.current||!S.current||!Q.current)return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();const D=O.getBoundingClientRect(),$=E.clientX-D.left,C=E.clientY-D.top;let B=d.timeScale().coordinateToTime($);const f=u.coordinateToPrice(C);if(B==null||f==null)return;const L=B;if(B=te(B),B==null)return;I.current={time:B,normalizedTime:B,rawTime:L,price:f};const w=S.current;if(Q.current.type==="rectangle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="circle"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="triangle"){const p=Q.current.primitive,_=R(w,{time:B,rawTime:L,price:f});if(!_)return;p.p1={rawTime:_.p1.rawTime,price:_.p1.price},p.p2={rawTime:_.p2.rawTime,price:_.p2.price},p.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="ellipse"){const p=Q.current.primitive;p.p1={rawTime:w.rawTime,price:w.price},p.p2={rawTime:L,price:f};try{c.current?.applyOptions({})}catch{}}if(Q.current.type==="parallellines")if(Q.current.firstLine){const p=Q.current.firstLine;p.endTime-p.startTime;const _=p.endPrice-p.startPrice,P=f,U=P+_;if(Q.current.secondLine)Q.current.secondLine.setData([{time:w.time,value:P},{time:B,value:U}]);else{const b=d.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});b.setData([{time:w.time,value:P},{time:B,value:U}]),Q.current.secondLine=b}}else Q.current.series.setData([{time:w.time,value:w.price},{time:B,value:f}])},se=E=>{if(E&&(E.preventDefault(),E.stopPropagation()),!T.current||!Q.current||!S.current)return;const D=S.current,$=I.current||D;if(Q.current.type==="parallellines")if(Q.current.firstLine){const C={type:"parallellines",firstLine:Q.current.series,secondLine:Q.current.secondLine,firstLineData:Q.current.firstLine};He(B=>[...B,C]),x.current.push(C),De(null),Q.current=null,T.current=!1,S.current=null,I.current=null;return}else{Q.current.firstLine={startTime:D.time,startPrice:D.price,endTime:$.time,endPrice:$.price},T.current=!1,S.current=null,I.current=null;return}if(Q.current.type==="rectangle"){const C=S.current,B=I.current||C,f=Math.max(C.price,B.price),L=Math.min(C.price,B.price),w=te(Math.min(C.time,B.time)),p=te(Math.max(C.time,B.time));if(w!=null&&p!=null&&Math.abs(p-w)>=1&&Math.abs(f-L)>=1e-5){const _=Q.current.primitive,P=C.time<=B.time?C.rawTime:B.rawTime,U=C.time<=B.time?B.rawTime:C.rawTime,b={rawTime:P,normalizedTime:w,price:f},g={rawTime:U,normalizedTime:p,price:L};_.p1={rawTime:b.rawTime,price:b.price},_.p2={rawTime:g.rawTime,price:g.price};const M={type:"rectangle",primitive:_,p1:b,p2:g};He(k=>[...k,M]),x.current.push(M),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="circle"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=3){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price};const U={type:"circle",primitive:C,p1:B,p2:f};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="triangle"){const C=Q.current.primitive,B=R(D,$);if(B){const f=Math.abs(B.p3.normalizedTime-B.p2.normalizedTime),L=Math.abs(B.p1.price-B.p2.price);if(f>=1&&L>=1e-5){C.p1={rawTime:B.p1.rawTime,price:B.p1.price},C.p2={rawTime:B.p2.rawTime,price:B.p2.price},C.p3={rawTime:B.p3.rawTime,price:B.p3.price};const w={type:"triangle",primitive:C,p1:B.p1,p2:B.p2,p3:B.p3};He(p=>[...p,w]),x.current.push(w),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}else try{u.detachPrimitive(Q.current.primitive)}catch{}}if(Q.current.type==="ellipse"){const C=Q.current.primitive,B={rawTime:D.rawTime,normalizedTime:D.time,price:D.price},f={rawTime:$.rawTime,normalizedTime:$.time,price:$.price},L=d.timeScale().timeToCoordinate(B.rawTime),w=u.priceToCoordinate(B.price),p=d.timeScale().timeToCoordinate(f.rawTime),_=u.priceToCoordinate(f.price);if((L!=null&&w!=null&&p!=null&&_!=null?Math.hypot(p-L,_-w):0)>=4){C.p1={rawTime:B.rawTime,price:B.price},C.p2={rawTime:f.rawTime,price:f.price},C.previewAsLine=!1,C.minorRatio=.45;const U={type:"ellipse",primitive:C,p1:B,p2:f,minorRatio:.45};He(b=>[...b,U]),x.current.push(U),De(null)}else try{u.detachPrimitive(Q.current.primitive)}catch{}}T.current=!1,S.current=null,I.current=null,Q.current=null};if(y==="rectangle"||y==="circle"||y==="triangle"||y==="ellipse"){const E={capture:!0,passive:!1},D=$=>{T.current||$.stopPropagation()};return O.addEventListener("mousedown",V,E),O.addEventListener("mousemove",X,E),O.addEventListener("mousemove",D,E),O.addEventListener("mouseup",se,E),()=>{if((Q.current?.type==="rectangle"||Q.current?.type==="circle"||Q.current?.type==="triangle"||Q.current?.type==="ellipse")&&Q.current?.primitive)try{u.detachPrimitive(Q.current.primitive)}catch{}Q.current=null,T.current=!1,S.current=null,I.current=null,O.removeEventListener("mousedown",V,E),O.removeEventListener("mousemove",X,E),O.removeEventListener("mousemove",D,E),O.removeEventListener("mouseup",se,E)}}},[We,Ne,He,De]),Y.useEffect(()=>{const d=c.current,u=h.current,O=o.current,ce=We===null||We===1;if(!ce||!d||!u||!O){ce||(z(null),G([]),le(null),we([]));return}const y=10,R=8;function V(B){if(!B)return[];if(B.type==="trendline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="gannline"&&B.point1&&B.point2){const f=d.timeScale().timeToCoordinate(B.point1.time),L=u.priceToCoordinate(B.point1.price),w=d.timeScale().timeToCoordinate(B.point2.time),p=u.priceToCoordinate(B.point2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="rectangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=Math.min(f,w),P=Math.max(f,w),U=Math.min(L,p),b=Math.max(L,p),g=(_+P)/2,M=(U+b)/2;return[{x:_,y:U},{x:g,y:U},{x:P,y:U},{x:_,y:M},{x:P,y:M},{x:_,y:b},{x:g,y:b},{x:P,y:b}]}if(B.type==="circle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="triangle"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="ellipse"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);if(f==null||L==null||w==null||p==null)return[];const _=(f+w)/2,P=(L+p)/2,U=w-f,b=p-L,g=Math.hypot(U,b);if(g<.001)return[];const M=U/g,k=b/g,K=-k,W=M,Z=g/2,Ae=Z*Math.max(.05,B.minorRatio??.45);return[{x:_-M*Z,y:P-k*Z},{x:_+K*Ae,y:P+W*Ae},{x:_+M*Z,y:P+k*Z},{x:_-K*Ae,y:P-W*Ae}]}if(B.type==="gannfan"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="ganngrid"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="arrowedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="rayline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="extendedline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="crossline"&&B.p){const f=d.timeScale().timeToCoordinate(B.p.rawTime),L=u.priceToCoordinate(B.p.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="pricelevel"&&B.price!=null){const f=u.priceToCoordinate(B.price);return f==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:f}]}if(B.type==="text"&&B.rawTime!=null&&B.price!=null){const f=d.timeScale().timeToCoordinate(B.rawTime),L=u.priceToCoordinate(B.price);return f==null||L==null?[]:[{x:f,y:L}]}if(B.type==="trendbyangle"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="andrewspitchfork"&&B.p1&&B.p2&&B.p3){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price);return f==null||L==null||w==null||p==null||_==null||P==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P}]}if(B.type==="equidistantchannel"&&B.p1&&B.p2&&B.b1&&B.b2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.b1.rawTime),P=u.priceToCoordinate(B.b1.price),U=d.timeScale().timeToCoordinate(B.b2.rawTime),b=u.priceToCoordinate(B.b2.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:(_+U)/2,y:(P+b)/2}]}if(B.type==="regressionchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="stddevchannel"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="disjointchannel"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="flattopbottom"&&B.p1&&B.p2&&B.p3&&B.p4){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price),_=d.timeScale().timeToCoordinate(B.p3.rawTime),P=u.priceToCoordinate(B.p3.price),U=d.timeScale().timeToCoordinate(B.p4.rawTime),b=u.priceToCoordinate(B.p4.price);return f==null||L==null||w==null||p==null||_==null||P==null||U==null||b==null?[]:[{x:f,y:L},{x:w,y:p},{x:_,y:P},{x:U,y:b}]}if(B.type==="infoline"&&B.p1&&B.p2){const f=B.p1.rawTime??B.p1.time,L=B.p2.rawTime??B.p2.time,w=d.timeScale().timeToCoordinate(f),p=u.priceToCoordinate(B.p1.price),_=d.timeScale().timeToCoordinate(L),P=u.priceToCoordinate(B.p2.price);return w==null||p==null||_==null||P==null?[]:[{x:w,y:p},{x:_,y:P}]}if(B.type==="rulerline"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:(f+w)/2,y:(L+p)/2},{x:w,y:p}]}if(B.type==="fibonacci"&&B.p1&&B.p2){const f=d.timeScale().timeToCoordinate(B.p1.rawTime),L=u.priceToCoordinate(B.p1.price),w=d.timeScale().timeToCoordinate(B.p2.rawTime),p=u.priceToCoordinate(B.p2.price);return f==null||L==null||w==null||p==null?[]:[{x:f,y:L},{x:w,y:p}]}if(B.type==="horizontalray"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.originTime),w=u.priceToCoordinate(f.price);return L==null||w==null?[]:[{x:L,y:w}]}if(B.type==="verticalline"&&B.primitive){const f=B.primitive,L=d.timeScale().timeToCoordinate(f.time);if(L==null)return[];const w=f.midYCss??200;return[{x:L,y:w}]}return[]}function X(B,f){for(let L=dt.length-1;L>=0;L--){const w=dt[L];if(w.type==="trendline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const p=d.timeScale().timeToCoordinate(w.point1.time),_=u.priceToCoordinate(w.point1.price),P=d.timeScale().timeToCoordinate(w.point2.time),U=u.priceToCoordinate(w.point2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.min(p,P),g=Math.max(p,P),M=Math.min(_,U),k=Math.max(_,U),K=(b+g)/2,W=(M+k)/2,Z=[{x:b,y:M,mode:"handle1"},{x:K,y:M,mode:"handle2"},{x:g,y:M,mode:"handle3"},{x:b,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x:b,y:k,mode:"handle6"},{x:K,y:k,mode:"handle7"},{x:g,y:k,mode:"handle8"}];for(const Ue of Z)if(Math.hypot(B-Ue.x,f-Ue.y)<y)return{object:w,mode:Ue.mode};const Ae=ut(B,f,b,M,g,M),he=ut(B,f,b,k,g,k),Be=ut(B,f,b,M,b,k),Ce=ut(B,f,g,M,g,k);if(Ae<R||he<R||Be<R||Ce<R||vi(B,f,[{x:b,y:M},{x:g,y:M},{x:g,y:k},{x:b,y:k}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(P-p,U-_);if(b<2)continue;const g=Math.hypot(B-p,f-_),M=Math.hypot(B-P,f-U);if(g<y)return{object:w,mode:"handle1"};if(M<y)return{object:w,mode:"handle2"};if(Math.abs(g-b)<R||g<b)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=ut(B,f,p,_,P,U),Z=ut(B,f,P,U,b,g),Ae=ut(B,f,b,g,p,_);if(W<R||Z<R||Ae<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=P-p,k=U-_,K=Math.hypot(M,k);if(K<2)continue;const W=M/K,Z=k/K,Ae=-Z,he=W,Be=K/2,Ce=Be*Math.max(.05,w.minorRatio??.45);if(Be<2||Ce<2)continue;const Ue=b-W*Be,qe=g-Z*Be,rt=b+Ae*Ce,Xe=g+he*Ce,vt=b+W*Be,pt=g+Z*Be,Tt=b-Ae*Ce,_t=g-he*Ce,iA=Math.hypot(B-Ue,f-qe),cA=Math.hypot(B-rt,f-Xe),wA=Math.hypot(B-vt,f-pt),qA=Math.hypot(B-Tt,f-_t);if(iA<y)return{object:w,mode:"handle1"};if(cA<y)return{object:w,mode:"handle2"};if(wA<y)return{object:w,mode:"handle3"};if(qA<y)return{object:w,mode:"handle4"};const _i=(B-b)*W+(f-g)*Z,Zs=(B-b)*Ae+(f-g)*he,of=_i/Be,af=Zs/Ce,lf=of*of+af*af;if(Math.abs(lf-1)<.2||lf<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-P,f-U),g=Math.hypot(B-p,f-_);if(b<y)return{object:w,mode:"handle2"};if(g<y)return{object:w,mode:"handle1"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(tb(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(Ab(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const p=d.timeScale().timeToCoordinate(w.p.rawTime),_=u.priceToCoordinate(w.p.price);if(p==null||_==null)continue;if(Math.hypot(B-p,f-_)<y)return{object:w,mode:"handle1"};const U=Math.abs(f-_),b=Math.abs(B-p);if(U<R||b<R)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const p=d.timeScale().timeToCoordinate(w.rawTime),_=u.priceToCoordinate(w.price);if(p==null||_==null)continue;const P=Hd(w,p,_);if(B>=P.left&&B<=P.right&&f>=P.top&&f<=P.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.b1.rawTime),g=u.priceToCoordinate(w.b1.price),M=d.timeScale().timeToCoordinate(w.b2.rawTime),k=u.priceToCoordinate(w.b2.price),K=b!=null&&M!=null?(b+M)/2:null,W=g!=null&&k!=null?(g+k)/2:null;if(p==null||_==null||P==null||U==null||K==null||W==null||b==null||g==null||M==null||k==null)continue;const Z=Math.hypot(B-p,f-_),Ae=Math.hypot(B-P,f-U),he=Math.hypot(B-K,f-W),Be=Math.hypot(p-K,_-W)<y*1.5;if(Be&&Math.min(Z,he)<y*1.5)return{object:w,mode:"handle3"};if(he<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle2"};if(Be)continue;if(Z<y)return{object:w,mode:"handle1"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:P,y:U},{x:M,y:k},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.top1.rawTime),g=u.priceToCoordinate(w.top1.price),M=d.timeScale().timeToCoordinate(w.top2.rawTime),k=u.priceToCoordinate(w.top2.price),K=d.timeScale().timeToCoordinate(w.bot1.rawTime),W=u.priceToCoordinate(w.bot1.price),Z=d.timeScale().timeToCoordinate(w.bot2.rawTime),Ae=u.priceToCoordinate(w.bot2.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null||K==null||W==null||Z==null||Ae==null)continue;const he=Math.hypot(B-p,f-_),Be=Math.hypot(B-P,f-U);if(he<y)return{object:w,mode:"handle1"};if(Be<y)return{object:w,mode:"handle2"};const Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k),qe=ut(B,f,K,W,Z,Ae);if(Ce<R||Ue<R||qe<R||vi(B,f,[{x:b,y:g},{x:M,y:k},{x:Z,y:Ae},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price);if(p==null||_==null||P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"handle3"};const W=(P+b)/2,Z=(U+g)/2;let Ae=W-p,he=Z-_;Math.abs(Ae)<1e-4&&(Ae=1e-4);const Be=he/Ae,Ce=O.clientWidth,Ue=U+Be*(Ce-P),qe=g+Be*(Ce-b),rt=ut(B,f,P,U,Ce,Ue),Xe=ut(B,f,b,g,Ce,qe);if(rt<R||Xe<R||vi(B,f,[{x:P,y:U},{x:Ce,y:Ue},{x:Ce,y:qe},{x:b,y:g}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price),b=d.timeScale().timeToCoordinate(w.p3.rawTime),g=u.priceToCoordinate(w.p3.price),M=d.timeScale().timeToCoordinate(w.p4.rawTime),k=u.priceToCoordinate(w.p4.price);if(p==null||_==null||P==null||U==null||b==null||g==null||M==null||k==null)continue;const K=Math.hypot(B-p,f-_),W=Math.hypot(B-P,f-U),Z=Math.hypot(B-b,f-g),Ae=Math.hypot(B-M,f-k);if(K<y)return{object:w,mode:"handle1"};if(W<y)return{object:w,mode:"handle2"};if(Z<y)return{object:w,mode:"handle3"};if(Ae<y)return{object:w,mode:"handle4"};const he=ut(B,f,p,_,b,g),Be=ut(B,f,P,U,M,k),Ce=ut(B,f,p,_,P,U),Ue=ut(B,f,b,g,M,k);if(he<R||Be<R||Ce<R||Ue<R||vi(B,f,[{x:p,y:_},{x:b,y:g},{x:M,y:k},{x:P,y:U}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=(p+P)/2,g=(_+U)/2,M=Math.hypot(B-p,f-_),k=Math.hypot(B-P,f-U),K=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(K<y)return{object:w,mode:"line"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const p=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,P=d.timeScale().timeToCoordinate(p),U=u.priceToCoordinate(w.p1.price),b=d.timeScale().timeToCoordinate(_),g=u.priceToCoordinate(w.p2.price);if(P==null||U==null||b==null||g==null)continue;const M=Math.hypot(B-P,f-U),k=Math.hypot(B-b,f-g);if(M<y)return{object:w,mode:"handle1"};if(k<y)return{object:w,mode:"handle2"};if(ut(B,f,P,U,b,g)<R)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const p=d.timeScale().timeToCoordinate(w.p1.rawTime),_=u.priceToCoordinate(w.p1.price),P=d.timeScale().timeToCoordinate(w.p2.rawTime),U=u.priceToCoordinate(w.p2.price);if(p==null||_==null||P==null||U==null)continue;const b=Math.hypot(B-p,f-_),g=Math.hypot(B-P,f-U);if(b<y)return{object:w,mode:"handle1"};if(g<y)return{object:w,mode:"handle2"};if(ut(B,f,p,_,P,U)<R)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.originTime),P=u.priceToCoordinate(p.price);if(P==null)continue;if(_!=null&&Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};const U=_==null?0:Math.max(0,_);if(B>=U&&Math.abs(f-P)<R)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const p=w.primitive,_=d.timeScale().timeToCoordinate(p.time);if(_==null)continue;const P=p.midYCss??200;if(Math.hypot(B-_,f-P)<y)return{object:w,mode:"handle1"};if(Math.abs(B-_)<R)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const p=u.priceToCoordinate(w.price);if(p==null)continue;const P=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(B-P,f-p)<y)return{object:w,mode:"line"};if(Math.abs(f-p)<R)return{object:w,mode:"line"}}}return null}const se=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top,p=X(L,w);if(p){if(B.preventDefault(),B.stopPropagation(),B.detail>=2){Qe.current=!0,q(p.object),j.current=null,oe.current=null;return}z(p.object),le(null),we([]),j.current=p.mode,p.object.type==="rayline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="extendedline"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="crossline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,p:{...p.object.p}}),p.object.type==="text"&&p.mode==="line"&&(oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}),p.object.type==="trendbyangle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="equidistantchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="andrewspitchfork"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="regressionchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="stddevchannel"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="disjointchannel"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="flattopbottom"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}),p.object.type==="fibonacci"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="gannfan"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="ganngrid"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="rectangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4"||p.mode==="handle5"||p.mode==="handle6"||p.mode==="handle7"||p.mode==="handle8")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="circle"&&(p.mode==="handle1"||p.mode==="handle2")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}),p.object.type==="triangle"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}),p.object.type==="ellipse"&&(p.mode==="handle1"||p.mode==="handle2"||p.mode==="handle3"||p.mode==="handle4")&&(oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}),p.object.type==="horizontalray"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}),p.object.type==="verticalline"&&(p.mode==="handle1"||p.mode==="line")&&(oe.current={x:L,y:w,time:p.object.primitive.time}),p.mode==="line"&&(p.object.type==="rulerline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="infoline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="arrowedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rayline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="extendedline"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="crossline"?oe.current={x:L,y:w,p:{...p.object.p}}:p.object.type==="text"?oe.current={x:L,y:w,rawTime:p.object.rawTime,price:p.object.price}:p.object.type==="trendbyangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="equidistantchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="andrewspitchfork"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="regressionchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="stddevchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="disjointchannel"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="flattopbottom"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3},p4:{...p.object.p4}}:p.object.type==="fibonacci"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="gannfan"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="rectangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="circle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="triangle"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},p3:{...p.object.p3}}:p.object.type==="ellipse"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2},minorRatio:p.object.minorRatio??.45}:p.object.type==="ganngrid"?oe.current={x:L,y:w,p1:{...p.object.p1},p2:{...p.object.p2}}:p.object.type==="horizontalray"?oe.current={x:L,y:w,price:p.object.primitive.price,originTime:p.object.primitive.originTime}:p.object.type==="verticalline"?oe.current={x:L,y:w,time:p.object.primitive.time}:p.object.type==="pricelevel"?oe.current={y:w,price:p.object.price}:oe.current={x:L,y:w,point1:{...p.object.point1},point2:{...p.object.point2}})}else z(null),j.current=null,G([]),le(null),we([])},E=B=>{const f=O.getBoundingClientRect(),L=B.clientX-f.left,w=B.clientY-f.top;if(!j.current){const b=X(L,w);if(b?.object&&!fe.current){const g=V(b.object);le(M=>M===b.object?M:b.object),we(M=>M.length===g.length&&M.every((k,K)=>k.x===g[K].x&&k.y===g[K].y)?M:g)}else le(g=>g==null?g:null),we(g=>g.length===0?g:[]);return}const p=fe.current;if(!p)return;const _=d.timeScale().coordinateToTime(L),P=u.coordinateToPrice(w);if(_==null||P==null)return;let U=te(_);if(U!=null){if(p.type==="infoline"&&p.p1&&p.p2){const b=K=>{const W=K.rawTime??K.time,Z=K.normalizedTime??te(W);return{rawTime:W,normalizedTime:Z,price:K.price}},g=(K,W)=>{const Z=K.normalizedTime??te(K.rawTime),Ae=W.normalizedTime??te(W.rawTime);if(Z==null||Ae==null)return;const he=W.price-K.price,Be=he/Math.abs(K.price)*100,Ce=BA(Te)||3600,Ue=Math.abs(Ae-Z),qe=Math.max(1,Math.round(Ue/Ce)),rt=Math.max(1,Math.round(Ue/86400)),Xe=d.timeScale().timeToCoordinate(K.rawTime),vt=u.priceToCoordinate(K.price),pt=d.timeScale().timeToCoordinate(W.rawTime),Tt=u.priceToCoordinate(W.price),_t=Xe!=null&&vt!=null&&pt!=null&&Tt!=null?Math.atan2(-(Tt-vt),pt-Xe)*(180/Math.PI):p.primitive?.info?.angle??0,iA={priceDiff:he,pricePct:Be,bars:qe,days:rt,angle:_t},cA=p.primitive;if(cA){cA.p1={rawTime:K.rawTime,price:K.price},cA.p2={rawTime:W.rawTime,price:W.price},cA.info=iA;try{c.current?.applyOptions({})}catch{}}const wA={...p,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:Z,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:Ae,price:W.price}};He(qA=>{const _i=qA.map(Zs=>Zs===p?wA:Zs);return x.current=_i,_i}),z(wA),fe.current=wA,Xe!=null&&vt!=null&&pt!=null&&Tt!=null&&G([{x:Xe,y:vt},{x:pt,y:Tt}])},M=b(p.p1),k=b(p.p2);if(M.rawTime==null||M.normalizedTime==null||k.rawTime==null||k.normalizedTime==null)return;if(j.current==="handle1"){const K=d.timeScale().coordinateToTime(L)??_;g({rawTime:K,normalizedTime:U,price:P},k)}else if(j.current==="handle2"){const K=d.timeScale().coordinateToTime(L)??_;g(M,{rawTime:K,normalizedTime:U,price:P})}else if(j.current==="line"){const K=oe.current;if(!K)return;const W=b(K.p1),Z=b(K.p2);if(W.rawTime==null||W.normalizedTime==null||Z.rawTime==null||Z.normalizedTime==null)return;const Ae=d.timeScale().coordinateToTime(K.x)??W.rawTime,he=u.coordinateToPrice(K.y);if(Ae==null||he==null)return;const Be=te(Ae)??W.normalizedTime;if(Be==null)return;const Ce=U-Be,Ue=P-he,qe=te(W.normalizedTime+Ce),rt=te(Z.normalizedTime+Ce);if(qe==null||rt==null)return;const Xe=_-Ae;g({rawTime:W.rawTime+Xe,normalizedTime:qe,price:W.price+Ue},{rawTime:Z.rawTime+Xe,normalizedTime:rt,price:Z.price+Ue})}return}if(p.type==="rulerline"&&p.p1&&p.p2){const b=(g,M)=>{const k=g.normalizedTime??g.rawTime,K=M.normalizedTime??M.rawTime,W=M.price-g.price,Z=W/Math.abs(g.price)*100,Ae=zs(Rs,g.rawTime,M.rawTime,Te),he=Math.abs(K-k),Be=Math.max(1,Math.round(he/86400)),Ce={priceDiff:W,pricePct:Z,bars:Ae,days:Be},Ue=p.primitive;if(Ue){Ue.p1={rawTime:g.rawTime,price:g.price},Ue.p2={rawTime:M.rawTime,price:M.price},Ue.info=Ce;const Tt=M.price>=g.price;Ue.color=Tt?"#3b82f6":"#ef5350",Ue.fillColor=Tt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const qe={...p,rawP1Time:g.rawTime,rawP2Time:M.rawTime,p1:g,p2:M};He(Tt=>{const _t=Tt.map(iA=>iA===p?qe:iA);return x.current=_t,_t}),z(qe),fe.current=qe;const rt=d.timeScale().timeToCoordinate(g.rawTime),Xe=u.priceToCoordinate(g.price),vt=d.timeScale().timeToCoordinate(M.rawTime),pt=u.priceToCoordinate(M.price);rt!=null&&Xe!=null&&vt!=null&&pt!=null&&G([{x:rt,y:Xe},{x:(rt+vt)/2,y:(Xe+pt)/2},{x:vt,y:pt}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="arrowedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rayline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;b(p.p1,{rawTime:g,normalizedTime:M,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="extendedline"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="crossline"&&p.p){const b=M=>{const k=p.primitive;if(k){k.center={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p:M};He(Ae=>{const he=Ae.map(Be=>Be===p?K:Be);return x.current=he,he}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(M.rawTime),Z=u.priceToCoordinate(M.price);W!=null&&Z!=null&&G([{x:W,y:Z}])},g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P});return}if(p.type==="pricelevel"&&p.price!=null){const b=u.coordinateToPrice(w);if(b==null)return;try{p.priceLine.applyOptions({price:b,title:b.toFixed(5)})}catch{}p.textPrimitive&&(p.textPrimitive.price=b);const g=c.current?c.current.paneSize().width:400,M=u.priceToCoordinate(b);M!=null&&G([{x:g/2,y:M}]);const k={...p,price:b};He(K=>{const W=K.map(Z=>Z===p?k:Z);return x.current=W,W}),z(k),fe.current=k;return}if(p.type==="text"){const b=d.timeScale().coordinateToTime(L);if(b==null)return;const g=p.primitive;if(g){g.rawTime=b,g.price=P;try{c.current?.applyOptions({})}catch{}}const M={...p,rawTime:b,price:P};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M;return}if(p.type==="trendbyangle"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(Be=>{const Ce=Be.map(Ue=>Ue===p?K:Ue);return x.current=Ce,Ce}),z(K),fe.current=K;const W=d.timeScale().timeToCoordinate(g.rawTime),Z=u.priceToCoordinate(g.price),Ae=d.timeScale().timeToCoordinate(M.rawTime),he=u.priceToCoordinate(M.price);W!=null&&Z!=null&&Ae!=null&&he!=null&&G([{x:W,y:Z},{x:Ae,y:he}])};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"||j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="equidistantchannel"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=Od(g,M,k);if(!K)return;const W=p.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.price},W.p2={rawTime:M.rawTime,price:M.price},W.b1={rawTime:K.b1.rawTime,price:K.b1.price},W.b2={rawTime:K.b2.rawTime,price:K.b2.price},W.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const Z={...p,p1:g,p2:M,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};He(Ae=>{const he=Ae.map(Be=>Be===p?Z:Be);return x.current=he,he}),z(Z),fe.current=Z};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??te(p.p3.rawTime),price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,price:g.p3.price+W});return}}if(p.type==="regressionchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Jr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,intercept:k.intercept,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="stddevchannel"&&p.p1&&p.p2){const b=(g,M)=>{const k=Zr(Ne,g,M,p.stdMultiplier??1);if(!k)return;const K=p.primitive;if(K){K.mid1={rawTime:k.p1.rawTime,price:k.p1.price},K.mid2={rawTime:k.p2.rawTime,price:k.p2.price},K.top1={rawTime:k.top1.rawTime,price:k.top1.price},K.top2={rawTime:k.top2.rawTime,price:k.top2.price},K.bot1={rawTime:k.bot1.rawTime,price:k.bot1.price},K.bot2={rawTime:k.bot2.rawTime,price:k.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:k.p1,p2:k.p2,top1:k.top1,top2:k.top2,bot1:k.bot1,bot2:k.bot2,slope:k.slope,stdDev:k.stdDev,offset:k.offset,barCount:k.barCount};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W});return}}if(p.type==="andrewspitchfork"&&p.p1&&p.p2&&p.p3){const b=(g,M,k)=>{const K=p.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.price},K.p2={rawTime:M.rawTime,price:M.price},K.p3={rawTime:k.rawTime,price:k.price};try{c.current?.applyOptions({})}catch{}}const W={...p,p1:g,p2:M,p3:k};He(Z=>{const Ae=Z.map(he=>he===p?W:he);return x.current=Ae,Ae}),z(W),fe.current=W};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2,p.p3);return}if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P},p.p3);return}if(j.current==="handle3"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,p.p2,{rawTime:g,normalizedTime:U,price:P});return}if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K),he=te(g.p3.normalizedTime+K);if(Z==null||Ae==null||he==null)return;const Be=_-M;b({rawTime:g.p1.rawTime+Be,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+Be,normalizedTime:Ae,price:g.p2.price+W},{rawTime:g.p3.rawTime+Be,normalizedTime:he,price:g.p3.price+W});return}}if(p.type==="disjointchannel"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(Z,Ae,g.p3,g.p4);return}if(j.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,Z={rawTime:M,normalizedTime:k,price:P},Ae={rawTime:M,normalizedTime:k,price:2*W-P};b(g.p1,g.p2,Z,Ae);return}if(j.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,Z={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:P};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:2*W-P};if(Ae.normalizedTime==null)return;b(Ae,Z,g.p3,g.p4);return}if(j.current==="handle4"){const W=P-g.p4.price,Z={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+W};if(Z.normalizedTime==null)return;const Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+W};if(Ae.normalizedTime==null)return;b(g.p1,Ae,g.p3,Z);return}}if(p.type==="flattopbottom"&&p.p1&&p.p2&&p.p3&&p.p4){const b=(W,Z,Ae,he)=>{const Be=p.primitive;if(Be){Be.p1={rawTime:W.rawTime,price:W.price},Be.p2={rawTime:Z.rawTime,price:Z.price},Be.p3={rawTime:Ae.rawTime,price:Ae.price},Be.p4={rawTime:he.rawTime,price:he.price};try{c.current?.applyOptions({})}catch{}}const Ce={...p,p1:W,p2:Z,p3:Ae,p4:he};He(Ue=>{const qe=Ue.map(rt=>rt===p?Ce:rt);return x.current=qe,qe}),z(Ce),fe.current=Ce},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;const K=(W,Z,Ae,he)=>{const Be=W.normalizedTime??te(W.rawTime);if(Be==null)return null;const Ce=te(Be+Ae);return Ce==null?null:{rawTime:W.rawTime+Z,normalizedTime:Ce,price:W.price+he}};if(j.current==="line"){const W=d.timeScale().coordinateToTime(g.x),Z=u.coordinateToPrice(g.y);if(W==null||Z==null)return;const Ae=te(W);if(Ae==null)return;const he=M-W,Be=k-Ae,Ce=P-Z,Ue=K(g.p1,he,Be,Ce),qe=K(g.p2,he,Be,Ce),rt=K(g.p3,he,Be,Ce),Xe=K(g.p4,he,Be,Ce);if(!Ue||!qe||!rt||!Xe)return;b(Ue,qe,rt,Xe);return}if(j.current==="handle1"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p2.price};b(W,Z,g.p3,g.p4);return}if(j.current==="handle3"){const W={rawTime:M,normalizedTime:k,price:P},Z={rawTime:M,normalizedTime:k,price:g.p4.price};b(g.p1,g.p2,W,Z);return}if(j.current==="handle2"||j.current==="handle4"){const W=j.current==="handle2"?g.p2:g.p4,Z=P-W.price,Ae={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??te(g.p1.rawTime),price:g.p2.price+Z},he={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??te(g.p3.rawTime),price:g.p4.price+Z};if(Ae.normalizedTime==null||he.normalizedTime==null)return;b(g.p1,Ae,g.p3,he);return}}if(p.type==="fibonacci"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="rectangle"&&p.p1&&p.p2){const b=(pt,Tt)=>{const _t=p.primitive;if(_t){_t.p1={rawTime:pt.rawTime,price:pt.price},_t.p2={rawTime:Tt.rawTime,price:Tt.price};try{c.current?.applyOptions({})}catch{}}const iA={...p,p1:pt,p2:Tt};He(cA=>{const wA=cA.map(qA=>qA===p?iA:qA);return x.current=wA,wA}),z(iA),fe.current=iA},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const pt=d.timeScale().coordinateToTime(g.x),Tt=u.coordinateToPrice(g.y);if(pt==null||Tt==null)return;const _t=te(pt);if(_t==null)return;const iA=k-_t,cA=P-Tt,wA=te(g.p1.normalizedTime+iA),qA=te(g.p2.normalizedTime+iA);if(wA==null||qA==null)return;const _i=_-pt;b({rawTime:g.p1.rawTime+_i,normalizedTime:wA,price:g.p1.price+cA},{rawTime:g.p2.rawTime+_i,normalizedTime:qA,price:g.p2.price+cA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),Z=Math.max(g.p1.price,g.p2.price),Ae=Math.min(g.p1.price,g.p2.price),he=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,Be=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Ce=K,Ue=W,qe=Z,rt=Ae,Xe=he,vt=Be;if((j.current==="handle1"||j.current==="handle4"||j.current==="handle6")&&(Ce=k,Xe=M),(j.current==="handle3"||j.current==="handle5"||j.current==="handle8")&&(Ue=k,vt=M),(j.current==="handle1"||j.current==="handle2"||j.current==="handle3")&&(qe=P),(j.current==="handle6"||j.current==="handle7"||j.current==="handle8")&&(rt=P),Ce>Ue){const pt=Ce,Tt=Xe;Ce=Ue,Xe=vt,Ue=pt,vt=Tt}if(qe<rt){const pt=qe;qe=rt,rt=pt}b({rawTime:Xe,normalizedTime:Ce,price:qe},{rawTime:vt,normalizedTime:Ue,price:rt});return}if(p.type==="circle"&&p.p1&&p.p2){const b=(qe,rt)=>{const Xe=p.primitive;if(Xe){Xe.p1={rawTime:qe.rawTime,price:qe.price},Xe.p2={rawTime:rt.rawTime,price:rt.price};try{c.current?.applyOptions({})}catch{}}const vt={...p,p1:qe,p2:rt};He(pt=>{const Tt=pt.map(_t=>_t===p?vt:_t);return x.current=Tt,Tt}),z(vt),fe.current=vt},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=te(k.p1.normalizedTime+Ae),Ce=te(k.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:k.p1.rawTime+Ue,normalizedTime:Be,price:k.p1.price+he},{rawTime:k.p2.rawTime+Ue,normalizedTime:Ce,price:k.p2.price+he});return}if(p.type==="triangle"&&p.p1&&p.p2&&p.p3){const b=(Xe,vt,pt)=>{const Tt=p.primitive;if(Tt){Tt.p1={rawTime:Xe.rawTime,price:Xe.price},Tt.p2={rawTime:vt.rawTime,price:vt.price},Tt.p3={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const _t={...p,p1:Xe,p2:vt,p3:pt};He(iA=>{const cA=iA.map(wA=>wA===p?_t:wA);return x.current=cA,cA}),z(_t),fe.current=_t},g=d.timeScale().coordinateToTime(L);if(g==null)return;const M=te(g);if(M==null)return;if(j.current==="handle1"){b({rawTime:g,normalizedTime:M,price:P},p.p2,p.p3);return}if(j.current==="handle2"){b(p.p1,{rawTime:g,normalizedTime:M,price:P},p.p3);return}if(j.current==="handle3"){b(p.p1,p.p2,{rawTime:g,normalizedTime:M,price:P});return}const k=oe.current;if(!k)return;const K=d.timeScale().coordinateToTime(k.x),W=u.coordinateToPrice(k.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=M-Z,he=P-W,Be=_-K,Ce=Xe=>{const vt=Xe.normalizedTime??te(Xe.rawTime);if(vt==null)return null;const pt=te(vt+Ae);return pt==null?null:{rawTime:Xe.rawTime+Be,normalizedTime:pt,price:Xe.price+he}},Ue=Ce(k.p1),qe=Ce(k.p2),rt=Ce(k.p3);if(!Ue||!qe||!rt)return;b(Ue,qe,rt);return}if(p.type==="ellipse"&&p.p1&&p.p2){const b=(K,W,Z=p.minorRatio??.45)=>{const Ae=p.primitive;if(Ae){Ae.p1={rawTime:K.rawTime,price:K.price},Ae.p2={rawTime:W.rawTime,price:W.price},Ae.minorRatio=Math.max(.05,Z);try{c.current?.applyOptions({})}catch{}}const he={...p,p1:K,p2:W,minorRatio:Math.max(.05,Z)};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he},g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(L);if(M==null)return;const k=te(M);if(k==null)return;if(j.current==="line"){const K=d.timeScale().coordinateToTime(g.x),W=u.coordinateToPrice(g.y);if(K==null||W==null)return;const Z=te(K);if(Z==null)return;const Ae=k-Z,he=P-W,Be=te(g.p1.normalizedTime+Ae),Ce=te(g.p2.normalizedTime+Ae);if(Be==null||Ce==null)return;const Ue=_-K;b({rawTime:g.p1.rawTime+Ue,normalizedTime:Be,price:g.p1.price+he},{rawTime:g.p2.rawTime+Ue,normalizedTime:Ce,price:g.p2.price+he},g.minorRatio??p.minorRatio??.45);return}if(j.current==="handle1"){b({rawTime:M,normalizedTime:k,price:P},p.p2,p.minorRatio??.45);return}if(j.current==="handle3"){b(p.p1,{rawTime:M,normalizedTime:k,price:P},p.minorRatio??.45);return}if(j.current==="handle2"||j.current==="handle4"){const K=d.timeScale().timeToCoordinate(p.p1.rawTime),W=u.priceToCoordinate(p.p1.price),Z=d.timeScale().timeToCoordinate(p.p2.rawTime),Ae=u.priceToCoordinate(p.p2.price);if(K==null||W==null||Z==null||Ae==null)return;const he=(K+Z)/2,Be=(W+Ae)/2,Ce=Z-K,Ue=Ae-W,qe=Math.hypot(Ce,Ue);if(qe<.001)return;const rt=-Ue/qe,Xe=Ce/qe,vt=Math.abs((L-he)*rt+(w-Be)*Xe),pt=Math.max(.05,vt*2/qe);b(p.p1,p.p2,pt);return}return}if(p.type==="gannfan"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="ganngrid"&&p.p1&&p.p2){const b=(g,M)=>{const k=p.primitive;if(k){k.p1={rawTime:g.rawTime,price:g.price},k.p2={rawTime:M.rawTime,price:M.price};try{c.current?.applyOptions({})}catch{}}const K={...p,p1:g,p2:M};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K};if(j.current==="handle1"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b({rawTime:g,normalizedTime:U,price:P},p.p2)}else if(j.current==="handle2"){const g=d.timeScale().coordinateToTime(L);if(g==null)return;b(p.p1,{rawTime:g,normalizedTime:U,price:P})}else if(j.current==="line"){const g=oe.current;if(!g)return;const M=d.timeScale().coordinateToTime(g.x),k=u.coordinateToPrice(g.y);if(M==null||k==null)return;const K=U-te(M),W=P-k,Z=te(g.p1.normalizedTime+K),Ae=te(g.p2.normalizedTime+K);if(Z==null||Ae==null)return;const he=_-M;b({rawTime:g.p1.rawTime+he,normalizedTime:Z,price:g.p1.price+W},{rawTime:g.p2.rawTime+he,normalizedTime:Ae,price:g.p2.price+W})}return}if(p.type==="verticalline"&&p.primitive){const b=p.primitive;b.time=_;const g={...p,time:te(_),rawTime:_};He(k=>{const K=k.map(W=>W===p?g:W);return x.current=K,K}),z(g),fe.current=g;const M=d.timeScale().timeToCoordinate(_);M!=null&&G([{x:M,y:b.midYCss??200}]),c.current?.applyOptions({});return}if(p.type==="horizontalray"&&p.primitive){const b=p.primitive,g=oe.current;if(!g)return;if(j.current==="handle1"){if(b.price=P,b.originTime=_,p.priceLine)try{p.priceLine.applyOptions({price:P,title:p.showPrice!==!1?P.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=P,p.textPrimitive.originTime=_);const M={...p,price:b.price,originTime:b.originTime,rawOriginTime:_};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M,c.current?.applyOptions({})}else if(j.current==="line"){const M=u.coordinateToPrice(g.y);if(M==null)return;const k=P-M;if(b.price=g.price+k,p.priceLine)try{p.priceLine.applyOptions({price:b.price,title:p.showPrice!==!1?b.price.toFixed(5):""})}catch{}p.textPrimitive&&(p.textPrimitive.price=b.price);const K={...p,price:b.price};He(W=>{const Z=W.map(Ae=>Ae===p?K:Ae);return x.current=Z,Z}),z(K),fe.current=K,c.current?.applyOptions({})}return}if(!(p.type!=="trendline"&&p.type!=="gannline")&&!(!p.point1||!p.point2)){if(j.current==="handle1"){const b={time:U,price:P},g=DA([{time:b.time,value:b.price},{time:p.point2.time,value:p.point2.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p1=b);const M={...p,point1:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="handle2"){const b={time:U,price:P},g=DA([{time:p.point1.time,value:p.point1.price},{time:b.time,value:b.price}]);g.length>0&&p.series.setData(g),p.decoration&&(p.decoration.p2=b);const M={...p,point2:b};He(k=>{const K=k.map(W=>W===p?M:W);return x.current=K,K}),z(M),fe.current=M}else if(j.current==="line"){const b=oe.current;if(!b)return;const g=d.timeScale().coordinateToTime(b.x),M=u.coordinateToPrice(b.y);if(g==null||M==null)return;const k=U-g,K=P-M,W={time:te(b.point1.time+k),price:b.point1.price+K},Z={time:te(b.point2.time+k),price:b.point2.price+K},Ae=DA([{time:W.time,value:W.price},{time:Z.time,value:Z.price}]);Ae.length>0&&p.series.setData(Ae),p.decoration&&(p.decoration.p1=W,p.decoration.p2=Z);const he={...p,point1:W,point2:Z};He(Be=>{const Ce=Be.map(Ue=>Ue===p?he:Ue);return x.current=Ce,Ce}),z(he),fe.current=he}}}},D=()=>{j.current=null,oe.current=null},$=()=>{j.current||fe.current||(le(null),we([]))},C={capture:!0,passive:!1};return O.addEventListener("mousedown",se,C),O.addEventListener("mousemove",E,C),O.addEventListener("mouseup",D,C),O.addEventListener("mouseleave",$,C),()=>{O.removeEventListener("mousedown",se,C),O.removeEventListener("mousemove",E,C),O.removeEventListener("mouseup",D,C),O.removeEventListener("mouseleave",$,C)}},[We,Ne,dt,He]),Y.useEffect(()=>{const d=c.current,u=h.current;if(!d||!u)return;const O=()=>{const y=H;if(!y){G([]);return}const R=d.timeScale();if(y.type==="infoline"&&y.p1&&y.p2){const V=y.p1.rawTime??y.p1.time,X=y.p2.rawTime??y.p2.time,se=R.timeToCoordinate(V),E=u.priceToCoordinate(y.p1.price),D=R.timeToCoordinate(X),$=u.priceToCoordinate(y.p2.price);se!=null&&E!=null&&D!=null&&$!=null?G([{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="rulerline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="arrowedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="rayline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="extendedline"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="crossline"&&y.p){const V=R.timeToCoordinate(y.p.rawTime),X=u.priceToCoordinate(y.p.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="text"&&y.rawTime!=null&&y.price!=null){const V=R.timeToCoordinate(y.rawTime),X=u.priceToCoordinate(y.price);V!=null&&X!=null?G([{x:V,y:X}]):G([]);return}if(y.type==="trendbyangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="equidistantchannel"&&y.p1&&y.p2&&y.b1&&y.b2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.b1.rawTime),$=u.priceToCoordinate(y.b1.price),C=R.timeToCoordinate(y.b2.rawTime),B=u.priceToCoordinate(y.b2.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:(D+C)/2,y:($+B)/2}]):G([]);return}if(y.type==="regressionchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="stddevchannel"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="andrewspitchfork"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="disjointchannel"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="flattopbottom"&&y.p1&&y.p2&&y.p3&&y.p4){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price),C=R.timeToCoordinate(y.p4.rawTime),B=u.priceToCoordinate(y.p4.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null&&C!=null&&B!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$},{x:C,y:B}]):G([]);return}if(y.type==="fibonacci"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="trendline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="gannline"&&y.point1&&y.point2){const V=R.timeToCoordinate(y.point1.time),X=u.priceToCoordinate(y.point1.price),se=R.timeToCoordinate(y.point2.time),E=u.priceToCoordinate(y.point2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:(V+se)/2,y:(X+E)/2},{x:se,y:E}]):G([]);return}if(y.type==="rectangle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=Math.min(V,se),$=Math.max(V,se),C=Math.min(X,E),B=Math.max(X,E),f=(D+$)/2,L=(C+B)/2;G([{x:D,y:C},{x:f,y:C},{x:$,y:C},{x:D,y:L},{x:$,y:L},{x:D,y:B},{x:f,y:B},{x:$,y:B}])}else G([]);return}if(y.type==="circle"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="triangle"&&y.p1&&y.p2&&y.p3){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price),D=R.timeToCoordinate(y.p3.rawTime),$=u.priceToCoordinate(y.p3.price);V!=null&&X!=null&&se!=null&&E!=null&&D!=null&&$!=null?G([{x:V,y:X},{x:se,y:E},{x:D,y:$}]):G([]);return}if(y.type==="ellipse"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);if(V!=null&&X!=null&&se!=null&&E!=null){const D=(V+se)/2,$=(X+E)/2,C=se-V,B=E-X,f=Math.hypot(C,B);if(f<.001){G([]);return}const L=C/f,w=B/f,p=-w,_=L,P=f/2,U=P*Math.max(.05,y.minorRatio??.45);G([{x:D-L*P,y:$-w*P},{x:D+p*U,y:$+_*U},{x:D+L*P,y:$+w*P},{x:D-p*U,y:$-_*U}])}else G([]);return}if(y.type==="gannfan"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="ganngrid"&&y.p1&&y.p2){const V=R.timeToCoordinate(y.p1.rawTime),X=u.priceToCoordinate(y.p1.price),se=R.timeToCoordinate(y.p2.rawTime),E=u.priceToCoordinate(y.p2.price);V!=null&&X!=null&&se!=null&&E!=null?G([{x:V,y:X},{x:se,y:E}]):G([]);return}if(y.type==="horizontalray"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.originTime),se=u.priceToCoordinate(V.price);X!=null&&se!=null?G([{x:X,y:se}]):G([]);return}if(y.type==="verticalline"&&y.primitive){const V=y.primitive,X=R.timeToCoordinate(V.time);if(X!=null){const se=V.midYCss??200;G([{x:X,y:se}])}else G([]);return}if(y.type==="pricelevel"&&y.priceLine){const V=h.current?.priceToCoordinate(y.price);if(V!=null){const X=c.current?c.current.paneSize().width:400;G([{x:X/2,y:V}])}else G([]);return}G([])};O();const ce=d.timeScale();return ce.subscribeVisibleTimeRangeChange(O),()=>{ce.unsubscribeVisibleTimeRangeChange(O)}},[H]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if(u.type==="verticalline"&&u.primitive){const O=u===H||u===ne;u.primitive.showDot!==O&&(u.primitive.showDot=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{let d=!1;x.current.forEach(u=>{if((u.type==="infoline"||u.type==="rulerline"||u.type==="arrowedline"||u.type==="rayline"||u.type==="extendedline"||u.type==="trendbyangle")&&u.primitive){const O=u===H||u===ne;u.primitive.isActive!==O&&(u.primitive.isActive=O,d=!0)}}),d&&c.current?.applyOptions({})},[H,ne]),Y.useEffect(()=>{!c.current||!h.current||x.current.forEach(d=>{if(d.series&&d.series.applyOptions({visible:ve}),d.priceLine){const u=ve&&d.showPrice!==!1;d.priceLine.applyOptions(ve?{color:d.lineColor??"#3b82f6",axisLabelVisible:u,title:u&&typeof d.price=="number"?d.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(d.type==="fibonacci"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="rectangle"&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}if(d.type==="parallellines"&&(d.baseLine&&d.baseLine.applyOptions({visible:ve}),d.parallelLine&&d.parallelLine.applyOptions({visible:ve}),d.firstLine&&d.firstLine.applyOptions({visible:ve}),d.secondLine&&d.secondLine.applyOptions({visible:ve})),(d.type==="horizontalray"||d.type==="verticalline"||d.type==="infoline"||d.type==="rulerline"||d.type==="arrowedline"||d.type==="rayline"||d.type==="extendedline"||d.type==="crossline"||d.type==="trendbyangle"||d.type==="equidistantchannel"||d.type==="regressionchannel"||d.type==="stddevchannel"||d.type==="gannfan"||d.type==="ganngrid"||d.type==="andrewspitchfork"||d.type==="disjointchannel"||d.type==="flattopbottom"||d.type==="circle"||d.type==="triangle"||d.type==="ellipse"||d.type==="text")&&d.primitive){d.primitive.visible=ve;try{c.current?.applyOptions({})}catch{}}})},[ve,dt]),Y.useEffect(()=>{!ve&&H&&(z(null),G([]))},[ve,H]),Y.useEffect(()=>{if(x.current.length>dt.length){const d=x.current.filter((u,O)=>!dt.includes(u));H&&d.some(u=>u===H)&&(z(null),G([])),d.forEach(u=>{if(u.series&&c.current?.removeSeries(u.series),u.priceLine&&h.current?.removePriceLine(u.priceLine),u.textPrimitive)try{h.current?.detachPrimitive(u.textPrimitive)}catch{}if(u.type==="horizontalray"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="verticalline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="infoline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rulerline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="arrowedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rayline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="extendedline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="crossline"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="trendbyangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="equidistantchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="regressionchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="stddevchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="gannfan"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ganngrid"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="andrewspitchfork"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="disjointchannel"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="flattopbottom"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="fibonacci"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="rectangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="circle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="triangle"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="ellipse"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="text"&&u.primitive)try{h.current?.detachPrimitive(u.primitive)}catch{}if(u.type==="parallellines")try{u.baseLine&&c.current?.removeSeries(u.baseLine),u.parallelLine&&c.current?.removeSeries(u.parallelLine),u.firstLine&&c.current?.removeSeries(u.firstLine),u.secondLine&&c.current?.removeSeries(u.secondLine)}catch{}}),x.current=dt,Xs()}},[dt,H,Xs]),Y.useEffect(()=>{const d=h.current;return d?(At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[],zt.filter(O=>O.symbol===ye).forEach(O=>{const ce=parseFloat(O.openPrice??O.price),R=O.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(wt&&!isNaN(ce)&&At.current.push(d.createPriceLine({price:ce,color:R,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${O.type} ${O.volume}`})),ZA){const V=parseFloat(O.stopLoss),X=parseFloat(O.takeProfit);!isNaN(V)&&V>0&&At.current.push(d.createPriceLine({price:V,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(X)&&X>0&&At.current.push(d.createPriceLine({price:X,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{At.current.forEach(O=>{try{d.removePriceLine(O)}catch{}}),At.current=[]}):void 0},[zt,ye,wt,ZA]),Y.useEffect(()=>{const d=h.current;if(!d||!aA)return;const u=parseFloat(Zt?.ask);if(isNaN(u)||u<=0)return;let O;try{O=d.createPriceLine({price:u,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(O)try{d.removePriceLine(O)}catch{}}},[aA,Zt]),Y.useEffect(()=>{const d=o.current;if(!d)return;const u=O=>{if(Qe.current){Qe.current=!1;return}if(T.current||!c.current)return;const ce=c.current,y=h.current;if(ce&&y&&x.current.length>0){const R=d.getBoundingClientRect(),V=O.clientX-R.left,X=O.clientY-R.top,se=15;for(let E=x.current.length-1;E>=0;E--){const D=x.current[E];let $=!1;if(D.type==="text"&&D.rawTime!=null&&D.price!=null){const C=ce.timeScale().timeToCoordinate(D.rawTime),B=y.priceToCoordinate(D.price);if(C!=null&&B!=null){const f=Hd(D,C,B);V>=f.left&&V<=f.right&&X>=f.top&&X<=f.bottom&&($=!0)}}else if(D.point1&&D.point2){const C=ce.timeScale().timeToCoordinate(D.point1.time??D.point1.rawTime),B=y.priceToCoordinate(D.point1.price),f=ce.timeScale().timeToCoordinate(D.point2.time??D.point2.rawTime),L=y.priceToCoordinate(D.point2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.hypot(V-C,X-B),p=Math.hypot(V-f,X-L),_=(C+f)/2,P=(B+L)/2,U=Math.hypot(V-_,X-P);(w<se||p<se||U<se)&&($=!0)}}else if(D.p1&&D.p2){const C=ce.timeScale().timeToCoordinate(D.p1.rawTime),B=y.priceToCoordinate(D.p1.price),f=ce.timeScale().timeToCoordinate(D.p2.rawTime),L=y.priceToCoordinate(D.p2.price);if(C!=null&&B!=null&&f!=null&&L!=null){const w=Math.min(C,f),p=Math.max(C,f),_=Math.min(B,L),P=Math.max(B,L);V>=w-5&&V<=p+5&&X>=_-5&&X<=P+5&&($=!0)}}else if(D.p){const C=ce.timeScale().timeToCoordinate(D.p.rawTime),B=y.priceToCoordinate(D.p.price);C!=null&&B!=null&&Math.hypot(V-C,X-B)<se&&($=!0)}else if(D.type==="pricelevel"&&D.price!=null){const C=y.priceToCoordinate(D.price);C!=null&&Math.abs(X-C)<se&&($=!0)}if($){O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),q(D);return}}}O.preventDefault(),O.stopPropagation(),typeof O.stopImmediatePropagation=="function"&&O.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const V=c.current.timeScale().getVisibleRange();Ie(V)},80)};return d.addEventListener("dblclick",u,!0),()=>{d.removeEventListener("dblclick",u,!0)}},[Ne,Te]);const qd=H??ne,jd=H?ie:ee,kb=ve&&nb(qd,jd),Ob=sb(qd?.type);Y.useEffect(()=>{const d=o.current,u=l.current;if(!d||!u)return;const O=80,ce=R=>{const V=d.getBoundingClientRect();u.style.opacity=V.bottom-R.clientY<=O?"1":"0"},y=()=>{u.style.opacity="0"};return d.addEventListener("mousemove",ce),d.addEventListener("mouseleave",y),()=>{d.removeEventListener("mousemove",ce),d.removeEventListener("mouseleave",y)}},[]);const Nb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*.8;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),Kb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleRange();if(!u?.from||!u?.to)return;const O=u.to-u.from,ce=(u.from+u.to)/2,y=O*1.25;try{d.setVisibleRange({from:ce-y/2,to:ce+y/2}),Ie(d.getVisibleRange())}catch{}},[Ie]),zb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from-O,to:u.to-O})}catch{}},[]),Vb=Y.useCallback(()=>{const d=c.current?.timeScale();if(!d)return;const u=d.getVisibleLogicalRange();if(!u)return;const O=Math.max(1,Math.round((u.to-u.from)*.1));try{d.setVisibleLogicalRange({from:u.from+O,to:u.to+O})}catch{}},[]),Wb=Y.useCallback(()=>{if(!c.current)return;kd(c.current,Ne,Te)||c.current.timeScale().fitContent();const u=c.current.timeScale().getVisibleRange();Ie(u)},[Ne,Te,Ie]),ef=Vt?.id??null,tf=Vt?.takeProfit??null,Af=Vt?.stopLoss??null,vl=Vt?.type??null,rf=Vt?.volume??null,Tl=Vt?.symbol??null,nf=Vt?.price||Vt?.openPrice||null;Y.useEffect(()=>{const d=h.current;if(!d)return;const u=ge.current;if(["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}}),!ef)return;const O=typeof ye=="object"?ye?.symbol:ye;if(Tl!==O)return;const ce=parseFloat(nf),y=parseFloat(tf),R=parseFloat(Af),V=vl==="BUY";Number.isFinite(ce)&&ce>0&&(u.entry=d.createPriceLine({price:ce,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`${vl} ${rf} @ ${ce}`}));const X=Tl?.includes("JPY")?.01:1e-4;if(Number.isFinite(y)&&y>0&&Number.isFinite(ce)&&ce>0){const se=V?((y-ce)*(1/X)*10).toFixed(0):((ce-y)*(1/X)*10).toFixed(0);u.tp=d.createPriceLine({price:y,color:"#26A69A",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`TP, ${se} pts`})}if(Number.isFinite(R)&&R>0&&Number.isFinite(ce)&&ce>0){const se=V?((ce-R)*(1/X)*10).toFixed(0):((R-ce)*(1/X)*10).toFixed(0);u.sl=d.createPriceLine({price:R,color:"#EF5350",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:`SL, ${se} pts`})}return()=>{["tp","sl","entry"].forEach(se=>{if(u[se]){try{d.removePriceLine(u[se])}catch{}u[se]=null}})}},[ef,tf,Af,vl,rf,Tl,nf,ye]);const Js=Y.useRef(Vt);Js.current=Vt;const sf=Y.useRef(je);return sf.current=je,Y.useEffect(()=>{const u=V=>{const X=h.current;if(!X)return null;const se=ge.current[V];if(!se)return null;const E=se.options();return!E||!Number.isFinite(E.price)?null:X.priceToCoordinate(E.price)},O=V=>{const X=o.current,se=c.current;if(!X||!se||!Js.current)return;const E=X.getBoundingClientRect(),D=V.clientY-E.top,$=u("tp"),C=u("sl");$!==null&&Math.abs(D-$)<20?(ae.current="tp",pe.current=D,ue.current=ge.current.tp.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1})):C!==null&&Math.abs(D-C)<20&&(ae.current="sl",pe.current=D,ue.current=ge.current.sl.options().price,V.preventDefault(),V.stopImmediatePropagation(),X.style.cursor="ns-resize",se.applyOptions({handleScroll:!1,handleScale:!1}))},ce=V=>{const X=o.current,se=h.current;if(!X)return;const E=ae.current;if(!E){if(!Js.current)return;const _=X.getBoundingClientRect(),P=V.clientY-_.top,U=u("tp"),b=u("sl"),g=U!==null&&Math.abs(P-U)<20,M=b!==null&&Math.abs(P-b)<20;X.style.cursor=g||M?"ns-resize":"";return}if(!se)return;const D=X.getBoundingClientRect(),$=V.clientY-D.top,C=se.coordinateToPrice($);if(!Number.isFinite(C)||C<=0)return;const B=ge.current[E];if(!B)return;const f=Js.current;if(!f)return;const L=parseFloat(f.price||f.openPrice),w=f.type==="BUY",p=E==="tp"?w?((C-L)*1e5).toFixed(0):((L-C)*1e5).toFixed(0):w?((L-C)*1e5).toFixed(0):((C-L)*1e5).toFixed(0);B.applyOptions({price:C,title:`${E.toUpperCase()} ${p} pts`})},y=()=>{const V=o.current,X=c.current,se=ae.current;if(!se)return;const E=ge.current[se],D=E?E.options().price:null;if(ae.current=null,V&&(V.style.cursor=""),X&&X.applyOptions({handleScroll:!0,handleScale:!0}),!Number.isFinite(D)||D<=0)return;const $=sf.current;$&&$(C=>C&&(se==="tp"?{...C,takeProfit:D}:se==="sl"?{...C,stopLoss:D}:C))},R=o.current;if(R)return R.addEventListener("mousedown",O,!0),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",y),()=>{R.removeEventListener("mousedown",O,!0),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",y)}},[lA]),a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Ee==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:We===1||We!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[lA&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),a.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:"#94a3b8"},children:["Loading ",typeof ye=="object"?ye?.symbol:ye,"..."]})]})}),!lA&&yl&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:Ee==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[a.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),a.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:yl})]})}),!lA&&!yl&&Ne.length===0&&a.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:a.jsx("div",{className:"flex flex-col items-center gap-2",children:a.jsxs("span",{className:"text-sm font-medium",style:{color:Ee==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),YA&&Ne.length>0&&(()=>{const d=Ne[Ne.length-1],u=O=>{const ce=Number(O);return Number.isFinite(ce)?ce>=100?ce.toFixed(2):ce.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:Ee==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:u(d?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:u(d?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:Ee==="light"?"#1e293b":"#e2e8f0"},children:u(d?.close)})]})]})})(),(i||si)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(ou,{bidPrice:e,askPrice:t,onBuyClick:Mb,onSellClick:Hb})}),a.jsx(au,{isOpen:st,onClose:Ib,orderType:ft,bidPrice:e,askPrice:t}),a.jsx(pu,{isOpen:re!==null,onClose:()=>q(null),chartObject:re,onUpdate:Pb}),lA&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:"#12161d",opacity:1},children:a.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:"#475569"}})}),kb&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:jd.map((d,u)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:d.x-5,top:d.y-5,backgroundColor:Ob}},u))}),a.jsx("div",{ref:l,style:{position:"absolute",bottom:"50px",left:"50%",transform:"translateX(-50%)",zIndex:30,display:"flex",alignItems:"center",gap:"4px",opacity:0,pointerEvents:"all",transition:"opacity 200ms"},children:[{title:"Zoom out",onClick:Kb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})})},{title:"Zoom in",onClick:Nb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",children:[a.jsx("line",{x1:"7",y1:"3",x2:"7",y2:"11"}),a.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7"})]})},{title:"Scroll left",onClick:zb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"8,3 4,7 8,11"})})},{title:"Scroll right",onClick:Vb,icon:a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"6,3 10,7 6,11"})})},{title:"Reset view",onClick:Wb,icon:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M2 7a5 5 0 1 0 1.5-3.5"}),a.jsx("polyline",{points:"2,2 2,5.5 5.5,5.5"})]})}].map(({title:d,onClick:u,icon:O})=>a.jsx("button",{title:d,onClick:u,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:Ee==="light"?"#374151":"#94a3b8",border:"1px solid "+(Ee==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ce.currentTarget.style.color=Ee==="light"?"#111827":"#e2e8f0"},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=Ee==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ce.currentTarget.style.color=Ee==="light"?"#374151":"#94a3b8"},children:O},d))})]})})}),Et={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 Vd({style:A,className:e}){const{selectedSymbol:t,setSelectedSymbol:i,symbols:r,symbolsLoading:n}=$t(),[s,o]=Y.useState(!1),[l,c]=Y.useState(""),[h,m]=Y.useState(-1),v=Y.useRef(null),x=Y.useRef(null);Y.useEffect(()=>{const Q=N=>{v.current&&!v.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[]),Y.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const F=r.filter(Q=>Q.symbol.toLowerCase().includes(l.toLowerCase())),T=F.filter(Q=>!Q.symbol.endsWith("USDT")),S=F.filter(Q=>Q.symbol.endsWith("USDT")),I=Q=>{i(Q),o(!1),c("")};return r.find(Q=>Q.symbol===t),a.jsxs("div",{ref:v,style:{...Et.container,...A},className:e,children:[a.jsxs("button",{style:Et.button,onClick:()=>o(!s),onMouseEnter:Q=>Object.assign(Q.currentTarget.style,Et.buttonHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Et.arrow,...s?Et.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Et.dropdown,children:[a.jsx("div",{style:Et.searchContainer,children:a.jsx("input",{ref:x,style:Et.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:Q=>c(Q.target.value)})}),a.jsx("div",{style:Et.list,children:F.length===0?a.jsx("div",{style:Et.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Forex & Metals"}),T.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(5)})]},Q.symbol))]}),S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Et.categoryLabel,children:"Crypto"}),S.map(Q=>a.jsxs("div",{style:{...Et.item,...Q.symbol===t?Et.itemSelected:{}},onClick:()=>I(Q.symbol),onMouseEnter:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{Q.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Et.symbolName,children:Q.symbol}),Q.bid&&a.jsx("span",{style:{...Et.symbolPrice,...parseFloat(Q.change)>=0?Et.priceUp:Et.priceDown},children:parseFloat(Q.bid).toFixed(2)})]},Q.symbol))]})]})})]})]})}const XA={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"}},lb=[.01,.05,.1,.5,1];function Wd({value:A,onChange:e,min:t=.01,max:i=100,step:r=.01,presets:n=lb,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:h}){const[m,v]=Y.useState(.1),x=A!==void 0?A:m,F=Y.useCallback(Q=>{const N=Math.max(t,Math.min(i,parseFloat(Q)||t)),J=Math.round(N/r)*r,H=parseFloat(J.toFixed(8));A!==void 0||v(H),e?.(H)},[t,i,r,A,e]),T=()=>F(x+r),S=()=>F(x-r),I=(x>=1,x.toFixed(2));return a.jsxs("div",{style:{...XA.container,...c},className:h,children:[o&&a.jsx("span",{style:XA.label,children:l}),a.jsx("button",{style:XA.btn,onClick:S,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:XA.input,type:"text",value:I,onChange:Q=>{const N=Q.target.value;if(N===""||N==="."||N==="0.")return;const J=parseFloat(N);isNaN(J)||F(J)},onBlur:()=>F(x)}),a.jsx("button",{style:XA.btn,onClick:T,onMouseEnter:Q=>Object.assign(Q.currentTarget.style,XA.btnHover),onMouseLeave:Q=>{Q.currentTarget.style.borderColor="#334155",Q.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:XA.presets,children:n.map(Q=>a.jsx("button",{style:{...XA.preset,...Math.abs(x-Q)<1e-4?XA.presetActive:{}},onClick:()=>F(Q),onMouseEnter:N=>{Math.abs(x-Q)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-Q)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:Q},Q))})]})}const gA={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 Gd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="SL",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.bid?parseFloat(v.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...gA.container,...h},className:m,children:[l&&a.jsx("span",{style:gA.label,children:c}),s&&a.jsx("button",{style:{...gA.toggle,...J?gA.toggleOn:gA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...gA.toggleKnob,...J?gA.knobOn:gA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:gA.inputGroup,children:[a.jsx("input",{style:gA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#EF5350",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...gA.modeBtn,...H==="price"?gA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...gA.modeBtn,...H==="pips"?gA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const mA={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 Rd({value:A,onChange:e,enabled:t,onEnabledChange:i,mode:r,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:l=!0,label:c="TP",style:h,className:m}){const{currentSymbolData:v}=$t(),[x,F]=Y.useState(""),[T,S]=Y.useState(!1),[I,Q]=Y.useState("price"),N=A!==void 0?A:x,J=t!==void 0?t:T,H=r!==void 0?r:I,z=Y.useCallback(ne=>{t!==void 0||S(ne),i?.(ne)},[t,i]),re=Y.useCallback(ne=>{r!==void 0||Q(ne),n?.(ne)},[r,n]),q=Y.useCallback(ne=>{A!==void 0||F(ne),e?.(ne)},[A,e]),ie=ne=>{const le=ne.target.value;if(le===""||le==="."||le==="0."){q(le);return}const ee=parseFloat(le);isNaN(ee)||q(le)},G=H==="price"?v?.ask?parseFloat(v.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...mA.container,...h},className:m,children:[l&&a.jsx("span",{style:mA.label,children:c}),s&&a.jsx("button",{style:{...mA.toggle,...J?mA.toggleOn:mA.toggleOff},onClick:()=>z(!J),children:a.jsx("div",{style:{...mA.toggleKnob,...J?mA.knobOn:mA.knobOff}})}),(J||!s)&&a.jsxs("div",{style:mA.inputGroup,children:[a.jsx("input",{style:mA.input,type:"text",value:N,onChange:ie,placeholder:G,onFocus:ne=>ne.currentTarget.style.borderColor="#26A69A",onBlur:ne=>ne.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...mA.modeBtn,...H==="price"?mA.modeBtnActive:{}},onClick:()=>re("price"),children:"Price"}),a.jsx("button",{style:{...mA.modeBtn,...H==="pips"?mA.modeBtnActive:{}},onClick:()=>re("pips"),children:"Pips"})]})]})]})}const cb=[{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:"─"}],JA={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 $d({showLabel:A=!0,showDelete:e=!0,showVisibility:t=!0,tools:i,label:r="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:l,drawingsVisible:c,setDrawingsVisible:h,chartObjects:m,setChartObjects:v}=$t(),[x,F]=Y.useState(null),T=i||cb,S=N=>{l(o===N?null:N)},I=()=>{v([]),l(null)},Q=()=>{h(!c)};return a.jsxs("div",{style:{...JA.container,...n},className:s,children:[A&&a.jsx("span",{style:JA.label,children:r}),T.map(N=>a.jsxs("button",{style:{...JA.btn,...o===N.id?JA.btnActive:{}},onClick:()=>S(N.id),onMouseEnter:J=>{F(N.id),o!==N.id&&Object.assign(J.currentTarget.style,JA.btnHover)},onMouseLeave:J=>{F(null),o!==N.id&&(J.currentTarget.style.borderColor="#334155",J.currentTarget.style.backgroundColor="#1e293b",J.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&a.jsx("div",{style:JA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:JA.divider}),t&&a.jsx("button",{style:{...JA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:Q,onMouseEnter:N=>{N.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:JA.deleteBtn,onClick:I,onMouseEnter:N=>Object.assign(N.currentTarget.style,JA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Xd={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 hb({showCoinSelector:A=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:i=!0,showDrawingTools:r=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:l,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:m,takeProfit:v,onTakeProfitChange:x,takeProfitEnabled:F,onTakeProfitEnabledChange:T,coinSelectorProps:S={},volumeControlProps:I={},stopLossProps:Q={},takeProfitProps:N={},drawingToolsProps:J={},style:H,className:z}){const re=[];A&&re.push(a.jsx(Vd,{...S},"coin")),e&&re.push(a.jsx(Wd,{value:s,onChange:o,...I},"volume")),t&&re.push(a.jsx(Gd,{value:l,onChange:c,enabled:h,onEnabledChange:m,...Q},"sl")),i&&re.push(a.jsx(Rd,{value:v,onChange:x,enabled:F,onEnabledChange:T,...N},"tp")),r&&re.push(a.jsx($d,{...J},"draw"));const q=[];return re.forEach((ie,G)=>{q.push(ie),n&&G<re.length-1&&q.push(a.jsx("div",{style:Xd.divider},`div-${G}`))}),a.jsx("div",{style:{...Xd.toolbar,...H},className:z,children:q})}const ub=[{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"}],wl={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 pb({style:A,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:i}=$t();return a.jsx("div",{style:{...wl.container,...A},className:e,children:ub.map(r=>a.jsx("button",{style:{...wl.btn,...t===r.value?wl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},children:r.label},r.value))})}const db=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Bl={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 fb({style:A,className:e}){const{chartType:t,setChartType:i}=$t();return a.jsx("div",{style:{...Bl.container,...A},className:e,children:db.map(r=>a.jsxs("button",{style:{...Bl.btn,...t===r.value?Bl.btnActive:{}},onClick:()=>i(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const oA={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 gb({volume:A=.1,stopLoss:e,takeProfit:t,onTradeExecuted:i,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=$t(),[h,m]=Y.useState(null),v=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),F=x>0&&v>0?Math.abs(x-v):0,T=Q=>!Q||Q===0?"-.-----":Q>=1e3?Q.toFixed(2):Q>=1?Q.toFixed(4):Q.toFixed(5),S=Q=>Q===0?"-":Q>=1?Q.toFixed(1):Q>=.01?Q.toFixed(3):(Q*1e4).toFixed(1)+"p",I=Y.useCallback(Q=>{if(!s)return;const N=Q==="BUY"?x:v;if(!N||N<=0){m({type:"error",message:"No price available"});return}const J={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:Q,volume:A,price:N,stopLoss:e?parseFloat(e):null,takeProfit:t?parseFloat(t):null,status:"OPEN",profit:0,swap:0,openAt:new Date().toISOString(),time:new Date().toLocaleTimeString()};l(z=>[...z,J]);const H=A*N*.01;c(z=>z-H),m({type:"success",message:`${Q} executed`}),i?.(J),setTimeout(()=>m(null),3e3)},[s,x,v,A,e,t,l,c,i]);return a.jsxs("div",{style:{...oA.container,...r},className:n,children:[a.jsx("button",{style:oA.sellBtn,onClick:()=>I("SELL"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.sellBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d",Q.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...oA.priceValue,color:"#EF5350"},children:T(v)})]}),a.jsxs("div",{style:oA.spread,children:[a.jsx("span",{style:oA.spreadLabel,children:"Spread"}),a.jsx("span",{style:oA.spreadValue,children:S(F)})]}),a.jsxs("div",{style:oA.priceBox,children:[a.jsx("span",{style:oA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...oA.priceValue,color:"#26A69A"},children:T(x)})]}),a.jsx("button",{style:oA.buyBtn,onClick:()=>I("BUY"),onMouseEnter:Q=>{Object.assign(Q.currentTarget.style,oA.buyBtnHover)},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#14532d",Q.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&a.jsx("span",{style:{...oA.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const ot={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 mb({style:A,className:e,maxHeight:t=200}){const{orders:i,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=$t(),[l,c]=Y.useState(null),h=i.filter(T=>T.status==="OPEN"||!T.closeAt),m=Y.useCallback((T,S)=>{const I=n.find(Q=>Q.symbol===T);return I?S?.toUpperCase()==="BUY"?parseFloat(I.bid||0):parseFloat(I.ask||0):0},[n]),v=Y.useCallback(T=>{if(l)return;c(T.id);const S=m(T.symbol,T.type),Q=(T.type?.toUpperCase()==="BUY"?S-T.price:T.price-S)*T.volume,N=T.volume*T.price*.01;r(J=>J.filter(H=>H.id!==T.id)),o(J=>J+N+Q),c(null)},[l,m,r,o]),x=T=>{const S=parseFloat(T);return!S||isNaN(S)?"-":S>=1e3?S.toFixed(2):S>=1?S.toFixed(4):S.toFixed(5)},F=T=>{const S=parseFloat(T);return isNaN(S)?"-":(S>=0?"+":"")+S.toFixed(2)};return a.jsxs("div",{style:{...ot.container,...A},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",h.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:h.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.emptyRow,children:"No open positions"})}):h.map(T=>{const S=m(T.symbol,T.type),I=T.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:T.symbol}),a.jsx("td",{style:{...ot.td,...T.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:T.type}),a.jsx("td",{style:ot.td,children:T.volume}),a.jsx("td",{style:ot.td,children:x(T.price)}),a.jsx("td",{style:ot.td,children:x(S)}),a.jsx("td",{style:ot.td,children:T.stopLoss?x(T.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:T.takeProfit?x(T.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:I>=0?"#26A69A":"#EF5350",fontWeight:700},children:F(I)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.closeBtn,...l===T.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>v(T),disabled:l===T.id,onMouseEnter:Q=>{l!==T.id&&(Q.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:Q=>{Q.currentTarget.style.backgroundColor="#7f1d1d"},children:l===T.id?"...":"Close"})})]},T.id)})})]})})]})}function wb(A){return nA({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:[]}]})(A)}function Bb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(A)}function yb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(A)}function Cb(A){return nA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(A)}const vb=({selectedSymbol:A,selectedTimeframe:e,onTimeframeChange:t,chartType:i="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:m=!0,onToggleMarketWatch:v,buySellPanelOpen:x,onMove:F})=>{const{theme:T}=$t(),S=T==="light",I=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],Q={bars:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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"}),a.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:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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":a.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.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 a.jsx("div",{className:`overflow-x-auto border-b ${S?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,style:{scrollbarWidth:"thin",scrollbarColor:S?"#cbd5e1 transparent":"#334155 transparent"},children:a.jsxs("div",{className:"flex items-center justify-between px-4 py-1 min-w-max",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${S?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
13
|
+
${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
|
|
14
14
|
`,title:N,children:Q[N]},N))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${S?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(N=>a.jsx("button",{onClick:()=>r(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
15
|
-
${
|
|
16
|
-
`,title:N,children:Q[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[I.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),a.jsx("div",{className:`border-r h-6 mx-1 ${S?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:x?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${x?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.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"}),a.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"}),a.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"})]})})}),a.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 ${S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.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"}),a.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"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(VT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(zT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>v?.(),title:g?"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 ${g?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.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"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${S?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.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"})})}),a.jsx("button",{type:"button",onClick:()=>h?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${S?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})})]})]})})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.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"}),a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],Vs=({children:i,top:e,panelRef:t,isLight:A})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${A?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:i})}),$T=({AccountId:i,UserName:e,UserId:t,onToggleTerminal:A})=>{const{activeTool:r,setActiveTool:n,showGrid:s,setShowGrid:o,snapToGrid:l,setSnapToGrid:c,chartObjects:h,setChartObjects:g,drawingsVisible:v,setDrawingsVisible:x,chartLocked:F,setChartLocked:T,theme:S,setTheme:I,setCandleColors:Q,setShowTradeOrders:N,showTradeOrders:X,setShowTradePosition:H,showTradePosition:V,setShowTradeHistory:ne,showTradeHistory:Z,setShowSLTP:re,showSLTP:R,setShowAskPrice:oe,showAskPrice:le,setShowChartControls:ee,showChartControls:fe,setShowTradeNotification:j,showTradeNotification:se,setShowCrosshair:Ae,showCrosshair:ue,setShowOHLC:ae,showOHLC:Be,setIsShow:be}=Vt(),xe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[me,ve]=q.useState(!1),[Qe,Ee]=q.useState(null),[Me,Ke]=q.useState(null),[Re,$e]=q.useState(0),[Ce,At]=q.useState(!1),[Fe,Ie]=q.useState(0),[dt,lt]=q.useState(!1),[Xe,Pe]=q.useState(0),[we,He]=q.useState(!1),[_e,Ge]=q.useState(0),[qe,mt]=q.useState(!1),[Et,bA]=q.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),ti=q.useRef(null),iA=q.useRef(null),hA=q.useRef(null),xA=q.useRef(null),GA=q.useRef(null),xt=q.useRef(null);q.useEffect(()=>{const ke=rt=>{const Ue=ti.current;me&&Ue&&!Ue.contains(rt.target)&&(ve(!1),Ee(null));const ze=iA.current;Me==="line"&&ze&&!ze.contains(rt.target)&&Ke(null);const nt=hA.current;Me==="channel"&&nt&&!nt.contains(rt.target)&&Ke(null);const Te=xA.current;Me==="gann"&&Te&&!Te.contains(rt.target)&&Ke(null);const De=GA.current;Me==="shape"&&De&&!De.contains(rt.target)&&Ke(null)};return window.addEventListener("mousedown",ke),()=>window.removeEventListener("mousedown",ke)},[me,Me]),q.useEffect(()=>{const ke=rt=>{rt.key==="Escape"&&(ve(!1),Ee(null),Ke(null))};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[]);const Rt=q.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"}],[]),vt=ke=>{const rt=Rt[ke].label;if(rt==="Menu"){ve(Ue=>!Ue),Ee(null);return}if(rt==="Grid"){o(!s);return}if(rt==="Magnet"){c(!l),n(l?null:ke);return}if(rt==="Delete"){if(h.length>0){const Ue=[...h];Ue.pop(),g(Ue)}return}if(rt==="Eye"){x(!v);return}if(rt==="Lock"){T(!F);return}if(rt==="Light Theme"||rt==="Dark Theme"){I(S==="light"?"dark":"light"),ve(!1),Ee(null);return}if(rt==="History"){A?.();return}n(r===ke?null:ke)};Rt.slice(0,12);const it=Rt.slice(12),Ut=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Lt=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.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:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.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:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"theme",label:S==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.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"})]})}]}],Ii=({item:ke})=>{const rt=!!ke.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{xt.current&&(clearTimeout(xt.current),xt.current=null),rt&&Ee(ke.key)},onMouseLeave:()=>{rt&&(xt.current=setTimeout(()=>Ee(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{rt?Ee(Ue=>Ue===ke.key?null:ke.key):(ke.key==="theme"&&I(Ue=>Ue==="light"?"dark":"light"),ve(!1),Ee(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ze?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ze?"text-slate-500":"text-slate-400"}`,children:ke.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:ke.label}),ke.rightText&&a.jsx("span",{className:`text-xs ${Ze?"text-slate-500":"text-slate-400"}`,children:ke.rightText}),rt&&a.jsx("svg",{className:`w-4 h-4 ${Ze?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),rt&&Qe===ke.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden border ${Ze?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:ke.submenu.map((Ue,ze)=>{const nt=Et[ke.key],Te=Array.isArray(nt)?nt.includes(Ue.label):nt===Ue.label||Ue.selected&&nt==null;return a.jsxs("button",{type:"button",onClick:()=>{ke.key==="chart"?(bA(st=>{const ot=Array.isArray(st.chart)?st.chart:[st.chart],Bt=ot.includes(Ue.label)?ot.filter(Gt=>Gt!==Ue.label):[...ot,Ue.label];return{...st,chart:Bt}}),{Grid:()=>o(!s),"Trade Orders":()=>N(!X),"Ask Price":()=>oe(!le),"Chart Controls":()=>ee(!fe),"Trade Notification":()=>j(!se),"Crosshair cursor":()=>Ae(!ue),"Show OHLC":()=>ae(!Be)}[Ue.label]?.()):(bA(De=>({...De,[ke.key]:Ue.label})),ke.key==="colors"&&xe[Ue.label]&&Q(xe[Ue.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ze?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ze?"text-slate-500":"text-slate-400"}`,children:Ue.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Ue.label}),Te&&a.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ze)})})})]})},Ze=S==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${Ze?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:Ut.map((ke,rt)=>{const Ue=ke==="gann",ze=Ue?null:Rt[ke],nt=Ue?-1:ke;return a.jsxs(q.Fragment,{children:[nt===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Te=Jr[Re].toolId;n(r===Te?null:Te)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
-
${r===
|
|
18
|
-
${r===
|
|
19
|
-
${r===
|
|
20
|
-
${r===
|
|
21
|
-
${
|
|
22
|
-
${
|
|
15
|
+
${i===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
|
|
16
|
+
`,title:N,children:Q[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[I.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?S?"text-sky-600":"text-sky-400":S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),a.jsx("div",{className:`border-r h-6 mx-1 ${S?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:x?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${x?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.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"}),a.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"}),a.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"})]})})}),a.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 ${S?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:a.jsxs("g",{fill:"none",fillRule:"evenodd",children:[a.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"}),a.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"}),a.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),a.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{onClick:s,className:`p-1 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(wb,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${S?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(Bb,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${S?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>v?.(),title:m?"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 ${m?S?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":S?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[a.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),a.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"})]})})]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${S?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:a.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"})})}),a.jsx("button",{type:"button",onClick:()=>h?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${S?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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"})})})]})]})})},Yr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],qr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],jr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],en=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.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"}),a.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"}),a.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:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.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"})})}],Ws=({children:A,top:e,panelRef:t,isLight:i})=>a.jsx("div",{ref:t,className:`absolute left-12 z-50 w-56 border shadow-2xl overflow-visible ${i?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,style:{top:e},children:a.jsx("div",{className:"py-1",children:A})}),Tb=({AccountId:A,UserName:e,UserId:t,onToggleTerminal:i})=>{const{activeTool:r,setActiveTool:n,showGrid:s,setShowGrid:o,snapToGrid:l,setSnapToGrid:c,chartObjects:h,setChartObjects:m,drawingsVisible:v,setDrawingsVisible:x,chartLocked:F,setChartLocked:T,theme:S,setTheme:I,setCandleColors:Q,setShowTradeOrders:N,showTradeOrders:J,setShowTradePosition:H,showTradePosition:z,setShowTradeHistory:re,showTradeHistory:q,setShowSLTP:ie,showSLTP:G,setShowAskPrice:ne,showAskPrice:le,setShowChartControls:ee,showChartControls:we,setShowTradeNotification:j,showTradeNotification:ge,setShowCrosshair:ae,showCrosshair:pe,setShowOHLC:ue,showOHLC:oe,setIsShow:fe}=$t(),Qe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[me,xe]=Y.useState(!1),[Se,Me]=Y.useState(null),[$e,Ye]=Y.useState(null),[Ie,We]=Y.useState(0),[De,Ze]=Y.useState(!1),[nt,dt]=Y.useState(0),[He,zt]=Y.useState(!1),[ye,Te]=Y.useState(0),[ve,be]=Y.useState(!1),[Le,Ee]=Y.useState(0),[Ke,wt]=Y.useState(!1),[Dt,ni]=Y.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),ZA=Y.useRef(null),aA=Y.useRef(null),si=Y.useRef(null),_A=Y.useRef(null),YA=Y.useRef(null),Zt=Y.useRef(null);Y.useEffect(()=>{const _e=Je=>{const et=ZA.current;me&&et&&!et.contains(Je.target)&&(xe(!1),Me(null));const bt=aA.current;$e==="line"&&bt&&!bt.contains(Je.target)&&Ye(null);const ze=si.current;$e==="channel"&&ze&&!ze.contains(Je.target)&&Ye(null);const Ve=_A.current;$e==="gann"&&Ve&&!Ve.contains(Je.target)&&Ye(null);const At=YA.current;$e==="shape"&&At&&!At.contains(Je.target)&&Ye(null)};return window.addEventListener("mousedown",_e),()=>window.removeEventListener("mousedown",_e)},[me,$e]),Y.useEffect(()=>{const _e=Je=>{Je.key==="Escape"&&(xe(!1),Me(null),Ye(null))};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[]);const Yt=Y.useMemo(()=>[{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.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:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{fill:"currentColor",d:"M12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C9.068 22 6.43 20.738 4.602 18.728L6.081 17.382C7.544 18.99 9.654 20 12 20C16.418 20 20 16.418 20 12C20 7.582 16.418 4 12 4C7.92 4 4.554 7.054 4.062 11H5.828L3 13.828L0.171997 11H2.049C2.551 5.947 6.815 2 12 2ZM13 7V12.186L16.657 15.843L15.243 17.257L11 13V7H13Z"})}),label:"History",description:"View trade history"}],[]),Qt=_e=>{const Je=Yt[_e].label;if(Je==="Menu"){xe(et=>!et),Me(null);return}if(Je==="Grid"){o(!s);return}if(Je==="Magnet"){c(!l),n(l?null:_e);return}if(Je==="Delete"){if(h.length>0){const et=[...h];et.pop(),m(et)}return}if(Je==="Eye"){x(!v);return}if(Je==="Lock"){T(!F);return}if(Je==="Light Theme"||Je==="Dark Theme"){I(S==="light"?"dark":"light"),xe(!1),Me(null);return}if(Je==="History"){i?.();return}n(r===_e?null:_e)};Yt.slice(0,12);const Lt=Yt.slice(12),Ct=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Ut=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.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:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.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"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),a.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),a.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:"Crosshair cursor",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"theme",label:S==="light"?"Dark Theme":"Light Theme",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),a.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),a.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:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.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:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),a.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"})]})}]}],Vt=({item:_e})=>{const Je=!!_e.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Zt.current&&(clearTimeout(Zt.current),Zt.current=null),Je&&Me(_e.key)},onMouseLeave:()=>{Je&&(Zt.current=setTimeout(()=>Me(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{Je?Me(et=>et===_e.key?null:_e.key):(_e.key==="theme"&&I(et=>et==="light"?"dark":"light"),xe(!1),Me(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:_e.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:_e.label}),_e.rightText&&a.jsx("span",{className:`text-xs ${je?"text-slate-500":"text-slate-400"}`,children:_e.rightText}),Je&&a.jsx("svg",{className:`w-4 h-4 ${je?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Je&&Se===_e.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden border ${je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:_e.submenu.map((et,bt)=>{const ze=Dt[_e.key],Ve=Array.isArray(ze)?ze.includes(et.label):ze===et.label||et.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{_e.key==="chart"?(ni(st=>{const Ge=Array.isArray(st.chart)?st.chart:[st.chart],ft=Ge.includes(et.label)?Ge.filter(at=>at!==et.label):[...Ge,et.label];return{...st,chart:ft}}),{Grid:()=>o(!s),"Trade Orders":()=>N(!J),"Ask Price":()=>ne(!le),"Chart Controls":()=>ee(!we),"Trade Notification":()=>j(!ge),"Crosshair cursor":()=>ae(!pe),"Show OHLC":()=>ue(!oe)}[et.label]?.()):(ni(At=>({...At,[_e.key]:et.label})),_e.key==="colors"&&Qe[et.label]&&Q(Qe[et.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:et.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:et.label}),Ve&&a.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},bt)})})})]})},je=S==="light";return a.jsxs("div",{className:"relative h-full",children:[a.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${je?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:Ct.map((_e,Je)=>{const et=_e==="gann",bt=et?null:Yt[_e],ze=et?-1:_e;return a.jsxs(Y.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=Yr[Ie].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
+
${r===Yr[Ie].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[Ie].label,children:Yr[Ie].icon}),a.jsx("span",{onMouseEnter:()=>Ze(!0),onMouseLeave:()=>Ze(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:De?10:7,height:De?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:je?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=qr[nt].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
18
|
+
${r===qr[nt].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[nt].label,children:qr[nt].icon}),a.jsx("span",{onMouseEnter:()=>zt(!0),onMouseLeave:()=>zt(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:He?10:7,height:He?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:je?"#64748b":"#94a3b8"})})})]}):et?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=jr[ye].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
19
|
+
${r===jr[ye].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:jr[ye].label,children:jr[ye].icon}),a.jsx("span",{onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:ve?10:7,height:ve?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:je?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ve=en[Le].toolId;n(r===Ve?null:Ve)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
20
|
+
${r===en[Le].toolId?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:en[Le].label,children:en[Le].icon}),a.jsx("span",{onMouseEnter:()=>wt(!0),onMouseLeave:()=>wt(!1),onMouseDown:Ve=>{Ve.stopPropagation(),Ye(At=>At==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ke?10:7,height:Ke?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:je?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>Qt(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
21
|
+
${bt.label==="Grid"&&s||bt.label==="Eye"&&!v||bt.label==="Lock"&&F||r===ze?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${bt.label}: ${bt.description}`,children:bt.icon}),!et&&bt.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${je?"border-slate-200":"border-slate-700"}`})]},et?"gann-slot":`${bt.label}-${_e}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:Lt.map((_e,Je)=>{const et=12+Je;return a.jsx("button",{onClick:()=>Qt(et),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
22
|
+
${_e.label==="Grid"&&s||_e.label==="Eye"&&!v||_e.label==="Lock"&&F||r===et?je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${_e.label}: ${_e.description}`,children:_e.icon},_e.label)})})]}),$e==="line"&&a.jsx(Ws,{top:84,panelRef:aA,isLight:je,children:Yr.map((_e,Je)=>{const et=Ie===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),We(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:_e.icon}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},_e.toolId)})}),$e==="channel"&&a.jsx(Ws,{top:128,panelRef:si,isLight:je,children:qr.map((_e,Je)=>{const et=nt===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),dt(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:_e.icon}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},_e.toolId)})}),$e==="gann"&&a.jsx(Ws,{top:210,panelRef:_A,isLight:je,children:jr.map((_e,Je)=>{const et=ye===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),Te(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:_e.icon}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},_e.toolId)})}),$e==="shape"&&a.jsx(Ws,{top:250,panelRef:YA,isLight:je,children:en.map((_e,Je)=>{const et=Le===Je;return a.jsxs("button",{type:"button",onMouseDown:bt=>{bt.stopPropagation(),Ee(Je),n(_e.toolId),Ye(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${je?"text-slate-500":"text-slate-400"}`,children:_e.icon}),a.jsx("span",{className:"flex-1",children:_e.label}),et&&a.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:a.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},_e.toolId)})}),me&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{xe(!1),Me(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:ZA,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${je?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${je?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),A!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${je?"text-slate-500":"text-slate-400"}`,children:A})]}),a.jsx("div",{className:"py-2",children:Ut.map(_e=>a.jsx(Vt,{item:_e},_e.key))})]})]})]})};function bb(A){return nA({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:[]}]})(A)}const xb={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},Qb={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},Fb={binance:"CRYPTO"},Ub=({width:A=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:i,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=$t(),o=s==="light",[l,c]=Y.useState(""),h=e.filter(x=>(x.symbol||"").toLowerCase().includes(l.toLowerCase())),m=Y.useMemo(()=>{const x={};for(const S of h){const I=(S.category||"other").toLowerCase();x[I]||(x[I]=[]),x[I].push(S)}const F=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(x).sort((S,I)=>{const Q=F.indexOf(S),N=F.indexOf(I);return Q!==-1&&N!==-1?Q-N:Q!==-1?-1:N!==-1?1:S.localeCompare(I)}).map(S=>({category:S,symbols:x[S]}))},[h]),v=x=>a.jsxs("tr",{onClick:()=>i(x.symbol),className:`cursor-pointer transition-colors ${t===x.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:[a.jsxs("td",{className:`px-3 flex items-center justify-start gap-2 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:[x.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Cb,{className:"text-2xl text-emerald-500"})}):x.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(yb,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Fw,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:x.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.symbol);return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
23
23
|
.scrollbar-dark::-webkit-scrollbar {
|
|
24
24
|
width: 8px;
|
|
25
25
|
}
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
.scrollbar-light::-webkit-scrollbar-thumb:hover {
|
|
47
47
|
background: #94a3b8;
|
|
48
48
|
}
|
|
49
|
-
`}),a.jsxs("div",{style:{width:`${i}px`},className:`border-l flex flex-col h-full shrink-0 overflow-hidden ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(XT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:x=>c(x.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"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.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."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:g.map(({category:x,symbols:F})=>a.jsxs(q.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?ZT[x]||"text-slate-600":JT[x]||"text-slate-400"}`,children:YT[x]||x.toUpperCase()})}),F.map(v)]},x))})]})})]})]})},jT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r,bots:n,onRunBot:s,onPauseBot:o,onDeleteBot:l})=>{const{accountSummary:c,orders:h,theme:g,isShow:v,setIsShow:x,historyOrders:F,fetchHistoryOrders:T}=Vt(),S=i||c,I=e||h,Q=F||[],N=n||[],X=g==="light",[H,V]=q.useState("trade");q.useEffect(()=>{x&&x(H==="history")},[H,x]),q.useEffect(()=>{H==="history"&&T&&T()},[H,T]);const ne="#26A69A",Z="#EF5350",re=X?"#f8fafc":"#12161D",R=X?"#e2e8f0":"#1e293b",oe=X?"#f1f5f9":"#12161D",le=X?"#F0F5F9":"#2B3543",ee=X?"#f8fafc":"#131c2e",fe=X?"#12161D":"#fff",j=X?"#64748b":"#fff",se=(I||[]).filter(we=>we.status==="OPEN"||!we.closeAt),Ae=S?.balance||0,ue=S?.equity??Ae,ae=S?.margin||0,Be=S?.freeMargin??ue-ae,be=ae>0?ue/ae*100:0,xe=se.reduce((we,He)=>we+(He.livePnL??He.profit??0),0),me=we=>{const He=parseFloat(we);return Number.isFinite(He)?He.toLocaleString("en-US",{minimumFractionDigits:4,maximumFractionDigits:4}):"0.00"},ve=we=>{const He=parseFloat(we);return!He||isNaN(He)?"—":He>=1e4?He.toFixed(2):He>=10?He.toFixed(4):He.toFixed(5)},Qe=we=>{const He=parseFloat(we);return isNaN(He)?"—":(He>=0?"+":"")+He.toFixed(4)},Ee=we=>{const He=parseFloat(we);return isNaN(He)?"—":He.toFixed(2)},Me=we=>{if(!we)return"—";const He=new Date(we);return isNaN(He.getTime())?String(we):`${He.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${He.toTimeString().slice(0,8)}`},Ke=q.useCallback((we,He)=>{we.stopPropagation(),t&&t(He.id,He)},[t]),Re=q.useCallback((we,He)=>{we.stopPropagation(),A&&A(He)},[A]),$e={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:re,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:fe,width:"100%",minWidth:0},Ce={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:le,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},At={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Fe={color:j,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Ie={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},dt={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:oe},lt=we=>({padding:"5px 14px",fontSize:"11px",fontWeight:we?700:500,color:we?X?"#0ea5e9":"#38bdf8":j,borderBottom:we?`2px solid ${X?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Xe={padding:"4px 8px",textAlign:"left",color:j,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:oe,position:"sticky",top:0,zIndex:1},Pe={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:fe};return a.jsxs("div",{className:"ap-scroll",style:$e,children:[a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:At,children:[a.jsx("span",{style:Fe,children:"Balance:"}),a.jsxs("span",{style:{...Ie,color:fe},children:["$",me(Ae)]})]}),a.jsxs("div",{style:At,children:[a.jsx("span",{style:Fe,children:"Equity:"}),a.jsxs("span",{style:{...Ie,color:ue>=Ae?ne:Z},children:["$",me(ue)]})]}),a.jsxs("div",{style:At,children:[a.jsx("span",{style:Fe,children:"Margin:"}),a.jsxs("span",{style:{...Ie,color:fe},children:["$",me(ae)]})]}),a.jsxs("div",{style:At,children:[a.jsx("span",{style:Fe,children:"Free Margin:"}),a.jsxs("span",{style:{...Ie,color:Be>=0?fe:Z},children:["$",me(Be)]})]}),a.jsxs("div",{style:{...At,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Fe,children:"Margin Level:"}),a.jsx("span",{style:{...Ie,color:be>=100?ne:Z},children:ae>0?be.toFixed(2)+"%":"—"})]}),se.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Fe,children:"Float P/L:"}),a.jsxs("span",{style:{...Ie,color:xe>=0?ne:Z,fontWeight:700},children:[xe>=0?"+":"",me(xe)]})]})]}),a.jsxs("div",{style:dt,children:[a.jsx("button",{style:lt(H==="trade"),onClick:()=>V("trade"),children:"Trade"}),a.jsx("button",{style:lt(H==="history"),onClick:()=>V("history"),children:"History"}),a.jsx("button",{style:lt(H==="bots"),onClick:()=>V("bots"),children:"Bots"})]}),H==="trade"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Xe,children:"Symbol"}),a.jsx("th",{style:Xe,children:"Ticket"}),a.jsx("th",{style:Xe,children:"Time"}),a.jsx("th",{style:Xe,children:"Type"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...Xe,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...Xe,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:se.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Pe,textAlign:"center",padding:"16px",color:j},children:"No open positions"})}):se.map(we=>{const He=we.livePnL??we.profit??0,_e=He>=0?ne:Z;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ge=>Ge.currentTarget.style.backgroundColor=ee,onMouseLeave:Ge=>Ge.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Pe,fontWeight:700,color:fe,letterSpacing:"0.02em"},children:we.symbol}),a.jsx("td",{style:{...Pe,color:j,fontSize:"10px"},children:String(we.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Pe,color:j},children:Me(we.openAt||we.time)}),a.jsx("td",{style:{...Pe,fontWeight:700,color:we.type?.toUpperCase()==="BUY"?ne:Z},children:we.type?.toUpperCase()}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:Ee(we.volume)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:ve(we.price??we.openPrice)}),a.jsx("td",{style:{...Pe,textAlign:"right",color:we.stopLoss?Z:j},children:we.stopLoss?ve(we.stopLoss):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:we.takeProfit?ne:j},children:we.takeProfit?ve(we.takeProfit):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:j},children:we.currentPrice?ve(we.currentPrice):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:_e},children:Qe(He)}),a.jsx("td",{style:{...Pe,textAlign:"center"},children:a.jsx("button",{onClick:Ge=>Re(Ge,we),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:j,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:Ge=>Ge.currentTarget.style.color="#f59e0b",onMouseLeave:Ge=>Ge.currentTarget.style.color=j,children:"✎"})}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:_e},children:a.jsx("button",{onClick:Ge=>Ke(Ge,we),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:Ge=>Ge.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:Ge=>Ge.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},we.id)})})]})}),H==="bots"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Xe,children:"Name"}),a.jsx("th",{style:Xe,children:"Symbol"}),a.jsx("th",{style:Xe,children:"Strategy"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Trades"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Max"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Profit Level"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Risk Level"}),a.jsx("th",{style:{...Xe,textAlign:"center"},children:"Status"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"PnL"}),a.jsx("th",{style:{...Xe,textAlign:"center"},children:"Actions"})]})}),a.jsx("tbody",{children:N.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Pe,textAlign:"center",padding:"16px",color:j},children:"No bots created"})}):N.map(we=>{const He=we.status==="active",_e=Number(we.totalPnL??0),Ge=_e>=0?ne:Z;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:qe=>qe.currentTarget.style.backgroundColor=ee,onMouseLeave:qe=>qe.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Pe,fontWeight:700,color:fe},children:we.name}),a.jsx("td",{style:{...Pe,color:fe},children:we.symbol}),a.jsx("td",{style:{...Pe,color:j,textTransform:"capitalize"},children:we.strategy}),a.jsx("td",{style:{...Pe,textAlign:"right",color:fe},children:we.openTrades??we.trades?.filter(qe=>qe.status==="open").length??0}),a.jsx("td",{style:{...Pe,textAlign:"right",color:j},children:we.max_trades}),a.jsx("td",{style:{...Pe,textAlign:"right",color:j},children:we.profit_level}),a.jsx("td",{style:{...Pe,textAlign:"right",color:j},children:we.risk}),a.jsx("td",{style:{...Pe,textAlign:"center"},children:a.jsx("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 8px",borderRadius:"4px",background:He?"rgba(38,166,154,0.15)":"rgba(148,163,184,0.15)",color:He?ne:j,textTransform:"uppercase"},children:we.status})}),a.jsxs("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:Ge},children:[_e>=0?"+":"",_e.toFixed(2)]}),a.jsx("td",{style:{...Pe,textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[He?a.jsx("button",{onClick:()=>o&&o(we.id),title:"Pause Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:"#f59e0b",color:"#fff"},children:"Pause"}):a.jsx("button",{onClick:()=>s&&s(we.id),title:"Run Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:ne,color:"#fff"},children:"Run"}),a.jsx("button",{onClick:()=>l&&l(we.id),title:"Delete Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:Z,color:"#fff"},children:"Delete"})]})})]},we.id)})})]})}),H==="history"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Xe,children:"Symbol"}),a.jsx("th",{style:Xe,children:"Ticket"}),a.jsx("th",{style:Xe,children:"Open Time"}),a.jsx("th",{style:Xe,children:"Type"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:Xe,children:"Close Time"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Xe,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:Q.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Pe,textAlign:"center",padding:"16px",color:j},children:"No trade history"})}):Q.map(we=>{const He=we.profit??0,_e=He>=0?ne:Z;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ge=>Ge.currentTarget.style.backgroundColor=ee,onMouseLeave:Ge=>Ge.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Pe,fontWeight:700,color:fe,letterSpacing:"0.02em"},children:we.symbol}),a.jsx("td",{style:{...Pe,color:j,fontSize:"10px"},children:String(we.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Pe,color:j},children:Me(we.openAt)}),a.jsx("td",{style:{...Pe,fontWeight:700,color:we.type?.toUpperCase()==="BUY"?ne:Z},children:we.type?.toUpperCase()}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:Ee(we.volume)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:ve(we.openPrice)}),a.jsx("td",{style:{...Pe,color:j},children:Me(we.closeAt)}),a.jsx("td",{style:{...Pe,textAlign:"right"},children:ve(we.closePrice)}),a.jsx("td",{style:{...Pe,textAlign:"right",color:we.stopLoss?Z:j},children:we.stopLoss?ve(we.stopLoss):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",color:we.takeProfit?ne:j},children:we.takeProfit?ve(we.takeProfit):"—"}),a.jsx("td",{style:{...Pe,textAlign:"right",fontWeight:700,color:_e},children:Qe(He)})]},we.id)})})]})})]})},eb="2.3.2";je.AccountPanel=jT,je.BuySellPanel=jh,je.Chart=MT,je.ChartTypeSelector=NT,je.CoinSelector=_d,je.DrawingTools=Nd,je.LeftSidebar=$T,je.MarketExecutionModal=eu,je.MarketWatch=qT,je.PositionsPanel=KT,je.SYMBOL_CONFIG=ml,je.StopLoss=Pd,je.TakeProfit=kd,je.TimeframeSelector=PT,je.ToolCustomizationModal=nu,je.TopBar=GT,je.TradePanel=OT,je.TradingProvider=j1,je.TradingToolbar=_T,je.VolumeControl=Dd,je.alignToTimeframe=Ve,je.calcBollingerBands=bl,je.calcLiveBollingerBands=Xs,je.detectGaps=Yd,je.getSymbolConfig=rr,je.is24x7Symbol=Zd,je.isCryptoSymbol=tn,je.isForexSymbol=en,je.isWithinTradingSession=qd,je.normalizeCandleTimes=wl,je.normalizeTime=te,je.processCandles=vl,je.processSingleCandle=Tl,je.setSocketBaseUrl=Gh,je.timeframeToSeconds=pA,je.useTrading=Vt,je.validateTimeOrdering=jd,je.version=eb,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})}));
|
|
49
|
+
`}),a.jsxs("div",{style:{width:`${A}px`},className:`border-l flex flex-col h-full shrink-0 overflow-hidden ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[a.jsx(bb,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:x=>c(x.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"}`})]}),a.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:r?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.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."})}):a.jsxs("table",{className:"w-full text-xs",children:[a.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:a.jsxs("tr",{children:[a.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),a.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change (24h)"})]})}),a.jsx("tbody",{children:m.map(({category:x,symbols:F})=>a.jsxs(Y.Fragment,{children:[a.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:a.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?Qb[x]||"text-slate-600":xb[x]||"text-slate-400"}`,children:Fb[x]||x.toUpperCase()})}),F.map(v)]},x))})]})})]})]})},Sb=({accountSummary:A,orders:e,onClose:t,onModify:i,height:r,bots:n,onRunBot:s,onPauseBot:o,onDeleteBot:l})=>{const{accountSummary:c,orders:h,theme:m,isShow:v,setIsShow:x,historyOrders:F,fetchHistoryOrders:T}=$t(),S=A||c,I=e||h,Q=F||[],N=n||[],J=m==="light",[H,z]=Y.useState("trade");Y.useEffect(()=>{x&&x(H==="history")},[H,x]),Y.useEffect(()=>{H==="history"&&T&&T()},[H,T]);const re="#26A69A",q="#EF5350",ie=J?"#f8fafc":"#12161D",G=J?"#e2e8f0":"#1e293b",ne=J?"#f1f5f9":"#12161D",le=J?"#F0F5F9":"#2B3543",ee=J?"#f8fafc":"#131c2e",we=J?"#12161D":"#fff",j=J?"#64748b":"#fff",ge=(I||[]).filter(ve=>ve.status==="OPEN"||!ve.closeAt),ae=S?.balance||0,pe=S?.equity??ae,ue=S?.margin||0,oe=S?.freeMargin??pe-ue,fe=ue>0?pe/ue*100:0,Qe=ge.reduce((ve,be)=>ve+(be.livePnL??be.profit??0),0),me=ve=>{const be=parseFloat(ve);return Number.isFinite(be)?be.toLocaleString("en-US",{minimumFractionDigits:4,maximumFractionDigits:4}):"0.00"},xe=ve=>{const be=parseFloat(ve);return!be||isNaN(be)?"—":be>=1e4?be.toFixed(2):be>=10?be.toFixed(4):be.toFixed(5)},Se=ve=>{const be=parseFloat(ve);return isNaN(be)?"—":(be>=0?"+":"")+be.toFixed(4)},Me=ve=>{const be=parseFloat(ve);return isNaN(be)?"—":be.toFixed(2)},$e=ve=>{if(!ve)return"—";const be=new Date(ve);return isNaN(be.getTime())?String(ve):`${be.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${be.toTimeString().slice(0,8)}`},Ye=Y.useCallback((ve,be)=>{ve.stopPropagation(),t&&t(be.id,be)},[t]),Ie=Y.useCallback((ve,be)=>{ve.stopPropagation(),i&&i(be)},[i]),We={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:ie,borderTop:`1px solid ${G}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:we,width:"100%",minWidth:0},De={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:le,borderBottom:`1px solid ${G}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ze={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${G}`,whiteSpace:"nowrap"},nt={color:j,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},dt={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},He={display:"flex",borderBottom:`1px solid ${G}`,flexShrink:0,backgroundColor:ne},zt=ve=>({padding:"5px 14px",fontSize:"11px",fontWeight:ve?700:500,color:ve?J?"#0ea5e9":"#38bdf8":j,borderBottom:ve?`2px solid ${J?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),ye={padding:"4px 8px",textAlign:"left",color:j,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",backgroundColor:ne,position:"sticky",top:0,zIndex:1},Te={padding:"3px 8px",borderBottom:`1px solid ${G}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:we};return a.jsxs("div",{className:"ap-scroll",style:We,children:[a.jsxs("div",{style:De,children:[a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Balance:"}),a.jsxs("span",{style:{...dt,color:we},children:["$",me(ae)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Equity:"}),a.jsxs("span",{style:{...dt,color:pe>=ae?re:q},children:["$",me(pe)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Margin:"}),a.jsxs("span",{style:{...dt,color:we},children:["$",me(ue)]})]}),a.jsxs("div",{style:Ze,children:[a.jsx("span",{style:nt,children:"Free Margin:"}),a.jsxs("span",{style:{...dt,color:oe>=0?we:q},children:["$",me(oe)]})]}),a.jsxs("div",{style:{...Ze,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:nt,children:"Margin Level:"}),a.jsx("span",{style:{...dt,color:fe>=100?re:q},children:ue>0?fe.toFixed(2)+"%":"—"})]}),ge.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:nt,children:"Float P/L:"}),a.jsxs("span",{style:{...dt,color:Qe>=0?re:q,fontWeight:700},children:[Qe>=0?"+":"",me(Qe)]})]})]}),a.jsxs("div",{style:He,children:[a.jsx("button",{style:zt(H==="trade"),onClick:()=>z("trade"),children:"Trade"}),a.jsx("button",{style:zt(H==="history"),onClick:()=>z("history"),children:"History"}),a.jsx("button",{style:zt(H==="bots"),onClick:()=>z("bots"),children:"Bots"})]}),H==="trade"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Ticket"}),a.jsx("th",{style:ye,children:"Time"}),a.jsx("th",{style:ye,children:"Type"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ge.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No open positions"})}):ge.map(ve=>{const be=ve.livePnL??ve.profit??0,Le=be>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=ee,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we,letterSpacing:"0.02em"},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,fontSize:"10px"},children:String(ve.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.openAt||ve.time)}),a.jsx("td",{style:{...Te,fontWeight:700,color:ve.type?.toUpperCase()==="BUY"?re:q},children:ve.type?.toUpperCase()}),a.jsx("td",{style:{...Te,textAlign:"right"},children:Me(ve.volume)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.price??ve.openPrice)}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.stopLoss?q:j},children:ve.stopLoss?xe(ve.stopLoss):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.takeProfit?re:j},children:ve.takeProfit?xe(ve.takeProfit):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.currentPrice?xe(ve.currentPrice):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:Se(be)}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsx("button",{onClick:Ee=>Ie(Ee,ve),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:j,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:Ee=>Ee.currentTarget.style.color="#f59e0b",onMouseLeave:Ee=>Ee.currentTarget.style.color=j,children:"✎"})}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:a.jsx("button",{onClick:Ee=>Ye(Ee,ve),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},ve.id)})})]})}),H==="bots"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Name"}),a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Strategy"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Trades"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Max"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit Level"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Risk Level"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Status"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"PnL"}),a.jsx("th",{style:{...ye,textAlign:"center"},children:"Actions"})]})}),a.jsx("tbody",{children:N.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No bots created"})}):N.map(ve=>{const be=ve.status==="active",Le=Number(ve.totalPnL??0),Ee=Le>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ke=>Ke.currentTarget.style.backgroundColor=ee,onMouseLeave:Ke=>Ke.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we},children:ve.name}),a.jsx("td",{style:{...Te,color:we},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,textTransform:"capitalize"},children:ve.strategy}),a.jsx("td",{style:{...Te,textAlign:"right",color:we},children:ve.openTrades??ve.trades?.filter(Ke=>Ke.status==="open").length??0}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.max_trades}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.profit_level}),a.jsx("td",{style:{...Te,textAlign:"right",color:j},children:ve.risk}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsx("span",{style:{fontSize:"10px",fontWeight:700,padding:"2px 8px",borderRadius:"4px",background:be?"rgba(38,166,154,0.15)":"rgba(148,163,184,0.15)",color:be?re:j,textTransform:"uppercase"},children:ve.status})}),a.jsxs("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Ee},children:[Le>=0?"+":"",Le.toFixed(2)]}),a.jsx("td",{style:{...Te,textAlign:"center"},children:a.jsxs("div",{style:{display:"flex",gap:"4px",justifyContent:"center"},children:[be?a.jsx("button",{onClick:()=>o&&o(ve.id),title:"Pause Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:"#f59e0b",color:"#fff"},children:"Pause"}):a.jsx("button",{onClick:()=>s&&s(ve.id),title:"Run Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:re,color:"#fff"},children:"Run"}),a.jsx("button",{onClick:()=>l&&l(ve.id),title:"Delete Bot",style:{padding:"3px 10px",fontSize:"10px",fontWeight:600,borderRadius:"3px",border:"none",cursor:"pointer",background:q,color:"#fff"},children:"Delete"})]})})]},ve.id)})})]})}),H==="history"&&a.jsx("div",{className:"ap-scroll",style:{overflowX:"scroll",overflowY:"auto",flex:1,minWidth:0},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ye,children:"Symbol"}),a.jsx("th",{style:ye,children:"Ticket"}),a.jsx("th",{style:ye,children:"Open Time"}),a.jsx("th",{style:ye,children:"Type"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:ye,children:"Close Time"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...ye,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:Q.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Te,textAlign:"center",padding:"16px",color:j},children:"No trade history"})}):Q.map(ve=>{const be=ve.profit??0,Le=be>=0?re:q;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:Ee=>Ee.currentTarget.style.backgroundColor=ee,onMouseLeave:Ee=>Ee.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Te,fontWeight:700,color:we,letterSpacing:"0.02em"},children:ve.symbol}),a.jsx("td",{style:{...Te,color:j,fontSize:"10px"},children:String(ve.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.openAt)}),a.jsx("td",{style:{...Te,fontWeight:700,color:ve.type?.toUpperCase()==="BUY"?re:q},children:ve.type?.toUpperCase()}),a.jsx("td",{style:{...Te,textAlign:"right"},children:Me(ve.volume)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.openPrice)}),a.jsx("td",{style:{...Te,color:j},children:$e(ve.closeAt)}),a.jsx("td",{style:{...Te,textAlign:"right"},children:xe(ve.closePrice)}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.stopLoss?q:j},children:ve.stopLoss?xe(ve.stopLoss):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",color:ve.takeProfit?re:j},children:ve.takeProfit?xe(ve.takeProfit):"—"}),a.jsx("td",{style:{...Te,textAlign:"right",fontWeight:700,color:Le},children:Se(be)})]},ve.id)})})]})})]})},Eb="2.3.2";it.AccountPanel=Sb,it.BuySellPanel=ou,it.Chart=ab,it.ChartTypeSelector=fb,it.CoinSelector=Vd,it.DrawingTools=$d,it.LeftSidebar=Tb,it.MarketExecutionModal=au,it.MarketWatch=Ub,it.PositionsPanel=mb,it.SYMBOL_CONFIG=bl,it.StopLoss=Gd,it.TakeProfit=Rd,it.TimeframeSelector=pb,it.ToolCustomizationModal=pu,it.TopBar=vb,it.TradePanel=gb,it.TradingProvider=dw,it.TradingToolbar=hb,it.VolumeControl=Wd,it.alignToTimeframe=Re,it.calcBollingerBands=Ml,it.calcLiveBollingerBands=qs,it.detectGaps=pf,it.getSymbolConfig=sr,it.is24x7Symbol=uf,it.isCryptoSymbol=rn,it.isForexSymbol=An,it.isWithinTradingSession=df,it.normalizeCandleTimes=Ql,it.normalizeTime=te,it.processCandles=El,it.processSingleCandle=Ll,it.setSocketBaseUrl=eu,it.timeframeToSeconds=BA,it.useTrading=$t,it.validateTimeOrdering=ff,it.version=Eb,Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})}));
|