@nabeeltahirdeveloper/chart-sdk 2.3.14-beta → 2.3.15-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.
@@ -1,25 +1,25 @@
1
- (function(tt,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):(tt=typeof globalThis<"u"?globalThis:tt||self,a(tt.ChartSDK={},tt.jsxRuntime,tt.React))})(this,(function(tt,a,j){"use strict";var Us=typeof document<"u"?document.currentScript:null;const _t="17:00-17:00",Pt="America/New_York",CA="24x7",vA="UTC",Ra={EURUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"},BTCUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},ETHUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},BNBUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},SOLUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},ADAUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},XRPUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},DOTUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},MATICUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"},LINKUSDT:{type:"crypto",session:CA,sessionTZ:vA,priceMode:"last"}},Ga={type:"forex",sessionTZ:Pt,session:_t,priceMode:"mid"};function Wi(i){return i&&Ra[i.toUpperCase()]||Ga}function kr(i){return Wi(i).type==="forex"}function Or(i){return Wi(i).type==="crypto"}function hp(i){return Wi(i).session==="24x7"}function q(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 up(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 dp(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 $a(i){return Array.isArray(i)?i.map(e=>({...e,time:q(e.time)})).filter(e=>e.time!=null):[]}function pp(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 Xa(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(q(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 Za(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 Ja(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=q(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 fp(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function gp(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,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const m=i[o];let y=l+e,v=0;for(y=Ve(y,e);y<c&&v<r;){const T=Ve(y,e);t.some(U=>U.time===T)||(t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),y+=e}if(y<c&&v>=r){const T=Ve(c-e,e);t.some(U=>U.time===T)||t.push({time:T,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 iA(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 Ya(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Wi(e),r=iA(t),o=$a(i).map(E=>({...E,time:Ve(E.time,r)})).filter(E=>Xa(E)).map(E=>Za(E)),l=Ja(o);l.sort((E,N)=>E.time-N.time);const c=Math.floor(Date.now()/1e3),u=l.filter(E=>E.time<=c),m=u.filter((E,N)=>N===0?!0:E.time>u[N-1].time),y=m.length>10?fp(m,"percentile"):m,v=Ja(y);v.sort((E,N)=>E.time-N.time);const T=gp(v,r),C=[];for(let E=1;E<T.length;E++){const N=T[E].time-T[E-1].time;N>r*2&&C.push({from:T[E-1].time,to:T[E].time,gapSeconds:N,gapMinutes:Math.round(N/60),fromDate:new Date(T[E-1].time*1e3).toISOString(),toDate:new Date(T[E].time*1e3).toISOString()})}const U=y.filter((E,N)=>N===0?!1:E.close===y[N-1].close&&E.open===y[N-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function qa(i,e,t="1m"){if(!i||!e||!Xa(i))return null;const A=q(i.time);if(A==null)return null;const r=iA(t),n=Ve(A,r);return Za({...i,time:n})}function mt(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 ii(i,e){return i.width===e.width&&i.height===e.height}var mp=(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 wp(i){return new mp(i)}var Bp=(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=mt({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 mt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=mt(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;ii(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=mt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=ii(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&ii(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}Cp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=ja(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=wp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=ja(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?vp(n[0],r):mt({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=mt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function yp(i,e){return new Bp(i,e.transform,e.options)}function ja(i){return i.ownerDocument.defaultView}function Cp(){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 vp(i,e){return mt({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 Tp=(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 ri(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 Tp(r,t,A)}const xp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},bp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Qp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Fp={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},Up={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},Sp={color:"#26a69a",base:0},el={color:"#2196f3"},tl={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 Al,il;function ni(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 rl(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 VA(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function Vt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Le(i){if(i===null)throw new Error("Value is null");return i}function Ci(i){return Le(Vt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(Al||(Al={})),(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"})(il||(il={}));const nl={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 oA(i){return i<0?0:i>255?255:Math.round(i)||0}function sl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const Ep=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Lp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Mp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Hp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Ri(i){(i=i.toLowerCase())in nl&&(i=nl[i]);{const e=Hp.exec(i)||Mp.exec(i);if(e)return[oA(parseInt(e[1],10)),oA(parseInt(e[2],10)),oA(parseInt(e[3],10)),sl(e.length<5?1:parseFloat(e[4]))]}{const e=Lp.exec(i);if(e)return[oA(parseInt(e[1],16)),oA(parseInt(e[2],16)),oA(parseInt(e[3],16)),1]}{const e=Ep.exec(i);if(e)return[oA(17*parseInt(e[1],16)),oA(17*parseInt(e[2],16)),oA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function ol(i){return .199*i[0]+.687*i[1]+.114*i[2]}function Kr(i){const e=Ri(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:ol(e)>160?"black":"white"}}class vt{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 fA(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]:fA(i[A],t[A]));return i}function TA(i){return typeof i=="number"&&isFinite(i)}function Gi(i){return typeof i=="number"&&i%1==0}function $i(i){return typeof i=="string"}function Vr(i){return typeof i=="boolean"}function _A(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"?_A(r):r);return t}function Ip(i){return i!==null}function Xi(i){return i===null?void 0:i}const Ss="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function vi(i,e,t){return e===void 0&&(e=Ss),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Dp{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=vi(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 Es{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class gA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class _p extends gA{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 u=n.it[c],m=Math.round(u.nt*t)+s,y=u.st*A,v=l*A+s;e.moveTo(m,y),e.arc(m,y,v,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 Pp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Np={from:0,to:1};class kp{constructor(e,t){this.ut=new Es,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(Pp),this.ct=this.dt.map((A=>{const r=new _p;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 u=Le(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,u.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=Np}))}}let Op=class extends gA{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,ni(e,this.zt.Lt.Nt),(function(c,u,m,y){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),c.lineTo(u+v,y),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,ni(e,this.zt.Et.Nt),rl(e,l,0,t.width))}};class Kp{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 Op(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=Le(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 Vp(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 zr(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function al(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 ll(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return al(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;al(i,e+c,t+c,A-s,r-s,(u=-c,o.map((m=>m===0?m:m+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function cl(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 hl{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 u=this.Gt(l,t,A,r),m=u.Jt;return u.Qt?ll(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):ll(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(u.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),u}));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:u}=e,m=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,E=t.P,N=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),M=E+v+T,z=t.C+C+U+R+m,Ae=Math.max(1,Math.floor(u));let $=Math.round(M*u);$%2!=Ae%2&&($+=1);const V=y>0?Math.max(1,Math.floor(y*c)):0,ie=Math.round(z*c),re=Math.round(m*c),ce=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,Z=Math.round(ce*u)-Math.floor(.5*u),ee=Math.floor(Z+Ae/2-$/2),oe=ee+$,le=r==="right",se=le?l.width-y:y,he=le?o.width-V:V;let pe,ge,be;return le?(pe=he-ie,ge=he-re,be=se-m-C-y):(pe=he+ie,ge=he+re,be=se+m+C),{Qt:le,Jt:{ii:ee,li:Z,ci:oe,ni:ie,si:$,ht:2*c,ei:V,ti:pe,ri:he,ai:ge,oi:Ae,ui:o.width},di:{ii:ee/u,ci:oe/u,fi:be,pi:N}}}}class Wr{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||hl)(this.Ci,this.yi),this.Ri=new(e||hl)(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 zp extends Wr{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=Kr(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 Wp=/[1-9]/g;class ul{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:y})=>(y.font=t.R,Math.round(t.Wi.xi(y,Le(this.zt).Kt,Wp)))));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 u=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const C=Le(this.zt);y.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*T),E=Math.round(u*v),N=Math.round(m*T),R=Math.round(2*v);if(y.beginPath(),y.moveTo(U,F),y.lineTo(U,N-R),y.arcTo(U,N,U+R,N,R),y.lineTo(E-R,N),y.arcTo(E,N,E,N-R,R),y.lineTo(E,F),y.fill(),C.hi){const M=Math.round(C.ki*v),z=F,Ae=Math.round((z+t.T)*T);y.fillStyle=C.V;const $=Math.max(1,Math.floor(v)),V=Math.floor(.5*v);y.fillRect(M-V,z,$,Ae-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Le(this.zt),T=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=v.V;const C=t.Wi.Mi(y,"Apr0");y.translate(c+r,T+C),y.fillText(v.Kt,0,0)}))}}class Rp{constructor(e,t,A){this.ft=!0,this.Wt=new ul,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(Le(n)),e.yt=!0;const s=Kr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ls{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 dl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(dl||(dl={}));class Gp extends Ls{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 kp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Le(this.tn).vn())return{_t:l,ki:o};{const c=Le(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 Rp(this,e,A),this.wn=new Kp(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 u=c!==null?c.Ct():null;return c!==null&&u!==null?(this.nn=t,this.an=c.Rt(t,u)):(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(Ip),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 zp(this,t,A),e.set(t,r)),r}}function Rr(i){return i==="left"||i==="right"}class Mt{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 Mt(2)}static es(){return new Mt(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 pl=".";function PA(i,e){if(!TA(i))return"n/a";if(!Gi(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 Gr{constructor(e,t){if(t||(t=1),TA(e)&&Gi(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=pl+PA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=pl+PA(0,n));return A.toFixed(0)+r}}class fl extends Gr{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class $p{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 gl(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,u=e[A.from];let m=n(i,u),y=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(C.nt*l,C.st*c),s(i,m,T,C)}else{const v=(C,U)=>{s(i,m,y,U),o.beginPath(),m=C,y=U};let T=y;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){T=e[C];const U=n(i,T);switch(t){case 0:o.lineTo(T.nt*l,T.st*c);break;case 1:o.lineTo(T.nt*l,e[C-1].st*c),U!==m&&(v(U,T),o.lineTo(T.nt*l,e[C-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,E]=Xp(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,E.nt*l,E.st*c,T.nt*l,T.st*c);break}}t!==1&&U!==m&&(v(U,T),o.moveTo(T.nt*l,T.st*c))}(y!==T||y===T&&t===1)&&s(i,m,y,T)}}const ml=6;function Ms(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 Xp(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(Ms(i[t],i[A]),ml),{nt:n.nt+s.nt,st:n.st+s.st}),Ms(i[t],wl(Ms(i[r],i[e]),ml))]}function Zp(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 Bl extends gA{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 u=e.context;u.lineCap="butt",u.lineJoin="round",u.lineWidth=s,ni(u,o),u.lineWidth=1,gl(e,A,l,r,n,this.bs.bind(this),Zp.bind(null,c))}}function Hs(i,e,t){return Math.min(Math.max(i,e),t)}function $r(i,e,t){return e-i<=t}function yl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Is{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 u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const m=Hs(c*e.verticalPixelRatio/l,0,1);u.addColorStop(m,n),u.addColorStop(m,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class Jp extends Bl{constructor(){super(...arguments),this.Ts=new Is}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function Yp(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Cl extends gA{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,ni(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&gl(e,t,n,A,r,u,Yp),l&&(function(m,y,v,T,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:E}=m;let N=null;const R=Math.max(1,Math.floor(U))%2/2,M=v*F+R;for(let z=T.to-1;z>=T.from;--z){const Ae=y[z];if(Ae){const $=C(m,Ae);$!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=$,N=$);const V=Math.round(Ae.nt*U)+R,ie=Ae.st*F;E.moveTo(V,ie),E.arc(V,ie,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class vl extends Cl{Vs(e,t){return t.lt}}function Tl(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 Zi=Tl.bind(null,!0),xl=Tl.bind(null,!1);function qp(i,e){return i.ot<e}function jp(i,e){return e<i.ot}function bl(i,e,t){const A=e.Os(),r=e.ui(),n=Zi(i,A,qp),s=xl(i,r,jp);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 Ds{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=bl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class Xr extends Ds{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,Xi(this.Ls)),e.te(this.zs,A,Xi(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 ef extends Xr{constructor(e,t){super(e,t),this.js=new Es,this.re=new Jp,this.he=new vl,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 tf extends gA{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),u=c-l,m=this.oe,y=u+m-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(T*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,m,F);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-E;let Ae=Math.max(C,Math.round(o.pe*A)-l),$=Ae+m-1;$>C+F-1&&($=C+F-1,Ae=$-m+1),e.fillRect(z,Ae,u-z,$-Ae+1)}const N=c+E;let R=Math.max(C,Math.round(o.me*A)-l),M=R+m-1;M>C+F-1&&(M=C+F-1,R=M-m+1),e.fillRect(y+1,R,N-y,M-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Le(this.zt).le,e)))}}class Ql extends Ds{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,Xi(this.Ls)),e.be(this.zs,A,Xi(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 Af extends Ql{constructor(){super(...arguments),this.js=new tf}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 rf extends Bl{constructor(){super(...arguments),this.Ts=new Is}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 nf extends Cl{constructor(){super(...arguments),this.Pe=new Is}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 sf extends Xr{constructor(e,t){super(e,t),this.js=new Es,this.Ve=new rf,this.Oe=new nf,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 of extends gA{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),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(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 u=null;for(let m=A.from;m<A.to;m++){const y=t[m];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const v=Math.round(Math.min(y.pe,y.me)*s),T=Math.round(Math.max(y.pe,y.me)*s),C=Math.round(y.de*s),U=Math.round(y.fe*s);let F=Math.round(n*y.nt)-c;const E=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,E));const N=E-F+1;r.fillRect(F,C,N,v-C),r.fillRect(F,T+1,N,U-T),u=E}}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 u=A.from;u<A.to;u++){const m=t[u];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let y=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=y+this.ae-1,T=Math.round(Math.min(m.pe,m.me)*s),C=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,v)),this.zt.le*n>2*l)Vp(r,y,T,v-y+1,C-T+1,l);else{const U=v-y+1;r.fillRect(y,T,U,C-T+1)}c=v}}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 u=t[c];let m=Math.round(Math.min(u.pe,u.me)*s),y=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,m+=l,T-=l,y-=l),m>y||r.fillRect(v,m,T-v+1,y-m+1)}}}class af 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(),Be:e.wickVisible,_i:e.borderVisible,tt:this.Ls})}}class lf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class _s extends Ds{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new lf(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,Xi(this.Ls))}Js(){this.wn.update({bars:this.zs.map(cf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function cf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class hf extends gA{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],u=Math.round(l.st*A);let m,y;e.fillStyle=l.ce,u<=n?(m=u,y=s):(m=n,y=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,y-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)),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 u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-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 uf extends Xr{constructor(){super(...arguments),this.js=new hf}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,Le(this.Es.Ct()).Vt)};this.js.J(e)}}class df extends Xr{constructor(){super(...arguments),this.js=new vl}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 pf=/[2-9]/g;class Ji{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||pf,n=String(t).replace(r,"0");if(this.tr.has(n))return Vt(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 ff{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 Fl{constructor(e,t,A){this.ur=e,this.ar=new Ji(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new ff(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 gf extends gA{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),ni(e,this.zt.Nt),rl(e,n,0,t.width))}}class Ps{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new gf,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 mf extends Ps{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 wf extends gA{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 Bf=[{Vr:0,Or:.25,Br:4,Ar:10,Ir:.25,zr:0,Lr:.4,Er:.8},{Vr:.25,Or:.525,Br:10,Ar:14,Ir:0,zr:0,Lr:.8,Er:0},{Vr:.525,Or:1,Br:14,Ar:14,Ir:0,zr:0,Lr:0,Er:0}];function Ul(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=Ri(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Sl(i,e){const t=i%2600/2600;let A;for(const l of Bf)if(t>=l.Vr&&t<=l.Or){A=l;break}VA(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Ul(e,r,A.Ir,A.zr),Dr:Ul(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class yf{constructor(e){this.Wt=new wf,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=Sl(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=Sl(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 Yi(i,e){return yl(Math.min(Math.max(i,12),30)*e)}function qi(i,e){switch(i){case"arrowDown":case"arrowUp":return Yi(e,1);case"circle":return Yi(e,.8);case"square":return Yi(e,.7)}}function El(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(Yi(i,1))}function Ll(i){return Math.max(Yi(i,.1),3)}function Ml(i,e,t){return e?i:t?Math.ceil(i/2):0}function Hl(i,e,t,A,r){const n=qi("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function Il(i,e,t,A){const r=(qi("arrowUp",A)-1)/2*t.Jr,n=(yl(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 Cf(i,e,t,A,r,n){return Hl(e,t,A,r,n)}class vf extends gA{constructor(){super(...arguments),this.zt=null,this.ar=new Ji,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=vi(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(xf(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),Tf(o,e,t,A)}}}}function Tf(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 Il(!1,n,s,r.Ks);case"arrowUp":return void Il(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(qi("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,u*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const u=qi("square",c),m=(u-1)*l.Jr/2,y=l.nt-m,v=l.st-m;o.fillRect(y,v,u*l.Jr,u*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 xf(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 Cf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+qi("circle",l)/2,y=s-c,v=o-u;return Math.sqrt(y*y+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return Hl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function bf(i,e,t,A,r,n,s,o,l){const c=TA(t)?t:t.Se,u=TA(t)?t:t.Me,m=TA(t)?t:t.xe,y=TA(e.size)?Math.max(e.size,0):1,v=El(o.le())*y,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(m,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Qf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new vf,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=Ll(e),A=1.5*El(e)+2*t,r=this.fh();this.ah={above:Ml(A,r.aboveBar,r.inBar),below:Ml(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((u=>({ot:u.time,nt:0,st:0,Ks:0,nh:u.shape,V:u.color,th:u.th,gr:u.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=Ll(t.le()),c={sh:l,eh:l};this.zt.tt=bl(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const y=this.zt.it[u];y.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(y.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&bf(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Ff extends Ps{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 Uf extends Wr{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 u=r.mh(c.V),m=Kr(u);A.t=m.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=m.i,t.V=m.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 Dl(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 Xt{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 Xt(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 Xt(Dl(Math.min,this.Ph(),e.Ph(),-1/0),Dl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!TA(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){TA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new Xt(e.minValue,e.maxValue)}}class Zr{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 Zr(Xt.Ah(e.priceRange),e.margins)}}class Sf extends Ps{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 Ef extends Wr{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=Kr(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Lf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Sf(e,this),this.ur=new Ef(e,this),this.Hh=new Fl(this.ur,e,e.$t())}$h(e){fA(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 Mf extends Ls{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Hf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Le(i(t,A)),l=Ci(o.Vt[0])<=Ci(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,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Le(i(t,A)),T=Ci(v.Vt[0])<=Ci(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?m:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Le(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 u=Le(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Le(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=Le(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class If{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Hf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var _l;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(_l||(_l={}));const zA=30;class Df{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=Jr(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 Zi(this.tl,e,((t,A)=>t.ee<A))}vl(e){return xl(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=Le(this.el()),s=Le(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/zA)*zA,u=Math.max(c,Math.floor(l/zA)*zA);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=Jr(r,this.pl(y,v,A))}let m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let y=Math.max(c+1,o);y<u;y+=zA){const v=Math.floor(y/zA);let T=m.get(v);if(T===void 0){const C=this.fl(v*zA),U=this.vl((v+1)*zA-1);T=this.pl(C,U,A),m.set(v,T)}r=Jr(r,T)}{const y=this.fl(u),v=this.vl(l);r=Jr(r,this.pl(y,v,A))}return r}}function Jr(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class _f{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 Ns{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 _f(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 Pl(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 Pf{constructor(e,t){this.Wt=new ul,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Pl(this.kl))),this.Wt}}class Nf extends Wr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Pl(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 kf{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 Ns(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 Pf(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 Nf(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 Ns(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 Ns(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 ks(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Os(i){return i.Pn()}function Of(i){return i.Bl()}function Kf(i){return i.Al()}class Ks extends Mf{constructor(e,t,A,r,n){super(e),this.zt=new Df,this.jh=new Ff(this),this.zl=[],this.Ll=new mf(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 Uf(this);this.rn=[s],this.Hh=new Fl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new yf(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 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}),u=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:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new If(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),fA(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 Lf(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=[];ks(this.Hl,Os,"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),ks(this.Hl,Os,"normal",e),e}ua(){return this.ca(Os,"bottom")}da(e){return this.ca(Of,e)}fa(e){return this.ca(Kf,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 Zr.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 Le(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 kf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof _s)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof _s)return e=>this.wn.je(e)}_a(){return!Rr(this.Dt().Pa())}pa(e,t){if(!Gi(e)||!Gi(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 Xt(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new Xt(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 v=new Xt(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,y;l?.margins&&(c=s,u=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,u.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,u.below)})})),new Zr(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 $p(this.cn.priceFormat.precision);break;case"percent":this.wa=new fl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Gr(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=Le(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Le(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Le(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 Qf(this,this.$t()),this.$l){case"Bar":this.wn=new Af(this,this.$t());break;case"Candlestick":this.wn=new af(this,this.$t());break;case"Line":this.wn=new df(this,this.$t());break;case"Custom":this.wn=new _s(this,this.$t(),Vt(e));break;case"Area":this.wn=new ef(this,this.$t());break;case"Baseline":this.wn=new sf(this,this.$t());break;case"Histogram":this.wn=new uf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return ks(this.Hl,e,t,A),A}}class Vf{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((u=>u instanceof Ks)).reduce(((u,m)=>{if(A.vr(m)||!m.yt())return u;const y=m.Dt(),v=m.In();if(y.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const C=Ci(m.Ct());return u.concat([y.Rt(T.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,m)=>Math.abs(u-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class zf extends gA{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=Le(this.zt);if(s.Aa){e.strokeStyle=s.Ia,ni(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,ni(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 Wf{constructor(e){this.Wt=new zf,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 Rf{constructor(e){this.wn=new Wf(e)}qh(){return this.wn}}const Vs={$a:4,Ua:1e-4};function Ti(i,e){const t=100*(i-e)/e;return e<0?-t:t}function Gf(i,e){const t=Ti(i.Ph(),e),A=Ti(i.Rh(),e);return new Xt(t,A)}function ji(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function $f(i,e){const t=ji(i.Ph(),e),A=ji(i.Rh(),e);return new Xt(t,A)}function Yr(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 er(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 tr(i,e){if(i===null)return null;const t=Yr(i.Ph(),e),A=Yr(i.Rh(),e);return new Xt(t,A)}function qr(i,e){if(i===null)return null;const t=er(i.Ph(),e),A=er(i.Rh(),e);return new Xt(t,A)}function zs(i){if(i===null)return Vs;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return Vs;const t=Math.ceil(Math.abs(Math.log10(e))),A=Vs.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Ws{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 m=$r(n,r,1e-14)&&n>r+1e-14,y=$r(n,A*o,1e-14),v=$r(n,1,1e-14);if(!(m&&y&&v))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,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];$r(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class Nl{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 Ws(this.qa,[2,2.5,2]),s=new Ws(this.qa,[2,2,2.5]),o=new Ws(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 u=c[0];for(let m=1;m<c.length;++m)c[m]<u&&(u=c[m]);return u})(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),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let m=this.Xa(c,u),y=c%m;y+=y<0?m:0;const v=c>=u?1:-1;let T=null,C=0;for(let U=c-y;U>u;U-=m){const F=this.Ja(U,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,T=F,e.ro()&&(m=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function kl(i){return i.slice().sort(((e,t)=>Le(e.Xi())-Le(t.Xi())))}var Ol;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(Ol||(Ol={}));const Kl=new fl,Vl=new Gr(100,1);class Xf{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 vt,this.vo=new vt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=Vl,this.xo=zs(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Nl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(fA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=Vt(e.scaleMargins.top),A=Vt(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=er(n.Ph(),s),l=er(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=qr(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=tr(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=Ti(e,t):this.Oo()&&(e=ji(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const E=r+u*(F-s),N=c?E:this.ho-1-E;C.st=N}}be(e,t,A){this.Wo();const r=this.Fo(),n=Le(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T];let U=C.ge,F=C.Me,E=C.xe,N=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),E=v(C.xe,t),N=v(C.Se,t));let R=r+u*(U-s),M=c?R:this.ho-1-R;C.pe=M,R=r+u*(F-s),M=c?R:this.ho-1-R,C.de=M,R=r+u*(E-s),M=c?R:this.ho-1-R,C.fe=M,R=r+u*(N-s),M=c?R:this.ho-1-R,C.me=M}}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=kl(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=Le(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=Le(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=Le(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Le(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Le(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_(Ti(e,t));case 3:return this.ba().format(ji(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,Le(this.e_()).ba())}Zl(e,t){return e=Ti(e,t),this.s_(e,Kl)}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=Vl,this.Mh()?(this.wa=Kl,t=100):this.Oo()?(this.wa=new Gr(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Nl(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?Yr(e,this.xo):e;const A=Le(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=Le(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?er(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 u=l.Il(e.Os(),e.ui());let m=u&&u.Lh();if(m!==null){switch(this.cn.mode){case 1:m=tr(m,this.xo);break;case 2:m=Gf(m,c.Vt);break;case 3:m=$f(m,c.Vt)}if(t=t===null?m:t.ts(Le(m)),u!==null){const y=u.Eh();y!==null&&(r=Math.max(r,y.above),n=Math.max(n,y.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=qr(t,this.xo)),t=new Xt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=tr(t,this.xo))}if(this.ro()){const l=qr(t,this.xo),c=zs(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?qr(this.ao,this.xo):null;this.xo=c,t=tr(l,c),u!==null&&(this.ao=tr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new Xt(-.5,.5)),this.xo=zs(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ti:this.Oo()?ji:this.ro()?e=>Yr(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 Zf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new vt,this.yl=e,this.$i=t,this.d_=new Rf(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=Le(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)?Vt(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);VA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Le(e.Dt()).Pa();if(this.o_.has(A)){const n=Vt(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=kl(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),!Rr(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},_A(t)),r=new Xf(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class Jf{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(Vt(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 Ar{constructor(e,t){VA(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 zl(i,e){return i===null||e===null?i===e:i.Ch(e)}class Yf{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(Zi(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=Vt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const y=o[m],v=y.index;for(;s<n;){const T=r[s],C=T.index;if(!(C<v)){c=C;break}s++,t.push(T),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(y),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class xi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new Ar(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new xi(null)}}function qf(i,e){return i.weight>e.weight?i:e}class jf{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new Yf,this.du=new Map,this.fu=xi.ou(),this.vu=!0,this.pu=new vt,this.mu=new vt,this.bu=new vt,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){fA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;fA(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=Zi(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=Le(this.Bu()),n=Le(this.Au());return{from:Le(this.Ui(Math.max(r,t))),to:Le(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Le(this.Va(e.from,!0)),to:Le(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()||!Gi(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=Le(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,u=this.$u(),m=this.cn.fixLeftEdge||u,y=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(T.index),C.label=this.Uu(T),C.weight=T.weight):(C={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=m&&T.index<=l||y&&T.index>=c,v++}return this.Mu.length=v,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=Hs(this.__-e,0,this.__),A=Hs(this.__-Le(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=Le(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 Ar(e,t+this.cn.rightOffset))}lc(e){const t=new Ar(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(xi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new Ar(A-t+1,A);this._c(new xi(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 Jf((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,zl(t.lu(),this.fu.lu())||this.pu.m(),zl(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 e0{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 t0 extends e0{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 A0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new t0(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:vi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class i0 extends Ls{constructor(e,t){super(),this.cn=t,this.wn=new A0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Wl,Rl,Gl,$l,Xl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(Wl||(Wl={}));class r0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new vt,this.Rc=new vt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Dp(this),this.yl=new jf(this,t.timeScale,this.cn.localization,A),this.vt=new Gp(this,t.crosshair),this.Bc=new Vf(t.crosshair),this.Ac=new i0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Mt.es())}Uh(){this.Nc(Mt.ss())}oa(){this.Nc(new Mt(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){fA(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 Zf(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=Mt.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(),u=c.Ct();u!==null&&(s=c.pn(t,u)),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,Le(n)),o=this.yl.Va(t,!0),l=this.yl.It(Le(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),u=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!y){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}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);VA(A!==-1,"Series not found"),this.Cc.splice(A,1),Le(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Le(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=Mt.ss();e.$n(),this.Nc(e)}pd(e){const t=Mt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Mt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Mt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Mt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Mt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Mt.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,u,m]=Ri(n),[y,v,T,C]=Ri(s),U=[oA(l+o*(y-l)),oA(c+o*(v-c)),oA(u+o*(T-u)),sl(m+o*(C-m))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new Mt(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 Ks(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Rr(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 Rs(i){return!TA(i)&&!$i(i)}function Zl(i){return TA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Rl||(Rl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(Gl||(Gl={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})($l||($l={})),(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"})(Xl||(Xl={}));const Jl=i=>i.getUTCFullYear();function n0(i,e,t){return e.replace(/yyyy/g,(A=>PA(Jl(A),4))(i)).replace(/yy/g,(A=>PA(Jl(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=>PA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>PA((r=>r.getUTCDate())(A),2))(i))}class Yl{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return n0(e,this.gd,this.Md)}}class s0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",PA(e.getUTCHours(),2)).replace("%m",PA(e.getUTCMinutes(),2)).replace("%s",PA(e.getUTCSeconds(),2))}}const o0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class a0{constructor(e={}){const t=Object.assign(Object.assign({},o0),e);this.Td=new Yl(t.Sd,t.Cd),this.Pd=new s0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function jr(i){return 60*i*60*1e3}function Gs(i){return 60*i*1e3}const en=[{Dd:(ql=1,1e3*ql),Vd:10},{Dd:Gs(1),Vd:20},{Dd:Gs(5),Vd:21},{Dd:Gs(30),Vd:22},{Dd:jr(1),Vd:30},{Dd:jr(3),Vd:31},{Dd:jr(6),Vd:32},{Dd:jr(12),Vd:33}];var ql;function jl(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=en.length-1;t>=0;--t)if(Math.floor(e.getTime()/en[t].Dd)!==Math.floor(i.getTime()/en[t].Dd))return en[t].Vd;return 0}function $s(i){let e=i;if($i(i)&&(e=Xs(i)),!Rs(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 ec(i){if(!Zl(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Xs(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 tc(i){$i(i.time)&&(i.time=Xs(i.time))}class Ac{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(tc)})(e):tc(e)}createConverterToInternalObj(e){return Le((function(t){return t.length===0?null:Rs(t[0].time)||$i(t[0].time)?$s:ec})(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 Zl(t=e)?ec(t):Rs(t)?$s(t):$s(Xs(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new a0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Yl(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(qf,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],u=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=jl(u,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=u}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=jl(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return fA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const bi=typeof window<"u";function ic(){return!!bi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Zs(){return!!bi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Js(i){return i+i%2}function Ys(i,e){return i.zd-e.zd}function qs(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class l0{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=qs(this.Ld,this.Ed,this.Ud),n=Ys(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=qs(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=Ys(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=qs(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=Ys(this.Nd,this.Fd);s.push(m),o.push(y),A+=y}}}}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,u){const m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Le(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-Le(this.Wd).ot;return Math.min(t,this.jd)}}class c0{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 ol(Ri(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 si(i,e){const t=Le(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=yp(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 oi(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function js(i,e,t,A){i.gl&&i.gl(e,t,A)}function tn(i,e,t,A){i.X(e,t,A)}function eo(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function h0(i){bi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class to{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=!Zs(),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(xA(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(xA(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=Ao(e.changedTouches,Le(this.Of));if(t===null||(this.Vf=An(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(xA(t),Le(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),Qi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(xA(e),Le(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=Ao(e.changedTouches,Le(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=An(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(xA(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&&Qi(e));this._f===0&&Qi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Qi(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),ic()&&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(xA(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=An(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=xA(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=xA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;ic()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=xA(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=xA(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})}Zs()&&(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}),h0(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=rc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Qi(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=rc(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=!Zs()}vv(e){const t=Ao(e.touches,Le(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:An(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"&&Qi(e)}}}}function rc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Qi(i){i.cancelable&&i.preventDefault()}function xA(i){return{nt:i.pageX,st:i.pageY}}function An(i){return i.timeStamp||performance.now()}function Ao(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function rn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function u0(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 io(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 nc(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],u=i[l-1],m=u.At(A,!1),y=c.Vi(),v=u.Vi();if(e===1?y>v-m:y<v+m){const T=v-m*e;c.Oi(T);const C=T-e*m/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-y:y-(v+m)}}class sc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Ji(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=io("normal",r),this.Zv=io("top",r),this.Xv=io("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=si(this.Kv,mt({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=si(this.Kv,mt({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 to(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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=Le(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 u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}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),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return Js(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&ii(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 Le(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,Le(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=ri(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=ri(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?zr(e,0,0,A,r,s):cl(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)),u=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-u,m,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((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const m=t[u];s.fillText(m.so,l,m.Ea+c[u])}}))}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)}nc(r,1,this.Ev.height,t),nc(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(Le(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(Le(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 vi(this.ko.fontSize,this.ko.fontFamily)}}function d0(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 nn(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 p0(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 f0(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 ro{constructor(e,t){this.Ev=mt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new vt,this.Op=new vt,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=si(A,mt({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=si(A,mt({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 to(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Le(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(ro.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 c0(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(Le(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Le(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=Le(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,u,m){var y,v;let T,C;for(const E of c){const N=(v=(y=E.va)===null||y===void 0?void 0:y.call(E,u,m))!==null&&v!==void 0?v:[];for(const R of N)U=R.zOrder,(!(F=T?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(T=R,C=E)}var U,F;return T&&C?{zv:T,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return rn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return rn(l);const u=u0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return rn(l)}return l?.zv?rn(l):null})(A,e,t)}_m(e,t){Le(t==="left"?this.Cp:this.Tp).cp(mt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){ii(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=Le(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=ri(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,d0),this.vm(A),this.pm(A),this.fm(A,nn),this.fm(A,p0)))}this.Jv.applySuggestedBitmapSize();const t=ri(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,f0))}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?zr(e,0,0,A,r,o):cl(e,0,0,A,r,s,o)}vm(e){const t=Le(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,nn,js,t),this.Mm(e,nn,tn,t)}bm(e){this.Mm(e,nn,tn,this.$i().Zc())}fm(e,t){const A=Le(this.Np).Uo();for(const r of A)this.Mm(e,t,js,r);for(const r of A)this.Mm(e,t,tn,r)}Mm(e,t,A,r){const n=Le(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;eo(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 sc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new sc(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,Le(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)Le(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 l0(.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 oc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=mt({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=si(this.Kv,mt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){ii(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=ri(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}){zr(e,0,0,t.width,t.height,this.Pm())}}function no(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 g0=no("normal"),m0=no("top"),w0=no("bottom");class B0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=mt({width:0,height:0}),this.Om=new vt,this.Fv=new Ji(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=si(this.Im,mt({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=si(this.Im,mt({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 to(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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){ii(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(mt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(mt({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=ri(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,w0)})),this.wp(A),this.$m(A,g0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=ri(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,m0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)eo(t,(n=>js(n,e,!1,void 0)),r,void 0);for(const r of A)eo(t,(n=>tn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){zr(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 u=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-m,0,u,y)}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 u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,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 vi(this.j(),this.cn.fontFamily)}Zm(){return vi(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 Ji,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 oc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new oc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const y0=!!bi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!bi&&(!((so=navigator?.userAgentData)===null||so===void 0)&&so.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var so;class C0{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 vt,this.Op=new vt,this.Rc=new vt,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),oo(this.cn)&&this.hb(!0),this.$i=new r0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new B0(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=[],Le(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 mt({width:l-l%2,height:c-c%2})})(mt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Le(this.Xd).style.height=n,Le(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Mt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Mt.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=oo(this.cn);this.$i.$h(e);const A=oo(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=Le(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Le(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 Vt(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 u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Le(o==="left"?m.wm():m.gm()),v=y.xp();e!==null&&y.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Le(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+=Le(r.gm()).xp().width);const s=(o,l,c)=>{Le(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Le(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=Le(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return mt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Le(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Le(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=Js(t),A=Js(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 u=0+l,m=n<u?0:n-u,y=m/e;let v=0;for(let T=0;T<this.Xm.length;++T){const C=this.Xm[T];C.qp(this.$i.qc()[T]);let U=0,F=0;F=T===this.Xm.length-1?m-v:Math.round(C.M_()*y),U=Math.max(F,2),v+=U,C.cp(mt({width:s,height:U})),this.xb()&&C._m(t,"left"),this.Sb()&&C._m(A,"right"),C.fp()&&this.$i.Kc(C.fp(),U)}this.ab.Fm(mt({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 y0?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=Vt(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 ro(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((u=>{const m=u.In().ll(e);m!==null&&n.set(u,m)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof Ks?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 oo(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function v0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function ac(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 lc(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 T0(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 x0(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 b0(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 Q0(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 F0(i,e,t,A,r){const n=Vt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:ac(u,["time","color"]),V:y}}function sn(i){return i.Vt!==void 0}function cc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function ai(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)?cc({ot:e,ee:t,zb:r},A):cc(i(e,t,A,r,n),A)}function hc(i){return{Candlestick:ai(Q0),Bar:ai(b0),Area:ai(T0),Baseline:ai(x0),Histogram:ai(lc),Line:ai(lc),Custom:ai(F0)}[i]}function uc(i){return{ee:0,Hb:new Map,la:i}}function dc(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 pc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),Vt(e)}class U0{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((v=>v.time)),c=this.q_.createConverterToInternalObj(t),u=hc(e.Qh()),m=e.Ca(),y=e.Ta();s=t.map(((v,T)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=uc(C),this.qb.set(U,F),r=!0);const E=u(C,F.ee,v,l[T],m,y);return F.Hb.set(e,E),E}))}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:pc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const m=dc(l,u),y=dc(c,u);if(m!==void 0&&y!==void 0)return{ta:m.Ub>=y.Ub&&m.$b>=y.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.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=uc(r),this.qb.set(this.q_.key(r),s));const l=hc(e.Qh()),c=e.Ca(),u=e.Ta(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const y={ta:sn(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:pc(s.Hb)},T=Zi(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(T,0,v);for(let C=T;C<this.Xb.length;++C)ao(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,y)}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)?sn(t)&&A.push(t):sn(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(sn)),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,ao(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)ao(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 ao(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function lo(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function fc(i){const e=lo(i);return i.V!==void 0&&(e.color=i.V),e}function S0(i){const e=lo(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 E0(i){const e=lo(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 gc(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 L0(i){const e=gc(i);return i.V!==void 0&&(e.color=i.V),e}function M0(i){const e=gc(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 co(i){return{Area:S0,Line:fc,Baseline:E0,Histogram:fc,Bar:L0,Candlestick:M0,Custom:H0}[i]}function H0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const I0={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},D0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},_0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Ss,attributionLogo:!0},ho={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},P0={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},N0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Ss,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function mc(){return{width:0,height:0,autoSize:!1,layout:_0,crosshair:I0,grid:D0,overlayPriceScales:Object.assign({},ho),leftPriceScale:Object.assign(Object.assign({},ho),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},ho),{visible:!0}),timeScale:P0,watermark:N0,localization:{locale:bi?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 Rr(this.ow)?this.aw.Mb(this.ow):0}Li(){return Le(this.aw.$t().Uc(this.ow)).Dt}}function wc(i,e,t){const A=ac(i,["time","originalTime"]),r=Object.assign({time:e},A);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 K0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class V0{constructor(e,t,A,r,n){this.uw=new vt,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 xi(new Ar(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=Le(A.el()),o=Le(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:co(this.seriesType())(A)}data(){const e=co(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 _A(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=fA(_A(O0),e),A=this.Es.ea(t);return new K0(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 z0{constructor(e,t,A){this.ww=new vt,this.mu=new vt,this.Om=new vt,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){VA(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({},_A(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 W0(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 Bc(i){return(function(e){if(Vr(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;Vr(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),Vr(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;Vr(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class R0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new vt,this.Cw=new vt,this.Tw=new vt,this.Pw=new U0(t);const r=A===void 0?_A(mc()):fA(_A(mc()),Bc(A));this.q_=t,this.aw=new C0(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,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=Ci(e),r=Object.assign(Object.assign({},el),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Fp,e)}addBaselineSeries(e){return this.Vw("Baseline",Up,e)}addBarSeries(e){return this.Vw("Bar",bp,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",xp,e)}addHistogramSeries(e){return this.Vw("Histogram",Sp,e)}addLineSeries(e){return this.Vw("Line",Qp,e)}removeSeries(e){const t=Vt(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 k0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Bc(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){W0(A.priceFormat);const n=fA(_A(tl),_A(t),A),s=this.aw.$t().dd(e,n,r),o=new V0(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 Vt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=co(s)(r);if(s!=="Custom")VA(v0(o));else{const l=n.Ta();VA(!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 G0(i,e,t){let A;if($i(i)){const n=document.getElementById(i);VA(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new R0(A,e,t);return e.setOptions(r.options()),r}function $0(i,e){return G0(i,new Ac,Ac.Id(e))}Object.assign(Object.assign({},tl),el);function yc(i,e){return function(){return i.apply(e,arguments)}}const{toString:X0}=Object.prototype,{getPrototypeOf:uo}=Object,{iterator:on,toStringTag:Cc}=Symbol,an=(i=>e=>{const t=X0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),mA=i=>(i=i.toLowerCase(),e=>an(e)===i),ln=i=>e=>typeof e===i,{isArray:Fi}=Array,Ui=ln("undefined");function ir(i){return i!==null&&!Ui(i)&&i.constructor!==null&&!Ui(i.constructor)&&Zt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const vc=mA("ArrayBuffer");function Z0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&vc(i.buffer),e}const J0=ln("string"),Zt=ln("function"),Tc=ln("number"),rr=i=>i!==null&&typeof i=="object",Y0=i=>i===!0||i===!1,cn=i=>{if(an(i)!=="object")return!1;const e=uo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Cc in i)&&!(on in i)},q0=i=>{if(!rr(i)||ir(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},j0=mA("Date"),e1=mA("File"),t1=mA("Blob"),A1=mA("FileList"),i1=i=>rr(i)&&Zt(i.pipe),r1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||Zt(i.append)&&((e=an(i))==="formdata"||e==="object"&&Zt(i.toString)&&i.toString()==="[object FormData]"))},n1=mA("URLSearchParams"),[s1,o1,a1,l1]=["ReadableStream","Request","Response","Headers"].map(mA),c1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function nr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Fi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(ir(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 xc(i,e){if(ir(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 li=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,bc=i=>!Ui(i)&&i!==li;function po(){const{caseless:i,skipUndefined:e}=bc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&xc(t,n)||n;cn(t[s])&&cn(r)?t[s]=po(t[s],r):cn(r)?t[s]=po({},r):Fi(r)?t[s]=r.slice():(!e||!Ui(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&nr(arguments[r],A);return t}const h1=(i,e,t,{allOwnKeys:A}={})=>(nr(e,(r,n)=>{t&&Zt(r)?Object.defineProperty(i,n,{value:yc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),u1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),d1=(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)},p1=(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&&uo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},f1=(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},g1=i=>{if(!i)return null;if(Fi(i))return i;let e=i.length;if(!Tc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},m1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&uo(Uint8Array)),w1=(i,e)=>{const A=(i&&i[on]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},B1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},y1=mA("HTMLFormElement"),C1=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),v1=mA("RegExp"),Fc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};nr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},T1=i=>{Fc(i,(e,t)=>{if(Zt(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(Zt(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+"'")})}})},x1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Fi(i)?A(i):A(String(i).split(e)),t},b1=()=>{},Q1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function F1(i){return!!(i&&Zt(i.append)&&i[Cc]==="FormData"&&i[on])}const U1=i=>{const e=new Array(10),t=(A,r)=>{if(rr(A)){if(e.indexOf(A)>=0)return;if(ir(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Fi(A)?[]:{};return nr(A,(s,o)=>{const l=t(s,r+1);!Ui(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},S1=mA("AsyncFunction"),E1=i=>i&&(rr(i)||Zt(i))&&Zt(i.then)&&Zt(i.catch),Uc=((i,e)=>i?setImmediate:e?((t,A)=>(li.addEventListener("message",({source:r,data:n})=>{r===li&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),li.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Zt(li.postMessage)),L1=typeof queueMicrotask<"u"?queueMicrotask.bind(li):typeof process<"u"&&process.nextTick||Uc,fe={isArray:Fi,isArrayBuffer:vc,isBuffer:ir,isFormData:r1,isArrayBufferView:Z0,isString:J0,isNumber:Tc,isBoolean:Y0,isObject:rr,isPlainObject:cn,isEmptyObject:q0,isReadableStream:s1,isRequest:o1,isResponse:a1,isHeaders:l1,isUndefined:Ui,isDate:j0,isFile:e1,isBlob:t1,isRegExp:v1,isFunction:Zt,isStream:i1,isURLSearchParams:n1,isTypedArray:m1,isFileList:A1,forEach:nr,merge:po,extend:h1,trim:c1,stripBOM:u1,inherits:d1,toFlatObject:p1,kindOf:an,kindOfTest:mA,endsWith:f1,toArray:g1,forEachEntry:w1,matchAll:B1,isHTMLForm:y1,hasOwnProperty:Qc,hasOwnProp:Qc,reduceDescriptors:Fc,freezeMethods:T1,toObjectSet:x1,toCamelCase:C1,noop:b1,toFiniteNumber:Q1,findKey:xc,global:li,isContextDefined:bc,isSpecCompliantForm:F1,toJSONObject:U1,isAsyncFn:S1,isThenable:E1,setImmediate:Uc,asap:L1,isIterable:i=>i!=null&&Zt(i[on])};let Xe=class lp extends Error{static from(e,t,A,r,n,s){const o=new lp(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:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Xe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Xe.ERR_BAD_OPTION="ERR_BAD_OPTION",Xe.ECONNABORTED="ECONNABORTED",Xe.ETIMEDOUT="ETIMEDOUT",Xe.ERR_NETWORK="ERR_NETWORK",Xe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Xe.ERR_DEPRECATED="ERR_DEPRECATED",Xe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Xe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Xe.ERR_CANCELED="ERR_CANCELED",Xe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Xe.ERR_INVALID_URL="ERR_INVALID_URL";const M1=null;function fo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Sc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Ec(i,e,t){return i?i.concat(e).map(function(r,n){return r=Sc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function H1(i){return fe.isArray(i)&&!i.some(fo)}const I1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function hn(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(T){if(T===null)return"";if(fe.isDate(T))return T.toISOString();if(fe.isBoolean(T))return T.toString();if(!l&&fe.isBlob(T))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(T)||fe.isTypedArray(T)?l&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function u(T,C,U){let F=T;if(T&&!U&&typeof T=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&H1(T)||(fe.isFileList(T)||fe.endsWith(C,"[]"))&&(F=fe.toArray(T)))return C=Sc(C),F.forEach(function(N,R){!(fe.isUndefined(N)||N===null)&&e.append(s===!0?Ec([C],R,n):s===null?C:C+"[]",c(N))}),!1}return fo(T)?!0:(e.append(Ec(U,C,n),c(T)),!1)}const m=[],y=Object.assign(I1,{defaultVisitor:u,convertValue:c,isVisitable:fo});function v(T,C){if(!fe.isUndefined(T)){if(m.indexOf(T)!==-1)throw Error("Circular reference detected in "+C.join("."));m.push(T),fe.forEach(T,function(F,E){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(E)?E.trim():E,C,y))===!0&&v(F,C?C.concat(E):[E])}),m.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Lc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function go(i,e){this._pairs=[],i&&hn(i,this,e)}const Mc=go.prototype;Mc.append=function(e,t){this._pairs.push([e,t])},Mc.toString=function(e){const t=e?function(A){return e.call(this,A,Lc)}:Lc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function D1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Hc(i,e,t){if(!e)return i;const A=t&&t.encode||D1,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new go(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Ic{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){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const mo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:go,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},wo=typeof window<"u"&&typeof document<"u",Bo=typeof navigator=="object"&&navigator||void 0,P1=wo&&(!Bo||["ReactNative","NativeScript","NS"].indexOf(Bo.product)<0),N1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",k1=wo&&window.location.href||"http://localhost",Nt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:wo,hasStandardBrowserEnv:P1,hasStandardBrowserWebWorkerEnv:N1,navigator:Bo,origin:k1},Symbol.toStringTag,{value:"Module"})),..._1};function O1(i,e){return hn(i,new Nt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Nt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function K1(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function V1(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 Dc(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&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=V1(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(K1(A),r,t,0)}),t}return null}function z1(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const sr={transitional:mo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(Dc(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.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 O1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return hn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),z1(e)):e}],transformResponse:[function(e){const t=this.transitional||sr.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.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"?Xe.from(o,Xe.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:Nt.classes.FormData,Blob:Nt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{sr.headers[i]={}});const W1=fe.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"]),R1=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(),A=s.substring(r+1).trim(),!(!t||e[t]&&W1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},_c=Symbol("internals");function or(i){return i&&String(i).trim().toLowerCase()}function un(i){return i===!1||i==null?i:fe.isArray(i)?i.map(un):String(i)}function G1(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(i);)e[A[1]]=A[2];return e}const $1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function yo(i,e,t,A,r){if(fe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!fe.isString(e)){if(fe.isString(A))return e.indexOf(A)!==-1;if(fe.isRegExp(A))return A.test(e)}}function X1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function Z1(i,e){const t=fe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let Jt=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=or(l);if(!u)throw new Error("header name must be a non-empty string");const m=fe.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=un(o))}const s=(o,l)=>fe.forEach(o,(c,u)=>n(c,u,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(fe.isString(e)&&(e=e.trim())&&!$1(e))s(R1(e),t);else if(fe.isObject(e)&&fe.isIterable(e)){let o={},l,c;for(const u of e){if(!fe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?fe.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=or(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return G1(r);if(fe.isFunction(t))return t.call(this,r,A);if(fe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=or(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||yo(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=or(s),s){const o=fe.findKey(A,s);o&&(!t||yo(A,A[o],o,t))&&(delete A[o],r=!0)}}return fe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||yo(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return fe.forEach(this,(r,n)=>{const s=fe.findKey(A,n);if(s){t[s]=un(r),delete t[n];return}const o=e?X1(n):String(n).trim();o!==n&&delete t[n],t[o]=un(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&fe.isArray(A)?A.join(", "):A)}),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 A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[_c]=this[_c]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=or(s);A[o]||(Z1(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};Jt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(Jt.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(Jt);function Co(i,e){const t=this||sr,A=e||t,r=Jt.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function Pc(i){return!!(i&&i.__CANCEL__)}let ar=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Nc(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Xe("Request failed with status code "+t.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function J1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function Y1(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(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let m=n,y=0;for(;m!==r;)y+=t[m++],m=m%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(y*1e3/v):void 0}}function q1(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),m=u-t;m>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-m)))},()=>r&&s(r)]}const dn=(i,e,t=3)=>{let A=0;const r=Y1(50,250);return q1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(m)},t)},kc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},Oc=i=>(...e)=>fe.asap(()=>i(...e)),j1=Nt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Nt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Nt.origin),Nt.navigator&&/(msie|trident)/i.test(Nt.navigator.userAgent)):()=>!0,eg=Nt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.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 tg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function Ag(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Kc(i,e,t){let A=!tg(e);return i&&(A||t==!1)?Ag(i,e):e}const Vc=i=>i instanceof Jt?{...i}:i;function ci(i,e){e=e||{};const t={};function A(c,u,m,y){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:y},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,m,y){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,m,y)}else return A(c,u,m,y)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,m){if(m in e)return A(c,u);if(m 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,u,m)=>r(Vc(c),Vc(u),m,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=fe.hasOwnProp(l,u)?l[u]:r,y=m(i[u],e[u],u);fe.isUndefined(y)&&m!==o||(t[u]=y)}),t}const zc=i=>{const e=ci({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=Jt.from(s),e.url=Hc(Kc(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Nt.hasStandardBrowserEnv||Nt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,m])=>{c.includes(u.toLowerCase())&&s.set(u,m)})}}if(Nt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&j1(e.url))){const l=r&&n&&eg.read(n);l&&s.set(r,l)}return e},ig=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=zc(i);let n=r.data;const s=Jt.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,y,v,T;function C(){v&&v(),T&&T(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const N=Jt.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:N,config:i,request:U};Nc(function(Ae){t(Ae),C()},function(Ae){A(Ae),C()},M),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(A(new Xe("Request aborted",Xe.ECONNABORTED,i,U)),U=null)},U.onerror=function(R){const M=R&&R.message?R.message:"Network Error",z=new Xe(M,Xe.ERR_NETWORK,i,U);z.event=R||null,A(z),U=null},U.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||mo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Xe(R,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(R,M){U.setRequestHeader(M,R)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([y,T]=dn(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([m,v]=dn(l),U.upload.addEventListener("progress",m),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=N=>{U&&(A(!N||N.type?new ar(null,i,U):N),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=J1(r.url);if(E&&Nt.protocols.indexOf(E)===-1){A(new Xe("Unsupported protocol "+E+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},rg=(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 u=c instanceof Error?c:this.reason;A.abort(u instanceof Xe?u:new ar(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Xe(`timeout of ${e}ms exceeded`,Xe.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=()=>fe.asap(o),l}},ng=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},sg=async function*(i,e){for await(const t of og(i))yield*ng(t,e)},og=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()}},Wc=(i,e,t,A)=>{const r=sg(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:u}=await r.next();if(c){o(),l.close();return}let m=u.byteLength;if(t){let y=n+=m;t(y)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Rc=64*1024,{isFunction:pn}=fe,ag=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:Gc,TextEncoder:$c}=fe.global,Xc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},lg=i=>{i=fe.merge.call({skipUndefined:!0},ag,i);const{fetch:e,Request:t,Response:A}=i,r=e?pn(e):typeof fetch=="function",n=pn(t),s=pn(A);if(!r)return!1;const o=r&&pn(Gc),l=r&&(typeof $c=="function"?(T=>C=>T.encode(C))(new $c):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&Xc(()=>{let T=!1;const C=new t(Nt.origin,{body:new Gc,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!C}),u=s&&o&&Xc(()=>fe.isReadableStream(new A("").body)),m={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!m[T]&&(m[T]=(C,U)=>{let F=C&&C[T];if(F)return F.call(C);throw new Xe(`Response type '${T}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const y=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(Nt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(T)||fe.isArrayBuffer(T))return T.byteLength;if(fe.isURLSearchParams(T)&&(T=T+""),fe.isString(T))return(await l(T)).byteLength},v=async(T,C)=>{const U=fe.toFiniteNumber(T.getContentLength());return U??y(C)};return async T=>{let{url:C,method:U,data:F,signal:E,cancelToken:N,timeout:R,onDownloadProgress:M,onUploadProgress:z,responseType:Ae,headers:$,withCredentials:V="same-origin",fetchOptions:ie}=zc(T),re=e||fetch;Ae=Ae?(Ae+"").toLowerCase():"text";let ce=rg([E,N&&N.toAbortSignal()],R),Z=null;const ee=ce&&ce.unsubscribe&&(()=>{ce.unsubscribe()});let oe;try{if(z&&c&&U!=="get"&&U!=="head"&&(oe=await v($,F))!==0){let be=new t(C,{method:"POST",body:F,duplex:"half"}),Ee;if(fe.isFormData(F)&&(Ee=be.headers.get("content-type"))&&$.setContentType(Ee),be.body){const[ye,Ce]=kc(oe,dn(Oc(z)));F=Wc(be.body,Rc,ye,Ce)}}fe.isString(V)||(V=V?"include":"omit");const le=n&&"credentials"in t.prototype,se={...ie,signal:ce,method:U.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:le?V:void 0};Z=n&&new t(C,se);let he=await(n?re(Z,ie):re(C,se));const pe=u&&(Ae==="stream"||Ae==="response");if(u&&(M||pe&&ee)){const be={};["status","statusText","headers"].forEach(Fe=>{be[Fe]=he[Fe]});const Ee=fe.toFiniteNumber(he.headers.get("content-length")),[ye,Ce]=M&&kc(Ee,dn(Oc(M),!0))||[];he=new A(Wc(he.body,Rc,ye,()=>{Ce&&Ce(),ee&&ee()}),be)}Ae=Ae||"text";let ge=await m[fe.findKey(m,Ae)||"text"](he,T);return!pe&&ee&&ee(),await new Promise((be,Ee)=>{Nc(be,Ee,{data:ge,headers:Jt.from(he.headers),status:he.status,statusText:he.statusText,config:T,request:Z})})}catch(le){throw ee&&ee(),le&&le.name==="TypeError"&&/Load failed|fetch/i.test(le.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,T,Z,le&&le.response),{cause:le.cause||le}):Xe.from(le,le&&le.code,T,Z,le&&le.response)}}},cg=new Map,Zc=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,u=cg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:lg(e)),u=c;return c};Zc();const vo={http:M1,xhr:ig,fetch:{get:Zc}};fe.forEach(vo,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const Jc=i=>`- ${i}`,hg=i=>fe.isFunction(i)||i===null||i===!1;function ug(i,e){i=fe.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,!hg(A)&&(r=vo[(o=String(A)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${o}'`);if(r&&(fe.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(Jc).join(`
5
- `):" "+Jc(s[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const Yc={getAdapter:ug,adapters:vo};function To(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new ar(null,i)}function qc(i){return To(i),i.headers=Jt.from(i.headers),i.data=Co.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),Yc.getAdapter(i.adapter||sr.adapter,i)(i).then(function(A){return To(i),A.data=Co.call(i,i.transformResponse,A),A.headers=Jt.from(A.headers),A},function(A){return Pc(A)||(To(i),A&&A.response&&(A.response.data=Co.call(i,i.transformResponse,A.response),A.response.headers=Jt.from(A.response.headers))),Promise.reject(A)})}const jc="1.13.5",fn={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{fn[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const eh={};fn.transitional=function(e,t,A){function r(n,s){return"[Axios v"+jc+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Xe(r(s," has been removed"+(t?" in "+t:"")),Xe.ERR_DEPRECATED);return t&&!eh[s]&&(eh[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}},fn.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function dg(i,e,t){if(typeof i!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const A=Object.keys(i);let r=A.length;for(;r-- >0;){const n=A[r],s=e[n];if(s){const o=i[n],l=o===void 0||s(o,n,i);if(l!==!0)throw new Xe("option "+n+" must be "+l,Xe.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Xe("Unknown option "+n,Xe.ERR_BAD_OPTION)}}const gn={assertOptions:dg,validators:fn},aA=gn.validators;let hi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ic,response:new Ic}}async request(e,t){try{return await this._request(e,t)}catch(A){if(A instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{A.stack?n&&!String(A.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(A.stack+=`
6
- `+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ci(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&gn.assertOptions(A,{silentJSONParsing:aA.transitional(aA.boolean),forcedJSONParsing:aA.transitional(aA.boolean),clarifyTimeoutError:aA.transitional(aA.boolean),legacyInterceptorReqResOrdering:aA.transitional(aA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:gn.assertOptions(r,{encode:aA.function,serialize:aA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),gn.assertOptions(t,{baseUrl:aA.spelling("baseURL"),withXsrfToken:aA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],T=>{delete n[T]}),t.headers=Jt.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(t)===!1)return;l=l&&C.synchronous;const U=t.transitional||mo;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,m=0,y;if(!l){const T=[qc.bind(this),void 0];for(T.unshift(...o),T.push(...c),y=T.length,u=Promise.resolve(t);m<y;)u=u.then(T[m++],T[m++]);return u}y=o.length;let v=t;for(;m<y;){const T=o[m++],C=o[m++];try{v=T(v)}catch(U){C.call(this,U);break}}try{u=qc.call(this,v)}catch(T){return Promise.reject(T)}for(m=0,y=c.length;m<y;)u=u.then(c[m++],c[m++]);return u}getUri(e){e=ci(this.defaults,e);const t=Kc(e.baseURL,e.url,e.allowAbsoluteUrls);return Hc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){hi.prototype[e]=function(t,A){return this.request(ci(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(ci(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}hi.prototype[e]=t(),hi.prototype[e+"Form"]=t(!0)});let pg=class cp{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 ar(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 cp(function(r){e=r}),cancel:e}}};function fg(i){return function(t){return i.apply(null,t)}}function gg(i){return fe.isObject(i)&&i.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(([i,e])=>{xo[e]=i});function th(i){const e=new hi(i),t=yc(hi.prototype.request,e);return fe.extend(t,hi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return th(ci(i,r))},t}const ht=th(sr);ht.Axios=hi,ht.CanceledError=ar,ht.CancelToken=pg,ht.isCancel=Pc,ht.VERSION=jc,ht.toFormData=hn,ht.AxiosError=Xe,ht.Cancel=ht.CanceledError,ht.all=function(e){return Promise.all(e)},ht.spread=fg,ht.isAxiosError=gg,ht.mergeConfig=ci,ht.AxiosHeaders=Jt,ht.formToJSON=i=>Dc(fe.isHTMLForm(i)?new FormData(i):i),ht.getAdapter=Yc.getAdapter,ht.HttpStatusCode=xo,ht.default=ht;const{Axios:$T,AxiosError:XT,CanceledError:ZT,isCancel:JT,CancelToken:YT,VERSION:qT,all:jT,Cancel:ex,isAxiosError:tx,spread:Ax,toFormData:ix,AxiosHeaders:rx,HttpStatusCode:nx,formToJSON:sx,getAdapter:ox,mergeConfig:ax}=ht,bA=Object.create(null);bA.open="0",bA.close="1",bA.ping="2",bA.pong="3",bA.message="4",bA.upgrade="5",bA.noop="6";const mn=Object.create(null);Object.keys(bA).forEach(i=>{mn[bA[i]]=i});const bo={type:"error",data:"parser error"},Ah=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ih=typeof ArrayBuffer=="function",rh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Qo=({type:i,data:e},t,A)=>Ah&&e instanceof Blob?t?A(e):nh(e,A):ih&&(e instanceof ArrayBuffer||rh(e))?t?A(e):nh(new Blob([e]),A):A(bA[i]+(e||"")),nh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function sh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Fo;function mg(i,e){if(Ah&&i.data instanceof Blob)return i.data.arrayBuffer().then(sh).then(e);if(ih&&(i.data instanceof ArrayBuffer||rh(i.data)))return e(sh(i.data));Qo(i,!1,t=>{Fo||(Fo=new TextEncoder),e(Fo.encode(t))})}const oh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<oh.length;i++)lr[oh.charCodeAt(i)]=i;const wg=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),u=new Uint8Array(c);for(A=0;A<t;A+=4)n=lr[i.charCodeAt(A)],s=lr[i.charCodeAt(A+1)],o=lr[i.charCodeAt(A+2)],l=lr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Bg=typeof ArrayBuffer=="function",Uo=(i,e)=>{if(typeof i!="string")return{type:"message",data:ah(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:yg(i.substring(1),e)}:mn[t]?i.length>1?{type:mn[t],data:i.substring(1)}:{type:mn[t]}:bo},yg=(i,e)=>{if(Bg){const t=wg(i);return ah(t,e)}else return{base64:!0,data:i}},ah=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,lh="",Cg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{Qo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(lh))})})},vg=(i,e)=>{const t=i.split(lh),A=[];for(let r=0;r<t.length;r++){const n=Uo(t[r],e);if(A.push(n),n.type==="error")break}return A};function Tg(){return new TransformStream({transform(i,e){mg(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 So;function wn(i){return i.reduce((e,t)=>e+t.length,0)}function Bn(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 xg(i,e){So||(So=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(wn(t)<1)break;const l=Bn(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(wn(t)<2)break;const l=Bn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(wn(t)<8)break;const l=Bn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(bo);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(wn(t)<r)break;const l=Bn(t,r);o.enqueue(Uo(n?l:So.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(bo);break}}}})}const ch=4;function Qt(i){if(i)return bg(i)}function bg(i){for(var e in Qt.prototype)i[e]=Qt.prototype[e];return i}Qt.prototype.on=Qt.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},Qt.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},Qt.prototype.off=Qt.prototype.removeListener=Qt.prototype.removeAllListeners=Qt.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},Qt.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},Qt.prototype.emitReserved=Qt.prototype.emit,Qt.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},Qt.prototype.hasListeners=function(i){return!!this.listeners(i).length};const yn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),lA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qg="arraybuffer";function lx(){}function hh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Fg=lA.setTimeout,Ug=lA.clearTimeout;function Cn(i,e){e.useNativeTimers?(i.setTimeoutFn=Fg.bind(lA),i.clearTimeoutFn=Ug.bind(lA)):(i.setTimeoutFn=lA.setTimeout.bind(lA),i.clearTimeoutFn=lA.clearTimeout.bind(lA))}const Sg=1.33;function Eg(i){return typeof i=="string"?Lg(i):Math.ceil((i.byteLength||i.size)*Sg)}function Lg(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 uh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Mg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Hg(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 Ig extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Eo extends Qt{constructor(e){super(),this.writable=!1,Cn(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 Ig(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=Uo(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=Mg(e);return t.length?"?"+t:""}}class Dg extends Eo{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)};vg(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,Cg(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]=uh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let dh=!1;try{dh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _g=dh;function Pg(){}class Ng extends Dg{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 QA extends Qt{constructor(e,t,A){super(),this.createRequest=e,Cn(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=hh(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=QA.requestsCount++,QA.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=Pg,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete QA.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(QA.requestsCount=0,QA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ph);else if(typeof addEventListener=="function"){const i="onpagehide"in lA?"pagehide":"unload";addEventListener(i,ph,!1)}}function ph(){for(let i in QA.requests)QA.requests.hasOwnProperty(i)&&QA.requests[i].abort()}const kg=(function(){const i=fh({xdomain:!1});return i&&i.responseType!==null})();class Og extends Ng{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=kg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new QA(fh,this.uri(),e)}}function fh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_g))return new XMLHttpRequest}catch{}if(!e)try{return new lA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const gh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Kg extends Eo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=gh?{}:hh(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;Qo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&yn(()=>{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]=uh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Lo=lA.WebSocket||lA.MozWebSocket;class Vg extends Kg{createSocket(e,t,A){return gh?new Lo(e,t,A):t?new Lo(e,t):new Lo(e)}doWrite(e,t){this.ws.send(t)}}class zg extends Eo{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=xg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=Tg();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&&yn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Wg={websocket:Vg,webtransport:zg,polling:Og},Rg=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Mo(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=Rg.exec(i||""),n={},s=14;for(;s--;)n[Gg[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=$g(n,n.path),n.queryKey=Xg(n,n.query),n}function $g(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 Xg(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Ho=typeof addEventListener=="function"&&typeof removeEventListener=="function",vn=[];Ho&&addEventListener("offline",()=>{vn.forEach(i=>i())},!1);class WA extends Qt{constructor(e,t){if(super(),this.binaryType=Qg,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=Mo(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=Mo(t.host).host);Cn(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=Hg(this.opts.query)),Ho&&(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"})},vn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ch,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&&WA.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",WA.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+=Eg(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,yn(()=>{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(WA.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(),Ho&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=vn.indexOf(this._offlineEventListener);A!==-1&&vn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}WA.protocol=ch;class Zg extends WA{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;WA.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;WA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=m=>{const y=new Error("probe error: "+m);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const u=()=>{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 Jg=class extends Zg{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=>Wg[r]).filter(r=>!!r)),super(e,A)}};function Yg(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=Mo(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 qg=typeof ArrayBuffer=="function",jg=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,mh=Object.prototype.toString,em=typeof Blob=="function"||typeof Blob<"u"&&mh.call(Blob)==="[object BlobConstructor]",tm=typeof File=="function"||typeof File<"u"&&mh.call(File)==="[object FileConstructor]";function Io(i){return qg&&(i instanceof ArrayBuffer||jg(i))||em&&i instanceof Blob||tm&&i instanceof File}function Tn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(Tn(i[t]))return!0;return!1}if(Io(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Tn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Tn(i[t]))return!0;return!1}function Am(i){const e=[],t=i.data,A=i;return A.data=Do(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Do(i,e){if(!i)return i;if(Io(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]=Do(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]=Do(i[A],e));return t}return i}function im(i,e){return i.data=_o(i.data,e),delete i.attachments,i}function _o(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]=_o(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=_o(i[t],e));return i}const rm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var st;(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"})(st||(st={}));class nm{constructor(e){this.replacer=e}encode(e){return(e.type===st.EVENT||e.type===st.ACK)&&Tn(e)?this.encodeAsBinary({type:e.type===st.EVENT?st.BINARY_EVENT:st.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===st.BINARY_EVENT||e.type===st.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=Am(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Po extends Qt{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===st.BINARY_EVENT;A||t.type===st.BINARY_ACK?(t.type=A?st.EVENT:st.ACK,this.reconstructor=new sm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Io(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(st[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===st.BINARY_EVENT||A.type===st.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(Po.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 st.CONNECT:return wh(t);case st.DISCONNECT:return t===void 0;case st.CONNECT_ERROR:return typeof t=="string"||wh(t);case st.EVENT:case st.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&rm.indexOf(t[0])===-1);case st.ACK:case st.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class sm{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=im(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 om=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Po,Encoder:nm,get PacketType(){return st}},Symbol.toStringTag,{value:"Module"}));function wA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const am=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Bh extends Qt{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=[wA(e,"open",this.onopen.bind(this)),wA(e,"packet",this.onpacket.bind(this)),wA(e,"error",this.onerror.bind(this)),wA(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(am.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:st.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,m=t.pop();this._registerAckCallback(u,m),s.id=u}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:st.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 st.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 st.EVENT:case st.BINARY_EVENT:this.onevent(e);break;case st.ACK:case st.BINARY_ACK:this.onack(e);break;case st.DISCONNECT:this.ondisconnect();break;case st.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:st.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:st.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 Si(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}Si.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},Si.prototype.reset=function(){this.attempts=0},Si.prototype.setMin=function(i){this.ms=i},Si.prototype.setMax=function(i){this.max=i},Si.prototype.setJitter=function(i){this.jitter=i};class No extends Qt{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,Cn(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 Si({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||om;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 Jg(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=wA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=wA(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(wA(e,"ping",this.onping.bind(this)),wA(e,"data",this.ondata.bind(this)),wA(e,"error",this.onerror.bind(this)),wA(e,"close",this.onclose.bind(this)),wA(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){yn(()=>{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 Bh(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 cr={};function xn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=Yg(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=cr[r]&&n in cr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new No(A,e):(cr[r]||(cr[r]=new No(A,e)),l=cr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(xn,{Manager:No,Socket:Bh,io:xn,connect:xn});function ko(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 rA=ko("http://localhost:8000");function yh(i){const e=ko(i);e&&e!==rA&&(rA=e,Ct&&(Ct.disconnect(),Ct.removeAllListeners(),Ct=null))}let Ct=null;function lm(){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:rA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=xn(rA,{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:rA,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:rA,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:rA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:rA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function Oo(){const i=ko(Ct?.io?.uri||null);return!Ct||Ct.io&&i&&rA&&i!==rA?(Ct&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:rA,wasConnected:Ct.connected,reason:"baseUrl changed"}),Ct.disconnect(),Ct.removeAllListeners(),Ct=null),Ct=lm()):Ct.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Ct.id,connected:Ct.connected,baseUrl:rA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Ct.id,baseUrl:rA}),Ct}function cm(i,e){const t=Oo();return t.on(i,e),()=>t.off(i,e)}function hm(i,e){Ct&&Ct.off(i,e)}function um(i,e){Oo().emit(i,e)}function dm(){return Ct?Ct.connected?"connected":"connecting":"disconnected"}const bn={getSocket:Oo,on:cm,off:hm,emit:um,getStatus:dm,setBaseUrl:yh},pm={},Ch=j.createContext(),Ht=()=>{const i=j.useContext(Ch);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},fm=({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:Us&&Us.tagName.toUpperCase()==="SCRIPT"&&Us.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&pm?.VITE_BASE_URL)??"http://localhost:5002";bn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[y,v]=j.useState(r||"BTC/USD"),[T,C]=j.useState(n||"M1"),[U,F]=j.useState([]),[E,N]=j.useState(!0),[R,M]=j.useState([]),[z,Ae]=j.useState(!1),[$,V]=j.useState(1e5),[ie,re]=j.useState(null),[ce,Z]=j.useState([]),[ee,oe]=j.useState(!0),[le,se]=j.useState(!1),[he,pe]=j.useState(!0),[ge,be]=j.useState("candles"),[Ee,ye]=j.useState(!1),[Ce,Fe]=j.useState("dark"),[Ue,Ne]=j.useState(!1),[Je,Ke]=j.useState([]),ve=j.useRef(null),Pe=j.useRef(new Map),Be=j.useRef(null),de=1e3,ke=j.useCallback(async()=>{if(A)try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;Ae(!0);const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Te}`}});let Se=[];Array.isArray(He.data)?Se=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Se=He.data.data);const Re=Se.filter(ze=>ze.closePrice===null||ze.closePrice===void 0).map(ze=>({id:ze.id,ticket:23,symbol:ze.symbol,type:ze.type,volume:ze.volume,openPrice:ze.openPrice??ze.price,stopLoss:ze.stopLoss,takeProfit:ze.takeProfit,comment:ze.comment||"",status:"OPEN",swap:0,profit:ze.profit||0,profitCurrency:"USD",time:new Date(ze.openedAt||ze.openAt||Date.now()).toLocaleTimeString(),openAt:ze.openedAt||ze.openAt,closeAt:ze.closedAt||ze.closeAt}));M(Re)}catch(Te){console.error("❌ Error fetching orders:",Te.response?.data||Te.message),M([])}finally{Ae(!1)}},[l,A]),qe=j.useCallback((Te,He)=>!He||!Te.price||isNaN(He)||isNaN(Te.price)?Te.profit||0:(Te?.type?.toUpperCase()==="BUY"?He-Te.price:Te.price-He)*Te.volume,[]),At=j.useCallback(async()=>{try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;const He=await ht.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Te}`}});if(He.data&&He.data.data){const Se=parseFloat(He.data.data.balance);isNaN(Se)||V(Se)}}catch(Te){console.error("❌ Error fetching user balance:",Te.response?.data||Te.message)}},[l]),rt=j.useCallback(async()=>{if(A)try{const Te=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Te)return;const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Te}`}});let Se=[];Array.isArray(He.data)?Se=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Se=He.data.data);const Re=Se.filter(ze=>ze.closePrice!==null&&ze.closePrice!==void 0).map(ze=>({id:ze.id,ticket:23,symbol:ze.symbol,type:ze.type,volume:ze.volume,openPrice:ze.openPrice??ze.price,closePrice:ze.closePrice,stopLoss:ze.stopLoss,takeProfit:ze.takeProfit,profit:ze.profit??ze.profitLoss??0,profitCurrency:"USD",openAt:ze.openedAt||ze.openAt,closeAt:ze.closedAt||ze.closeAt,closeReason:ze.closeReason||"",status:"CLOSED"}));Ke(Re)}catch(Te){console.error("❌ Error fetching history orders:",Te.response?.data||Te.message),Ke([])}},[l,A]),Ge=j.useMemo(()=>{const Te=$,He=R.reduce((lt,gt)=>lt+gt.volume*gt.price*.01,0),Se=R.reduce((lt,gt)=>{const sA=U.find(eA=>eA.symbol===gt.symbol);if(sA){const eA=gt.type?.toUpperCase()==="BUY"?parseFloat(sA.bid||0):parseFloat(sA.ask||0);if(eA&&eA>0&&!isNaN(eA))return lt+qe(gt,eA)}return lt+(gt.profit||0)},0),Re=Te+Se,ze=Re-He,Ye=He>0?Re/He*100:0;return{balance:Te,equity:Re,margin:He,freeMargin:ze,level:Ye.toFixed(2)}},[R,U,$,qe]);j.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(ke(),At(),rt())},[ke,At,rt,A]),j.useEffect(()=>{(async()=>{try{N(!0);const He=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Se=await ht.get(He);let Re=[];Array.isArray(Se.data)?Re=Se.data:Se.data&&Se.data.data&&Array.isArray(Se.data.data)?Re=Se.data.data:Se.data&&Se.data.prices&&Array.isArray(Se.data.prices)?Re=Se.data.prices:Se.data&&Array.isArray(Se.data)&&(Re=Se.data);const ze=Re.map(Ye=>{const lt=Ye.symbol||Ye.name||"",gt=Ye.category||null;return lt&&(Ye.bid!==void 0||Ye.price!==void 0)?{symbol:lt,bid:Ye.bid??Ye.price??0,ask:Ye.ask??Ye.price??0,change:Ye.change??0,category:gt}:{...Ye,symbol:lt,category:gt}});ze.length>0?(F(ze),ze.find(lt=>lt.symbol===y)||v(ze[0].symbol)):F([])}catch(He){console.error("❌ Error fetching symbols:",He.response?.data||He.message),F([])}finally{N(!1)}})()},[l,u.symbols]);const De=j.useCallback(()=>{const Te=Pe.current;if(Te.size===0)return;const He=new Map(Te);Te.clear(),F(Se=>Se.map(Re=>{const ze=He.get(Re.symbol);return ze?{...Re,...ze}:Re})),M(Se=>{let Re=!1;const ze=Se.map(Ye=>{const lt=He.get(Ye.symbol);if(!lt)return Ye;const gt=Ye.type?.toUpperCase()==="BUY"?parseFloat(lt.bid||0):parseFloat(lt.ask||0);if(!gt||isNaN(gt)||gt<=0)return Ye;const sA=qe(Ye,gt);return sA===Ye.profit?Ye:(Re=!0,{...Ye,profit:sA})});return Re?ze:Se})},[qe]);j.useEffect(()=>{ve.current||(ve.current=bn.getSocket());const Te=ve.current,He=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Te.emit("joinUserRoom",{userId:Number(A)})},Se=()=>console.log("⚠️ TradingContext: Disconnected"),Re=Ye=>{Ye?.symbol&&(Pe.current.set(Ye.symbol,Ye),Be.current||(Be.current=setTimeout(()=>{Be.current=null,De()},de)))},ze=async Ye=>{if(Ye){if(Ye.newBalance!==void 0){const lt=parseFloat(Ye.newBalance);isNaN(lt)||V(lt)}if(window.notify){const lt=Ye.profitLoss||Ye.profit||0,gt=lt>=0?`+${lt.toFixed(2)}`:lt.toFixed(2),sA=Ye.symbol||"Trade",eA=Ye.reason||"Closed";window.notify(`Trade Closed: ${eA} | ${sA} | P/L: ${gt} USD`,lt>=0?"success":"error")}Ye.tradeId&&M(lt=>lt.filter(gt=>gt.id!==Ye.tradeId)),await ke(),await At()}};return Te.on("connect",He),Te.on("disconnect",Se),Te.on("priceUpdate",Re),Te.on("tradeClosed",ze),Te.connected&&A&&Number.isFinite(Number(A))&&Te.emit("joinUserRoom",{userId:Number(A)}),()=>{Te.off("connect",He),Te.off("disconnect",Se),Te.off("priceUpdate",Re),Te.off("tradeClosed",ze),Be.current&&(clearTimeout(Be.current),Be.current=null),Pe.current.clear()}},[De,ke,At]),j.useEffect(()=>{try{const Te=document.documentElement;if(!Te)return;Te.dataset.theme=Ce}catch{}},[Ce]);const Ie=j.useMemo(()=>U.find(Te=>Te.symbol===y)||{bid:"0.00000",ask:"0.00000",change:0},[U,y]),Qe=j.useMemo(()=>({selectedSymbol:y,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:ke,fetchUserBalance:At,userBalance:$,setUserBalance:V,accountSummary:Ge,currentSymbolData:Ie,activeTool:ie,setActiveTool:re,chartObjects:ce,setChartObjects:Z,showGrid:ee,setShowGrid:oe,snapToGrid:le,setSnapToGrid:se,drawingsVisible:he,setDrawingsVisible:pe,chartType:ge,setChartType:be,chartLocked:Ee,setChartLocked:ye,theme:Ce,setTheme:Fe,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:Ue,setIsShow:Ne,historyOrders:Je,setHistoryOrders:Ke,fetchHistoryOrders:rt,indicators:s,indicatorSettings:o}),[y,T,U,E,R,z,ke,At,$,Ge,Ie,ie,ce,ee,le,he,ge,Ee,Ce,l,u,m,Ue,Je,rt,s,o]);return a.jsx(Ch.Provider,{value:Qe,children:i})};var vh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Th=j.createContext&&j.createContext(vh),gm=["attr","size","title"];function mm(i,e){if(i==null)return{};var t=wm(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 wm(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 Qn(){return Qn=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},Qn.apply(this,arguments)}function xh(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 Fn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xh(Object(t),!0).forEach(function(A){Bm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Bm(i,e,t){return e=ym(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ym(i){var e=Cm(i,"string");return typeof e=="symbol"?e:e+""}function Cm(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 bh(i){return i&&i.map((e,t)=>j.createElement(e.tag,Fn({key:t},e.attr),bh(e.child)))}function zt(i){return e=>j.createElement(vm,Qn({attr:Fn({},i.attr)},e),bh(i.child))}function vm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=mm(i,gm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),j.createElement("svg",Qn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Fn(Fn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&j.createElement("title",null,n),i.children)};return Th!==void 0?j.createElement(Th.Consumer,null,t=>e(t)):e(vh)}function Tm(i){return zt({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 xm(i){return zt({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 bm(i){return zt({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 Qm(i){return zt({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 zt({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 Fm(i){return zt({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 Um(i){return zt({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 Sm(i){return zt({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 Em(i){return zt({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 Lm(i){return zt({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 Mm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Fh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Ht(),c=r==="light",[u,m]=j.useState("0.01"),[y,v]=j.useState(""),[T,C]=j.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",E=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",N=M=>{const z=parseFloat(u)||.01,Ae=Math.max(.01,z+M);m(Ae.toFixed(2))},R=async M=>{v("");const z=M,Ae=parseFloat(z==="BUY"?e:i),$=parseFloat(u);if(!$||$<=0||isNaN($)){v("Please enter a valid volume (minimum 0.01)");return}if($<.01){v("Volume must be at least 0.01");return}if(!Ae||Ae<=0||isNaN(Ae)){v("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token")??localStorage.getItem("authToken");if(!V){v("Please login to place trades");return}C(!0);const ie=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:ie,type:z,volume:$,openPrice:Ae,takeProfit:null,stopLoss:null};try{const ce=o||Mm?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",ee=await ht.post(`${ce}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(ee.status<200||ee.status>=300){v(ee.data?.message||`Failed to place trade (${ee.status})`);return}s&&s(),A&&A()}catch(ce){const Z=ce?.response?.data?.message||ce?.message||"Network error. Please try again.";v(Z)}finally{C(!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:()=>R("SELL"),disabled:T,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 ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>N(-.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Qh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const z=M.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const M=parseFloat(u);m(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>N(.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Fm,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,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):"—"})]})]}),y&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:y})]})},Hm={},Uh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:m,selectedTimeframe:y,setOrders:v,symbols:T,fetchOrders:C,theme:U,baseUrl:F,endpoints:E}=Ht(),N=U==="light",R={getContractSpec:Ie=>{const Qe=String(Ie||"").toUpperCase();return Qe.includes("BTC")||Qe.includes("ETH")||Qe.includes("SOL")||Qe.includes("XRP")||Qe.includes("ADA")||Qe.includes("DOGE")||Qe.includes("BNB")||Qe.includes("AVAX")||Qe.includes("DOT")||Qe.includes("LINK")||Qe.endsWith("USDT")?{contractSize:1}:Qe.includes("XAU")||Qe.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Ie,volume:Qe})=>{const Te=R.getContractSpec(Ie);return(parseFloat(Qe)||0)*(Te.contractSize||1)}},M=u||R,[z,Ae]=j.useState("0.01"),[$,V]=j.useState(""),[ie,re]=j.useState(""),[ce,Z]=j.useState(""),[ee,oe]=j.useState(!1),[le,se]=j.useState(null),[he,pe]=j.useState(""),[ge,be]=j.useState(t||"BUY"),[Ee,ye]=j.useState(parseFloat(A)||0),[Ce,Fe]=j.useState(parseFloat(r)||0),[Ue,Ne]=j.useState("text-white"),[Je,Ke]=j.useState("text-white"),ve=j.useRef(parseFloat(A)||0),Pe=j.useRef(parseFloat(r)||0);j.useEffect(()=>{if(!i)return;const Ie=bn.getSocket(),Qe=He=>{if(!(!He||!He.symbol)&&He.symbol.toUpperCase()===m?.toUpperCase()){const Se=parseFloat(He.bid)||0,Re=parseFloat(He.ask)||0;Se>0&&(Se>ve.current?(Ne("text-green-400"),setTimeout(()=>Ne("text-white"),500)):Se<ve.current&&ve.current>0&&(Ne("text-red-400"),setTimeout(()=>Ne("text-white"),500)),ye(Se),ve.current=Se),Re>0&&(Re>Pe.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):Re<Pe.current&&Pe.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),Fe(Re),Pe.current=Re)}};Ie.on("priceUpdate",Qe);const Te=T.find(He=>He.symbol===m);if(Te){const He=parseFloat(Te.bid)||0,Se=parseFloat(Te.ask)||0;He>0&&(ye(He),ve.current=He),Se>0&&(Fe(Se),Pe.current=Se)}return()=>{Ie.off("priceUpdate",Qe)}},[i,m,T]),j.useEffect(()=>{if(i){Ae(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),be(t||"BUY");const Ie=parseFloat(A)||0,Qe=parseFloat(r)||0;Ie>0&&(ye(Ie),ve.current=Ie),Qe>0&&(Fe(Qe),Pe.current=Qe)}},[i,t,A,r,o]);const Be=Ee||0,de=Ce||0,ke=Ie=>{const Qe=parseFloat(z)||.01,Te=Math.max(.01,Qe+Ie);Ae(Te.toFixed(2))},qe=Ie=>{const Qe=parseFloat($)||0,Te=parseFloat(ge==="BUY"?Ce:Ee)||0;if(!Te){pe("Current price not available. Please wait...");return}let He=Qe+Ie;ge==="BUY"?He=Math.max(1e-5,Math.min(He,Te-1e-5)):He=Math.max(Te+1e-5,He),V(He>0?He.toFixed(5):""),pe("")},At=Ie=>{const Qe=parseFloat(ie)||0,Te=parseFloat(ge==="BUY"?Ce:Ee)||0;if(!Te){pe("Current price not available. Please wait...");return}let He=Qe+Ie;ge==="BUY"?He=Math.max(Te+1e-5,He):He=Math.max(1e-5,Math.min(He,Te-1e-5)),re(He>0?He.toFixed(5):""),pe("")},rt=async Ie=>{pe("");const Qe=Ie||ge,Te=parseFloat(Qe==="BUY"?Ce:Ee),He=parseFloat(z),Se=$?parseFloat($):null,Re=ie?parseFloat(ie):null;if(!He||He<=0||isNaN(He)){pe("Please enter a valid volume (minimum 0.01)");return}if(He<.01){pe("Volume must be at least 0.01");return}if(!Te||Te<=0||isNaN(Te)){pe("Invalid price. Please refresh and try again.");return}if(Se!==null&&Se!==""){if(isNaN(Se)||Se<=0){pe("Stop Loss must be a valid positive number");return}if(Qe==="BUY"&&Se>=Te){pe("Stop Loss must be below the current price for BUY orders");return}if(Qe==="SELL"&&Se<=Te){pe("Stop Loss must be above the current price for SELL orders");return}}if(Re!==null&&Re!==""){if(isNaN(Re)||Re<=0){pe("Take Profit must be a valid positive number");return}if(Qe==="BUY"){if(Re<=Te){pe(`Take Profit must be above the entry price (${Te.toFixed(5)}) for BUY orders`);return}}else if(Qe==="SELL"&&Re>=Te){pe(`Take Profit must be below the entry price (${Te.toFixed(5)}) for SELL orders`);return}}be(Qe),se(Qe),oe(!0);const ze=new Date,Ye=ze.toLocaleTimeString(),lt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gt=localStorage.getItem("token")??localStorage.getItem("authToken");if(!gt){pe("Please login to place trades"),oe(!1),se(null);return}const sA={accountId:s,symbol:m,type:Qe,volume:He,price:Te,takeProfit:Re,stopLoss:Se,comment:ce.trim()||null},eA={ticket:lt.substring(0,8),symbol:m,type:Qe,volume:parseFloat(He),price:parseFloat(Te),time:Ye,stopLoss:Se?parseFloat(Se):null,takeProfit:Re?parseFloat(Re):null,swap:0,profit:0,profitCurrency:"USD",comment:ce.trim()||"",id:lt,status:"OPEN",openAt:ze.toISOString()};if(!l&&v&&v(Ze=>[...Ze,eA]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),oe(!1),se(null);return}if(n){oe(!1),se(null),e();const Ze={symbol:m,type:Qe,lotSize:He,entryPrice:Te,stopLoss:Se,takeProfit:Re,comment:ce.trim()||null};Promise.resolve(n(Ze)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(IA=>{console.error("❌ Trade execution failed:",IA),!l&&v&&v(Lt=>Lt.filter(yt=>yt.id!==lt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),oe(!1),se(null);return}oe(!1),se(null),e();const Ze=F||Hm?.VITE_BASE_URL||"http://localhost:8000",IA=E?.trades||"/api/trades";ht.post(`${Ze}${IA}`,sA,{headers:{Authorization:`Bearer ${gt}`,"Content-Type":"application/json"}}).then(Lt=>{if(Lt.data&&Lt.data.data){const yt=Lt.data.data.trade;!l&&v&&v(Gt=>Gt.map(tA=>tA.id===lt?{...tA,id:yt.id,ticket:yt.id.substring(0,8),time:Ye,openAt:yt.openAt}:tA)),console.log("✅ Trade saved successfully:",yt),window.notify&&window.notify(`Trade placed successfully: ${yt.symbol} ${yt.type}`,"success")}else{!l&&v&&v(Gt=>Gt.filter(tA=>tA.id!==lt));const yt=Lt.data?.message||"Failed to place trade";window.notify&&window.notify(yt,"error")}}).catch(Lt=>{console.error("Error placing trade:",Lt),!l&&v&&v(Gt=>Gt.filter(tA=>tA.id!==lt));let yt="Failed to place trade";if(Lt.response){const Gt=Lt.response.status,tA=Lt.response.data;Gt===400?yt=tA?.message||"Invalid trade data. Please check your inputs.":Gt===401?yt="Authentication failed. Please login again.":Gt===404?yt=tA?.message||"Symbol not found. Please select a valid symbol.":Gt===500?yt="Server error. Please try again later.":yt=tA?.message||`Error: ${Gt}`}else Lt.request&&(yt="Network error. Please check your internet connection.");window.notify&&window.notify(yt,"error")})}},De=(M?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||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:[he&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:he}),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:[De," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>ke(-.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:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d{0,2}$/.test(Qe))&&(Ae(Qe),pe(""))},onBlur:()=>{const Ie=parseFloat(z);Ae(isNaN(Ie)||Ie<.01?"0.01":Ie.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:()=>ke(.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:()=>qe(-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:$,onChange:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d*$/.test(Qe))&&(V(Qe),pe(""))},onBlur:Ie=>{const Qe=parseFloat(Ie.target.value);!isNaN(Qe)&&Qe>0?V(Qe.toFixed(5)):Ie.target.value===""&&V("")},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:()=>qe(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:()=>At(-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:ie,onChange:Ie=>{const Qe=Ie.target.value;(Qe===""||/^\d*\.?\d*$/.test(Qe))&&(re(Qe),pe(""))},onBlur:Ie=>{const Qe=parseFloat(Ie.target.value);!isNaN(Qe)&&Qe>0?re(Qe.toFixed(5)):Ie.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:()=>At(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:ce,onChange:Ie=>Z(Ie.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:`${Ue} font-medium transition-colors duration-400`,children:Be>0?Be.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:`${Je} font-medium transition-colors duration-400`,children:de>0?de.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>rt("SELL"),disabled:ee,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:ee&&le==="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:()=>rt("BUY"),disabled:ee,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:ee&&le==="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},Im={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"},Dm=[10,11,12,14,16,20,24,28,30,40],Un=[{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"}],RA={width:"78%",height:"78%",display:"block"},Sh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function _m(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 FA(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 Pm=()=>a.jsx(Em,{style:RA}),Nm=()=>a.jsx(Lm,{style:RA}),km=()=>a.jsx(Qm,{style:RA}),Om=()=>a.jsx(Sm,{style:RA}),Km=()=>a.jsx(xm,{style:RA}),Vm=()=>a.jsx(Tm,{style:RA}),zm=()=>a.jsx(bm,{style:RA}),Wm=()=>a.jsx(Qh,{style:RA}),Ko=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function hr({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(Ko,{size:"18px",children:r})})}function je({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:Sh}),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 St({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=FA(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:u=>e(u.target.value),disabled:A,style:{...Sh,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:u=>{const m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function cA({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 ui({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(Wm,{})})]})}function Rm({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===Un.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:Un.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(je,{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:Un.map(s=>a.jsx(je,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Gm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,FA(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(St,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Dm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(hr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(km,{})}),a.jsx(hr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Om,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(hr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(Km,{})}),a.jsx(hr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Vm,{})}),a.jsx(hr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(zm,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(je,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(je,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(St,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(cA,{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(je,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(St,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(cA,{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 Sn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(je,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(je,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function $m({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Xm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(je,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(je,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(je,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Zm({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(cA,{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 di(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 pi({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:di(i.point1Time),style:n}),a.jsx(cA,{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:di(i.point2Time),style:n}),a.jsx(cA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Eh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,FA(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(St,{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(je,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(je,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(St,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{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(ui,{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 Jm({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(cA,{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 Ym({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:di(i.originTime),style:r}),a.jsx(cA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function qm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function jm({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:di(i.rawTime),style:t})]})})}function ew({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(St,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(je,{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(je,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(je,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function tw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(je,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function Aw({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:di(i.rawTime),style:r}),a.jsx(cA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Lh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,FA(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(St,{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(je,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(St,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(cA,{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(je,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(St,{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(je,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(je,{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(je,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(je,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Mh({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:di(i.point1Time),style:n}),a.jsx(cA,{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:di(i.point2Time),style:n}),a.jsx(cA,{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(cA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function iw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||Un.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 Hh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Ht(),s=_m(r==="light"),[o,l]=j.useState("style"),[c,u]=j.useState({}),[m,y]=j.useState(null),v=j.useRef(null),T=j.useRef(null);j.useEffect(()=>{t&&(u(iw(t)),l("style"))},[t]),j.useEffect(()=>{i||y(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const z=v.current;if(!z)return;const Ae=z.offsetParent,$=Ae?Ae.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),ie=V.left-$.left,re=V.top-$.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:ie,startY:re},y({x:ie,y:re});const ce=ee=>{const{startMX:oe,startMY:le,startX:se,startY:he}=T.current;y({x:se+ee.clientX-oe,y:he+ee.clientY-le})},Z=()=>{T.current=null,document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Z)};if(!i||!t)return null;const U=Im[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(Rm,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Gm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Zm,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Eh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Jm,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Eh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ym,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(qm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(jm,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Xm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx($m,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Sn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(tw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Aw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(ew,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Mh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Mh,{draft:c,setDraft:u,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:v,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:C,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:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(Ko,{size:"18px",children:a.jsx(Pm,{})})})]})}),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(Ko,{size:"20px",children:a.jsx(Nm,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const z=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),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:[M.charAt(0).toUpperCase()+M.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:E()}),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 Vo=function(i,e){return Vo=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])},Vo(i,e)};function BA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Vo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var zo=function(){return zo=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},zo.apply(this,arguments)};function Wt(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(u){try{c(A.next(u))}catch(m){s(m)}}function l(u){try{c(A.throw(u))}catch(m){s(m)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function kt(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(u){return l([c,u])}}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(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function En(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 NA=(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})(),Ln=function(i,e){return NA.fromClientRect(i,e.getBoundingClientRect())},rw=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 NA(0,0,A,r)},Mn=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},Tt=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},Ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Hn=0;Hn<Ih.length;Hn++)nw[Ih.charCodeAt(Hn)]=Hn;for(var Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),In=0;In<Dh.length;In++)ur[Dh.charCodeAt(In)]=In;for(var sw=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),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=ur[i.charCodeAt(A)],s=ur[i.charCodeAt(A+1)],o=ur[i.charCodeAt(A+2)],l=ur[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},ow=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},aw=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},fi=5,Wo=11,Ro=2,lw=Wo-fi,_h=65536>>fi,cw=1<<fi,Go=cw-1,hw=1024>>fi,uw=_h+hw,dw=uw,pw=32,fw=dw+pw,gw=65536>>Wo,mw=1<<lw,ww=mw-1,Ph=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Bw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},yw=function(i,e){var t=sw(i),A=Array.isArray(t)?aw(t):new Uint32Array(t),r=Array.isArray(t)?ow(t):new Uint16Array(t),n=24,s=Ph(r,n/2,A[4]/2),o=A[5]===2?Ph(r,(n+A[4])/2):Bw(A,Math.ceil((n+A[4])/4));return new Cw(A[0],A[1],A[2],A[3],s,o)},Cw=(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>>fi],t=(t<<Ro)+(e&Go),this.data[t];if(e<=65535)return t=this.index[_h+(e-55296>>fi)],t=(t<<Ro)+(e&Go),this.data[t];if(e<this.highStart)return t=fw-gw+(e>>Wo),t=this.index[t],t+=e>>fi&ww,t=this.index[t],t=(t<<Ro)+(e&Go),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Nh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Dn=0;Dn<Nh.length;Dn++)vw[Nh.charCodeAt(Dn)]=Dn;var Tw="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==",kh=50,xw=1,Oh=2,Kh=3,bw=4,Qw=5,Vh=7,zh=8,Wh=9,GA=10,$o=11,Rh=12,Xo=13,Fw=14,dr=15,Zo=16,_n=17,pr=18,Uw=19,Gh=20,Jo=21,fr=22,Yo=23,Ei=24,nA=25,gr=26,mr=27,Li=28,Sw=29,gi=30,Ew=31,Pn=32,Nn=33,qo=34,jo=35,ea=36,wr=37,ta=38,kn=39,On=40,Aa=41,$h=42,Lw=43,Mw=[9001,65288],Xh="!",nt="×",Kn="÷",ia=yw(Tw),kA=[gi,ea],ra=[xw,Oh,Kh,Qw],Zh=[GA,zh],Jh=[mr,gr],Hw=ra.concat(Zh),Yh=[ta,kn,On,qo,jo],Iw=[dr,Xo],Dw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ia.get(n);if(o>kh?(r.push(!0),o-=kh):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(Zo);if(o===bw||o===$o){if(s===0)return A.push(s),t.push(gi);var l=t[s-1];return Hw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(gi))}if(A.push(s),o===Ew)return t.push(e==="strict"?Jo:wr);if(o===$h||o===Sw)return t.push(gi);if(o===Lw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(wr):t.push(gi);t.push(o)}),[A,t,r]},na=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!==GA)break}if(r===GA)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!==GA)break}if(o!==GA)break}return!1},qh=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===GA)t--;else return A}return 0},_w=function(i,e,t,A,r){if(t[A]===0)return nt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return nt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===Oh&&u===Kh)return nt;if(ra.indexOf(l)!==-1)return Xh;if(ra.indexOf(u)!==-1||Zh.indexOf(u)!==-1)return nt;if(qh(n,e)===zh)return Kn;if(ia.get(i[n])===$o||(l===Pn||l===Nn)&&ia.get(i[o])===$o||l===Vh||u===Vh||l===Wh||[GA,Xo,dr].indexOf(l)===-1&&u===Wh||[_n,pr,Uw,Ei,Li].indexOf(u)!==-1||qh(n,e)===fr||na(Yo,fr,n,e)||na([_n,pr],Jo,n,e)||na(Rh,Rh,n,e))return nt;if(l===GA)return Kn;if(l===Yo||u===Yo)return nt;if(u===Zo||l===Zo)return Kn;if([Xo,dr,Jo].indexOf(u)!==-1||l===Fw||c===ea&&Iw.indexOf(l)!==-1||l===Li&&u===ea||u===Gh||kA.indexOf(u)!==-1&&l===nA||kA.indexOf(l)!==-1&&u===nA||l===mr&&[wr,Pn,Nn].indexOf(u)!==-1||[wr,Pn,Nn].indexOf(l)!==-1&&u===gr||kA.indexOf(l)!==-1&&Jh.indexOf(u)!==-1||Jh.indexOf(l)!==-1&&kA.indexOf(u)!==-1||[mr,gr].indexOf(l)!==-1&&(u===nA||[fr,dr].indexOf(u)!==-1&&e[o+1]===nA)||[fr,dr].indexOf(l)!==-1&&u===nA||l===nA&&[nA,Li,Ei].indexOf(u)!==-1)return nt;if([nA,Li,Ei,_n,pr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===nA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if([mr,gr].indexOf(u)!==-1)for(var m=[_n,pr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===nA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if(ta===l&&[ta,kn,qo,jo].indexOf(u)!==-1||[kn,qo].indexOf(l)!==-1&&[kn,On].indexOf(u)!==-1||[On,jo].indexOf(l)!==-1&&u===On||Yh.indexOf(l)!==-1&&[Gh,gr].indexOf(u)!==-1||Yh.indexOf(u)!==-1&&l===mr||kA.indexOf(l)!==-1&&kA.indexOf(u)!==-1||l===Ei&&kA.indexOf(u)!==-1||kA.concat(nA).indexOf(l)!==-1&&u===fr&&Mw.indexOf(i[o])===-1||kA.concat(nA).indexOf(u)!==-1&&l===pr)return nt;if(l===Aa&&u===Aa){for(var v=t[n],T=1;v>0&&(v--,e[v]===Aa);)T++;if(T%2!==0)return nt}return l===Pn&&u===Nn?nt:Kn},Pw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Dw(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[nA,gi,$h].indexOf(o)!==-1?wr: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]},Nw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Xh,this.start=A,this.end=r}return i.prototype.slice=function(){return Tt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),kw=function(i,e){var t=Mn(i),A=Pw(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 u=nt;c<o&&(u=_w(t,n,r,++c,s))===nt;);if(u!==nt||c===o){var m=new Nw(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},Ow=1,Kw=2,Br=4,jh=8,Vn=10,eu=47,yr=92,Vw=9,zw=32,zn=34,Cr=61,Ww=35,Rw=36,Gw=37,Wn=39,Rn=40,vr=41,$w=95,Yt=45,Xw=33,Zw=60,Jw=62,Yw=64,qw=91,jw=93,eB=61,tB=123,Gn=63,AB=125,tu=124,iB=126,rB=128,Au=65533,sa=42,mi=43,nB=44,sB=58,oB=59,Tr=46,aB=0,lB=8,cB=11,hB=14,uB=31,dB=127,UA=-1,iu=48,ru=97,nu=101,pB=102,fB=117,gB=122,su=65,ou=69,au=70,mB=85,wB=90,Ot=function(i){return i>=iu&&i<=57},BB=function(i){return i>=55296&&i<=57343},Mi=function(i){return Ot(i)||i>=su&&i<=au||i>=ru&&i<=pB},yB=function(i){return i>=ru&&i<=gB},CB=function(i){return i>=su&&i<=wB},vB=function(i){return yB(i)||CB(i)},TB=function(i){return i>=rB},$n=function(i){return i===Vn||i===Vw||i===zw},Xn=function(i){return vB(i)||TB(i)||i===$w},lu=function(i){return Xn(i)||Ot(i)||i===Yt},xB=function(i){return i>=aB&&i<=lB||i===cB||i>=hB&&i<=uB||i===dB},$A=function(i,e){return i!==yr?!1:e!==Vn},Zn=function(i,e,t){return i===Yt?Xn(e)||$A(e,t):Xn(i)?!0:!!(i===yr&&$A(i,e))},oa=function(i,e,t){return i===mi||i===Yt?Ot(e)?!0:e===Tr&&Ot(t):Ot(i===Tr?e:i)},bB=function(i){var e=0,t=1;(i[e]===mi||i[e]===Yt)&&(i[e]===Yt&&(t=-1),e++);for(var A=[];Ot(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Tt.apply(void 0,A),10):0;i[e]===Tr&&e++;for(var n=[];Ot(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Tt.apply(void 0,n),10):0;(i[e]===ou||i[e]===nu)&&e++;var l=1;(i[e]===mi||i[e]===Yt)&&(i[e]===Yt&&(l=-1),e++);for(var c=[];Ot(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Tt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},QB={type:2},FB={type:3},UB={type:4},SB={type:13},EB={type:8},LB={type:21},MB={type:9},HB={type:10},IB={type:11},DB={type:12},_B={type:14},Jn={type:23},PB={type:1},NB={type:25},kB={type:24},OB={type:26},KB={type:27},VB={type:28},zB={type:29},WB={type:31},aa={type:32},cu=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat(Mn(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==aa;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case zn:return this.consumeStringToken(zn);case Ww:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(lu(t)||$A(A,r)){var n=Zn(t,A,r)?Kw:Ow,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Rw:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),SB;break;case Wn:return this.consumeStringToken(Wn);case Rn:return QB;case vr:return FB;case sa:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),_B;break;case mi:if(oa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case nB:return UB;case Yt:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(oa(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Zn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Yt&&c===Jw)return this.consumeCodePoint(),this.consumeCodePoint(),kB;break;case Tr:if(oa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case eu:if(this.peekCodePoint(0)===sa)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===sa&&(u=this.consumeCodePoint(),u===eu))return this.consumeToken();if(u===UA)return this.consumeToken()}break;case sB:return OB;case oB:return KB;case Zw:if(this.peekCodePoint(0)===Xw&&this.peekCodePoint(1)===Yt&&this.peekCodePoint(2)===Yt)return this.consumeCodePoint(),this.consumeCodePoint(),NB;break;case Yw:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(Zn(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case qw:return VB;case yr:if($A(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case jw:return zB;case eB:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),EB;break;case tB:return IB;case AB:return DB;case fB:case mB:var T=this.peekCodePoint(0),C=this.peekCodePoint(1);return T===mi&&(Mi(C)||C===Gn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case tu:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),MB;if(this.peekCodePoint(0)===tu)return this.consumeCodePoint(),LB;break;case iB:if(this.peekCodePoint(0)===Cr)return this.consumeCodePoint(),HB;break;case UA:return aa}return $n(e)?(this.consumeWhiteSpace(),WB):Ot(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Xn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Tt(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();Mi(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===Gn&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Tt.apply(void 0,e.map(function(l){return l===Gn?iu:l})),16),n=parseInt(Tt.apply(void 0,e.map(function(l){return l===Gn?au:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Tt.apply(void 0,e),16);if(this.peekCodePoint(0)===Yt&&Mi(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Mi(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Tt.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)===Rn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Rn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===UA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Wn||t===zn){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===UA||this.peekCodePoint(0)===vr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),Jn)}for(;;){var r=this.consumeCodePoint();if(r===UA||r===vr)return{type:22,value:Tt.apply(void 0,e)};if($n(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===UA||this.peekCodePoint(0)===vr?(this.consumeCodePoint(),{type:22,value:Tt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Jn);if(r===zn||r===Wn||r===Rn||xB(r))return this.consumeBadUrlRemnants(),Jn;if(r===yr)if($A(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Jn;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;$n(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===vr||e===UA)return;$A(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+=Tt.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===UA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===Vn)return this._value.splice(0,A),PB;if(r===yr){var n=this._value[A+1];n!==UA&&n!==void 0&&(n===Vn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):$A(r,n)&&(t+=this.consumeStringSlice(A),t+=Tt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Br,A=this.peekCodePoint(0);for((A===mi||A===Yt)&&e.push(this.consumeCodePoint());Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===Tr&&Ot(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===ou||A===nu)&&((r===mi||r===Yt)&&Ot(n)||Ot(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=jh;Ot(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[bB(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(Zn(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===Gw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Mi(e)){for(var t=Tt(e);Mi(this.peekCodePoint(0))&&t.length<6;)t+=Tt(this.consumeCodePoint());$n(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||BB(A)||A>1114111?Au:A}return e===UA?Au:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(lu(t))e+=Tt(t);else if($A(t,this.peekCodePoint(0)))e+=Tt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),hu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new cu;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||GB(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"?aa:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),xr=function(i){return i.type===15},Hi=function(i){return i.type===17},ut=function(i){return i.type===20},RB=function(i){return i.type===0},la=function(i,e){return ut(i)&&i.value===e},uu=function(i){return i.type!==31},Ii=function(i){return i.type!==31&&i.type!==4},SA=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},GB=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},XA=function(i){return i.type===17||i.type===15},Ft=function(i){return i.type===16||XA(i)},du=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},It={type:17,number:0,flags:Br},ca={type:16,number:50,flags:Br},ZA={type:16,number:100,flags:Br},br=function(i,e,t){var A=i[0],r=i[1];return[ft(A,e),ft(typeof r<"u"?r:A,t)]},ft=function(i,e){if(i.type===16)return i.number/100*e;if(xr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},pu="deg",fu="grad",gu="rad",mu="turn",Yn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case pu:return Math.PI*e.number/180;case fu:return Math.PI/200*e.number;case gu:return e.number;case mu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},wu=function(i){return i.type===15&&(i.unit===pu||i.unit===fu||i.unit===gu||i.unit===mu)},Bu=function(i){var e=i.filter(ut).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[It,It];case"to top":case"bottom":return hA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[It,ZA];case"to right":case"left":return hA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ZA,ZA];case"to bottom":case"top":return hA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ZA,It];case"to left":case"right":return hA(270)}return 0},hA=function(i){return Math.PI*i/180},JA={name:"color",parse:function(i,e){if(e.type===18){var t=$B[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 qA(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 qA(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 qA(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 qA(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=OA[e.value.toUpperCase()];if(typeof o<"u")return o}return OA.TRANSPARENT}},YA=function(i){return(255&i)===0},Et=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+")"},qA=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},yu=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},Cu=function(i,e){var t=e.filter(Ii);if(t.length===3){var A=t.map(yu),r=A[0],n=A[1],s=A[2];return qA(r,n,s,1)}if(t.length===4){var o=t.map(yu),r=o[0],n=o[1],s=o[2],l=o[3];return qA(r,n,s,l)}return 0};function ha(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 vu=function(i,e){var t=e.filter(Ii),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?hA(A.number):Yn.parse(i,A))/(Math.PI*2),l=Ft(r)?r.number/100:0,c=Ft(n)?n.number/100:0,u=typeof s<"u"&&Ft(s)?ft(s,1):1;if(l===0)return qA(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=ha(y,m,o+1/3),T=ha(y,m,o),C=ha(y,m,o-1/3);return qA(v*255,T*255,C*255,u)},$B={hsl:vu,hsla:vu,rgb:Cu,rgba:Cu},Qr=function(i,e){return JA.parse(i,hu.create(e).parseComponentValue())},OA={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},XB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ZB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},qn=function(i,e){var t=JA.parse(i,e[0]),A=e[1];return A&&Ft(A)?{color:t,stop:A}:{color:t,stop:null}},Tu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=It),A.stop===null&&(A.stop=ZA);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=ft(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 u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,y=r[c-1],v=(u-y)/(m+1),T=1;T<=m;T++)r[c+T-1]=v*T;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},JB=function(i,e,t){var A=e/2,r=t/2,n=ft(i[0],e)-A,s=r-ft(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},YB=function(i,e,t){var A=typeof i=="number"?i:JB(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]},yA=function(i,e){return Math.sqrt(i*i+e*e)},xu=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],u=yA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},qB=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(yA(e,t),yA(e,t-r),yA(e-A,t),yA(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=xu(A,r,e,t,!0),c=l[0],u=l[1];n=yA(c-e,(u-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(yA(e,t),yA(e,t-r),yA(e-A,t),yA(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)),m=xu(A,r,e,t,!1),c=m[0],u=m[1];n=yA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=ft(i.size[0],A),s=i.size.length===2?ft(i.size[1],r):n),[n,s]},jB=function(i,e){var t=hA(180),A=[];return SA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Bu(r);return}else if(wu(s)){t=Yn.parse(i,s);return}}var o=qn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},jn=function(i,e){var t=hA(180),A=[];return SA(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=Bu(r);return}else if(wu(s)){t=(Yn.parse(i,s)+hA(270))%hA(360);return}}var o=qn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},e2=function(i,e){var t=hA(180),A=[],r=1,n=0,s=3,o=[];return SA(e).forEach(function(l,c){var u=l[0];if(c===0){if(ut(u)&&u.value==="linear"){r=1;return}else if(ut(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=JA.parse(i,u.values[0]);A.push({stop:It,color:m})}else if(u.name==="to"){var m=JA.parse(i,u.values[0]);A.push({stop:ZA,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Ii);if(y.length===2){var m=JA.parse(i,y[1]),v=y[0];Hi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+hA(180))%hA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},bu="closest-side",Qu="farthest-side",Fu="closest-corner",Uu="farthest-corner",Su="circle",Eu="ellipse",Lu="cover",Mu="contain",t2=function(i,e){var t=0,A=3,r=[],n=[];return SA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(ut(y))switch(y.value){case"center":return n.push(ca),m;case"top":case"left":return n.push(It),m;case"right":case"bottom":return n.push(ZA),m}else(Ft(y)||XA(y))&&n.push(y);else if(ut(y))switch(y.value){case Su:return t=0,!1;case Eu:return t=1,!1;case"at":return c=!0,!1;case bu:return A=0,!1;case Lu:case Qu:return A=1,!1;case Mu:case Fu:return A=2,!1;case Uu:return A=3,!1}else if(XA(y)||Ft(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=qn(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},es=function(i,e){var t=0,A=3,r=[],n=[];return SA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(ut(m))switch(m.value){case"center":return n.push(ca),!1;case"top":case"left":return n.push(It),!1;case"right":case"bottom":return n.push(ZA),!1}else if(Ft(m)||XA(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(ut(m))switch(m.value){case Su:return t=0,!1;case Eu:return t=1,!1;case Mu:case bu:return A=0,!1;case Qu:return A=1,!1;case Fu:return A=2,!1;case Lu:case Uu:return A=3,!1}else if(XA(m)||Ft(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=qn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},A2=function(i){return i.type===1},i2=function(i){return i.type===2},ua={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=Hu[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 r2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Hu[i.name])}var Hu={"linear-gradient":jB,"-moz-linear-gradient":jn,"-ms-linear-gradient":jn,"-o-linear-gradient":jn,"-webkit-linear-gradient":jn,"radial-gradient":t2,"-moz-radial-gradient":es,"-ms-radial-gradient":es,"-o-radial-gradient":es,"-webkit-radial-gradient":es,"-webkit-gradient":e2},n2={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 Ii(A)&&r2(A)}).map(function(A){return ua.parse(i,A)})}},s2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},o2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return SA(e).map(function(t){return t.filter(Ft)}).map(du)}},a2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return SA(e).map(function(t){return t.filter(ut).map(function(A){return A.value}).join(" ")}).map(l2)}},l2=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}},Di;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Di||(Di={}));var c2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return SA(e).map(function(t){return t.filter(h2)})}},h2=function(i){return ut(i)||Ft(i)},ts=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},u2=ts("top"),d2=ts("right"),p2=ts("bottom"),f2=ts("left"),As=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return du(t.filter(Ft))}}},g2=As("top-left"),m2=As("top-right"),w2=As("bottom-right"),B2=As("bottom-left"),is=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}}},y2=is("top"),C2=is("right"),v2=is("bottom"),T2=is("left"),rs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return xr(t)?t.number:0}}},x2=rs("top"),b2=rs("right"),Q2=rs("bottom"),F2=rs("left"),U2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},S2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},E2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).reduce(function(t,A){return t|L2(A.value)},0)}},L2=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},M2={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}},H2={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}},ns;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ns||(ns={}));var I2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ns.STRICT:ns.NORMAL}},D2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Iu=function(i,e){return ut(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Ft(i)?ft(i,e):e},_2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:ua.parse(i,e)}},P2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},da={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}}},ss=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},N2=ss("top"),k2=ss("right"),O2=ss("bottom"),K2=ss("left"),V2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).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}})}},z2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},os=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},W2=os("top"),R2=os("right"),G2=os("bottom"),$2=os("left"),X2={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}}},Z2={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}},J2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&la(e[0],"none")?[]:SA(e).map(function(t){for(var A={color:OA.TRANSPARENT,offsetX:It,offsetY:It,blur:It},r=0,n=0;n<t.length;n++){var s=t[n];XA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=JA.parse(i,s)}return A})}},Y2={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}},q2={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=ty[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},j2=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},ey=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},ty={matrix:j2,matrix3d:ey},Du={type:16,number:50,flags:Br},Ay=[Du,Du],iy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Ft);return t.length!==2?Ay:[t[0],t[1]]}},ry={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}}},Fr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Fr||(Fr={}));for(var ny={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Fr.BREAK_ALL;case"keep-all":return Fr.KEEP_ALL;default:return Fr.NORMAL}}},sy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Hi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},_u={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")}},oy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:1}},ay={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ly={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).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})}},cy={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+"'"})}},hy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},uy={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:ut(e)&&e.value==="bold"?700:400}},dy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(ut).map(function(t){return t.value})}},py={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"}}},Ut=function(i,e){return(i&e)!==0},fy={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}},gy={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(uu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Hi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},my={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(uu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(ut(n)&&n.value!=="none"){var o=s&&Hi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},wy={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(xr).map(function(t){return _u.parse(i,t)})}},By={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(RB);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}},Pu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},yy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&la(e[0],"none")?[]:SA(e).map(function(t){for(var A={color:255,offsetX:It,offsetY:It,blur:It,spread:It,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];la(s,"inset")?A.inset=!0:XA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=JA.parse(i,s)}return A})}},Cy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(ut).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}},vy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Ty={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return xr(e)?e.number:0}},xy=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,wy,t.animationDuration),this.backgroundClip=Oe(e,XB,t.backgroundClip),this.backgroundColor=Oe(e,ZB,t.backgroundColor),this.backgroundImage=Oe(e,n2,t.backgroundImage),this.backgroundOrigin=Oe(e,s2,t.backgroundOrigin),this.backgroundPosition=Oe(e,o2,t.backgroundPosition),this.backgroundRepeat=Oe(e,a2,t.backgroundRepeat),this.backgroundSize=Oe(e,c2,t.backgroundSize),this.borderTopColor=Oe(e,u2,t.borderTopColor),this.borderRightColor=Oe(e,d2,t.borderRightColor),this.borderBottomColor=Oe(e,p2,t.borderBottomColor),this.borderLeftColor=Oe(e,f2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,g2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,m2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,w2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,B2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,y2,t.borderTopStyle),this.borderRightStyle=Oe(e,C2,t.borderRightStyle),this.borderBottomStyle=Oe(e,v2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,T2,t.borderLeftStyle),this.borderTopWidth=Oe(e,x2,t.borderTopWidth),this.borderRightWidth=Oe(e,b2,t.borderRightWidth),this.borderBottomWidth=Oe(e,Q2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,F2,t.borderLeftWidth),this.boxShadow=Oe(e,yy,t.boxShadow),this.color=Oe(e,U2,t.color),this.direction=Oe(e,S2,t.direction),this.display=Oe(e,E2,t.display),this.float=Oe(e,M2,t.cssFloat),this.fontFamily=Oe(e,cy,t.fontFamily),this.fontSize=Oe(e,hy,t.fontSize),this.fontStyle=Oe(e,py,t.fontStyle),this.fontVariant=Oe(e,dy,t.fontVariant),this.fontWeight=Oe(e,uy,t.fontWeight),this.letterSpacing=Oe(e,H2,t.letterSpacing),this.lineBreak=Oe(e,I2,t.lineBreak),this.lineHeight=Oe(e,D2,t.lineHeight),this.listStyleImage=Oe(e,_2,t.listStyleImage),this.listStylePosition=Oe(e,P2,t.listStylePosition),this.listStyleType=Oe(e,da,t.listStyleType),this.marginTop=Oe(e,N2,t.marginTop),this.marginRight=Oe(e,k2,t.marginRight),this.marginBottom=Oe(e,O2,t.marginBottom),this.marginLeft=Oe(e,K2,t.marginLeft),this.opacity=Oe(e,oy,t.opacity);var n=Oe(e,V2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,z2,t.overflowWrap),this.paddingTop=Oe(e,W2,t.paddingTop),this.paddingRight=Oe(e,R2,t.paddingRight),this.paddingBottom=Oe(e,G2,t.paddingBottom),this.paddingLeft=Oe(e,$2,t.paddingLeft),this.paintOrder=Oe(e,Cy,t.paintOrder),this.position=Oe(e,Z2,t.position),this.textAlign=Oe(e,X2,t.textAlign),this.textDecorationColor=Oe(e,ay,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,ly,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,J2,t.textShadow),this.textTransform=Oe(e,Y2,t.textTransform),this.transform=Oe(e,q2,t.transform),this.transformOrigin=Oe(e,iy,t.transformOrigin),this.visibility=Oe(e,ry,t.visibility),this.webkitTextStrokeColor=Oe(e,vy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,Ty,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,ny,t.wordBreak),this.zIndex=Oe(e,sy,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return YA(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 Ut(this.display,4)||Ut(this.display,33554432)||Ut(this.display,268435456)||Ut(this.display,536870912)||Ut(this.display,67108864)||Ut(this.display,134217728)},i})(),by=(function(){function i(e,t){this.content=Oe(e,fy,t.content),this.quotes=Oe(e,By,t.quotes)}return i})(),Nu=(function(){function i(e,t){this.counterIncrement=Oe(e,gy,t.counterIncrement),this.counterReset=Oe(e,my,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new cu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new hu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,ut(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 Yn.parse(i,n.parseComponentValue());case"color":return JA.parse(i,n.parseComponentValue());case"image":return ua.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return XA(o)?o:It;case"length-percentage":var l=n.parseComponentValue();return Ft(l)?l:It;case"time":return _u.parse(i,n.parseComponentValue())}break}},Qy="data-html2canvas-debug",Fy=function(i){var e=i.getAttribute(Qy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},pa=function(i,e){var t=Fy(i);return t===1||e===t},EA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,pa(t,3))debugger;this.styles=new xy(e,window.getComputedStyle(t,null)),Ua(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Ln(this.context,t),pa(t,4)&&(this.flags|=16)}return i})(),Uy="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ur=typeof Uint8Array>"u"?[]:new Uint8Array(256),as=0;as<ku.length;as++)Ur[ku.charCodeAt(as)]=as;for(var Sy=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),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Ur[i.charCodeAt(A)],s=Ur[i.charCodeAt(A+1)],o=Ur[i.charCodeAt(A+2)],l=Ur[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Ey=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Ly=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},wi=5,fa=11,ga=2,My=fa-wi,Ou=65536>>wi,Hy=1<<wi,ma=Hy-1,Iy=1024>>wi,Dy=Ou+Iy,_y=Dy,Py=32,Ny=_y+Py,ky=65536>>fa,Oy=1<<My,Ky=Oy-1,Ku=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Vy=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},zy=function(i,e){var t=Sy(i),A=Array.isArray(t)?Ly(t):new Uint32Array(t),r=Array.isArray(t)?Ey(t):new Uint16Array(t),n=24,s=Ku(r,n/2,A[4]/2),o=A[5]===2?Ku(r,(n+A[4])/2):Vy(A,Math.ceil((n+A[4])/4));return new Wy(A[0],A[1],A[2],A[3],s,o)},Wy=(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>>wi],t=(t<<ga)+(e&ma),this.data[t];if(e<=65535)return t=this.index[Ou+(e-55296>>wi)],t=(t<<ga)+(e&ma),this.data[t];if(e<this.highStart)return t=Ny-ky+(e>>fa),t=this.index[t],t+=e>>wi&Ky,t=this.index[t],t=(t<<ga)+(e&ma),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Vu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ry=typeof Uint8Array>"u"?[]:new Uint8Array(256),ls=0;ls<Vu.length;ls++)Ry[Vu.charCodeAt(ls)]=ls;var Gy=1,wa=2,Ba=3,zu=4,Wu=5,$y=7,Ru=8,ya=9,Ca=10,Gu=11,$u=12,Xu=13,Zu=14,va=15,Xy=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},Zy=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},Jy=zy(Uy),uA="×",Ta="÷",Yy=function(i){return Jy.get(i)},qy=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===wa&&s===Ba)return uA;if(n===wa||n===Ba||n===zu||s===wa||s===Ba||s===zu)return Ta;if(n===Ru&&[Ru,ya,Gu,$u].indexOf(s)!==-1||(n===Gu||n===ya)&&(s===ya||s===Ca)||(n===$u||n===Ca)&&s===Ca||s===Xu||s===Wu||s===$y||n===Gy)return uA;if(n===Xu&&s===Zu){for(;r===Wu;)r=e[--A];if(r===Zu)return uA}if(n===va&&s===va){for(var o=0;r===va;)o++,r=e[--A];if(o%2===0)return uA}return Ta},jy=function(i){var e=Xy(i),t=e.length,A=0,r=0,n=e.map(Yy);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=uA;A<t&&(s=qy(e,n,++A))===uA;);if(s!==uA||A===t){var o=Zy.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},eC=function(i){for(var e=jy(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},tC=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},AC=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"?"&#128104;".repeat(10):"";var A=e.firstChild,r=Mn(A.data).map(function(l){return Tt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var m=u.x>s.x||u.y>s.y;return s=u,c===0?!0:m});return i.body.removeChild(e),o},iC=function(){return typeof new Image().crossOrigin<"u"},rC=function(){return typeof new XMLHttpRequest().responseType=="string"},nC=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},Ju=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},sC=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=xa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),Yu(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",Ju(l)?Yu(xa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),Ju(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},xa=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},Yu=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))})},Dt={get SUPPORT_RANGE_BOUNDS(){var i=tC(document);return Object.defineProperty(Dt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Dt.SUPPORT_RANGE_BOUNDS&&AC(document);return Object.defineProperty(Dt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=nC(document);return Object.defineProperty(Dt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?sC(document):Promise.resolve(!1);return Object.defineProperty(Dt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=iC();return Object.defineProperty(Dt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=rC();return Object.defineProperty(Dt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Dt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Dt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Sr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),oC=function(i,e,t,A){var r=cC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Dt.SUPPORT_RANGE_BOUNDS){var l=qu(A,s,o.length).getClientRects();if(l.length>1){var c=ba(o),u=0;c.forEach(function(y){n.push(new Sr(y,NA.fromDOMRectList(i,qu(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new Sr(o,NA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Sr(o,aC(i,A))),A=m}else Dt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},aC=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=Ln(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return NA.EMPTY},qu=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},ba=function(i){if(Dt.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 eC(i)},lC=function(i,e){if(Dt.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 uC(i,e)},cC=function(i,e){return e.letterSpacing!==0?ba(i):lC(i,e)},hC=[32,160,4961,65792,65793,4153,4241],uC=function(i,e){for(var t=kw(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=Mn(s),l="";o.forEach(function(c){hC.indexOf(c)===-1?l+=Tt(c):(l.length&&A.push(l),A.push(Tt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},dC=(function(){function i(e,t,A){this.text=pC(t.data,A.textTransform),this.textBounds=oC(e,this.text,A,t)}return i})(),pC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(fC,gC);case 2:return i.toUpperCase();default:return i}},fC=/(^|\s|:|-|\(|\))([a-z])/g,gC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},ju=(function(i){BA(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})(EA),ed=(function(i){BA(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})(EA),td=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Ln(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})(EA),Ad=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(EA),Qa=(function(i){BA(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})(EA),mC=[{type:15,flags:0,unit:"px",number:3}],wC=[{type:16,flags:0,number:50}],BC=function(i){return i.width>i.height?new NA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new NA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},yC=function(i){var e=i.type===CC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},cs="checkbox",hs="radio",CC="password",id=707406591,Fa=(function(i){BA(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=yC(A),(r.type===cs||r.type===hs)&&(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=BC(r.bounds)),r.type){case cs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=mC;break;case hs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=wC;break}return r}return e})(EA),rd=(function(i){BA(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})(EA),nd=(function(i){BA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(EA),sd=(function(i){BA(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=ad(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Qr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):OA.TRANSPARENT,s=A.contentWindow.document.body?Qr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):OA.TRANSPARENT;r.backgroundColor=YA(n)?YA(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(EA),vC=["OL","UL","MENU"],us=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,ld(r)&&r.data.trim().length>0)t.textNodes.push(new dC(i,r,t.styles));else if(_i(r))if(fd(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return us(i,o,t,A)});else{var s=od(i,r);s.styles.isVisible()&&(TC(r,s,A)?s.flags|=4:xC(s.styles)&&(s.flags|=2),vC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?us(i,r.shadowRoot,s,A):!ps(r)&&!cd(r)&&!fs(r)&&us(i,r,s,A))}},od=function(i,e){return Ea(e)?new ju(i,e):hd(e)?new ed(i,e):cd(e)?new td(i,e):bC(e)?new Ad(i,e):QC(e)?new Qa(i,e):FC(e)?new Fa(i,e):fs(e)?new rd(i,e):ps(e)?new nd(i,e):dd(e)?new sd(i,e):new EA(i,e)},ad=function(i,e){var t=od(i,e);return t.flags|=4,us(i,e,t,t),t},TC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Sa(i)&&t.styles.isTransparent()},xC=function(i){return i.isPositioned()||i.isFloating()},ld=function(i){return i.nodeType===Node.TEXT_NODE},_i=function(i){return i.nodeType===Node.ELEMENT_NODE},Ua=function(i){return _i(i)&&typeof i.style<"u"&&!ds(i)},ds=function(i){return typeof i.className=="object"},bC=function(i){return i.tagName==="LI"},QC=function(i){return i.tagName==="OL"},FC=function(i){return i.tagName==="INPUT"},UC=function(i){return i.tagName==="HTML"},cd=function(i){return i.tagName==="svg"},Sa=function(i){return i.tagName==="BODY"},hd=function(i){return i.tagName==="CANVAS"},ud=function(i){return i.tagName==="VIDEO"},Ea=function(i){return i.tagName==="IMG"},dd=function(i){return i.tagName==="IFRAME"},pd=function(i){return i.tagName==="STYLE"},SC=function(i){return i.tagName==="SCRIPT"},ps=function(i){return i.tagName==="TEXTAREA"},fs=function(i){return i.tagName==="SELECT"},fd=function(i){return i.tagName==="SLOT"},gd=function(i){return i.tagName.indexOf("-")>0},EC=(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})(),md={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"]},wd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},LC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},MC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Pi=function(i,e,t,A,r,n){return i<e||i>t?Lr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Bd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},xt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Bd(Math.abs(i),n,A,function(s){return Tt(Math.floor(s%n)+e)})+r)},Bi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Bd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},Ni=1,jA=2,ei=4,Er=8,KA=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Lr(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&&Ut(n,Ni)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&Ut(n,jA)||c===1&&l===1&&Ut(n,ei)&&i>100||c===1&&l>1&&Ut(n,Er)?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},yd="十百千萬",Cd="拾佰仟萬",vd="マイナス",La="마이너스",Lr=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=xt(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Bi(i,"〇一二三四五六七八九",r);case 6:return Pi(i,1,3999,md,3,A).toLowerCase();case 7:return Pi(i,1,3999,md,3,A);case 8:return xt(i,945,969,!1,A);case 9:return xt(i,97,122,!1,A);case 10:return xt(i,65,90,!1,A);case 11:return xt(i,1632,1641,!0,A);case 12:case 49:return Pi(i,1,9999,wd,3,A);case 35:return Pi(i,1,9999,wd,3,A).toLowerCase();case 13:return xt(i,2534,2543,!0,A);case 14:case 30:return xt(i,6112,6121,!0,A);case 15:return Bi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Bi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return KA(i,"零一二三四五六七八九",yd,"負",r,jA|ei|Er);case 47:return KA(i,"零壹貳參肆伍陸柒捌玖",Cd,"負",r,Ni|jA|ei|Er);case 42:return KA(i,"零一二三四五六七八九",yd,"负",r,jA|ei|Er);case 41:return KA(i,"零壹贰叁肆伍陆柒捌玖",Cd,"负",r,Ni|jA|ei|Er);case 26:return KA(i,"〇一二三四五六七八九","十百千万",vd,r,0);case 25:return KA(i,"零壱弐参四伍六七八九","拾百千万",vd,r,Ni|jA|ei);case 31:return KA(i,"영일이삼사오육칠팔구","십백천만",La,n,Ni|jA|ei);case 33:return KA(i,"零一二三四五六七八九","十百千萬",La,n,0);case 32:return KA(i,"零壹貳參四五六七八九","拾百千",La,n,Ni|jA|ei);case 18:return xt(i,2406,2415,!0,A);case 20:return Pi(i,1,19999,MC,3,A);case 21:return xt(i,2790,2799,!0,A);case 22:return xt(i,2662,2671,!0,A);case 22:return Pi(i,1,10999,LC,3,A);case 23:return Bi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Bi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return xt(i,3302,3311,!0,A);case 28:return Bi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Bi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return xt(i,3792,3801,!0,A);case 37:return xt(i,6160,6169,!0,A);case 38:return xt(i,4160,4169,!0,A);case 39:return xt(i,2918,2927,!0,A);case 40:return xt(i,1776,1785,!0,A);case 43:return xt(i,3046,3055,!0,A);case 44:return xt(i,3174,3183,!0,A);case 45:return xt(i,3664,3673,!0,A);case 46:return xt(i,3872,3881,!0,A);default:return xt(i,48,57,!0,A)}},Td="data-html2canvas-ignore",xd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new EC,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=HC(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=_C(r).then(function(){return Wt(A,void 0,void 0,function(){var u,m;return kt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(OC),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))),u=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:y.sent(),y.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,DC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(NC(document.doctype)+"<html></html>"),kC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(pa(e,2))debugger;if(hd(e))return this.createCanvasClone(e);if(ud(e))return this.createVideoClone(e);if(pd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return Ea(t)&&(Ea(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),gd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ma(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){(!_i(t)||!SC(t)&&!t.hasAttribute(Td)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!_i(t)||!pd(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(_i(n)&&fd(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(ld(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&_i(e)&&(Ua(e)||ds(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&&Ua(r)&&(this.clonedReferenceElement=r),Sa(r)&&zC(r);var l=this.counters.parse(new Nu(this.context,n)),c=this.resolvePseudoContent(e,r,s,Mr.BEFORE);gd(e)&&(t=!0),ud(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,Mr.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||ds(e))&&!dd(e)||t)&&Ma(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(ps(e)||fs(e))&&(ps(r)||fs(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 Nu(this.context,A));var l=new by(this.context,A),c=o.createElement("html2canvaspseudoelement");Ma(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var y=o.createElement("img");y.src=m.value,y.style.opacity="1",c.appendChild(y)}else if(m.type===18){if(m.name==="attr"){var v=m.values.filter(ut);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Ii),C=T[0],U=T[1];if(C&&ut(C)){var F=n.counters.getCounterValue(C.value),E=U&&ut(U)?da.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Lr(F,E,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Ii),C=N[0],R=N[1],U=N[2];if(C&&ut(C)){var M=n.counters.getCounterValues(C.value),z=U&&ut(U)?da.parse(n.context,U.value):3,Ae=R&&R.type===0?R.value:"",$=M.map(function(re){return Lr(re,z,!1)}).join(Ae);c.appendChild(o.createTextNode($))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(Pu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Pu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ha+" "+Ia;var u=r===Mr.BEFORE?" "+Ha:" "+Ia;return ds(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Mr;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Mr||(Mr={}));var HC=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(Td,"true"),i.body.appendChild(t),t},IC=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},DC=function(i){return Promise.all([].slice.call(i.images,0).map(IC))},_C=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)}})},PC=["all","d","content"],Ma=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);PC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},NC=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},kC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},OC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},KC=":before",VC=":after",Ha="___html2canvas___pseudoelement_before",Ia="___html2canvas___pseudoelement_after",bd=`{
1
+ (function(qe,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):(qe=typeof globalThis<"u"?globalThis:qe||self,a(qe.ChartSDK={},qe.jsxRuntime,qe.React))})(this,(function(qe,a,q){"use strict";var Ss=typeof document<"u"?document.currentScript:null;const Nt="17:00-17:00",Ot="America/New_York",TA="24x7",xA="UTC",Ga={EURUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},ETHUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},BNBUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},SOLUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},ADAUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},XRPUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},DOTUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},MATICUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"},LINKUSDT:{type:"crypto",session:TA,sessionTZ:xA,priceMode:"last"}},$a={type:"forex",sessionTZ:Ot,session:Nt,priceMode:"mid"};function Ri(i){return i&&Ga[i.toUpperCase()]||$a}function Or(i){return Ri(i).type==="forex"}function Kr(i){return Ri(i).type==="crypto"}function dp(i){return Ri(i).session==="24x7"}function j(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 pp(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 fp(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 Xa(i){return Array.isArray(i)?i.map(e=>({...e,time:j(e.time)})).filter(e=>e.time!=null):[]}function gp(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 ze(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function Ja(i){if(!i||typeof i!="object")return!1;const{time:e,open:t,high:A,low:r,close:n,volume:s}=i;return!(j(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 Za(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 Ya(i){if(!Array.isArray(i)||i.length===0)return[];const e=new Map;return i.forEach(t=>{const A=j(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 mp(i,e="percentile"){if(!Array.isArray(i)||i.length<3)return i;const t=i.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return i;const A=[...t].sort((s,o)=>s-o);let r,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),l=A[s],c=A[o],u=c-l;r=l-1.5*u,n=c+1.5*u}else{const s=t.reduce((c,u)=>c+u,0)/t.length,o=t.reduce((c,u)=>c+Math.pow(u-s,2),0)/t.length,l=Math.sqrt(o);if(l===0)return i;r=s-3*l,n=s+3*l}return i.map((s,o)=>{const l=s.close;if(l<r||l>n){if(o===0)return s;const c=i[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function wp(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,u=c-l;if(u>A&&((u/3600).toFixed(1),(A/3600).toFixed(1)),u>e&&u<=A){const m=i[o];let y=l+e,v=0;for(y=ze(y,e);y<c&&v<r;){const T=ze(y,e);t.some(U=>U.time===T)||(t.push({time:T,open:m.close,high:m.close,low:m.close,close:m.close,volume:0}),v++),y+=e}if(y<c&&v>=r){const T=ze(c-e,e);t.some(U=>U.time===T)||t.push({time:T,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 nA(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 qa(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Ri(e),r=nA(t),o=Xa(i).map(E=>({...E,time:ze(E.time,r)})).filter(E=>Ja(E)).map(E=>Za(E)),l=Ya(o);l.sort((E,k)=>E.time-k.time);const c=Math.floor(Date.now()/1e3),u=l.filter(E=>E.time<=c),m=u.filter((E,k)=>k===0?!0:E.time>u[k-1].time),y=m.length>10?mp(m,"percentile"):m,v=Ya(y);v.sort((E,k)=>E.time-k.time);const T=wp(v,r),C=[];for(let E=1;E<T.length;E++){const k=T[E].time-T[E-1].time;k>r*2&&C.push({from:T[E-1].time,to:T[E].time,gapSeconds:k,gapMinutes:Math.round(k/60),fromDate:new Date(T[E-1].time*1e3).toISOString(),toDate:new Date(T[E].time*1e3).toISOString()})}const U=y.filter((E,k)=>k===0?!1:E.close===y[k-1].close&&E.open===y[k-1].close).length,F={original:i.length,processed:T.length,duplicates:i.length-l.length,outliers:U,gaps:C,filledGaps:T.length-v.length,symbolConfig:A};return{candles:T,stats:F}}function ja(i,e,t="1m"){if(!i||!e||!Ja(i))return null;const A=j(i.time);if(A==null)return null;const r=nA(t),n=ze(A,r);return Za({...i,time:n})}function gt(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 ii(i,e){return i.width===e.width&&i.height===e.height}var Bp=(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 yp(i){return new Bp(i)}var Cp=(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=gt({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 gt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=gt(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;ii(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=gt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=ii(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&ii(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}Tp().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=el(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=yp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=el(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?xp(n[0],r):gt({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=gt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function vp(i,e){return new Cp(i,e.transform,e.options)}function el(i){return i.ownerDocument.defaultView}function Tp(){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 xp(i,e){return gt({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 bp=(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 ri(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 bp(r,t,A)}const Qp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Fp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Up={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Sp={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},Ep={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},Lp={color:"#26a69a",base:0},tl={color:"#2196f3"},Al={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 il,rl;function ni(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 nl(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 zA(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function Gt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Ee(i){if(i===null)throw new Error("Value is null");return i}function Ci(i){return Ee(Gt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(il||(il={})),(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"})(rl||(rl={}));const sl={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 aA(i){return i<0?0:i>255?255:Math.round(i)||0}function ol(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const Mp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Hp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Ip=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Dp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Gi(i){(i=i.toLowerCase())in sl&&(i=sl[i]);{const e=Dp.exec(i)||Ip.exec(i);if(e)return[aA(parseInt(e[1],10)),aA(parseInt(e[2],10)),aA(parseInt(e[3],10)),ol(e.length<5?1:parseFloat(e[4]))]}{const e=Hp.exec(i);if(e)return[aA(parseInt(e[1],16)),aA(parseInt(e[2],16)),aA(parseInt(e[3],16)),1]}{const e=Mp.exec(i);if(e)return[aA(17*parseInt(e[1],16)),aA(17*parseInt(e[2],16)),aA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function al(i){return .199*i[0]+.687*i[1]+.114*i[2]}function Vr(i){const e=Gi(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:al(e)>160?"black":"white"}}class Tt{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 gA(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]:gA(i[A],t[A]));return i}function bA(i){return typeof i=="number"&&isFinite(i)}function $i(i){return typeof i=="number"&&i%1==0}function Xi(i){return typeof i=="string"}function zr(i){return typeof i=="boolean"}function PA(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"?PA(r):r);return t}function _p(i){return i!==null}function Ji(i){return i===null?void 0:i}const Es="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function vi(i,e,t){return e===void 0&&(e=Es),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Pp{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=vi(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 Ls{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class mA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class kp extends mA{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 u=n.it[c],m=Math.round(u.nt*t)+s,y=u.st*A,v=l*A+s;e.moveTo(m,y),e.arc(m,y,v,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 Np(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Op={from:0,to:1};class Kp{constructor(e,t){this.ut=new Ls,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(Np),this.ct=this.dt.map((A=>{const r=new kp;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 u=Ee(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,u.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=Op}))}}let Vp=class extends mA{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,ni(e,this.zt.Lt.Nt),(function(c,u,m,y){c.beginPath();const v=c.lineWidth%2?.5:0;c.moveTo(u+v,m),c.lineTo(u+v,y),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,ni(e,this.zt.Et.Nt),nl(e,l,0,t.width))}};class zp{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 Vp(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=Ee(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 Wp(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 Wr(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function ll(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 cl(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return ll(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;ll(i,e+c,t+c,A-s,r-s,(u=-c,o.map((m=>m===0?m:m+u)))),n!=="transparent"&&(i.fillStyle=n,i.fill()),l!=="transparent"&&(i.lineWidth=s,i.strokeStyle=l,i.closePath(),i.stroke()),i.restore()}function hl(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 ul{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 u=this.Gt(l,t,A,r),m=u.Jt;return u.Qt?cl(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):cl(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(u.Qt?m.ui-m.ei:0,m.ii,m.ei,m.ci-m.ii)),u}));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:u}=e,m=this.zt.hi||!this.zt.mi?t.T:0,y=this.zt.bi?t.C:0,v=t.L+this.Xt.wi,T=t.B+this.Xt.gi,C=t.A,U=t.I,F=this.zt.Kt,E=t.P,k=A.Mi(s,F),R=Math.ceil(A.xi(s,F)),M=E+v+T,z=t.C+C+U+R+m,ie=Math.max(1,Math.floor(u));let G=Math.round(M*u);G%2!=ie%2&&(G+=1);const K=y>0?Math.max(1,Math.floor(y*c)):0,Ae=Math.round(z*c),re=Math.round(m*c),he=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,J=Math.round(he*u)-Math.floor(.5*u),ee=Math.floor(J+ie/2-G/2),ae=ee+G,ce=r==="right",se=ce?l.width-y:y,le=ce?o.width-K:K;let pe,we,be;return ce?(pe=le-Ae,we=le-re,be=se-m-C-y):(pe=le+Ae,we=le+re,be=se+m+C),{Qt:ce,Jt:{ii:ee,li:J,ci:ae,ni:Ae,si:G,ht:2*c,ei:K,ti:pe,ri:le,ai:we,oi:ie,ui:o.width},di:{ii:ee/u,ci:ae/u,fi:be,pi:k}}}}class Rr{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||ul)(this.Ci,this.yi),this.Ri=new(e||ul)(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 Rp extends Rr{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=Vr(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 Gp=/[1-9]/g;class dl{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:y})=>(y.font=t.R,Math.round(t.Wi.xi(y,Ee(this.zt).Kt,Gp)))));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 u=c+n,m=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:y,horizontalPixelRatio:v,verticalPixelRatio:T})=>{const C=Ee(this.zt);y.fillStyle=C.t;const U=Math.round(c*v),F=Math.round(0*T),E=Math.round(u*v),k=Math.round(m*T),R=Math.round(2*v);if(y.beginPath(),y.moveTo(U,F),y.lineTo(U,k-R),y.arcTo(U,k,U+R,k,R),y.lineTo(E-R,k),y.arcTo(E,k,E,k-R,R),y.lineTo(E,F),y.fill(),C.hi){const M=Math.round(C.ki*v),z=F,ie=Math.round((z+t.T)*T);y.fillStyle=C.V;const G=Math.max(1,Math.floor(v)),K=Math.floor(.5*v);y.fillRect(M-K,z,G,ie-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Ee(this.zt),T=0+t.C+t.T+t.L+t.P/2;y.font=t.R,y.textAlign="left",y.textBaseline="middle",y.fillStyle=v.V;const C=t.Wi.Mi(y,"Apr0");y.translate(c+r,T+C),y.fillText(v.Kt,0,0)}))}}class $p{constructor(e,t,A){this.ft=!0,this.Wt=new dl,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(Ee(n)),e.yt=!0;const s=Vr(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ms{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 pl;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(pl||(pl={}));class Xp extends Ms{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 Kp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Ee(this.tn).vn())return{_t:l,ki:o};{const c=Ee(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 $p(this,e,A),this.wn=new zp(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 u=c!==null?c.Ct():null;return c!==null&&u!==null?(this.nn=t,this.an=c.Rt(t,u)):(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(_p),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 Rp(this,t,A),e.set(t,r)),r}}function Gr(i){return i==="left"||i==="right"}class It{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 It(2)}static es(){return new It(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 fl=".";function kA(i,e){if(!bA(i))return"n/a";if(!$i(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 $r{constructor(e,t){if(t||(t=1),bA(e)&&$i(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=fl+kA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=fl+kA(0,n));return A.toFixed(0)+r}}class gl extends $r{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Jp{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 ml(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,u=e[A.from];let m=n(i,u),y=u;if(A.to-A.from<2){const v=r/2;o.beginPath();const T={nt:u.nt-v,st:u.st},C={nt:u.nt+v,st:u.st};o.moveTo(T.nt*l,T.st*c),o.lineTo(C.nt*l,C.st*c),s(i,m,T,C)}else{const v=(C,U)=>{s(i,m,y,U),o.beginPath(),m=C,y=U};let T=y;o.beginPath(),o.moveTo(u.nt*l,u.st*c);for(let C=A.from+1;C<A.to;++C){T=e[C];const U=n(i,T);switch(t){case 0:o.lineTo(T.nt*l,T.st*c);break;case 1:o.lineTo(T.nt*l,e[C-1].st*c),U!==m&&(v(U,T),o.lineTo(T.nt*l,e[C-1].st*c)),o.lineTo(T.nt*l,T.st*c);break;case 2:{const[F,E]=Zp(e,C-1,C);o.bezierCurveTo(F.nt*l,F.st*c,E.nt*l,E.st*c,T.nt*l,T.st*c);break}}t!==1&&U!==m&&(v(U,T),o.moveTo(T.nt*l,T.st*c))}(y!==T||y===T&&t===1)&&s(i,m,y,T)}}const wl=6;function Hs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Bl(i,e){return{nt:i.nt/e,st:i.st/e}}function Zp(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=Bl(Hs(i[t],i[A]),wl),{nt:n.nt+s.nt,st:n.st+s.st}),Hs(i[t],Bl(Hs(i[r],i[e]),wl))]}function Yp(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 yl extends mA{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 u=e.context;u.lineCap="butt",u.lineJoin="round",u.lineWidth=s,ni(u,o),u.lineWidth=1,ml(e,A,l,r,n,this.bs.bind(this),Yp.bind(null,c))}}function Is(i,e,t){return Math.min(Math.max(i,e),t)}function Xr(i,e,t){return e-i<=t}function Cl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class Ds{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 u=e.context.createLinearGradient(0,0,0,l);if(u.addColorStop(0,r),c!=null){const m=Is(c*e.verticalPixelRatio/l,0,1);u.addColorStop(m,n),u.addColorStop(m,s)}u.addColorStop(1,o),this.Cs=u,this.gs=t}return this.Cs}}class qp extends yl{constructor(){super(...arguments),this.Ts=new Ds}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function jp(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class vl extends mA{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,ni(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&ml(e,t,n,A,r,u,jp),l&&(function(m,y,v,T,C){const{horizontalPixelRatio:U,verticalPixelRatio:F,context:E}=m;let k=null;const R=Math.max(1,Math.floor(U))%2/2,M=v*F+R;for(let z=T.to-1;z>=T.from;--z){const ie=y[z];if(ie){const G=C(m,ie);G!==k&&(E.beginPath(),k!==null&&E.fill(),E.fillStyle=G,k=G);const K=Math.round(ie.nt*U)+R,Ae=ie.st*F;E.moveTo(K,Ae),E.arc(K,Ae,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class Tl extends vl{Vs(e,t){return t.lt}}function xl(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 Zi=xl.bind(null,!0),bl=xl.bind(null,!1);function ef(i,e){return i.ot<e}function tf(i,e){return e<i.ot}function Ql(i,e,t){const A=e.Os(),r=e.ui(),n=Zi(i,A,ef),s=bl(i,r,tf);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 _s{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=Ql(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class Jr extends _s{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,Ji(this.Ls)),e.te(this.zs,A,Ji(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 Af extends Jr{constructor(e,t){super(e,t),this.js=new Ls,this.re=new qp,this.he=new Tl,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 rf extends mA{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),u=c-l,m=this.oe,y=u+m-1,v=Math.min(o.de,o.fe),T=Math.max(o.de,o.fe),C=Math.round(v*A)-l,U=Math.round(T*A)+l,F=Math.max(U-C,this.oe);e.fillRect(u,C,m,F);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const z=c-E;let ie=Math.max(C,Math.round(o.pe*A)-l),G=ie+m-1;G>C+F-1&&(G=C+F-1,ie=G-m+1),e.fillRect(z,ie,u-z,G-ie+1)}const k=c+E;let R=Math.max(C,Math.round(o.me*A)-l),M=R+m-1;M>C+F-1&&(M=C+F-1,R=M-m+1),e.fillRect(y+1,R,k-y,M-R+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,r){return Math.floor(.3*A*r)})(Ee(this.zt).le,e)))}}class Fl extends _s{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,Ji(this.Ls)),e.be(this.zs,A,Ji(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 nf extends Fl{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(),ve:e.openVisible,ue:e.thinBars,tt:this.Ls})}}class sf extends yl{constructor(){super(...arguments),this.Ts=new Ds}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 of extends vl{constructor(){super(...arguments),this.Pe=new Ds}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 af extends Jr{constructor(e,t){super(e,t),this.js=new Ls,this.Ve=new sf,this.Oe=new of,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 lf extends mA{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),u=Math.min(l,c);return Math.max(Math.floor(s),u)})(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 u=null;for(let m=A.from;m<A.to;m++){const y=t[m];y.Ee!==o&&(r.fillStyle=y.Ee,o=y.Ee);const v=Math.round(Math.min(y.pe,y.me)*s),T=Math.round(Math.max(y.pe,y.me)*s),C=Math.round(y.de*s),U=Math.round(y.fe*s);let F=Math.round(n*y.nt)-c;const E=F+l-1;u!==null&&(F=Math.max(u+1,F),F=Math.min(F,E));const k=E-F+1;r.fillRect(F,C,k,v-C),r.fillRect(F,T+1,k,U-T),u=E}}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 u=A.from;u<A.to;u++){const m=t[u];m.Ne!==o&&(r.fillStyle=m.Ne,o=m.Ne);let y=Math.round(m.nt*n)-Math.floor(.5*this.ae);const v=y+this.ae-1,T=Math.round(Math.min(m.pe,m.me)*s),C=Math.round(Math.max(m.pe,m.me)*s);if(c!==null&&(y=Math.max(c+1,y),y=Math.min(y,v)),this.zt.le*n>2*l)Wp(r,y,T,v-y+1,C-T+1,l);else{const U=v-y+1;r.fillRect(y,T,U,C-T+1)}c=v}}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 u=t[c];let m=Math.round(Math.min(u.pe,u.me)*s),y=Math.round(Math.max(u.pe,u.me)*s),v=Math.round(u.nt*n)-Math.floor(.5*this.ae),T=v+this.ae-1;if(u.ce!==o){const C=u.ce;r.fillStyle=C,o=C}this.zt._i&&(v+=l,m+=l,T-=l,y-=l),m>y||r.fillRect(v,m,T-v+1,y-m+1)}}}class cf extends Fl{constructor(){super(...arguments),this.js=new lf}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 hf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Ps extends _s{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new hf(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,Ji(this.Ls))}Js(){this.wn.update({bars:this.zs.map(uf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function uf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class df extends mA{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],u=Math.round(l.st*A);let m,y;e.fillStyle=l.ce,u<=n?(m=u,y=s):(m=n,y=u-Math.floor(r/2)+r),e.fillRect(c.Os,m,c.ui-c.Os+1,y-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)),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 u=(A-1)/2;l=o-u,c=o+u}else{const u=A/2;l=o-u,c=o+u-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 pf extends Jr{constructor(){super(...arguments),this.js=new df}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,Ee(this.Es.Ct()).Vt)};this.js.J(e)}}class ff extends Jr{constructor(){super(...arguments),this.js=new Tl}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 gf=/[2-9]/g;class Yi{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||gf,n=String(t).replace(r,"0");if(this.tr.has(n))return Gt(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 mf{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 Ul{constructor(e,t,A){this.ur=e,this.ar=new Yi(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new mf(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 wf extends mA{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),ni(e,this.zt.Nt),nl(e,n,0,t.width))}}class ks{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new wf,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 Bf extends ks{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 yf extends mA{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 Cf=[{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 Sl(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=Gi(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function El(i,e){const t=i%2600/2600;let A;for(const l of Cf)if(t>=l.Vr&&t<=l.Or){A=l;break}zA(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Sl(e,r,A.Ir,A.zr),Dr:Sl(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class vf{constructor(e){this.Wt=new yf,this.ft=!0,this.Nr=!0,this.Fr=performance.now(),this.Wr=this.Fr-1,this.jr=e}Hr(){this.Wr=this.Fr-1,this.bt()}$r(){if(this.bt(),this.jr.W().lastPriceAnimation===2){const e=performance.now(),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=El(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=El(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 qi(i,e){return Cl(Math.min(Math.max(i,12),30)*e)}function ji(i,e){switch(i){case"arrowDown":case"arrowUp":return qi(e,1);case"circle":return qi(e,.8);case"square":return qi(e,.7)}}function Ll(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(qi(i,1))}function Ml(i){return Math.max(qi(i,.1),3)}function Hl(i,e,t){return e?i:t?Math.ceil(i/2):0}function Il(i,e,t,A,r){const n=ji("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function Dl(i,e,t,A){const r=(ji("arrowUp",A)-1)/2*t.Jr,n=(Cl(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 Tf(i,e,t,A,r,n){return Il(e,t,A,r,n)}class xf extends mA{constructor(){super(...arguments),this.zt=null,this.ar=new Yi,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=vi(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(Qf(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),bf(o,e,t,A)}}}}function bf(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 Dl(!1,n,s,r.Ks);case"arrowUp":return void Dl(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(ji("circle",c)-1)/2;o.beginPath(),o.arc(l.nt,l.st,u*l.Jr,0,2*Math.PI,!1),o.fill()})(n,s,r.Ks);case"square":return void(function(o,l,c){const u=ji("square",c),m=(u-1)*l.Jr/2,y=l.nt-m,v=l.st-m;o.fillRect(y,v,u*l.Jr,u*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 Qf(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 Tf(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+ji("circle",l)/2,y=s-c,v=o-u;return Math.sqrt(y*y+v*v)<=m})(A.nt,A.st,A.Ks,r,n);case"square":return Il(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function Ff(i,e,t,A,r,n,s,o,l){const c=bA(t)?t:t.Se,u=bA(t)?t:t.Me,m=bA(t)?t:t.xe,y=bA(e.size)?Math.max(e.size,0):1,v=Ll(o.le())*y,T=v/2;switch(i.Ks=v,e.position){case"inBar":return i.st=s.Rt(c,l),void(i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r));case"aboveBar":return i.st=s.Rt(u,l)-T-A.sh,i.Kt!==void 0&&(i.Kt.st=i.st-T-.6*r,A.sh+=1.2*r),void(A.sh+=v+n);case"belowBar":return i.st=s.Rt(m,l)+T+A.eh,i.Kt!==void 0&&(i.Kt.st=i.st+T+n+.6*r,A.eh+=1.2*r),void(A.eh+=v+n)}e.position}class Uf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new xf,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=Ml(e),A=1.5*Ll(e)+2*t,r=this.fh();this.ah={above:Hl(A,r.aboveBar,r.inBar),below:Hl(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((u=>({ot:u.time,nt:0,st:0,Ks:0,nh:u.shape,V:u.color,th:u.th,gr:u.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=Ml(t.le()),c={sh:l,eh:l};this.zt.tt=Ql(this.zt.it,n,!0);for(let u=this.zt.tt.from;u<this.zt.tt.to;u++){const m=A[u];m.time!==o&&(c.sh=l,c.eh=l,o=m.time);const y=this.zt.it[u];y.nt=t.It(m.time),m.text!==void 0&&m.text.length>0&&(y.Kt={ih:m.text,nt:0,st:0,Hi:0,At:0});const v=this.jr.ph(m.time);v!==null&&Ff(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Sf extends ks{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 Ef extends Rr{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 u=r.mh(c.V),m=Vr(u);A.t=m.t,A.ki=c.ki,t.Ot=r.$t().Bt(c.ki/r.Dt().At()),e.Ot=u,e.V=m.i,t.V=m.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 _l(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 qt{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 qt(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 qt(_l(Math.min,this.Ph(),e.Ph(),-1/0),_l(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!bA(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){bA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new qt(e.minValue,e.maxValue)}}class Zr{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 Zr(qt.Ah(e.priceRange),e.margins)}}class Lf extends ks{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 Mf extends Rr{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=Vr(r.axisLabelColor||r.color);A.t=c.t;const u=r.axisLabelTextColor||c.i;e.V=u,t.V=u,A.ki=l}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class Hf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Lf(e,this),this.ur=new Mf(e,this),this.Hh=new Ul(this.ur,e,e.$t())}$h(e){gA(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 If extends Ms{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Df={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Ee(i(t,A)),l=Ci(o.Vt[0])<=Ci(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,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Ee(i(t,A)),T=Ci(v.Vt[0])<=Ci(v.Vt[3]);return{ce:(r=v.V)!==null&&r!==void 0?r:T?o:l,Ne:(n=v.Ot)!==null&&n!==void 0?n:T?c:u,Ee:(s=v.Xh)!==null&&s!==void 0?s:T?m:y}},Custom:(i,e,t,A)=>{var r;return{ce:(r=Ee(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Ee(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 u=Ee(i(t,A));return{ce:u.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(r=u.Re)!==null&&r!==void 0?r:e.topLineColor,De:(n=u.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=u.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=u.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(l=u.Ce)!==null&&l!==void 0?l:e.bottomFillColor1,Te:(c=u.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(i,e,t,A)=>{var r,n;const s=Ee(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=Ee(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class _f{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Df[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var Pl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(Pl||(Pl={}));const WA=30;class Pf{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=Yr(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 Zi(this.tl,e,((t,A)=>t.ee<A))}vl(e){return bl(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=Ee(this.el()),s=Ee(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/WA)*WA,u=Math.max(c,Math.floor(l/WA)*WA);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=Yr(r,this.pl(y,v,A))}let m=this.il.get(A);m===void 0&&(m=new Map,this.il.set(A,m));for(let y=Math.max(c+1,o);y<u;y+=WA){const v=Math.floor(y/WA);let T=m.get(v);if(T===void 0){const C=this.fl(v*WA),U=this.vl((v+1)*WA-1);T=this.pl(C,U,A),m.set(v,T)}r=Yr(r,T)}{const y=this.fl(u),v=this.vl(l);r=Yr(r,this.pl(y,v,A))}return r}}function Yr(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class kf{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 Ns{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 kf(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 kl(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 Nf{constructor(e,t){this.Wt=new dl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},kl(this.kl))),this.Wt}}class Of extends Rr{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=kl(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 Kf{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 Ns(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 Nf(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 Of(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 Ns(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 Ns(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 Os(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Ks(i){return i.Pn()}function Vf(i){return i.Bl()}function zf(i){return i.Al()}class Vs extends If{constructor(e,t,A,r,n){super(e),this.zt=new Pf,this.jh=new Sf(this),this.zl=[],this.Ll=new Bf(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 Ef(this);this.rn=[s],this.Hh=new Ul(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new vf(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 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}),u=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:u,ee:o}}Us(){return this.Nl!==null||(this.Nl=new _f(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),gA(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 Hf(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=[];Os(this.Hl,Ks,"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),Os(this.Hl,Ks,"normal",e),e}ua(){return this.ca(Ks,"bottom")}da(e){return this.ca(Vf,e)}fa(e){return this.ca(zf,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 Zr.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 Ee(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 Kf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Ps)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Ps)return e=>this.wn.je(e)}_a(){return!Gr(this.Dt().Pa())}pa(e,t){if(!$i(e)||!$i(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 qt(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new qt(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 v=new qt(l.priceRange.minValue,l.priceRange.maxValue);n=n!==null?n.ts(v):v}var c,u,m,y;l?.margins&&(c=s,u=l.margins,s={above:Math.max((m=c?.above)!==null&&m!==void 0?m:0,u.above),below:Math.max((y=c?.below)!==null&&y!==void 0?y:0,u.below)})})),new Zr(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 Jp(this.cn.priceFormat.precision);break;case"percent":this.wa=new gl(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new $r(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=Ee(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Ee(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Ee(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 Uf(this,this.$t()),this.$l){case"Bar":this.wn=new nf(this,this.$t());break;case"Candlestick":this.wn=new cf(this,this.$t());break;case"Line":this.wn=new ff(this,this.$t());break;case"Custom":this.wn=new Ps(this,this.$t(),Gt(e));break;case"Area":this.wn=new Af(this,this.$t());break;case"Baseline":this.wn=new af(this,this.$t());break;case"Histogram":this.wn=new pf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return Os(this.Hl,e,t,A),A}}class Wf{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((u=>u instanceof Vs)).reduce(((u,m)=>{if(A.vr(m)||!m.yt())return u;const y=m.Dt(),v=m.In();if(y.Ni()||!v.Kr(t))return u;const T=v.Gh(t);if(T===null)return u;const C=Ci(m.Ct());return u.concat([y.Rt(T.Vt[3],C.Vt)])}),[]);if(l.length===0)return r;l.sort(((u,m)=>Math.abs(u-o)-Math.abs(m-o)));const c=l[0];return r=n.pn(c,s),r}}class Rf extends mA{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=Ee(this.zt);if(s.Aa){e.strokeStyle=s.Ia,ni(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,ni(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 Gf{constructor(e){this.Wt=new Rf,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 $f{constructor(e){this.wn=new Gf(e)}qh(){return this.wn}}const zs={$a:4,Ua:1e-4};function Ti(i,e){const t=100*(i-e)/e;return e<0?-t:t}function Xf(i,e){const t=Ti(i.Ph(),e),A=Ti(i.Rh(),e);return new qt(t,A)}function er(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function Jf(i,e){const t=er(i.Ph(),e),A=er(i.Rh(),e);return new qt(t,A)}function qr(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 tr(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 Ar(i,e){if(i===null)return null;const t=qr(i.Ph(),e),A=qr(i.Rh(),e);return new qt(t,A)}function jr(i,e){if(i===null)return null;const t=tr(i.Ph(),e),A=tr(i.Rh(),e);return new qt(t,A)}function Ws(i){if(i===null)return zs;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return zs;const t=Math.ceil(Math.abs(Math.log10(e))),A=zs.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Rs{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 m=Xr(n,r,1e-14)&&n>r+1e-14,y=Xr(n,A*o,1e-14),v=Xr(n,1,1e-14);if(!(m&&y&&v))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,u=1e-14,Math.abs(l-c)<u))for(s=0,o=this.Za[0];Xr(n,A*o,1e-14)&&n>r+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var l,c,u;return n}}class Nl{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 Rs(this.qa,[2,2.5,2]),s=new Rs(this.qa,[2,2,2.5]),o=new Rs(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 u=c[0];for(let m=1;m<c.length;++m)c[m]<u&&(u=c[m]);return u})(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),u=Math.min(r,n);if(c===u)return void(this.Ka=[]);let m=this.Xa(c,u),y=c%m;y+=y<0?m:0;const v=c>=u?1:-1;let T=null,C=0;for(let U=c-y;U>u;U-=m){const F=this.Ja(U,t,!0);T!==null&&Math.abs(F-T)<this.Qa()||F<o||F>l||(C<this.Ka.length?(this.Ka[C].Ea=F,this.Ka[C].so=e.eo(U)):this.Ka.push({Ea:F,so:e.eo(U)}),C++,T=F,e.ro()&&(m=this.Xa(U*v,u)))}this.Ka.length=C}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Ol(i){return i.slice().sort(((e,t)=>Ee(e.Xi())-Ee(t.Xi())))}var Kl;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(Kl||(Kl={}));const Vl=new gl,zl=new $r(100,1);class Zf{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 Tt,this.vo=new Tt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=zl,this.xo=Ws(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Nl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(gA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=Gt(e.scaleMargins.top),A=Gt(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=tr(n.Ph(),s),l=tr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=jr(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=Ar(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=Ti(e,t):this.Oo()&&(e=er(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Ee(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T],U=C._t;if(isNaN(U))continue;let F=U;v!==null&&(F=v(C._t,t));const E=r+u*(F-s),k=c?E:this.ho-1-E;C.st=k}}be(e,t,A){this.Wo();const r=this.Fo(),n=Ee(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),u=l/(o-s),m=A===void 0?0:A.from,y=A===void 0?e.length:A.to,v=this.Ho();for(let T=m;T<y;T++){const C=e[T];let U=C.ge,F=C.Me,E=C.xe,k=C.Se;v!==null&&(U=v(C.ge,t),F=v(C.Me,t),E=v(C.xe,t),k=v(C.Se,t));let R=r+u*(U-s),M=c?R:this.ho-1-R;C.pe=M,R=r+u*(F-s),M=c?R:this.ho-1-R,C.de=M,R=r+u*(E-s),M=c?R:this.ho-1-R,C.fe=M,R=r+u*(k-s),M=c?R:this.ho-1-R,C.me=M}}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=Ol(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=Ee(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=Ee(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=Ee(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Ee(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Ee(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_(Ti(e,t));case 3:return this.ba().format(er(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,Ee(this.e_()).ba())}Zl(e,t){return e=Ti(e,t),this.s_(e,Vl)}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=zl,this.Mh()?(this.wa=Vl,t=100):this.Oo()?(this.wa=new $r(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Nl(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?qr(e,this.xo):e;const A=Ee(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=Ee(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?tr(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 u=l.Il(e.Os(),e.ui());let m=u&&u.Lh();if(m!==null){switch(this.cn.mode){case 1:m=Ar(m,this.xo);break;case 2:m=Xf(m,c.Vt);break;case 3:m=Jf(m,c.Vt)}if(t=t===null?m:t.ts(Ee(m)),u!==null){const y=u.Eh();y!==null&&(r=Math.max(r,y.above),n=Math.max(n,y.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=jr(t,this.xo)),t=new qt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=Ar(t,this.xo))}if(this.ro()){const l=jr(t,this.xo),c=Ws(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?jr(this.ao,this.xo):null;this.xo=c,t=Ar(l,c),u!==null&&(this.ao=Ar(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new qt(-.5,.5)),this.xo=Ws(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Ti:this.Oo()?er:this.ro()?e=>qr(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 Yf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Tt,this.yl=e,this.$i=t,this.d_=new $f(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=Ee(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)?Gt(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);zA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Ee(e.Dt()).Pa();if(this.o_.has(A)){const n=Gt(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=Ol(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),!Gr(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},PA(t)),r=new Zf(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class qf{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(Gt(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 ir{constructor(e,t){zA(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 Wl(i,e){return i===null||e===null?i===e:i.Ch(e)}class jf{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(Zi(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=Gt(this.J_.get(A)),l=o.length;let c=1/0,u=-1/0;for(let m=0;m<l;m++){const y=o[m],v=y.index;for(;s<n;){const T=r[s],C=T.index;if(!(C<v)){c=C;break}s++,t.push(T),u=C,c=1/0}if(c-v>=e&&v-u>=e)t.push(y),u=v;else if(this.Q_)return r}for(;s<n;s++)t.push(r[s])}return t}}class xi{constructor(e){this.hu=e}lu(){return this.hu===null?null:new ir(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new xi(null)}}function e0(i,e){return i.weight>e.weight?i:e}class t0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new jf,this.du=new Map,this.fu=xi.ou(),this.vu=!0,this.pu=new Tt,this.mu=new Tt,this.bu=new Tt,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){gA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;gA(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=Zi(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=Ee(this.Bu()),n=Ee(this.Au());return{from:Ee(this.Ui(Math.max(r,t))),to:Ee(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Ee(this.Va(e.from,!0)),to:Ee(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()||!$i(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=Ee(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,u=this.$u(),m=this.cn.fixLeftEdge||u,y=this.cn.fixRightEdge||u;let v=0;for(const T of o){if(!(n<=T.index&&T.index<=s))continue;let C;v<this.Mu.length?(C=this.Mu[v],C.coord=this.It(T.index),C.label=this.Uu(T),C.weight=T.weight):(C={needAlignCoordinate:!1,coord:this.It(T.index),label:this.Uu(T),weight:T.weight},this.Mu.push(C)),this.Su>t/2&&!u?C.needAlignCoordinate=!1:C.needAlignCoordinate=m&&T.index<=l||y&&T.index>=c,v++}return this.Mu.length=v,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=Is(this.__-e,0,this.__),A=Is(this.__-Ee(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=Ee(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 ir(e,t+this.cn.rightOffset))}lc(e){const t=new ir(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(xi.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new ir(A-t+1,A);this._c(new xi(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 qf((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,Wl(t.lu(),this.fu.lu())||this.pu.m(),Wl(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 A0{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 i0 extends A0{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 r0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new i0(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:vi(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class n0 extends Ms{constructor(e,t){super(),this.cn=t,this.wn=new r0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Rl,Gl,$l,Xl,Jl;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(Rl||(Rl={}));class s0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Tt,this.Rc=new Tt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Pp(this),this.yl=new t0(this,t.timeScale,this.cn.localization,A),this.vt=new Xp(this,t.crosshair),this.Bc=new Wf(t.crosshair),this.Ac=new n0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(It.es())}Uh(){this.Nc(It.ss())}oa(){this.Nc(new It(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){gA(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 Yf(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=It.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(),u=c.Ct();u!==null&&(s=c.pn(t,u)),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,Ee(n)),o=this.yl.Va(t,!0),l=this.yl.It(Ee(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),u=e!==null&&e>s&&!c,m=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,y=l&&(A!==void 0||m)&&this.yl.W().shiftVisibleRangeOnNewBar;if(u&&!y){const v=e-s;this.yl.Jn(this.yl.Hu()-v)}}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);zA(A!==-1,"Series not found"),this.Cc.splice(A,1),Ee(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Ee(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=It.ss();e.$n(),this.Nc(e)}pd(e){const t=It.ss();t.Yn(e),this.Nc(t)}Kn(){const e=It.ss();e.Kn(),this.Nc(e)}Gn(e){const t=It.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=It.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=It.ss();t.Zn(e),this.Nc(t)}Un(){const e=It.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,u,m]=Gi(n),[y,v,T,C]=Gi(s),U=[aA(l+o*(y-l)),aA(c+o*(v-c)),aA(u+o*(T-u)),ol(m+o*(C-m))];return`rgba(${U[0]}, ${U[1]}, ${U[2]}, ${U[3]})`})(A,t,e/100);return this.Dc.wd.set(e,r),r}Gc(e,t){const A=new It(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 Vs(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Gr(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 Gs(i){return!bA(i)&&!Xi(i)}function Zl(i){return bA(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(Gl||(Gl={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})($l||($l={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(Xl||(Xl={})),(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"})(Jl||(Jl={}));const Yl=i=>i.getUTCFullYear();function o0(i,e,t){return e.replace(/yyyy/g,(A=>kA(Yl(A),4))(i)).replace(/yy/g,(A=>kA(Yl(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=>kA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>kA((r=>r.getUTCDate())(A),2))(i))}class ql{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return o0(e,this.gd,this.Md)}}class a0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",kA(e.getUTCHours(),2)).replace("%m",kA(e.getUTCMinutes(),2)).replace("%s",kA(e.getUTCSeconds(),2))}}const l0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class c0{constructor(e={}){const t=Object.assign(Object.assign({},l0),e);this.Td=new ql(t.Sd,t.Cd),this.Pd=new a0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function en(i){return 60*i*60*1e3}function $s(i){return 60*i*1e3}const tn=[{Dd:(jl=1,1e3*jl),Vd:10},{Dd:$s(1),Vd:20},{Dd:$s(5),Vd:21},{Dd:$s(30),Vd:22},{Dd:en(1),Vd:30},{Dd:en(3),Vd:31},{Dd:en(6),Vd:32},{Dd:en(12),Vd:33}];var jl;function ec(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=tn.length-1;t>=0;--t)if(Math.floor(e.getTime()/tn[t].Dd)!==Math.floor(i.getTime()/tn[t].Dd))return tn[t].Vd;return 0}function Xs(i){let e=i;if(Xi(i)&&(e=Js(i)),!Gs(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 tc(i){if(!Zl(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function Js(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 Ac(i){Xi(i.time)&&(i.time=Js(i.time))}class ic{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(Ac)})(e):Ac(e)}createConverterToInternalObj(e){return Ee((function(t){return t.length===0?null:Gs(t[0].time)||Xi(t[0].time)?Xs:tc})(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 Zl(t=e)?tc(t):Gs(t)?Xs(t):Xs(Js(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new c0({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new ql(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(e0,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],u=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=ec(u,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=u}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=ec(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return gA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const bi=typeof window<"u";function rc(){return!!bi&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Zs(){return!!bi&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Ys(i){return i+i%2}function qs(i,e){return i.zd-e.zd}function js(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class h0{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=js(this.Ld,this.Ed,this.Ud),n=qs(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=js(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=qs(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=js(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=qs(this.Nd,this.Fd);s.push(m),o.push(y),A+=y}}}}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,u){const m=Math.log(u);return Math.log(1*m/-c)/m})(Math.abs(l),this.qd))}tc(e){const t=Ee(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-Ee(this.Wd).ot;return Math.min(t,this.jd)}}class u0{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 al(Gi(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 si(i,e){const t=Ee(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=vp(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 oi(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function eo(i,e,t,A){i.gl&&i.gl(e,t,A)}function An(i,e,t,A){i.X(e,t,A)}function to(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function d0(i){bi&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Ao{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=!Zs(),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(QA(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(QA(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=io(e.changedTouches,Ee(this.Of));if(t===null||(this.Vf=rn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(QA(t),Ee(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),Qi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(QA(e),Ee(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=io(e.changedTouches,Ee(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=rn(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(QA(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&&Qi(e));this._f===0&&Qi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Qi(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),rc()&&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(QA(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=rn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=QA(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=QA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;rc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=QA(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=QA(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})}Zs()&&(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}),d0(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=nc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Qi(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=nc(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=!Zs()}vv(e){const t=io(e.touches,Ee(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:rn(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"&&Qi(e)}}}}function nc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Qi(i){i.cancelable&&i.preventDefault()}function QA(i){return{nt:i.pageX,st:i.pageY}}function rn(i){return i.timeStamp||performance.now()}function io(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function nn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function p0(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 ro(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 sc(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],u=i[l-1],m=u.At(A,!1),y=c.Vi(),v=u.Vi();if(e===1?y>v-m:y<v+m){const T=v-m*e;c.Oi(T);const C=T-e*m/2;if((e===1?C<0:C>t)&&o>0){const U=e===1?-1-C:C-t,F=Math.min(U,o);for(let E=r;E<i.length;E++)i[E].Oi(i[E].Vi()+e*F);o-=F}}else r=l,o=e===1?v-m-y:y-(v+m)}}class oc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Yi(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=ro("normal",r),this.Zv=ro("top",r),this.Xv=ro("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=si(this.Kv,gt({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=si(this.Kv,gt({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 Ao(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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=Ee(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 u=this.Fv.xi(A,n[c].Kt());u>e&&(e=u)}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),u=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,u))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,u))-.11111111111111,s)))}var o;A.restore();const l=e||34;return Ys(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&ii(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 Ee(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,Ee(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=ri(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=ri(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?Wr(e,0,0,A,r,s):hl(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)),u=Math.floor(.5*l),m=Math.round(r.T*o);s.beginPath();for(const y of t)s.rect(Math.floor(n*o),Math.round(y.Ea*l)-u,m,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((u=>this.Fv.Mi(s,u.so)));for(let u=t.length;u--;){const m=t[u];s.fillText(m.so,l,m.Ea+c[u])}}))}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)}sc(r,1,this.Ev.height,t),sc(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(Ee(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(Ee(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 vi(this.ko.fontSize,this.ko.fontFamily)}}function f0(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 sn(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 g0(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 m0(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 no{constructor(e,t){this.Ev=gt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Tt,this.Op=new Tt,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=si(A,gt({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=si(A,gt({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 Ao(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Ee(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(no.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 u0(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(Ee(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Ee(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=Ee(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,u,m){var y,v;let T,C;for(const E of c){const k=(v=(y=E.va)===null||y===void 0?void 0:y.call(E,u,m))!==null&&v!==void 0?v:[];for(const R of k)U=R.zOrder,(!(F=T?.zOrder)||U==="top"&&F!=="top"||U==="normal"&&F==="bottom")&&(T=R,C=E)}var U,F;return T&&C?{zv:T,Hc:C}:null})(o,n,s);if(l?.zv.zOrder==="top")return nn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return nn(l);const u=p0(c.Pn(r),n,s);if(u!==null)return{Hc:c,Bv:u.Bv,Iv:u.Iv};if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&l.zv.isBackground)return nn(l)}return l?.zv?nn(l):null})(A,e,t)}_m(e,t){Ee(t==="left"?this.Cp:this.Tp).cp(gt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){ii(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=Ee(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=ri(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,f0),this.vm(A),this.pm(A),this.fm(A,sn),this.fm(A,g0)))}this.Jv.applySuggestedBitmapSize();const t=ri(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,m0))}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?Wr(e,0,0,A,r,o):hl(e,0,0,A,r,s,o)}vm(e){const t=Ee(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,sn,eo,t),this.Mm(e,sn,An,t)}bm(e){this.Mm(e,sn,An,this.$i().Zc())}fm(e,t){const A=Ee(this.Np).Uo();for(const r of A)this.Mm(e,t,eo,r);for(const r of A)this.Mm(e,t,An,r)}Mm(e,t,A,r){const n=Ee(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;to(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 oc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new oc(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,Ee(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)Ee(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 h0(.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 ac{constructor(e,t,A,r,n){this.ft=!0,this.Ev=gt({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=si(this.Kv,gt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){ii(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=ri(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}){Wr(e,0,0,t.width,t.height,this.Pm())}}function so(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 w0=so("normal"),B0=so("top"),y0=so("bottom");class C0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=gt({width:0,height:0}),this.Om=new Tt,this.Fv=new Yi(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=si(this.Im,gt({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=si(this.Im,gt({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 Ao(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),oi(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),oi(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){ii(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(gt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(gt({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=ri(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,y0)})),this.wp(A),this.$m(A,w0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=ri(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,B0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)to(t,(n=>eo(n,e,!1,void 0)),r,void 0);for(const r of A)to(t,(n=>An(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){Wr(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 u=Math.max(1,Math.floor(l)),m=Math.floor(.5*l);o.beginPath();const y=Math.round(n.T*c);for(let v=A.length;v--;){const T=Math.round(A[v].coord*l);o.rect(T-m,0,u,y)}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 u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,l)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=r){const u=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,u,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 vi(this.j(),this.cn.fontFamily)}Zm(){return vi(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 Yi,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 ac("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new ac("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const v0=!!bi&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!bi&&(!((oo=navigator?.userAgentData)===null||oo===void 0)&&oo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var oo;class T0{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 Tt,this.Op=new Tt,this.Rc=new Tt,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),ao(this.cn)&&this.hb(!0),this.$i=new s0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new C0(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=[],Ee(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 gt({width:l-l%2,height:c-c%2})})(gt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Ee(this.Xd).style.height=n,Ee(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(It.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=It.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=ao(this.cn);this.$i.$h(e);const A=ao(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=Ee(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Ee(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 Gt(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 u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Ee(o==="left"?m.wm():m.gm()),v=y.xp();e!==null&&y.Sp(e,l,c),c+=v.height}};this.xb()&&(n("left",0),t+=Ee(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+=Ee(r.gm()).xp().width);const s=(o,l,c)=>{Ee(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Ee(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=Ee(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return gt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Ee(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Ee(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=Ys(t),A=Ys(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 u=0+l,m=n<u?0:n-u,y=m/e;let v=0;for(let T=0;T<this.Xm.length;++T){const C=this.Xm[T];C.qp(this.$i.qc()[T]);let U=0,F=0;F=T===this.Xm.length-1?m-v:Math.round(C.M_()*y),U=Math.max(F,2),v+=U,C.cp(gt({width:s,height:U})),this.xb()&&C._m(t,"left"),this.Sb()&&C._m(A,"right"),C.fp()&&this.$i.Kc(C.fp(),U)}this.ab.Fm(gt({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 v0?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=Gt(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 no(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((u=>{const m=u.In().ll(e);m!==null&&n.set(u,m)}));let s;if(e!==null){const u=(r=this.$i.St().Ui(e))===null||r===void 0?void 0:r.originalTime;u!==void 0&&(s=u)}const o=this.$t().Wc(),l=o!==null&&o.Hc instanceof Vs?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 ao(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function x0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function lc(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 cc(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 b0(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 Q0(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 F0(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 U0(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 S0(i,e,t,A,r){const n=Gt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:lc(u,["time","color"]),V:y}}function on(i){return i.Vt!==void 0}function hc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function ai(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)?hc({ot:e,ee:t,zb:r},A):hc(i(e,t,A,r,n),A)}function uc(i){return{Candlestick:ai(U0),Bar:ai(F0),Area:ai(b0),Baseline:ai(Q0),Histogram:ai(cc),Line:ai(cc),Custom:ai(S0)}[i]}function dc(i){return{ee:0,Hb:new Map,la:i}}function pc(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 fc(i){let e;return i.forEach((t=>{e===void 0&&(e=t.zb)})),Gt(e)}class E0{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((v=>v.time)),c=this.q_.createConverterToInternalObj(t),u=uc(e.Qh()),m=e.Ca(),y=e.Ta();s=t.map(((v,T)=>{const C=c(v.time),U=this.q_.key(C);let F=this.qb.get(U);F===void 0&&(F=dc(C),this.qb.set(U,F),r=!0);const E=u(C,F.ee,v,l[T],m,y);return F.Hb.set(e,E),E}))}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:fc(c.Hb)})})),l.sort(((c,u)=>this.q_.key(c.time)-this.q_.key(u.time))),o=this.Qb(l)}return this.tw(e,o,(function(l,c,u){const m=pc(l,u),y=pc(c,u);if(m!==void 0&&y!==void 0)return{ta:m.Ub>=y.Ub&&m.$b>=y.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(C){C.zb===void 0&&(C.zb=C.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=dc(r),this.qb.set(this.q_.key(r),s));const l=uc(e.Qh()),c=e.Ca(),u=e.Ta(),m=l(r,s.ee,t,A.zb,c,u);s.Hb.set(e,m),this.nw(e,m);const y={ta:on(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:fc(s.Hb)},T=Zi(this.Xb,this.q_.key(v.time),((C,U)=>this.q_.key(C.time)<U));this.Xb.splice(T,0,v);for(let C=T;C<this.Xb.length;++C)lo(this.Xb[C].pointData,C);return this.q_.fillWeightsForPoints(this.Xb,T),this.tw(e,T,y)}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)?on(t)&&A.push(t):on(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(on)),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,lo(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)lo(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 lo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function co(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function gc(i){const e=co(i);return i.V!==void 0&&(e.color=i.V),e}function L0(i){const e=co(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 M0(i){const e=co(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 mc(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 H0(i){const e=mc(i);return i.V!==void 0&&(e.color=i.V),e}function I0(i){const e=mc(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 ho(i){return{Area:L0,Line:gc,Baseline:M0,Histogram:gc,Bar:H0,Candlestick:I0,Custom:D0}[i]}function D0(i){const e=i.zb;return Object.assign(Object.assign({},i.$e),{time:e})}const _0={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},P0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},k0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Es,attributionLogo:!0},uo={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},N0={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},O0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Es,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function wc(){return{width:0,height:0,autoSize:!1,layout:k0,crosshair:_0,grid:P0,overlayPriceScales:Object.assign({},uo),leftPriceScale:Object.assign(Object.assign({},uo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},uo),{visible:!0}),timeScale:N0,watermark:O0,localization:{locale:bi?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 Gr(this.ow)?this.aw.Mb(this.ow):0}Li(){return Ee(this.aw.$t().Uc(this.ow)).Dt}}function Bc(i,e,t){const A=lc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const V0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class z0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class W0{constructor(e,t,A,r,n){this.uw=new Tt,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 xi(new ir(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=Ee(A.el()),o=Ee(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:ho(this.seriesType())(A)}data(){const e=ho(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=>Bc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Bc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return PA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=gA(PA(V0),e),A=this.Es.ea(t);return new z0(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 R0{constructor(e,t,A){this.ww=new Tt,this.mu=new Tt,this.Om=new Tt,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){zA(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({},PA(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 G0(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 yc(i){return(function(e){if(zr(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;zr(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),zr(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;zr(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class $0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Tt,this.Cw=new Tt,this.Tw=new Tt,this.Pw=new E0(t);const r=A===void 0?PA(wc()):gA(PA(wc()),yc(A));this.q_=t,this.aw=new T0(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 R0(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=Ci(e),r=Object.assign(Object.assign({},tl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Sp,e)}addBaselineSeries(e){return this.Vw("Baseline",Ep,e)}addBarSeries(e){return this.Vw("Bar",Fp,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",Qp,e)}addHistogramSeries(e){return this.Vw("Histogram",Lp,e)}addLineSeries(e){return this.Vw("Line",Up,e)}removeSeries(e){const t=Gt(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 K0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(yc(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){G0(A.priceFormat);const n=gA(PA(Al),PA(t),A),s=this.aw.$t().dd(e,n,r),o=new W0(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 Gt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=ho(s)(r);if(s!=="Custom")zA(x0(o));else{const l=n.Ta();zA(!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 X0(i,e,t){let A;if(Xi(i)){const n=document.getElementById(i);zA(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new $0(A,e,t);return e.setOptions(r.options()),r}function J0(i,e){return X0(i,new ic,ic.Id(e))}Object.assign(Object.assign({},Al),tl);function Cc(i,e){return function(){return i.apply(e,arguments)}}const{toString:Z0}=Object.prototype,{getPrototypeOf:po}=Object,{iterator:an,toStringTag:vc}=Symbol,ln=(i=>e=>{const t=Z0.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),wA=i=>(i=i.toLowerCase(),e=>ln(e)===i),cn=i=>e=>typeof e===i,{isArray:Fi}=Array,Ui=cn("undefined");function rr(i){return i!==null&&!Ui(i)&&i.constructor!==null&&!Ui(i.constructor)&&jt(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Tc=wA("ArrayBuffer");function Y0(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Tc(i.buffer),e}const q0=cn("string"),jt=cn("function"),xc=cn("number"),nr=i=>i!==null&&typeof i=="object",j0=i=>i===!0||i===!1,hn=i=>{if(ln(i)!=="object")return!1;const e=po(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(vc in i)&&!(an in i)},e1=i=>{if(!nr(i)||rr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},t1=wA("Date"),A1=wA("File"),i1=wA("Blob"),r1=wA("FileList"),n1=i=>nr(i)&&jt(i.pipe),s1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||jt(i.append)&&((e=ln(i))==="formdata"||e==="object"&&jt(i.toString)&&i.toString()==="[object FormData]"))},o1=wA("URLSearchParams"),[a1,l1,c1,h1]=["ReadableStream","Request","Response","Headers"].map(wA),u1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function sr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Fi(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(rr(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 bc(i,e){if(rr(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 li=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Qc=i=>!Ui(i)&&i!==li;function fo(){const{caseless:i,skipUndefined:e}=Qc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&bc(t,n)||n;hn(t[s])&&hn(r)?t[s]=fo(t[s],r):hn(r)?t[s]=fo({},r):Fi(r)?t[s]=r.slice():(!e||!Ui(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&sr(arguments[r],A);return t}const d1=(i,e,t,{allOwnKeys:A}={})=>(sr(e,(r,n)=>{t&&jt(r)?Object.defineProperty(i,n,{value:Cc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),p1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),f1=(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)},g1=(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&&po(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},m1=(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},w1=i=>{if(!i)return null;if(Fi(i))return i;let e=i.length;if(!xc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},B1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&po(Uint8Array)),y1=(i,e)=>{const A=(i&&i[an]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},C1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},v1=wA("HTMLFormElement"),T1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Fc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),x1=wA("RegExp"),Uc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};sr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},b1=i=>{Uc(i,(e,t)=>{if(jt(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(jt(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+"'")})}})},Q1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Fi(i)?A(i):A(String(i).split(e)),t},F1=()=>{},U1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function S1(i){return!!(i&&jt(i.append)&&i[vc]==="FormData"&&i[an])}const E1=i=>{const e=new Array(10),t=(A,r)=>{if(nr(A)){if(e.indexOf(A)>=0)return;if(rr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Fi(A)?[]:{};return sr(A,(s,o)=>{const l=t(s,r+1);!Ui(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},L1=wA("AsyncFunction"),M1=i=>i&&(nr(i)||jt(i))&&jt(i.then)&&jt(i.catch),Sc=((i,e)=>i?setImmediate:e?((t,A)=>(li.addEventListener("message",({source:r,data:n})=>{r===li&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),li.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",jt(li.postMessage)),H1=typeof queueMicrotask<"u"?queueMicrotask.bind(li):typeof process<"u"&&process.nextTick||Sc,fe={isArray:Fi,isArrayBuffer:Tc,isBuffer:rr,isFormData:s1,isArrayBufferView:Y0,isString:q0,isNumber:xc,isBoolean:j0,isObject:nr,isPlainObject:hn,isEmptyObject:e1,isReadableStream:a1,isRequest:l1,isResponse:c1,isHeaders:h1,isUndefined:Ui,isDate:t1,isFile:A1,isBlob:i1,isRegExp:x1,isFunction:jt,isStream:n1,isURLSearchParams:o1,isTypedArray:B1,isFileList:r1,forEach:sr,merge:fo,extend:d1,trim:u1,stripBOM:p1,inherits:f1,toFlatObject:g1,kindOf:ln,kindOfTest:wA,endsWith:m1,toArray:w1,forEachEntry:y1,matchAll:C1,isHTMLForm:v1,hasOwnProperty:Fc,hasOwnProp:Fc,reduceDescriptors:Uc,freezeMethods:b1,toObjectSet:Q1,toCamelCase:T1,noop:F1,toFiniteNumber:U1,findKey:bc,global:li,isContextDefined:Qc,isSpecCompliantForm:S1,toJSONObject:E1,isAsyncFn:L1,isThenable:M1,setImmediate:Sc,asap:H1,isIterable:i=>i!=null&&jt(i[an])};let Xe=class hp extends Error{static from(e,t,A,r,n,s){const o=new hp(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:fe.toJSONObject(this.config),code:this.code,status:this.status}}};Xe.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Xe.ERR_BAD_OPTION="ERR_BAD_OPTION",Xe.ECONNABORTED="ECONNABORTED",Xe.ETIMEDOUT="ETIMEDOUT",Xe.ERR_NETWORK="ERR_NETWORK",Xe.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Xe.ERR_DEPRECATED="ERR_DEPRECATED",Xe.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Xe.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Xe.ERR_CANCELED="ERR_CANCELED",Xe.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Xe.ERR_INVALID_URL="ERR_INVALID_URL";const I1=null;function go(i){return fe.isPlainObject(i)||fe.isArray(i)}function Ec(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function Lc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Ec(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function D1(i){return fe.isArray(i)&&!i.some(go)}const _1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function un(i,e,t){if(!fe.isObject(i))throw new TypeError("target must be an object");e=e||new FormData,t=fe.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,U){return!fe.isUndefined(U[C])});const A=t.metaTokens,r=t.visitor||u,n=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(r))throw new TypeError("visitor must be a function");function c(T){if(T===null)return"";if(fe.isDate(T))return T.toISOString();if(fe.isBoolean(T))return T.toString();if(!l&&fe.isBlob(T))throw new Xe("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(T)||fe.isTypedArray(T)?l&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function u(T,C,U){let F=T;if(T&&!U&&typeof T=="object"){if(fe.endsWith(C,"{}"))C=A?C:C.slice(0,-2),T=JSON.stringify(T);else if(fe.isArray(T)&&D1(T)||(fe.isFileList(T)||fe.endsWith(C,"[]"))&&(F=fe.toArray(T)))return C=Ec(C),F.forEach(function(k,R){!(fe.isUndefined(k)||k===null)&&e.append(s===!0?Lc([C],R,n):s===null?C:C+"[]",c(k))}),!1}return go(T)?!0:(e.append(Lc(U,C,n),c(T)),!1)}const m=[],y=Object.assign(_1,{defaultVisitor:u,convertValue:c,isVisitable:go});function v(T,C){if(!fe.isUndefined(T)){if(m.indexOf(T)!==-1)throw Error("Circular reference detected in "+C.join("."));m.push(T),fe.forEach(T,function(F,E){(!(fe.isUndefined(F)||F===null)&&r.call(e,F,fe.isString(E)?E.trim():E,C,y))===!0&&v(F,C?C.concat(E):[E])}),m.pop()}}if(!fe.isObject(i))throw new TypeError("data must be an object");return v(i),e}function Mc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function mo(i,e){this._pairs=[],i&&un(i,this,e)}const Hc=mo.prototype;Hc.append=function(e,t){this._pairs.push([e,t])},Hc.toString=function(e){const t=e?function(A){return e.call(this,A,Mc)}:Mc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function P1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ic(i,e,t){if(!e)return i;const A=t&&t.encode||P1,r=fe.isFunction(t)?{serialize:t}:t,n=r&&r.serialize;let s;if(n?s=n(e,r):s=fe.isURLSearchParams(e)?e.toString():new mo(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class Dc{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){fe.forEach(this.handlers,function(A){A!==null&&e(A)})}}const wo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},k1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:mo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Bo=typeof window<"u"&&typeof document<"u",yo=typeof navigator=="object"&&navigator||void 0,N1=Bo&&(!yo||["ReactNative","NativeScript","NS"].indexOf(yo.product)<0),O1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",K1=Bo&&window.location.href||"http://localhost",Kt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Bo,hasStandardBrowserEnv:N1,hasStandardBrowserWebWorkerEnv:O1,navigator:yo,origin:K1},Symbol.toStringTag,{value:"Module"})),...k1};function V1(i,e){return un(i,new Kt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Kt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function z1(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function W1(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 _c(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&&fe.isArray(r)?r.length:s,l?(fe.hasOwnProp(r,s)?r[s]=[r[s],A]:r[s]=A,!o):((!r[s]||!fe.isObject(r[s]))&&(r[s]=[]),e(t,A,r[s],n)&&fe.isArray(r[s])&&(r[s]=W1(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(z1(A),r,t,0)}),t}return null}function R1(i,e,t){if(fe.isString(i))try{return(e||JSON.parse)(i),fe.trim(i)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(i)}const or={transitional:wo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",r=A.indexOf("application/json")>-1,n=fe.isObject(e);if(n&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return r?JSON.stringify(_c(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.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 V1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.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),R1(e)):e}],transformResponse:[function(e){const t=this.transitional||or.transitional,A=t&&t.forcedJSONParsing,r=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.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"?Xe.from(o,Xe.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:Kt.classes.FormData,Blob:Kt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],i=>{or.headers[i]={}});const G1=fe.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"]),$1=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(),A=s.substring(r+1).trim(),!(!t||e[t]&&G1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},Pc=Symbol("internals");function ar(i){return i&&String(i).trim().toLowerCase()}function dn(i){return i===!1||i==null?i:fe.isArray(i)?i.map(dn):String(i)}function X1(i){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(i);)e[A[1]]=A[2];return e}const J1=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Co(i,e,t,A,r){if(fe.isFunction(A))return A.call(this,e,t);if(r&&(e=t),!!fe.isString(e)){if(fe.isString(A))return e.indexOf(A)!==-1;if(fe.isRegExp(A))return A.test(e)}}function Z1(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function Y1(i,e){const t=fe.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(i,A+t,{value:function(r,n,s){return this[A].call(this,e,r,n,s)},configurable:!0})})}let eA=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=ar(l);if(!u)throw new Error("header name must be a non-empty string");const m=fe.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(r[m||l]=dn(o))}const s=(o,l)=>fe.forEach(o,(c,u)=>n(c,u,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(fe.isString(e)&&(e=e.trim())&&!J1(e))s($1(e),t);else if(fe.isObject(e)&&fe.isIterable(e)){let o={},l,c;for(const u of e){if(!fe.isArray(u))throw TypeError("Object iterator must return a key-value pair");o[c=u[0]]=(l=o[c])?fe.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=ar(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return X1(r);if(fe.isFunction(t))return t.call(this,r,A);if(fe.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ar(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||Co(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=ar(s),s){const o=fe.findKey(A,s);o&&(!t||Co(A,A[o],o,t))&&(delete A[o],r=!0)}}return fe.isArray(e)?e.forEach(n):n(e),r}clear(e){const t=Object.keys(this);let A=t.length,r=!1;for(;A--;){const n=t[A];(!e||Co(this,this[n],n,e,!0))&&(delete this[n],r=!0)}return r}normalize(e){const t=this,A={};return fe.forEach(this,(r,n)=>{const s=fe.findKey(A,n);if(s){t[s]=dn(r),delete t[n];return}const o=e?Z1(n):String(n).trim();o!==n&&delete t[n],t[o]=dn(r),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return fe.forEach(this,(A,r)=>{A!=null&&A!==!1&&(t[r]=e&&fe.isArray(A)?A.join(", "):A)}),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 A=new this(e);return t.forEach(r=>A.set(r)),A}static accessor(e){const A=(this[Pc]=this[Pc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=ar(s);A[o]||(Y1(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};eA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(eA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(eA);function vo(i,e){const t=this||or,A=e||t,r=eA.from(A.headers);let n=A.data;return fe.forEach(i,function(o){n=o.call(t,n,r.normalize(),e?e.status:void 0)}),r.normalize(),n}function kc(i){return!!(i&&i.__CANCEL__)}let lr=class extends Xe{constructor(e,t,A){super(e??"canceled",Xe.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Nc(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Xe("Request failed with status code "+t.status,[Xe.ERR_BAD_REQUEST,Xe.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function q1(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function j1(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(),u=A[n];s||(s=c),t[r]=l,A[r]=c;let m=n,y=0;for(;m!==r;)y+=t[m++],m=m%i;if(r=(r+1)%i,r===n&&(n=(n+1)%i),c-s<e)return;const v=u&&c-u;return v?Math.round(y*1e3/v):void 0}}function eg(i,e){let t=0,A=1e3/e,r,n;const s=(c,u=Date.now())=>{t=u,r=null,n&&(clearTimeout(n),n=null),i(...c)};return[(...c)=>{const u=Date.now(),m=u-t;m>=A?s(c,u):(r=c,n||(n=setTimeout(()=>{n=null,s(r)},A-m)))},()=>r&&s(r)]}const pn=(i,e,t=3)=>{let A=0;const r=j1(50,250);return eg(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,l=s-A,c=r(l),u=s<=o;A=s;const m={loaded:s,total:o,progress:o?s/o:void 0,bytes:l,rate:c||void 0,estimated:c&&o&&u?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};i(m)},t)},Oc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},Kc=i=>(...e)=>fe.asap(()=>i(...e)),tg=Kt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Kt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Kt.origin),Kt.navigator&&/(msie|trident)/i.test(Kt.navigator.userAgent)):()=>!0,Ag=Kt.hasStandardBrowserEnv?{write(i,e,t,A,r,n,s){if(typeof document>"u")return;const o=[`${i}=${encodeURIComponent(e)}`];fe.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),fe.isString(A)&&o.push(`path=${A}`),fe.isString(r)&&o.push(`domain=${r}`),n===!0&&o.push("secure"),fe.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 ig(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function rg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function Vc(i,e,t){let A=!ig(e);return i&&(A||t==!1)?rg(i,e):e}const zc=i=>i instanceof eA?{...i}:i;function ci(i,e){e=e||{};const t={};function A(c,u,m,y){return fe.isPlainObject(c)&&fe.isPlainObject(u)?fe.merge.call({caseless:y},c,u):fe.isPlainObject(u)?fe.merge({},u):fe.isArray(u)?u.slice():u}function r(c,u,m,y){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c,m,y)}else return A(c,u,m,y)}function n(c,u){if(!fe.isUndefined(u))return A(void 0,u)}function s(c,u){if(fe.isUndefined(u)){if(!fe.isUndefined(c))return A(void 0,c)}else return A(void 0,u)}function o(c,u,m){if(m in e)return A(c,u);if(m 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,u,m)=>r(zc(c),zc(u),m,!0)};return fe.forEach(Object.keys({...i,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=fe.hasOwnProp(l,u)?l[u]:r,y=m(i[u],e[u],u);fe.isUndefined(y)&&m!==o||(t[u]=y)}),t}const Wc=i=>{const e=ci({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=eA.from(s),e.url=Ic(Vc(e.baseURL,e.url,e.allowAbsoluteUrls),i.params,i.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),fe.isFormData(t)){if(Kt.hasStandardBrowserEnv||Kt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(fe.isFunction(t.getHeaders)){const l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,m])=>{c.includes(u.toLowerCase())&&s.set(u,m)})}}if(Kt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&tg(e.url))){const l=r&&n&&Ag.read(n);l&&s.set(r,l)}return e},ng=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Wc(i);let n=r.data;const s=eA.from(r.headers).normalize();let{responseType:o,onUploadProgress:l,onDownloadProgress:c}=r,u,m,y,v,T;function C(){v&&v(),T&&T(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let U=new XMLHttpRequest;U.open(r.method.toUpperCase(),r.url,!0),U.timeout=r.timeout;function F(){if(!U)return;const k=eA.from("getAllResponseHeaders"in U&&U.getAllResponseHeaders()),M={data:!o||o==="text"||o==="json"?U.responseText:U.response,status:U.status,statusText:U.statusText,headers:k,config:i,request:U};Nc(function(ie){t(ie),C()},function(ie){A(ie),C()},M),U=null}"onloadend"in U?U.onloadend=F:U.onreadystatechange=function(){!U||U.readyState!==4||U.status===0&&!(U.responseURL&&U.responseURL.indexOf("file:")===0)||setTimeout(F)},U.onabort=function(){U&&(A(new Xe("Request aborted",Xe.ECONNABORTED,i,U)),U=null)},U.onerror=function(R){const M=R&&R.message?R.message:"Network Error",z=new Xe(M,Xe.ERR_NETWORK,i,U);z.event=R||null,A(z),U=null},U.ontimeout=function(){let R=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const M=r.transitional||wo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Xe(R,M.clarifyTimeoutError?Xe.ETIMEDOUT:Xe.ECONNABORTED,i,U)),U=null},n===void 0&&s.setContentType(null),"setRequestHeader"in U&&fe.forEach(s.toJSON(),function(R,M){U.setRequestHeader(M,R)}),fe.isUndefined(r.withCredentials)||(U.withCredentials=!!r.withCredentials),o&&o!=="json"&&(U.responseType=r.responseType),c&&([y,T]=pn(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([m,v]=pn(l),U.upload.addEventListener("progress",m),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=k=>{U&&(A(!k||k.type?new lr(null,i,U):k),U.abort(),U=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=q1(r.url);if(E&&Kt.protocols.indexOf(E)===-1){A(new Xe("Unsupported protocol "+E+":",Xe.ERR_BAD_REQUEST,i));return}U.send(n||null)})},sg=(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 u=c instanceof Error?c:this.reason;A.abort(u instanceof Xe?u:new lr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Xe(`timeout of ${e}ms exceeded`,Xe.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=()=>fe.asap(o),l}},og=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},ag=async function*(i,e){for await(const t of lg(i))yield*og(t,e)},lg=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()}},Rc=(i,e,t,A)=>{const r=ag(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:u}=await r.next();if(c){o(),l.close();return}let m=u.byteLength;if(t){let y=n+=m;t(y)}l.enqueue(new Uint8Array(u))}catch(c){throw o(c),c}},cancel(l){return o(l),r.return()}},{highWaterMark:2})},Gc=64*1024,{isFunction:fn}=fe,cg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:$c,TextEncoder:Xc}=fe.global,Jc=(i,...e)=>{try{return!!i(...e)}catch{return!1}},hg=i=>{i=fe.merge.call({skipUndefined:!0},cg,i);const{fetch:e,Request:t,Response:A}=i,r=e?fn(e):typeof fetch=="function",n=fn(t),s=fn(A);if(!r)return!1;const o=r&&fn($c),l=r&&(typeof Xc=="function"?(T=>C=>T.encode(C))(new Xc):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&Jc(()=>{let T=!1;const C=new t(Kt.origin,{body:new $c,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!C}),u=s&&o&&Jc(()=>fe.isReadableStream(new A("").body)),m={stream:u&&(T=>T.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!m[T]&&(m[T]=(C,U)=>{let F=C&&C[T];if(F)return F.call(C);throw new Xe(`Response type '${T}' is not supported`,Xe.ERR_NOT_SUPPORT,U)})});const y=async T=>{if(T==null)return 0;if(fe.isBlob(T))return T.size;if(fe.isSpecCompliantForm(T))return(await new t(Kt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(T)||fe.isArrayBuffer(T))return T.byteLength;if(fe.isURLSearchParams(T)&&(T=T+""),fe.isString(T))return(await l(T)).byteLength},v=async(T,C)=>{const U=fe.toFiniteNumber(T.getContentLength());return U??y(C)};return async T=>{let{url:C,method:U,data:F,signal:E,cancelToken:k,timeout:R,onDownloadProgress:M,onUploadProgress:z,responseType:ie,headers:G,withCredentials:K="same-origin",fetchOptions:Ae}=Wc(T),re=e||fetch;ie=ie?(ie+"").toLowerCase():"text";let he=sg([E,k&&k.toAbortSignal()],R),J=null;const ee=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let ae;try{if(z&&c&&U!=="get"&&U!=="head"&&(ae=await v(G,F))!==0){let be=new t(C,{method:"POST",body:F,duplex:"half"}),Fe;if(fe.isFormData(F)&&(Fe=be.headers.get("content-type"))&&G.setContentType(Fe),be.body){const[Ce,ve]=Oc(ae,pn(Kc(z)));F=Rc(be.body,Gc,Ce,ve)}}fe.isString(K)||(K=K?"include":"omit");const ce=n&&"credentials"in t.prototype,se={...Ae,signal:he,method:U.toUpperCase(),headers:G.normalize().toJSON(),body:F,duplex:"half",credentials:ce?K:void 0};J=n&&new t(C,se);let le=await(n?re(J,Ae):re(C,se));const pe=u&&(ie==="stream"||ie==="response");if(u&&(M||pe&&ee)){const be={};["status","statusText","headers"].forEach(Qe=>{be[Qe]=le[Qe]});const Fe=fe.toFiniteNumber(le.headers.get("content-length")),[Ce,ve]=M&&Oc(Fe,pn(Kc(M),!0))||[];le=new A(Rc(le.body,Gc,Ce,()=>{ve&&ve(),ee&&ee()}),be)}ie=ie||"text";let we=await m[fe.findKey(m,ie)||"text"](le,T);return!pe&&ee&&ee(),await new Promise((be,Fe)=>{Nc(be,Fe,{data:we,headers:eA.from(le.headers),status:le.status,statusText:le.statusText,config:T,request:J})})}catch(ce){throw ee&&ee(),ce&&ce.name==="TypeError"&&/Load failed|fetch/i.test(ce.message)?Object.assign(new Xe("Network Error",Xe.ERR_NETWORK,T,J,ce&&ce.response),{cause:ce.cause||ce}):Xe.from(ce,ce&&ce.code,T,J,ce&&ce.response)}}},ug=new Map,Zc=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,u=ug;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:hg(e)),u=c;return c};Zc();const To={http:I1,xhr:ng,fetch:{get:Zc}};fe.forEach(To,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const Yc=i=>`- ${i}`,dg=i=>fe.isFunction(i)||i===null||i===!1;function pg(i,e){i=fe.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,!dg(A)&&(r=To[(o=String(A)).toLowerCase()],r===void 0))throw new Xe(`Unknown adapter '${o}'`);if(r&&(fe.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(Yc).join(`
5
+ `):" "+Yc(s[0]):"as no adapter specified";throw new Xe("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const qc={getAdapter:pg,adapters:To};function xo(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new lr(null,i)}function jc(i){return xo(i),i.headers=eA.from(i.headers),i.data=vo.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),qc.getAdapter(i.adapter||or.adapter,i)(i).then(function(A){return xo(i),A.data=vo.call(i,i.transformResponse,A),A.headers=eA.from(A.headers),A},function(A){return kc(A)||(xo(i),A&&A.response&&(A.response.data=vo.call(i,i.transformResponse,A.response),A.response.headers=eA.from(A.response.headers))),Promise.reject(A)})}const eh="1.13.5",gn={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{gn[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const th={};gn.transitional=function(e,t,A){function r(n,s){return"[Axios v"+eh+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Xe(r(s," has been removed"+(t?" in "+t:"")),Xe.ERR_DEPRECATED);return t&&!th[s]&&(th[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}},gn.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function fg(i,e,t){if(typeof i!="object")throw new Xe("options must be an object",Xe.ERR_BAD_OPTION_VALUE);const A=Object.keys(i);let r=A.length;for(;r-- >0;){const n=A[r],s=e[n];if(s){const o=i[n],l=o===void 0||s(o,n,i);if(l!==!0)throw new Xe("option "+n+" must be "+l,Xe.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Xe("Unknown option "+n,Xe.ERR_BAD_OPTION)}}const mn={assertOptions:fg,validators:gn},lA=mn.validators;let hi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Dc,response:new Dc}}async request(e,t){try{return await this._request(e,t)}catch(A){if(A instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{A.stack?n&&!String(A.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(A.stack+=`
6
+ `+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ci(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&mn.assertOptions(A,{silentJSONParsing:lA.transitional(lA.boolean),forcedJSONParsing:lA.transitional(lA.boolean),clarifyTimeoutError:lA.transitional(lA.boolean),legacyInterceptorReqResOrdering:lA.transitional(lA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:mn.assertOptions(r,{encode:lA.function,serialize:lA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),mn.assertOptions(t,{baseUrl:lA.spelling("baseURL"),withXsrfToken:lA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&fe.merge(n.common,n[t.method]);n&&fe.forEach(["delete","get","head","post","put","patch","common"],T=>{delete n[T]}),t.headers=eA.concat(s,n);const o=[];let l=!0;this.interceptors.request.forEach(function(C){if(typeof C.runWhen=="function"&&C.runWhen(t)===!1)return;l=l&&C.synchronous;const U=t.transitional||wo;U&&U.legacyInterceptorReqResOrdering?o.unshift(C.fulfilled,C.rejected):o.push(C.fulfilled,C.rejected)});const c=[];this.interceptors.response.forEach(function(C){c.push(C.fulfilled,C.rejected)});let u,m=0,y;if(!l){const T=[jc.bind(this),void 0];for(T.unshift(...o),T.push(...c),y=T.length,u=Promise.resolve(t);m<y;)u=u.then(T[m++],T[m++]);return u}y=o.length;let v=t;for(;m<y;){const T=o[m++],C=o[m++];try{v=T(v)}catch(U){C.call(this,U);break}}try{u=jc.call(this,v)}catch(T){return Promise.reject(T)}for(m=0,y=c.length;m<y;)u=u.then(c[m++],c[m++]);return u}getUri(e){e=ci(this.defaults,e);const t=Vc(e.baseURL,e.url,e.allowAbsoluteUrls);return Ic(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){hi.prototype[e]=function(t,A){return this.request(ci(A||{},{method:e,url:t,data:(A||{}).data}))}}),fe.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(ci(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}hi.prototype[e]=t(),hi.prototype[e+"Form"]=t(!0)});let gg=class up{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 lr(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 up(function(r){e=r}),cancel:e}}};function mg(i){return function(t){return i.apply(null,t)}}function wg(i){return fe.isObject(i)&&i.isAxiosError===!0}const bo={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(bo).forEach(([i,e])=>{bo[e]=i});function Ah(i){const e=new hi(i),t=Cc(hi.prototype.request,e);return fe.extend(t,hi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return Ah(ci(i,r))},t}const ht=Ah(or);ht.Axios=hi,ht.CanceledError=lr,ht.CancelToken=gg,ht.isCancel=kc,ht.VERSION=eh,ht.toFormData=un,ht.AxiosError=Xe,ht.Cancel=ht.CanceledError,ht.all=function(e){return Promise.all(e)},ht.spread=mg,ht.isAxiosError=wg,ht.mergeConfig=ci,ht.AxiosHeaders=eA,ht.formToJSON=i=>_c(fe.isHTMLForm(i)?new FormData(i):i),ht.getAdapter=qc.getAdapter,ht.HttpStatusCode=bo,ht.default=ht;const{Axios:JT,AxiosError:ZT,CanceledError:YT,isCancel:qT,CancelToken:jT,VERSION:ex,all:tx,Cancel:Ax,isAxiosError:ix,spread:rx,toFormData:nx,AxiosHeaders:sx,HttpStatusCode:ox,formToJSON:ax,getAdapter:lx,mergeConfig:cx}=ht,FA=Object.create(null);FA.open="0",FA.close="1",FA.ping="2",FA.pong="3",FA.message="4",FA.upgrade="5",FA.noop="6";const wn=Object.create(null);Object.keys(FA).forEach(i=>{wn[FA[i]]=i});const Qo={type:"error",data:"parser error"},ih=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",rh=typeof ArrayBuffer=="function",nh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,Fo=({type:i,data:e},t,A)=>ih&&e instanceof Blob?t?A(e):sh(e,A):rh&&(e instanceof ArrayBuffer||nh(e))?t?A(e):sh(new Blob([e]),A):A(FA[i]+(e||"")),sh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function oh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Uo;function Bg(i,e){if(ih&&i.data instanceof Blob)return i.data.arrayBuffer().then(oh).then(e);if(rh&&(i.data instanceof ArrayBuffer||nh(i.data)))return e(oh(i.data));Fo(i,!1,t=>{Uo||(Uo=new TextEncoder),e(Uo.encode(t))})}const ah="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<ah.length;i++)cr[ah.charCodeAt(i)]=i;const yg=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),u=new Uint8Array(c);for(A=0;A<t;A+=4)n=cr[i.charCodeAt(A)],s=cr[i.charCodeAt(A+1)],o=cr[i.charCodeAt(A+2)],l=cr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},Cg=typeof ArrayBuffer=="function",So=(i,e)=>{if(typeof i!="string")return{type:"message",data:lh(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:vg(i.substring(1),e)}:wn[t]?i.length>1?{type:wn[t],data:i.substring(1)}:{type:wn[t]}:Qo},vg=(i,e)=>{if(Cg){const t=yg(i);return lh(t,e)}else return{base64:!0,data:i}},lh=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,ch="",Tg=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{Fo(n,!1,o=>{A[s]=o,++r===t&&e(A.join(ch))})})},xg=(i,e)=>{const t=i.split(ch),A=[];for(let r=0;r<t.length;r++){const n=So(t[r],e);if(A.push(n),n.type==="error")break}return A};function bg(){return new TransformStream({transform(i,e){Bg(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 Eo;function Bn(i){return i.reduce((e,t)=>e+t.length,0)}function yn(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 Qg(i,e){Eo||(Eo=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(Bn(t)<1)break;const l=yn(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(Bn(t)<2)break;const l=yn(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Bn(t)<8)break;const l=yn(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(Qo);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Bn(t)<r)break;const l=yn(t,r);o.enqueue(So(n?l:Eo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(Qo);break}}}})}const hh=4;function Ft(i){if(i)return Fg(i)}function Fg(i){for(var e in Ft.prototype)i[e]=Ft.prototype[e];return i}Ft.prototype.on=Ft.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},Ft.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},Ft.prototype.off=Ft.prototype.removeListener=Ft.prototype.removeAllListeners=Ft.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},Ft.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},Ft.prototype.emitReserved=Ft.prototype.emit,Ft.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},Ft.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Cn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),cA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ug="arraybuffer";function hx(){}function uh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Sg=cA.setTimeout,Eg=cA.clearTimeout;function vn(i,e){e.useNativeTimers?(i.setTimeoutFn=Sg.bind(cA),i.clearTimeoutFn=Eg.bind(cA)):(i.setTimeoutFn=cA.setTimeout.bind(cA),i.clearTimeoutFn=cA.clearTimeout.bind(cA))}const Lg=1.33;function Mg(i){return typeof i=="string"?Hg(i):Math.ceil((i.byteLength||i.size)*Lg)}function Hg(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 dh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ig(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Dg(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 _g extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class Lo extends Ft{constructor(e){super(),this.writable=!1,vn(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 _g(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=So(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=Ig(e);return t.length?"?"+t:""}}class Pg extends Lo{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)};xg(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,Tg(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]=dh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let ph=!1;try{ph=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const kg=ph;function Ng(){}class Og extends Pg{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 UA extends Ft{constructor(e,t,A){super(),this.createRequest=e,vn(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=uh(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=UA.requestsCount++,UA.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=Ng,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete UA.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(UA.requestsCount=0,UA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",fh);else if(typeof addEventListener=="function"){const i="onpagehide"in cA?"pagehide":"unload";addEventListener(i,fh,!1)}}function fh(){for(let i in UA.requests)UA.requests.hasOwnProperty(i)&&UA.requests[i].abort()}const Kg=(function(){const i=gh({xdomain:!1});return i&&i.responseType!==null})();class Vg extends Og{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Kg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new UA(gh,this.uri(),e)}}function gh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||kg))return new XMLHttpRequest}catch{}if(!e)try{return new cA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const mh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class zg extends Lo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=mh?{}:uh(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;Fo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Cn(()=>{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]=dh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Mo=cA.WebSocket||cA.MozWebSocket;class Wg extends zg{createSocket(e,t,A){return mh?new Mo(e,t,A):t?new Mo(e,t):new Mo(e)}doWrite(e,t){this.ws.send(t)}}class Rg extends Lo{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=Qg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=bg();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&&Cn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Gg={websocket:Wg,webtransport:Rg,polling:Vg},$g=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Xg=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ho(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=$g.exec(i||""),n={},s=14;for(;s--;)n[Xg[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=Jg(n,n.path),n.queryKey=Zg(n,n.query),n}function Jg(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 Zg(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Io=typeof addEventListener=="function"&&typeof removeEventListener=="function",Tn=[];Io&&addEventListener("offline",()=>{Tn.forEach(i=>i())},!1);class RA extends Ft{constructor(e,t){if(super(),this.binaryType=Ug,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=Ho(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=Ho(t.host).host);vn(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=Dg(this.opts.query)),Io&&(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"})},Tn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=hh,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&&RA.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",RA.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+=Mg(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,Cn(()=>{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(RA.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(),Io&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Tn.indexOf(this._offlineEventListener);A!==-1&&Tn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}RA.protocol=hh;class Yg extends RA{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;RA.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;RA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(u(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function n(){A||(A=!0,u(),t.close(),t=null)}const s=m=>{const y=new Error("probe error: "+m);y.transport=t.name,n(),this.emitReserved("upgradeError",y)};function o(){s("transport closed")}function l(){s("socket closed")}function c(m){t&&m.name!==t.name&&n()}const u=()=>{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 qg=class extends Yg{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=>Gg[r]).filter(r=>!!r)),super(e,A)}};function jg(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=Ho(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 em=typeof ArrayBuffer=="function",tm=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,wh=Object.prototype.toString,Am=typeof Blob=="function"||typeof Blob<"u"&&wh.call(Blob)==="[object BlobConstructor]",im=typeof File=="function"||typeof File<"u"&&wh.call(File)==="[object FileConstructor]";function Do(i){return em&&(i instanceof ArrayBuffer||tm(i))||Am&&i instanceof Blob||im&&i instanceof File}function xn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(xn(i[t]))return!0;return!1}if(Do(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return xn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&xn(i[t]))return!0;return!1}function rm(i){const e=[],t=i.data,A=i;return A.data=_o(t,e),A.attachments=e.length,{packet:A,buffers:e}}function _o(i,e){if(!i)return i;if(Do(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]=_o(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]=_o(i[A],e));return t}return i}function nm(i,e){return i.data=Po(i.data,e),delete i.attachments,i}function Po(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]=Po(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Po(i[t],e));return i}const sm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var st;(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"})(st||(st={}));class om{constructor(e){this.replacer=e}encode(e){return(e.type===st.EVENT||e.type===st.ACK)&&xn(e)?this.encodeAsBinary({type:e.type===st.EVENT?st.BINARY_EVENT:st.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===st.BINARY_EVENT||e.type===st.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=rm(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class ko extends Ft{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===st.BINARY_EVENT;A||t.type===st.BINARY_ACK?(t.type=A?st.EVENT:st.ACK,this.reconstructor=new am(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Do(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(st[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===st.BINARY_EVENT||A.type===st.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(ko.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 st.CONNECT:return Bh(t);case st.DISCONNECT:return t===void 0;case st.CONNECT_ERROR:return typeof t=="string"||Bh(t);case st.EVENT:case st.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&sm.indexOf(t[0])===-1);case st.ACK:case st.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class am{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=nm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Bh(i){return Object.prototype.toString.call(i)==="[object Object]"}const lm=Object.freeze(Object.defineProperty({__proto__:null,Decoder:ko,Encoder:om,get PacketType(){return st}},Symbol.toStringTag,{value:"Module"}));function BA(i,e,t){return i.on(e,t),function(){i.off(e,t)}}const cm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class yh extends Ft{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=[BA(e,"open",this.onopen.bind(this)),BA(e,"packet",this.onpacket.bind(this)),BA(e,"error",this.onerror.bind(this)),BA(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(cm.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:st.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const u=this.ids++,m=t.pop();this._registerAckCallback(u,m),s.id=u}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:st.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 st.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 st.EVENT:case st.BINARY_EVENT:this.onevent(e);break;case st.ACK:case st.BINARY_ACK:this.onack(e);break;case st.DISCONNECT:this.ondisconnect();break;case st.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:st.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:st.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 Si(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}Si.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},Si.prototype.reset=function(){this.attempts=0},Si.prototype.setMin=function(i){this.ms=i},Si.prototype.setMax=function(i){this.max=i},Si.prototype.setJitter=function(i){this.jitter=i};class No extends Ft{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,vn(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 Si({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||lm;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 qg(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=BA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=BA(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(BA(e,"ping",this.onping.bind(this)),BA(e,"data",this.ondata.bind(this)),BA(e,"error",this.onerror.bind(this)),BA(e,"close",this.onclose.bind(this)),BA(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){Cn(()=>{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 yh(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 hr={};function bn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=jg(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=hr[r]&&n in hr[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new No(A,e):(hr[r]||(hr[r]=new No(A,e)),l=hr[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(bn,{Manager:No,Socket:yh,io:bn,connect:bn});function Oo(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 sA=Oo("http://localhost:8000");function Ch(i){const e=Oo(i);e&&e!==sA&&(sA=e,Ct&&(Ct.disconnect(),Ct.removeAllListeners(),Ct=null))}let Ct=null;function hm(){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:sA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=bn(sA,{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:sA,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:sA,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:sA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:sA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function Ko(){const i=Oo(Ct?.io?.uri||null);return!Ct||Ct.io&&i&&sA&&i!==sA?(Ct&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:sA,wasConnected:Ct.connected,reason:"baseUrl changed"}),Ct.disconnect(),Ct.removeAllListeners(),Ct=null),Ct=hm()):Ct.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:Ct.id,connected:Ct.connected,baseUrl:sA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:Ct.id,baseUrl:sA}),Ct}function um(i,e){const t=Ko();return t.on(i,e),()=>t.off(i,e)}function dm(i,e){Ct&&Ct.off(i,e)}function pm(i,e){Ko().emit(i,e)}function fm(){return Ct?Ct.connected?"connected":"connecting":"disconnected"}const Qn={getSocket:Ko,on:um,off:dm,emit:pm,getStatus:fm,setBaseUrl:Ch},gm={},vh=q.createContext(),Dt=()=>{const i=q.useContext(vh);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},mm=({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:Ss&&Ss.tagName.toUpperCase()==="SCRIPT"&&Ss.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&gm?.VITE_BASE_URL)??"http://localhost:5002";Qn.setBaseUrl(l);const u={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account",indicators:"/api/market-data/indicators"},...t},m=t?.params||{},[y,v]=q.useState(r||"BTC/USD"),[T,C]=q.useState(n||"M1"),[U,F]=q.useState([]),[E,k]=q.useState(!0),[R,M]=q.useState([]),[z,ie]=q.useState(!1),[G,K]=q.useState(1e5),[Ae,re]=q.useState(null),[he,J]=q.useState([]),[ee,ae]=q.useState(!0),[ce,se]=q.useState(!1),[le,pe]=q.useState(!0),[we,be]=q.useState("candles"),[Fe,Ce]=q.useState(!1),[ve,Qe]=q.useState("dark"),[Ue,ke]=q.useState(null),[Je,We]=q.useState(!1),[Te,Ne]=q.useState([]),ye=q.useRef(null),de=q.useRef(new Map),_e=q.useRef(null),je=1e3,At=q.useCallback(async()=>{if(A)try{const Se=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Se)return;ie(!0);const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Se}`}});let Ke=[];Array.isArray(He.data)?Ke=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Ke=He.data.data);const tt=Ke.filter(Ve=>Ve.closePrice===null||Ve.closePrice===void 0).map(Ve=>({id:Ve.id,ticket:23,symbol:Ve.symbol,type:Ve.type,volume:Ve.volume,openPrice:Ve.openPrice??Ve.price,stopLoss:Ve.stopLoss,takeProfit:Ve.takeProfit,comment:Ve.comment||"",status:"OPEN",swap:0,profit:Ve.profit||0,profitCurrency:"USD",time:new Date(Ve.openedAt||Ve.openAt||Date.now()).toLocaleTimeString(),openAt:Ve.openedAt||Ve.openAt,closeAt:Ve.closedAt||Ve.closeAt}));M(tt)}catch(Se){console.error("❌ Error fetching orders:",Se.response?.data||Se.message),M([])}finally{ie(!1)}},[l,A]),rt=q.useCallback((Se,He)=>!He||!Se.price||isNaN(He)||isNaN(Se.price)?Se.profit||0:(Se?.type?.toUpperCase()==="BUY"?He-Se.price:Se.price-He)*Se.volume,[]),vt=q.useCallback(async()=>{try{const Se=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Se)return;const He=await ht.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${Se}`}});if(He.data&&He.data.data){const Ke=parseFloat(He.data.data.balance);isNaN(Ke)||K(Ke)}}catch(Se){console.error("❌ Error fetching user balance:",Se.response?.data||Se.message)}},[l]),kt=q.useCallback(async()=>{if(A)try{const Se=localStorage.getItem("token")??localStorage.getItem("authToken");if(!Se)return;const He=await ht.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${Se}`}});let Ke=[];Array.isArray(He.data)?Ke=He.data:He.data?.data&&Array.isArray(He.data.data)&&(Ke=He.data.data);const tt=Ke.filter(Ve=>Ve.closePrice!==null&&Ve.closePrice!==void 0).map(Ve=>({id:Ve.id,ticket:23,symbol:Ve.symbol,type:Ve.type,volume:Ve.volume,openPrice:Ve.openPrice??Ve.price,closePrice:Ve.closePrice,stopLoss:Ve.stopLoss,takeProfit:Ve.takeProfit,profit:Ve.profit??Ve.profitLoss??0,profitCurrency:"USD",openAt:Ve.openedAt||Ve.openAt,closeAt:Ve.closedAt||Ve.closeAt,closeReason:Ve.closeReason||"",status:"CLOSED"}));Ne(tt)}catch(Se){console.error("❌ Error fetching history orders:",Se.response?.data||Se.message),Ne([])}},[l,A]),Me=q.useMemo(()=>{const Se=G,He=R.reduce((ct,yt)=>ct+yt.volume*yt.price*.01,0),Ke=R.reduce((ct,yt)=>{const Et=U.find(Ge=>Ge.symbol===yt.symbol);if(Et){const Ge=yt.type?.toUpperCase()==="BUY"?parseFloat(Et.bid||0):parseFloat(Et.ask||0);if(Ge&&Ge>0&&!isNaN(Ge))return ct+rt(yt,Ge)}return ct+(yt.profit||0)},0),tt=Se+Ke,Ve=tt-He,et=He>0?tt/He*100:0;return{balance:Se,equity:tt,margin:He,freeMargin:Ve,level:et.toFixed(2)}},[R,U,G,rt]);q.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(At(),vt(),kt())},[At,vt,kt,A]),q.useEffect(()=>{(async()=>{try{k(!0);const He=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Ke=await ht.get(He);let tt=[];Array.isArray(Ke.data)?tt=Ke.data:Ke.data&&Ke.data.data&&Array.isArray(Ke.data.data)?tt=Ke.data.data:Ke.data&&Ke.data.prices&&Array.isArray(Ke.data.prices)?tt=Ke.data.prices:Ke.data&&Array.isArray(Ke.data)&&(tt=Ke.data);const Ve=tt.map(et=>{const ct=et.symbol||et.name||"",yt=et.category||null;return ct&&(et.bid!==void 0||et.price!==void 0)?{symbol:ct,bid:et.bid??et.price??0,ask:et.ask??et.price??0,change:et.change??0,category:yt}:{...et,symbol:ct,category:yt}});Ve.length>0?(F(Ve),Ve.find(ct=>ct.symbol===y)||v(Ve[0].symbol)):F([])}catch(He){console.error("❌ Error fetching symbols:",He.response?.data||He.message),F([])}finally{k(!1)}})()},[l,u.symbols]);const ge=q.useCallback(()=>{const Se=de.current;if(Se.size===0)return;const He=new Map(Se);Se.clear(),F(Ke=>Ke.map(tt=>{const Ve=He.get(tt.symbol);return Ve?{...tt,...Ve}:tt})),M(Ke=>{let tt=!1;const Ve=Ke.map(et=>{const ct=He.get(et.symbol);if(!ct)return et;const yt=et.type?.toUpperCase()==="BUY"?parseFloat(ct.bid||0):parseFloat(ct.ask||0);if(!yt||isNaN(yt)||yt<=0)return et;const Et=rt(et,yt);return Et===et.profit?et:(tt=!0,{...et,profit:Et})});return tt?Ve:Ke})},[rt]);q.useEffect(()=>{ye.current||(ye.current=Qn.getSocket());const Se=ye.current,He=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&Se.emit("joinUserRoom",{userId:Number(A)})},Ke=()=>console.log("⚠️ TradingContext: Disconnected"),tt=et=>{et?.symbol&&(de.current.set(et.symbol,et),_e.current||(_e.current=setTimeout(()=>{_e.current=null,ge()},je)))},Ve=async et=>{if(et){if(et.newBalance!==void 0){const ct=parseFloat(et.newBalance);isNaN(ct)||K(ct)}if(window.notify){const ct=et.profitLoss||et.profit||0,yt=ct>=0?`+${ct.toFixed(2)}`:ct.toFixed(2),Et=et.symbol||"Trade",Ge=et.reason||"Closed";window.notify(`Trade Closed: ${Ge} | ${Et} | P/L: ${yt} USD`,ct>=0?"success":"error")}et.tradeId&&M(ct=>ct.filter(yt=>yt.id!==et.tradeId)),await At(),await vt()}};return Se.on("connect",He),Se.on("disconnect",Ke),Se.on("priceUpdate",tt),Se.on("tradeClosed",Ve),Se.connected&&A&&Number.isFinite(Number(A))&&Se.emit("joinUserRoom",{userId:Number(A)}),()=>{Se.off("connect",He),Se.off("disconnect",Ke),Se.off("priceUpdate",tt),Se.off("tradeClosed",Ve),_e.current&&(clearTimeout(_e.current),_e.current=null),de.current.clear()}},[ge,At,vt]),q.useEffect(()=>{try{const Se=document.documentElement;if(!Se)return;Se.dataset.theme=ve}catch{}},[ve]);const De=q.useMemo(()=>U.find(Se=>Se.symbol===y)||{bid:"0.00000",ask:"0.00000",change:0},[U,y]),Ie=q.useMemo(()=>({selectedSymbol:y,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:At,fetchUserBalance:vt,userBalance:G,setUserBalance:K,accountSummary:Me,currentSymbolData:De,activeTool:Ae,setActiveTool:re,chartObjects:he,setChartObjects:J,showGrid:ee,setShowGrid:ae,snapToGrid:ce,setSnapToGrid:se,drawingsVisible:le,setDrawingsVisible:pe,chartType:we,setChartType:be,chartLocked:Fe,setChartLocked:Ce,theme:ve,setTheme:Qe,candleColors:Ue,setCandleColors:ke,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:Je,setIsShow:We,historyOrders:Te,setHistoryOrders:Ne,fetchHistoryOrders:kt,indicators:s,indicatorSettings:o}),[y,T,U,E,R,z,At,vt,G,Me,De,Ae,he,ee,ce,le,we,Fe,ve,Ue,l,u,m,Je,Te,kt,s,o]);return a.jsx(vh.Provider,{value:Ie,children:i})};var Th={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},xh=q.createContext&&q.createContext(Th),wm=["attr","size","title"];function Bm(i,e){if(i==null)return{};var t=ym(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 ym(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 Fn(){return Fn=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},Fn.apply(this,arguments)}function bh(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 Un(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bh(Object(t),!0).forEach(function(A){Cm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):bh(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Cm(i,e,t){return e=vm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vm(i){var e=Tm(i,"string");return typeof e=="symbol"?e:e+""}function Tm(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 Qh(i){return i&&i.map((e,t)=>q.createElement(e.tag,Un({key:t},e.attr),Qh(e.child)))}function $t(i){return e=>q.createElement(xm,Fn({attr:Un({},i.attr)},e),Qh(i.child))}function xm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=Bm(i,wm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),q.createElement("svg",Fn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Un(Un({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 xh!==void 0?q.createElement(xh.Consumer,null,t=>e(t)):e(Th)}function bm(i){return $t({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 Qm(i){return $t({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 Fm(i){return $t({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 Um(i){return $t({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 Fh(i){return $t({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 Sm(i){return $t({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 Em(i){return $t({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 Lm(i){return $t({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 Mm(i){return $t({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 Hm(i){return $t({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 Im={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Uh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Dt(),c=r==="light",[u,m]=q.useState("0.01"),[y,v]=q.useState(""),[T,C]=q.useState(!1),U=c?"bg-slate-100":"bg-[#12161d]",F=c?"text-slate-700":"text-white",E=c?"hover:bg-slate-200":"hover:bg-[#1e2635]",k=M=>{const z=parseFloat(u)||.01,ie=Math.max(.01,z+M);m(ie.toFixed(2))},R=async M=>{v("");const z=M,ie=parseFloat(z==="BUY"?e:i),G=parseFloat(u);if(!G||G<=0||isNaN(G)){v("Please enter a valid volume (minimum 0.01)");return}if(G<.01){v("Volume must be at least 0.01");return}if(!ie||ie<=0||isNaN(ie)){v("Invalid price. Please refresh and try again.");return}const K=localStorage.getItem("token")??localStorage.getItem("authToken");if(!K){v("Please login to place trades");return}C(!0);const Ae=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:Ae,type:z,volume:G,openPrice:ie,takeProfit:null,stopLoss:null};try{const he=o||Im?.VITE_BASE_URL||"http://localhost:8000",J=l?.trades||"/api/trades",ee=await ht.post(`${he}${J}`,re,{headers:{Authorization:`Bearer ${K}`,"Content-Type":"application/json"}});if(ee.status<200||ee.status>=300){v(ee.data?.message||`Failed to place trade (${ee.status})`);return}s&&s(),A&&A()}catch(he){const J=he?.response?.data?.message||he?.message||"Network error. Please try again.";v(J)}finally{C(!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:()=>R("SELL"),disabled:T,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 ${U}`,children:[a.jsx("button",{type:"button",onClick:()=>k(-.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Fh,{size:8})}),a.jsx("input",{type:"number",value:u,onChange:M=>{const z=M.target.value;(z===""||/^\d*\.?\d{0,2}$/.test(z))&&m(z)},onBlur:()=>{const M=parseFloat(u);m(isNaN(M)||M<.01?"0.01":M.toFixed(2))},className:`w-14 text-center focus:outline-none ${U} ${F}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),a.jsx("button",{type:"button",onClick:()=>k(.01),className:`w-5 flex items-center justify-center ${F} ${E} transition-colors`,children:a.jsx(Sm,{size:8})})]}),a.jsxs("button",{onClick:()=>R("BUY"),disabled:T,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):"—"})]})]}),y&&a.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:y})]})},Dm={},Sh=({isOpen:i,onClose:e,orderType:t,bidPrice:A,askPrice:r,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:l=!1,forceParentExecution:c=!1,tradingEngine:u})=>{const{selectedSymbol:m,selectedTimeframe:y,setOrders:v,symbols:T,fetchOrders:C,theme:U,baseUrl:F,endpoints:E}=Dt(),k=U==="light",R={getContractSpec:Me=>{const ge=String(Me||"").toUpperCase();return ge.includes("BTC")||ge.includes("ETH")||ge.includes("SOL")||ge.includes("XRP")||ge.includes("ADA")||ge.includes("DOGE")||ge.includes("BNB")||ge.includes("AVAX")||ge.includes("DOT")||ge.includes("LINK")||ge.endsWith("USDT")?{contractSize:1}:ge.includes("XAU")||ge.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Me,volume:ge})=>{const De=R.getContractSpec(Me);return(parseFloat(ge)||0)*(De.contractSize||1)}},M=u||R,[z,ie]=q.useState("0.01"),[G,K]=q.useState(""),[Ae,re]=q.useState(""),[he,J]=q.useState(""),[ee,ae]=q.useState(!1),[ce,se]=q.useState(null),[le,pe]=q.useState(""),[we,be]=q.useState(t||"BUY"),[Fe,Ce]=q.useState(parseFloat(A)||0),[ve,Qe]=q.useState(parseFloat(r)||0),[Ue,ke]=q.useState("text-white"),[Je,We]=q.useState("text-white"),Te=q.useRef(parseFloat(A)||0),Ne=q.useRef(parseFloat(r)||0);q.useEffect(()=>{if(!i)return;const Me=Qn.getSocket(),ge=Ie=>{if(!(!Ie||!Ie.symbol)&&Ie.symbol.toUpperCase()===m?.toUpperCase()){const Se=parseFloat(Ie.bid)||0,He=parseFloat(Ie.ask)||0;Se>0&&(Se>Te.current?(ke("text-green-400"),setTimeout(()=>ke("text-white"),500)):Se<Te.current&&Te.current>0&&(ke("text-red-400"),setTimeout(()=>ke("text-white"),500)),Ce(Se),Te.current=Se),He>0&&(He>Ne.current?(We("text-green-400"),setTimeout(()=>We("text-white"),500)):He<Ne.current&&Ne.current>0&&(We("text-red-400"),setTimeout(()=>We("text-white"),500)),Qe(He),Ne.current=He)}};Me.on("priceUpdate",ge);const De=T.find(Ie=>Ie.symbol===m);if(De){const Ie=parseFloat(De.bid)||0,Se=parseFloat(De.ask)||0;Ie>0&&(Ce(Ie),Te.current=Ie),Se>0&&(Qe(Se),Ne.current=Se)}return()=>{Me.off("priceUpdate",ge)}},[i,m,T]),q.useEffect(()=>{if(i){ie(o?String(o):"0.01"),K(""),re(""),J(""),pe(""),be(t||"BUY");const Me=parseFloat(A)||0,ge=parseFloat(r)||0;Me>0&&(Ce(Me),Te.current=Me),ge>0&&(Qe(ge),Ne.current=ge)}},[i,t,A,r,o]);const ye=Fe||0,de=ve||0,_e=Me=>{const ge=parseFloat(z)||.01,De=Math.max(.01,ge+Me);ie(De.toFixed(2))},je=Me=>{const ge=parseFloat(G)||0,De=parseFloat(we==="BUY"?ve:Fe)||0;if(!De){pe("Current price not available. Please wait...");return}let Ie=ge+Me;we==="BUY"?Ie=Math.max(1e-5,Math.min(Ie,De-1e-5)):Ie=Math.max(De+1e-5,Ie),K(Ie>0?Ie.toFixed(5):""),pe("")},At=Me=>{const ge=parseFloat(Ae)||0,De=parseFloat(we==="BUY"?ve:Fe)||0;if(!De){pe("Current price not available. Please wait...");return}let Ie=ge+Me;we==="BUY"?Ie=Math.max(De+1e-5,Ie):Ie=Math.max(1e-5,Math.min(Ie,De-1e-5)),re(Ie>0?Ie.toFixed(5):""),pe("")},rt=async Me=>{pe("");const ge=Me||we,De=parseFloat(ge==="BUY"?ve:Fe),Ie=parseFloat(z),Se=G?parseFloat(G):null,He=Ae?parseFloat(Ae):null;if(!Ie||Ie<=0||isNaN(Ie)){pe("Please enter a valid volume (minimum 0.01)");return}if(Ie<.01){pe("Volume must be at least 0.01");return}if(!De||De<=0||isNaN(De)){pe("Invalid price. Please refresh and try again.");return}if(Se!==null&&Se!==""){if(isNaN(Se)||Se<=0){pe("Stop Loss must be a valid positive number");return}if(ge==="BUY"&&Se>=De){pe("Stop Loss must be below the current price for BUY orders");return}if(ge==="SELL"&&Se<=De){pe("Stop Loss must be above the current price for SELL orders");return}}if(He!==null&&He!==""){if(isNaN(He)||He<=0){pe("Take Profit must be a valid positive number");return}if(ge==="BUY"){if(He<=De){pe(`Take Profit must be above the entry price (${De.toFixed(5)}) for BUY orders`);return}}else if(ge==="SELL"&&He>=De){pe(`Take Profit must be below the entry price (${De.toFixed(5)}) for SELL orders`);return}}be(ge),se(ge),ae(!0);const Ke=new Date,tt=Ke.toLocaleTimeString(),Ve=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,et=localStorage.getItem("token")??localStorage.getItem("authToken");if(!et){pe("Please login to place trades"),ae(!1),se(null);return}const ct={accountId:s,symbol:m,type:ge,volume:Ie,price:De,takeProfit:He,stopLoss:Se,comment:he.trim()||null},yt={ticket:Ve.substring(0,8),symbol:m,type:ge,volume:parseFloat(Ie),price:parseFloat(De),time:tt,stopLoss:Se?parseFloat(Se):null,takeProfit:He?parseFloat(He):null,swap:0,profit:0,profitCurrency:"USD",comment:he.trim()||"",id:Ve,status:"OPEN",openAt:Ke.toISOString()};if(!l&&v&&v(Et=>[...Et,yt]),c&&!n){pe("Execution handler is required in forceParentExecution mode"),ae(!1),se(null);return}if(n){ae(!1),se(null),e();const Et={symbol:m,type:ge,lotSize:Ie,entryPrice:De,stopLoss:Se,takeProfit:He,comment:he.trim()||null};Promise.resolve(n(Et)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(Ge=>{console.error("❌ Trade execution failed:",Ge),!l&&v&&v(Lt=>Lt.filter(Bt=>Bt.id!==Ve))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),ae(!1),se(null);return}ae(!1),se(null),e();const Et=F||Dm?.VITE_BASE_URL||"http://localhost:8000",Ge=E?.trades||"/api/trades";ht.post(`${Et}${Ge}`,ct,{headers:{Authorization:`Bearer ${et}`,"Content-Type":"application/json"}}).then(Lt=>{if(Lt.data&&Lt.data.data){const Bt=Lt.data.data.trade;!l&&v&&v(Wt=>Wt.map(Zt=>Zt.id===Ve?{...Zt,id:Bt.id,ticket:Bt.id.substring(0,8),time:tt,openAt:Bt.openAt}:Zt)),console.log("✅ Trade saved successfully:",Bt),window.notify&&window.notify(`Trade placed successfully: ${Bt.symbol} ${Bt.type}`,"success")}else{!l&&v&&v(Wt=>Wt.filter(Zt=>Zt.id!==Ve));const Bt=Lt.data?.message||"Failed to place trade";window.notify&&window.notify(Bt,"error")}}).catch(Lt=>{console.error("Error placing trade:",Lt),!l&&v&&v(Wt=>Wt.filter(Zt=>Zt.id!==Ve));let Bt="Failed to place trade";if(Lt.response){const Wt=Lt.response.status,Zt=Lt.response.data;Wt===400?Bt=Zt?.message||"Invalid trade data. Please check your inputs.":Wt===401?Bt="Authentication failed. Please login again.":Wt===404?Bt=Zt?.message||"Symbol not found. Please select a valid symbol.":Wt===500?Bt="Server error. Please try again later.":Bt=Zt?.message||`Error: ${Wt}`}else Lt.request&&(Bt="Network error. Please check your internet connection.");window.notify&&window.notify(Bt,"error")})}},kt=(M?.calculateVolumeUnits?.({symbol:m,volume:parseFloat(z)||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 ${k?"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 ${k?"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 ${k?"text-slate-800":"text-white"}`,children:"Market Execution"}),a.jsx("button",{className:`p-0.5 transition-colors ${k?"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 ${k?"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:[le&&a.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:le}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("label",{className:`text-sm font-medium ${k?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${k?"text-slate-700":"text-white"}`,children:[kt," ",m]})]}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>_e(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),a.jsx("input",{type:"number",value:z,onChange:Me=>{const ge=Me.target.value;(ge===""||/^\d*\.?\d{0,2}$/.test(ge))&&(ie(ge),pe(""))},onBlur:()=>{const Me=parseFloat(z);ie(isNaN(Me)||Me<.01?"0.01":Me.toFixed(2))},className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-white"}`,step:"0.01",min:"0.01",placeholder:"0.01"}),a.jsx("button",{type:"button",onClick:()=>_e(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),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 ${k?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>je(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease SL",children:"−"}),a.jsx("input",{type:"text",value:G,onChange:Me=>{const ge=Me.target.value;(ge===""||/^\d*\.?\d*$/.test(ge))&&(K(ge),pe(""))},onBlur:Me=>{const ge=parseFloat(Me.target.value);!isNaN(ge)&&ge>0?K(ge.toFixed(5)):Me.target.value===""&&K("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>je(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase 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 ${k?"text-slate-700":"text-white"}`,children:"Take Profit"})}),a.jsxs("div",{className:"relative flex items-center",children:[a.jsx("button",{type:"button",onClick:()=>At(-1e-4),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Decrease TP",children:"−"}),a.jsx("input",{type:"text",value:Ae,onChange:Me=>{const ge=Me.target.value;(ge===""||/^\d*\.?\d*$/.test(ge))&&(re(ge),pe(""))},onBlur:Me=>{const ge=parseFloat(Me.target.value);!isNaN(ge)&&ge>0?re(ge.toFixed(5)):Me.target.value===""&&re("")},placeholder:"0.00000",className:`w-full px-10 py-2 rounded text-sm focus:outline-none focus:border-secondary text-center ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`}),a.jsx("button",{type:"button",onClick:()=>At(1e-4),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${k?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,title:"Increase TP",children:"+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:`block text-sm font-medium mb-2 ${k?"text-slate-700":"text-white"}`,children:"Comment"}),a.jsx("textarea",{value:he,onChange:Me=>J(Me.target.value),placeholder:"Optional comment",rows:2,className:`w-full px-3 py-2 rounded text-sm focus:outline-none focus:border-secondary resize-none ${k?"bg-white border border-slate-400 text-slate-800":"bg-[#12161d] border border-slate-700 text-slate-100"}`})]}),a.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${k?"border-slate-400":"border-slate-700"}`,children:[a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:k?"text-slate-700":"text-white",children:"Bid: "}),a.jsx("span",{className:`${Ue} font-medium transition-colors duration-400`,children:ye>0?ye.toFixed(5):"---"})]}),a.jsxs("div",{className:"text-sm",children:[a.jsx("span",{className:k?"text-slate-700":"text-white",children:"Ask: "}),a.jsx("span",{className:`${Je} font-medium transition-colors duration-400`,children:de>0?de.toFixed(5):"---"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[a.jsx("button",{onClick:()=>rt("SELL"),disabled:ee,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:ee&&ce==="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:()=>rt("BUY"),disabled:ee,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:ee&&ce==="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},_m={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"},Pm=[10,11,12,14,16,20,24,28,30,40],Sn=[{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"}],GA={width:"78%",height:"78%",display:"block"},Eh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function km(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 SA(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 Nm=()=>a.jsx(Mm,{style:GA}),Om=()=>a.jsx(Hm,{style:GA}),Km=()=>a.jsx(Um,{style:GA}),Vm=()=>a.jsx(Lm,{style:GA}),zm=()=>a.jsx(Qm,{style:GA}),Wm=()=>a.jsx(bm,{style:GA}),Rm=()=>a.jsx(Fm,{style:GA}),Gm=()=>a.jsx(Fh,{style:GA}),Vo=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function ur({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(Vo,{size:"18px",children:r})})}function Ze({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:Eh}),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 Mt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=SA(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:u=>e(u.target.value),disabled:A,style:{...Eh,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:u=>{const m=u.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(m?`#${m}`:"")},onBlur:t,disabled:A,style:c})]})}function hA({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 ui({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(Gm,{})})]})}function $m({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===Sn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:Sn.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(Ze,{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:Sn.map(s=>a.jsx(Ze,{checked:(i.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Xm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,SA(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(Mt,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(ui,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Pm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(ur,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(Km,{})}),a.jsx(ur,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(Vm,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(ur,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(zm,{})}),a.jsx(ur,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(Wm,{})}),a.jsx(ur,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(Rm,{})})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[a.jsx(Ze,{checked:!!i.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ze,{checked:!!i.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),a.jsx(Mt,{value:i.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>r("borderColor",i.borderColor,"#5f8f96"),disabled:!i.borderEnabled,tokens:t}),a.jsx(hA,{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(Ze,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Mt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(hA,{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 En({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{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(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{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(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(Ze,{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(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ze,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Jm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{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(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(Ze,{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(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t})]})]})]})]})}function Zm({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(Ze,{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(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsBarsRange,onChange:n=>A("statsBarsRange",n),label:"Bars range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDateRange,onChange:n=>A("statsDateRange",n),label:"Date range",tokens:t}),a.jsx(Ze,{checked:!!i.statsAngle,onChange:n=>A("statsAngle",n),label:"Angle",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function Ym({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(hA,{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 di(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 pi({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:di(i.point1Time),style:n}),a.jsx(hA,{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:di(i.point2Time),style:n}),a.jsx(hA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function Lh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,SA(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(Mt,{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(Ze,{checked:i.showPrice!==!1,onChange:s=>A("showPrice",s),label:"Show price",tokens:t}),a.jsx("div",{}),a.jsx("div",{}),a.jsx(Ze,{checked:!!i.showText,onChange:s=>A("showText",s),label:"Show text",tokens:t}),a.jsx(Mt,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(ui,{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(ui,{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 qm({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(hA,{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 jm({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:di(i.originTime),style:r}),a.jsx(hA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function ew({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function tw({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:di(i.rawTime),style:t})]})})}function Aw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{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(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{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(Mt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(ui,{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(Ze,{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(Ze,{checked:!!i.statsPriceRange,onChange:n=>A("statsPriceRange",n),label:"Price range",tokens:t}),a.jsx(Ze,{checked:!!i.statsDistance,onChange:n=>A("statsDistance",n),label:"Distance",tokens:t})]})]})]})]})}function iw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{checked:!!i.showTime,onChange:n=>A("showTime",n),label:"Show time",tokens:t}),a.jsx(Ze,{checked:!!i.showPrice,onChange:n=>A("showPrice",n),label:"Show price",tokens:t}),a.jsx("div",{})]})]})}function rw({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:di(i.rawTime),style:r}),a.jsx(hA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Mh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,SA(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(Mt,{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(Ze,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Mt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(hA,{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(Ze,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Mt,{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(Ze,{checked:!!i.rayLeft,onChange:n=>A("rayLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{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(Ze,{checked:!!i.arrowLeft,onChange:n=>A("arrowLeft",n),label:"Left",tokens:t}),a.jsx(Ze,{checked:!!i.arrowRight,onChange:n=>A("arrowRight",n),label:"Right",tokens:t})]})]})}function Hh({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:di(i.point1Time),style:n}),a.jsx(hA,{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:di(i.point2Time),style:n}),a.jsx(hA,{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(hA,{tokens:t,value:i.point3Price??"",onChange:s=>A("point3Price",s.target.value)})]})]})}function nw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||Sn.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 Ih=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Dt(),s=km(r==="light"),[o,l]=q.useState("style"),[c,u]=q.useState({}),[m,y]=q.useState(null),v=q.useRef(null),T=q.useRef(null);q.useEffect(()=>{t&&(u(nw(t)),l("style"))},[t]),q.useEffect(()=>{i||y(null)},[i]);const C=M=>{if(M.button!==0)return;M.preventDefault();const z=v.current;if(!z)return;const ie=z.offsetParent,G=ie?ie.getBoundingClientRect():{left:0,top:0},K=z.getBoundingClientRect(),Ae=K.left-G.left,re=K.top-G.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:Ae,startY:re},y({x:Ae,y:re});const he=ee=>{const{startMX:ae,startMY:ce,startX:se,startY:le}=T.current;y({x:se+ee.clientX-ae,y:le+ee.clientY-ce})},J=()=>{T.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",J)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",J)};if(!i||!t)return null;const U=_m[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx($m,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(Xm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ym,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(En,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(qm,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(Lh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(jm,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(ew,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(tw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(Zm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(Jm,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(En,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(En,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(En,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(iw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(rw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(Aw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(pi,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Mh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Hh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Mh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Hh,{draft:c,setDraft:u,tokens:s})}return a.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},k=()=>{A(c),e()};return a.jsxs("div",{ref:v,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:C,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:U}),a.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:a.jsx(Vo,{size:"18px",children:a.jsx(Nm,{})})})]})}),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(Vo,{size:"20px",children:a.jsx(Om,{})})})]}),a.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:F.map(M=>{const z=o===M;return a.jsxs("button",{type:"button",onClick:()=>l(M),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:[M.charAt(0).toUpperCase()+M.slice(1),z&&a.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},M)})}),a.jsx("div",{style:{flex:1,overflow:"auto"},children:E()}),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:k,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 zo=function(i,e){return zo=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])},zo(i,e)};function yA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zo(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Wo=function(){return Wo=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},Wo.apply(this,arguments)};function Xt(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(u){try{c(A.next(u))}catch(m){s(m)}}function l(u){try{c(A.throw(u))}catch(m){s(m)}}function c(u){u.done?n(u.value):r(u.value).then(o,l)}c((A=A.apply(i,[])).next())})}function Vt(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(u){return l([c,u])}}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(u){c=[6,u],r=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ln(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 NA=(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})(),Mn=function(i,e){return NA.fromClientRect(i,e.getBoundingClientRect())},sw=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 NA(0,0,A,r)},Hn=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},xt=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},Dh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ow=typeof Uint8Array>"u"?[]:new Uint8Array(256),In=0;In<Dh.length;In++)ow[Dh.charCodeAt(In)]=In;for(var _h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Dn=0;Dn<_h.length;Dn++)dr[_h.charCodeAt(Dn)]=Dn;for(var aw=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),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=dr[i.charCodeAt(A)],s=dr[i.charCodeAt(A+1)],o=dr[i.charCodeAt(A+2)],l=dr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},lw=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},cw=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},fi=5,Ro=11,Go=2,hw=Ro-fi,Ph=65536>>fi,uw=1<<fi,$o=uw-1,dw=1024>>fi,pw=Ph+dw,fw=pw,gw=32,mw=fw+gw,ww=65536>>Ro,Bw=1<<hw,yw=Bw-1,kh=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Cw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},vw=function(i,e){var t=aw(i),A=Array.isArray(t)?cw(t):new Uint32Array(t),r=Array.isArray(t)?lw(t):new Uint16Array(t),n=24,s=kh(r,n/2,A[4]/2),o=A[5]===2?kh(r,(n+A[4])/2):Cw(A,Math.ceil((n+A[4])/4));return new Tw(A[0],A[1],A[2],A[3],s,o)},Tw=(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>>fi],t=(t<<Go)+(e&$o),this.data[t];if(e<=65535)return t=this.index[Ph+(e-55296>>fi)],t=(t<<Go)+(e&$o),this.data[t];if(e<this.highStart)return t=mw-ww+(e>>Ro),t=this.index[t],t+=e>>fi&yw,t=this.index[t],t=(t<<Go)+(e&$o),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Nh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xw=typeof Uint8Array>"u"?[]:new Uint8Array(256),_n=0;_n<Nh.length;_n++)xw[Nh.charCodeAt(_n)]=_n;var bw="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==",Oh=50,Qw=1,Kh=2,Vh=3,Fw=4,Uw=5,zh=7,Wh=8,Rh=9,$A=10,Xo=11,Gh=12,Jo=13,Sw=14,pr=15,Zo=16,Pn=17,fr=18,Ew=19,$h=20,Yo=21,gr=22,qo=23,Ei=24,oA=25,mr=26,wr=27,Li=28,Lw=29,gi=30,Mw=31,kn=32,Nn=33,jo=34,ea=35,ta=36,Br=37,Aa=38,On=39,Kn=40,ia=41,Xh=42,Hw=43,Iw=[9001,65288],Jh="!",nt="×",Vn="÷",ra=vw(bw),OA=[gi,ta],na=[Qw,Kh,Vh,Uw],Zh=[$A,Wh],Yh=[wr,mr],Dw=na.concat(Zh),qh=[Aa,On,Kn,jo,ea],_w=[pr,Jo],Pw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ra.get(n);if(o>Oh?(r.push(!0),o-=Oh):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(Zo);if(o===Fw||o===Xo){if(s===0)return A.push(s),t.push(gi);var l=t[s-1];return Dw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(gi))}if(A.push(s),o===Mw)return t.push(e==="strict"?Yo:Br);if(o===Xh||o===Lw)return t.push(gi);if(o===Hw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Br):t.push(gi);t.push(o)}),[A,t,r]},sa=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!==$A)break}if(r===$A)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!==$A)break}if(o!==$A)break}return!1},jh=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===$A)t--;else return A}return 0},kw=function(i,e,t,A,r){if(t[A]===0)return nt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return nt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===Kh&&u===Vh)return nt;if(na.indexOf(l)!==-1)return Jh;if(na.indexOf(u)!==-1||Zh.indexOf(u)!==-1)return nt;if(jh(n,e)===Wh)return Vn;if(ra.get(i[n])===Xo||(l===kn||l===Nn)&&ra.get(i[o])===Xo||l===zh||u===zh||l===Rh||[$A,Jo,pr].indexOf(l)===-1&&u===Rh||[Pn,fr,Ew,Ei,Li].indexOf(u)!==-1||jh(n,e)===gr||sa(qo,gr,n,e)||sa([Pn,fr],Yo,n,e)||sa(Gh,Gh,n,e))return nt;if(l===$A)return Vn;if(l===qo||u===qo)return nt;if(u===Zo||l===Zo)return Vn;if([Jo,pr,Yo].indexOf(u)!==-1||l===Sw||c===ta&&_w.indexOf(l)!==-1||l===Li&&u===ta||u===$h||OA.indexOf(u)!==-1&&l===oA||OA.indexOf(l)!==-1&&u===oA||l===wr&&[Br,kn,Nn].indexOf(u)!==-1||[Br,kn,Nn].indexOf(l)!==-1&&u===mr||OA.indexOf(l)!==-1&&Yh.indexOf(u)!==-1||Yh.indexOf(l)!==-1&&OA.indexOf(u)!==-1||[wr,mr].indexOf(l)!==-1&&(u===oA||[gr,pr].indexOf(u)!==-1&&e[o+1]===oA)||[gr,pr].indexOf(l)!==-1&&u===oA||l===oA&&[oA,Li,Ei].indexOf(u)!==-1)return nt;if([oA,Li,Ei,Pn,fr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===oA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if([wr,mr].indexOf(u)!==-1)for(var m=[Pn,fr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===oA)return nt;if([Li,Ei].indexOf(y)!==-1)m--;else break}if(Aa===l&&[Aa,On,jo,ea].indexOf(u)!==-1||[On,jo].indexOf(l)!==-1&&[On,Kn].indexOf(u)!==-1||[Kn,ea].indexOf(l)!==-1&&u===Kn||qh.indexOf(l)!==-1&&[$h,mr].indexOf(u)!==-1||qh.indexOf(u)!==-1&&l===wr||OA.indexOf(l)!==-1&&OA.indexOf(u)!==-1||l===Ei&&OA.indexOf(u)!==-1||OA.concat(oA).indexOf(l)!==-1&&u===gr&&Iw.indexOf(i[o])===-1||OA.concat(oA).indexOf(u)!==-1&&l===fr)return nt;if(l===ia&&u===ia){for(var v=t[n],T=1;v>0&&(v--,e[v]===ia);)T++;if(T%2!==0)return nt}return l===kn&&u===Nn?nt:Vn},Nw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Pw(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[oA,gi,Xh].indexOf(o)!==-1?Br: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]},Ow=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===Jh,this.start=A,this.end=r}return i.prototype.slice=function(){return xt.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),Kw=function(i,e){var t=Hn(i),A=Nw(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 u=nt;c<o&&(u=kw(t,n,r,++c,s))===nt;);if(u!==nt||c===o){var m=new Ow(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},Vw=1,zw=2,yr=4,eu=8,zn=10,tu=47,Cr=92,Ww=9,Rw=32,Wn=34,vr=61,Gw=35,$w=36,Xw=37,Rn=39,Gn=40,Tr=41,Jw=95,tA=45,Zw=33,Yw=60,qw=62,jw=64,eB=91,tB=93,AB=61,iB=123,$n=63,rB=125,Au=124,nB=126,sB=128,iu=65533,oa=42,mi=43,oB=44,aB=58,lB=59,xr=46,cB=0,hB=8,uB=11,dB=14,pB=31,fB=127,EA=-1,ru=48,nu=97,su=101,gB=102,mB=117,wB=122,ou=65,au=69,lu=70,BB=85,yB=90,zt=function(i){return i>=ru&&i<=57},CB=function(i){return i>=55296&&i<=57343},Mi=function(i){return zt(i)||i>=ou&&i<=lu||i>=nu&&i<=gB},vB=function(i){return i>=nu&&i<=wB},TB=function(i){return i>=ou&&i<=yB},xB=function(i){return vB(i)||TB(i)},bB=function(i){return i>=sB},Xn=function(i){return i===zn||i===Ww||i===Rw},Jn=function(i){return xB(i)||bB(i)||i===Jw},cu=function(i){return Jn(i)||zt(i)||i===tA},QB=function(i){return i>=cB&&i<=hB||i===uB||i>=dB&&i<=pB||i===fB},XA=function(i,e){return i!==Cr?!1:e!==zn},Zn=function(i,e,t){return i===tA?Jn(e)||XA(e,t):Jn(i)?!0:!!(i===Cr&&XA(i,e))},aa=function(i,e,t){return i===mi||i===tA?zt(e)?!0:e===xr&&zt(t):zt(i===xr?e:i)},FB=function(i){var e=0,t=1;(i[e]===mi||i[e]===tA)&&(i[e]===tA&&(t=-1),e++);for(var A=[];zt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(xt.apply(void 0,A),10):0;i[e]===xr&&e++;for(var n=[];zt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(xt.apply(void 0,n),10):0;(i[e]===au||i[e]===su)&&e++;var l=1;(i[e]===mi||i[e]===tA)&&(i[e]===tA&&(l=-1),e++);for(var c=[];zt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(xt.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},UB={type:2},SB={type:3},EB={type:4},LB={type:13},MB={type:8},HB={type:21},IB={type:9},DB={type:10},_B={type:11},PB={type:12},kB={type:14},Yn={type:23},NB={type:1},OB={type:25},KB={type:24},VB={type:26},zB={type:27},WB={type:28},RB={type:29},GB={type:31},la={type:32},hu=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat(Hn(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==la;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Wn:return this.consumeStringToken(Wn);case Gw:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(cu(t)||XA(A,r)){var n=Zn(t,A,r)?zw:Vw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case $w:if(this.peekCodePoint(0)===vr)return this.consumeCodePoint(),LB;break;case Rn:return this.consumeStringToken(Rn);case Gn:return UB;case Tr:return SB;case oa:if(this.peekCodePoint(0)===vr)return this.consumeCodePoint(),kB;break;case mi:if(aa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case oB:return EB;case tA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(aa(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Zn(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===tA&&c===qw)return this.consumeCodePoint(),this.consumeCodePoint(),KB;break;case xr:if(aa(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case tu:if(this.peekCodePoint(0)===oa)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===oa&&(u=this.consumeCodePoint(),u===tu))return this.consumeToken();if(u===EA)return this.consumeToken()}break;case aB:return VB;case lB:return zB;case Yw:if(this.peekCodePoint(0)===Zw&&this.peekCodePoint(1)===tA&&this.peekCodePoint(2)===tA)return this.consumeCodePoint(),this.consumeCodePoint(),OB;break;case jw:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(Zn(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case eB:return WB;case Cr:if(XA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case tB:return RB;case AB:if(this.peekCodePoint(0)===vr)return this.consumeCodePoint(),MB;break;case iB:return _B;case rB:return PB;case mB:case BB:var T=this.peekCodePoint(0),C=this.peekCodePoint(1);return T===mi&&(Mi(C)||C===$n)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Au:if(this.peekCodePoint(0)===vr)return this.consumeCodePoint(),IB;if(this.peekCodePoint(0)===Au)return this.consumeCodePoint(),HB;break;case nB:if(this.peekCodePoint(0)===vr)return this.consumeCodePoint(),DB;break;case EA:return la}return Xn(e)?(this.consumeWhiteSpace(),GB):zt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Jn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:xt(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();Mi(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===$n&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(xt.apply(void 0,e.map(function(l){return l===$n?ru:l})),16),n=parseInt(xt.apply(void 0,e.map(function(l){return l===$n?lu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(xt.apply(void 0,e),16);if(this.peekCodePoint(0)===tA&&Mi(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Mi(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(xt.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)===Gn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Gn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===EA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===Rn||t===Wn){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===EA||this.peekCodePoint(0)===Tr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),Yn)}for(;;){var r=this.consumeCodePoint();if(r===EA||r===Tr)return{type:22,value:xt.apply(void 0,e)};if(Xn(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===EA||this.peekCodePoint(0)===Tr?(this.consumeCodePoint(),{type:22,value:xt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Yn);if(r===Wn||r===Rn||r===Gn||QB(r))return this.consumeBadUrlRemnants(),Yn;if(r===Cr)if(XA(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Yn;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;Xn(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Tr||e===EA)return;XA(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+=xt.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===EA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===zn)return this._value.splice(0,A),NB;if(r===Cr){var n=this._value[A+1];n!==EA&&n!==void 0&&(n===zn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):XA(r,n)&&(t+=this.consumeStringSlice(A),t+=xt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=yr,A=this.peekCodePoint(0);for((A===mi||A===tA)&&e.push(this.consumeCodePoint());zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===xr&&zt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=eu;zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===au||A===su)&&((r===mi||r===tA)&&zt(n)||zt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=eu;zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[FB(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(Zn(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===Xw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Mi(e)){for(var t=xt(e);Mi(this.peekCodePoint(0))&&t.length<6;)t+=xt(this.consumeCodePoint());Xn(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||CB(A)||A>1114111?iu:A}return e===EA?iu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(cu(t))e+=xt(t);else if(XA(t,this.peekCodePoint(0)))e+=xt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),uu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new hu;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||XB(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"?la:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),br=function(i){return i.type===15},Hi=function(i){return i.type===17},ut=function(i){return i.type===20},$B=function(i){return i.type===0},ca=function(i,e){return ut(i)&&i.value===e},du=function(i){return i.type!==31},Ii=function(i){return i.type!==31&&i.type!==4},LA=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},XB=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},JA=function(i){return i.type===17||i.type===15},Ut=function(i){return i.type===16||JA(i)},pu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},_t={type:17,number:0,flags:yr},ha={type:16,number:50,flags:yr},ZA={type:16,number:100,flags:yr},Qr=function(i,e,t){var A=i[0],r=i[1];return[ft(A,e),ft(typeof r<"u"?r:A,t)]},ft=function(i,e){if(i.type===16)return i.number/100*e;if(br(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},fu="deg",gu="grad",mu="rad",wu="turn",qn={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case fu:return Math.PI*e.number/180;case gu:return Math.PI/200*e.number;case mu:return e.number;case wu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Bu=function(i){return i.type===15&&(i.unit===fu||i.unit===gu||i.unit===mu||i.unit===wu)},yu=function(i){var e=i.filter(ut).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[_t,_t];case"to top":case"bottom":return uA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[_t,ZA];case"to right":case"left":return uA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ZA,ZA];case"to bottom":case"top":return uA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ZA,_t];case"to left":case"right":return uA(270)}return 0},uA=function(i){return Math.PI*i/180},YA={name:"color",parse:function(i,e){if(e.type===18){var t=JB[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 jA(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 jA(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 jA(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 jA(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=KA[e.value.toUpperCase()];if(typeof o<"u")return o}return KA.TRANSPARENT}},qA=function(i){return(255&i)===0},Ht=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+")"},jA=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Cu=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},vu=function(i,e){var t=e.filter(Ii);if(t.length===3){var A=t.map(Cu),r=A[0],n=A[1],s=A[2];return jA(r,n,s,1)}if(t.length===4){var o=t.map(Cu),r=o[0],n=o[1],s=o[2],l=o[3];return jA(r,n,s,l)}return 0};function ua(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 Tu=function(i,e){var t=e.filter(Ii),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?uA(A.number):qn.parse(i,A))/(Math.PI*2),l=Ut(r)?r.number/100:0,c=Ut(n)?n.number/100:0,u=typeof s<"u"&&Ut(s)?ft(s,1):1;if(l===0)return jA(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=ua(y,m,o+1/3),T=ua(y,m,o),C=ua(y,m,o-1/3);return jA(v*255,T*255,C*255,u)},JB={hsl:Tu,hsla:Tu,rgb:vu,rgba:vu},Fr=function(i,e){return YA.parse(i,uu.create(e).parseComponentValue())},KA={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},ZB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},YB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},jn=function(i,e){var t=YA.parse(i,e[0]),A=e[1];return A&&Ut(A)?{color:t,stop:A}:{color:t,stop:null}},xu=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=_t),A.stop===null&&(A.stop=ZA);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=ft(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 u=r[s];if(u===null)c===null&&(c=s);else if(c!==null){for(var m=s-c,y=r[c-1],v=(u-y)/(m+1),T=1;T<=m;T++)r[c+T-1]=v*T;c=null}}return i.map(function(C,U){var F=C.color;return{color:F,stop:Math.max(Math.min(1,r[U]/e),0)}})},qB=function(i,e,t){var A=e/2,r=t/2,n=ft(i[0],e)-A,s=r-ft(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},jB=function(i,e,t){var A=typeof i=="number"?i:qB(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]},CA=function(i,e){return Math.sqrt(i*i+e*e)},bu=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],u=CA(t-l,A-c);return(r?u<s.optimumDistance:u>s.optimumDistance)?{optimumCorner:o,optimumDistance:u}:s},{optimumDistance:r?1/0:-1/0,optimumCorner:null}).optimumCorner},e2=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(CA(e,t),CA(e,t-r),CA(e-A,t),CA(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=bu(A,r,e,t,!0),c=l[0],u=l[1];n=CA(c-e,(u-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(CA(e,t),CA(e,t-r),CA(e-A,t),CA(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)),m=bu(A,r,e,t,!1),c=m[0],u=m[1];n=CA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=ft(i.size[0],A),s=i.size.length===2?ft(i.size[1],r):n),[n,s]},t2=function(i,e){var t=uA(180),A=[];return LA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=yu(r);return}else if(Bu(s)){t=qn.parse(i,s);return}}var o=jn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},es=function(i,e){var t=uA(180),A=[];return LA(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=yu(r);return}else if(Bu(s)){t=(qn.parse(i,s)+uA(270))%uA(360);return}}var o=jn(i,r);A.push(o)}),{angle:t,stops:A,type:1}},A2=function(i,e){var t=uA(180),A=[],r=1,n=0,s=3,o=[];return LA(e).forEach(function(l,c){var u=l[0];if(c===0){if(ut(u)&&u.value==="linear"){r=1;return}else if(ut(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=YA.parse(i,u.values[0]);A.push({stop:_t,color:m})}else if(u.name==="to"){var m=YA.parse(i,u.values[0]);A.push({stop:ZA,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Ii);if(y.length===2){var m=YA.parse(i,y[1]),v=y[0];Hi(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+uA(180))%uA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},Qu="closest-side",Fu="farthest-side",Uu="closest-corner",Su="farthest-corner",Eu="circle",Lu="ellipse",Mu="cover",Hu="contain",i2=function(i,e){var t=0,A=3,r=[],n=[];return LA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(ut(y))switch(y.value){case"center":return n.push(ha),m;case"top":case"left":return n.push(_t),m;case"right":case"bottom":return n.push(ZA),m}else(Ut(y)||JA(y))&&n.push(y);else if(ut(y))switch(y.value){case Eu:return t=0,!1;case Lu:return t=1,!1;case"at":return c=!0,!1;case Qu:return A=0,!1;case Mu:case Fu:return A=1,!1;case Hu:case Uu:return A=2,!1;case Su:return A=3,!1}else if(JA(y)||Ut(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=jn(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},ts=function(i,e){var t=0,A=3,r=[],n=[];return LA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(ut(m))switch(m.value){case"center":return n.push(ha),!1;case"top":case"left":return n.push(_t),!1;case"right":case"bottom":return n.push(ZA),!1}else if(Ut(m)||JA(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(ut(m))switch(m.value){case Eu:return t=0,!1;case Lu:return t=1,!1;case Hu:case Qu:return A=0,!1;case Fu:return A=1,!1;case Uu:return A=2,!1;case Mu:case Su:return A=3,!1}else if(JA(m)||Ut(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=jn(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},r2=function(i){return i.type===1},n2=function(i){return i.type===2},da={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=Iu[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 s2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Iu[i.name])}var Iu={"linear-gradient":t2,"-moz-linear-gradient":es,"-ms-linear-gradient":es,"-o-linear-gradient":es,"-webkit-linear-gradient":es,"radial-gradient":i2,"-moz-radial-gradient":ts,"-ms-radial-gradient":ts,"-o-radial-gradient":ts,"-webkit-radial-gradient":ts,"-webkit-gradient":A2},o2={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 Ii(A)&&s2(A)}).map(function(A){return da.parse(i,A)})}},a2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(ut(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},l2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return LA(e).map(function(t){return t.filter(Ut)}).map(pu)}},c2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return LA(e).map(function(t){return t.filter(ut).map(function(A){return A.value}).join(" ")}).map(h2)}},h2=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}},Di;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Di||(Di={}));var u2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return LA(e).map(function(t){return t.filter(d2)})}},d2=function(i){return ut(i)||Ut(i)},As=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},p2=As("top"),f2=As("right"),g2=As("bottom"),m2=As("left"),is=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return pu(t.filter(Ut))}}},w2=is("top-left"),B2=is("top-right"),y2=is("bottom-right"),C2=is("bottom-left"),rs=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}}},v2=rs("top"),T2=rs("right"),x2=rs("bottom"),b2=rs("left"),ns=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return br(t)?t.number:0}}},Q2=ns("top"),F2=ns("right"),U2=ns("bottom"),S2=ns("left"),E2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},L2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},M2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).reduce(function(t,A){return t|H2(A.value)},0)}},H2=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},I2={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}},D2={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}},ss;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ss||(ss={}));var _2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ss.STRICT:ss.NORMAL}},P2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Du=function(i,e){return ut(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Ut(i)?ft(i,e):e},k2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:da.parse(i,e)}},N2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},pa={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}}},os=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},O2=os("top"),K2=os("right"),V2=os("bottom"),z2=os("left"),W2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).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}})}},R2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},as=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},G2=as("top"),$2=as("right"),X2=as("bottom"),J2=as("left"),Z2={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}}},Y2={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}},q2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&ca(e[0],"none")?[]:LA(e).map(function(t){for(var A={color:KA.TRANSPARENT,offsetX:_t,offsetY:_t,blur:_t},r=0,n=0;n<t.length;n++){var s=t[n];JA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=YA.parse(i,s)}return A})}},j2={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}},ey={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=iy[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},ty=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Ay=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},iy={matrix:ty,matrix3d:Ay},_u={type:16,number:50,flags:yr},ry=[_u,_u],ny={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Ut);return t.length!==2?ry:[t[0],t[1]]}},sy={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}}},Ur;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Ur||(Ur={}));for(var oy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Ur.BREAK_ALL;case"keep-all":return Ur.KEEP_ALL;default:return Ur.NORMAL}}},ay={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if(Hi(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Pu={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")}},ly={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:1}},cy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},hy={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(ut).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})}},uy={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+"'"})}},dy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},py={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return Hi(e)?e.number:ut(e)&&e.value==="bold"?700:400}},fy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(ut).map(function(t){return t.value})}},gy={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"}}},St=function(i,e){return(i&e)!==0},my={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}},wy={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(du),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&Hi(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},By={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(du),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(ut(n)&&n.value!=="none"){var o=s&&Hi(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},yy={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(br).map(function(t){return Pu.parse(i,t)})}},Cy={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($B);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}},ku=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},vy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&ca(e[0],"none")?[]:LA(e).map(function(t){for(var A={color:255,offsetX:_t,offsetY:_t,blur:_t,spread:_t,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];ca(s,"inset")?A.inset=!0:JA(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=YA.parse(i,s)}return A})}},Ty={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(ut).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}},xy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},by={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return br(e)?e.number:0}},Qy=(function(){function i(e,t){var A,r;this.animationDuration=Oe(e,yy,t.animationDuration),this.backgroundClip=Oe(e,ZB,t.backgroundClip),this.backgroundColor=Oe(e,YB,t.backgroundColor),this.backgroundImage=Oe(e,o2,t.backgroundImage),this.backgroundOrigin=Oe(e,a2,t.backgroundOrigin),this.backgroundPosition=Oe(e,l2,t.backgroundPosition),this.backgroundRepeat=Oe(e,c2,t.backgroundRepeat),this.backgroundSize=Oe(e,u2,t.backgroundSize),this.borderTopColor=Oe(e,p2,t.borderTopColor),this.borderRightColor=Oe(e,f2,t.borderRightColor),this.borderBottomColor=Oe(e,g2,t.borderBottomColor),this.borderLeftColor=Oe(e,m2,t.borderLeftColor),this.borderTopLeftRadius=Oe(e,w2,t.borderTopLeftRadius),this.borderTopRightRadius=Oe(e,B2,t.borderTopRightRadius),this.borderBottomRightRadius=Oe(e,y2,t.borderBottomRightRadius),this.borderBottomLeftRadius=Oe(e,C2,t.borderBottomLeftRadius),this.borderTopStyle=Oe(e,v2,t.borderTopStyle),this.borderRightStyle=Oe(e,T2,t.borderRightStyle),this.borderBottomStyle=Oe(e,x2,t.borderBottomStyle),this.borderLeftStyle=Oe(e,b2,t.borderLeftStyle),this.borderTopWidth=Oe(e,Q2,t.borderTopWidth),this.borderRightWidth=Oe(e,F2,t.borderRightWidth),this.borderBottomWidth=Oe(e,U2,t.borderBottomWidth),this.borderLeftWidth=Oe(e,S2,t.borderLeftWidth),this.boxShadow=Oe(e,vy,t.boxShadow),this.color=Oe(e,E2,t.color),this.direction=Oe(e,L2,t.direction),this.display=Oe(e,M2,t.display),this.float=Oe(e,I2,t.cssFloat),this.fontFamily=Oe(e,uy,t.fontFamily),this.fontSize=Oe(e,dy,t.fontSize),this.fontStyle=Oe(e,gy,t.fontStyle),this.fontVariant=Oe(e,fy,t.fontVariant),this.fontWeight=Oe(e,py,t.fontWeight),this.letterSpacing=Oe(e,D2,t.letterSpacing),this.lineBreak=Oe(e,_2,t.lineBreak),this.lineHeight=Oe(e,P2,t.lineHeight),this.listStyleImage=Oe(e,k2,t.listStyleImage),this.listStylePosition=Oe(e,N2,t.listStylePosition),this.listStyleType=Oe(e,pa,t.listStyleType),this.marginTop=Oe(e,O2,t.marginTop),this.marginRight=Oe(e,K2,t.marginRight),this.marginBottom=Oe(e,V2,t.marginBottom),this.marginLeft=Oe(e,z2,t.marginLeft),this.opacity=Oe(e,ly,t.opacity);var n=Oe(e,W2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Oe(e,R2,t.overflowWrap),this.paddingTop=Oe(e,G2,t.paddingTop),this.paddingRight=Oe(e,$2,t.paddingRight),this.paddingBottom=Oe(e,X2,t.paddingBottom),this.paddingLeft=Oe(e,J2,t.paddingLeft),this.paintOrder=Oe(e,Ty,t.paintOrder),this.position=Oe(e,Y2,t.position),this.textAlign=Oe(e,Z2,t.textAlign),this.textDecorationColor=Oe(e,cy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Oe(e,hy,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=Oe(e,q2,t.textShadow),this.textTransform=Oe(e,j2,t.textTransform),this.transform=Oe(e,ey,t.transform),this.transformOrigin=Oe(e,ny,t.transformOrigin),this.visibility=Oe(e,sy,t.visibility),this.webkitTextStrokeColor=Oe(e,xy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Oe(e,by,t.webkitTextStrokeWidth),this.wordBreak=Oe(e,oy,t.wordBreak),this.zIndex=Oe(e,ay,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return qA(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 St(this.display,4)||St(this.display,33554432)||St(this.display,268435456)||St(this.display,536870912)||St(this.display,67108864)||St(this.display,134217728)},i})(),Fy=(function(){function i(e,t){this.content=Oe(e,my,t.content),this.quotes=Oe(e,Cy,t.quotes)}return i})(),Nu=(function(){function i(e,t){this.counterIncrement=Oe(e,wy,t.counterIncrement),this.counterReset=Oe(e,By,t.counterReset)}return i})(),Oe=function(i,e,t){var A=new hu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new uu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,ut(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 qn.parse(i,n.parseComponentValue());case"color":return YA.parse(i,n.parseComponentValue());case"image":return da.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return JA(o)?o:_t;case"length-percentage":var l=n.parseComponentValue();return Ut(l)?l:_t;case"time":return Pu.parse(i,n.parseComponentValue())}break}},Uy="data-html2canvas-debug",Sy=function(i){var e=i.getAttribute(Uy);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},fa=function(i,e){var t=Sy(i);return t===1||e===t},MA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,fa(t,3))debugger;this.styles=new Qy(e,window.getComputedStyle(t,null)),Sa(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Mn(this.context,t),fa(t,4)&&(this.flags|=16)}return i})(),Ey="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sr=typeof Uint8Array>"u"?[]:new Uint8Array(256),ls=0;ls<Ou.length;ls++)Sr[Ou.charCodeAt(ls)]=ls;for(var Ly=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),u=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Sr[i.charCodeAt(A)],s=Sr[i.charCodeAt(A+1)],o=Sr[i.charCodeAt(A+2)],l=Sr[i.charCodeAt(A+3)],u[r++]=n<<2|s>>4,u[r++]=(s&15)<<4|o>>2,u[r++]=(o&3)<<6|l&63;return c},My=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Hy=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},wi=5,ga=11,ma=2,Iy=ga-wi,Ku=65536>>wi,Dy=1<<wi,wa=Dy-1,_y=1024>>wi,Py=Ku+_y,ky=Py,Ny=32,Oy=ky+Ny,Ky=65536>>ga,Vy=1<<Iy,zy=Vy-1,Vu=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Wy=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Ry=function(i,e){var t=Ly(i),A=Array.isArray(t)?Hy(t):new Uint32Array(t),r=Array.isArray(t)?My(t):new Uint16Array(t),n=24,s=Vu(r,n/2,A[4]/2),o=A[5]===2?Vu(r,(n+A[4])/2):Wy(A,Math.ceil((n+A[4])/4));return new Gy(A[0],A[1],A[2],A[3],s,o)},Gy=(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>>wi],t=(t<<ma)+(e&wa),this.data[t];if(e<=65535)return t=this.index[Ku+(e-55296>>wi)],t=(t<<ma)+(e&wa),this.data[t];if(e<this.highStart)return t=Oy-Ky+(e>>ga),t=this.index[t],t+=e>>wi&zy,t=this.index[t],t=(t<<ma)+(e&wa),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),zu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$y=typeof Uint8Array>"u"?[]:new Uint8Array(256),cs=0;cs<zu.length;cs++)$y[zu.charCodeAt(cs)]=cs;var Xy=1,Ba=2,ya=3,Wu=4,Ru=5,Jy=7,Gu=8,Ca=9,va=10,$u=11,Xu=12,Ju=13,Zu=14,Ta=15,Zy=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},Yy=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},qy=Ry(Ey),dA="×",xa="÷",jy=function(i){return qy.get(i)},eC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===Ba&&s===ya)return dA;if(n===Ba||n===ya||n===Wu||s===Ba||s===ya||s===Wu)return xa;if(n===Gu&&[Gu,Ca,$u,Xu].indexOf(s)!==-1||(n===$u||n===Ca)&&(s===Ca||s===va)||(n===Xu||n===va)&&s===va||s===Ju||s===Ru||s===Jy||n===Xy)return dA;if(n===Ju&&s===Zu){for(;r===Ru;)r=e[--A];if(r===Zu)return dA}if(n===Ta&&s===Ta){for(var o=0;r===Ta;)o++,r=e[--A];if(o%2===0)return dA}return xa},tC=function(i){var e=Zy(i),t=e.length,A=0,r=0,n=e.map(jy);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=dA;A<t&&(s=eC(e,n,++A))===dA;);if(s!==dA||A===t){var o=Yy.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},AC=function(i){for(var e=tC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},iC=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},rC=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"?"&#128104;".repeat(10):"";var A=e.firstChild,r=Hn(A.data).map(function(l){return xt(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var u=t.getBoundingClientRect();n+=l.length;var m=u.x>s.x||u.y>s.y;return s=u,c===0?!0:m});return i.body.removeChild(e),o},nC=function(){return typeof new Image().crossOrigin<"u"},sC=function(){return typeof new XMLHttpRequest().responseType=="string"},oC=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},Yu=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},aC=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=ba(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),qu(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",Yu(l)?qu(ba(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),Yu(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},ba=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},qu=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))})},Pt={get SUPPORT_RANGE_BOUNDS(){var i=iC(document);return Object.defineProperty(Pt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Pt.SUPPORT_RANGE_BOUNDS&&rC(document);return Object.defineProperty(Pt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=oC(document);return Object.defineProperty(Pt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?aC(document):Promise.resolve(!1);return Object.defineProperty(Pt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=nC();return Object.defineProperty(Pt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=sC();return Object.defineProperty(Pt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Pt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Pt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Er=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),lC=function(i,e,t,A){var r=uC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Pt.SUPPORT_RANGE_BOUNDS){var l=ju(A,s,o.length).getClientRects();if(l.length>1){var c=Qa(o),u=0;c.forEach(function(y){n.push(new Er(y,NA.fromDOMRectList(i,ju(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new Er(o,NA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Er(o,cC(i,A))),A=m}else Pt.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},cC=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=Mn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return NA.EMPTY},ju=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},Qa=function(i){if(Pt.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 AC(i)},hC=function(i,e){if(Pt.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 pC(i,e)},uC=function(i,e){return e.letterSpacing!==0?Qa(i):hC(i,e)},dC=[32,160,4961,65792,65793,4153,4241],pC=function(i,e){for(var t=Kw(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=Hn(s),l="";o.forEach(function(c){dC.indexOf(c)===-1?l+=xt(c):(l.length&&A.push(l),A.push(xt(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},fC=(function(){function i(e,t,A){this.text=gC(t.data,A.textTransform),this.textBounds=lC(e,this.text,A,t)}return i})(),gC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(mC,wC);case 2:return i.toUpperCase();default:return i}},mC=/(^|\s|:|-|\(|\))([a-z])/g,wC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},ed=(function(i){yA(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})(MA),td=(function(i){yA(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})(MA),Ad=(function(i){yA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Mn(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})(MA),id=(function(i){yA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(MA),Fa=(function(i){yA(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})(MA),BC=[{type:15,flags:0,unit:"px",number:3}],yC=[{type:16,flags:0,number:50}],CC=function(i){return i.width>i.height?new NA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new NA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},vC=function(i){var e=i.type===TC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},hs="checkbox",us="radio",TC="password",rd=707406591,Ua=(function(i){yA(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=vC(A),(r.type===hs||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=CC(r.bounds)),r.type){case hs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=BC;break;case us:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=yC;break}return r}return e})(MA),nd=(function(i){yA(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})(MA),sd=(function(i){yA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(MA),od=(function(i){yA(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=ld(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Fr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):KA.TRANSPARENT,s=A.contentWindow.document.body?Fr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):KA.TRANSPARENT;r.backgroundColor=qA(n)?qA(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(MA),xC=["OL","UL","MENU"],ds=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,cd(r)&&r.data.trim().length>0)t.textNodes.push(new fC(i,r,t.styles));else if(_i(r))if(gd(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return ds(i,o,t,A)});else{var s=ad(i,r);s.styles.isVisible()&&(bC(r,s,A)?s.flags|=4:QC(s.styles)&&(s.flags|=2),xC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?ds(i,r.shadowRoot,s,A):!fs(r)&&!hd(r)&&!gs(r)&&ds(i,r,s,A))}},ad=function(i,e){return La(e)?new ed(i,e):ud(e)?new td(i,e):hd(e)?new Ad(i,e):FC(e)?new id(i,e):UC(e)?new Fa(i,e):SC(e)?new Ua(i,e):gs(e)?new nd(i,e):fs(e)?new sd(i,e):pd(e)?new od(i,e):new MA(i,e)},ld=function(i,e){var t=ad(i,e);return t.flags|=4,ds(i,e,t,t),t},bC=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ea(i)&&t.styles.isTransparent()},QC=function(i){return i.isPositioned()||i.isFloating()},cd=function(i){return i.nodeType===Node.TEXT_NODE},_i=function(i){return i.nodeType===Node.ELEMENT_NODE},Sa=function(i){return _i(i)&&typeof i.style<"u"&&!ps(i)},ps=function(i){return typeof i.className=="object"},FC=function(i){return i.tagName==="LI"},UC=function(i){return i.tagName==="OL"},SC=function(i){return i.tagName==="INPUT"},EC=function(i){return i.tagName==="HTML"},hd=function(i){return i.tagName==="svg"},Ea=function(i){return i.tagName==="BODY"},ud=function(i){return i.tagName==="CANVAS"},dd=function(i){return i.tagName==="VIDEO"},La=function(i){return i.tagName==="IMG"},pd=function(i){return i.tagName==="IFRAME"},fd=function(i){return i.tagName==="STYLE"},LC=function(i){return i.tagName==="SCRIPT"},fs=function(i){return i.tagName==="TEXTAREA"},gs=function(i){return i.tagName==="SELECT"},gd=function(i){return i.tagName==="SLOT"},md=function(i){return i.tagName.indexOf("-")>0},MC=(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})(),wd={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"]},Bd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},HC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},IC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Pi=function(i,e,t,A,r,n){return i<e||i>t?Mr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},yd=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},bt=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(yd(Math.abs(i),n,A,function(s){return xt(Math.floor(s%n)+e)})+r)},Bi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return yd(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},ki=1,ei=2,ti=4,Lr=8,VA=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Mr(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&&St(n,ki)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&St(n,ei)||c===1&&l===1&&St(n,ti)&&i>100||c===1&&l>1&&St(n,Lr)?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},Cd="十百千萬",vd="拾佰仟萬",Td="マイナス",Ma="마이너스",Mr=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=bt(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Bi(i,"〇一二三四五六七八九",r);case 6:return Pi(i,1,3999,wd,3,A).toLowerCase();case 7:return Pi(i,1,3999,wd,3,A);case 8:return bt(i,945,969,!1,A);case 9:return bt(i,97,122,!1,A);case 10:return bt(i,65,90,!1,A);case 11:return bt(i,1632,1641,!0,A);case 12:case 49:return Pi(i,1,9999,Bd,3,A);case 35:return Pi(i,1,9999,Bd,3,A).toLowerCase();case 13:return bt(i,2534,2543,!0,A);case 14:case 30:return bt(i,6112,6121,!0,A);case 15:return Bi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Bi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return VA(i,"零一二三四五六七八九",Cd,"負",r,ei|ti|Lr);case 47:return VA(i,"零壹貳參肆伍陸柒捌玖",vd,"負",r,ki|ei|ti|Lr);case 42:return VA(i,"零一二三四五六七八九",Cd,"负",r,ei|ti|Lr);case 41:return VA(i,"零壹贰叁肆伍陆柒捌玖",vd,"负",r,ki|ei|ti|Lr);case 26:return VA(i,"〇一二三四五六七八九","十百千万",Td,r,0);case 25:return VA(i,"零壱弐参四伍六七八九","拾百千万",Td,r,ki|ei|ti);case 31:return VA(i,"영일이삼사오육칠팔구","십백천만",Ma,n,ki|ei|ti);case 33:return VA(i,"零一二三四五六七八九","十百千萬",Ma,n,0);case 32:return VA(i,"零壹貳參四五六七八九","拾百千",Ma,n,ki|ei|ti);case 18:return bt(i,2406,2415,!0,A);case 20:return Pi(i,1,19999,IC,3,A);case 21:return bt(i,2790,2799,!0,A);case 22:return bt(i,2662,2671,!0,A);case 22:return Pi(i,1,10999,HC,3,A);case 23:return Bi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Bi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return bt(i,3302,3311,!0,A);case 28:return Bi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Bi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return bt(i,3792,3801,!0,A);case 37:return bt(i,6160,6169,!0,A);case 38:return bt(i,4160,4169,!0,A);case 39:return bt(i,2918,2927,!0,A);case 40:return bt(i,1776,1785,!0,A);case 43:return bt(i,3046,3055,!0,A);case 44:return bt(i,3174,3183,!0,A);case 45:return bt(i,3664,3673,!0,A);case 46:return bt(i,3872,3881,!0,A);default:return bt(i,48,57,!0,A)}},xd="data-html2canvas-ignore",bd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new MC,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=DC(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=kC(r).then(function(){return Xt(A,void 0,void 0,function(){var u,m;return Vt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(VC),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))),u=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:y.sent(),y.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,PC(l)]:[3,4];case 3:y.sent(),y.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(l,m)}).then(function(){return r})]:[2,r]}})})});return l.open(),l.write(OC(document.doctype)+"<html></html>"),KC(this.referenceElement.ownerDocument,n,s),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},i.prototype.createElementClone=function(e){if(fa(e,2))debugger;if(ud(e))return this.createCanvasClone(e);if(dd(e))return this.createVideoClone(e);if(fd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return La(t)&&(La(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),md(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ha(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){(!_i(t)||!LC(t)&&!t.hasAttribute(xd)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!_i(t)||!fd(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(_i(n)&&gd(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(cd(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&_i(e)&&(Sa(e)||ps(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&&Sa(r)&&(this.clonedReferenceElement=r),Ea(r)&&RC(r);var l=this.counters.parse(new Nu(this.context,n)),c=this.resolvePseudoContent(e,r,s,Hr.BEFORE);md(e)&&(t=!0),dd(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,Hr.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||ps(e))&&!pd(e)||t)&&Ha(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(fs(e)||gs(e))&&(fs(r)||gs(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 Nu(this.context,A));var l=new Fy(this.context,A),c=o.createElement("html2canvaspseudoelement");Ha(A,c),l.content.forEach(function(m){if(m.type===0)c.appendChild(o.createTextNode(m.value));else if(m.type===22){var y=o.createElement("img");y.src=m.value,y.style.opacity="1",c.appendChild(y)}else if(m.type===18){if(m.name==="attr"){var v=m.values.filter(ut);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Ii),C=T[0],U=T[1];if(C&&ut(C)){var F=n.counters.getCounterValue(C.value),E=U&&ut(U)?pa.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Mr(F,E,!1)))}}else if(m.name==="counters"){var k=m.values.filter(Ii),C=k[0],R=k[1],U=k[2];if(C&&ut(C)){var M=n.counters.getCounterValues(C.value),z=U&&ut(U)?pa.parse(n.context,U.value):3,ie=R&&R.type===0?R.value:"",G=M.map(function(re){return Mr(re,z,!1)}).join(ie);c.appendChild(o.createTextNode(G))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(ku(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(ku(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ia+" "+Da;var u=r===Hr.BEFORE?" "+Ia:" "+Da;return ps(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),Hr;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})(Hr||(Hr={}));var DC=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(xd,"true"),i.body.appendChild(t),t},_C=function(i){return new Promise(function(e){if(i.complete){e();return}if(!i.src){e();return}i.onload=e,i.onerror=e})},PC=function(i){return Promise.all([].slice.call(i.images,0).map(_C))},kC=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)}})},NC=["all","d","content"],Ha=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);NC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},OC=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},KC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},VC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},zC=":before",WC=":after",Ia="___html2canvas___pseudoelement_before",Da="___html2canvas___pseudoelement_after",Qd=`{
7
7
  content: "" !important;
8
8
  display: none !important;
9
- }`,zC=function(i){WC(i,"."+Ha+KC+bd+`
10
- .`+Ia+VC+bd)},WC=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Qd=(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})(),RC=(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)||(_a(e)||ZC(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 Wt(this,void 0,void 0,function(){var t,A,r,n,s=this;return kt(this,function(o){switch(o.label){case 0:return t=Qd.isSameOrigin(e),A=!Da(e)&&this._options.useCORS===!0&&Dt.SUPPORT_CORS_IMAGES&&!t,r=!Da(e)&&!t&&!_a(e)&&typeof this._options.proxy=="string"&&Dt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Da(e)&&!_a(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 u=new Image;u.onload=function(){return l(u)},u.onerror=c,(JC(n)||A)&&(u.crossOrigin="anonymous"),u.src=n,u.complete===!0&&setTimeout(function(){return l(u)},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=Dt.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(y){return s(y)},!1),m.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 u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),GC=/^data:image\/svg\+xml/i,$C=/^data:image\/.*;base64,/i,XC=/^data:image\/.*/i,ZC=function(i){return Dt.SUPPORT_SVG_DRAWING||!YC(i)},Da=function(i){return XC.test(i)},JC=function(i){return $C.test(i)},_a=function(i){return i.substr(0,4)==="blob"},YC=function(i){return i.substr(-3).toLowerCase()==="svg"||GC.test(i)},_e=(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})(),ki=function(i,e,t){return new _e(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},gs=(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=ki(this.start,this.startControl,e),r=ki(this.startControl,this.endControl,e),n=ki(this.endControl,this.end,e),s=ki(A,r,e),o=ki(r,n,e),l=ki(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})(),dA=function(i){return i.type===1},qC=(function(){function i(e){var t=e.styles,A=e.bounds,r=br(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=br(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=br(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=br(t.borderBottomLeftRadius,A.width,A.height),T=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((T+m)/A.width),U.push((s+C)/A.height),U.push((c+y)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,m/=F,y/=F,T/=F,C/=F);var E=A.width-l,N=A.height-y,R=A.width-m,M=A.height-C,z=t.borderTopWidth,Ae=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,ie=ft(t.paddingTop,e.bounds.width),re=ft(t.paddingRight,e.bounds.width),ce=ft(t.paddingBottom,e.bounds.width),Z=ft(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?wt(A.left+V/3,A.top+z/3,n-V/3,s-z/3,ct.TOP_LEFT):new _e(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?wt(A.left+E,A.top+z/3,l-Ae/3,c-z/3,ct.TOP_RIGHT):new _e(A.left+A.width-Ae/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?wt(A.left+R,A.top+N,m-Ae/3,y-$/3,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=T>0||C>0?wt(A.left+V/3,A.top+M,T-V/3,C-$/3,ct.BOTTOM_LEFT):new _e(A.left+V/3,A.top+A.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?wt(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,ct.TOP_LEFT):new _e(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?wt(A.left+E,A.top+z*2/3,l-Ae*2/3,c-z*2/3,ct.TOP_RIGHT):new _e(A.left+A.width-Ae*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?wt(A.left+R,A.top+N,m-Ae*2/3,y-$*2/3,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||C>0?wt(A.left+V*2/3,A.top+M,T-V*2/3,C-$*2/3,ct.BOTTOM_LEFT):new _e(A.left+V*2/3,A.top+A.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?wt(A.left+V/2,A.top+z/2,n-V/2,s-z/2,ct.TOP_LEFT):new _e(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?wt(A.left+E,A.top+z/2,l-Ae/2,c-z/2,ct.TOP_RIGHT):new _e(A.left+A.width-Ae/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?wt(A.left+R,A.top+N,m-Ae/2,y-$/2,ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=T>0||C>0?wt(A.left+V/2,A.top+M,T-V/2,C-$/2,ct.BOTTOM_LEFT):new _e(A.left+V/2,A.top+A.height-$/2),this.topLeftBorderBox=n>0||s>0?wt(A.left,A.top,n,s,ct.TOP_LEFT):new _e(A.left,A.top),this.topRightBorderBox=l>0||c>0?wt(A.left+E,A.top,l,c,ct.TOP_RIGHT):new _e(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?wt(A.left+R,A.top+N,m,y,ct.BOTTOM_RIGHT):new _e(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||C>0?wt(A.left,A.top+M,T,C,ct.BOTTOM_LEFT):new _e(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?wt(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),ct.TOP_LEFT):new _e(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?wt(A.left+Math.min(E,A.width-Ae),A.top+z,E>A.width+Ae?0:Math.max(0,l-Ae),Math.max(0,c-z),ct.TOP_RIGHT):new _e(A.left+A.width-Ae,A.top+z),this.bottomRightPaddingBox=m>0||y>0?wt(A.left+Math.min(R,A.width-V),A.top+Math.min(N,A.height-$),Math.max(0,m-Ae),Math.max(0,y-$),ct.BOTTOM_RIGHT):new _e(A.left+A.width-Ae,A.top+A.height-$),this.bottomLeftPaddingBox=T>0||C>0?wt(A.left+V,A.top+Math.min(M,A.height-$),Math.max(0,T-V),Math.max(0,C-$),ct.BOTTOM_LEFT):new _e(A.left+V,A.top+A.height-$),this.topLeftContentBox=n>0||s>0?wt(A.left+V+Z,A.top+z+ie,Math.max(0,n-(V+Z)),Math.max(0,s-(z+ie)),ct.TOP_LEFT):new _e(A.left+V+Z,A.top+z+ie),this.topRightContentBox=l>0||c>0?wt(A.left+Math.min(E,A.width+V+Z),A.top+z+ie,E>A.width+V+Z?0:l-V+Z,c-(z+ie),ct.TOP_RIGHT):new _e(A.left+A.width-(Ae+re),A.top+z+ie),this.bottomRightContentBox=m>0||y>0?wt(A.left+Math.min(R,A.width-(V+Z)),A.top+Math.min(N,A.height+z+ie),Math.max(0,m-(Ae+re)),y-($+ce),ct.BOTTOM_RIGHT):new _e(A.left+A.width-(Ae+re),A.top+A.height-($+ce)),this.bottomLeftContentBox=T>0||C>0?wt(A.left+V+Z,A.top+M,Math.max(0,T-(V+Z)),C-($+ce),ct.BOTTOM_LEFT):new _e(A.left+V+Z,A.top+A.height-($+ce))}return i})(),ct;(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"})(ct||(ct={}));var wt=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 ct.TOP_LEFT:return new gs(new _e(i,c),new _e(i,c-o),new _e(l-s,e),new _e(l,e));case ct.TOP_RIGHT:return new gs(new _e(i,e),new _e(i+s,e),new _e(l,c-o),new _e(l,c));case ct.BOTTOM_RIGHT:return new gs(new _e(l,e),new _e(l,e+o),new _e(i+s,c),new _e(i,c));case ct.BOTTOM_LEFT:default:return new gs(new _e(l,c),new _e(l-s,c),new _e(i,e+o),new _e(i,e))}},ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},jC=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},ws=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},ev=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Bs=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),tv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),Av=function(i){return i.type===0},Fd=function(i){return i.type===1},iv=function(i){return i.type===2},Ud=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},rv=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})},Sd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Ed=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new qC(this.container),this.container.styles.opacity<1&&this.effects.push(new tv(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 ev(A,r,n))}if(this.container.styles.overflowX!==0){var s=ms(this.curves),o=ws(this.curves);Ud(s,o)?this.effects.push(new Bs(s,6)):(this.effects.push(new Bs(s,2)),this.effects.push(new Bs(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!Fd(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=ws(A.curves);Ud(s,o)||r.unshift(new Bs(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return Ut(l.target,e)})},i})(),Pa=function(i,e,t,A){i.container.elements.forEach(function(r){var n=Ut(r.flags,4),s=Ut(r.flags,2),o=new Ed(r,i);Ut(r.styles.display,2048)&&A.push(o);var l=Ut(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Sd(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var y=0;c.negativeZIndex.some(function(T,C){return m>T.element.container.styles.zIndex.order?(y=C,!1):y>0}),c.negativeZIndex.splice(y,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(T,C){return m>=T.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);Pa(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Pa(o,e,t,l);Ut(r.flags,8)&&Ld(r,l)})},Ld=function(i,e){for(var t=i instanceof Qa?i.start:1,A=i instanceof Qa?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof Ad&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Lr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},nv=function(i){var e=new Ed(i,null),t=new Sd(e),A=[];return Pa(e,t,t,A),Ld(e.container,A),t},Md=function(i,e){switch(e){case 0:return pA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return pA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return pA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return pA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},sv=function(i,e){switch(e){case 0:return pA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return pA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return pA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return pA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},ov=function(i,e){switch(e){case 0:return pA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return pA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return pA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return pA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},av=function(i,e){switch(e){case 0:return ys(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return ys(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return ys(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return ys(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},ys=function(i,e){var t=[];return dA(i)?t.push(i.subdivide(.5,!1)):t.push(i),dA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},pA=function(i,e,t,A){var r=[];return dA(i)?r.push(i.subdivide(.5,!1)):r.push(i),dA(t)?r.push(t.subdivide(.5,!0)):r.push(t),dA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),dA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Hd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},Cs=function(i){var e=i.styles,t=i.bounds,A=ft(e.paddingLeft,t.width),r=ft(e.paddingRight,t.width),n=ft(e.paddingTop,t.width),s=ft(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))},lv=function(i,e){return i===0?e.bounds:i===2?Cs(e):Hd(e)},cv=function(i,e){return i===0?e.bounds:i===2?Cs(e):Hd(e)},Na=function(i,e,t){var A=lv(Ki(i.styles.backgroundOrigin,e),i),r=cv(Ki(i.styles.backgroundClip,e),i),n=hv(Ki(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=br(Ki(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=uv(Ki(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),m=Math.round(A.top+l[1]);return[c,u,m,s,o]},Oi=function(i){return ut(i)&&i.value===Di.AUTO},vs=function(i){return typeof i=="number"},hv=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(Ft(s)&&o&&Ft(o))return[ft(s,t.width),ft(o,t.height)];var l=vs(n);if(ut(s)&&(s.value===Di.CONTAIN||s.value===Di.COVER)){if(vs(n)){var c=t.width/t.height;return c<n!=(s.value===Di.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=vs(A),m=vs(r),y=u||m;if(Oi(s)&&(!o||Oi(o))){if(u&&m)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var v=u?A:r*n,T=m?r:A/n;return[v,T]}var C=u?A:t.width,U=m?r:t.height;return[C,U]}if(l){var F=0,E=0;return Ft(s)?F=ft(s,t.width):Ft(o)&&(E=ft(o,t.height)),Oi(s)?F=E*n:(!o||Oi(o))&&(E=F/n),[F,E]}var N=null,R=null;if(Ft(s)?N=ft(s,t.width):o&&Ft(o)&&(R=ft(o,t.height)),N!==null&&(!o||Oi(o))&&(R=u&&m?N/A*r:t.height),R!==null&&Oi(s)&&(N=u&&m?R/r*A:t.width),N!==null&&R!==null)return[N,R];throw new Error("Unable to calculate background-size for element")},Ki=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},uv=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 _e(Math.round(A.left),Math.round(A.top+s)),new _e(Math.round(A.left+A.width),Math.round(A.top+s)),new _e(Math.round(A.left+A.width),Math.round(l+A.top+s)),new _e(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new _e(Math.round(A.left+n),Math.round(A.top)),new _e(Math.round(A.left+n+o),Math.round(A.top)),new _e(Math.round(A.left+n+o),Math.round(A.height+A.top)),new _e(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new _e(Math.round(A.left+n),Math.round(A.top+s)),new _e(Math.round(A.left+n+o),Math.round(A.top+s)),new _e(Math.round(A.left+n+o),Math.round(A.top+s+l)),new _e(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new _e(Math.round(r.left),Math.round(r.top)),new _e(Math.round(r.left+r.width),Math.round(r.top)),new _e(Math.round(r.left+r.width),Math.round(r.height+r.top)),new _e(Math.round(r.left),Math.round(r.height+r.top))]}},dv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Id="Hidden Text",pv=(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=dv,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(Id)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Id)),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})(),Dd=(function(){function i(e,t){this.context=e,this.options=t}return i})(),fv=1e4,gv=(function(i){BA(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 pv(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(),iv(t)&&(this.ctx.globalAlpha=t.opacity),Av(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)),Fd(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 Wt(this,void 0,void 0,function(){var A;return kt(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 Wt(this,void 0,void 0,function(){return kt(this,function(A){switch(A.label){case 0:if(Ut(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=ba(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=Cv(t.fontFamily).join(", "),n=xr(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 Wt(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return kt(this,function(v){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,u=l.middle,m=A.paintOrder,t.textBounds.forEach(function(T){m.forEach(function(C){switch(C){case 0:y.ctx.fillStyle=Et(A.color),y.renderTextWithLetterSpacing(T,A.letterSpacing,c);var U=A.textShadow;U.length&&T.text.trim().length&&(U.slice(0).reverse().forEach(function(F){y.ctx.shadowColor=Et(F.color),y.ctx.shadowOffsetX=F.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=F.offsetY.number*y.options.scale,y.ctx.shadowBlur=F.blur.number,y.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Et(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:y.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(y.ctx.strokeStyle=Et(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),y.ctx.strokeStyle="",y.ctx.lineWidth=0,y.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=Cs(t),s=ws(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,m,y,R,v,T,M,C,U,F,E,N,R,M;return kt(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.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(!(A instanceof ju))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof ed&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof td))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof sd&&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:u=z.sent(),A.width&&A.height&&this.ctx.drawImage(u,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),z.label=14;case 14:if(A instanceof Fa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===cs?A.checked&&(this.ctx.save(),this.path([new _e(A.bounds.left+m*.39363,A.bounds.top+m*.79),new _e(A.bounds.left+m*.16,A.bounds.top+m*.5549),new _e(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new _e(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new _e(A.bounds.left+m*.72983,A.bounds.top+m*.23),new _e(A.bounds.left+m*.84,A.bounds.top+m*.34085),new _e(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Et(id),this.ctx.fill(),this.ctx.restore()):A.type===hs&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+m/2,A.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Et(id),this.ctx.fill(),this.ctx.restore())),mv(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],v=y[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=Et(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Bv(A.styles.textAlign),M=Cs(A),C=0,A.styles.textAlign){case 1:C+=M.width/2;break;case 2:C+=M.width;break}U=M.add(C,0,0,-M.height/2+1),this.ctx.save(),this.path([new _e(M.left,M.top),new _e(M.left+M.width,M.top),new _e(M.left+M.width,M.top+M.height),new _e(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Sr(A.value,U),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ut(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];E=void 0,N=F.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return E=z.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.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&&A.styles.listStyleType!==-1&&(R=this.createFontStyle(n)[0],this.ctx.font=R,this.ctx.fillStyle=Et(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new NA(A.bounds.left,A.bounds.top+ft(A.styles.paddingTop,A.bounds.width),A.bounds.width,Iu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Sr(t.listValue,M),n.letterSpacing,Iu(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 Wt(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,y,F,v,T,F,C,U,F;return kt(this,function(E){switch(E.label){case 0:if(Ut(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,r=t.negativeZIndex,E.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:E.sent(),E.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:E.sent(),n=0,s=t.nonInlineLevel,E.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,E.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,E.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:m=0,y=t.inlineLevel,E.label=19;case 19:return m<y.length?(F=y[m],[4,this.renderNode(F)]):[3,22];case 20:E.sent(),E.label=21;case 21:return m++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:E.sent(),E.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,E.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:E.sent(),E.label=29;case 29:return C++,[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=dA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),dA(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 Wt(this,void 0,void 0,function(){var A,r,n,s,o,l;return kt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,ie,le,se,Z,ee,$,T,ie,le,se,Z,ee,C,U,F,E,N,R,M,z,Ae,$,V,ie,re,ce,Z,ee,oe,le,se,he,pe,ge,be,Ee,ye,Ce,Fe;return kt(this,function(Ue){switch(Ue.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=Ue.sent(),[3,4];case 3:return Ue.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Na(t,A,[m.width,m.height,m.width/m.height]),ie=v[0],le=v[1],se=v[2],Z=v[3],ee=v[4],$=n.ctx.createPattern(n.resizeImage(m,Z,ee),"repeat"),n.renderRepeat(ie,$,le,se)),[3,6];case 5:A2(u)?(T=Na(t,A,[null,null,null]),ie=T[0],le=T[1],se=T[2],Z=T[3],ee=T[4],C=YB(u.angle,Z,ee),U=C[0],F=C[1],E=C[2],N=C[3],R=C[4],M=document.createElement("canvas"),M.width=Z,M.height=ee,z=M.getContext("2d"),Ae=z.createLinearGradient(F,N,E,R),Tu(u.stops,U).forEach(function(Ne){return Ae.addColorStop(Ne.stop,Et(Ne.color))}),z.fillStyle=Ae,z.fillRect(0,0,Z,ee),Z>0&&ee>0&&($=n.ctx.createPattern(M,"repeat"),n.renderRepeat(ie,$,le,se))):i2(u)&&(V=Na(t,A,[null,null,null]),ie=V[0],re=V[1],ce=V[2],Z=V[3],ee=V[4],oe=u.position.length===0?[ca]:u.position,le=ft(oe[0],Z),se=ft(oe[oe.length-1],ee),he=qB(u,le,se,Z,ee),pe=he[0],ge=he[1],pe>0&&ge>0&&(be=n.ctx.createRadialGradient(re+le,ce+se,0,re+le,ce+se,pe),Tu(u.stops,pe*2).forEach(function(Ne){return be.addColorStop(Ne.stop,Et(Ne.color))}),n.path(ie),n.ctx.fillStyle=be,pe!==ge?(Ee=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,Ce=ge/pe,Fe=1/Ce,n.ctx.save(),n.ctx.translate(Ee,ye),n.ctx.transform(1,0,0,Ce,0,0),n.ctx.translate(-Ee,-ye),n.ctx.fillRect(re,Fe*(ce-ye)+ye,Z,ee*Fe),n.ctx.restore()):n.ctx.fill())),Ue.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 Wt(this,void 0,void 0,function(){return kt(this,function(n){return this.path(Md(r,A)),this.ctx.fillStyle=Et(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return Wt(this,void 0,void 0,function(){var s,o;return kt(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=sv(n,r),this.path(s),this.ctx.fillStyle=Et(t),this.ctx.fill(),o=ov(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Wt(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return kt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!YA(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=wv(Ki(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),YA(A.backgroundColor)||(this.ctx.fillStyle=Et(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:y.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){m.ctx.save();var T=ms(t.curves),C=v.inset?0:fv,U=rv(T,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(m.path(T),m.ctx.clip(),m.mask(U)):(m.mask(T),m.ctx.clip(),m.path(U)),m.ctx.shadowOffsetX=v.offsetX.number+C,m.ctx.shadowOffsetY=v.offsetY.number,m.ctx.shadowColor=Et(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Et(v.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!YA(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:y.sent(),y.label=11;case 11:o++,y.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return Wt(this,void 0,void 0,function(){var o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,z,M,z;return kt(this,function(Ae){return this.ctx.save(),o=av(n,r),l=Md(n,r),s===2&&(this.path(l),this.ctx.clip()),dA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),dA(l[1])?(m=l[1].end.x,y=l[1].end.y):(m=l[1].x,y=l[1].y),r===0||r===2?v=Math.abs(c-m):v=Math.abs(u-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(T=A,C=A),U=!0,v<=T*2?U=!1:v<=T*2+C?(F=v/(2*T+C),T*=F,C*=F):(E=Math.floor((v+C)/(T+C)),N=(v-E*T)/(E-1),R=(v-(E+1)*T)/E,C=R<=0||Math.abs(C-N)<Math.abs(C-R)?N:R),U&&(s===3?this.ctx.setLineDash([0,T+C]):this.ctx.setLineDash([T,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Et(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(dA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new _e(M.end.x,M.end.y),new _e(z.start.x,z.start.y)]),this.ctx.stroke()),dA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new _e(M.end.x,M.end.y),new _e(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Wt(this,void 0,void 0,function(){var A;return kt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Et(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=nv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Dd),mv=function(i){return i instanceof nd||i instanceof rd?!0:i instanceof Fa&&i.type!==hs&&i.type!==cs},wv=function(i,e){switch(i){case 0:return ms(e);case 2:return jC(e);default:return ws(e)}},Bv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},yv=["-apple-system","system-ui"],Cv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return yv.indexOf(e)===-1}):i},vv=(function(i){BA(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 Wt(this,void 0,void 0,function(){var A,r;return kt(this,function(n){switch(n.label){case 0:return A=xa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Tv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Et(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})(Dd),Tv=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))})},xv=(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,En([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,En([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,En([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,En([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),bv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new xv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new RC(this,e)}return i.instanceCount=1,i})(),Qv=function(i,e){return e===void 0&&(e={}),Fv(i,e)};typeof window<"u"&&Qd.setContext(window);var Fv=function(i,e){return Wt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,y,v,T,C,U,F,E,N,R,M,Ae,z,Ae,$,V,ie,re,ce,Z,ee,oe,le,se,he,pe,ge,be,Ee,ye,Ce;return kt(this,function(Fe){switch(Fe.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:($=e.allowTaint)!==null&&$!==void 0?$:!1,imageTimeout:(V=e.imageTimeout)!==null&&V!==void 0?V:15e3,proxy:e.proxy,useCORS:(ie=e.useCORS)!==null&&ie!==void 0?ie:!1},n=zo({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(ce=e.windowWidth)!==null&&ce!==void 0?ce:A.innerWidth,windowHeight:(Z=e.windowHeight)!==null&&Z!==void 0?Z:A.innerHeight,scrollX:(ee=e.scrollX)!==null&&ee!==void 0?ee:A.pageXOffset,scrollY:(oe=e.scrollY)!==null&&oe!==void 0?oe:A.pageYOffset},o=new NA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new bv(n,o),c=(le=e.foreignObjectRendering)!==null&&le!==void 0?le:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!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 xd(l,i,u),y=m.clonedReferenceElement,y?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Fe.sent(),T=Sa(y)||UC(y)?rw(y.ownerDocument):Ln(l,y),C=T.width,U=T.height,F=T.left,E=T.top,N=Uv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:N,scale:(pe=(he=e.scale)!==null&&he!==void 0?he:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((ge=e.x)!==null&&ge!==void 0?ge:0)+F,y:((be=e.y)!==null&&be!==void 0?be:0)+E,width:(Ee=e.width)!==null&&Ee!==void 0?Ee:Math.ceil(C),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),Ae=new vv(l,R),[4,Ae.render(y)]):[3,3];case 2:return M=Fe.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+E+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=ad(l,y),N===z.styles.backgroundColor&&(z.styles.backgroundColor=OA.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),Ae=new gv(l,R),[4,Ae.render(z)];case 4:M=Fe.sent(),Fe.label=5;case 5:return(!((Ce=e.removeContainer)!==null&&Ce!==void 0)||Ce)&&(xd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Uv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Qr(i,getComputedStyle(A.documentElement).backgroundColor):OA.TRANSPARENT,n=A.body?Qr(i,getComputedStyle(A.body).backgroundColor):OA.TRANSPARENT,s=typeof t=="string"?Qr(i,t):t===null?OA.TRANSPARENT:4294967295;return e===A.documentElement?YA(r)?YA(n)?s:n:r:s};const Sv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Ev{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,u=n._series;if(!c||!u)return;const m=u.priceToCoordinate(n.price);if(m==null)return;const y=Math.round(m*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(T>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,y),l.lineTo(C,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(T,y,U,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 _d{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 u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),y=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):m,n.textAlign="right"}else T=m,n.textAlign="left";else A.hAlign==="right"?(T=v-m,n.textAlign="right"):(T=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-y:A.vAlign==="bottom"?U=C+y:U=C,n.fillStyle=A.textColor,n.fillText(A.text,T,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Lv{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,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*y,M.setLineDash([]),M.moveTo(F,E),M.lineTo(N,R),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,E,3*y,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(N,R,3*y,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:z,pricePct:Ae,bars:$,days:V,angle:ie}=s.info,re=z>=0?"+":"",ce=[];if(s.statsPriceRange!==!1&&ce.push(`${re}${z.toFixed(5)} (${re}${Ae.toFixed(2)}%)`),s.statsBarsRange!==!1&&ce.push(`${$} bars`),s.statsDateRange!==!1&&ce.push(`${V} days`),s.statsAngle!==!1&&ce.push(`∠ ${ie.toFixed(1)}°`),s.statsDistance&&ce.push(`Δ ${Math.abs(z).toFixed(5)}`),ce.length===0){M.restore();return}const Z=Math.round(11*y);M.font=`${Z}px sans-serif`;const ee=Z*1.6,oe=8*y,le=Math.max(...ce.map(Je=>M.measureText(Je).width))+oe*2,se=ce.length*ee+oe*2,he=s.statsPosition??"right";let pe,ge;he==="left"?(pe=F,ge=E):he==="center"?(pe=Math.round((F+N)/2),ge=Math.round((E+R)/2)):(pe=N,ge=R);let be,Ee;he==="left"?(be=pe-le-10*m,Ee=ge-se-4*y):he==="center"?(be=pe-le/2,Ee=ge-se-8*y):(be=pe+10*m,Ee=ge-se-4*y);const ye=l.bitmapSize.width,Ce=l.bitmapSize.height,Fe=Math.min(Math.max(0,be),ye-le-4*m),Ue=Math.min(Math.max(4*y,Ee),Ce-se-4*y),Ne=4*y;M.beginPath(),M.moveTo(Fe+Ne,Ue),M.lineTo(Fe+le-Ne,Ue),M.quadraticCurveTo(Fe+le,Ue,Fe+le,Ue+Ne),M.lineTo(Fe+le,Ue+se-Ne),M.quadraticCurveTo(Fe+le,Ue+se,Fe+le-Ne,Ue+se),M.lineTo(Fe+Ne,Ue+se),M.quadraticCurveTo(Fe,Ue+se,Fe,Ue+se-Ne),M.lineTo(Fe,Ue+Ne),M.quadraticCurveTo(Fe,Ue,Fe+Ne,Ue),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*y,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",ce.forEach((Je,Ke)=>{M.fillText(Je,Fe+oe,Ue+oe+Z+Ke*ee)}),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 Pd{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,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),N=Math.round(T*m),R=Math.round(U*y),M=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E)),z.strokeStyle=M,z.lineWidth=1*y,z.setLineDash([]),z.strokeRect(Math.min(F,N),Math.min(E,R),Math.abs(N-F),Math.abs(R-E))),z.beginPath(),z.strokeStyle=M,z.lineWidth=2*y,z.moveTo(F,E),z.lineTo(N,R),z.stroke(),z.fillStyle=M,z.beginPath(),z.arc(F,E,3*y,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(N,R,3*y,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:Ae,pricePct:$,bars:V,days:ie}=s.info,re=Ae>=0?"+":"",ce=[];if(s.statsPriceRange&&ce.push(re+Ae.toFixed(5)+" ("+re+$.toFixed(2)+"%)"),s.statsBarsRange&&ce.push(V+" bars"),s.statsDateRange&&ce.push(ie+" days"),ce.length===0){z.restore();return}const Z=Math.round(11*y);z.font=Z+"px sans-serif";const ee=Z*1.6,oe=8*y,le=Math.max(...ce.map(Fe=>z.measureText(Fe).width))+oe*2,se=ce.length*ee+oe*2,he=l.bitmapSize.width,pe=l.bitmapSize.height;let ge,be;if(s.statsPosition==="left")ge=F-le-10*m,be=E-se-4*y;else if(s.statsPosition==="center"){const Fe=(F+N)/2,Ue=(E+R)/2;ge=Fe-le/2,be=Ue-se-4*y}else ge=N+10*m,be=R-se-4*y;const Ee=Math.min(Math.max(0,ge),he-le-4*m),ye=Math.min(Math.max(4*y,be),pe-se-4*y),Ce=4*y;z.beginPath(),z.moveTo(Ee+Ce,ye),z.lineTo(Ee+le-Ce,ye),z.quadraticCurveTo(Ee+le,ye,Ee+le,ye+Ce),z.lineTo(Ee+le,ye+se-Ce),z.quadraticCurveTo(Ee+le,ye+se,Ee+le-Ce,ye+se),z.lineTo(Ee+Ce,ye+se),z.quadraticCurveTo(Ee,ye+se,Ee,ye+se-Ce),z.lineTo(Ee,ye+Ce),z.quadraticCurveTo(Ee,ye,Ee+Ce,ye),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||M,z.lineWidth=1*y,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",ce.forEach((Fe,Ue)=>{z.fillText(Fe,Ee+oe,ye+oe+Z+Ue*ee)}),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 Mv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.min(m,y)*c,U=Math.max(m,y)*c,F=Math.min(v,T)*u,E=Math.max(v,T)*u,N=U-C,R=E-F;if(N<.5||R<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,N,R),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,N,R),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 Hv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=Math.hypot(F-C,E-U);if(N<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*u,R.setLineDash([]),R.beginPath(),R.arc(C,U,N,0,Math.PI*2),R.stroke(),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 Iv{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 u=o.horizontalPixelRatio,m=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*u,N=v*m,R=T*u,M=C*m,z=U*u,Ae=F*m,$=o.context;$.save(),$.beginPath(),$.moveTo(E,N),$.lineTo(R,M),$.lineTo(z,Ae),$.closePath(),$.fillStyle=n.fillColor,$.fill(),$.strokeStyle=n.strokeColor,$.lineWidth=n.lineWidth*m,$.setLineDash([]),$.stroke(),$.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Dv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,N=F-C,R=E-U,M=Math.hypot(N,R);if(M<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*u,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(C,U),z.lineTo(F,E),z.stroke();else{const Ae=(C+F)/2,$=(U+E)/2,V=Math.atan2(R,N),ie=M/2,re=Math.max(1,ie*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(Ae,$,ie,re,V,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 Nd{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+de*pe)})}}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 _v{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+de*pe)})}}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 Pv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),N=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(N)<1e-4?0:R/N;if(r.rayLeft){const ce=U+z*(0-C);M.beginPath(),M.moveTo(0,ce),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,ce=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const Ae=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(Ae-V),ce=E-$*Math.sin(Ae-V),Z=F-$*Math.cos(Ae+V),ee=E-$*Math.sin(Ae+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,ce),M.lineTo(Z,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=Ae+Math.PI,ce=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),ee=C-$*Math.cos(re+V),oe=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(ce,Z),M.lineTo(ee,oe),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,ce=r.p2.rawTime,Z=r.p1.price,ee=r.p2.price,oe=[];if(r.statsPriceRange){const se=Math.abs(ee-Z),he=Z!==0?Math.abs((ee-Z)/Z*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;oe.push("↕ "+se.toFixed(pe)+" ("+he.toFixed(2)+"%)")}const le=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),he=o.timeScale().timeToCoordinate(ce);if(se!=null&&he!=null){const pe=o.timeScale().coordinateToLogical(se),ge=o.timeScale().coordinateToLogical(he);pe!=null&&ge!=null&&le.push("↔ "+Math.abs(Math.round(ge-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(ce-re),he=Math.floor(se/86400),pe=Math.floor(se%86400/3600),ge=Math.floor(se%3600/60);let be=he>0?he+" day"+(he!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!he&&!pe&&(be=ge+" min"+(ge!==1?"s":"")),r.statsBarsRange&&le.length>0?le[le.length-1]+=" ("+be+")":le.push(be)}if(r.statsDistance){const se=N/c,he=R/u;le.push("distance: "+Math.sqrt(se*se+he*he).toFixed(2))}if(le.length>0&&oe.push(le.join(", ")),r.statsAngle){const se=N/c,he=R/u,pe=Math.atan2(he,se)*180/Math.PI;oe.push("∠ "+pe.toFixed(0)+"°")}if(oe.length>0){const se=Math.min(c,u),he=11*se,pe=he*1.5,ge=5*se;M.font=he+"px sans-serif";const Ee=oe.reduce((Be,de)=>Math.max(Be,M.measureText(de).width),0)+ge*2,ye=oe.length*pe+ge*2,[Ce,Fe,Ue,Ne]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,Ke;r.statsPosition==="left"?(Je=Ce,Ke=Fe):r.statsPosition==="center"?(Je=(Ce+Ue)/2,Ke=(Fe+Ne)/2):(Je=Ue,Ke=Ne);const ve=Je-Ee/2,Pe=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(ve,Pe,Ee,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(ve,Pe,Ee,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",oe.forEach((Be,de)=>{M.fillText(Be,ve+ge,Pe+ge+de*pe)})}}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 Nv{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 u=n._chart,m=n._series;if(!u||!m)return;const y=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(T==null||C==null||U==null||F==null)return;const E=T*y,N=U*v,R=C*y,M=F*v,[z,Ae,$,V]=E<=R?[E,N,R,M]:[R,M,E,N];let ie=$-z,re=V-Ae;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=o.context;if(Z.save(),Z.strokeStyle=n.color,Z.fillStyle=n.color,Z.lineWidth=n.lineWidth*v,Z.setLineDash([]),n.rayLeft){const he=Ae+ce*(0-z);Z.beginPath(),Z.moveTo(0,he),Z.lineTo(z,Ae),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,he=V+ce*(se-$);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,he),Z.stroke()}const ee=Math.atan2(re,ie),oe=(n.lineWidth*4+4)*v,le=Math.PI/7;if(n.arrowRight){const se=$-oe*Math.cos(ee-le),he=V-oe*Math.sin(ee-le),pe=$-oe*Math.cos(ee+le),ge=V-oe*Math.sin(ee+le);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,he),Z.lineTo(pe,ge),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=ee+Math.PI,he=z-oe*Math.cos(se-le),pe=Ae-oe*Math.sin(se-le),ge=z-oe*Math.cos(se+le),be=Ae-oe*Math.sin(se+le);Z.beginPath(),Z.moveTo(z,Ae),Z.lineTo(he,pe),Z.lineTo(ge,be),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,he=n.p2.rawTime??n.p2.time,pe=n.p1.price,ge=n.p2.price,be=[];if(n.statsPriceRange){const ye=Math.abs(ge-pe),Ce=pe!==0?Math.abs((ge-pe)/pe*100):0,Fe=ye<1e-4?6:ye<.01?5:ye<1?4:2;be.push("↕ "+ye.toFixed(Fe)+" ("+Ce.toFixed(2)+"%)")}const Ee=[];if(n.statsBarsRange)try{const ye=u.timeScale().timeToCoordinate(se),Ce=u.timeScale().timeToCoordinate(he);if(ye!=null&&Ce!=null){const Fe=u.timeScale().coordinateToLogical(ye),Ue=u.timeScale().coordinateToLogical(Ce);Fe!=null&&Ue!=null&&Ee.push("↔ "+Math.abs(Math.round(Ue-Fe))+" bars")}}catch{}if(n.statsDateRange){const ye=Math.abs(he-se),Ce=Math.floor(ye/86400),Fe=Math.floor(ye%86400/3600),Ue=Math.floor(ye%3600/60);let Ne=Ce>0?Ce+" day"+(Ce!==1?"s":""):"";Fe>0&&(Ne+=(Ne?" ":"")+Fe+" hour"+(Fe!==1?"s":"")),!Ce&&!Fe&&(Ne=Ue+" min"+(Ue!==1?"s":"")),n.statsBarsRange&&Ee.length>0?Ee[Ee.length-1]+=" ("+Ne+")":Ee.push(Ne)}if(n.statsDistance){const ye=(R-E)/y,Ce=(M-N)/v;Ee.push("distance: "+Math.sqrt(ye*ye+Ce*Ce).toFixed(2))}if(Ee.length>0&&be.push(Ee.join(", ")),n.statsAngle){const ye=ie/y,Ce=re/v,Fe=Math.atan2(Ce,ye)*180/Math.PI;be.push("∠ "+Fe.toFixed(0)+"°")}if(be.length>0){const ye=Math.min(y,v),Ce=11*ye,Fe=Ce*1.5,Ue=5*ye;Z.font=Ce+"px sans-serif";const Je=be.reduce((ke,qe)=>Math.max(ke,Z.measureText(qe).width),0)+Ue*2,Ke=be.length*Fe+Ue*2;let ve,Pe;n.statsPosition==="left"?(ve=z,Pe=Ae):n.statsPosition==="center"?(ve=(z+$)/2,Pe=(Ae+V)/2):(ve=$,Pe=V);const Be=ve-Je/2,de=Pe-Ke-12*ye;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(Be,de,Je,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*ye,Z.strokeRect(Be,de,Je,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",be.forEach((ke,qe)=>{Z.fillText(ke,Be+Ue,de+Ue+qe*Fe)})}}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 kv{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,u=s.timeScale().timeToCoordinate(A.center.rawTime),m=o.priceToCoordinate(A.center.price);if(u==null||m==null)return;const y=Math.round(u*l),v=Math.round(m*c),T=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(T,v),U.stroke(),U.beginPath(),U.moveTo(y,0),U.lineTo(y,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),E=Math.round(11*c);U.font=E+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const N=U.measureText(F).width,R=Math.round(6*l),M=Math.round(3*c),z=E+2*M,Ae=N+2*R,$=T-Ae-Math.round(2*l),V=v-z/2;U.fillStyle=A.color,U.fillRect($,V,Ae,z),U.fillStyle="#ffffff",U.fillText(F,$+R,v)}if(A.showTime){const F=A.center.rawTime,E=new Date(F*1e3),N=Z=>String(Z).padStart(2,"0"),R=N(E.getUTCDate())+"."+N(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+N(E.getUTCHours())+":"+N(E.getUTCMinutes())+":"+N(E.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(R).width,Ae=Math.round(6*l),$=Math.round(3*c),V=M+2*$,ie=z+2*Ae,re=y-ie/2,ce=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,ce,ie,V),U.fillStyle="#ffffff",U.fillText(R,y,ce+V/2)}U.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Ov{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=v*u,F=y*c,E=T*u,N=C-F,R=U-E,M=F-C,z=E-U;if(Math.hypot(N,R)<1e-4)return;const $=Math.atan2(R,N),V=Math.round(Math.abs($*180/Math.PI)),ie=s.context;ie.save(),ie.strokeStyle=r.color,ie.fillStyle=r.color,ie.lineWidth=r.lineWidth*u,ie.setLineDash([]);const re=Math.abs(M)<1e-4?0:z/M;if(r.rayLeft){const ge=U+re*(0-C);ie.beginPath(),ie.moveTo(0,ge),ie.lineTo(C,U),ie.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,ge=E+re*(pe-F);ie.beginPath(),ie.moveTo(F,E),ie.lineTo(pe,ge),ie.stroke()}ie.beginPath(),ie.moveTo(C,U),ie.lineTo(F,E),ie.stroke();const ce=Math.atan2(z,M),Z=(r.lineWidth*4+4)*u,ee=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(ce-ee),ge=E-Z*Math.sin(ce-ee),be=F-Z*Math.cos(ce+ee),Ee=E-Z*Math.sin(ce+ee);ie.beginPath(),ie.moveTo(F,E),ie.lineTo(pe,ge),ie.lineTo(be,Ee),ie.closePath(),ie.fill()}if(r.arrowLeft){const pe=ce+Math.PI,ge=C-Z*Math.cos(pe-ee),be=U-Z*Math.sin(pe-ee),Ee=C-Z*Math.cos(pe+ee),ye=U-Z*Math.sin(pe+ee);ie.beginPath(),ie.moveTo(C,U),ie.lineTo(ge,be),ie.lineTo(Ee,ye),ie.closePath(),ie.fill()}const oe=28*u;ie.strokeStyle="rgba(122,166,174,0.55)",ie.fillStyle=r.color,ie.lineWidth=1*u,ie.beginPath(),ie.moveTo(F,E),ie.lineTo(F+oe,E),ie.stroke(),ie.beginPath(),ie.strokeStyle="rgba(122,166,174,0.45)",ie.arc(F,E,oe,0,$,$<0),ie.stroke(),ie.fillStyle="#4b7c86",ie.font=`${Math.round(10*u)}px sans-serif`,ie.textAlign="left",ie.textBaseline="middle";const le=F+(oe+10*u)*Math.cos($/2),se=E+(oe+10*u)*Math.sin($/2);if(ie.fillText(`${V}°`,le,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,ge=r.p2.price,be=[];if(r.statsPriceRange){const ye=Math.abs(ge-pe),Ce=pe!==0?Math.abs((ge-pe)/pe*100):0,Fe=ye<1e-4?6:ye<.01?5:ye<1?4:2;be.push("↕ "+ye.toFixed(Fe)+" ("+Ce.toFixed(2)+"%)")}const Ee=[];if(r.statsDistance){const ye=M/c,Ce=z/u;Ee.push("distance: "+Math.sqrt(ye*ye+Ce*Ce).toFixed(2))}if(Ee.length>0&&be.push(Ee.join(", ")),be.length>0){const ye=Math.min(c,u),Ce=11*ye,Fe=Ce*1.5,Ue=5*ye;ie.font=Ce+"px sans-serif";const Je=be.reduce((Ge,De)=>Math.max(Ge,ie.measureText(De).width),0)+Ue*2,Ke=be.length*Fe+Ue*2,[ve,Pe,Be,de]=C<=F?[C,U,F,E]:[F,E,C,U];let ke,qe;r.statsPosition==="left"?(ke=ve,qe=Pe):r.statsPosition==="center"?(ke=(ve+Be)/2,qe=(Pe+de)/2):(ke=Be,qe=de);const At=ke-Je/2,rt=qe-Ke-12*ye;ie.fillStyle="rgba(20, 20, 30, 0.72)",ie.fillRect(At,rt,Je,Ke),ie.strokeStyle=r.statsColor,ie.lineWidth=1*ye,ie.strokeRect(At,rt,Je,Ke),ie.fillStyle=r.statsColor,ie.textBaseline="top",ie.textAlign="left",be.forEach((Ge,De)=>{ie.fillText(Ge,At+Ue,rt+Ue+De*Fe)})}}ie.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Kv{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,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*c,N=v*u,R=T*c,M=C*u,z=U*c,Ae=F*u,$=(R+z)/2,V=(M+Ae)/2;let ie=$-E,re=V-N;Math.abs(ie)<1e-4&&(ie=1e-4);const ce=re/ie,Z=s.bitmapSize.width,ee=(R-z)/2,oe=(M-Ae)/2,le=ye=>({x:$+ee*ye,y:V+oe*ye}),se=(ye,Ce)=>({x:Z,y:Ce+ce*(Z-ye)}),he=le(1),pe=le(-1),ge=se(he.x,he.y),be=se(pe.x,pe.y);m.save(),m.beginPath(),m.moveTo(he.x,he.y),m.lineTo(ge.x,ge.y),m.lineTo(be.x,be.y),m.lineTo(pe.x,pe.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*u,m.moveTo(R,M),m.lineTo(z,Ae),m.stroke(),r._levels.forEach(ye=>{const Ce=le(ye.k),Fe=se(Ce.x,Ce.y);m.beginPath(),m.strokeStyle=ye.color,m.lineWidth=ye.width*u,m.moveTo(Ce.x,Ce.y),m.lineTo(Fe.x,Fe.y),m.stroke()});const Ee=se(E,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(E,N),m.lineTo(Ee.x,Ee.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 Vv{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,u=n.context,m=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*l,U=y*c,F=v*l,E=T*c,N=n.bitmapSize.width,R=Math.abs(F-C)<1e-4?1:F-C,M=(E-U)/R,z=F>=C?1:-1,Ae=z>0?N:0,$=C+z*Math.min(220*l,Math.max(80*l,N*.35)),V=A._rays.map(re=>{const ce=M*re.ratio;return{...re,yEnd:U+ce*(Ae-C),yLabel:U+ce*($-C)}});u.save();const ie=(re,ce,Z)=>{!re||!ce||(u.beginPath(),u.moveTo(C,U),u.lineTo(Ae,re.yEnd),u.lineTo(Ae,ce.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};ie(V[0],V[3],"rgba(161, 98, 7, 0.10)"),ie(V[3],V[4],"rgba(5, 150, 105, 0.10)"),ie(V[4],V[5],"rgba(107, 114, 128, 0.12)"),V.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(Ae,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=z>0?"left":"right",u.textBaseline="middle",V.forEach(re=>{u.fillStyle=re.color;const ce=$+(z>0?4*l:-4*l),Z=re.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(re.label,ce,Z)}),u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class zv{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,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(y==null||v==null||T==null||C==null)return;const U=y*c,F=v*u,E=T*c,N=C*u,R=E-U,M=N-F,z=Math.hypot(R,M);if(z<1e-4)return;const Ae=R/z,$=M/z,V=-$,ie=Ae,re=E+V*z,ce=N+ie*z,Z=U+V*z,ee=F+ie*z,oe=(se,he)=>({x:U+Ae*z*se+V*z*he,y:F+$*z*se+ie*z*he});m.save();const le=["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 se=0;se<r.divisions;se++){const he=se/r.divisions,pe=(se+1)/r.divisions,ge=oe(0,he),be=oe(1,he),Ee=oe(1,pe),ye=oe(0,pe);m.beginPath(),m.moveTo(ge.x,ge.y),m.lineTo(be.x,be.y),m.lineTo(Ee.x,Ee.y),m.lineTo(ye.x,ye.y),m.closePath(),m.fillStyle=le[se%le.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const he=se/r.divisions,pe=oe(0,he),ge=oe(1,he),be=oe(he,0),Ee=oe(he,1);m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(ge.x,ge.y),m.stroke(),m.beginPath(),m.moveTo(be.x,be.y),m.lineTo(Ee.x,Ee.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(U,F),m.lineTo(re,ce),m.stroke(),m.beginPath(),m.moveTo(E,N),m.lineTo(Z,ee),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(U,F),m.lineTo(E,N),m.lineTo(re,ce),m.lineTo(Z,ee),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 ka{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:m=!0,pricesColor:y="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:C=!1,arrowRight:U=!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=u,this.showPrices=m,this.pricesColor=y,this.rayLeft=v,this.rayRight=T,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(N=>{if(!F.visible)return;const R=F._chart,M=F._series;if(!R||!M)return;const z=N.horizontalPixelRatio,Ae=N.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const ve=R.timeScale().timeToCoordinate(Ke.rawTime),Pe=M.priceToCoordinate(Ke.price);return ve==null||Pe==null?null:{x:ve*z,y:Pe*Ae}}).filter(Boolean);if($.length!==4)return;const[V,ie,re,ce]=$,Z=N.context;Z.save();const ee=ie.x-V.x,oe=ie.y-V.y,le=Math.sqrt(ee*ee+oe*oe)||1,se=ee/le,he=oe/le,pe=re.x-ce.x,ge=re.y-ce.y,be=Math.sqrt(pe*pe+ge*ge)||1,Ee=pe/be,ye=ge/be,Ce=1e5,Fe=F.rayLeft?{x:V.x-se*Ce,y:V.y-he*Ce}:V,Ue=F.rayRight?{x:ie.x+se*Ce,y:ie.y+he*Ce}:ie,Ne=F.rayLeft?{x:ce.x-Ee*Ce,y:ce.y-ye*Ce}:ce,Je=F.rayRight?{x:re.x+Ee*Ce,y:re.y+ye*Ce}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",ve=parseInt(Ke.slice(1,3),16),Pe=parseInt(Ke.slice(3,5),16),Be=parseInt(Ke.slice(5,7),16);Z.beginPath(),Z.moveTo(V.x,V.y),Z.lineTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.lineTo(ce.x,ce.y),Z.closePath(),Z.fillStyle=`rgba(${ve},${Pe},${Be},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*Ae,Z.setLineDash([]),Z.beginPath(),Z.moveTo(Fe.x,Fe.y),Z.lineTo(Ue.x,Ue.y),Z.moveTo(Ne.x,Ne.y),Z.lineTo(Je.x,Je.y),Z.moveTo(V.x,V.y),Z.lineTo(ce.x,ce.y),Z.moveTo(ie.x,ie.y),Z.lineTo(re.x,re.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*Ae,ve=(Pe,Be,de)=>{Z.save(),Z.translate(Pe,Be),Z.rotate(de),Z.beginPath(),Z.moveTo(0,0),Z.lineTo(-Ke,-Ke/2),Z.lineTo(-Ke,Ke/2),Z.closePath(),Z.fillStyle=F.lineColor,Z.fill(),Z.restore()};F.arrowLeft&&(ve(Fe.x,Fe.y,Math.atan2(-he,-se)),ve(Ne.x,Ne.y,Math.atan2(-ye,-Ee))),F.arrowRight&&(ve(Ue.x,Ue.y,Math.atan2(he,se)),ve(Je.x,Je.y,Math.atan2(ye,Ee)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*Ae,[V,ie,re,ce].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*Ae,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],ve=[V,ie,ce,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*Ae)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",ve.forEach((Pe,Be)=>{const de=Ke[Be]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),Pe.x+8*z,Pe.y)})}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 kd extends ka{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Od{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 u=o._chart,m=o._series;if(!u||!m)return;const y=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,C=R=>{const M=u.timeScale().timeToCoordinate(R.rawTime),z=m.priceToCoordinate(R.price);return M==null||z==null?null:{x:M*y,y:z*v}},U=C(o.p1),F=C(o.p2),E=C(o.b2),N=C(o.b1);!U||!F||!E||!N||(T.save(),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.lineTo(E.x,E.y),T.lineTo(N.x,N.y),T.closePath(),T.fillStyle=o.fillColor,T.fill(),T.strokeStyle=o.strokeColor,T.lineWidth=o.lineWidth*v,T.setLineDash([]),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.stroke(),T.beginPath(),T.moveTo(N.x,N.y),T.lineTo(E.x,E.y),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]}}class Oa{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(u=>{if(!l.visible)return;const m=l._chart,y=l._series;if(!m||!y)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,C=u.context,U=$=>{const V=m.timeScale().timeToCoordinate($.rawTime),ie=y.priceToCoordinate($.price);return V==null||ie==null?null:{x:V*v,y:ie*T}},F=U(l.mid1),E=U(l.mid2),N=U(l.top1),R=U(l.top2),M=U(l.bot1),z=U(l.bot2);if(!F||!E||!N||!R||!M||!z)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(E.x,E.y),C.lineTo(R.x,R.y),C.lineTo(N.x,N.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(z.x,z.y),C.lineTo(E.x,E.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const Ae=($,V,ie)=>{C.beginPath(),C.strokeStyle=ie,C.lineWidth=l.lineWidth*T,C.setLineDash([]),C.moveTo($.x,$.y),C.lineTo(V.x,V.y),C.stroke()};if(Ae(N,R,l.upperStrokeColor),Ae(F,E,l.centerStrokeColor),Ae(M,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){const ie=Math.max(10,Math.round(10*T));C.fillStyle=l.labelColor,C.font=`${ie}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(V,M.x+2*v,M.y+10*T)}}C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Kd extends Oa{}class Vd{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,u=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,v=A.p2.price,T=y-v,C=$=>v+T*$,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(y),N=o.priceToCoordinate(v),R=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):m,z=M-R;u.save(),A._zoneFills.forEach(({from:$,to:V,color:ie})=>{const re=C($),ce=C(V),Z=o.priceToCoordinate(re),ee=o.priceToCoordinate(ce);if(Z==null||ee==null)return;const oe=Math.round(Z*c),le=Math.round(ee*c);u.fillStyle=ie,u.fillRect(R,Math.min(oe,le),z,Math.abs(le-oe))}),A._levels.forEach(({ratio:$,label:V})=>{const ie=C($),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[$]||"#888888";u.beginPath(),u.strokeStyle=Z,u.lineWidth=$===0||$===1?1.5*c:1*c,$!==0&&$!==1&&$<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,ce),u.lineTo(M,ce),u.stroke(),u.setLineDash([])});const Ae=Math.round(11*c);if(u.font=`${Ae}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const ie=C($),re=o.priceToCoordinate(ie);if(re==null)return;const ce=Math.round(re*c),Z=A._levelColors[$]||"#888888",ee=`${V} (${ie.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(ee,R-4*l,ce-4*c)}),U!=null&&F!=null&&E!=null&&N!=null){const $=Math.round(U*l),V=Math.round(E*c),ie=Math.round(F*l),re=Math.round(N*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo($,V),u.lineTo(ie,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc($,V,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(ie,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Wv{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 u=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(u,0),y.lineTo(u,m),y.stroke();const v=Math.round(m/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;y.arc(u,v,T,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const T=n.time,C=new Date(typeof T=="number"?T*1e3:T),U=ie=>String(ie).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,E=Math.round(11*o.verticalPixelRatio);y.font=`${E}px ui-sans-serif, system-ui, sans-serif`,y.textBaseline="middle",y.textAlign="center";const N=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,Ae=N+2*R,$=u-Ae/2,V=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect($,V,Ae,z),y.fillStyle="#ffffff",y.fillText(F,u,V+z/2)}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function zd(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 Rv(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 u=c;for(;u.length>s;){let m=u.lastIndexOf(" ",s);m<=0&&(m=s),o.push(u.slice(0,m)),u=u.slice(m).trimStart()}o.push(u)};return A.split(`
11
- `).forEach(l),o.length===0&&o.push(""),o}function Wd(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=Rv(A.text??i?.text??"Text",r,n),o=s.reduce((T,C)=>Math.max(T,C.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,m=s.length*u+10,y=e-c/2,v=t-m;return{left:y,right:y+c,top:v,bottom:v+m+12}}class Gv{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.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),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const m=s.horizontalPixelRatio,y=s.verticalPixelRatio,v=Math.round(c*m),T=Math.round(u*y),C=s.context;C.save();const U=Math.round(r.fontSize*y);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,E=220*m,N=[],R=he=>{if(!r.textWrap||he.length===0){N.push(he);return}const pe=he.split(/\s+/);let ge="";for(const be of pe){const Ee=ge?`${ge} ${be}`:be;C.measureText(Ee).width<=E||!ge?ge=Ee:(N.push(ge),ge=be)}N.push(ge)};F.split(`
12
- `).forEach(R),N.length===0&&N.push("");const M=N.map(he=>C.measureText(he).width),z=Math.max(...M,20*m),Ae=8*m,$=5*y,V=z+Ae*2,ie=U*1.2,re=ie*N.length+$*2,ce=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,ee=T-re;r.bgEnabled&&(C.fillStyle=zd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,ee,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=zd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*y),C.beginPath(),C.rect(Z,ee,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=ce,C.textBaseline="middle";const oe=ce==="left"?Z+Ae:ce==="right"?Z+V-Ae:Z+V/2;for(let he=0;he<N.length;he++)C.fillText(N[he],oe,ee+$+ie*(he+.5));const le=5*y,se=T+10*y;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*y,C.arc(v,se,le,0,Math.PI*2),C.stroke(),C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const $v={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Rd(i){if(!i)return 7;const e=String(i).toUpperCase();return $v[e]??7}function Xv(i,e){const t=String(i||"").toUpperCase(),A=e||Rd(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 LA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:q(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)};function ot(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 u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Zv(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 u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Jv(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,u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function ti(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+1e-7)+s&&(A=!A)}return A}function Gd(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??q(i.rawTime),r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=q((A+r)/2),m=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:m}}}function Vi(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map($=>({time:q($.time),close:typeof $.close=="number"?$.close:parseFloat($.close)})).filter($=>$.time!=null&&Number.isFinite($.close)&&$.time>=s&&$.time<=o).sort(($,V)=>$.time-V.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,y=0,v=0;for(let $=0;$<c;$++){const V=$,ie=l[$].close;u+=V,m+=ie,y+=V*ie,v+=V*V}const T=c*v-u*u,C=Math.abs(T)<1e-12?0:(c*y-u*m)/T,U=(m-C*u)/c;let F=0;for(let $=0;$<c;$++){const V=U+C*$,ie=l[$].close-V;F+=ie*ie}const E=Math.sqrt(F/c),N=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=U,Ae=U+C*(c-1);return{slope:C,intercept:U,stdDev:E,offset:N,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:M,normalizedTime:M,price:Ae},top1:{rawTime:R,normalizedTime:R,price:z+N},top2:{rawTime:M,normalizedTime:M,price:Ae+N},bot1:{rawTime:R,normalizedTime:R,price:z-N},bot2:{rawTime:M,normalizedTime:M,price:Ae-N}}}function Hr(i,e,t,A=1){return Vi(i,e,t,A)}const Yv={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}},qv={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 jv(i,e){if(!i||!i.type)return!1;const t=Yv[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function eT(i){return i?qv[i]??"#22c55e":"#22c55e"}const tT=300,$d=24,AT=150,Xd=150;function Ka(i,e,t=tT){if(!Array.isArray(i)||i.length===0)return[];const A=iA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=q(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 iT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=q(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function rT(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 Ts(i,e,t,A){const r=q(e),n=q(t),s=iA(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=y=>{const v=rT(i,y);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],C=i[v];return Math.abs(y-T)<=Math.abs(C-y)?v-1:v},u=c(r),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function Zd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=iT(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 u=A.getVisibleLogicalRange(),m=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,y=Number.isFinite(m)&&m>20?m:120,v=Math.min(Xd,y/2),T=Math.max(20,y-v),C={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=iA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-AT*o,to:r+Xd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const nT=j.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:r,onSellClick:n},s){const o=j.useRef(null),l=j.useRef(null),c=j.useRef(null),u=j.useRef(null),m=j.useRef(null),y=j.useRef(null),v=j.useRef([]),T=j.useRef(!1),C=j.useRef(null),U=j.useRef(null),F=j.useRef(null),E=j.useRef(null),N=j.useRef([]),[R,M]=j.useState(null),[z,Ae]=j.useState(null),[$,V]=j.useState([]),[ie,re]=j.useState(null),[ce,Z]=j.useState([]),ee=j.useRef(null),oe=j.useRef(null),le=j.useRef(null),se=j.useRef(!1),he=j.useRef(!1);j.useEffect(()=>{le.current=R;let p=!1;v.current.forEach(g=>{if(g.type==="trendline"&&g.decoration){const k=g===R;g.decoration.isSelected!==k&&(g.decoration.isSelected=k,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const pe=j.useRef(new Map),ge=j.useRef(null),be=j.useRef(null),Ee=(p,g)=>`${p}_${g}`,ye=()=>{const p=Ee(Be,de);return pe.current.get(p)||null},Ce=p=>{if(!p)return;const g=Ee(Be,de);pe.current.set(g,p)},{activeTool:Fe,setActiveTool:Ue,showGrid:Ne,snapToGrid:Je,chartObjects:Ke,setChartObjects:ve,orders:Pe,selectedSymbol:Be,selectedTimeframe:de,drawingsVisible:ke,chartType:qe,chartLocked:At,theme:rt,baseUrl:Ge,endpoints:De,endpointParams:Ie,indicators:Qe,indicatorSettings:Te}=Ht(),He=j.useRef({}),[Se,Re]=j.useState({}),ze=j.useRef(0),Ye=j.useRef([]),[lt,gt]=j.useState(!1),[sA,eA]=j.useState(null),[Ze,IA]=j.useState([]),[Lt,yt]=j.useState(!0),[Gt,tA]=j.useState(null),[UT,cx]=j.useState(0),bs=j.useMemo(()=>{const p=Ze.map(g=>q(g?.time)).filter(g=>Number.isFinite(g));return p.sort((g,k)=>g-k),p},[Ze]),Qs=j.useRef(null),zi=j.useRef(new Map);j.useRef(null);const Ap=j.useRef(0),Ai=j.useRef(null),Nr=j.useRef(!1);j.useEffect(()=>{const p=m.current;p&&p.setData(Ka(Ze,de))},[Ze,de]),j.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*.8;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*1.25;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const g=p.querySelectorAll("canvas"),k=rt==="light"?"#ffffff":"#12161d";let we=null,H=0;if(g.forEach(X=>{if(X.width>0&&X.height>0){const J=X.width*X.height;J>H&&(H=J,we=X)}}),we)try{const X=document.createElement("canvas");X.width=we.width,X.height=we.height;const J=X.getContext("2d");J.fillStyle=k,J.fillRect(0,0,X.width,X.height),J.drawImage(we,0,0);const ne=document.createElement("a");ne.download=`chart-${Be}-${de}-${Date.now()}.png`,ne.href=X.toDataURL("image/png"),ne.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Qv(p,{useCORS:!0,allowTaint:!0,backgroundColor:k,scale:2,logging:!1}).then(X=>{const J=document.createElement("a");J.download=`chart-${Be}-${de}-${Date.now()}.png`,J.href=X.toDataURL("image/png"),J.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(X=>{console.error("Chart screenshot failed",X),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Be,de,rt]);const Wa=j.useMemo(()=>Ze.length===0?[]:qe==="line"||qe==="area"?Ze.map(p=>({time:p.time,value:p.close})):Ze,[Ze,qe]),ST=p=>{r?r(p):(eA("BUY"),gt(!0))},ET=p=>{n?n(p):(eA("SELL"),gt(!0))},LT=()=>{gt(!1),eA(null)},MT=p=>{const g=z;if(!g||!p)return;const k=(X,J)=>{if(typeof X!="string")return J;const ne=X.trim(),ae=ne.startsWith("#")?ne:`#${ne}`;return/^#[0-9A-Fa-f]{6}$/.test(ae)?ae.toLowerCase():J},we=(X,J)=>{const ne=Number(X);return Number.isFinite(ne)?Math.max(0,Math.min(1,ne)):J};let H={...g,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:g.visibleTimeframes};if(g.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):g.price,J=g.primitive;J&&(J.text=typeof p.text=="string"?p.text:J.text,J.color=k(p.color,J.color??"#5f8f96"),J.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):J.fontSize,J.fontWeight=p.fontWeight==="bold"?"bold":"normal",J.fontStyle=p.fontStyle==="italic"?"italic":"normal",J.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:J.textAlign,J.textWrap=!!p.textWrap,J.borderEnabled=!!p.borderEnabled,J.borderColor=k(p.borderColor,J.borderColor??"#5f8f96"),J.borderOpacity=we(p.borderOpacity,J.borderOpacity??.1),J.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),J.bgEnabled=!!p.bgEnabled,J.bgColor=k(p.bgColor,J.bgColor??"#5f8f96"),J.bgOpacity=we(p.bgOpacity,J.bgOpacity??.1),J.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:g.text}}if(g.type==="trendline"){const X=k(p.lineColor,"#22c55e"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(g.series)try{g.series.applyOptions({color:X,lineWidth:J})}catch{}const ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.point1?.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.point2?.price;if(g.series&&g.point1&&g.point2){const Y=g.point1.time??g.point1.rawTime,B=g.point2.time??g.point2.rawTime;try{const h=LA([{time:Y,value:ne},{time:B,value:ae}]);h.length>0&&g.series.setData(h)}catch{}}const S={...g.point1,price:ne},O={...g.point2,price:ae};g.decoration&&(g.decoration.color=X,g.decoration.lineWidth=J,g.decoration.arrowLeft=!!p.arrowLeft,g.decoration.arrowRight=!!p.arrowRight,g.decoration.rayLeft=!!p.rayLeft,g.decoration.rayRight=!!p.rayRight,g.decoration.statsColor=k(p.statsColor,"#5f8f96"),g.decoration.statsPosition=p.statsPosition??"right",g.decoration.statsShowAlways=!!p.statsShowAlways,g.decoration.statsPriceRange=!!p.statsPriceRange,g.decoration.statsBarsRange=!!p.statsBarsRange,g.decoration.statsDateRange=!!p.statsDateRange,g.decoration.statsAngle=!!p.statsAngle,g.decoration.statsDistance=!!p.statsDistance,g.decoration.p1=S,g.decoration.p2=O),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:S,point2:O,decoration:g.decoration}}if(g.type==="pricelevel"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,ae=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price;if(g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,lineWidth:J,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(ae&&S&&b)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h;else{const I=new _d(h,{text:S,textColor:O,hAlign:Y,vAlign:B});try{b.attachPrimitive(I)}catch{}g.textPrimitive=I}else if(g.textPrimitive&&b){try{b.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ne,showText:ae,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="horizontalray"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,ae=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=k(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price,b=g.primitive;if(b&&(b.price=h,b.color=X,b.lineWidth=J),g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(ae&&S&&I)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h,g.textPrimitive.originTime=g.rawOriginTime;else{const w=new _d(h,{text:S,textColor:O,hAlign:Y,vAlign:B,originTime:g.rawOriginTime});try{I.attachPrimitive(w)}catch{}g.textPrimitive=w}else if(g.textPrimitive&&I){try{I.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ne,showText:ae,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="verticalline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showDate!==!1,ae=g.primitive;ae&&(ae.color=X,ae.lineWidth=J,ae.showDate=ne),H={...H,lineColor:X,lineWidth:J,showDate:ne}}if(g.type==="infoline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.statsShowAlways!==!1,ae=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=!!p.statsAngle,b=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,d=g.p1.rawTime,_=g.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,x=g.p1.normalizedTime??0,f=g.p2.normalizedTime??0,D=iA(de)||3600,P=Math.abs(f-x),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=c.current,te=u.current,ue=G?G.timeScale().timeToCoordinate(d):null,me=te?te.priceToCoordinate(I):null,xe=G?G.timeScale().timeToCoordinate(_):null,Me=te?te.priceToCoordinate(w):null,$e=ue!=null&&me!=null&&xe!=null&&Me!=null?Math.atan2(-(Me-me),xe-ue)*(180/Math.PI):g.primitive?.info?.angle??0,et={priceDiff:Q,pricePct:L,bars:K,days:W,angle:$e},We=g.primitive;We&&(We.color=X,We.lineWidth=J,We.statsShowAlways=ne,We.statsColor=ae,We.statsPosition=S,We.statsPriceRange=O,We.statsBarsRange=Y,We.statsDateRange=B,We.statsAngle=h,We.statsDistance=b,We.p1={...g.p1,price:I},We.p2={...g.p2,price:w},We.info=et),H={...H,lineColor:X,lineWidth:J,statsShowAlways:ne,statsColor:ae,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B,statsAngle:h,statsDistance:b,p1:{...g.p1,price:I},p2:{...g.p2,price:w}}}if(g.type==="rulerline"){const X=k(p.lineColor,"#3b82f6"),J=p.showArea!==!1,ne=!!p.statsShowAlways,ae=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=g.primitive;h&&(h.lineColor=X,h.showArea=J,h.statsShowAlways=ne,h.statsColor=ae,h.statsPosition=S,h.statsPriceRange=O,h.statsBarsRange=Y,h.statsDateRange=B),H={...H,lineColor:X,showArea:J,statsShowAlways:ne,statsColor:ae,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B}}if(g.type==="arrowedline"){const X=k(p.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="rayline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="extendedline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="crossline"){const X=k(p.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.price))?Number(p.price):g.p.price,ae=g.primitive;ae&&(ae.color=X,ae.lineWidth=J,ae.showTime=!!p.showTime,ae.showPrice=!!p.showPrice,ae.center={...g.p,price:ne}),H={...H,lineColor:X,lineWidth:J,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...g.p,price:ne}}}if(g.type==="trendbyangle"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,ae=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=J,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=k(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:ae}),H={...H,lineColor:X,lineWidth:J,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:k(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:ae}}}if(g.type==="disjointchannel"){const X=k(p.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=k(p.fillColor,"#6aa84f"),ae=we(p.fillOpacity,.1),S=k(p.pricesColor,"#129f5c"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ne,h.fillOpacity=ae,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ne,fillOpacity:ae,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}if(g.type==="flattopbottom"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=k(p.fillColor,"#3b82f6"),ae=we(p.fillOpacity,.12),S=k(p.pricesColor,"#3b82f6"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ne,h.fillOpacity=ae,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ne,fillOpacity:ae,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}ve(X=>{const J=X.map(ne=>ne===g?H:ne);return v.current=J,J}),le.current===g&&(le.current=H),M(X=>X===g?H:X),re(X=>X===g?H:X),Ae(H);try{c.current?.applyOptions({})}catch{}};j.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getBoundingClientRect(),k=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},we=rt==="light",H=$0(p,{width:g.width||p.clientWidth,height:g.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:k},layout:{background:{color:we?"#FFFFFF":"#0d1117",type:"solid"},textColor:we?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Ne,color:Ne?we?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0},horzLines:{visible:Ne,color:Ne?we?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0}},rightPriceScale:{borderColor:we?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:we?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:we?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Fe===1?1:0,vertLine:{width:1,color:we?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:we?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:we?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:we?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Fe===1,horzLineVisible:Fe===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Fe===null||Fe===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}}),X=(typeof Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),J=X.includes("JPY"),ne=Or(X),ae=kr(X);let S,O;J?(S=.001,O=w=>Math.abs(Number(w)).toFixed(3)):ne?X.startsWith("BTC")||X.startsWith("ETH")?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(4)):ae&&(X.startsWith("XAU")||X.startsWith("XAG"))?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(5));const Y=H.addCandlestickSeries({upColor:we?"#089981":"#26a69a",downColor:we?"#f23645":"#ef5350",wickUpColor:we?"#089981":"#26a69a",wickDownColor:we?"#f23645":"#ef5350",borderUpColor:we?"#089981":"#26a69a",borderDownColor:we?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:S,formatter:O}}),B=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=Y,m.current=B,B.setData(Ka(Ze,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),b=()=>{if(he.current&&zi.current.size>0){const w=h.getVisibleRange();w&&Ce(w)}};h.subscribeVisibleTimeRangeChange(b);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const L=h.getVisibleRange();H.resize(_,Q),L&&setTimeout(()=>{try{h.setVisibleRange(L)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(b),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,y.current=null,v.current=[],Ai.current&&clearTimeout(Ai.current)}},[]),j.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Ne,color:Ne?"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0},horzLines:{visible:Ne,color:Ne?"rgba(110, 118, 129, 0.15)":"transparent",style:Ne?2:0}}})},[Ne]),j.useEffect(()=>{const p=c.current;if(!p)return;const g=rt==="light";p.applyOptions({layout:{background:{color:g?"#FFFFFF":"#12161d"},textColor:g?"#020617":"#fff"},grid:{vertLines:{color:Ne?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Ne?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:g?"#e5e7eb":"#1e293b"},timeScale:{borderColor:g?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1},horzLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1}}})},[rt,Ne]),j.useEffect(()=>{if(!c.current)return;const g=!At&&!(Fe!==null&&Fe!==1&&Fe!==0),k=!At;c.current.applyOptions({crosshair:{mode:Fe===1?1:0,vertLine:{visible:Fe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Fe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:k,pressedMouseMove:g,horzTouchDrag:g,vertTouchDrag:g},handleScale:{axisPressedMouseMove:{time:g,price:g},axisDoubleClickReset:{time:!1,price:k},axisTouch:{time:g,price:g},mouseWheel:k,pinch:k}})},[Fe,At]);const HT=()=>{const p=u.current;v.current.forEach(g=>{if(g.primitive){try{p&&p.detachPrimitive(g.primitive)}catch{}if(g.series&&g.series!==p)try{g.series.detachPrimitive(g.primitive)}catch{}}if(g.priceLine&&p)try{p.removePriceLine(g.priceLine)}catch{}if(g.textPrimitive&&p)try{p.detachPrimitive(g.textPrimitive)}catch{}}),v.current=[],ve([]),Ue(null)},ip=(p,g=!1)=>{p&&v.current.forEach(k=>{if(k.primitive){try{p.detachPrimitive(k.primitive)}catch{}try{p.attachPrimitive(k.primitive)}catch{}}if(g&&k.type==="pricelevel"&&k.priceLine)try{const we=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,axisLabelVisible:we,title:we&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}if(g&&k.type==="horizontalray"&&k.priceLine)try{const we=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:we,title:we&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}})};j.useEffect(()=>{(async()=>{if(!Be||!de){IA([]),he.current=!1;return}try{if(yt(!0),tA(null),IA([]),he.current=!1,Nr.current=!1,be.current!==null&&be.current!==Be&&HT(),be.current=Be,u.current)try{u.current.setData([])}catch{}const g=Rd(de),k=Xv(de,g),we=Ge||Sv?.VITE_BASE_URL||"http://localhost:5002",H=De?.candles||"/api/chart/candles",X=Ie?.candles||{},J={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},ne={};ne[J.symbol]=Be,ne[J.timeframe]=de,ne[J.limit]=k,X.daysBack!==!1&&(ne[J.daysBack]=g);const ae=await ht.get(`${we}${H}`,{params:ne,timeout:1e4});let S=[];if(Array.isArray(ae.data)?S=ae.data:ae.data&&ae.data.data&&Array.isArray(ae.data.data)?S=ae.data.data:ae.data&&Array.isArray(ae.data)&&(S=ae.data),S&&S.length>0){const{candles:O,stats:Y}=Ya(S,Be,de);O.length>0?(IA(O),zi.current=new Map,O.forEach(B=>{zi.current.set(B.time,B)}),Nr.current=!0,Qs.current?.connected&&Be&&de&&Qs.current.emit("subscribeCandles",{symbol:Be,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${Be}`),IA([]))}else console.warn(`⚠️ No candle data returned for ${Be}`),IA([])}catch(g){console.error(`❌ Error fetching ${Be}:`,g.message);const k=g.code==="ECONNABORTED"||g.message&&g.message.includes("timeout");tA(k?"Request timed out. No data available for this symbol.":g.message||"Failed to load candles."),IA([]),yt(!1)}})()},[Be,de,UT]),j.useEffect(()=>{Qs.current=bn.getSocket();const p=Qs.current,g=()=>{if(Nr.current&&Be&&de&&p.connected){const ne={symbol:Be,timeframe:de};p.emit("subscribeCandles",ne)}},k=()=>{setTimeout(()=>{Be&&de&&g()},200)},we=ne=>{},H=ne=>{};p.on("connect",k),p.on("disconnect",we),p.on("connect_error",H),p.on("subscription:confirmed",ne=>{ne.type});const X=ne=>{if(!Nr.current||!ne||!ne.candle||!ne.symbol)return;const ae=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(ae(ne.symbol)!==ae(Be)||ne.timeframe&&ne.timeframe!==de)return;const{candle:S}=ne,O=qa(S,Be,de);if(!O)return;const Y=Date.now();if(Y-Ap.current<200)return;Ap.current=Y;const B=c.current?.timeScale(),h=B?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!he.current&&!Nr.current||b?.seriesType?.()!==(qe==="line"?"Line":qe==="area"?"Area":qe==="bars"?"Bar":"Candlestick")))try{const _=zi.current.get(O.time),Q=!_,L=_?{time:O.time,open:_.open,high:Math.max(_.high,O.high),low:Math.min(_.low,O.low),close:O.close}:O;zi.current.set(O.time,L),Q&&m.current&&m.current.setData(Ka(Array.from(zi.current.values()),de));try{qe==="line"||qe==="area"?b.update({time:L.time,value:L.close}):b.update(L),B&&h&&Ce(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",X);const J=()=>{p.connected&&Be&&de&&g()};if(p.connected)J();else{const ne=()=>{setTimeout(J,200)};p.once("connect",ne),setTimeout(()=>{p.connected&&J()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",k),p.off("disconnect",we),p.off("connect_error",H),p.off("subscription:confirmed"),Be&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:Be,timeframe:de})}},[Be,de,Ge]),j.useEffect(()=>{const p=u.current,g=c.current;if(!(!p||!g)&&!(Ze.length===0&&he.current)){if(Ze.length===0&&!he.current){if(Lt)return;const k=g.timeScale();p.setData([]),k.fitContent(),Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(()=>requestAnimationFrame(()=>yt(!1)),400);return}if(!he.current){const k=(typeof Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),we=k.includes("JPY"),H=kr(k),X=Or(k);let J,ne;we?(J=.001,ne=h=>Math.abs(Number(h)).toFixed(3)):X?k.startsWith("BTC")||k.startsWith("ETH")?(J=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ne=h=>Math.abs(Number(h)).toFixed(4)):H&&(k.startsWith("XAU")||k.startsWith("XAG"))?(J=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ne=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:J,formatter:ne}})}catch{}const ae=g.timeScale(),S=Ee(Be,de);ge.current,ge.current=S;const O=[...Ze].sort((h,b)=>h.time-b.time);if(qe==="line"||qe==="area"){const h=O?.map(b=>({time:b.time,value:b.close})).filter(b=>b.time!=null);h.length>0&&p.setData(h)}else O?.length>0&&p.setData(O);ip(p);const Y=iA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=Ve(Q,Y);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=Ve(Q,Y);h.primitive.time=L,h.time=q(L);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=W=>{const G=Ve(W,Y);return x==null||f==null?G:Math.min(Math.max(G,x),f)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p1.normalizedTime=q(P),h.p2.rawTime=K,h.p2.normalizedTime=q(K),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=ue=>{const me=Ve(ue,Y);return x==null||f==null?me:Math.min(Math.max(me,x),f)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p2.rawTime=K,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:K,price:h.p2.price};const W=q(P),G=q(K),te=Math.abs((G??0)-(W??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:Ts(bs,P,K,de),days:Math.max(1,Math.round(te/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Ve(Q,Y),f=Ve(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=q(x),h.p2.rawTime=f,h.p2.normalizedTime=q(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Ve(L.rawTime,Y);L.rawTime=x,L.normalizedTime=q(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Ve(L.rawTime,Y);L.rawTime=x,L.normalizedTime=q(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="regressionchannel"&&h.primitive&&h.p1&&h.p2){const Q=Vi(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Hr(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y),x=Ve(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.p3.rawTime=x,h.p3.normalizedTime=q(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y),x=Ve(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.p3.rawTime=x,h.p3.normalizedTime=q(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=Ve(h.p1.rawTime,Y),L=Ve(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=q(Q),h.p2.rawTime=L,h.p2.normalizedTime=q(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const b=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=Ve(b,Y),d=Ve(I,Y);h.point1.time=w,h.point2.time=d;const _=LA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),O?.length>0){const h=O[O?.length-1].time,b=iA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*b;try{ae.setVisibleRange({from:w,to:h+b*$d})}catch{ae.fitContent()}}else ae.fitContent();try{g.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0;const B=ae.getVisibleRange();Ce(B),Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(()=>requestAnimationFrame(()=>yt(!1)),400)}}},[Ze.length,qe,Be,de]),j.useEffect(()=>{const p=c.current;if(!p||!he.current||Ze.length===0)return;const g=p.timeScale(),k=g.getVisibleRange()||ye();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let we;const H=(typeof Be=="string"?Be:Be?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),J=kr(H),ne=Or(H);let ae,S;X?(ae=.001,S=B=>Math.abs(Number(B)).toFixed(3)):ne?H.startsWith("BTC")||H.startsWith("ETH")?(ae=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(ae=1e-4,S=B=>Math.abs(Number(B)).toFixed(4)):J&&(H.startsWith("XAU")||H.startsWith("XAG"))?(ae=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(ae=1e-4,S=B=>Math.abs(Number(B)).toFixed(5));const O={type:"custom",minMove:ae,formatter:S};if(qe==="bars"){const B=rt==="light";we=p.addBarSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ze].sort((b,I)=>b.time-I.time);h?.length>0&&we.setData(h)}else if(qe==="line"){we=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=LA(Wa);B.length>0&&we.setData(B)}else if(qe==="area"){we=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=LA(Wa);B.length>0&&we.setData(B)}else if(qe==="volume ticks"||qe==="volume"){const B=rt==="light";we=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,priceScaleId:"right"});const h=[...Ze].sort((w,d)=>w.time-d.time);h?.length>0&&we.setData(h);const b=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.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)"}));I.length>0&&b.setData(I),y.current=b}else{const B=rt==="light";we=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ze].sort((b,I)=>b.time-I.time);h?.length>0&&we.setData(h)}u.current=we,ip(we,!0);const Y=iA(de)||60;if(v.current.forEach(B=>{if(B.type==="horizontalray"&&B.primitive){const L=B.rawOriginTime??B.primitive.originTime,x=Ve(L,Y);B.primitive.originTime=x,B.originTime=x;return}if(B.type==="verticalline"&&B.primitive){const L=B.rawTime??B.primitive.time,x=Ve(L,Y);B.primitive.time=x,B.time=q(x);return}if(B.type==="infoline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ze].sort((te,ue)=>te.time-ue.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=te=>{const ue=Ve(te,Y);return D==null||P==null?ue:Math.min(Math.max(ue,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p1.normalizedTime=q(W),B.p2.rawTime=G,B.p2.normalizedTime=q(G),B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};return}if(B.type==="rulerline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ze].sort((xe,Me)=>xe.time-Me.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,K=xe=>{const Me=Ve(xe,Y);return D==null||P==null?Me:Math.min(Math.max(Me,D),P)},W=K(L),G=K(x);B.p1.rawTime=W,B.p2.rawTime=G,B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:G,price:B.p2.price};const te=q(W),ue=q(G),me=Math.abs((ue??0)-(te??0));B.primitive.info={priceDiff:B.p2.price-B.p1.price,pricePct:(B.p2.price-B.p1.price)/Math.abs(B.p1.price||1)*100,bars:Ts(bs,W,G,de),days:Math.max(1,Math.round(me/86400))};return}if(B.type==="arrowedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="rayline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="extendedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="trendbyangle"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=Ve(L,Y),D=Ve(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=q(f),B.p2.rawTime=D,B.p2.normalizedTime=q(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="disjointchannel"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=Ve(x.rawTime,Y);x.rawTime=f,x.normalizedTime=q(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="flattopbottom"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=Ve(x.rawTime,Y);x.rawTime=f,x.normalizedTime=q(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="regressionchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ze].sort((D,P)=>D.time-P.time),x=Vi(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.intercept=x.intercept,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="stddevchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ze].sort((D,P)=>D.time-P.time),x=Hr(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="andrewspitchfork"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y),f=Ve(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.p3.rawTime=f,B.p3.normalizedTime=q(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="gannfan"||B.type==="ganngrid")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if((B.type==="circle"||B.type==="ellipse")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type==="triangle"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y),f=Ve(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.p3.rawTime=f,B.p3.normalizedTime=q(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="fibonacci"||B.type==="rectangle")&&B.primitive&&B.p1&&B.p2){const L=Ve(B.p1.rawTime,Y),x=Ve(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=q(L),B.p2.rawTime=x,B.p2.normalizedTime=q(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type!=="trendline"&&B.type!=="gannline"||!B.series||!B.point1||!B.point2)return;const h=B.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(B.series)}catch{}const b=p.addLineSeries({color:B.lineColor??h,lineWidth:B.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=B.point1.rawTime??B.point1.time,w=B.point2.rawTime??B.point2.time,d=Ve(I,Y),_=Ve(w,Y);B.point1.time=d,B.point2.time=_;const Q=LA([{time:d,value:B.point1.price},{time:_,value:B.point2.price}]);try{Q.length>0&&b.setData(Q)}catch{}if(B.decoration)try{b.attachPrimitive(B.decoration)}catch{}B.series=b}),k&&he.current)setTimeout(()=>{try{g.setVisibleRange(k),Ce(k)}catch{if(Ze.length>0)try{const h=Ze[Ze.length-1].time,b=iA(de)||60,I=h-100*b;g.setVisibleRange({from:I,to:h+b*$d}),Ce(g.getVisibleRange())}catch{g.fitContent(),Ce(g.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!he.current){g.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}he.current=!0,Ce(g.getVisibleRange())}},[qe,Ze.length,Wa.length,Be]),j.useEffect(()=>{const p=c.current,g=y.current;if(!p||!g||!he.current||Ze.length===0||qe!=="volume"&&qe!=="volume ticks")return;const we=[...Ze].sort((H,X)=>H.time-X.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));we.length>0&&g.setData(we)},[Ze,qe]),j.useEffect(()=>{if(!Be||!de||!Qe)return;const g=Object.entries(Qe).filter(([J,ne])=>ne).map(([J])=>J).filter(J=>J.startsWith("sma")||J.startsWith("ema")||J==="rsi"||J==="macd");if(g.length===0){Re({});return}const k=g.map(J=>J==="sma20"?`sma:${Te?.smaPeriod||20}`:J==="sma50"?"sma:50":J==="ema12"?`ema:${Te?.emaPeriod||12}`:J==="rsi"?`rsi:${Te?.rsiPeriod||14}`:J==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!k)return;const we=++ze.current,H=Ge||"http://localhost:5002",X=De?.indicators||"/api/market-data/indicators";ht.get(`${H}${X}`,{params:{symbol:Be,timeframe:de,indicators:k}}).then(J=>{we===ze.current&&Re(J.data?.data||{})}).catch(J=>{console.error("[ChartArea] Indicator fetch error:",J?.message),we===ze.current&&Re({})})},[Be,de,Qe,Te,Ge,De]),j.useEffect(()=>{const p=c.current;if(!p||!he.current)return;const g=He.current,k=(ae,S)=>(g[ae]||(g[ae]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...S})),g[ae]),we=ae=>{if(g[ae]){try{p.removeSeries(g[ae])}catch{}delete g[ae]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(we)},X=Qe||{};if(X.sma20&&Se.sma20?.data?.length?k("sma20",{color:"#2196F3",lineWidth:1.5}).setData(Se.sma20.data.map(S=>({time:S.time,value:S.value}))):we("sma20"),X.sma50&&Se.sma50?.data?.length?k("sma50",{color:"#FF9800",lineWidth:1.5}).setData(Se.sma50.data.map(S=>({time:S.time,value:S.value}))):we("sma50"),X.ema12&&Se.ema12?.data?.length?k("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(Se.ema12.data.map(S=>({time:S.time,value:S.value}))):we("ema12"),X.rsi&&Se.rsi?.data?.length){const ae=k("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:B=>B.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),ae.setData(Se.rsi.data.map(B=>({time:B.time,value:B.value}))),g.rsi70||(g.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),g.rsi30||(g.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const S=Se.rsi.data,O=S[0]?.time,Y=S[S.length-1]?.time;O&&Y&&(g.rsi70.setData([{time:O,value:70},{time:Y,value:70}]),g.rsi30.setData([{time:O,value:30},{time:Y,value:30}]))}else we("rsi"),we("rsi70"),we("rsi30");if(X.macd&&Se.macd?.data?.length){const ae=k("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}),S=k("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});g.macdHist||(g.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}));const O=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:O,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const Y=Se.macd.data;ae.setData(Y.map(B=>({time:B.time,value:B.value}))),S.setData(Y.map(B=>({time:B.time,value:B.signal}))),g.macdHist.setData(Y.map(B=>({time:B.time,value:B.histogram,color:B.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const J=X.rsi&&Se.rsi?.data?.length||X.macd&&Se.macd?.data?.length,ne=X.rsi&&Se.rsi?.data?.length&&X.macd&&Se.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:ne?.4:J?.25:.05}})}catch{}},[Se,Qe,Ze.length]),j.useEffect(()=>()=>{const p=c.current;if(!p)return;const g=He.current;Object.keys(g).forEach(k=>{try{p.removeSeries(g[k])}catch{}}),He.current={}},[Be,de]),j.useEffect(()=>{const p=c.current,g=u.current,k=o.current;if(!p||!g||!k)return;const H=Fe!==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"][Fe]:null,X=(S,O)=>{const Y=Math.min(S.time,O.time),B=Math.max(S.time,O.time),h=S.time<=O.time?S.rawTime:O.rawTime,b=S.time<=O.time?O.rawTime:S.rawTime,I=Math.max(S.price,O.price),w=Math.min(S.price,O.price),d=q(Math.round((Y+B)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:Y,price:w},p3:{rawTime:b,normalizedTime:B,price:w}}};if(!H){if(T.current=!1,C.current=null,U.current=null,E.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};ve(_=>[..._,d]),v.current.push(d),Ue(null)};return k.addEventListener("click",S),()=>{k.removeEventListener("click",S)}}if(H==="horizontalray"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Ev(I,b);g.attachPrimitive(w);const d=g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=q(b),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:b,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};ve(L=>[...L,Q]),v.current.push(Q),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="verticalline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=p.timeScale().coordinateToTime(B);if(h==null)return;const b=new Wv(h);g.attachPrimitive(b);const I=q(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};ve(d=>[...d,w]),v.current.push(w),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="text"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Gv(b,I);g.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};ve(_=>[..._,d]),v.current.push(d),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="infoline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;O||(O=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=S.normalizedTime,L=q(d);if(Q==null||L==null||Q===L)return;const x=Q<=L?[{time:Q,value:S.price},{time:L,value:_}]:[{time:L,value:_},{time:Q,value:S.price}];try{O.setData(x)}catch{}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d),x:I,y:w};return}if(O){try{p.removeSeries(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null)return;const x=_-S.price,f=x/Math.abs(S.price)*100,D=iA(de)||3600,P=Math.abs(L-Q),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=S.x,te=S.y,ue=I,xe=Math.atan2(-(w-te),ue-G)*(180/Math.PI),Me={priceDiff:x,pricePct:f,bars:K,days:W,angle:xe},$e=new Lv({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_},Me);g.attachPrimitive($e);const et={type:"infoline",primitive:$e,rawP1Time:S.rawTime,rawP2Time:d,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};ve(We=>[...We,et]),v.current.push(et),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{p.removeSeries(O)}catch{}}}if(H==="rulerline"){let S=null,O=null;const Y=(b,I,w,d)=>{const _=q(b),Q=q(w),L=d-I,x=L/Math.abs(I)*100,f=Ts(bs,b,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:x,bars:f,days:P}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null||L===S.normalizedTime)return;const x=Y(S.rawTime,S.price,_,Q);if(!O)O=new Pd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},x),g.attachPrimitive(O);else{O.p2={rawTime:_,price:Q},O.info=x;const f=Q>=S.price;O.color=f?"#3b82f6":"#ef5350",O.fillColor=f?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;if(!S){S={rawTime:_,price:Q,normalizedTime:q(_)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const L=S.normalizedTime,x=q(_);if(L==null||x==null)return;const f=Y(S.rawTime,S.price,_,Q),D=new Pd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},f);g.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:S.rawTime,rawP2Time:_,p1:{rawTime:S.rawTime,normalizedTime:L,price:S.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=S.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="arrowedline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;const Q=q(d);if(!(Q==null||Q===S.normalizedTime))if(!O)O=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null||Q===L)return;const x=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"arrowedline",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,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};ve(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(H==="rayline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new _v({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"rayline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},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};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="extendedline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new Pv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"extendedline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},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};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="crossline"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=new kv({rawTime:b,price:I});g.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};ve(Q=>[...Q,_]),v.current.push(_),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendbyangle"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=q(b),Q=q(d);if(_==null||Q==null)return;const L=new Ov({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"trendbyangle",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};ve(f=>[...f,x]),v.current.push(x),Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="disjointchannel"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new ka(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;const K=(S.price+O.price)/2;D>=K?(Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:2*K-D}):(B={rawTime:f,normalizedTime:P,price:D},Y={rawTime:f,normalizedTime:P,price:2*K-D}),I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new ka(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ue(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="flattopbottom"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new kd(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P==null)return;Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:O.price},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=k.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=q(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const K=g.coordinateToPrice(x);if(K==null||Math.abs(K-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:K},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const K=new kd(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:q(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:q(b.p4.rawTime),price:b.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};ve(G=>[...G,W]),v.current.push(W),Ue(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="regressionchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;const f=Vi(Ze,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Oa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Vi(Ze,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Oa({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,intercept:f.intercept,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="stddevchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;const f=Hr(Ze,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=k.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=q(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Hr(Ze,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Kd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};ve(K=>[...K,P]),v.current.push(P),S=null,Ue(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="andrewspitchfork"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d=B+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=q(_);if(Q==null)return;const L={rawTime:b,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},f={rawTime:b,normalizedTime:w,price:I},D=new Kv({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:f.rawTime,price:f.price});g.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:L,p2:x,p3:f};ve(K=>[...K,P]),v.current.push(P),M(P),le.current=P,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="gannfan"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new Vv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:d,p2:_};ve(x=>[...x,L]),v.current.push(L),M(L),le.current=L,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="ganngrid"){const S=O=>{const Y=k.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=q(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new zv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:d,p2:_};ve(x=>[...x,L]),v.current.push(L),M(L),le.current=L,Ue(null)};return k.addEventListener("click",S),()=>k.removeEventListener("click",S)}if(H==="trendline"||H==="gannline"){const S=H,O=S==="gannline"?"#7aa6ae":"#22c55e",Y=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(!(Q==null||L==null)&&(Q=q(Q),Q!=null))if(E.current===null){E.current={time:Q,price:L};const x=p.addLineSeries({color:O,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:S,series:x},x.setData([{time:Q,value:L}])}else{const x=E.current,f={time:Q,price:L},D=1,P=1e-5,K=Math.abs(f.time-x.time),W=Math.abs(f.price-x.price);if(K<D&&W<P){try{p.removeSeries(F.current.series)}catch{}E.current=null,F.current=null;return}const G={time:x.time,rawTime:x.time,price:x.price},te={time:f.time,rawTime:f.time,price:f.price},ue=LA([{time:G.time,value:G.price},{time:te.time,value:te.price}]);if(ue.length>0){F.current.series.setData(ue);const me=new Nv(G,te,O,2);try{F.current.series.attachPrimitive(me)}catch{}const xe={type:S,series:F.current.series,point1:G,point2:te,decoration:me};ve(Me=>[...Me,xe]),v.current.push(xe)}Ue(null),E.current=null,F.current=null}},B=I=>{if(E.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=k.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(Q==null||L==null||(Q=q(Q),Q==null))return;const x=E.current,f=LA([{time:x.time,value:x.price},{time:Q,value:L}]);f.length>0&&F.current.series.setData(f)},h=I=>{I.stopPropagation()},b={capture:!0,passive:!1};return k.addEventListener("click",Y,b),k.addEventListener("mousemove",B,b),k.addEventListener("mousemove",h,b),()=>{if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}k.removeEventListener("click",Y,b),k.removeEventListener("mousemove",B,b),k.removeEventListener("mousemove",h,b)}}if(H==="parallellines"){let S=null,O=null,Y=null,B=0,h=null;const b=(L,x,f,D)=>{L.p1={rawTime:x.rawTime,price:x.price},L.p2={rawTime:f.rawTime,price:f.price},L.b1={rawTime:D.b1.rawTime,price:D.b1.price},L.b2={rawTime:D.b2.rawTime,price:D.b2.price},L.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(L,x,f)=>{const D=Gd(L,x,f);if(!D)return null;if(!h)h=new Od({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),g.attachPrimitive(h);else{b(h,L,x,D);try{p.applyOptions({})}catch{}}return D},w=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const x=k.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(B===0){S={rawTime:P,normalizedTime:W,price:K},B=1;return}if(B===1){if(O={rawTime:P,normalizedTime:W,price:K},Math.abs(O.normalizedTime-S.normalizedTime)<1)return;const G=q((S.normalizedTime+O.normalizedTime)/2);if(G==null)return;const te=(S.price+O.price)/2;Y={rawTime:G,normalizedTime:G,price:te},I(S,O,Y),B=2;return}if(B===2&&S&&O){Y={rawTime:P,normalizedTime:W,price:K};const G=I(S,O,Y);if(!G||!h)return;try{g.detachPrimitive(h)}catch{}const te=new Od({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:G.b1.rawTime,price:G.b1.price},{rawTime:G.b2.rawTime,price:G.b2.price},{rawTime:G.bottomMid.rawTime,price:G.bottomMid.price});g.attachPrimitive(te);const ue={type:"equidistantchannel",primitive:te,p1:S,p2:O,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};ve(me=>[...me,ue]),v.current.push(ue),Ue(null),B=0,S=null,O=null,Y=null,h=null}}},d=L=>{if(B===0||!S)return;const x=k.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),K=g.coordinateToPrice(D);if(P==null||K==null)return;const W=q(P);if(W!=null){if(B===1){const G={rawTime:P,normalizedTime:W,price:K},te=q((S.normalizedTime+G.normalizedTime)/2);if(te==null)return;const ue=(S.price+G.price)/2;I(S,G,{rawTime:te,normalizedTime:te,price:ue});return}B===2&&O&&I(S,O,{rawTime:P,normalizedTime:W,price:K})}},_=L=>{L.stopPropagation()},Q={capture:!0,passive:!1};return k.addEventListener("click",w,Q),k.addEventListener("mousemove",d,Q),k.addEventListener("mousemove",_,Q),()=>{if(B=0,S=null,O=null,Y=null,N.current=[],h)try{g.detachPrimitive(h)}catch{}h=null,k.removeEventListener("click",w,Q),k.removeEventListener("mousemove",d,Q),k.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let S=null,O=null;const Y=h=>{if(!S)return;const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(!(d==null||_==null))if(!O)O=new Vd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},B=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:q(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=q(d);if(Q==null||L==null)return;if(Math.abs(_-S.price)<1e-5){S=null;return}const x=new Vd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"fibonacci",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_}};ve(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const J=S=>{if(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=q(h),h!=null){if(T.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:b},U.current=null,H==="rectangle"){const w=new Mv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Hv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});g.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new Iv({rawTime:I,price:b},{rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Dv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});g.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},ne=S=>{if(!T.current||!C.current||!F.current)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const O=k.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=q(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:b};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:b});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=b,L=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:L}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:L}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:b}])},ae=S=>{if(S&&(S.preventDefault(),S.stopPropagation()),!T.current||!F.current||!C.current)return;const O=C.current,Y=U.current||O;if(F.current.type==="parallellines")if(F.current.firstLine){const B={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};ve(h=>[...h,B]),v.current.push(B),Ue(null),F.current=null,T.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:O.time,startPrice:O.price,endTime:Y.time,endPrice:Y.price},T.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const B=C.current,h=U.current||B,b=Math.max(B.price,h.price),I=Math.min(B.price,h.price),w=q(Math.min(B.time,h.time)),d=q(Math.max(B.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(b-I)>=1e-5){const _=F.current.primitive,Q=B.time<=h.time?B.rawTime:h.rawTime,L=B.time<=h.time?h.rawTime:B.rawTime,x={rawTime:Q,normalizedTime:w,price:b},f={rawTime:L,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:f.rawTime,price:f.price};const D={type:"rectangle",primitive:_,p1:x,p2:f};ve(P=>[...P,D]),v.current.push(D),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price};const L={type:"circle",primitive:B,p1:h,p2:b};ve(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const B=F.current.primitive,h=X(O,Y);if(h){const b=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(b>=1&&I>=1e-5){B.p1={rawTime:h.p1.rawTime,price:h.p1.price},B.p2={rawTime:h.p2.rawTime,price:h.p2.price},B.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:B,p1:h.p1,p2:h.p2,p3:h.p3};ve(d=>[...d,w]),v.current.push(w),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price},B.previewAsLine=!1,B.minorRatio=.45;const L={type:"ellipse",primitive:B,p1:h,p2:b,minorRatio:.45};ve(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const S={capture:!0,passive:!1},O=Y=>{T.current||Y.stopPropagation()};return k.addEventListener("mousedown",J,S),k.addEventListener("mousemove",ne,S),k.addEventListener("mousemove",O,S),k.addEventListener("mouseup",ae,S),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,C.current=null,U.current=null,k.removeEventListener("mousedown",J,S),k.removeEventListener("mousemove",ne,S),k.removeEventListener("mousemove",O,S),k.removeEventListener("mouseup",ae,S)}}},[Fe,Ze,ve,Ue]),j.useEffect(()=>{const p=c.current,g=u.current,k=o.current,we=Fe===null||Fe===1;if(!we||!p||!g||!k){we||(M(null),V([]),re(null),Z([]));return}const H=10,X=8;function J(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=Math.min(b,w),Q=Math.max(b,w),L=Math.min(I,d),x=Math.max(I,d),f=(_+Q)/2,D=(L+x)/2;return[{x:_,y:L},{x:f,y:L},{x:Q,y:L},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:f,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=(b+w)/2,Q=(I+d)/2,L=w-b,x=d-I,f=Math.hypot(L,x);if(f<.001)return[];const D=L/f,P=x/f,K=-P,W=D,G=f/2,te=G*Math.max(.05,h.minorRatio??.45);return[{x:_-D*G,y:Q-P*G},{x:_+K*te,y:Q+W*te},{x:_+D*G,y:Q+P*G},{x:_-K*te,y:Q-W*te}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const b=p.timeScale().timeToCoordinate(h.p.rawTime),I=g.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=g.priceToCoordinate(h.price);return b==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:b}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const b=p.timeScale().timeToCoordinate(h.rawTime),I=g.priceToCoordinate(h.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=g.priceToCoordinate(h.b1.price),L=p.timeScale().timeToCoordinate(h.b2.rawTime),x=g.priceToCoordinate(h.b2.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:(_+L)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const b=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(b),d=g.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=g.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.originTime),w=g.priceToCoordinate(b.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.time);if(I==null)return[];const w=b.midYCss??200;return[{x:I,y:w}]}return[]}function ne(h,b){for(let I=Ke.length-1;I>=0;I--){const w=Ke[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.min(d,Q),f=Math.max(d,Q),D=Math.min(_,L),P=Math.max(_,L),K=(x+f)/2,W=(D+P)/2,G=[{x,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:f,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:f,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:K,y:P,mode:"handle7"},{x:f,y:P,mode:"handle8"}];for(const Me of G)if(Math.hypot(h-Me.x,b-Me.y)<H)return{object:w,mode:Me.mode};const te=ot(h,b,x,D,f,D),ue=ot(h,b,x,P,f,P),me=ot(h,b,x,D,x,P),xe=ot(h,b,f,D,f,P);if(te<X||ue<X||me<X||xe<X||ti(h,b,[{x,y:D},{x:f,y:D},{x:f,y:P},{x,y:P}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(Q-d,L-_);if(x<2)continue;const f=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-L);if(f<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(f-x)<X||f<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=ot(h,b,d,_,Q,L),G=ot(h,b,Q,L,x,f),te=ot(h,b,x,f,d,_);if(W<X||G<X||te<X||ti(h,b,[{x:d,y:_},{x:Q,y:L},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Q-d,P=L-_,K=Math.hypot(D,P);if(K<2)continue;const W=D/K,G=P/K,te=-G,ue=W,me=K/2,xe=me*Math.max(.05,w.minorRatio??.45);if(me<2||xe<2)continue;const Me=x-W*me,$e=f-G*me,et=x+te*xe,We=f+ue*xe,dt=x+W*me,at=f+G*me,pt=x-te*xe,bt=f-ue*xe,Kt=Math.hypot(h-Me,b-$e),$t=Math.hypot(h-et,b-We),AA=Math.hypot(h-dt,b-at),DA=Math.hypot(h-pt,b-bt);if(Kt<H)return{object:w,mode:"handle1"};if($t<H)return{object:w,mode:"handle2"};if(AA<H)return{object:w,mode:"handle3"};if(DA<H)return{object:w,mode:"handle4"};const yi=(h-x)*W+(b-f)*G,Fs=(h-x)*te+(b-f)*ue,sp=yi/me,op=Fs/xe,ap=sp*sp+op*op;if(Math.abs(ap-1)<.2||ap<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Zv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Jv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=g.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,b-_)<H)return{object:w,mode:"handle1"};const L=Math.abs(b-_),x=Math.abs(h-d);if(L<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=g.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=Wd(w,d,_);if(h>=Q.left&&h<=Q.right&&b>=Q.top&&b<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),f=g.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=g.priceToCoordinate(w.b2.price),K=x!=null&&D!=null?(x+D)/2:null,W=f!=null&&P!=null?(f+P)/2:null;if(d==null||_==null||Q==null||L==null||K==null||W==null||x==null||f==null||D==null||P==null)continue;const G=Math.hypot(h-d,b-_),te=Math.hypot(h-Q,b-L),ue=Math.hypot(h-K,b-W),me=Math.hypot(d-K,_-W)<H*1.5;if(me&&Math.min(G,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle2"};if(me)continue;if(G<H)return{object:w,mode:"handle1"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(xe<X||Me<X||ti(h,b,[{x:d,y:_},{x:Q,y:L},{x:D,y:P},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P),$e=ot(h,b,K,W,G,te);if(xe<X||Me<X||$e<X||ti(h,b,[{x,y:f},{x:D,y:P},{x:G,y:te},{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 d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||K==null||W==null||G==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P),$e=ot(h,b,K,W,G,te);if(xe<X||Me<X||$e<X||ti(h,b,[{x,y:f},{x:D,y:P},{x:G,y:te},{x:K,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"handle3"};const W=(Q+x)/2,G=(L+f)/2;let te=W-d,ue=G-_;Math.abs(te)<1e-4&&(te=1e-4);const me=ue/te,xe=k.clientWidth,Me=L+me*(xe-Q),$e=f+me*(xe-x),et=ot(h,b,Q,L,xe,Me),We=ot(h,b,x,f,xe,$e);if(et<X||We<X||ti(h,b,[{x:Q,y:L},{x:xe,y:Me},{x:xe,y:$e},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Me<X||ti(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const K=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),G=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(K<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if(G<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Me=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Me<X||ti(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(K<H)return{object:w,mode:"line"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),L=g.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),f=g.priceToCoordinate(w.p2.price);if(Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-Q,b-L),P=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ot(h,b,Q,L,x,f)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=g.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};const L=_==null?0:Math.max(0,_);if(h>=L&&Math.abs(b-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=g.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,b-d)<H)return{object:w,mode:"line"};if(Math.abs(b-d)<X)return{object:w,mode:"line"}}}return null}const ae=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ne(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,Ae(d.object),ee.current=null,oe.current=null;return}M(d.object),re(null),Z([]),ee.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.object.type==="horizontalray"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}),d.object.type==="verticalline"&&(d.mode==="handle1"||d.mode==="line")&&(oe.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?oe.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?oe.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?oe.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?oe.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?oe.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?oe.current={y:w,price:d.object.price}:oe.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else M(null),ee.current=null,V([]),re(null),Z([])},S=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!ee.current){const x=ne(I,w);if(x?.object&&!le.current){const f=J(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===f.length&&D.every((P,K)=>P.x===f[K].x&&P.y===f[K].y)?D:f)}else re(f=>f==null?f:null),Z(f=>f.length===0?f:[]);return}const d=le.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=g.coordinateToPrice(w);if(_==null||Q==null)return;let L=q(_);if(L!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??q(W);return{rawTime:W,normalizedTime:G,price:K.price}},f=(K,W)=>{const G=K.normalizedTime??q(K.rawTime),te=W.normalizedTime??q(W.rawTime);if(G==null||te==null)return;const ue=W.price-K.price,me=ue/Math.abs(K.price)*100,xe=iA(de)||3600,Me=Math.abs(te-G),$e=Math.max(1,Math.round(Me/xe)),et=Math.max(1,Math.round(Me/86400)),We=p.timeScale().timeToCoordinate(K.rawTime),dt=g.priceToCoordinate(K.price),at=p.timeScale().timeToCoordinate(W.rawTime),pt=g.priceToCoordinate(W.price),bt=We!=null&&dt!=null&&at!=null&&pt!=null?Math.atan2(-(pt-dt),at-We)*(180/Math.PI):d.primitive?.info?.angle??0,Kt={priceDiff:ue,pricePct:me,bars:$e,days:et,angle:bt},$t=d.primitive;if($t){$t.p1={rawTime:K.rawTime,price:K.price},$t.p2={rawTime:W.rawTime,price:W.price},$t.info=Kt;try{c.current?.applyOptions({})}catch{}}const AA={...d,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:te,price:W.price}};ve(DA=>{const yi=DA.map(Fs=>Fs===d?AA:Fs);return v.current=yi,yi}),M(AA),le.current=AA,We!=null&&dt!=null&&at!=null&&pt!=null&&V([{x:We,y:dt},{x:at,y:pt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(ee.current==="handle1"){const K=p.timeScale().coordinateToTime(I)??_;f({rawTime:K,normalizedTime:L,price:Q},P)}else if(ee.current==="handle2"){const K=p.timeScale().coordinateToTime(I)??_;f(D,{rawTime:K,normalizedTime:L,price:Q})}else if(ee.current==="line"){const K=oe.current;if(!K)return;const W=x(K.p1),G=x(K.p2);if(W.rawTime==null||W.normalizedTime==null||G.rawTime==null||G.normalizedTime==null)return;const te=p.timeScale().coordinateToTime(K.x)??W.rawTime,ue=g.coordinateToPrice(K.y);if(te==null||ue==null)return;const me=q(te)??W.normalizedTime;if(me==null)return;const xe=L-me,Me=Q-ue,$e=q(W.normalizedTime+xe),et=q(G.normalizedTime+xe);if($e==null||et==null)return;const We=_-te;f({rawTime:W.rawTime+We,normalizedTime:$e,price:W.price+Me},{rawTime:G.rawTime+We,normalizedTime:et,price:G.price+Me})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(f,D)=>{const P=f.normalizedTime??f.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-f.price,G=W/Math.abs(f.price)*100,te=Ts(bs,f.rawTime,D.rawTime,de),ue=Math.abs(K-P),me=Math.max(1,Math.round(ue/86400)),xe={priceDiff:W,pricePct:G,bars:te,days:me},Me=d.primitive;if(Me){Me.p1={rawTime:f.rawTime,price:f.price},Me.p2={rawTime:D.rawTime,price:D.price},Me.info=xe;const pt=D.price>=f.price;Me.color=pt?"#3b82f6":"#ef5350",Me.fillColor=pt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const $e={...d,rawP1Time:f.rawTime,rawP2Time:D.rawTime,p1:f,p2:D};ve(pt=>{const bt=pt.map(Kt=>Kt===d?$e:Kt);return v.current=bt,bt}),M($e),le.current=$e;const et=p.timeScale().timeToCoordinate(f.rawTime),We=g.priceToCoordinate(f.price),dt=p.timeScale().timeToCoordinate(D.rawTime),at=g.priceToCoordinate(D.price);et!=null&&We!=null&&dt!=null&&at!=null&&V([{x:et,y:We},{x:(et+dt)/2,y:(We+at)/2},{x:dt,y:at}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;x(d.p1,{rawTime:f,normalizedTime:D,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p:D};ve(te=>{const ue=te.map(me=>me===d?K:me);return v.current=ue,ue}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(D.rawTime),G=g.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=g.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const f=c.current?c.current.paneSize().width:400,D=g.priceToCoordinate(x);D!=null&&V([{x:f/2,y:D}]);const P={...d,price:x};ve(K=>{const W=K.map(G=>G===d?P:G);return v.current=W,W}),M(P),le.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const f=d.primitive;if(f){f.rawTime=x,f.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(me=>{const xe=me.map(Me=>Me===d?K:Me);return v.current=xe,xe}),M(K),le.current=K;const W=p.timeScale().timeToCoordinate(f.rawTime),G=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&G!=null&&te!=null&&ue!=null&&V([{x:W,y:G},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"||ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=Gd(f,D,P);if(!K)return;const W=d.primitive;if(W){W.p1={rawTime:f.rawTime,price:f.price},W.p2={rawTime:D.rawTime,price:D.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 G={...d,p1:f,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};ve(te=>{const ue=te.map(me=>me===d?G:me);return v.current=ue,ue}),M(G),le.current=G};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??q(d.p3.rawTime),price:Q});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Vi(Ze,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Hr(Ze,f,D,d.stdMultiplier??1);if(!P)return;const K=d.primitive;if(K){K.mid1={rawTime:P.p1.rawTime,price:P.p1.price},K.mid2={rawTime:P.p2.rawTime,price:P.p2.price},K.top1={rawTime:P.top1.rawTime,price:P.top1.price},K.top2={rawTime:P.top2.rawTime,price:P.top2.price},K.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},K.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const K=d.primitive;if(K){K.p1={rawTime:f.rawTime,price:f.price},K.p2={rawTime:D.rawTime,price:D.price},K.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:f,p2:D,p3:P};ve(G=>{const te=G.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),le.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,d.p2,{rawTime:f,normalizedTime:L,price:Q});return}if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K),ue=q(f.p3.normalizedTime+K);if(G==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:G.rawTime,price:G.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:te,p4:ue};ve(Me=>{const $e=Me.map(et=>et===d?xe:et);return v.current=$e,$e}),M(xe),le.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,te,ue)=>{const me=W.normalizedTime??q(W.rawTime);if(me==null)return null;const xe=q(me+te);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const te=q(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-G,Me=K(f.p1,ue,me,xe),$e=K(f.p2,ue,me,xe),et=K(f.p3,ue,me,xe),We=K(f.p4,ue,me,xe);if(!Me||!$e||!et||!We)return;x(Me,$e,et,We);return}if(ee.current==="handle1"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x(G,te,f.p3,f.p4);return}if(ee.current==="handle3"){const W=(f.p3.price+f.p4.price)/2,G={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x(f.p1,f.p2,G,te);return}if(ee.current==="handle2"){const W=(f.p1.price+f.p2.price)/2,G={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:2*W-Q};if(te.normalizedTime==null)return;x(te,G,f.p3,f.p4);return}if(ee.current==="handle4"){const W=Q-f.p4.price,G={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+W};if(G.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+W};if(te.normalizedTime==null)return;x(f.p1,te,f.p3,G);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:G.rawTime,price:G.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:G,p3:te,p4:ue};ve(Me=>{const $e=Me.map(et=>et===d?xe:et);return v.current=$e,$e}),M(xe),le.current=xe},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;const K=(W,G,te,ue)=>{const me=W.normalizedTime??q(W.rawTime);if(me==null)return null;const xe=q(me+te);return xe==null?null:{rawTime:W.rawTime+G,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),G=g.coordinateToPrice(f.y);if(W==null||G==null)return;const te=q(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-G,Me=K(f.p1,ue,me,xe),$e=K(f.p2,ue,me,xe),et=K(f.p3,ue,me,xe),We=K(f.p4,ue,me,xe);if(!Me||!$e||!et||!We)return;x(Me,$e,et,We);return}if(ee.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p2.price};x(W,G,f.p3,f.p4);return}if(ee.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:f.p4.price};x(f.p1,f.p2,W,G);return}if(ee.current==="handle2"||ee.current==="handle4"){const W=ee.current==="handle2"?f.p2:f.p4,G=Q-W.price,te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??q(f.p1.rawTime),price:f.p2.price+G},ue={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??q(f.p3.rawTime),price:f.p4.price+G};if(te.normalizedTime==null||ue.normalizedTime==null)return;x(f.p1,te,f.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(at,pt)=>{const bt=d.primitive;if(bt){bt.p1={rawTime:at.rawTime,price:at.price},bt.p2={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Kt={...d,p1:at,p2:pt};ve($t=>{const AA=$t.map(DA=>DA===d?Kt:DA);return v.current=AA,AA}),M(Kt),le.current=Kt},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(ee.current==="line"){const at=p.timeScale().coordinateToTime(f.x),pt=g.coordinateToPrice(f.y);if(at==null||pt==null)return;const bt=q(at);if(bt==null)return;const Kt=P-bt,$t=Q-pt,AA=q(f.p1.normalizedTime+Kt),DA=q(f.p2.normalizedTime+Kt);if(AA==null||DA==null)return;const yi=_-at;x({rawTime:f.p1.rawTime+yi,normalizedTime:AA,price:f.p1.price+$t},{rawTime:f.p2.rawTime+yi,normalizedTime:DA,price:f.p2.price+$t});return}const K=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),W=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),G=Math.max(f.p1.price,f.p2.price),te=Math.min(f.p1.price,f.p2.price),ue=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,me=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let xe=K,Me=W,$e=G,et=te,We=ue,dt=me;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(xe=P,We=D),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(Me=P,dt=D),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&($e=Q),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(et=Q),xe>Me){const at=xe,pt=We;xe=Me,We=dt,Me=at,dt=pt}if($e<et){const at=$e;$e=et,et=at}x({rawTime:We,normalizedTime:xe,price:$e},{rawTime:dt,normalizedTime:Me,price:et});return}if(d.type==="circle"&&d.p1&&d.p2){const x=($e,et)=>{const We=d.primitive;if(We){We.p1={rawTime:$e.rawTime,price:$e.price},We.p2={rawTime:et.rawTime,price:et.price};try{c.current?.applyOptions({})}catch{}}const dt={...d,p1:$e,p2:et};ve(at=>{const pt=at.map(bt=>bt===d?dt:bt);return v.current=pt,pt}),M(dt),le.current=dt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=D-G,ue=Q-W,me=q(P.p1.normalizedTime+te),xe=q(P.p2.normalizedTime+te);if(me==null||xe==null)return;const Me=_-K;x({rawTime:P.p1.rawTime+Me,normalizedTime:me,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Me,normalizedTime:xe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(We,dt,at)=>{const pt=d.primitive;if(pt){pt.p1={rawTime:We.rawTime,price:We.price},pt.p2={rawTime:dt.rawTime,price:dt.price},pt.p3={rawTime:at.rawTime,price:at.price};try{c.current?.applyOptions({})}catch{}}const bt={...d,p1:We,p2:dt,p3:at};ve(Kt=>{const $t=Kt.map(AA=>AA===d?bt:AA);return v.current=$t,$t}),M(bt),le.current=bt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=q(f);if(D==null)return;if(ee.current==="handle1"){x({rawTime:f,normalizedTime:D,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:f,normalizedTime:D,price:Q});return}const P=oe.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=D-G,ue=Q-W,me=_-K,xe=We=>{const dt=We.normalizedTime??q(We.rawTime);if(dt==null)return null;const at=q(dt+te);return at==null?null:{rawTime:We.rawTime+me,normalizedTime:at,price:We.price+ue}},Me=xe(P.p1),$e=xe(P.p2),et=xe(P.p3);if(!Me||!$e||!et)return;x(Me,$e,et);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(K,W,G=d.minorRatio??.45)=>{const te=d.primitive;if(te){te.p1={rawTime:K.rawTime,price:K.price},te.p2={rawTime:W.rawTime,price:W.price},te.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:K,p2:W,minorRatio:Math.max(.05,G)};ve(me=>{const xe=me.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),M(ue),le.current=ue},f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=q(D);if(P==null)return;if(ee.current==="line"){const K=p.timeScale().coordinateToTime(f.x),W=g.coordinateToPrice(f.y);if(K==null||W==null)return;const G=q(K);if(G==null)return;const te=P-G,ue=Q-W,me=q(f.p1.normalizedTime+te),xe=q(f.p2.normalizedTime+te);if(me==null||xe==null)return;const Me=_-K;x({rawTime:f.p1.rawTime+Me,normalizedTime:me,price:f.p1.price+ue},{rawTime:f.p2.rawTime+Me,normalizedTime:xe,price:f.p2.price+ue},f.minorRatio??d.minorRatio??.45);return}if(ee.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(ee.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const K=p.timeScale().timeToCoordinate(d.p1.rawTime),W=g.priceToCoordinate(d.p1.price),G=p.timeScale().timeToCoordinate(d.p2.rawTime),te=g.priceToCoordinate(d.p2.price);if(K==null||W==null||G==null||te==null)return;const ue=(K+G)/2,me=(W+te)/2,xe=G-K,Me=te-W,$e=Math.hypot(xe,Me);if($e<.001)return;const et=-Me/$e,We=xe/$e,dt=Math.abs((I-ue)*et+(w-me)*We),at=Math.max(.05,dt*2/$e);x(d.p1,d.p2,at);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:f,p2:D};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=oe.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const K=L-q(D),W=Q-P,G=q(f.p1.normalizedTime+K),te=q(f.p2.normalizedTime+K);if(G==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:G,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const f={...d,time:q(_),rawTime:_};ve(P=>{const K=P.map(W=>W===d?f:W);return v.current=K,K}),M(f),le.current=f;const D=p.timeScale().timeToCoordinate(_);D!=null&&V([{x:D,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,f=oe.current;if(!f)return;if(ee.current==="handle1"){if(x.price=Q,x.originTime=_,d.priceLine)try{d.priceLine.applyOptions({price:Q,title:d.showPrice!==!1?Q.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=Q,d.textPrimitive.originTime=_);const D={...d,price:x.price,originTime:x.originTime,rawOriginTime:_};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D,c.current?.applyOptions({})}else if(ee.current==="line"){const D=g.coordinateToPrice(f.y);if(D==null)return;const P=Q-D;if(x.price=f.price+P,d.priceLine)try{d.priceLine.applyOptions({price:x.price,title:d.showPrice!==!1?x.price.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=x.price);const K={...d,price:x.price};ve(W=>{const G=W.map(te=>te===d?K:te);return v.current=G,G}),M(K),le.current=K,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(ee.current==="handle1"){const x={time:L,price:Q},f=LA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D}else if(ee.current==="handle2"){const x={time:L,price:Q},f=LA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};ve(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),le.current=D}else if(ee.current==="line"){const x=oe.current;if(!x)return;const f=p.timeScale().coordinateToTime(x.x),D=g.coordinateToPrice(x.y);if(f==null||D==null)return;const P=L-f,K=Q-D,W={time:q(x.point1.time+P),price:x.point1.price+K},G={time:q(x.point2.time+P),price:x.point2.price+K},te=LA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);te.length>0&&d.series.setData(te),d.decoration&&(d.decoration.p1=W,d.decoration.p2=G);const ue={...d,point1:W,point2:G};ve(me=>{const xe=me.map(Me=>Me===d?ue:Me);return v.current=xe,xe}),M(ue),le.current=ue}}}},O=()=>{ee.current=null,oe.current=null},Y=()=>{ee.current||le.current||(re(null),Z([]))},B={capture:!0,passive:!1};return k.addEventListener("mousedown",ae,B),k.addEventListener("mousemove",S,B),k.addEventListener("mouseup",O,B),k.addEventListener("mouseleave",Y,B),()=>{k.removeEventListener("mousedown",ae,B),k.removeEventListener("mousemove",S,B),k.removeEventListener("mouseup",O,B),k.removeEventListener("mouseleave",Y,B)}},[Fe,Ze,Ke,ve]),j.useEffect(()=>{const p=c.current,g=u.current;if(!p||!g)return;const k=()=>{const H=R;if(!H){V([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const J=H.p1.rawTime??H.p1.time,ne=H.p2.rawTime??H.p2.time,ae=X.timeToCoordinate(J),S=g.priceToCoordinate(H.p1.price),O=X.timeToCoordinate(ne),Y=g.priceToCoordinate(H.p2.price);ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:(J+ae)/2,y:(ne+S)/2},{x:ae,y:S}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="crossline"&&H.p){const J=X.timeToCoordinate(H.p.rawTime),ne=g.priceToCoordinate(H.p.price);J!=null&&ne!=null?V([{x:J,y:ne}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const J=X.timeToCoordinate(H.rawTime),ne=g.priceToCoordinate(H.price);J!=null&&ne!=null?V([{x:J,y:ne}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.b1.rawTime),Y=g.priceToCoordinate(H.b1.price),B=X.timeToCoordinate(H.b2.rawTime),h=g.priceToCoordinate(H.b2.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:(O+B)/2,y:(Y+h)/2}]):V([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y},{x:B,y:h}]):V([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),ae=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),ae=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:(J+ae)/2,y:(ne+S)/2},{x:ae,y:S}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(J!=null&&ne!=null&&ae!=null&&S!=null){const O=Math.min(J,ae),Y=Math.max(J,ae),B=Math.min(ne,S),h=Math.max(ne,S),b=(O+Y)/2,I=(B+h)/2;V([{x:O,y:B},{x:b,y:B},{x:Y,y:B},{x:O,y:I},{x:Y,y:I},{x:O,y:h},{x:b,y:h},{x:Y,y:h}])}else V([]);return}if(H.type==="circle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);J!=null&&ne!=null&&ae!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ne},{x:ae,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(J!=null&&ne!=null&&ae!=null&&S!=null){const O=(J+ae)/2,Y=(ne+S)/2,B=ae-J,h=S-ne,b=Math.hypot(B,h);if(b<.001){V([]);return}const I=B/b,w=h/b,d=-w,_=I,Q=b/2,L=Q*Math.max(.05,H.minorRatio??.45);V([{x:O-I*Q,y:Y-w*Q},{x:O+d*L,y:Y+_*L},{x:O+I*Q,y:Y+w*Q},{x:O-d*L,y:Y-_*L}])}else V([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),ae=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);J!=null&&ne!=null&&ae!=null&&S!=null?V([{x:J,y:ne},{x:ae,y:S}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const J=H.primitive,ne=X.timeToCoordinate(J.originTime),ae=g.priceToCoordinate(J.price);ne!=null&&ae!=null?V([{x:ne,y:ae}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const J=H.primitive,ne=X.timeToCoordinate(J.time);if(ne!=null){const ae=J.midYCss??200;V([{x:ne,y:ae}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const J=u.current?.priceToCoordinate(H.price);if(J!=null){const ne=c.current?c.current.paneSize().width:400;V([{x:ne/2,y:J}])}else V([]);return}V([])};k();const we=p.timeScale();return we.subscribeVisibleTimeRangeChange(k),()=>{we.unsubscribeVisibleTimeRangeChange(k)}},[R]),j.useEffect(()=>{let p=!1;v.current.forEach(g=>{if(g.type==="verticalline"&&g.primitive){const k=g===R||g===ie;g.primitive.showDot!==k&&(g.primitive.showDot=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,ie]),j.useEffect(()=>{let p=!1;v.current.forEach(g=>{if((g.type==="infoline"||g.type==="rulerline"||g.type==="arrowedline"||g.type==="rayline"||g.type==="extendedline"||g.type==="trendbyangle")&&g.primitive){const k=g===R||g===ie;g.primitive.isActive!==k&&(g.primitive.isActive=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,ie]),j.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:ke}),p.priceLine){const g=ke&&p.showPrice!==!1;p.priceLine.applyOptions(ke?{color:p.lineColor??"#3b82f6",axisLabelVisible:g,title:g&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=ke;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=ke;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:ke}),p.parallelLine&&p.parallelLine.applyOptions({visible:ke}),p.firstLine&&p.firstLine.applyOptions({visible:ke}),p.secondLine&&p.secondLine.applyOptions({visible:ke})),(p.type==="horizontalray"||p.type==="verticalline"||p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="crossline"||p.type==="trendbyangle"||p.type==="equidistantchannel"||p.type==="regressionchannel"||p.type==="stddevchannel"||p.type==="gannfan"||p.type==="ganngrid"||p.type==="andrewspitchfork"||p.type==="disjointchannel"||p.type==="flattopbottom"||p.type==="circle"||p.type==="triangle"||p.type==="ellipse"||p.type==="text")&&p.primitive){p.primitive.visible=ke;try{c.current?.applyOptions({})}catch{}}})},[ke,Ke]),j.useEffect(()=>{!ke&&R&&(M(null),V([]))},[ke,R]),j.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((g,k)=>!Ke.includes(g));R&&p.some(g=>g===R)&&(M(null),V([])),p.forEach(g=>{if(g.series&&c.current?.removeSeries(g.series),g.priceLine&&u.current?.removePriceLine(g.priceLine),g.textPrimitive)try{u.current?.detachPrimitive(g.textPrimitive)}catch{}if(g.type==="horizontalray"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="verticalline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="infoline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rulerline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="arrowedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rayline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="extendedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="crossline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="trendbyangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="equidistantchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="regressionchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="stddevchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="gannfan"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ganngrid"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="andrewspitchfork"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="disjointchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="flattopbottom"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="fibonacci"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rectangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="circle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="triangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ellipse"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="text"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="parallellines")try{g.baseLine&&c.current?.removeSeries(g.baseLine),g.parallelLine&&c.current?.removeSeries(g.parallelLine),g.firstLine&&c.current?.removeSeries(g.firstLine),g.secondLine&&c.current?.removeSeries(g.secondLine)}catch{}}),v.current=Ke}},[Ke,R]),j.useEffect(()=>{const p=u.current;return p?(Ye.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Ye.current=[],Pe.filter(k=>k.symbol===Be).forEach(k=>{const we=parseFloat(k.price);if(isNaN(we))return;const X=k.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350",J=p.createPriceLine({price:we,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${k.type} ${k.volume} @ ${k.price}`,textColor:X});Ye.current.push(J)}),()=>{Ye.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Ye.current=[]}):void 0},[Pe,Be]),j.useEffect(()=>{const p=o.current;if(!p)return;const g=k=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const we=c.current,H=u.current;if(we&&H&&v.current.length>0){const X=p.getBoundingClientRect(),J=k.clientX-X.left,ne=k.clientY-X.top,ae=15;for(let S=v.current.length-1;S>=0;S--){const O=v.current[S];let Y=!1;if(O.type==="text"&&O.rawTime!=null&&O.price!=null){const B=we.timeScale().timeToCoordinate(O.rawTime),h=H.priceToCoordinate(O.price);if(B!=null&&h!=null){const b=Wd(O,B,h);J>=b.left&&J<=b.right&&ne>=b.top&&ne<=b.bottom&&(Y=!0)}}else if(O.point1&&O.point2){const B=we.timeScale().timeToCoordinate(O.point1.time??O.point1.rawTime),h=H.priceToCoordinate(O.point1.price),b=we.timeScale().timeToCoordinate(O.point2.time??O.point2.rawTime),I=H.priceToCoordinate(O.point2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.hypot(J-B,ne-h),d=Math.hypot(J-b,ne-I),_=(B+b)/2,Q=(h+I)/2,L=Math.hypot(J-_,ne-Q);(w<ae||d<ae||L<ae)&&(Y=!0)}}else if(O.p1&&O.p2){const B=we.timeScale().timeToCoordinate(O.p1.rawTime),h=H.priceToCoordinate(O.p1.price),b=we.timeScale().timeToCoordinate(O.p2.rawTime),I=H.priceToCoordinate(O.p2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.min(B,b),d=Math.max(B,b),_=Math.min(h,I),Q=Math.max(h,I);J>=w-5&&J<=d+5&&ne>=_-5&&ne<=Q+5&&(Y=!0)}}else if(O.p){const B=we.timeScale().timeToCoordinate(O.p.rawTime),h=H.priceToCoordinate(O.p.price);B!=null&&h!=null&&Math.hypot(J-B,ne-h)<ae&&(Y=!0)}else if(O.type==="pricelevel"&&O.price!=null){const B=H.priceToCoordinate(O.price);B!=null&&Math.abs(ne-B)<ae&&(Y=!0)}if(Y){k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),Ae(O);return}}}k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;Zd(c.current,Ze,de)||c.current.timeScale().fitContent();const J=c.current.timeScale().getVisibleRange();Ce(J)},80)};return p.addEventListener("dblclick",g,!0),()=>{p.removeEventListener("dblclick",g,!0)}},[Ze,de]);const rp=R??ie,np=R?$:ce,IT=ke&&jv(rp,np),DT=eT(rp?.type);j.useEffect(()=>{const p=o.current,g=l.current;if(!p||!g)return;const k=80,we=X=>{const J=p.getBoundingClientRect();g.style.opacity=J.bottom-X.clientY<=k?"1":"0"},H=()=>{g.style.opacity="0"};return p.addEventListener("mousemove",we),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",we),p.removeEventListener("mouseleave",H)}},[]);const _T=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*.8;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},[Ce]),PT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const k=g.to-g.from,we=(g.from+g.to)/2,H=k*1.25;try{p.setVisibleRange({from:we-H/2,to:we+H/2}),Ce(p.getVisibleRange())}catch{}},[Ce]),NT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const k=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from-k,to:g.to-k})}catch{}},[]),kT=j.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const k=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from+k,to:g.to+k})}catch{}},[]),OT=j.useCallback(()=>{if(!c.current)return;Zd(c.current,Ze,de)||c.current.timeScale().fitContent();const g=c.current.timeScale().getVisibleRange();Ce(g)},[Ze,de,Ce]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${rt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Fe===1||Fe!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Lt&&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 Be=="object"?Be?.symbol:Be,"..."]})]})}),!Lt&&Gt&&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:rt==="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:rt==="light"?"#64748b":"#94a3b8"},children:Gt})]})}),!Lt&&!Gt&&Ze.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:rt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Be=="object"?Be?.symbol:Be]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Fh,{bidPrice:e,askPrice:t,onBuyClick:ST,onSellClick:ET})}),a.jsx(Uh,{isOpen:lt,onClose:LT,orderType:sA,bidPrice:e,askPrice:t}),a.jsx(Hh,{isOpen:z!==null,onClose:()=>Ae(null),chartObject:z,onUpdate:MT}),Lt&&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"}})}),IT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:np.map((p,g)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:DT}},g))}),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:PT,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:_T,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:NT,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:kT,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:OT,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:p,onClick:g,icon:k})=>a.jsx("button",{title:p,onClick:g,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:rt==="light"?"#374151":"#94a3b8",border:"1px solid "+(rt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:we=>{we.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",we.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",we.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:k},p))})]})})}),Bt={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 Jd({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Ht(),[s,o]=j.useState(!1),[l,c]=j.useState(""),[u,m]=j.useState(-1),y=j.useRef(null),v=j.useRef(null);j.useEffect(()=>{const E=N=>{y.current&&!y.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),j.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),C=T.filter(E=>!E.symbol.endsWith("USDT")),U=T.filter(E=>E.symbol.endsWith("USDT")),F=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:y,style:{...Bt.container,...i},className:e,children:[a.jsxs("button",{style:Bt.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,Bt.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...Bt.arrow,...s?Bt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Bt.dropdown,children:[a.jsx("div",{style:Bt.searchContainer,children:a.jsx("input",{ref:v,style:Bt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:Bt.list,children:T.length===0?a.jsx("div",{style:Bt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Bt.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...Bt.item,...E.symbol===t?Bt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Bt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Bt.symbolPrice,...parseFloat(E.change)>=0?Bt.priceUp:Bt.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Bt.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...Bt.item,...E.symbol===t?Bt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:Bt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Bt.symbolPrice,...parseFloat(E.change)>=0?Bt.priceUp:Bt.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const MA={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"}},sT=[.01,.05,.1,.5,1];function Yd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=sT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,y]=j.useState(.1),v=i!==void 0?i:m,T=j.useCallback(E=>{const N=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(N/r)*r,M=parseFloat(R.toFixed(8));i!==void 0||y(M),e?.(M)},[t,A,r,i,e]),C=()=>T(v+r),U=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...MA.container,...c},className:u,children:[o&&a.jsx("span",{style:MA.label,children:l}),a.jsx("button",{style:MA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,MA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:MA.input,type:"text",value:F,onChange:E=>{const N=E.target.value;if(N===""||N==="."||N==="0.")return;const R=parseFloat(N);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:MA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,MA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:MA.presets,children:n.map(E=>a.jsx("button",{style:{...MA.preset,...Math.abs(v-E)<1e-4?MA.presetActive:{}},onClick:()=>T(E),onMouseEnter:N=>{Math.abs(v-E)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(v-E)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const qt={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#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 qd({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:u,className:m}){const{currentSymbolData:y}=Ht(),[v,T]=j.useState(""),[C,U]=j.useState(!1),[F,E]=j.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=j.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),Ae=j.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=j.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const Z=parseFloat(ce);isNaN(Z)||$(ce)},ie=M==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...qt.container,...u},className:m,children:[l&&a.jsx("span",{style:qt.label,children:c}),s&&a.jsx("button",{style:{...qt.toggle,...R?qt.toggleOn:qt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...qt.toggleKnob,...R?qt.knobOn:qt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:qt.inputGroup,children:[a.jsx("input",{style:qt.input,type:"text",value:N,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...qt.modeBtn,...M==="price"?qt.modeBtnActive:{}},onClick:()=>Ae("price"),children:"Price"}),a.jsx("button",{style:{...qt.modeBtn,...M==="pips"?qt.modeBtnActive:{}},onClick:()=>Ae("pips"),children:"Pips"})]})]})]})}const jt={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 jd({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:u,className:m}){const{currentSymbolData:y}=Ht(),[v,T]=j.useState(""),[C,U]=j.useState(!1),[F,E]=j.useState("price"),N=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=j.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),Ae=j.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=j.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const ce=re.target.value;if(ce===""||ce==="."||ce==="0."){$(ce);return}const Z=parseFloat(ce);isNaN(Z)||$(ce)},ie=M==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...jt.container,...u},className:m,children:[l&&a.jsx("span",{style:jt.label,children:c}),s&&a.jsx("button",{style:{...jt.toggle,...R?jt.toggleOn:jt.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...jt.toggleKnob,...R?jt.knobOn:jt.knobOff}})}),(R||!s)&&a.jsxs("div",{style:jt.inputGroup,children:[a.jsx("input",{style:jt.input,type:"text",value:N,onChange:V,placeholder:ie,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...jt.modeBtn,...M==="price"?jt.modeBtnActive:{}},onClick:()=>Ae("price"),children:"Price"}),a.jsx("button",{style:{...jt.modeBtn,...M==="pips"?jt.modeBtnActive:{}},onClick:()=>Ae("pips"),children:"Pips"})]})]})]})}const oT=[{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:"─"}],HA={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 ep({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:u,chartObjects:m,setChartObjects:y}=Ht(),[v,T]=j.useState(null),C=A||oT,U=N=>{l(o===N?null:N)},F=()=>{y([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...HA.container,...n},className:s,children:[i&&a.jsx("span",{style:HA.label,children:r}),C.map(N=>a.jsxs("button",{style:{...HA.btn,...o===N.id?HA.btnActive:{}},onClick:()=>U(N.id),onMouseEnter:R=>{T(N.id),o!==N.id&&Object.assign(R.currentTarget.style,HA.btnHover)},onMouseLeave:R=>{T(null),o!==N.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,v===N.id&&a.jsx("div",{style:HA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:HA.divider}),t&&a.jsx("button",{style:{...HA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,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:HA.deleteBtn,onClick:F,onMouseEnter:N=>Object.assign(N.currentTarget.style,HA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const tp={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 aT({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:u,onStopLossEnabledChange:m,takeProfit:y,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:E={},takeProfitProps:N={},drawingToolsProps:R={},style:M,className:z}){const Ae=[];i&&Ae.push(a.jsx(Jd,{...U},"coin")),e&&Ae.push(a.jsx(Yd,{value:s,onChange:o,...F},"volume")),t&&Ae.push(a.jsx(qd,{value:l,onChange:c,enabled:u,onEnabledChange:m,...E},"sl")),A&&Ae.push(a.jsx(jd,{value:y,onChange:v,enabled:T,onEnabledChange:C,...N},"tp")),r&&Ae.push(a.jsx(ep,{...R},"draw"));const $=[];return Ae.forEach((V,ie)=>{$.push(V),n&&ie<Ae.length-1&&$.push(a.jsx("div",{style:tp.divider},`div-${ie}`))}),a.jsx("div",{style:{...tp.toolbar,...M},className:z,children:$})}const lT=[{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"}],Va={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 cT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Ht();return a.jsx("div",{style:{...Va.container,...i},className:e,children:lT.map(r=>a.jsx("button",{style:{...Va.btn,...t===r.value?Va.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 hT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],za={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 uT({style:i,className:e}){const{chartType:t,setChartType:A}=Ht();return a.jsx("div",{style:{...za.container,...i},className:e,children:hT.map(r=>a.jsxs("button",{style:{...za.btn,...t===r.value?za.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 Rt={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 dT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Ht(),[u,m]=j.useState(null),y=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&y>0?Math.abs(v-y):0,C=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),U=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",F=j.useCallback(E=>{if(!s)return;const N=E==="BUY"?v:y;if(!N||N<=0){m({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,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(z=>[...z,R]);const M=i*N*.01;c(z=>z-M),m({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>m(null),3e3)},[s,v,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...Rt.container,...r},className:n,children:[a.jsx("button",{style:Rt.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Rt.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Bid"}),a.jsx("span",{style:{...Rt.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:Rt.spread,children:[a.jsx("span",{style:Rt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Rt.spreadValue,children:U(T)})]}),a.jsxs("div",{style:Rt.priceBox,children:[a.jsx("span",{style:Rt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Rt.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:Rt.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Rt.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...Rt.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const it={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 pT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Ht(),[l,c]=j.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),m=j.useCallback((C,U)=>{const F=n.find(E=>E.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),y=j.useCallback(C=>{if(l)return;c(C.id);const U=m(C.symbol,C.type),E=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,N=C.volume*C.price*.01;r(R=>R.filter(M=>M.id!==C.id)),o(R=>R+N+E),c(null)},[l,m,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},T=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...it.container,...i},className:e,children:[a.jsxs("div",{style:it.header,children:[a.jsxs("span",{style:it.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:it.summary,children:[a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...it.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...it.scrollArea,maxHeight:t},children:a.jsxs("table",{style:it.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:it.th,children:"Symbol"}),a.jsx("th",{style:it.th,children:"Type"}),a.jsx("th",{style:it.th,children:"Volume"}),a.jsx("th",{style:it.th,children:"Open Price"}),a.jsx("th",{style:it.th,children:"Current"}),a.jsx("th",{style:it.th,children:"SL"}),a.jsx("th",{style:it.th,children:"TP"}),a.jsx("th",{style:it.th,children:"Profit"}),a.jsx("th",{style:it.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:it.emptyRow,children:"No open positions"})}):u.map(C=>{const U=m(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...it.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...it.td,...C.type?.toUpperCase()==="BUY"?it.typeBuy:it.typeSell},children:C.type}),a.jsx("td",{style:it.td,children:C.volume}),a.jsx("td",{style:it.td,children:v(C.price)}),a.jsx("td",{style:it.td,children:v(U)}),a.jsx("td",{style:it.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:it.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...it.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:it.td,children:a.jsx("button",{style:{...it.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>y(C),disabled:l===C.id,onMouseEnter:E=>{l!==C.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function fT(i){return zt({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 gT(i){return zt({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 mT(i){return zt({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 wT(i){return zt({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 BT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:m=!0,onToggleMarketWatch:y,buySellPanelOpen:v,onMove:T})=>{const{theme:C}=Ht(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={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.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"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
- ${A===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
- `,title:N,children:E[N]},N))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${U?"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
- ${A===N?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
16
- `,title:N,children:E[N]},N))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(N=>a.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?U?"text-sky-600":"text-sky-400":U?"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 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"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 ${U?"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 ${U?"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 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(fT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(gT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:T,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>y?.(),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?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"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 ${U?"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:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"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"})})})]})]})},Ir=[{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"})]})}],Dr=[{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"})})}],_r=[{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"})})}],Pr=[{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"})})}],xs=({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})}),yT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:m,setDrawingsVisible:y,chartLocked:v,setChartLocked:T,theme:C,setTheme:U,setIsShow:F}=Ht(),[E,N]=j.useState(!1),[R,M]=j.useState(null),[z,Ae]=j.useState(null),[$,V]=j.useState(0),[ie,re]=j.useState(!1),[ce,Z]=j.useState(0),[ee,oe]=j.useState(!1),[le,se]=j.useState(0),[he,pe]=j.useState(!1),[ge,be]=j.useState(0),[Ee,ye]=j.useState(!1),[Ce,Fe]=j.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ue=j.useRef(null),Ne=j.useRef(null),Je=j.useRef(null),Ke=j.useRef(null),ve=j.useRef(null),Pe=j.useRef(null);j.useEffect(()=>{const De=Ie=>{const Qe=Ue.current;E&&Qe&&!Qe.contains(Ie.target)&&(N(!1),M(null));const Te=Ne.current;z==="line"&&Te&&!Te.contains(Ie.target)&&Ae(null);const He=Je.current;z==="channel"&&He&&!He.contains(Ie.target)&&Ae(null);const Se=Ke.current;z==="gann"&&Se&&!Se.contains(Ie.target)&&Ae(null);const Re=ve.current;z==="shape"&&Re&&!Re.contains(Ie.target)&&Ae(null)};return window.addEventListener("mousedown",De),()=>window.removeEventListener("mousedown",De)},[E,z]),j.useEffect(()=>{const De=Ie=>{Ie.key==="Escape"&&(N(!1),M(null),Ae(null))};return window.addEventListener("keydown",De),()=>window.removeEventListener("keydown",De)},[]);const Be=j.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"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),de=De=>{const Ie=Be[De].label;if(Ie==="Menu"){N(Qe=>!Qe),M(null);return}if(Ie==="Grid"){s(!n);return}if(Ie==="Magnet"){l(!o),r(o?null:De);return}if(Ie==="Delete"){if(c.length>0){const Qe=[...c];Qe.pop(),u(Qe)}return}if(Ie==="Eye"){y(!m);return}if(Ie==="Lock"){T(!v);return}if(Ie==="Light Theme"||Ie==="Dark Theme"){U(C==="light"?"dark":"light"),N(!1),M(null);return}if(Ie==="History"){F(!0);return}r(A===De?null:De)};Be.slice(0,12);const ke=Be.slice(12),qe=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],At=[{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"})]})},{label:"Open Demo account",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",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),a.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),a.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),a.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon: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:"Trade Position",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:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),a.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),a.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",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 19L8 14L12 19H4Z",fill:"#3183FF"}),a.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),a.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP 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)"},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.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),a.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),a.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",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:"Trade Notification",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:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{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:"oneclick",label:"One Click Trading",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:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon: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"})]})},{label:"Arabic",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"})]})},{label:"Bulgarian",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",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:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon: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:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],rt=({item:De})=>{const Ie=!!De.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Pe.current&&(clearTimeout(Pe.current),Pe.current=null),Ie&&M(De.key)},onMouseLeave:()=>{Ie&&(Pe.current=setTimeout(()=>M(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{Ie?M(Qe=>Qe===De.key?null:De.key):(De.key==="theme"&&U(Qe=>Qe==="light"?"dark":"light"),N(!1),M(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:De.label}),De.rightText&&a.jsx("span",{className:`text-xs ${Ge?"text-slate-500":"text-slate-400"}`,children:De.rightText}),Ie&&a.jsx("svg",{className:`w-4 h-4 ${Ge?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ie&&R===De.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:De.submenu.map((Qe,Te)=>{const He=Ce[De.key]===Qe.label||Qe.selected&&Ce[De.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{Fe(Se=>({...Se,[De.key]:Qe.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:Qe.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Qe.label}),He&&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"})})})]},Te)})})})]})},Ge=C==="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 ${Ge?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:qe.map((De,Ie)=>{const Qe=De==="gann",Te=Qe?null:Be[De],He=Qe?-1:De;return a.jsxs(j.Fragment,{children:[He===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Ir[$].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
- ${A===Ir[$].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Ir[$].label,children:Ir[$].icon}),a.jsx("span",{onMouseEnter:()=>re(!0),onMouseLeave:()=>re(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:ie?10:7,height:ie?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:Ge?"#64748b":"#94a3b8"})})})]}):He===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Dr[ce].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
- ${A===Dr[ce].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Dr[ce].label,children:Dr[ce].icon}),a.jsx("span",{onMouseEnter:()=>oe(!0),onMouseLeave:()=>oe(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:ee?10:7,height:ee?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:Ge?"#64748b":"#94a3b8"})})})]}):Qe?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=_r[le].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
- ${A===_r[le].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:_r[le].label,children:_r[le].icon}),a.jsx("span",{onMouseEnter:()=>pe(!0),onMouseLeave:()=>pe(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="gann"?null:"gann")},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 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:Ge?"#64748b":"#94a3b8"})})})]}):He===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Se=Pr[ge].toolId;r(A===Se?null:Se)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
- ${A===Pr[ge].toolId?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Pr[ge].label,children:Pr[ge].icon}),a.jsx("span",{onMouseEnter:()=>ye(!0),onMouseLeave:()=>ye(!1),onMouseDown:Se=>{Se.stopPropagation(),Ae(Re=>Re==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:Ee?10:7,height:Ee?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:Ge?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>de(He),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
- ${Te.label==="Grid"&&n||Te.label==="Eye"&&!m||Te.label==="Lock"&&v||A===He?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Te.label}: ${Te.description}`,children:Te.icon}),!Qe&&Te.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Ge?"border-slate-200":"border-slate-700"}`})]},Qe?"gann-slot":`${Te.label}-${De}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:ke.map((De,Ie)=>{const Qe=12+Ie;return a.jsx("button",{onClick:()=>de(Qe),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
- ${De.label==="Grid"&&n||De.label==="Eye"&&!m||De.label==="Lock"&&v||A===Qe?Ge?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ge?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${De.label}: ${De.description}`,children:De.icon},De.label)})})]}),z==="line"&&a.jsx(xs,{top:84,panelRef:Ne,isLight:Ge,children:Ir.map((De,Ie)=>{const Qe=$===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),V(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&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"})})})]},De.toolId)})}),z==="channel"&&a.jsx(xs,{top:128,panelRef:Je,isLight:Ge,children:Dr.map((De,Ie)=>{const Qe=ce===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),Z(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&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"})})})]},De.toolId)})}),z==="gann"&&a.jsx(xs,{top:210,panelRef:Ke,isLight:Ge,children:_r.map((De,Ie)=>{const Qe=le===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),se(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&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"})})})]},De.toolId)})}),z==="shape"&&a.jsx(xs,{top:250,panelRef:ve,isLight:Ge,children:Pr.map((De,Ie)=>{const Qe=ge===Ie;return a.jsxs("button",{type:"button",onMouseDown:Te=>{Te.stopPropagation(),be(Ie),r(De.toolId),Ae(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ge?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ge?"text-slate-500":"text-slate-400"}`,children:De.icon}),a.jsx("span",{className:"flex-1",children:De.label}),Qe&&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"})})})]},De.toolId)})}),E&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{N(!1),M(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:Ue,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Ge?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Ge?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Ge?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),a.jsx("div",{className:`text-[12px] mt-0.5 ${Ge?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:At.map(De=>a.jsx(rt,{item:De},De.key))})]})]})]})};function CT(i){return zt({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:[]}]})(i)}const vT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},TT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},xT={binance:"CRYPTO"},bT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Ht(),o=s==="light",[l,c]=j.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),m=j.useMemo(()=>{const v={};for(const U of u){const F=(U.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(U)}const T=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((U,F)=>{const E=T.indexOf(U),N=T.indexOf(F);return E!==-1&&N!==-1?E-N:E!==-1?-1:N!==-1?1:U.localeCompare(F)}).map(U=>({category:U,symbols:v[U]}))},[u]),y=v=>a.jsxs("tr",{onClick:()=>A(v.symbol),className:`cursor-pointer transition-colors ${t===v.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:[v.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(wT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(mT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Um,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:v.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${v.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[v.change>=0?"+":"",v.change,"%"]})]},v.symbol);return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
9
+ }`,RC=function(i){GC(i,"."+Ia+zC+Qd+`
10
+ .`+Da+WC+Qd)},GC=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Fd=(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})(),$C=(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)||(Pa(e)||YC(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 Xt(this,void 0,void 0,function(){var t,A,r,n,s=this;return Vt(this,function(o){switch(o.label){case 0:return t=Fd.isSameOrigin(e),A=!_a(e)&&this._options.useCORS===!0&&Pt.SUPPORT_CORS_IMAGES&&!t,r=!_a(e)&&!t&&!Pa(e)&&typeof this._options.proxy=="string"&&Pt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!_a(e)&&!Pa(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 u=new Image;u.onload=function(){return l(u)},u.onerror=c,(qC(n)||A)&&(u.crossOrigin="anonymous"),u.src=n,u.complete===!0&&setTimeout(function(){return l(u)},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=Pt.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(y){return s(y)},!1),m.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 u=t._options.imageTimeout;l.timeout=u,l.ontimeout=function(){return s("Timed out ("+u+"ms) proxying "+r)}}l.send()})},i})(),XC=/^data:image\/svg\+xml/i,JC=/^data:image\/.*;base64,/i,ZC=/^data:image\/.*/i,YC=function(i){return Pt.SUPPORT_SVG_DRAWING||!jC(i)},_a=function(i){return ZC.test(i)},qC=function(i){return JC.test(i)},Pa=function(i){return i.substr(0,4)==="blob"},jC=function(i){return i.substr(-3).toLowerCase()==="svg"||XC.test(i)},Pe=(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})(),Ni=function(i,e,t){return new Pe(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},ms=(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=Ni(this.start,this.startControl,e),r=Ni(this.startControl,this.endControl,e),n=Ni(this.endControl,this.end,e),s=Ni(A,r,e),o=Ni(r,n,e),l=Ni(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})(),pA=function(i){return i.type===1},ev=(function(){function i(e){var t=e.styles,A=e.bounds,r=Qr(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Qr(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=Qr(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=Qr(t.borderBottomLeftRadius,A.width,A.height),T=v[0],C=v[1],U=[];U.push((n+l)/A.width),U.push((T+m)/A.width),U.push((s+C)/A.height),U.push((c+y)/A.height);var F=Math.max.apply(Math,U);F>1&&(n/=F,s/=F,l/=F,c/=F,m/=F,y/=F,T/=F,C/=F);var E=A.width-l,k=A.height-y,R=A.width-m,M=A.height-C,z=t.borderTopWidth,ie=t.borderRightWidth,G=t.borderBottomWidth,K=t.borderLeftWidth,Ae=ft(t.paddingTop,e.bounds.width),re=ft(t.paddingRight,e.bounds.width),he=ft(t.paddingBottom,e.bounds.width),J=ft(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?mt(A.left+K/3,A.top+z/3,n-K/3,s-z/3,lt.TOP_LEFT):new Pe(A.left+K/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?mt(A.left+E,A.top+z/3,l-ie/3,c-z/3,lt.TOP_RIGHT):new Pe(A.left+A.width-ie/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?mt(A.left+R,A.top+k,m-ie/3,y-G/3,lt.BOTTOM_RIGHT):new Pe(A.left+A.width-ie/3,A.top+A.height-G/3),this.bottomLeftBorderDoubleOuterBox=T>0||C>0?mt(A.left+K/3,A.top+M,T-K/3,C-G/3,lt.BOTTOM_LEFT):new Pe(A.left+K/3,A.top+A.height-G/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?mt(A.left+K*2/3,A.top+z*2/3,n-K*2/3,s-z*2/3,lt.TOP_LEFT):new Pe(A.left+K*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?mt(A.left+E,A.top+z*2/3,l-ie*2/3,c-z*2/3,lt.TOP_RIGHT):new Pe(A.left+A.width-ie*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?mt(A.left+R,A.top+k,m-ie*2/3,y-G*2/3,lt.BOTTOM_RIGHT):new Pe(A.left+A.width-ie*2/3,A.top+A.height-G*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||C>0?mt(A.left+K*2/3,A.top+M,T-K*2/3,C-G*2/3,lt.BOTTOM_LEFT):new Pe(A.left+K*2/3,A.top+A.height-G*2/3),this.topLeftBorderStroke=n>0||s>0?mt(A.left+K/2,A.top+z/2,n-K/2,s-z/2,lt.TOP_LEFT):new Pe(A.left+K/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?mt(A.left+E,A.top+z/2,l-ie/2,c-z/2,lt.TOP_RIGHT):new Pe(A.left+A.width-ie/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?mt(A.left+R,A.top+k,m-ie/2,y-G/2,lt.BOTTOM_RIGHT):new Pe(A.left+A.width-ie/2,A.top+A.height-G/2),this.bottomLeftBorderStroke=T>0||C>0?mt(A.left+K/2,A.top+M,T-K/2,C-G/2,lt.BOTTOM_LEFT):new Pe(A.left+K/2,A.top+A.height-G/2),this.topLeftBorderBox=n>0||s>0?mt(A.left,A.top,n,s,lt.TOP_LEFT):new Pe(A.left,A.top),this.topRightBorderBox=l>0||c>0?mt(A.left+E,A.top,l,c,lt.TOP_RIGHT):new Pe(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?mt(A.left+R,A.top+k,m,y,lt.BOTTOM_RIGHT):new Pe(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||C>0?mt(A.left,A.top+M,T,C,lt.BOTTOM_LEFT):new Pe(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?mt(A.left+K,A.top+z,Math.max(0,n-K),Math.max(0,s-z),lt.TOP_LEFT):new Pe(A.left+K,A.top+z),this.topRightPaddingBox=l>0||c>0?mt(A.left+Math.min(E,A.width-ie),A.top+z,E>A.width+ie?0:Math.max(0,l-ie),Math.max(0,c-z),lt.TOP_RIGHT):new Pe(A.left+A.width-ie,A.top+z),this.bottomRightPaddingBox=m>0||y>0?mt(A.left+Math.min(R,A.width-K),A.top+Math.min(k,A.height-G),Math.max(0,m-ie),Math.max(0,y-G),lt.BOTTOM_RIGHT):new Pe(A.left+A.width-ie,A.top+A.height-G),this.bottomLeftPaddingBox=T>0||C>0?mt(A.left+K,A.top+Math.min(M,A.height-G),Math.max(0,T-K),Math.max(0,C-G),lt.BOTTOM_LEFT):new Pe(A.left+K,A.top+A.height-G),this.topLeftContentBox=n>0||s>0?mt(A.left+K+J,A.top+z+Ae,Math.max(0,n-(K+J)),Math.max(0,s-(z+Ae)),lt.TOP_LEFT):new Pe(A.left+K+J,A.top+z+Ae),this.topRightContentBox=l>0||c>0?mt(A.left+Math.min(E,A.width+K+J),A.top+z+Ae,E>A.width+K+J?0:l-K+J,c-(z+Ae),lt.TOP_RIGHT):new Pe(A.left+A.width-(ie+re),A.top+z+Ae),this.bottomRightContentBox=m>0||y>0?mt(A.left+Math.min(R,A.width-(K+J)),A.top+Math.min(k,A.height+z+Ae),Math.max(0,m-(ie+re)),y-(G+he),lt.BOTTOM_RIGHT):new Pe(A.left+A.width-(ie+re),A.top+A.height-(G+he)),this.bottomLeftContentBox=T>0||C>0?mt(A.left+K+J,A.top+M,Math.max(0,T-(K+J)),C-(G+he),lt.BOTTOM_LEFT):new Pe(A.left+K+J,A.top+A.height-(G+he))}return i})(),lt;(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"})(lt||(lt={}));var mt=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 lt.TOP_LEFT:return new ms(new Pe(i,c),new Pe(i,c-o),new Pe(l-s,e),new Pe(l,e));case lt.TOP_RIGHT:return new ms(new Pe(i,e),new Pe(i+s,e),new Pe(l,c-o),new Pe(l,c));case lt.BOTTOM_RIGHT:return new ms(new Pe(l,e),new Pe(l,e+o),new Pe(i+s,c),new Pe(i,c));case lt.BOTTOM_LEFT:default:return new ms(new Pe(l,c),new Pe(l-s,c),new Pe(i,e+o),new Pe(i,e))}},ws=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},tv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Bs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},Av=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),ys=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),iv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),rv=function(i){return i.type===0},Ud=function(i){return i.type===1},nv=function(i){return i.type===2},Sd=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},sv=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})},Ed=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),Ld=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new ev(this.container),this.container.styles.opacity<1&&this.effects.push(new iv(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 Av(A,r,n))}if(this.container.styles.overflowX!==0){var s=ws(this.curves),o=Bs(this.curves);Sd(s,o)?this.effects.push(new ys(s,6)):(this.effects.push(new ys(s,2)),this.effects.push(new ys(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!Ud(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=ws(A.curves),o=Bs(A.curves);Sd(s,o)||r.unshift(new ys(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return St(l.target,e)})},i})(),ka=function(i,e,t,A){i.container.elements.forEach(function(r){var n=St(r.flags,4),s=St(r.flags,2),o=new Ld(r,i);St(r.styles.display,2048)&&A.push(o);var l=St(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Ed(o);if(r.styles.isPositioned()||r.styles.opacity<1||r.styles.isTransformed()){var m=r.styles.zIndex.order;if(m<0){var y=0;c.negativeZIndex.some(function(T,C){return m>T.element.container.styles.zIndex.order?(y=C,!1):y>0}),c.negativeZIndex.splice(y,0,u)}else if(m>0){var v=0;c.positiveZIndex.some(function(T,C){return m>=T.element.container.styles.zIndex.order?(v=C+1,!1):v>0}),c.positiveZIndex.splice(v,0,u)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(u)}else r.styles.isFloating()?c.nonPositionedFloats.push(u):c.nonPositionedInlineLevel.push(u);ka(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),ka(o,e,t,l);St(r.flags,8)&&Md(r,l)})},Md=function(i,e){for(var t=i instanceof Fa?i.start:1,A=i instanceof Fa?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof id&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Mr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},ov=function(i){var e=new Ld(i,null),t=new Ed(e),A=[];return ka(e,t,t,A),Md(e.container,A),t},Hd=function(i,e){switch(e){case 0:return fA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return fA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return fA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return fA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},av=function(i,e){switch(e){case 0:return fA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return fA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return fA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return fA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},lv=function(i,e){switch(e){case 0:return fA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return fA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return fA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return fA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},cv=function(i,e){switch(e){case 0:return Cs(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Cs(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Cs(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Cs(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Cs=function(i,e){var t=[];return pA(i)?t.push(i.subdivide(.5,!1)):t.push(i),pA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},fA=function(i,e,t,A){var r=[];return pA(i)?r.push(i.subdivide(.5,!1)):r.push(i),pA(t)?r.push(t.subdivide(.5,!0)):r.push(t),pA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),pA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Id=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},vs=function(i){var e=i.styles,t=i.bounds,A=ft(e.paddingLeft,t.width),r=ft(e.paddingRight,t.width),n=ft(e.paddingTop,t.width),s=ft(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))},hv=function(i,e){return i===0?e.bounds:i===2?vs(e):Id(e)},uv=function(i,e){return i===0?e.bounds:i===2?vs(e):Id(e)},Na=function(i,e,t){var A=hv(Ki(i.styles.backgroundOrigin,e),i),r=uv(Ki(i.styles.backgroundClip,e),i),n=dv(Ki(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Qr(Ki(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=pv(Ki(i.styles.backgroundRepeat,e),l,n,A,r),u=Math.round(A.left+l[0]),m=Math.round(A.top+l[1]);return[c,u,m,s,o]},Oi=function(i){return ut(i)&&i.value===Di.AUTO},Ts=function(i){return typeof i=="number"},dv=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(Ut(s)&&o&&Ut(o))return[ft(s,t.width),ft(o,t.height)];var l=Ts(n);if(ut(s)&&(s.value===Di.CONTAIN||s.value===Di.COVER)){if(Ts(n)){var c=t.width/t.height;return c<n!=(s.value===Di.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ts(A),m=Ts(r),y=u||m;if(Oi(s)&&(!o||Oi(o))){if(u&&m)return[A,r];if(!l&&!y)return[t.width,t.height];if(y&&l){var v=u?A:r*n,T=m?r:A/n;return[v,T]}var C=u?A:t.width,U=m?r:t.height;return[C,U]}if(l){var F=0,E=0;return Ut(s)?F=ft(s,t.width):Ut(o)&&(E=ft(o,t.height)),Oi(s)?F=E*n:(!o||Oi(o))&&(E=F/n),[F,E]}var k=null,R=null;if(Ut(s)?k=ft(s,t.width):o&&Ut(o)&&(R=ft(o,t.height)),k!==null&&(!o||Oi(o))&&(R=u&&m?k/A*r:t.height),R!==null&&Oi(s)&&(k=u&&m?R/r*A:t.width),k!==null&&R!==null)return[k,R];throw new Error("Unable to calculate background-size for element")},Ki=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},pv=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 Pe(Math.round(A.left),Math.round(A.top+s)),new Pe(Math.round(A.left+A.width),Math.round(A.top+s)),new Pe(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Pe(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Pe(Math.round(A.left+n),Math.round(A.top)),new Pe(Math.round(A.left+n+o),Math.round(A.top)),new Pe(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Pe(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Pe(Math.round(A.left+n),Math.round(A.top+s)),new Pe(Math.round(A.left+n+o),Math.round(A.top+s)),new Pe(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Pe(Math.round(A.left+n),Math.round(A.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))]}},fv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Dd="Hidden Text",gv=(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=fv,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)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Dd)),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})(),_d=(function(){function i(e,t){this.context=e,this.options=t}return i})(),mv=1e4,wv=(function(i){yA(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 gv(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(),nv(t)&&(this.ctx.globalAlpha=t.opacity),rv(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)),Ud(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 Xt(this,void 0,void 0,function(){var A;return Vt(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 Xt(this,void 0,void 0,function(){return Vt(this,function(A){switch(A.label){case 0:if(St(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=Qa(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=Tv(t.fontFamily).join(", "),n=br(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 Xt(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return Vt(this,function(v){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,u=l.middle,m=A.paintOrder,t.textBounds.forEach(function(T){m.forEach(function(C){switch(C){case 0:y.ctx.fillStyle=Ht(A.color),y.renderTextWithLetterSpacing(T,A.letterSpacing,c);var U=A.textShadow;U.length&&T.text.trim().length&&(U.slice(0).reverse().forEach(function(F){y.ctx.shadowColor=Ht(F.color),y.ctx.shadowOffsetX=F.offsetX.number*y.options.scale,y.ctx.shadowOffsetY=F.offsetY.number*y.options.scale,y.ctx.shadowBlur=F.blur.number,y.renderTextWithLetterSpacing(T,A.letterSpacing,c)}),y.ctx.shadowColor="",y.ctx.shadowOffsetX=0,y.ctx.shadowOffsetY=0,y.ctx.shadowBlur=0),A.textDecorationLine.length&&(y.ctx.fillStyle=Ht(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(F){switch(F){case 1:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top+c),T.bounds.width,1);break;case 2:y.ctx.fillRect(T.bounds.left,Math.round(T.bounds.top),T.bounds.width,1);break;case 3:y.ctx.fillRect(T.bounds.left,Math.ceil(T.bounds.top+u),T.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&T.text.trim().length&&(y.ctx.strokeStyle=Ht(A.webkitTextStrokeColor),y.ctx.lineWidth=A.webkitTextStrokeWidth,y.ctx.lineJoin=window.chrome?"miter":"round",y.ctx.strokeText(T.text,T.bounds.left,T.bounds.top+c)),y.ctx.strokeStyle="",y.ctx.lineWidth=0,y.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,r){if(r&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=vs(t),s=Bs(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 Xt(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,m,y,R,v,T,M,C,U,F,E,k,R,M;return Vt(this,function(z){switch(z.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,r=t.curves,n=A.styles,s=0,o=A.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(!(A instanceof ed))return[3,8];z.label=5;case 5:return z.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,8];case 7:return z.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof td&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof Ad))return[3,12];z.label=9;case 9:return z.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=z.sent(),this.renderReplacedElement(A,r,E),[3,12];case 11:return z.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof od&&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:u=z.sent(),A.width&&A.height&&this.ctx.drawImage(u,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),z.label=14;case 14:if(A instanceof Ua&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===hs?A.checked&&(this.ctx.save(),this.path([new Pe(A.bounds.left+m*.39363,A.bounds.top+m*.79),new Pe(A.bounds.left+m*.16,A.bounds.top+m*.5549),new Pe(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new Pe(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new Pe(A.bounds.left+m*.72983,A.bounds.top+m*.23),new Pe(A.bounds.left+m*.84,A.bounds.top+m*.34085),new Pe(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Ht(rd),this.ctx.fill(),this.ctx.restore()):A.type===us&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+m/2,A.bounds.top+m/2,m/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ht(rd),this.ctx.fill(),this.ctx.restore())),Bv(A)&&A.value.length){switch(y=this.createFontStyle(n),R=y[0],v=y[1],T=this.fontMetrics.getMetrics(R,v).baseline,this.ctx.font=R,this.ctx.fillStyle=Ht(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Cv(A.styles.textAlign),M=vs(A),C=0,A.styles.textAlign){case 1:C+=M.width/2;break;case 2:C+=M.width;break}U=M.add(C,0,0,-M.height/2+1),this.ctx.save(),this.path([new Pe(M.left,M.top),new Pe(M.left+M.width,M.top),new Pe(M.left+M.width,M.top+M.height),new Pe(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Er(A.value,U),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!St(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(F=A.styles.listStyleImage,F.type!==0)return[3,18];E=void 0,k=F.url,z.label=15;case 15:return z.trys.push([15,17,,18]),[4,this.context.cache.match(k)];case 16:return E=z.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return z.sent(),this.context.logger.error("Error loading list-style-image "+k),[3,18];case 18:return[3,20];case 19:t.listValue&&A.styles.listStyleType!==-1&&(R=this.createFontStyle(n)[0],this.ctx.font=R,this.ctx.fillStyle=Ht(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new NA(A.bounds.left,A.bounds.top+ft(A.styles.paddingTop,A.bounds.width),A.bounds.width,Du(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Er(t.listValue,M),n.letterSpacing,Du(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 Xt(this,void 0,void 0,function(){var A,r,F,n,s,F,o,l,F,c,u,F,m,y,F,v,T,F,C,U,F;return Vt(this,function(E){switch(E.label){case 0:if(St(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,r=t.negativeZIndex,E.label=2;case 2:return A<r.length?(F=r[A],[4,this.renderStack(F)]):[3,5];case 3:E.sent(),E.label=4;case 4:return A++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:E.sent(),n=0,s=t.nonInlineLevel,E.label=7;case 7:return n<s.length?(F=s[n],[4,this.renderNode(F)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,l=t.nonPositionedFloats,E.label=11;case 11:return o<l.length?(F=l[o],[4,this.renderStack(F)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,u=t.nonPositionedInlineLevel,E.label=15;case 15:return c<u.length?(F=u[c],[4,this.renderStack(F)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:m=0,y=t.inlineLevel,E.label=19;case 19:return m<y.length?(F=y[m],[4,this.renderNode(F)]):[3,22];case 20:E.sent(),E.label=21;case 21:return m++,[3,19];case 22:v=0,T=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return v<T.length?(F=T[v],[4,this.renderStack(F)]):[3,26];case 24:E.sent(),E.label=25;case 25:return v++,[3,23];case 26:C=0,U=t.positiveZIndex,E.label=27;case 27:return C<U.length?(F=U[C],[4,this.renderStack(F)]):[3,30];case 28:E.sent(),E.label=29;case 29:return C++,[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=pA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),pA(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 Xt(this,void 0,void 0,function(){var A,r,n,s,o,l;return Vt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,Ae,ce,se,J,ee,G,T,Ae,ce,se,J,ee,C,U,F,E,k,R,M,z,ie,G,K,Ae,re,he,J,ee,ae,ce,se,le,pe,we,be,Fe,Ce,ve,Qe;return Vt(this,function(Ue){switch(Ue.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,Ue.label=1;case 1:return Ue.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=Ue.sent(),[3,4];case 3:return Ue.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Na(t,A,[m.width,m.height,m.width/m.height]),Ae=v[0],ce=v[1],se=v[2],J=v[3],ee=v[4],G=n.ctx.createPattern(n.resizeImage(m,J,ee),"repeat"),n.renderRepeat(Ae,G,ce,se)),[3,6];case 5:r2(u)?(T=Na(t,A,[null,null,null]),Ae=T[0],ce=T[1],se=T[2],J=T[3],ee=T[4],C=jB(u.angle,J,ee),U=C[0],F=C[1],E=C[2],k=C[3],R=C[4],M=document.createElement("canvas"),M.width=J,M.height=ee,z=M.getContext("2d"),ie=z.createLinearGradient(F,k,E,R),xu(u.stops,U).forEach(function(ke){return ie.addColorStop(ke.stop,Ht(ke.color))}),z.fillStyle=ie,z.fillRect(0,0,J,ee),J>0&&ee>0&&(G=n.ctx.createPattern(M,"repeat"),n.renderRepeat(Ae,G,ce,se))):n2(u)&&(K=Na(t,A,[null,null,null]),Ae=K[0],re=K[1],he=K[2],J=K[3],ee=K[4],ae=u.position.length===0?[ha]:u.position,ce=ft(ae[0],J),se=ft(ae[ae.length-1],ee),le=e2(u,ce,se,J,ee),pe=le[0],we=le[1],pe>0&&we>0&&(be=n.ctx.createRadialGradient(re+ce,he+se,0,re+ce,he+se,pe),xu(u.stops,pe*2).forEach(function(ke){return be.addColorStop(ke.stop,Ht(ke.color))}),n.path(Ae),n.ctx.fillStyle=be,pe!==we?(Fe=t.bounds.left+.5*t.bounds.width,Ce=t.bounds.top+.5*t.bounds.height,ve=we/pe,Qe=1/ve,n.ctx.save(),n.ctx.translate(Fe,Ce),n.ctx.transform(1,0,0,ve,0,0),n.ctx.translate(-Fe,-Ce),n.ctx.fillRect(re,Qe*(he-Ce)+Ce,J,ee*Qe),n.ctx.restore()):n.ctx.fill())),Ue.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 Xt(this,void 0,void 0,function(){return Vt(this,function(n){return this.path(Hd(r,A)),this.ctx.fillStyle=Ht(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return Xt(this,void 0,void 0,function(){var s,o;return Vt(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=av(n,r),this.path(s),this.ctx.fillStyle=Ht(t),this.ctx.fill(),o=lv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Xt(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return Vt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!qA(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=yv(Ki(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),qA(A.backgroundColor)||(this.ctx.fillStyle=Ht(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:y.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(v){m.ctx.save();var T=ws(t.curves),C=v.inset?0:mv,U=sv(T,-C+(v.inset?1:-1)*v.spread.number,(v.inset?1:-1)*v.spread.number,v.spread.number*(v.inset?-2:2),v.spread.number*(v.inset?-2:2));v.inset?(m.path(T),m.ctx.clip(),m.mask(U)):(m.mask(T),m.ctx.clip(),m.path(U)),m.ctx.shadowOffsetX=v.offsetX.number+C,m.ctx.shadowOffsetY=v.offsetY.number,m.ctx.shadowColor=Ht(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Ht(v.color):"rgba(0,0,0,1)",m.ctx.fill(),m.ctx.restore()}),y.label=2;case 2:o=0,l=0,c=n,y.label=3;case 3:return l<c.length?(u=c[l],u.style!==0&&!qA(u.color)&&u.width>0?u.style!==2?[3,5]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return y.sent(),[3,11];case 5:return u.style!==3?[3,7]:[4,this.renderDashedDottedBorder(u.color,u.width,o,t.curves,3)];case 6:return y.sent(),[3,11];case 7:return u.style!==4?[3,9]:[4,this.renderDoubleBorder(u.color,u.width,o,t.curves)];case 8:return y.sent(),[3,11];case 9:return[4,this.renderSolidBorder(u.color,o,t.curves)];case 10:y.sent(),y.label=11;case 11:o++,y.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,r,n,s){return Xt(this,void 0,void 0,function(){var o,l,c,u,m,y,v,T,C,U,F,E,k,R,M,z,M,z;return Vt(this,function(ie){return this.ctx.save(),o=cv(n,r),l=Hd(n,r),s===2&&(this.path(l),this.ctx.clip()),pA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),pA(l[1])?(m=l[1].end.x,y=l[1].end.y):(m=l[1].x,y=l[1].y),r===0||r===2?v=Math.abs(c-m):v=Math.abs(u-y),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(l.slice(0,2)),T=A<3?A*3:A*2,C=A<3?A*2:A,s===3&&(T=A,C=A),U=!0,v<=T*2?U=!1:v<=T*2+C?(F=v/(2*T+C),T*=F,C*=F):(E=Math.floor((v+C)/(T+C)),k=(v-E*T)/(E-1),R=(v-(E+1)*T)/E,C=R<=0||Math.abs(C-k)<Math.abs(C-R)?k:R),U&&(s===3?this.ctx.setLineDash([0,T+C]):this.ctx.setLineDash([T,C])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=Ht(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(pA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Pe(M.end.x,M.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke()),pA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Pe(M.end.x,M.end.y),new Pe(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Xt(this,void 0,void 0,function(){var A;return Vt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ht(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=ov(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(_d),Bv=function(i){return i instanceof sd||i instanceof nd?!0:i instanceof Ua&&i.type!==us&&i.type!==hs},yv=function(i,e){switch(i){case 0:return ws(e);case 2:return tv(e);default:return Bs(e)}},Cv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},vv=["-apple-system","system-ui"],Tv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return vv.indexOf(e)===-1}):i},xv=(function(i){yA(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 Xt(this,void 0,void 0,function(){var A,r;return Vt(this,function(n){switch(n.label){case 0:return A=ba(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,bv(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ht(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})(_d),bv=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))})},Qv=(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,Ln([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,Ln([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,Ln([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,Ln([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),Fv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Qv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new $C(this,e)}return i.instanceCount=1,i})(),Uv=function(i,e){return e===void 0&&(e={}),Sv(i,e)};typeof window<"u"&&Fd.setContext(window);var Sv=function(i,e){return Xt(void 0,void 0,void 0,function(){var t,A,r,n,s,o,l,c,u,m,y,v,T,C,U,F,E,k,R,M,ie,z,ie,G,K,Ae,re,he,J,ee,ae,ce,se,le,pe,we,be,Fe,Ce,ve;return Vt(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:(G=e.allowTaint)!==null&&G!==void 0?G:!1,imageTimeout:(K=e.imageTimeout)!==null&&K!==void 0?K:15e3,proxy:e.proxy,useCORS:(Ae=e.useCORS)!==null&&Ae!==void 0?Ae:!1},n=Wo({logging:(re=e.logging)!==null&&re!==void 0?re:!0,cache:e.cache},r),s={windowWidth:(he=e.windowWidth)!==null&&he!==void 0?he:A.innerWidth,windowHeight:(J=e.windowHeight)!==null&&J!==void 0?J:A.innerHeight,scrollX:(ee=e.scrollX)!==null&&ee!==void 0?ee:A.pageXOffset,scrollY:(ae=e.scrollY)!==null&&ae!==void 0?ae:A.pageYOffset},o=new NA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new Fv(n,o),c=(ce=e.foreignObjectRendering)!==null&&ce!==void 0?ce:!1,u={allowTaint:(se=e.allowTaint)!==null&&se!==void 0?se:!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 bd(l,i,u),y=m.clonedReferenceElement,y?[4,m.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return v=Qe.sent(),T=Ea(y)||EC(y)?sw(y.ownerDocument):Mn(l,y),C=T.width,U=T.height,F=T.left,E=T.top,k=Ev(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:k,scale:(pe=(le=e.scale)!==null&&le!==void 0?le:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((we=e.x)!==null&&we!==void 0?we:0)+F,y:((be=e.y)!==null&&be!==void 0?be:0)+E,width:(Fe=e.width)!==null&&Fe!==void 0?Fe:Math.ceil(C),height:(Ce=e.height)!==null&&Ce!==void 0?Ce:Math.ceil(U)},c?(l.logger.debug("Document cloned, using foreign object rendering"),ie=new xv(l,R),[4,ie.render(y)]):[3,3];case 2:return M=Qe.sent(),[3,5];case 3:return l.logger.debug("Document cloned, element located at "+F+","+E+" with size "+C+"x"+U+" using computed rendering"),l.logger.debug("Starting DOM parsing"),z=ld(l,y),k===z.styles.backgroundColor&&(z.styles.backgroundColor=KA.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),ie=new wv(l,R),[4,ie.render(z)];case 4:M=Qe.sent(),Qe.label=5;case 5:return(!((ve=e.removeContainer)!==null&&ve!==void 0)||ve)&&(bd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Ev=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Fr(i,getComputedStyle(A.documentElement).backgroundColor):KA.TRANSPARENT,n=A.body?Fr(i,getComputedStyle(A.body).backgroundColor):KA.TRANSPARENT,s=typeof t=="string"?Fr(i,t):t===null?KA.TRANSPARENT:4294967295;return e===A.documentElement?qA(r)?qA(n)?s:n:r:s};const Lv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class Mv{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,u=n._series;if(!c||!u)return;const m=u.priceToCoordinate(n.price);if(m==null)return;const y=Math.round(m*o.verticalPixelRatio),v=c.timeScale().timeToCoordinate(n.originTime),T=v==null?0:Math.max(0,Math.round(v*o.horizontalPixelRatio)),C=o.bitmapSize.width;if(T>=C)return;l.save(),l.beginPath(),l.strokeStyle=n.color,l.lineWidth=n.lineWidth*o.verticalPixelRatio,l.setLineDash([]),l.moveTo(T,y),l.lineTo(C,y),l.stroke(),l.beginPath(),l.fillStyle=n.color;const U=3*o.verticalPixelRatio;l.arc(T,y,U,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 Pd{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 u=Math.round(A.fontSize*l);n.font=`${u}px ui-sans-serif, system-ui, sans-serif`,n.textBaseline="middle";const m=Math.round(8*o),y=Math.round(14*l),v=s.width;let T;if(A.hAlign==="left")if(A.originTime!=null&&A._chart){const F=A._chart.timeScale().timeToCoordinate(A.originTime);T=F!=null?Math.round(F*o):m,n.textAlign="right"}else T=m,n.textAlign="left";else A.hAlign==="right"?(T=v-m,n.textAlign="right"):(T=v/2,n.textAlign="center");const C=Math.round(c*l);let U;A.vAlign==="top"?U=C-y:A.vAlign==="bottom"?U=C+y:U=C,n.fillStyle=A.textColor,n.fillText(A.text,T,U)})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Hv{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,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),k=Math.round(T*m),R=Math.round(U*y),M=l.context;if(M.save(),M.beginPath(),M.strokeStyle=s.color,M.lineWidth=s.lineWidth*y,M.setLineDash([]),M.moveTo(F,E),M.lineTo(k,R),M.stroke(),M.beginPath(),M.fillStyle=s.color,M.arc(F,E,3*y,0,Math.PI*2),M.fill(),M.beginPath(),M.arc(k,R,3*y,0,Math.PI*2),M.fill(),!s.statsShowAlways&&!s.isActive){M.restore();return}const{priceDiff:z,pricePct:ie,bars:G,days:K,angle:Ae}=s.info,re=z>=0?"+":"",he=[];if(s.statsPriceRange!==!1&&he.push(`${re}${z.toFixed(5)} (${re}${ie.toFixed(2)}%)`),s.statsBarsRange!==!1&&he.push(`${G} bars`),s.statsDateRange!==!1&&he.push(`${K} days`),s.statsAngle!==!1&&he.push(`∠ ${Ae.toFixed(1)}°`),s.statsDistance&&he.push(`Δ ${Math.abs(z).toFixed(5)}`),he.length===0){M.restore();return}const J=Math.round(11*y);M.font=`${J}px sans-serif`;const ee=J*1.6,ae=8*y,ce=Math.max(...he.map(Je=>M.measureText(Je).width))+ae*2,se=he.length*ee+ae*2,le=s.statsPosition??"right";let pe,we;le==="left"?(pe=F,we=E):le==="center"?(pe=Math.round((F+k)/2),we=Math.round((E+R)/2)):(pe=k,we=R);let be,Fe;le==="left"?(be=pe-ce-10*m,Fe=we-se-4*y):le==="center"?(be=pe-ce/2,Fe=we-se-8*y):(be=pe+10*m,Fe=we-se-4*y);const Ce=l.bitmapSize.width,ve=l.bitmapSize.height,Qe=Math.min(Math.max(0,be),Ce-ce-4*m),Ue=Math.min(Math.max(4*y,Fe),ve-se-4*y),ke=4*y;M.beginPath(),M.moveTo(Qe+ke,Ue),M.lineTo(Qe+ce-ke,Ue),M.quadraticCurveTo(Qe+ce,Ue,Qe+ce,Ue+ke),M.lineTo(Qe+ce,Ue+se-ke),M.quadraticCurveTo(Qe+ce,Ue+se,Qe+ce-ke,Ue+se),M.lineTo(Qe+ke,Ue+se),M.quadraticCurveTo(Qe,Ue+se,Qe,Ue+se-ke),M.lineTo(Qe,Ue+ke),M.quadraticCurveTo(Qe,Ue,Qe+ke,Ue),M.closePath(),M.fillStyle="rgba(30, 41, 59, 0.92)",M.fill(),M.strokeStyle=s.statsColor||s.color,M.lineWidth=1*y,M.stroke(),M.fillStyle="#e2e8f0",M.textAlign="left",he.forEach((Je,We)=>{M.fillText(Je,Qe+ae,Ue+ae+J+We*ee)}),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 kd{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,u=s._series;if(!c||!u)return;const m=l.horizontalPixelRatio,y=l.verticalPixelRatio,v=c.timeScale().timeToCoordinate(s.p1.rawTime??s.p1.time),T=c.timeScale().timeToCoordinate(s.p2.rawTime??s.p2.time),C=u.priceToCoordinate(s.p1.price),U=u.priceToCoordinate(s.p2.price);if(v==null||T==null||C==null||U==null)return;const F=Math.round(v*m),E=Math.round(C*y),k=Math.round(T*m),R=Math.round(U*y),M=s.lineColor??s.color,z=l.context;if(z.save(),s.showArea&&(z.fillStyle=s.fillColor,z.fillRect(Math.min(F,k),Math.min(E,R),Math.abs(k-F),Math.abs(R-E)),z.strokeStyle=M,z.lineWidth=1*y,z.setLineDash([]),z.strokeRect(Math.min(F,k),Math.min(E,R),Math.abs(k-F),Math.abs(R-E))),z.beginPath(),z.strokeStyle=M,z.lineWidth=2*y,z.moveTo(F,E),z.lineTo(k,R),z.stroke(),z.fillStyle=M,z.beginPath(),z.arc(F,E,3*y,0,Math.PI*2),z.fill(),z.beginPath(),z.arc(k,R,3*y,0,Math.PI*2),z.fill(),!s.statsShowAlways&&!s.isActive){z.restore();return}const{priceDiff:ie,pricePct:G,bars:K,days:Ae}=s.info,re=ie>=0?"+":"",he=[];if(s.statsPriceRange&&he.push(re+ie.toFixed(5)+" ("+re+G.toFixed(2)+"%)"),s.statsBarsRange&&he.push(K+" bars"),s.statsDateRange&&he.push(Ae+" days"),he.length===0){z.restore();return}const J=Math.round(11*y);z.font=J+"px sans-serif";const ee=J*1.6,ae=8*y,ce=Math.max(...he.map(Qe=>z.measureText(Qe).width))+ae*2,se=he.length*ee+ae*2,le=l.bitmapSize.width,pe=l.bitmapSize.height;let we,be;if(s.statsPosition==="left")we=F-ce-10*m,be=E-se-4*y;else if(s.statsPosition==="center"){const Qe=(F+k)/2,Ue=(E+R)/2;we=Qe-ce/2,be=Ue-se-4*y}else we=k+10*m,be=R-se-4*y;const Fe=Math.min(Math.max(0,we),le-ce-4*m),Ce=Math.min(Math.max(4*y,be),pe-se-4*y),ve=4*y;z.beginPath(),z.moveTo(Fe+ve,Ce),z.lineTo(Fe+ce-ve,Ce),z.quadraticCurveTo(Fe+ce,Ce,Fe+ce,Ce+ve),z.lineTo(Fe+ce,Ce+se-ve),z.quadraticCurveTo(Fe+ce,Ce+se,Fe+ce-ve,Ce+se),z.lineTo(Fe+ve,Ce+se),z.quadraticCurveTo(Fe,Ce+se,Fe,Ce+se-ve),z.lineTo(Fe,Ce+ve),z.quadraticCurveTo(Fe,Ce,Fe+ve,Ce),z.closePath(),z.fillStyle="rgba(30, 41, 59, 0.92)",z.fill(),z.strokeStyle=s.statsColor||M,z.lineWidth=1*y,z.stroke(),z.fillStyle="#e2e8f0",z.textAlign="left",he.forEach((Qe,Ue)=>{z.fillText(Qe,Fe+ae,Ce+ae+J+Ue*ee)}),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 Iv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.min(m,y)*c,U=Math.max(m,y)*c,F=Math.min(v,T)*u,E=Math.max(v,T)*u,k=U-C,R=E-F;if(k<.5||R<.5)return;const M=s.context;M.save(),M.fillStyle=r.fillColor,M.fillRect(C,F,k,R),M.strokeStyle=r.strokeColor,M.lineWidth=r.lineWidth*u,M.setLineDash([]),M.strokeRect(C,F,k,R),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 Dv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,k=Math.hypot(F-C,E-U);if(k<.5)return;const R=s.context;R.save(),R.strokeStyle=r.strokeColor,R.lineWidth=r.lineWidth*u,R.setLineDash([]),R.beginPath(),R.arc(C,U,k,0,Math.PI*2),R.stroke(),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 _v{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 u=o.horizontalPixelRatio,m=o.verticalPixelRatio,y=l.timeScale().timeToCoordinate(n.p1.rawTime),v=c.priceToCoordinate(n.p1.price),T=l.timeScale().timeToCoordinate(n.p2.rawTime),C=c.priceToCoordinate(n.p2.price),U=l.timeScale().timeToCoordinate(n.p3.rawTime),F=c.priceToCoordinate(n.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*u,k=v*m,R=T*u,M=C*m,z=U*u,ie=F*m,G=o.context;G.save(),G.beginPath(),G.moveTo(E,k),G.lineTo(R,M),G.lineTo(z,ie),G.closePath(),G.fillStyle=n.fillColor,G.fill(),G.strokeStyle=n.strokeColor,G.lineWidth=n.lineWidth*m,G.setLineDash([]),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 Pv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=l.priceToCoordinate(r.p1.price),v=o.timeScale().timeToCoordinate(r.p2.rawTime),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=y*u,F=v*c,E=T*u,k=F-C,R=E-U,M=Math.hypot(k,R);if(M<.5)return;const z=s.context;if(z.save(),z.strokeStyle=r.strokeColor,z.lineWidth=r.lineWidth*u,z.setLineDash([]),r.previewAsLine)z.beginPath(),z.moveTo(C,U),z.lineTo(F,E),z.stroke();else{const ie=(C+F)/2,G=(U+E)/2,K=Math.atan2(R,k),Ae=M/2,re=Math.max(1,Ae*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(ie,G,Ae,re,K,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 Nd{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),k=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ie=Math.atan2(E-U,F-C),G=(r.lineWidth*4+4)*u,K=Math.PI/7;if(r.arrowRight){const re=F-G*Math.cos(ie-K),he=E-G*Math.sin(ie-K),J=F-G*Math.cos(ie+K),ee=E-G*Math.sin(ie+K);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(J,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=ie+Math.PI,he=C-G*Math.cos(re-K),J=U-G*Math.sin(re-K),ee=C-G*Math.cos(re+K),ae=U-G*Math.sin(re+K);M.beginPath(),M.moveTo(C,U),M.lineTo(he,J),M.lineTo(ee,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,J=r.p1.price,ee=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(ee-J),le=J!==0?Math.abs((ee-J)/J*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(le);pe!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+be+")":ce.push(be)}if(r.statsDistance){const se=k/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=k/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,we=5*se;M.font=le+"px sans-serif";const Fe=ae.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Ce=ae.length*pe+we*2,[ve,Qe,Ue,ke]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,We;r.statsPosition==="left"?(Je=ve,We=Qe):r.statsPosition==="center"?(Je=(ve+Ue)/2,We=(Qe+ke)/2):(Je=Ue,We=ke);const Te=Je-Fe/2,Ne=We-Ce-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,Ne,Fe,Ce),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,Ne,Fe,Ce),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((ye,de)=>{M.fillText(ye,Te+we,Ne+we+de*pe)})}}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 kv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),k=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ie=Math.atan2(E-U,F-C),G=(r.lineWidth*4+4)*u,K=Math.PI/7;if(r.arrowRight){const re=F-G*Math.cos(ie-K),he=E-G*Math.sin(ie-K),J=F-G*Math.cos(ie+K),ee=E-G*Math.sin(ie+K);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(J,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=ie+Math.PI,he=C-G*Math.cos(re-K),J=U-G*Math.sin(re-K),ee=C-G*Math.cos(re+K),ae=U-G*Math.sin(re+K);M.beginPath(),M.moveTo(C,U),M.lineTo(he,J),M.lineTo(ee,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,J=r.p1.price,ee=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(ee-J),le=J!==0?Math.abs((ee-J)/J*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(le);pe!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+be+")":ce.push(be)}if(r.statsDistance){const se=k/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=k/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,we=5*se;M.font=le+"px sans-serif";const Fe=ae.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Ce=ae.length*pe+we*2,[ve,Qe,Ue,ke]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,We;r.statsPosition==="left"?(Je=ve,We=Qe):r.statsPosition==="center"?(Je=(ve+Ue)/2,We=(Qe+ke)/2):(Je=Ue,We=ke);const Te=Je-Fe/2,Ne=We-Ce-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,Ne,Fe,Ce),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,Ne,Fe,Ce),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((ye,de)=>{M.fillText(ye,Te+we,Ne+we+de*pe)})}}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 Nv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=Math.round(m*c),U=Math.round(v*u),F=Math.round(y*c),E=Math.round(T*u),k=F-C,R=E-U,M=s.context;M.save(),M.strokeStyle=r.color,M.fillStyle=r.color,M.lineWidth=r.lineWidth*u,M.setLineDash([]);const z=Math.abs(k)<1e-4?0:R/k;if(r.rayLeft){const he=U+z*(0-C);M.beginPath(),M.moveTo(0,he),M.lineTo(C,U),M.stroke()}if(r.rayRight){const re=s.bitmapSize.width,he=E+z*(re-F);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.stroke()}M.beginPath(),M.moveTo(C,U),M.lineTo(F,E),M.stroke();const ie=Math.atan2(E-U,F-C),G=(r.lineWidth*4+4)*u,K=Math.PI/7;if(r.arrowRight){const re=F-G*Math.cos(ie-K),he=E-G*Math.sin(ie-K),J=F-G*Math.cos(ie+K),ee=E-G*Math.sin(ie+K);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(J,ee),M.closePath(),M.fill()}if(r.arrowLeft){const re=ie+Math.PI,he=C-G*Math.cos(re-K),J=U-G*Math.sin(re-K),ee=C-G*Math.cos(re+K),ae=U-G*Math.sin(re+K);M.beginPath(),M.moveTo(C,U),M.lineTo(he,J),M.lineTo(ee,ae),M.closePath(),M.fill()}if((r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsBarsRange||r.statsDateRange||r.statsDistance||r.statsAngle)){const re=r.p1.rawTime,he=r.p2.rawTime,J=r.p1.price,ee=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(ee-J),le=J!==0?Math.abs((ee-J)/J*100):0,pe=se<1e-4?6:se<.01?5:se<1?4:2;ae.push("↕ "+se.toFixed(pe)+" ("+le.toFixed(2)+"%)")}const ce=[];if(r.statsBarsRange)try{const se=o.timeScale().timeToCoordinate(re),le=o.timeScale().timeToCoordinate(he);if(se!=null&&le!=null){const pe=o.timeScale().coordinateToLogical(se),we=o.timeScale().coordinateToLogical(le);pe!=null&&we!=null&&ce.push("↔ "+Math.abs(Math.round(we-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),we=Math.floor(se%3600/60);let be=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(be+=(be?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(be=we+" min"+(we!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+be+")":ce.push(be)}if(r.statsDistance){const se=k/c,le=R/u;ce.push("distance: "+Math.sqrt(se*se+le*le).toFixed(2))}if(ce.length>0&&ae.push(ce.join(", ")),r.statsAngle){const se=k/c,le=R/u,pe=Math.atan2(le,se)*180/Math.PI;ae.push("∠ "+pe.toFixed(0)+"°")}if(ae.length>0){const se=Math.min(c,u),le=11*se,pe=le*1.5,we=5*se;M.font=le+"px sans-serif";const Fe=ae.reduce((ye,de)=>Math.max(ye,M.measureText(de).width),0)+we*2,Ce=ae.length*pe+we*2,[ve,Qe,Ue,ke]=C<=F?[C,U,F,E]:[F,E,C,U];let Je,We;r.statsPosition==="left"?(Je=ve,We=Qe):r.statsPosition==="center"?(Je=(ve+Ue)/2,We=(Qe+ke)/2):(Je=Ue,We=ke);const Te=Je-Fe/2,Ne=We-Ce-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(Te,Ne,Fe,Ce),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(Te,Ne,Fe,Ce),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((ye,de)=>{M.fillText(ye,Te+we,Ne+we+de*pe)})}}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 Ov{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 u=n._chart,m=n._series;if(!u||!m)return;const y=o.horizontalPixelRatio,v=o.verticalPixelRatio,T=u.timeScale().timeToCoordinate(n.p1.rawTime??n.p1.time),C=u.timeScale().timeToCoordinate(n.p2.rawTime??n.p2.time),U=m.priceToCoordinate(n.p1.price),F=m.priceToCoordinate(n.p2.price);if(T==null||C==null||U==null||F==null)return;const E=T*y,k=U*v,R=C*y,M=F*v,[z,ie,G,K]=E<=R?[E,k,R,M]:[R,M,E,k];let Ae=G-z,re=K-ie;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,J=o.context;if(J.save(),J.strokeStyle=n.color,J.fillStyle=n.color,J.lineWidth=n.lineWidth*v,J.setLineDash([]),n.rayLeft){const le=ie+he*(0-z);J.beginPath(),J.moveTo(0,le),J.lineTo(z,ie),J.stroke()}if(n.rayRight){const se=o.bitmapSize.width,le=K+he*(se-G);J.beginPath(),J.moveTo(G,K),J.lineTo(se,le),J.stroke()}const ee=Math.atan2(re,Ae),ae=(n.lineWidth*4+4)*v,ce=Math.PI/7;if(n.arrowRight){const se=G-ae*Math.cos(ee-ce),le=K-ae*Math.sin(ee-ce),pe=G-ae*Math.cos(ee+ce),we=K-ae*Math.sin(ee+ce);J.beginPath(),J.moveTo(G,K),J.lineTo(se,le),J.lineTo(pe,we),J.closePath(),J.fill()}if(n.arrowLeft){const se=ee+Math.PI,le=z-ae*Math.cos(se-ce),pe=ie-ae*Math.sin(se-ce),we=z-ae*Math.cos(se+ce),be=ie-ae*Math.sin(se+ce);J.beginPath(),J.moveTo(z,ie),J.lineTo(le,pe),J.lineTo(we,be),J.closePath(),J.fill()}if(c){const se=n.p1.rawTime??n.p1.time,le=n.p2.rawTime??n.p2.time,pe=n.p1.price,we=n.p2.price,be=[];if(n.statsPriceRange){const Ce=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Qe=Ce<1e-4?6:Ce<.01?5:Ce<1?4:2;be.push("↕ "+Ce.toFixed(Qe)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(n.statsBarsRange)try{const Ce=u.timeScale().timeToCoordinate(se),ve=u.timeScale().timeToCoordinate(le);if(Ce!=null&&ve!=null){const Qe=u.timeScale().coordinateToLogical(Ce),Ue=u.timeScale().coordinateToLogical(ve);Qe!=null&&Ue!=null&&Fe.push("↔ "+Math.abs(Math.round(Ue-Qe))+" bars")}}catch{}if(n.statsDateRange){const Ce=Math.abs(le-se),ve=Math.floor(Ce/86400),Qe=Math.floor(Ce%86400/3600),Ue=Math.floor(Ce%3600/60);let ke=ve>0?ve+" day"+(ve!==1?"s":""):"";Qe>0&&(ke+=(ke?" ":"")+Qe+" hour"+(Qe!==1?"s":"")),!ve&&!Qe&&(ke=Ue+" min"+(Ue!==1?"s":"")),n.statsBarsRange&&Fe.length>0?Fe[Fe.length-1]+=" ("+ke+")":Fe.push(ke)}if(n.statsDistance){const Ce=(R-E)/y,ve=(M-k)/v;Fe.push("distance: "+Math.sqrt(Ce*Ce+ve*ve).toFixed(2))}if(Fe.length>0&&be.push(Fe.join(", ")),n.statsAngle){const Ce=Ae/y,ve=re/v,Qe=Math.atan2(ve,Ce)*180/Math.PI;be.push("∠ "+Qe.toFixed(0)+"°")}if(be.length>0){const Ce=Math.min(y,v),ve=11*Ce,Qe=ve*1.5,Ue=5*Ce;J.font=ve+"px sans-serif";const Je=be.reduce((_e,je)=>Math.max(_e,J.measureText(je).width),0)+Ue*2,We=be.length*Qe+Ue*2;let Te,Ne;n.statsPosition==="left"?(Te=z,Ne=ie):n.statsPosition==="center"?(Te=(z+G)/2,Ne=(ie+K)/2):(Te=G,Ne=K);const ye=Te-Je/2,de=Ne-We-12*Ce;J.fillStyle="rgba(20, 20, 30, 0.72)",J.fillRect(ye,de,Je,We),J.strokeStyle=n.statsColor,J.lineWidth=1*Ce,J.strokeRect(ye,de,Je,We),J.fillStyle=n.statsColor,J.textBaseline="top",J.textAlign="left",be.forEach((_e,je)=>{J.fillText(_e,ye+Ue,de+Ue+je*Qe)})}}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 Kv{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,u=s.timeScale().timeToCoordinate(A.center.rawTime),m=o.priceToCoordinate(A.center.price);if(u==null||m==null)return;const y=Math.round(u*l),v=Math.round(m*c),T=n.bitmapSize.width,C=n.bitmapSize.height,U=n.context;if(U.save(),U.strokeStyle=A.color,U.lineWidth=A.lineWidth*c,U.setLineDash([]),U.beginPath(),U.moveTo(0,v),U.lineTo(T,v),U.stroke(),U.beginPath(),U.moveTo(y,0),U.lineTo(y,C),U.stroke(),A.showPrice){const F=A.center.price.toFixed(5),E=Math.round(11*c);U.font=E+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="left";const k=U.measureText(F).width,R=Math.round(6*l),M=Math.round(3*c),z=E+2*M,ie=k+2*R,G=T-ie-Math.round(2*l),K=v-z/2;U.fillStyle=A.color,U.fillRect(G,K,ie,z),U.fillStyle="#ffffff",U.fillText(F,G+R,v)}if(A.showTime){const F=A.center.rawTime,E=new Date(F*1e3),k=J=>String(J).padStart(2,"0"),R=k(E.getUTCDate())+"."+k(E.getUTCMonth()+1)+"."+E.getUTCFullYear()+" "+k(E.getUTCHours())+":"+k(E.getUTCMinutes())+":"+k(E.getUTCSeconds()),M=Math.round(11*c);U.font=M+"px ui-sans-serif, system-ui, sans-serif",U.textBaseline="middle",U.textAlign="center";const z=U.measureText(R).width,ie=Math.round(6*l),G=Math.round(3*c),K=M+2*G,Ae=z+2*ie,re=y-Ae/2,he=C-K-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,he,Ae,K),U.fillStyle="#ffffff",U.fillText(R,y,he+K/2)}U.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Vv{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,u=s.verticalPixelRatio,m=o.timeScale().timeToCoordinate(r.p1.rawTime),y=o.timeScale().timeToCoordinate(r.p2.rawTime),v=l.priceToCoordinate(r.p1.price),T=l.priceToCoordinate(r.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*c,U=v*u,F=y*c,E=T*u,k=C-F,R=U-E,M=F-C,z=E-U;if(Math.hypot(k,R)<1e-4)return;const G=Math.atan2(R,k),K=Math.round(Math.abs(G*180/Math.PI)),Ae=s.context;Ae.save(),Ae.strokeStyle=r.color,Ae.fillStyle=r.color,Ae.lineWidth=r.lineWidth*u,Ae.setLineDash([]);const re=Math.abs(M)<1e-4?0:z/M;if(r.rayLeft){const we=U+re*(0-C);Ae.beginPath(),Ae.moveTo(0,we),Ae.lineTo(C,U),Ae.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,we=E+re*(pe-F);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,we),Ae.stroke()}Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(F,E),Ae.stroke();const he=Math.atan2(z,M),J=(r.lineWidth*4+4)*u,ee=Math.PI/7;if(r.arrowRight){const pe=F-J*Math.cos(he-ee),we=E-J*Math.sin(he-ee),be=F-J*Math.cos(he+ee),Fe=E-J*Math.sin(he+ee);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,we),Ae.lineTo(be,Fe),Ae.closePath(),Ae.fill()}if(r.arrowLeft){const pe=he+Math.PI,we=C-J*Math.cos(pe-ee),be=U-J*Math.sin(pe-ee),Fe=C-J*Math.cos(pe+ee),Ce=U-J*Math.sin(pe+ee);Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(we,be),Ae.lineTo(Fe,Ce),Ae.closePath(),Ae.fill()}const ae=28*u;Ae.strokeStyle="rgba(122,166,174,0.55)",Ae.fillStyle=r.color,Ae.lineWidth=1*u,Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(F+ae,E),Ae.stroke(),Ae.beginPath(),Ae.strokeStyle="rgba(122,166,174,0.45)",Ae.arc(F,E,ae,0,G,G<0),Ae.stroke(),Ae.fillStyle="#4b7c86",Ae.font=`${Math.round(10*u)}px sans-serif`,Ae.textAlign="left",Ae.textBaseline="middle";const ce=F+(ae+10*u)*Math.cos(G/2),se=E+(ae+10*u)*Math.sin(G/2);if(Ae.fillText(`${K}°`,ce,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,we=r.p2.price,be=[];if(r.statsPriceRange){const Ce=Math.abs(we-pe),ve=pe!==0?Math.abs((we-pe)/pe*100):0,Qe=Ce<1e-4?6:Ce<.01?5:Ce<1?4:2;be.push("↕ "+Ce.toFixed(Qe)+" ("+ve.toFixed(2)+"%)")}const Fe=[];if(r.statsDistance){const Ce=M/c,ve=z/u;Fe.push("distance: "+Math.sqrt(Ce*Ce+ve*ve).toFixed(2))}if(Fe.length>0&&be.push(Fe.join(", ")),be.length>0){const Ce=Math.min(c,u),ve=11*Ce,Qe=ve*1.5,Ue=5*Ce;Ae.font=ve+"px sans-serif";const Je=be.reduce((vt,kt)=>Math.max(vt,Ae.measureText(kt).width),0)+Ue*2,We=be.length*Qe+Ue*2,[Te,Ne,ye,de]=C<=F?[C,U,F,E]:[F,E,C,U];let _e,je;r.statsPosition==="left"?(_e=Te,je=Ne):r.statsPosition==="center"?(_e=(Te+ye)/2,je=(Ne+de)/2):(_e=ye,je=de);const At=_e-Je/2,rt=je-We-12*Ce;Ae.fillStyle="rgba(20, 20, 30, 0.72)",Ae.fillRect(At,rt,Je,We),Ae.strokeStyle=r.statsColor,Ae.lineWidth=1*Ce,Ae.strokeRect(At,rt,Je,We),Ae.fillStyle=r.statsColor,Ae.textBaseline="top",Ae.textAlign="left",be.forEach((vt,kt)=>{Ae.fillText(vt,At+Ue,rt+Ue+kt*Qe)})}}Ae.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class zv{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,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price),U=o.timeScale().timeToCoordinate(r.p3.rawTime),F=l.priceToCoordinate(r.p3.price);if(y==null||v==null||T==null||C==null||U==null||F==null)return;const E=y*c,k=v*u,R=T*c,M=C*u,z=U*c,ie=F*u,G=(R+z)/2,K=(M+ie)/2;let Ae=G-E,re=K-k;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,J=s.bitmapSize.width,ee=(R-z)/2,ae=(M-ie)/2,ce=Ce=>({x:G+ee*Ce,y:K+ae*Ce}),se=(Ce,ve)=>({x:J,y:ve+he*(J-Ce)}),le=ce(1),pe=ce(-1),we=se(le.x,le.y),be=se(pe.x,pe.y);m.save(),m.beginPath(),m.moveTo(le.x,le.y),m.lineTo(we.x,we.y),m.lineTo(be.x,be.y),m.lineTo(pe.x,pe.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*u,m.moveTo(R,M),m.lineTo(z,ie),m.stroke(),r._levels.forEach(Ce=>{const ve=ce(Ce.k),Qe=se(ve.x,ve.y);m.beginPath(),m.strokeStyle=Ce.color,m.lineWidth=Ce.width*u,m.moveTo(ve.x,ve.y),m.lineTo(Qe.x,Qe.y),m.stroke()});const Fe=se(E,k);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(E,k),m.lineTo(Fe.x,Fe.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 Wv{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,u=n.context,m=s.timeScale().timeToCoordinate(A.p1.rawTime),y=o.priceToCoordinate(A.p1.price),v=s.timeScale().timeToCoordinate(A.p2.rawTime),T=o.priceToCoordinate(A.p2.price);if(m==null||y==null||v==null||T==null)return;const C=m*l,U=y*c,F=v*l,E=T*c,k=n.bitmapSize.width,R=Math.abs(F-C)<1e-4?1:F-C,M=(E-U)/R,z=F>=C?1:-1,ie=z>0?k:0,G=C+z*Math.min(220*l,Math.max(80*l,k*.35)),K=A._rays.map(re=>{const he=M*re.ratio;return{...re,yEnd:U+he*(ie-C),yLabel:U+he*(G-C)}});u.save();const Ae=(re,he,J)=>{!re||!he||(u.beginPath(),u.moveTo(C,U),u.lineTo(ie,re.yEnd),u.lineTo(ie,he.yEnd),u.closePath(),u.fillStyle=J,u.fill())};Ae(K[0],K[3],"rgba(161, 98, 7, 0.10)"),Ae(K[3],K[4],"rgba(5, 150, 105, 0.10)"),Ae(K[4],K[5],"rgba(107, 114, 128, 0.12)"),K.forEach(re=>{u.beginPath(),u.strokeStyle=re.color,u.lineWidth=1*c,u.moveTo(C,U),u.lineTo(ie,re.yEnd),u.stroke()}),u.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,u.textAlign=z>0?"left":"right",u.textBaseline="middle",K.forEach(re=>{u.fillStyle=re.color;const he=G+(z>0?4*l:-4*l),J=re.yLabel;J<-20||J>n.bitmapSize.height+20||u.fillText(re.label,he,J)}),u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Rv{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,u=s.verticalPixelRatio,m=s.context,y=o.timeScale().timeToCoordinate(r.p1.rawTime),v=l.priceToCoordinate(r.p1.price),T=o.timeScale().timeToCoordinate(r.p2.rawTime),C=l.priceToCoordinate(r.p2.price);if(y==null||v==null||T==null||C==null)return;const U=y*c,F=v*u,E=T*c,k=C*u,R=E-U,M=k-F,z=Math.hypot(R,M);if(z<1e-4)return;const ie=R/z,G=M/z,K=-G,Ae=ie,re=E+K*z,he=k+Ae*z,J=U+K*z,ee=F+Ae*z,ae=(se,le)=>({x:U+ie*z*se+K*z*le,y:F+G*z*se+Ae*z*le});m.save();const ce=["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 se=0;se<r.divisions;se++){const le=se/r.divisions,pe=(se+1)/r.divisions,we=ae(0,le),be=ae(1,le),Fe=ae(1,pe),Ce=ae(0,pe);m.beginPath(),m.moveTo(we.x,we.y),m.lineTo(be.x,be.y),m.lineTo(Fe.x,Fe.y),m.lineTo(Ce.x,Ce.y),m.closePath(),m.fillStyle=ce[se%ce.length],m.fill()}m.lineWidth=1*u,m.strokeStyle="rgba(148, 163, 184, 0.55)";for(let se=0;se<=r.divisions;se++){const le=se/r.divisions,pe=ae(0,le),we=ae(1,le),be=ae(le,0),Fe=ae(le,1);m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(we.x,we.y),m.stroke(),m.beginPath(),m.moveTo(be.x,be.y),m.lineTo(Fe.x,Fe.y),m.stroke()}m.strokeStyle="rgba(100, 116, 139, 0.85)",m.lineWidth=1*u,m.beginPath(),m.moveTo(U,F),m.lineTo(re,he),m.stroke(),m.beginPath(),m.moveTo(E,k),m.lineTo(J,ee),m.stroke(),m.strokeStyle="rgba(122, 166, 174, 0.95)",m.lineWidth=1.2*u,m.beginPath(),m.moveTo(U,F),m.lineTo(E,k),m.lineTo(re,he),m.lineTo(J,ee),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 Oa{constructor(e,t,A,r,n={}){const{lineColor:s="#129f5c",lineWidth:o=2,fillColor:l="#6aa84f",fillOpacity:c=.1,showBackground:u=!0,showPrices:m=!0,pricesColor:y="#129f5c",rayLeft:v=!1,rayRight:T=!1,arrowLeft:C=!1,arrowRight:U=!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=u,this.showPrices=m,this.pricesColor=y,this.rayLeft=v,this.rayRight=T,this.arrowLeft=C,this.arrowRight=U,this.visible=!0,this._chart=null,this._series=null;const F=this;this._paneView={renderer(){return{draw(E){E.useBitmapCoordinateSpace(k=>{if(!F.visible)return;const R=F._chart,M=F._series;if(!R||!M)return;const z=k.horizontalPixelRatio,ie=k.verticalPixelRatio,G=[F.p1,F.p3,F.p4,F.p2].map(We=>{const Te=R.timeScale().timeToCoordinate(We.rawTime),Ne=M.priceToCoordinate(We.price);return Te==null||Ne==null?null:{x:Te*z,y:Ne*ie}}).filter(Boolean);if(G.length!==4)return;const[K,Ae,re,he]=G,J=k.context;J.save();const ee=Ae.x-K.x,ae=Ae.y-K.y,ce=Math.sqrt(ee*ee+ae*ae)||1,se=ee/ce,le=ae/ce,pe=re.x-he.x,we=re.y-he.y,be=Math.sqrt(pe*pe+we*we)||1,Fe=pe/be,Ce=we/be,ve=1e5,Qe=F.rayLeft?{x:K.x-se*ve,y:K.y-le*ve}:K,Ue=F.rayRight?{x:Ae.x+se*ve,y:Ae.y+le*ve}:Ae,ke=F.rayLeft?{x:he.x-Fe*ve,y:he.y-Ce*ve}:he,Je=F.rayRight?{x:re.x+Fe*ve,y:re.y+Ce*ve}:re;if(F.showBackground){const We=F.fillColor||"#6aa84f",Te=parseInt(We.slice(1,3),16),Ne=parseInt(We.slice(3,5),16),ye=parseInt(We.slice(5,7),16);J.beginPath(),J.moveTo(K.x,K.y),J.lineTo(Ae.x,Ae.y),J.lineTo(re.x,re.y),J.lineTo(he.x,he.y),J.closePath(),J.fillStyle=`rgba(${Te},${Ne},${ye},${F.fillOpacity??.1})`,J.fill()}if(J.strokeStyle=F.lineColor,J.lineWidth=F.lineWidth*ie,J.setLineDash([]),J.beginPath(),J.moveTo(Qe.x,Qe.y),J.lineTo(Ue.x,Ue.y),J.moveTo(ke.x,ke.y),J.lineTo(Je.x,Je.y),J.moveTo(K.x,K.y),J.lineTo(he.x,he.y),J.moveTo(Ae.x,Ae.y),J.lineTo(re.x,re.y),J.stroke(),F.arrowLeft||F.arrowRight){const We=8*ie,Te=(Ne,ye,de)=>{J.save(),J.translate(Ne,ye),J.rotate(de),J.beginPath(),J.moveTo(0,0),J.lineTo(-We,-We/2),J.lineTo(-We,We/2),J.closePath(),J.fillStyle=F.lineColor,J.fill(),J.restore()};F.arrowLeft&&(Te(Qe.x,Qe.y,Math.atan2(-le,-se)),Te(ke.x,ke.y,Math.atan2(-Ce,-Fe))),F.arrowRight&&(Te(Ue.x,Ue.y,Math.atan2(le,se)),Te(Je.x,Je.y,Math.atan2(Ce,Fe)))}if(J.fillStyle="#ffffff",J.strokeStyle="#3b82f6",J.lineWidth=2*ie,[K,Ae,re,he].forEach(We=>{J.beginPath(),J.arc(We.x,We.y,6*ie,0,Math.PI*2),J.fill(),J.stroke()}),F.showPrices){const We=[F.p1,F.p3,F.p2,F.p4],Te=[K,Ae,he,re];J.fillStyle=F.pricesColor||F.lineColor,J.font=`${Math.round(10*ie)}px sans-serif`,J.textAlign="left",J.textBaseline="middle",Te.forEach((Ne,ye)=>{const de=We[ye]?.price;typeof de=="number"&&J.fillText(de.toFixed(5),Ne.x+8*z,Ne.y)})}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 Od extends Oa{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class Kd{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 u=o._chart,m=o._series;if(!u||!m)return;const y=c.horizontalPixelRatio,v=c.verticalPixelRatio,T=c.context,C=R=>{const M=u.timeScale().timeToCoordinate(R.rawTime),z=m.priceToCoordinate(R.price);return M==null||z==null?null:{x:M*y,y:z*v}},U=C(o.p1),F=C(o.p2),E=C(o.b2),k=C(o.b1);!U||!F||!E||!k||(T.save(),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.lineTo(E.x,E.y),T.lineTo(k.x,k.y),T.closePath(),T.fillStyle=o.fillColor,T.fill(),T.strokeStyle=o.strokeColor,T.lineWidth=o.lineWidth*v,T.setLineDash([]),T.beginPath(),T.moveTo(U.x,U.y),T.lineTo(F.x,F.y),T.stroke(),T.beginPath(),T.moveTo(k.x,k.y),T.lineTo(E.x,E.y),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]}}class Ka{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(u=>{if(!l.visible)return;const m=l._chart,y=l._series;if(!m||!y)return;const v=u.horizontalPixelRatio,T=u.verticalPixelRatio,C=u.context,U=G=>{const K=m.timeScale().timeToCoordinate(G.rawTime),Ae=y.priceToCoordinate(G.price);return K==null||Ae==null?null:{x:K*v,y:Ae*T}},F=U(l.mid1),E=U(l.mid2),k=U(l.top1),R=U(l.top2),M=U(l.bot1),z=U(l.bot2);if(!F||!E||!k||!R||!M||!z)return;C.save(),C.beginPath(),C.moveTo(F.x,F.y),C.lineTo(E.x,E.y),C.lineTo(R.x,R.y),C.lineTo(k.x,k.y),C.closePath(),C.fillStyle=l.upperFillColor,C.fill(),C.beginPath(),C.moveTo(M.x,M.y),C.lineTo(z.x,z.y),C.lineTo(E.x,E.y),C.lineTo(F.x,F.y),C.closePath(),C.fillStyle=l.lowerFillColor,C.fill();const ie=(G,K,Ae)=>{C.beginPath(),C.strokeStyle=Ae,C.lineWidth=l.lineWidth*T,C.setLineDash([]),C.moveTo(G.x,G.y),C.lineTo(K.x,K.y),C.stroke()};if(ie(k,R,l.upperStrokeColor),ie(F,E,l.centerStrokeColor),ie(M,z,l.lowerStrokeColor),l.showDeviationLabel){const G=Math.abs(l.top1.price-l.mid1.price),K=Number.isFinite(G)?G.toFixed(5):null;if(K){const Ae=Math.max(10,Math.round(10*T));C.fillStyle=l.labelColor,C.font=`${Ae}px sans-serif`,C.textAlign="left",C.textBaseline="top",C.fillText(K,M.x+2*v,M.y+10*T)}}C.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 extends Ka{}class zd{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,u=n.context,m=n.bitmapSize.width;n.bitmapSize.height;const y=A.p1.price,v=A.p2.price,T=y-v,C=G=>v+T*G,U=s.timeScale().timeToCoordinate(A.p1.rawTime),F=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(y),k=o.priceToCoordinate(v),R=U!=null&&F!=null?Math.round(Math.min(U,F)*l):0,M=U!=null&&F!=null?Math.round(Math.max(U,F)*l):m,z=M-R;u.save(),A._zoneFills.forEach(({from:G,to:K,color:Ae})=>{const re=C(G),he=C(K),J=o.priceToCoordinate(re),ee=o.priceToCoordinate(he);if(J==null||ee==null)return;const ae=Math.round(J*c),ce=Math.round(ee*c);u.fillStyle=Ae,u.fillRect(R,Math.min(ae,ce),z,Math.abs(ce-ae))}),A._levels.forEach(({ratio:G,label:K})=>{const Ae=C(G),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),J=A._levelColors[G]||"#888888";u.beginPath(),u.strokeStyle=J,u.lineWidth=G===0||G===1?1.5*c:1*c,G!==0&&G!==1&&G<1?u.setLineDash([4*l,4*l]):u.setLineDash([]),u.moveTo(R,he),u.lineTo(M,he),u.stroke(),u.setLineDash([])});const ie=Math.round(11*c);if(u.font=`${ie}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:G,label:K})=>{const Ae=C(G),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),J=A._levelColors[G]||"#888888",ee=`${K} (${Ae.toFixed(5)})`;u.fillStyle=J,u.textAlign="right",u.fillText(ee,R-4*l,he-4*c)}),U!=null&&F!=null&&E!=null&&k!=null){const G=Math.round(U*l),K=Math.round(E*c),Ae=Math.round(F*l),re=Math.round(k*c);u.beginPath(),u.strokeStyle="rgba(128, 128, 128, 0.6)",u.lineWidth=1*c,u.setLineDash([]),u.moveTo(G,K),u.lineTo(Ae,re),u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(G,K,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke(),u.beginPath(),u.fillStyle="#2962ff",u.arc(Ae,re,4*c,0,Math.PI*2),u.fill(),u.strokeStyle="#ffffff",u.lineWidth=1*c,u.stroke()}u.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Gv{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 u=Math.round(c*o.horizontalPixelRatio),m=o.bitmapSize.height,y=o.context;y.save(),y.beginPath(),y.strokeStyle=n.color,y.lineWidth=n.lineWidth*o.horizontalPixelRatio,y.setLineDash([]),y.moveTo(u,0),y.lineTo(u,m),y.stroke();const v=Math.round(m/2);if(n.midYCss=v/o.verticalPixelRatio,n.showDot){y.beginPath(),y.strokeStyle=n.color,y.lineWidth=1.5*o.horizontalPixelRatio;const T=5*o.horizontalPixelRatio;y.arc(u,v,T,0,Math.PI*2),y.stroke()}if(n.showDate!==!1){const T=n.time,C=new Date(typeof T=="number"?T*1e3:T),U=Ae=>String(Ae).padStart(2,"0"),F=`${U(C.getUTCDate())}.${U(C.getUTCMonth()+1)}.${C.getUTCFullYear()} ${U(C.getUTCHours())}:${U(C.getUTCMinutes())}:${U(C.getUTCSeconds())}`,E=Math.round(11*o.verticalPixelRatio);y.font=`${E}px ui-sans-serif, system-ui, sans-serif`,y.textBaseline="middle",y.textAlign="center";const k=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,ie=k+2*R,G=u-ie/2,K=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect(G,K,ie,z),y.fillStyle="#ffffff",y.fillText(F,u,K+z/2)}y.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Wd(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 $v(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 u=c;for(;u.length>s;){let m=u.lastIndexOf(" ",s);m<=0&&(m=s),o.push(u.slice(0,m)),u=u.slice(m).trimStart()}o.push(u)};return A.split(`
11
+ `).forEach(l),o.length===0&&o.push(""),o}function Rd(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=$v(A.text??i?.text??"Text",r,n),o=s.reduce((T,C)=>Math.max(T,C.length),1),c=Math.max(20,o*r*.58)+16,u=r*1.2,m=s.length*u+10,y=e-c/2,v=t-m;return{left:y,right:y+c,top:v,bottom:v+m+12}}class Xv{constructor(e,t,A={}){this.rawTime=e,this.price=t,this.text=A.text??"Text",this.color=A.color??"#5f8f96",this.fontSize=A.fontSize??12,this.fontWeight=A.fontWeight??"normal",this.fontStyle=A.fontStyle??"normal",this.textAlign=A.textAlign??"center",this.textWrap=A.textWrap??!1,this.borderEnabled=A.borderEnabled??!1,this.borderColor=A.borderColor??"#5f8f96",this.borderOpacity=A.borderOpacity??.1,this.borderWidth=A.borderWidth??1,this.bgEnabled=A.bgEnabled??!1,this.bgColor=A.bgColor??"#5f8f96",this.bgOpacity=A.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),u=l.priceToCoordinate(r.price);if(c==null||u==null)return;const m=s.horizontalPixelRatio,y=s.verticalPixelRatio,v=Math.round(c*m),T=Math.round(u*y),C=s.context;C.save();const U=Math.round(r.fontSize*y);C.font=`${r.fontStyle} ${r.fontWeight} ${U}px sans-serif`;const F=`${r.text??""}`,E=220*m,k=[],R=le=>{if(!r.textWrap||le.length===0){k.push(le);return}const pe=le.split(/\s+/);let we="";for(const be of pe){const Fe=we?`${we} ${be}`:be;C.measureText(Fe).width<=E||!we?we=Fe:(k.push(we),we=be)}k.push(we)};F.split(`
12
+ `).forEach(R),k.length===0&&k.push("");const M=k.map(le=>C.measureText(le).width),z=Math.max(...M,20*m),ie=8*m,G=5*y,K=z+ie*2,Ae=U*1.2,re=Ae*k.length+G*2,he=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",J=v-K/2,ee=T-re;r.bgEnabled&&(C.fillStyle=Wd(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(J,ee,K,re),C.fill()),r.borderEnabled&&(C.strokeStyle=Wd(r.borderColor,Math.max(0,Math.min(1,r.borderOpacity??.1))),C.lineWidth=Math.max(.5,(r.borderWidth??1)*y),C.beginPath(),C.rect(J,ee,K,re),C.stroke()),C.fillStyle=r.color,C.textAlign=he,C.textBaseline="middle";const ae=he==="left"?J+ie:he==="right"?J+K-ie:J+K/2;for(let le=0;le<k.length;le++)C.fillText(k[le],ae,ee+G+Ae*(le+.5));const ce=5*y,se=T+10*y;C.beginPath(),C.strokeStyle="#3b82f6",C.lineWidth=1.5*y,C.arc(v,se,ce,0,Math.PI*2),C.stroke(),C.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const Jv={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Gd(i){if(!i)return 7;const e=String(i).toUpperCase();return Jv[e]??7}function Zv(i,e){const t=String(i||"").toUpperCase(),A=e||Gd(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 HA=i=>{if(!Array.isArray(i)||i.length===0)return[];const e=i.map(A=>({...A,time:j(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)};function ot(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 u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Yv(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 u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function qv(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,u=t+c*s,m=A+c*o;return Math.hypot(i-u,e-m)}function Ai(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+1e-7)+s&&(A=!A)}return A}function $d(i,e,t){if(!i||!e||!t)return null;const A=i.normalizedTime??j(i.rawTime),r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(A==null||r==null||n==null)return null;const s=r-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-i.price)/s,l=t.price+o*(A-n),c=t.price+o*(r-n),u=j((A+r)/2),m=(l+c)/2;return u==null?null:{b1:{rawTime:i.rawTime,normalizedTime:A,price:l},b2:{rawTime:e.rawTime,normalizedTime:r,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:u,normalizedTime:u,price:m}}}function Vi(i,e,t,A=1){if(!Array.isArray(i)||i.length<2||!e||!t)return null;const r=e.normalizedTime??j(e.rawTime),n=t.normalizedTime??j(t.rawTime);if(r==null||n==null)return null;const s=Math.min(r,n),o=Math.max(r,n),l=i.map(G=>({time:j(G.time),close:typeof G.close=="number"?G.close:parseFloat(G.close)})).filter(G=>G.time!=null&&Number.isFinite(G.close)&&G.time>=s&&G.time<=o).sort((G,K)=>G.time-K.time);if(l.length<2)return null;const c=l.length;let u=0,m=0,y=0,v=0;for(let G=0;G<c;G++){const K=G,Ae=l[G].close;u+=K,m+=Ae,y+=K*Ae,v+=K*K}const T=c*v-u*u,C=Math.abs(T)<1e-12?0:(c*y-u*m)/T,U=(m-C*u)/c;let F=0;for(let G=0;G<c;G++){const K=U+C*G,Ae=l[G].close-K;F+=Ae*Ae}const E=Math.sqrt(F/c),k=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=U,ie=U+C*(c-1);return{slope:C,intercept:U,stdDev:E,offset:k,barCount:c,p1:{rawTime:R,normalizedTime:R,price:z},p2:{rawTime:M,normalizedTime:M,price:ie},top1:{rawTime:R,normalizedTime:R,price:z+k},top2:{rawTime:M,normalizedTime:M,price:ie+k},bot1:{rawTime:R,normalizedTime:R,price:z-k},bot2:{rawTime:M,normalizedTime:M,price:ie-k}}}function Ir(i,e,t,A=1){return Vi(i,e,t,A)}const jv={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}},eT={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 tT(i,e){if(!i||!i.type)return!1;const t=jv[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function AT(i){return i?eT[i]??"#22c55e":"#22c55e"}const iT=300,Xd=24,rT=150,Jd=150;function Va(i,e,t=iT){if(!Array.isArray(i)||i.length===0)return[];const A=nA(e),r=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of i){const l=j(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 nT(i){if(!Array.isArray(i)||i.length===0)return null;let e=null;for(const t of i){const A=j(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function sT(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 xs(i,e,t,A){const r=j(e),n=j(t),s=nA(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=y=>{const v=sT(i,y);if(v<=0)return 0;if(v>=i.length)return i.length-1;const T=i[v-1],C=i[v];return Math.abs(y-T)<=Math.abs(C-y)?v-1:v},u=c(r),m=c(n);return Math.max(1,Math.abs(m-u)+1)}function Zd(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=nT(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 u=A.getVisibleLogicalRange(),m=Number.isFinite(u?.from)&&Number.isFinite(u?.to)?u.to-u.from:null,y=Number.isFinite(m)&&m>20?m:120,v=Math.min(Jd,y/2),T=Math.max(20,y-v),C={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=nA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-rT*o,to:r+Jd*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const oT=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),u=q.useRef(null),m=q.useRef(null),y=q.useRef(null),v=q.useRef([]),T=q.useRef(!1),C=q.useRef(null),U=q.useRef(null),F=q.useRef(null),E=q.useRef(null),k=q.useRef([]),[R,M]=q.useState(null),[z,ie]=q.useState(null),[G,K]=q.useState([]),[Ae,re]=q.useState(null),[he,J]=q.useState([]),ee=q.useRef(null),ae=q.useRef(null),ce=q.useRef(null),se=q.useRef(!1),le=q.useRef(!1);q.useEffect(()=>{ce.current=R;let p=!1;v.current.forEach(g=>{if(g.type==="trendline"&&g.decoration){const N=g===R;g.decoration.isSelected!==N&&(g.decoration.isSelected=N,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const pe=q.useRef(new Map),we=q.useRef(null),be=q.useRef(null),Fe=(p,g)=>`${p}_${g}`,Ce=()=>{const p=Fe(ye,de);return pe.current.get(p)||null},ve=p=>{if(!p)return;const g=Fe(ye,de);pe.current.set(g,p)},{activeTool:Qe,setActiveTool:Ue,showGrid:ke,snapToGrid:Je,chartObjects:We,setChartObjects:Te,orders:Ne,selectedSymbol:ye,selectedTimeframe:de,drawingsVisible:_e,chartType:je,chartLocked:At,theme:rt,candleColors:vt,baseUrl:kt,endpoints:Me,endpointParams:ge,indicators:De,indicatorSettings:Ie}=Dt(),Se=q.useRef({}),[He,Ke]=q.useState({}),tt=q.useRef(0),Ve=q.useRef([]),[et,ct]=q.useState(!1),[yt,Et]=q.useState(null),[Ge,Lt]=q.useState([]),[Bt,Wt]=q.useState(!0),[Zt,ip]=q.useState(null),[ET,ux]=q.useState(0),Qs=q.useMemo(()=>{const p=Ge.map(g=>j(g?.time)).filter(g=>Number.isFinite(g));return p.sort((g,N)=>g-N),p},[Ge]),Fs=q.useRef(null),zi=q.useRef(new Map);q.useRef(null);const rp=q.useRef(0),vA=q.useRef(null),Wi=q.useRef(!1),Nr=q.useRef(!1);q.useEffect(()=>{const p=m.current;p&&p.setData(Va(Ge,de))},[Ge,de]),q.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const N=g.to-g.from,Be=(g.from+g.to)/2,H=N*.8;try{p.setVisibleRange({from:Be-H/2,to:Be+H/2}),ve(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g||!g.from||!g.to)return;const N=g.to-g.from,Be=(g.from+g.to)/2,H=N*1.25;try{p.setVisibleRange({from:Be-H/2,to:Be+H/2}),ve(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const g=p.querySelectorAll("canvas"),N=rt==="light"?"#ffffff":"#12161d";let Be=null,H=0;if(g.forEach(X=>{if(X.width>0&&X.height>0){const Z=X.width*X.height;Z>H&&(H=Z,Be=X)}}),Be)try{const X=document.createElement("canvas");X.width=Be.width,X.height=Be.height;const Z=X.getContext("2d");Z.fillStyle=N,Z.fillRect(0,0,X.width,X.height),Z.drawImage(Be,0,0);const ne=document.createElement("a");ne.download=`chart-${ye}-${de}-${Date.now()}.png`,ne.href=X.toDataURL("image/png"),ne.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Uv(p,{useCORS:!0,allowTaint:!0,backgroundColor:N,scale:2,logging:!1}).then(X=>{const Z=document.createElement("a");Z.download=`chart-${ye}-${de}-${Date.now()}.png`,Z.href=X.toDataURL("image/png"),Z.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(X=>{console.error("Chart screenshot failed",X),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ye,de,rt]);const Ra=q.useMemo(()=>Ge.length===0?[]:je==="line"||je==="area"?Ge.map(p=>({time:p.time,value:p.close})):Ge,[Ge,je]),LT=p=>{r?r(p):(Et("BUY"),ct(!0))},MT=p=>{n?n(p):(Et("SELL"),ct(!0))},HT=()=>{ct(!1),Et(null)},IT=p=>{const g=z;if(!g||!p)return;const N=(X,Z)=>{if(typeof X!="string")return Z;const ne=X.trim(),oe=ne.startsWith("#")?ne:`#${ne}`;return/^#[0-9A-Fa-f]{6}$/.test(oe)?oe.toLowerCase():Z},Be=(X,Z)=>{const ne=Number(X);return Number.isFinite(ne)?Math.max(0,Math.min(1,ne)):Z};let H={...g,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:g.visibleTimeframes};if(g.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):g.price,Z=g.primitive;Z&&(Z.text=typeof p.text=="string"?p.text:Z.text,Z.color=N(p.color,Z.color??"#5f8f96"),Z.fontSize=Number.isFinite(Number(p.fontSize))?Number(p.fontSize):Z.fontSize,Z.fontWeight=p.fontWeight==="bold"?"bold":"normal",Z.fontStyle=p.fontStyle==="italic"?"italic":"normal",Z.textAlign=["left","center","right"].includes(p.textAlign)?p.textAlign:Z.textAlign,Z.textWrap=!!p.textWrap,Z.borderEnabled=!!p.borderEnabled,Z.borderColor=N(p.borderColor,Z.borderColor??"#5f8f96"),Z.borderOpacity=Be(p.borderOpacity,Z.borderOpacity??.1),Z.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(p.borderWidth))?Number(p.borderWidth):1)),Z.bgEnabled=!!p.bgEnabled,Z.bgColor=N(p.bgColor,Z.bgColor??"#5f8f96"),Z.bgOpacity=Be(p.bgOpacity,Z.bgOpacity??.1),Z.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:g.text}}if(g.type==="trendline"){const X=N(p.lineColor,"#22c55e"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2));if(g.series)try{g.series.applyOptions({color:X,lineWidth:Z})}catch{}const ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.point1?.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.point2?.price;if(g.series&&g.point1&&g.point2){const Y=g.point1.time??g.point1.rawTime,B=g.point2.time??g.point2.rawTime;try{const h=HA([{time:Y,value:ne},{time:B,value:oe}]);h.length>0&&g.series.setData(h)}catch{}}const S={...g.point1,price:ne},O={...g.point2,price:oe};g.decoration&&(g.decoration.color=X,g.decoration.lineWidth=Z,g.decoration.arrowLeft=!!p.arrowLeft,g.decoration.arrowRight=!!p.arrowRight,g.decoration.rayLeft=!!p.rayLeft,g.decoration.rayRight=!!p.rayRight,g.decoration.statsColor=N(p.statsColor,"#5f8f96"),g.decoration.statsPosition=p.statsPosition??"right",g.decoration.statsShowAlways=!!p.statsShowAlways,g.decoration.statsPriceRange=!!p.statsPriceRange,g.decoration.statsBarsRange=!!p.statsBarsRange,g.decoration.statsDateRange=!!p.statsDateRange,g.decoration.statsAngle=!!p.statsAngle,g.decoration.statsDistance=!!p.statsDistance,g.decoration.p1=S,g.decoration.p2=O),H={...H,lineColor:X,lineWidth:Z,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsColor:N(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsShowAlways:!!p.statsShowAlways,statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,point1:S,point2:O,decoration:g.decoration}}if(g.type==="pricelevel"){const X=N(p.lineColor,"#3b82f6"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,oe=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=N(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price;if(g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,lineWidth:Z,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(oe&&S&&b)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h;else{const I=new Pd(h,{text:S,textColor:O,hAlign:Y,vAlign:B});try{b.attachPrimitive(I)}catch{}g.textPrimitive=I}else if(g.textPrimitive&&b){try{b.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:Z,showPrice:ne,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="horizontalray"){const X=N(p.lineColor,"#3b82f6"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showPrice!==!1,oe=!!p.showText,S=typeof p.textContent=="string"?p.textContent:"",O=N(p.textColor,"#ffffff"),Y=["left","center","right"].includes(p.textHAlign)?p.textHAlign:"center",B=["top","middle","bottom"].includes(p.textVAlign)?p.textVAlign:"top",h=Number.isFinite(Number(p.price))?Number(p.price):g.price,b=g.primitive;if(b&&(b.price=h,b.color=X,b.lineWidth=Z),g.priceLine)try{g.priceLine.applyOptions({price:h,color:X,axisLabelVisible:ne,title:ne&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(oe&&S&&I)if(g.textPrimitive)g.textPrimitive.text=S,g.textPrimitive.textColor=O,g.textPrimitive.hAlign=Y,g.textPrimitive.vAlign=B,g.textPrimitive.price=h,g.textPrimitive.originTime=g.rawOriginTime;else{const w=new Pd(h,{text:S,textColor:O,hAlign:Y,vAlign:B,originTime:g.rawOriginTime});try{I.attachPrimitive(w)}catch{}g.textPrimitive=w}else if(g.textPrimitive&&I){try{I.detachPrimitive(g.textPrimitive)}catch{}g.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:Z,showPrice:ne,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:g.textPrimitive}}if(g.type==="verticalline"){const X=N(p.lineColor,"#3b82f6"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.showDate!==!1,oe=g.primitive;oe&&(oe.color=X,oe.lineWidth=Z,oe.showDate=ne),H={...H,lineColor:X,lineWidth:Z,showDate:ne}}if(g.type==="infoline"){const X=N(p.lineColor,"#3b82f6"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=p.statsShowAlways!==!1,oe=N(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=!!p.statsAngle,b=!!p.statsDistance,I=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,d=g.p1.rawTime,_=g.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,x=g.p1.normalizedTime??0,f=g.p2.normalizedTime??0,D=nA(de)||3600,P=Math.abs(f-x),V=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),$=c.current,te=u.current,ue=$?$.timeScale().timeToCoordinate(d):null,me=te?te.priceToCoordinate(I):null,xe=$?$.timeScale().timeToCoordinate(_):null,Le=te?te.priceToCoordinate(w):null,$e=ue!=null&&me!=null&&xe!=null&&Le!=null?Math.atan2(-(Le-me),xe-ue)*(180/Math.PI):g.primitive?.info?.angle??0,Ye={priceDiff:Q,pricePct:L,bars:V,days:W,angle:$e},Re=g.primitive;Re&&(Re.color=X,Re.lineWidth=Z,Re.statsShowAlways=ne,Re.statsColor=oe,Re.statsPosition=S,Re.statsPriceRange=O,Re.statsBarsRange=Y,Re.statsDateRange=B,Re.statsAngle=h,Re.statsDistance=b,Re.p1={...g.p1,price:I},Re.p2={...g.p2,price:w},Re.info=Ye),H={...H,lineColor:X,lineWidth:Z,statsShowAlways:ne,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B,statsAngle:h,statsDistance:b,p1:{...g.p1,price:I},p2:{...g.p2,price:w}}}if(g.type==="rulerline"){const X=N(p.lineColor,"#3b82f6"),Z=p.showArea!==!1,ne=!!p.statsShowAlways,oe=N(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=g.primitive;h&&(h.lineColor=X,h.showArea=Z,h.statsShowAlways=ne,h.statsColor=oe,h.statsPosition=S,h.statsPriceRange=O,h.statsBarsRange=Y,h.statsDateRange=B),H={...H,lineColor:X,showArea:Z,statsShowAlways:ne,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B}}if(g.type==="arrowedline"){const X=N(p.lineColor,"#f59e0b"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=Z,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=N(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:oe}),H={...H,lineColor:X,lineWidth:Z,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:N(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:oe}}}if(g.type==="rayline"){const X=N(p.lineColor,"#7aa6ae"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=Z,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=N(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:oe}),H={...H,lineColor:X,lineWidth:Z,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:N(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:oe}}}if(g.type==="extendedline"){const X=N(p.lineColor,"#7aa6ae"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=Z,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=N(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsBarsRange=!!p.statsBarsRange,S.statsDateRange=!!p.statsDateRange,S.statsAngle=!!p.statsAngle,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:oe}),H={...H,lineColor:X,lineWidth:Z,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:N(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsBarsRange:!!p.statsBarsRange,statsDateRange:!!p.statsDateRange,statsAngle:!!p.statsAngle,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:oe}}}if(g.type==="crossline"){const X=N(p.lineColor,"#06a0e3"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.price))?Number(p.price):g.p.price,oe=g.primitive;oe&&(oe.color=X,oe.lineWidth=Z,oe.showTime=!!p.showTime,oe.showPrice=!!p.showPrice,oe.center={...g.p,price:ne}),H={...H,lineColor:X,lineWidth:Z,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...g.p,price:ne}}}if(g.type==="trendbyangle"){const X=N(p.lineColor,"#7aa6ae"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p2.price,S=g.primitive;S&&(S.color=X,S.lineWidth=Z,S.arrowLeft=!!p.arrowLeft,S.arrowRight=!!p.arrowRight,S.rayLeft=!!p.rayLeft,S.rayRight=!!p.rayRight,S.statsShowAlways=!!p.statsShowAlways,S.statsColor=N(p.statsColor,"#5f8f96"),S.statsPosition=p.statsPosition??"right",S.statsPriceRange=!!p.statsPriceRange,S.statsDistance=!!p.statsDistance,S.p1={...g.p1,price:ne},S.p2={...g.p2,price:oe}),H={...H,lineColor:X,lineWidth:Z,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,statsShowAlways:!!p.statsShowAlways,statsColor:N(p.statsColor,"#5f8f96"),statsPosition:p.statsPosition??"right",statsPriceRange:!!p.statsPriceRange,statsDistance:!!p.statsDistance,p1:{...g.p1,price:ne},p2:{...g.p2,price:oe}}}if(g.type==="disjointchannel"){const X=N(p.lineColor,"#129f5c"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=N(p.fillColor,"#6aa84f"),oe=Be(p.fillOpacity,.1),S=N(p.pricesColor,"#129f5c"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=Z,h.fillColor=ne,h.fillOpacity=oe,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:Z,fillColor:ne,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}if(g.type==="flattopbottom"){const X=N(p.lineColor,"#3b82f6"),Z=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ne=N(p.fillColor,"#3b82f6"),oe=Be(p.fillOpacity,.12),S=N(p.pricesColor,"#3b82f6"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):g.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):g.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):g.p2.price,h=g.primitive;h&&(h.lineColor=X,h.lineWidth=Z,h.fillColor=ne,h.fillOpacity=oe,h.showBackground=!!p.showBackground,h.showPrices=!!p.showPrices,h.pricesColor=S,h.rayLeft=!!p.rayLeft,h.rayRight=!!p.rayRight,h.arrowLeft=!!p.arrowLeft,h.arrowRight=!!p.arrowRight,h.p1={...g.p1,price:O},h.p3={...g.p3,price:Y},h.p2={...g.p2,price:B}),H={...H,lineColor:X,lineWidth:Z,fillColor:ne,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...g.p1,price:O},p3:{...g.p3,price:Y},p2:{...g.p2,price:B}}}Te(X=>{const Z=X.map(ne=>ne===g?H:ne);return v.current=Z,Z}),ce.current===g&&(ce.current=H),M(X=>X===g?H:X),re(X=>X===g?H:X),ie(H);try{c.current?.applyOptions({})}catch{}};q.useEffect(()=>{const p=o.current;if(!p)return;const g=p.getBoundingClientRect(),N=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},Be=rt==="light",H=J0(p,{width:g.width||p.clientWidth,height:g.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:N},layout:{background:{color:Be?"#FFFFFF":"#0d1117",type:"solid"},textColor:Be?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:ke,color:ke?Be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:ke?2:0},horzLines:{visible:ke,color:ke?Be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:ke?2:0}},rightPriceScale:{borderColor:Be?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:Be?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:Be?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:Qe===1?1:0,vertLine:{width:1,color:Be?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Be?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:Be?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Be?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:Qe===1,horzLineVisible:Qe===1},handleScroll:{mouseWheel:!0,pressedMouseMove:Qe===null||Qe===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}}),X=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),Z=X.includes("JPY"),ne=Kr(X),oe=Or(X);let S,O;Z?(S=.001,O=w=>Math.abs(Number(w)).toFixed(3)):ne?X.startsWith("BTC")||X.startsWith("ETH")?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(4)):oe&&(X.startsWith("XAU")||X.startsWith("XAG"))?(S=.01,O=w=>Math.abs(Number(w)).toFixed(2)):(S=1e-4,O=w=>Math.abs(Number(w)).toFixed(5));const Y=H.addCandlestickSeries({upColor:Be?"#089981":"#26a69a",downColor:Be?"#f23645":"#ef5350",wickUpColor:Be?"#089981":"#26a69a",wickDownColor:Be?"#f23645":"#ef5350",borderUpColor:Be?"#089981":"#26a69a",borderDownColor:Be?"#f23645":"#ef5350",borderVisible:!0,priceFormat:{type:"custom",minMove:S,formatter:O}}),B=H.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)",priceScaleId:""});c.current=H,u.current=Y,m.current=B,B.setData(Va(Ge,de)),requestAnimationFrame(()=>{if(p&&H){const w=p.getBoundingClientRect();w.width>0&&w.height>0&&H.resize(w.width,w.height)}});const h=H.timeScale(),b=()=>{if(le.current&&zi.current.size>0){const w=h.getVisibleRange();w&&ve(w)}};h.subscribeVisibleTimeRangeChange(b);const I=new ResizeObserver(w=>{for(const d of w){const{width:_,height:Q}=d.contentRect;if(_>0&&Q>0&&H){const L=h.getVisibleRange();H.resize(_,Q),L&&setTimeout(()=>{try{h.setVisibleRange(L)}catch{}},0)}}});return I.observe(p),()=>{h.unsubscribeVisibleTimeRangeChange(b),I.disconnect(),H.remove(),c.current=null,u.current=null,m.current=null,y.current=null,v.current=[],vA.current&&clearTimeout(vA.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 p=c.current;if(!p)return;const g=rt==="light";p.applyOptions({layout:{background:{color:g?"#FFFFFF":"#12161d"},textColor:g?"#020617":"#fff"},grid:{vertLines:{color:ke?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:ke?g?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:g?"#e5e7eb":"#1e293b"},timeScale:{borderColor:g?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1},horzLine:{color:g?"#3b82f6":"#58a6ff",labelBackgroundColor:g?"#eff6ff":"#161b22",width:1}}})},[rt,ke]),q.useEffect(()=>{const p=u.current;!p||!vt||p.applyOptions({upColor:vt.upColor,downColor:vt.downColor,wickUpColor:vt.upColor,wickDownColor:vt.downColor,borderUpColor:vt.upColor,borderDownColor:vt.downColor})},[vt]),q.useEffect(()=>{if(!c.current)return;const g=!At&&!(Qe!==null&&Qe!==1&&Qe!==0),N=!At;c.current.applyOptions({crosshair:{mode:Qe===1?1:0,vertLine:{visible:Qe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:Qe===1,width:1,color:rt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:rt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:N,pressedMouseMove:g,horzTouchDrag:g,vertTouchDrag:g},handleScale:{axisPressedMouseMove:{time:g,price:g},axisDoubleClickReset:{time:!1,price:N},axisTouch:{time:g,price:g},mouseWheel:N,pinch:N}})},[Qe,At]);const DT=()=>{const p=u.current;v.current.forEach(g=>{if(g.primitive){try{p&&p.detachPrimitive(g.primitive)}catch{}if(g.series&&g.series!==p)try{g.series.detachPrimitive(g.primitive)}catch{}}if(g.priceLine&&p)try{p.removePriceLine(g.priceLine)}catch{}if(g.textPrimitive&&p)try{p.detachPrimitive(g.textPrimitive)}catch{}}),v.current=[],Te([]),Ue(null)},np=(p,g=!1)=>{p&&v.current.forEach(N=>{if(N.primitive){try{p.detachPrimitive(N.primitive)}catch{}try{p.attachPrimitive(N.primitive)}catch{}}if(g&&N.type==="pricelevel"&&N.priceLine)try{const Be=N.showPrice!==!1,H=p.createPriceLine({price:N.price,color:N.lineColor??"#3b82f6",lineWidth:N.lineWidth??2,lineStyle:0,axisLabelVisible:Be,title:Be&&typeof N.price=="number"?N.price.toFixed(5):""});N.priceLine=H}catch{}if(g&&N.type==="horizontalray"&&N.priceLine)try{const Be=N.showPrice!==!1,H=p.createPriceLine({price:N.price,color:N.lineColor??"#3b82f6",lineWidth:N.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:Be,title:Be&&typeof N.price=="number"?N.price.toFixed(5):""});N.priceLine=H}catch{}})};q.useEffect(()=>{(async()=>{if(!ye||!de){Lt([]),le.current=!1;return}try{if(vA.current&&(clearTimeout(vA.current),vA.current=null),Wi.current=!0,Wt(!0),ip(null),Lt([]),le.current=!1,Nr.current=!1,be.current!==null&&be.current!==ye&&DT(),be.current=ye,u.current)try{u.current.setData([])}catch{}const g=Gd(de),N=Zv(de,g),Be=kt||Lv?.VITE_BASE_URL||"http://localhost:5002",H=Me?.candles||"/api/chart/candles",X=ge?.candles||{},Z={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},ne={};ne[Z.symbol]=ye,ne[Z.timeframe]=de,ne[Z.limit]=N,X.daysBack!==!1&&(ne[Z.daysBack]=g);const oe=await ht.get(`${Be}${H}`,{params:ne,timeout:1e4});let S=[];if(Array.isArray(oe.data)?S=oe.data:oe.data&&oe.data.data&&Array.isArray(oe.data.data)?S=oe.data.data:oe.data&&Array.isArray(oe.data)&&(S=oe.data),S&&S.length>0){const{candles:O,stats:Y}=qa(S,ye,de);O.length>0?(Lt(O),zi.current=new Map,O.forEach(B=>{zi.current.set(B.time,B)}),Nr.current=!0,Wi.current=!1,Fs.current?.connected&&ye&&de&&Fs.current.emit("subscribeCandles",{symbol:ye,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${ye}`),Wi.current=!1,Lt([]))}else console.warn(`⚠️ No candle data returned for ${ye}`),Wi.current=!1,Lt([])}catch(g){console.error(`❌ Error fetching ${ye}:`,g.message);const N=g.code==="ECONNABORTED"||g.message&&g.message.includes("timeout");ip(N?"Request timed out. No data available for this symbol.":g.message||"Failed to load candles."),Wi.current=!1,Lt([]),Wt(!1)}})()},[ye,de,ET]),q.useEffect(()=>{Fs.current=Qn.getSocket();const p=Fs.current,g=()=>{if(Nr.current&&ye&&de&&p.connected){const ne={symbol:ye,timeframe:de};p.emit("subscribeCandles",ne)}},N=()=>{setTimeout(()=>{ye&&de&&g()},200)},Be=ne=>{},H=ne=>{};p.on("connect",N),p.on("disconnect",Be),p.on("connect_error",H),p.on("subscription:confirmed",ne=>{ne.type});const X=ne=>{if(!Nr.current||!ne||!ne.candle||!ne.symbol)return;const oe=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(oe(ne.symbol)!==oe(ye)||ne.timeframe&&ne.timeframe!==de)return;const{candle:S}=ne,O=ja(S,ye,de);if(!O)return;const Y=Date.now();if(Y-rp.current<200)return;rp.current=Y;const B=c.current?.timeScale(),h=B?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!le.current&&!Nr.current||b?.seriesType?.()!==(je==="line"?"Line":je==="area"?"Area":je==="bars"?"Bar":"Candlestick")))try{const _=zi.current.get(O.time),Q=!_,L=_?{time:O.time,open:_.open,high:Math.max(_.high,O.high),low:Math.min(_.low,O.low),close:O.close}:O;zi.current.set(O.time,L),Q&&m.current&&m.current.setData(Va(Array.from(zi.current.values()),de));try{je==="line"||je==="area"?b.update({time:L.time,value:L.close}):b.update(L),B&&h&&ve(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",X);const Z=()=>{p.connected&&ye&&de&&g()};if(p.connected)Z();else{const ne=()=>{setTimeout(Z,200)};p.once("connect",ne),setTimeout(()=>{p.connected&&Z()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",N),p.off("disconnect",Be),p.off("connect_error",H),p.off("subscription:confirmed"),ye&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:ye,timeframe:de})}},[ye,de,kt]),q.useEffect(()=>{const p=u.current,g=c.current;if(!(!p||!g)&&!(Wi.current&&Ge.length>0)&&!(Ge.length===0&&le.current)){if(Ge.length===0&&!le.current){if(Bt)return;const N=g.timeScale();p.setData([]),N.fitContent(),vA.current&&clearTimeout(vA.current),vA.current=setTimeout(()=>requestAnimationFrame(()=>Wt(!1)),400);return}if(!le.current){const N=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),Be=N.includes("JPY"),H=Or(N),X=Kr(N);let Z,ne;Be?(Z=.001,ne=h=>Math.abs(Number(h)).toFixed(3)):X?N.startsWith("BTC")||N.startsWith("ETH")?(Z=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(Z=1e-4,ne=h=>Math.abs(Number(h)).toFixed(4)):H&&(N.startsWith("XAU")||N.startsWith("XAG"))?(Z=.01,ne=h=>Math.abs(Number(h)).toFixed(2)):(Z=1e-4,ne=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:Z,formatter:ne}})}catch{}const oe=g.timeScale(),S=Fe(ye,de);we.current,we.current=S;const O=[...Ge].sort((h,b)=>h.time-b.time);if(je==="line"||je==="area"){const h=O?.map(b=>({time:b.time,value:b.close})).filter(b=>b.time!=null);h.length>0&&p.setData(h)}else O?.length>0&&p.setData(O);np(p);const Y=nA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=ze(Q,Y);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=ze(Q,Y);h.primitive.time=L,h.time=j(L);return}if(h.type==="infoline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=W=>{const $=ze(W,Y);return x==null||f==null?$:Math.min(Math.max($,x),f)},P=D(Q),V=D(L);h.p1.rawTime=P,h.p1.normalizedTime=j(P),h.p2.rawTime=V,h.p2.normalizedTime=j(V),h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:V,price:h.p2.price};return}if(h.type==="rulerline"&&h.primitive&&h.p1&&h.p2){const Q=h.rawP1Time??h.p1.rawTime,L=h.rawP2Time??h.p2.rawTime,x=O.length>0?O[0].time:null,f=O.length>0?O[O.length-1].time:null,D=ue=>{const me=ze(ue,Y);return x==null||f==null?me:Math.min(Math.max(me,x),f)},P=D(Q),V=D(L);h.p1.rawTime=P,h.p2.rawTime=V,h.primitive.p1={rawTime:P,price:h.p1.price},h.primitive.p2={rawTime:V,price:h.p2.price};const W=j(P),$=j(V),te=Math.abs(($??0)-(W??0));h.primitive.info={priceDiff:h.p2.price-h.p1.price,pricePct:(h.p2.price-h.p1.price)/Math.abs(h.p1.price||1)*100,bars:xs(Qs,P,V,de),days:Math.max(1,Math.round(te/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=ze(Q,Y),f=ze(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=f,h.p2.normalizedTime=j(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="rayline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=ze(Q,Y),f=ze(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=f,h.p2.normalizedTime=j(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="extendedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=ze(Q,Y),f=ze(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=f,h.p2.normalizedTime=j(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="trendbyangle"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=ze(Q,Y),f=ze(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=f,h.p2.normalizedTime=j(f),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:f,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=ze(L.rawTime,Y);L.rawTime=x,L.normalizedTime=j(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="flattopbottom"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=ze(L.rawTime,Y);L.rawTime=x,L.normalizedTime=j(x)};Q(h.p1),Q(h.p2),Q(h.p3),Q(h.p4),h.primitive.p1={rawTime:h.p1.rawTime,price:h.p1.price},h.primitive.p2={rawTime:h.p2.rawTime,price:h.p2.price},h.primitive.p3={rawTime:h.p3.rawTime,price:h.p3.price},h.primitive.p4={rawTime:h.p4.rawTime,price:h.p4.price};return}if(h.type==="regressionchannel"&&h.primitive&&h.p1&&h.p2){const Q=Vi(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.intercept=Q.intercept,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="stddevchannel"&&h.primitive&&h.p1&&h.p2){const Q=Ir(O,h.p1,h.p2,h.stdMultiplier??1);if(!Q)return;const L=h.primitive;L.mid1={rawTime:Q.p1.rawTime,price:Q.p1.price},L.mid2={rawTime:Q.p2.rawTime,price:Q.p2.price},L.top1={rawTime:Q.top1.rawTime,price:Q.top1.price},L.top2={rawTime:Q.top2.rawTime,price:Q.top2.price},L.bot1={rawTime:Q.bot1.rawTime,price:Q.bot1.price},L.bot2={rawTime:Q.bot2.rawTime,price:Q.bot2.price},h.p1=Q.p1,h.p2=Q.p2,h.top1=Q.top1,h.top2=Q.top2,h.bot1=Q.bot1,h.bot2=Q.bot2,h.slope=Q.slope,h.stdDev=Q.stdDev,h.offset=Q.offset,h.barCount=Q.barCount;return}if(h.type==="andrewspitchfork"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ze(h.p1.rawTime,Y),L=ze(h.p2.rawTime,Y),x=ze(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=x,h.p3.normalizedTime=j(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="gannfan"||h.type==="ganngrid")&&h.primitive&&h.p1&&h.p2){const Q=ze(h.p1.rawTime,Y),L=ze(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if((h.type==="circle"||h.type==="ellipse")&&h.primitive&&h.p1&&h.p2){const Q=ze(h.p1.rawTime,Y),L=ze(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type==="triangle"&&h.primitive&&h.p1&&h.p2&&h.p3){const Q=ze(h.p1.rawTime,Y),L=ze(h.p2.rawTime,Y),x=ze(h.p3.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.p3.rawTime=x,h.p3.normalizedTime=j(x),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price},h.primitive.p3={rawTime:x,price:h.p3.price};return}if((h.type==="fibonacci"||h.type==="rectangle")&&h.primitive&&h.p1&&h.p2){const Q=ze(h.p1.rawTime,Y),L=ze(h.p2.rawTime,Y);h.p1.rawTime=Q,h.p1.normalizedTime=j(Q),h.p2.rawTime=L,h.p2.normalizedTime=j(L),h.primitive.p1={rawTime:Q,price:h.p1.price},h.primitive.p2={rawTime:L,price:h.p2.price};return}if(h.type!=="trendline"&&h.type!=="gannline"||!h.series||!h.point1||!h.point2)return;const b=h.point1.rawTime??h.point1.time,I=h.point2.rawTime??h.point2.time,w=ze(b,Y),d=ze(I,Y);h.point1.time=w,h.point2.time=d;const _=HA([{time:w,value:h.point1.price},{time:d,value:h.point2.price}]);try{_.length>0&&h.series.setData(_)}catch{}}),O?.length>0){const h=O[O?.length-1].time,b=nA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*b;try{oe.setVisibleRange({from:w,to:h+b*Xd})}catch{oe.fitContent()}}else oe.fitContent();try{g.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0;const B=oe.getVisibleRange();ve(B),vA.current&&clearTimeout(vA.current),vA.current=setTimeout(()=>requestAnimationFrame(()=>Wt(!1)),400)}}},[Ge.length,je,ye,de]),q.useEffect(()=>{const p=c.current;if(!p||!le.current||Ge.length===0)return;const g=p.timeScale(),N=g.getVisibleRange()||Ce();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let Be;const H=(typeof ye=="string"?ye:ye?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),Z=Or(H),ne=Kr(H);let oe,S;X?(oe=.001,S=B=>Math.abs(Number(B)).toFixed(3)):ne?H.startsWith("BTC")||H.startsWith("ETH")?(oe=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(oe=1e-4,S=B=>Math.abs(Number(B)).toFixed(4)):Z&&(H.startsWith("XAU")||H.startsWith("XAG"))?(oe=.01,S=B=>Math.abs(Number(B)).toFixed(2)):(oe=1e-4,S=B=>Math.abs(Number(B)).toFixed(5));const O={type:"custom",minMove:oe,formatter:S};if(je==="bars"){const B=rt==="light";Be=p.addBarSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ge].sort((b,I)=>b.time-I.time);h?.length>0&&Be.setData(h)}else if(je==="line"){Be=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=HA(Ra);B.length>0&&Be.setData(B)}else if(je==="area"){Be=p.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=HA(Ra);B.length>0&&Be.setData(B)}else if(je==="volume ticks"||je==="volume"){const B=rt==="light";Be=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,priceScaleId:"right"});const h=[...Ge].sort((w,d)=>w.time-d.time);h?.length>0&&Be.setData(h);const b=p.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),p.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const I=h?.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)"}));I.length>0&&b.setData(I),y.current=b}else{const B=rt==="light";Be=p.addCandlestickSeries({upColor:B?"#089981":"#26A69A",downColor:B?"#f23645":"#EF5350",wickUpColor:B?"#089981":"#26A69A",wickDownColor:B?"#f23645":"#EF5350",borderUpColor:B?"#089981":"#26A69A",borderDownColor:B?"#f23645":"#EF5350",borderVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const h=[...Ge].sort((b,I)=>b.time-I.time);h?.length>0&&Be.setData(h)}u.current=Be,np(Be,!0);const Y=nA(de)||60;if(v.current.forEach(B=>{if(B.type==="horizontalray"&&B.primitive){const L=B.rawOriginTime??B.primitive.originTime,x=ze(L,Y);B.primitive.originTime=x,B.originTime=x;return}if(B.type==="verticalline"&&B.primitive){const L=B.rawTime??B.primitive.time,x=ze(L,Y);B.primitive.time=x,B.time=j(x);return}if(B.type==="infoline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ge].sort((te,ue)=>te.time-ue.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,V=te=>{const ue=ze(te,Y);return D==null||P==null?ue:Math.min(Math.max(ue,D),P)},W=V(L),$=V(x);B.p1.rawTime=W,B.p1.normalizedTime=j(W),B.p2.rawTime=$,B.p2.normalizedTime=j($),B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:$,price:B.p2.price};return}if(B.type==="rulerline"&&B.primitive&&B.p1&&B.p2){const L=B.rawP1Time??B.p1.rawTime,x=B.rawP2Time??B.p2.rawTime,f=[...Ge].sort((xe,Le)=>xe.time-Le.time),D=f.length>0?f[0].time:null,P=f.length>0?f[f.length-1].time:null,V=xe=>{const Le=ze(xe,Y);return D==null||P==null?Le:Math.min(Math.max(Le,D),P)},W=V(L),$=V(x);B.p1.rawTime=W,B.p2.rawTime=$,B.primitive.p1={rawTime:W,price:B.p1.price},B.primitive.p2={rawTime:$,price:B.p2.price};const te=j(W),ue=j($),me=Math.abs((ue??0)-(te??0));B.primitive.info={priceDiff:B.p2.price-B.p1.price,pricePct:(B.p2.price-B.p1.price)/Math.abs(B.p1.price||1)*100,bars:xs(Qs,W,$,de),days:Math.max(1,Math.round(me/86400))};return}if(B.type==="arrowedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=ze(L,Y),D=ze(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=j(f),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="rayline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=ze(L,Y),D=ze(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=j(f),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="extendedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=ze(L,Y),D=ze(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=j(f),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="trendbyangle"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,f=ze(L,Y),D=ze(x,Y);B.p1.rawTime=f,B.p1.normalizedTime=j(f),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:f,price:B.p1.price},B.primitive.p2={rawTime:D,price:B.p2.price};return}if(B.type==="disjointchannel"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=ze(x.rawTime,Y);x.rawTime=f,x.normalizedTime=j(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="flattopbottom"&&B.primitive&&B.p1&&B.p2&&B.p3&&B.p4){const L=x=>{const f=ze(x.rawTime,Y);x.rawTime=f,x.normalizedTime=j(f)};L(B.p1),L(B.p2),L(B.p3),L(B.p4),B.primitive.p1={rawTime:B.p1.rawTime,price:B.p1.price},B.primitive.p2={rawTime:B.p2.rawTime,price:B.p2.price},B.primitive.p3={rawTime:B.p3.rawTime,price:B.p3.price},B.primitive.p4={rawTime:B.p4.rawTime,price:B.p4.price};return}if(B.type==="regressionchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ge].sort((D,P)=>D.time-P.time),x=Vi(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.intercept=x.intercept,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="stddevchannel"&&B.primitive&&B.p1&&B.p2){const L=[...Ge].sort((D,P)=>D.time-P.time),x=Ir(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const f=B.primitive;f.mid1={rawTime:x.p1.rawTime,price:x.p1.price},f.mid2={rawTime:x.p2.rawTime,price:x.p2.price},f.top1={rawTime:x.top1.rawTime,price:x.top1.price},f.top2={rawTime:x.top2.rawTime,price:x.top2.price},f.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},f.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price},B.p1=x.p1,B.p2=x.p2,B.top1=x.top1,B.top2=x.top2,B.bot1=x.bot1,B.bot2=x.bot2,B.slope=x.slope,B.stdDev=x.stdDev,B.offset=x.offset,B.barCount=x.barCount;return}if(B.type==="andrewspitchfork"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=ze(B.p1.rawTime,Y),x=ze(B.p2.rawTime,Y),f=ze(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.p3.rawTime=f,B.p3.normalizedTime=j(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="gannfan"||B.type==="ganngrid")&&B.primitive&&B.p1&&B.p2){const L=ze(B.p1.rawTime,Y),x=ze(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if((B.type==="circle"||B.type==="ellipse")&&B.primitive&&B.p1&&B.p2){const L=ze(B.p1.rawTime,Y),x=ze(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type==="triangle"&&B.primitive&&B.p1&&B.p2&&B.p3){const L=ze(B.p1.rawTime,Y),x=ze(B.p2.rawTime,Y),f=ze(B.p3.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.p3.rawTime=f,B.p3.normalizedTime=j(f),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:f,price:B.p3.price};return}if((B.type==="fibonacci"||B.type==="rectangle")&&B.primitive&&B.p1&&B.p2){const L=ze(B.p1.rawTime,Y),x=ze(B.p2.rawTime,Y);B.p1.rawTime=L,B.p1.normalizedTime=j(L),B.p2.rawTime=x,B.p2.normalizedTime=j(x),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price};return}if(B.type!=="trendline"&&B.type!=="gannline"||!B.series||!B.point1||!B.point2)return;const h=B.type==="gannline"?"#7aa6ae":"#22c55e";try{p.removeSeries(B.series)}catch{}const b=p.addLineSeries({color:B.lineColor??h,lineWidth:B.lineWidth??2,priceLineVisible:!1,lastValueVisible:!1}),I=B.point1.rawTime??B.point1.time,w=B.point2.rawTime??B.point2.time,d=ze(I,Y),_=ze(w,Y);B.point1.time=d,B.point2.time=_;const Q=HA([{time:d,value:B.point1.price},{time:_,value:B.point2.price}]);try{Q.length>0&&b.setData(Q)}catch{}if(B.decoration)try{b.attachPrimitive(B.decoration)}catch{}B.series=b}),N&&le.current)setTimeout(()=>{try{g.setVisibleRange(N),ve(N)}catch{if(Ge.length>0)try{const h=Ge[Ge.length-1].time,b=nA(de)||60,I=h-100*b;g.setVisibleRange({from:I,to:h+b*Xd}),ve(g.getVisibleRange())}catch{g.fitContent(),ve(g.getVisibleRange())}}try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!le.current){g.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0,ve(g.getVisibleRange())}},[je,Ge.length,Ra.length,ye]),q.useEffect(()=>{const p=c.current,g=y.current;if(!p||!g||!le.current||Ge.length===0||je!=="volume"&&je!=="volume ticks")return;const Be=[...Ge].sort((H,X)=>H.time-X.time)?.map(H=>({time:H.time,value:H.volume||0,color:H.close>=H.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Be.length>0&&g.setData(Be)},[Ge,je]),q.useEffect(()=>{if(!ye||!de||!De)return;const g=Object.entries(De).filter(([Z,ne])=>ne).map(([Z])=>Z).filter(Z=>Z.startsWith("sma")||Z.startsWith("ema")||Z==="rsi"||Z==="macd");if(g.length===0){Ke({});return}const N=g.map(Z=>Z==="sma20"?`sma:${Ie?.smaPeriod||20}`:Z==="sma50"?"sma:50":Z==="ema12"?`ema:${Ie?.emaPeriod||12}`:Z==="rsi"?`rsi:${Ie?.rsiPeriod||14}`:Z==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!N)return;const Be=++tt.current,H=kt||"http://localhost:5002",X=Me?.indicators||"/api/market-data/indicators";ht.get(`${H}${X}`,{params:{symbol:ye,timeframe:de,indicators:N}}).then(Z=>{Be===tt.current&&Ke(Z.data?.data||{})}).catch(Z=>{console.error("[ChartArea] Indicator fetch error:",Z?.message),Be===tt.current&&Ke({})})},[ye,de,De,Ie,kt,Me]),q.useEffect(()=>{const p=c.current;if(!p||!le.current)return;const g=Se.current,N=(oe,S)=>(g[oe]||(g[oe]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...S})),g[oe]),Be=oe=>{if(g[oe]){try{p.removeSeries(g[oe])}catch{}delete g[oe]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(Be)},X=De||{};if(X.sma20&&He.sma20?.data?.length?N("sma20",{color:"#2196F3",lineWidth:1.5}).setData(He.sma20.data.map(S=>({time:S.time,value:S.value}))):Be("sma20"),X.sma50&&He.sma50?.data?.length?N("sma50",{color:"#FF9800",lineWidth:1.5}).setData(He.sma50.data.map(S=>({time:S.time,value:S.value}))):Be("sma50"),X.ema12&&He.ema12?.data?.length?N("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(He.ema12.data.map(S=>({time:S.time,value:S.value}))):Be("ema12"),X.rsi&&He.rsi?.data?.length){const oe=N("rsi",{color:"#FF5722",lineWidth:1.5,priceScaleId:"rsi",priceFormat:{type:"custom",minMove:.01,formatter:B=>B.toFixed(1)}});p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0},borderVisible:!1,autoScale:!0}),oe.setData(He.rsi.data.map(B=>({time:B.time,value:B.value}))),g.rsi70||(g.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),g.rsi30||(g.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const S=He.rsi.data,O=S[0]?.time,Y=S[S.length-1]?.time;O&&Y&&(g.rsi70.setData([{time:O,value:70},{time:Y,value:70}]),g.rsi30.setData([{time:O,value:30},{time:Y,value:30}]))}else Be("rsi"),Be("rsi70"),Be("rsi30");if(X.macd&&He.macd?.data?.length){const oe=N("macdLine",{color:"#2196F3",lineWidth:1.5,priceScaleId:"macd",priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}),S=N("macdSignal",{color:"#FF9800",lineWidth:1.5,priceScaleId:"macd"});g.macdHist||(g.macdHist=p.addHistogramSeries({priceScaleId:"macd",priceLineVisible:!1,lastValueVisible:!1,priceFormat:{type:"custom",minMove:1e-4,formatter:B=>B.toFixed(4)}}));const O=X.rsi?.65:.8;p.priceScale("macd").applyOptions({scaleMargins:{top:O,bottom:0},borderVisible:!1,autoScale:!0}),X.rsi&&p.priceScale("rsi").applyOptions({scaleMargins:{top:.8,bottom:0}});const Y=He.macd.data;oe.setData(Y.map(B=>({time:B.time,value:B.value}))),S.setData(Y.map(B=>({time:B.time,value:B.signal}))),g.macdHist.setData(Y.map(B=>({time:B.time,value:B.histogram,color:B.histogram>=0?"rgba(38,166,154,0.6)":"rgba(239,83,80,0.6)"})))}else H();const Z=X.rsi&&He.rsi?.data?.length||X.macd&&He.macd?.data?.length,ne=X.rsi&&He.rsi?.data?.length&&X.macd&&He.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:ne?.4:Z?.25:.05}})}catch{}},[He,De,Ge.length]),q.useEffect(()=>()=>{const p=c.current;if(!p)return;const g=Se.current;Object.keys(g).forEach(N=>{try{p.removeSeries(g[N])}catch{}}),Se.current={}},[ye,de]),q.useEffect(()=>{const p=c.current,g=u.current,N=o.current;if(!p||!g||!N)return;const H=Qe!==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"][Qe]:null,X=(S,O)=>{const Y=Math.min(S.time,O.time),B=Math.max(S.time,O.time),h=S.time<=O.time?S.rawTime:O.rawTime,b=S.time<=O.time?O.rawTime:S.rawTime,I=Math.max(S.price,O.price),w=Math.min(S.price,O.price),d=j(Math.round((Y+B)/2));return d==null?null:{p1:{rawTime:d,normalizedTime:d,price:I},p2:{rawTime:h,normalizedTime:Y,price:w},p3:{rawTime:b,normalizedTime:B,price:w}}};if(!H){if(T.current=!1,C.current=null,U.current=null,E.current=null,F.current?.series)try{p.removeSeries(F.current.series)}catch{}if(F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null;return}if(H==="pricelevel"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};Te(_=>[..._,d]),v.current.push(d),Ue(null)};return N.addEventListener("click",S),()=>{N.removeEventListener("click",S)}}if(H==="horizontalray"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Mv(I,b);g.attachPrimitive(w);const d=g.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,lineVisible:!1,axisLabelVisible:!0,title:typeof I=="number"?I.toFixed(5):""}),_=j(b),Q={type:"horizontalray",primitive:w,priceLine:d,price:I,originTime:_,rawOriginTime:b,lineColor:"#3b82f6",lineWidth:2,showPrice:!0,showText:!1};Te(L=>[...L,Q]),v.current.push(Q),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="verticalline"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=p.timeScale().coordinateToTime(B);if(h==null)return;const b=new Gv(h);g.attachPrimitive(b);const I=j(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};Te(d=>[...d,w]),v.current.push(w),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="text"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=new Xv(b,I);g.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};Te(_=>[..._,d]),v.current.push(d),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="infoline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;O||(O=p.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const Q=S.normalizedTime,L=j(d);if(Q==null||L==null||Q===L)return;const x=Q<=L?[{time:Q,value:S.price},{time:L,value:_}]:[{time:L,value:_},{time:Q,value:S.price}];try{O.setData(x)}catch{}},B=h=>{const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d),x:I,y:w};return}if(O){try{p.removeSeries(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null)return;const x=_-S.price,f=x/Math.abs(S.price)*100,D=nA(de)||3600,P=Math.abs(L-Q),V=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),$=S.x,te=S.y,ue=I,xe=Math.atan2(-(w-te),ue-$)*(180/Math.PI),Le={priceDiff:x,pricePct:f,bars:V,days:W,angle:xe},$e=new Hv({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_},Le);g.attachPrimitive($e);const Ye={type:"infoline",primitive:$e,rawP1Time:S.rawTime,rawP2Time:d,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_},lineColor:"#3b82f6",lineWidth:2,statsShowAlways:!0,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0,statsAngle:!0,statsDistance:!0};Te(Re=>[...Re,Ye]),v.current.push(Ye),S=null,Ue(null)};return N.addEventListener("mousemove",Y),N.addEventListener("click",B),()=>{if(N.removeEventListener("mousemove",Y),N.removeEventListener("click",B),O)try{p.removeSeries(O)}catch{}}}if(H==="rulerline"){let S=null,O=null;const Y=(b,I,w,d)=>{const _=j(b),Q=j(w),L=d-I,x=L/Math.abs(I)*100,f=xs(Qs,b,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:x,bars:f,days:P}},B=b=>{if(!S)return;const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null||L===S.normalizedTime)return;const x=Y(S.rawTime,S.price,_,Q);if(!O)O=new kd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},x),g.attachPrimitive(O);else{O.p2={rawTime:_,price:Q},O.info=x;const f=Q>=S.price;O.color=f?"#3b82f6":"#ef5350",O.fillColor=f?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}},h=b=>{const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;if(!S){S={rawTime:_,price:Q,normalizedTime:j(_)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const L=S.normalizedTime,x=j(_);if(L==null||x==null)return;const f=Y(S.rawTime,S.price,_,Q),D=new kd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},f);g.attachPrimitive(D);const P={type:"rulerline",primitive:D,rawP1Time:S.rawTime,rawP2Time:_,p1:{rawTime:S.rawTime,normalizedTime:L,price:S.price},p2:{rawTime:_,normalizedTime:x,price:Q},lineColor:Q>=S.price?"#3b82f6":"#ef5350",showArea:!0,statsColor:"#5f8f96",statsPosition:"right",statsShowAlways:!0,statsPriceRange:!0,statsBarsRange:!0,statsDateRange:!0};Te(V=>[...V,P]),v.current.push(P),S=null,Ue(null)};return N.addEventListener("mousemove",B),N.addEventListener("click",h),()=>{if(N.removeEventListener("mousemove",B),N.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="arrowedline"){let S=null,O=null;const Y=h=>{if(!S)return;const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;const Q=j(d);if(!(Q==null||Q===S.normalizedTime))if(!O)O=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{c.current?.applyOptions({})}catch{}}},B=h=>{const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null||Q===L)return;const x=new Nd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"arrowedline",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,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};Te(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return N.addEventListener("mousemove",Y),N.addEventListener("click",B),()=>{if(N.removeEventListener("mousemove",Y),N.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(H==="rayline"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new kv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"rayline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},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};Te(f=>[...f,x]),v.current.push(x),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="extendedline"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new Nv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"extendedline",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},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};Te(f=>[...f,x]),v.current.push(x),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="crossline"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d=new Kv({rawTime:b,price:I});g.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};Te(Q=>[...Q,_]),v.current.push(_),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="trendbyangle"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=B+140,d=p.timeScale().coordinateToTime(w);if(d==null)return;const _=j(b),Q=j(d);if(_==null||Q==null)return;const L=new Vv({rawTime:b,price:I},{rawTime:d,price:I});g.attachPrimitive(L);const x={type:"trendbyangle",primitive:L,p1:{rawTime:b,normalizedTime:_,price:I},p2:{rawTime:d,normalizedTime:Q,price:I},lineColor:"#7aa6ae",lineWidth:2,arrowLeft:!1,arrowRight:!1,rayLeft:!1,rayRight:!1,statsShowAlways:!1,statsColor:"#5f8f96",statsPosition:"right",statsPriceRange:!1,statsDistance:!1};Te(f=>[...f,x]),v.current.push(x),Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="disjointchannel"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new Oa(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=N.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=j(f);if(P==null)return;const V=(S.price+O.price)/2;D>=V?(Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:2*V-D}):(B={rawTime:f,normalizedTime:P,price:D},Y={rawTime:f,normalizedTime:P,price:2*V-D}),I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=N.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=j(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const V=g.coordinateToPrice(x);if(V==null||Math.abs(V-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:V},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const V=new Oa(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(V);const W={type:"disjointchannel",primitive:V,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:j(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:j(b.p4.rawTime),price:b.p4.price},lineColor:"#129f5c",lineWidth:2,fillColor:"#6aa84f",fillOpacity:.1,showBackground:!0,showPrices:!0,pricesColor:"#129f5c",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,W]),v.current.push(W),Ue(null)}}};return N.addEventListener("mousemove",w),N.addEventListener("click",d),()=>{if(N.removeEventListener("mousemove",w),N.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="flattopbottom"){let S=null,O=null,Y=null,B=null,h=0,b=null;const I=(_,Q,L,x)=>{if(!b)b=new Od(_,Q,L,x),g.attachPrimitive(b);else{b.p1=_,b.p2=Q,b.p3=L,b.p4=x;try{c.current?.applyOptions({})}catch{}}},w=_=>{if(h===0||!S)return;const Q=N.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top;if(h===1){const f=g.coordinateToPrice(x);if(f==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:f},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===2&&O){const f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=j(f);if(P==null)return;Y={rawTime:f,normalizedTime:P,price:D},B={rawTime:f,normalizedTime:P,price:O.price},I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:Y.rawTime,price:Y.price},{rawTime:B.rawTime,price:B.price})}},d=_=>{const Q=N.getBoundingClientRect(),L=_.clientX-Q.left,x=_.clientY-Q.top,f=p.timeScale().coordinateToTime(L),D=g.coordinateToPrice(x);if(f==null||D==null)return;const P=j(f);if(P!=null){if(h===0){S={rawTime:f,normalizedTime:P,price:D},O={rawTime:f,normalizedTime:P,price:D},h=1,I({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price});return}if(h===1){const V=g.coordinateToPrice(x);if(V==null||Math.abs(V-S.price)<1e-7)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:V},h=2;return}if(h===2&&b){try{g.detachPrimitive(b)}catch{}const V=new Od(b.p1,b.p2,b.p3,b.p4);g.attachPrimitive(V);const W={type:"flattopbottom",primitive:V,p1:S,p2:O,p3:{rawTime:b.p3.rawTime,normalizedTime:j(b.p3.rawTime),price:b.p3.price},p4:{rawTime:b.p4.rawTime,normalizedTime:j(b.p4.rawTime),price:b.p4.price},lineColor:"#3b82f6",lineWidth:2,fillColor:"#3b82f6",fillOpacity:.12,showBackground:!0,showPrices:!0,pricesColor:"#3b82f6",rayLeft:!1,rayRight:!1,arrowLeft:!1,arrowRight:!1};Te($=>[...$,W]),v.current.push(W),Ue(null)}}};return N.addEventListener("mousemove",w),N.addEventListener("click",d),()=>{if(N.removeEventListener("mousemove",w),N.removeEventListener("click",d),b)try{g.detachPrimitive(b)}catch{}}}if(H==="regressionchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const f=Vi(Ge,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Ka({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Vi(Ge,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Ka({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,intercept:f.intercept,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};Te(V=>[...V,P]),v.current.push(P),S=null,Ue(null)};return N.addEventListener("mousemove",B),N.addEventListener("click",h),()=>{if(N.removeEventListener("mousemove",B),N.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="stddevchannel"){let S=null,O=null;const Y=(b,I)=>{b.mid1={rawTime:I.p1.rawTime,price:I.p1.price},b.mid2={rawTime:I.p2.rawTime,price:I.p2.price},b.top1={rawTime:I.top1.rawTime,price:I.top1.price},b.top2={rawTime:I.top2.rawTime,price:I.top2.price},b.bot1={rawTime:I.bot1.rawTime,price:I.bot1.price},b.bot2={rawTime:I.bot2.rawTime,price:I.bot2.price}},B=b=>{if(!S)return;const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const f=Ir(Ge,S,{rawTime:_,normalizedTime:L},1);if(f)if(!O)O=new Vd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price}),g.attachPrimitive(O);else{Y(O,f);try{p.applyOptions({})}catch{}}},h=b=>{const I=N.getBoundingClientRect(),w=b.clientX-I.left,d=b.clientY-I.top,_=p.timeScale().coordinateToTime(w),Q=g.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const f=Ir(Ge,S,{rawTime:_,normalizedTime:L},1);if(!f)return;if(O){try{g.detachPrimitive(O)}catch{}O=null}const D=new Vd({rawTime:f.p1.rawTime,price:f.p1.price},{rawTime:f.p2.rawTime,price:f.p2.price},{rawTime:f.top1.rawTime,price:f.top1.price},{rawTime:f.top2.rawTime,price:f.top2.price},{rawTime:f.bot1.rawTime,price:f.bot1.price},{rawTime:f.bot2.rawTime,price:f.bot2.price});g.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:f.p1,p2:f.p2,top1:f.top1,top2:f.top2,bot1:f.bot1,bot2:f.bot2,slope:f.slope,stdDev:f.stdDev,offset:f.offset,barCount:f.barCount,stdMultiplier:1};Te(V=>[...V,P]),v.current.push(P),S=null,Ue(null)};return N.addEventListener("mousemove",B),N.addEventListener("click",h),()=>{if(N.removeEventListener("mousemove",B),N.removeEventListener("click",h),O)try{g.detachPrimitive(O)}catch{}}}if(H==="andrewspitchfork"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d=B+140,_=p.timeScale().coordinateToTime(d);if(_==null)return;const Q=j(_);if(Q==null)return;const L={rawTime:b,normalizedTime:w,price:I},x={rawTime:_,normalizedTime:Q,price:I},f={rawTime:b,normalizedTime:w,price:I},D=new zv({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:f.rawTime,price:f.price});g.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:L,p2:x,p3:f};Te(V=>[...V,P]),v.current.push(P),M(P),ce.current=P,Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="gannfan"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new Wv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:d,p2:_};Te(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="ganngrid"){const S=O=>{const Y=N.getBoundingClientRect(),B=O.clientX-Y.left,h=O.clientY-Y.top,b=p.timeScale().coordinateToTime(B),I=g.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d={rawTime:b,normalizedTime:w,price:I},_={rawTime:b,normalizedTime:w,price:I},Q=new Rv({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});g.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:d,p2:_};Te(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,Ue(null)};return N.addEventListener("click",S),()=>N.removeEventListener("click",S)}if(H==="trendline"||H==="gannline"){const S=H,O=S==="gannline"?"#7aa6ae":"#22c55e",Y=I=>{I.preventDefault(),I.stopPropagation(),I.stopImmediatePropagation();const w=N.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(!(Q==null||L==null)&&(Q=j(Q),Q!=null))if(E.current===null){E.current={time:Q,price:L};const x=p.addLineSeries({color:O,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:S,series:x},x.setData([{time:Q,value:L}])}else{const x=E.current,f={time:Q,price:L},D=1,P=1e-5,V=Math.abs(f.time-x.time),W=Math.abs(f.price-x.price);if(V<D&&W<P){try{p.removeSeries(F.current.series)}catch{}E.current=null,F.current=null;return}const $={time:x.time,rawTime:x.time,price:x.price},te={time:f.time,rawTime:f.time,price:f.price},ue=HA([{time:$.time,value:$.price},{time:te.time,value:te.price}]);if(ue.length>0){F.current.series.setData(ue);const me=new Ov($,te,O,2);try{F.current.series.attachPrimitive(me)}catch{}const xe={type:S,series:F.current.series,point1:$,point2:te,decoration:me};Te(Le=>[...Le,xe]),v.current.push(xe)}Ue(null),E.current=null,F.current=null}},B=I=>{if(E.current===null||F.current?.type!=="trendline"&&F.current?.type!=="gannline")return;I.preventDefault(),I.stopPropagation();const w=N.getBoundingClientRect(),d=I.clientX-w.left,_=I.clientY-w.top;let Q=p.timeScale().coordinateToTime(d);const L=g.coordinateToPrice(_);if(Q==null||L==null||(Q=j(Q),Q==null))return;const x=E.current,f=HA([{time:x.time,value:x.price},{time:Q,value:L}]);f.length>0&&F.current.series.setData(f)},h=I=>{I.stopPropagation()},b={capture:!0,passive:!1};return N.addEventListener("click",Y,b),N.addEventListener("mousemove",B,b),N.addEventListener("mousemove",h,b),()=>{if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}N.removeEventListener("click",Y,b),N.removeEventListener("mousemove",B,b),N.removeEventListener("mousemove",h,b)}}if(H==="parallellines"){let S=null,O=null,Y=null,B=0,h=null;const b=(L,x,f,D)=>{L.p1={rawTime:x.rawTime,price:x.price},L.p2={rawTime:f.rawTime,price:f.price},L.b1={rawTime:D.b1.rawTime,price:D.b1.price},L.b2={rawTime:D.b2.rawTime,price:D.b2.price},L.p3={rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}},I=(L,x,f)=>{const D=$d(L,x,f);if(!D)return null;if(!h)h=new Kd({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:D.b1.rawTime,price:D.b1.price},{rawTime:D.b2.rawTime,price:D.b2.price},{rawTime:D.bottomMid.rawTime,price:D.bottomMid.price}),g.attachPrimitive(h);else{b(h,L,x,D);try{p.applyOptions({})}catch{}}return D},w=L=>{L.preventDefault(),L.stopPropagation(),L.stopImmediatePropagation();const x=N.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),V=g.coordinateToPrice(D);if(P==null||V==null)return;const W=j(P);if(W!=null){if(B===0){S={rawTime:P,normalizedTime:W,price:V},B=1;return}if(B===1){if(O={rawTime:P,normalizedTime:W,price:V},Math.abs(O.normalizedTime-S.normalizedTime)<1)return;const $=j((S.normalizedTime+O.normalizedTime)/2);if($==null)return;const te=(S.price+O.price)/2;Y={rawTime:$,normalizedTime:$,price:te},I(S,O,Y),B=2;return}if(B===2&&S&&O){Y={rawTime:P,normalizedTime:W,price:V};const $=I(S,O,Y);if(!$||!h)return;try{g.detachPrimitive(h)}catch{}const te=new Kd({rawTime:S.rawTime,price:S.price},{rawTime:O.rawTime,price:O.price},{rawTime:$.b1.rawTime,price:$.b1.price},{rawTime:$.b2.rawTime,price:$.b2.price},{rawTime:$.bottomMid.rawTime,price:$.bottomMid.price});g.attachPrimitive(te);const ue={type:"equidistantchannel",primitive:te,p1:S,p2:O,p3:$.bottomMid,b1:$.b1,b2:$.b2,bottomMid:$.bottomMid};Te(me=>[...me,ue]),v.current.push(ue),Ue(null),B=0,S=null,O=null,Y=null,h=null}}},d=L=>{if(B===0||!S)return;const x=N.getBoundingClientRect(),f=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(f),V=g.coordinateToPrice(D);if(P==null||V==null)return;const W=j(P);if(W!=null){if(B===1){const $={rawTime:P,normalizedTime:W,price:V},te=j((S.normalizedTime+$.normalizedTime)/2);if(te==null)return;const ue=(S.price+$.price)/2;I(S,$,{rawTime:te,normalizedTime:te,price:ue});return}B===2&&O&&I(S,O,{rawTime:P,normalizedTime:W,price:V})}},_=L=>{L.stopPropagation()},Q={capture:!0,passive:!1};return N.addEventListener("click",w,Q),N.addEventListener("mousemove",d,Q),N.addEventListener("mousemove",_,Q),()=>{if(B=0,S=null,O=null,Y=null,k.current=[],h)try{g.detachPrimitive(h)}catch{}h=null,N.removeEventListener("click",w,Q),N.removeEventListener("mousemove",d,Q),N.removeEventListener("mousemove",_,Q)}}if(H==="fibonacci"){let S=null,O=null;const Y=h=>{if(!S)return;const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(!(d==null||_==null))if(!O)O=new zd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),g.attachPrimitive(O);else{O.p2={rawTime:d,price:_};try{p.applyOptions({})}catch{}}},B=h=>{const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=g.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{g.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null)return;if(Math.abs(_-S.price)<1e-5){S=null;return}const x=new zd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});g.attachPrimitive(x);const f={type:"fibonacci",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_}};Te(D=>[...D,f]),v.current.push(f),S=null,Ue(null)};return N.addEventListener("mousemove",Y),N.addEventListener("click",B),()=>{if(N.removeEventListener("mousemove",Y),N.removeEventListener("click",B),O)try{g.detachPrimitive(O)}catch{}}}if(E.current=null,(F.current?.type==="trendline"||F.current?.type==="gannline")&&F.current?.series){try{p.removeSeries(F.current.series)}catch{}F.current=null}const Z=S=>{if(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),H==="trendline"||H==="gannline"||H==="parallellines"||H==="fibonacci"||H!=="rectangle"&&H!=="circle"&&H!=="triangle"&&H!=="ellipse")return;const O=N.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=j(h),h!=null){if(T.current=!0,C.current={time:h,normalizedTime:h,rawTime:I,price:b},U.current=null,H==="rectangle"){const w=new Iv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Dv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});g.attachPrimitive(w),F.current={type:"circle",primitive:w}}if(H==="triangle"){const w=new _v({rawTime:I,price:b},{rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});g.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Pv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});g.attachPrimitive(w),F.current={type:"ellipse",primitive:w}}if(H==="parallellines"){const w=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});F.current={type:"parallellines",series:w,firstLine:null,secondLine:null}}}},ne=S=>{if(!T.current||!C.current||!F.current)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();const O=N.getBoundingClientRect(),Y=S.clientX-O.left,B=S.clientY-O.top;let h=p.timeScale().coordinateToTime(Y);const b=g.coordinateToPrice(B);if(h==null||b==null)return;const I=h;if(h=j(h),h==null)return;U.current={time:h,normalizedTime:h,rawTime:I,price:b};const w=C.current;if(F.current.type==="rectangle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="circle"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="triangle"){const d=F.current.primitive,_=X(w,{time:h,rawTime:I,price:b});if(!_)return;d.p1={rawTime:_.p1.rawTime,price:_.p1.price},d.p2={rawTime:_.p2.rawTime,price:_.p2.price},d.p3={rawTime:_.p3.rawTime,price:_.p3.price};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="ellipse"){const d=F.current.primitive;d.p1={rawTime:w.rawTime,price:w.price},d.p2={rawTime:I,price:b};try{c.current?.applyOptions({})}catch{}}if(F.current.type==="parallellines")if(F.current.firstLine){const d=F.current.firstLine;d.endTime-d.startTime;const _=d.endPrice-d.startPrice,Q=b,L=Q+_;if(F.current.secondLine)F.current.secondLine.setData([{time:w.time,value:Q},{time:h,value:L}]);else{const x=p.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});x.setData([{time:w.time,value:Q},{time:h,value:L}]),F.current.secondLine=x}}else F.current.series.setData([{time:w.time,value:w.price},{time:h,value:b}])},oe=S=>{if(S&&(S.preventDefault(),S.stopPropagation()),!T.current||!F.current||!C.current)return;const O=C.current,Y=U.current||O;if(F.current.type==="parallellines")if(F.current.firstLine){const B={type:"parallellines",firstLine:F.current.series,secondLine:F.current.secondLine,firstLineData:F.current.firstLine};Te(h=>[...h,B]),v.current.push(B),Ue(null),F.current=null,T.current=!1,C.current=null,U.current=null;return}else{F.current.firstLine={startTime:O.time,startPrice:O.price,endTime:Y.time,endPrice:Y.price},T.current=!1,C.current=null,U.current=null;return}if(F.current.type==="rectangle"){const B=C.current,h=U.current||B,b=Math.max(B.price,h.price),I=Math.min(B.price,h.price),w=j(Math.min(B.time,h.time)),d=j(Math.max(B.time,h.time));if(w!=null&&d!=null&&Math.abs(d-w)>=1&&Math.abs(b-I)>=1e-5){const _=F.current.primitive,Q=B.time<=h.time?B.rawTime:h.rawTime,L=B.time<=h.time?h.rawTime:B.rawTime,x={rawTime:Q,normalizedTime:w,price:b},f={rawTime:L,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:f.rawTime,price:f.price};const D={type:"rectangle",primitive:_,p1:x,p2:f};Te(P=>[...P,D]),v.current.push(D),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="circle"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=3){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price};const L={type:"circle",primitive:B,p1:h,p2:b};Te(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="triangle"){const B=F.current.primitive,h=X(O,Y);if(h){const b=Math.abs(h.p3.normalizedTime-h.p2.normalizedTime),I=Math.abs(h.p1.price-h.p2.price);if(b>=1&&I>=1e-5){B.p1={rawTime:h.p1.rawTime,price:h.p1.price},B.p2={rawTime:h.p2.rawTime,price:h.p2.price},B.p3={rawTime:h.p3.rawTime,price:h.p3.price};const w={type:"triangle",primitive:B,p1:h.p1,p2:h.p2,p3:h.p3};Te(d=>[...d,w]),v.current.push(w),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}else try{g.detachPrimitive(F.current.primitive)}catch{}}if(F.current.type==="ellipse"){const B=F.current.primitive,h={rawTime:O.rawTime,normalizedTime:O.time,price:O.price},b={rawTime:Y.rawTime,normalizedTime:Y.time,price:Y.price},I=p.timeScale().timeToCoordinate(h.rawTime),w=g.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=g.priceToCoordinate(b.price);if((I!=null&&w!=null&&d!=null&&_!=null?Math.hypot(d-I,_-w):0)>=4){B.p1={rawTime:h.rawTime,price:h.price},B.p2={rawTime:b.rawTime,price:b.price},B.previewAsLine=!1,B.minorRatio=.45;const L={type:"ellipse",primitive:B,p1:h,p2:b,minorRatio:.45};Te(x=>[...x,L]),v.current.push(L),Ue(null)}else try{g.detachPrimitive(F.current.primitive)}catch{}}T.current=!1,C.current=null,U.current=null,F.current=null};if(H==="rectangle"||H==="circle"||H==="triangle"||H==="ellipse"){const S={capture:!0,passive:!1},O=Y=>{T.current||Y.stopPropagation()};return N.addEventListener("mousedown",Z,S),N.addEventListener("mousemove",ne,S),N.addEventListener("mousemove",O,S),N.addEventListener("mouseup",oe,S),()=>{if((F.current?.type==="rectangle"||F.current?.type==="circle"||F.current?.type==="triangle"||F.current?.type==="ellipse")&&F.current?.primitive)try{g.detachPrimitive(F.current.primitive)}catch{}F.current=null,T.current=!1,C.current=null,U.current=null,N.removeEventListener("mousedown",Z,S),N.removeEventListener("mousemove",ne,S),N.removeEventListener("mousemove",O,S),N.removeEventListener("mouseup",oe,S)}}},[Qe,Ge,Te,Ue]),q.useEffect(()=>{const p=c.current,g=u.current,N=o.current,Be=Qe===null||Qe===1;if(!Be||!p||!g||!N){Be||(M(null),K([]),re(null),J([]));return}const H=10,X=8;function Z(h){if(!h)return[];if(h.type==="trendline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="gannline"&&h.point1&&h.point2){const b=p.timeScale().timeToCoordinate(h.point1.time),I=g.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=g.priceToCoordinate(h.point2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="rectangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=Math.min(b,w),Q=Math.max(b,w),L=Math.min(I,d),x=Math.max(I,d),f=(_+Q)/2,D=(L+x)/2;return[{x:_,y:L},{x:f,y:L},{x:Q,y:L},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:f,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="triangle"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="ellipse"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);if(b==null||I==null||w==null||d==null)return[];const _=(b+w)/2,Q=(I+d)/2,L=w-b,x=d-I,f=Math.hypot(L,x);if(f<.001)return[];const D=L/f,P=x/f,V=-P,W=D,$=f/2,te=$*Math.max(.05,h.minorRatio??.45);return[{x:_-D*$,y:Q-P*$},{x:_+V*te,y:Q+W*te},{x:_+D*$,y:Q+P*$},{x:_-V*te,y:Q-W*te}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="ganngrid"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="arrowedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="rayline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="extendedline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="crossline"&&h.p){const b=p.timeScale().timeToCoordinate(h.p.rawTime),I=g.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=g.priceToCoordinate(h.price);return b==null?[]:[{x:(c.current?c.current.paneSize().width:400)/2,y:b}]}if(h.type==="text"&&h.rawTime!=null&&h.price!=null){const b=p.timeScale().timeToCoordinate(h.rawTime),I=g.priceToCoordinate(h.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="trendbyangle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="andrewspitchfork"&&h.p1&&h.p2&&h.p3){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price);return b==null||I==null||w==null||d==null||_==null||Q==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q}]}if(h.type==="equidistantchannel"&&h.p1&&h.p2&&h.b1&&h.b2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=g.priceToCoordinate(h.b1.price),L=p.timeScale().timeToCoordinate(h.b2.rawTime),x=g.priceToCoordinate(h.b2.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:(_+L)/2,y:(Q+x)/2}]}if(h.type==="regressionchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="stddevchannel"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="disjointchannel"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="flattopbottom"&&h.p1&&h.p2&&h.p3&&h.p4){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=g.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=g.priceToCoordinate(h.p4.price);return b==null||I==null||w==null||d==null||_==null||Q==null||L==null||x==null?[]:[{x:b,y:I},{x:w,y:d},{x:_,y:Q},{x:L,y:x}]}if(h.type==="infoline"&&h.p1&&h.p2){const b=h.p1.rawTime??h.p1.time,I=h.p2.rawTime??h.p2.time,w=p.timeScale().timeToCoordinate(b),d=g.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=g.priceToCoordinate(h.p2.price);return w==null||d==null||_==null||Q==null?[]:[{x:w,y:d},{x:_,y:Q}]}if(h.type==="rulerline"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:(b+w)/2,y:(I+d)/2},{x:w,y:d}]}if(h.type==="fibonacci"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=g.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=g.priceToCoordinate(h.p2.price);return b==null||I==null||w==null||d==null?[]:[{x:b,y:I},{x:w,y:d}]}if(h.type==="horizontalray"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.originTime),w=g.priceToCoordinate(b.price);return I==null||w==null?[]:[{x:I,y:w}]}if(h.type==="verticalline"&&h.primitive){const b=h.primitive,I=p.timeScale().timeToCoordinate(b.time);if(I==null)return[];const w=b.midYCss??200;return[{x:I,y:w}]}return[]}function ne(h,b){for(let I=We.length-1;I>=0;I--){const w=We[I];if(w.type==="trendline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="gannline"&&w.point1&&w.point2){const d=p.timeScale().timeToCoordinate(w.point1.time),_=g.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=g.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),V=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(V<H)return{object:w,mode:"line"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rectangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.min(d,Q),f=Math.max(d,Q),D=Math.min(_,L),P=Math.max(_,L),V=(x+f)/2,W=(D+P)/2,$=[{x,y:D,mode:"handle1"},{x:V,y:D,mode:"handle2"},{x:f,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:f,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:V,y:P,mode:"handle7"},{x:f,y:P,mode:"handle8"}];for(const Le of $)if(Math.hypot(h-Le.x,b-Le.y)<H)return{object:w,mode:Le.mode};const te=ot(h,b,x,D,f,D),ue=ot(h,b,x,P,f,P),me=ot(h,b,x,D,x,P),xe=ot(h,b,f,D,f,P);if(te<X||ue<X||me<X||xe<X||Ai(h,b,[{x,y:D},{x:f,y:D},{x:f,y:P},{x,y:P}]))return{object:w,mode:"line"}}if(w.type==="circle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(Q-d,L-_);if(x<2)continue;const f=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-L);if(f<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(f-x)<X||f<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),V=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(V<H)return{object:w,mode:"handle3"};const W=ot(h,b,d,_,Q,L),$=ot(h,b,Q,L,x,f),te=ot(h,b,x,f,d,_);if(W<X||$<X||te<X||Ai(h,b,[{x:d,y:_},{x:Q,y:L},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Q-d,P=L-_,V=Math.hypot(D,P);if(V<2)continue;const W=D/V,$=P/V,te=-$,ue=W,me=V/2,xe=me*Math.max(.05,w.minorRatio??.45);if(me<2||xe<2)continue;const Le=x-W*me,$e=f-$*me,Ye=x+te*xe,Re=f+ue*xe,dt=x+W*me,at=f+$*me,pt=x-te*xe,Qt=f-ue*xe,Rt=Math.hypot(h-Le,b-$e),Yt=Math.hypot(h-Ye,b-Re),rA=Math.hypot(h-dt,b-at),_A=Math.hypot(h-pt,b-Qt);if(Rt<H)return{object:w,mode:"handle1"};if(Yt<H)return{object:w,mode:"handle2"};if(rA<H)return{object:w,mode:"handle3"};if(_A<H)return{object:w,mode:"handle4"};const yi=(h-x)*W+(b-f)*$,Us=(h-x)*te+(b-f)*ue,ap=yi/me,lp=Us/xe,cp=ap*ap+lp*lp;if(Math.abs(cp-1)<.2||cp<1)return{object:w,mode:"line"}}if(w.type==="gannfan"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="ganngrid"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),f=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(f<H)return{object:w,mode:"handle1"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="arrowedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="rayline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(Yv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="extendedline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(qv(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="crossline"&&w.p){const d=p.timeScale().timeToCoordinate(w.p.rawTime),_=g.priceToCoordinate(w.p.price);if(d==null||_==null)continue;if(Math.hypot(h-d,b-_)<H)return{object:w,mode:"handle1"};const L=Math.abs(b-_),x=Math.abs(h-d);if(L<X||x<X)return{object:w,mode:"line"}}if(w.type==="text"&&w.rawTime!=null&&w.price!=null){const d=p.timeScale().timeToCoordinate(w.rawTime),_=g.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=Rd(w,d,_);if(h>=Q.left&&h<=Q.right&&b>=Q.top&&b<=Q.bottom)return{object:w,mode:"line"}}if(w.type==="trendbyangle"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="equidistantchannel"&&w.p1&&w.p2&&w.b1&&w.b2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),f=g.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=g.priceToCoordinate(w.b2.price),V=x!=null&&D!=null?(x+D)/2:null,W=f!=null&&P!=null?(f+P)/2:null;if(d==null||_==null||Q==null||L==null||V==null||W==null||x==null||f==null||D==null||P==null)continue;const $=Math.hypot(h-d,b-_),te=Math.hypot(h-Q,b-L),ue=Math.hypot(h-V,b-W),me=Math.hypot(d-V,_-W)<H*1.5;if(me&&Math.min($,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle2"};if(me)continue;if($<H)return{object:w,mode:"handle1"};const xe=ot(h,b,d,_,Q,L),Le=ot(h,b,x,f,D,P);if(xe<X||Le<X||Ai(h,b,[{x:d,y:_},{x:Q,y:L},{x:D,y:P},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="regressionchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),V=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||V==null||W==null||$==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Le=ot(h,b,x,f,D,P),$e=ot(h,b,V,W,$,te);if(xe<X||Le<X||$e<X||Ai(h,b,[{x,y:f},{x:D,y:P},{x:$,y:te},{x:V,y:W}]))return{object:w,mode:"line"}}if(w.type==="stddevchannel"&&w.p1&&w.p2&&w.top1&&w.top2&&w.bot1&&w.bot2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),f=g.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=g.priceToCoordinate(w.top2.price),V=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=g.priceToCoordinate(w.bot1.price),$=p.timeScale().timeToCoordinate(w.bot2.rawTime),te=g.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null||V==null||W==null||$==null||te==null)continue;const ue=Math.hypot(h-d,b-_),me=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(me<H)return{object:w,mode:"handle2"};const xe=ot(h,b,d,_,Q,L),Le=ot(h,b,x,f,D,P),$e=ot(h,b,V,W,$,te);if(xe<X||Le<X||$e<X||Ai(h,b,[{x,y:f},{x:D,y:P},{x:$,y:te},{x:V,y:W}]))return{object:w,mode:"line"}}if(w.type==="andrewspitchfork"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),V=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(V<H)return{object:w,mode:"handle3"};const W=(Q+x)/2,$=(L+f)/2;let te=W-d,ue=$-_;Math.abs(te)<1e-4&&(te=1e-4);const me=ue/te,xe=N.clientWidth,Le=L+me*(xe-Q),$e=f+me*(xe-x),Ye=ot(h,b,Q,L,xe,Le),Re=ot(h,b,x,f,xe,$e);if(Ye<X||Re<X||Ai(h,b,[{x:Q,y:L},{x:xe,y:Le},{x:xe,y:$e},{x,y:f}]))return{object:w,mode:"line"}}if(w.type==="disjointchannel"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const V=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),$=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(V<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Le=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Le<X||Ai(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="flattopbottom"&&w.p1&&w.p2&&w.p3&&w.p4){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),f=g.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=g.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||f==null||D==null||P==null)continue;const V=Math.hypot(h-d,b-_),W=Math.hypot(h-Q,b-L),$=Math.hypot(h-x,b-f),te=Math.hypot(h-D,b-P);if(V<H)return{object:w,mode:"handle1"};if(W<H)return{object:w,mode:"handle2"};if($<H)return{object:w,mode:"handle3"};if(te<H)return{object:w,mode:"handle4"};const ue=ot(h,b,d,_,x,f),me=ot(h,b,Q,L,D,P),xe=ot(h,b,d,_,Q,L),Le=ot(h,b,x,f,D,P);if(ue<X||me<X||xe<X||Le<X||Ai(h,b,[{x:d,y:_},{x,y:f},{x:D,y:P},{x:Q,y:L}]))return{object:w,mode:"line"}}if(w.type==="rulerline"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,f=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),V=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(V<H)return{object:w,mode:"line"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="infoline"&&w.p1&&w.p2){const d=w.p1.rawTime??w.p1.time,_=w.p2.rawTime??w.p2.time,Q=p.timeScale().timeToCoordinate(d),L=g.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),f=g.priceToCoordinate(w.p2.price);if(Q==null||L==null||x==null||f==null)continue;const D=Math.hypot(h-Q,b-L),P=Math.hypot(h-x,b-f);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ot(h,b,Q,L,x,f)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=g.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=g.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),f=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(f<H)return{object:w,mode:"handle2"};if(ot(h,b,d,_,Q,L)<X)return{object:w,mode:"line"}}if(w.type==="horizontalray"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.originTime),Q=g.priceToCoordinate(d.price);if(Q==null)continue;if(_!=null&&Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};const L=_==null?0:Math.max(0,_);if(h>=L&&Math.abs(b-Q)<X)return{object:w,mode:"line"}}if(w.type==="verticalline"&&w.primitive){const d=w.primitive,_=p.timeScale().timeToCoordinate(d.time);if(_==null)continue;const Q=d.midYCss??200;if(Math.hypot(h-_,b-Q)<H)return{object:w,mode:"handle1"};if(Math.abs(h-_)<X)return{object:w,mode:"line"}}if(w.type==="pricelevel"&&w.price!=null){const d=g.priceToCoordinate(w.price);if(d==null)continue;const Q=(c.current?c.current.paneSize().width:400)/2;if(Math.hypot(h-Q,b-d)<H)return{object:w,mode:"line"};if(Math.abs(b-d)<X)return{object:w,mode:"line"}}}return null}const oe=h=>{const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ne(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ie(d.object),ee.current=null,ae.current=null;return}M(d.object),re(null),J([]),ee.current=d.mode,d.object.type==="rayline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="extendedline"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="crossline"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,p:{...d.object.p}}),d.object.type==="text"&&d.mode==="line"&&(ae.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}),d.object.type==="trendbyangle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="equidistantchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="andrewspitchfork"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="regressionchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="stddevchannel"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="disjointchannel"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="flattopbottom"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}),d.object.type==="fibonacci"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="gannfan"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="ganngrid"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="rectangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4"||d.mode==="handle5"||d.mode==="handle6"||d.mode==="handle7"||d.mode==="handle8")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="circle"&&(d.mode==="handle1"||d.mode==="handle2")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}),d.object.type==="triangle"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}),d.object.type==="ellipse"&&(d.mode==="handle1"||d.mode==="handle2"||d.mode==="handle3"||d.mode==="handle4")&&(ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}),d.object.type==="horizontalray"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}),d.object.type==="verticalline"&&(d.mode==="handle1"||d.mode==="line")&&(ae.current={x:I,y:w,time:d.object.primitive.time}),d.mode==="line"&&(d.object.type==="rulerline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="infoline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="arrowedline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rayline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="extendedline"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="crossline"?ae.current={x:I,y:w,p:{...d.object.p}}:d.object.type==="text"?ae.current={x:I,y:w,rawTime:d.object.rawTime,price:d.object.price}:d.object.type==="trendbyangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="equidistantchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="andrewspitchfork"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="regressionchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="stddevchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="disjointchannel"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="flattopbottom"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3},p4:{...d.object.p4}}:d.object.type==="fibonacci"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="gannfan"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="rectangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="circle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="triangle"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},p3:{...d.object.p3}}:d.object.type==="ellipse"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2},minorRatio:d.object.minorRatio??.45}:d.object.type==="ganngrid"?ae.current={x:I,y:w,p1:{...d.object.p1},p2:{...d.object.p2}}:d.object.type==="horizontalray"?ae.current={x:I,y:w,price:d.object.primitive.price,originTime:d.object.primitive.originTime}:d.object.type==="verticalline"?ae.current={x:I,y:w,time:d.object.primitive.time}:d.object.type==="pricelevel"?ae.current={y:w,price:d.object.price}:ae.current={x:I,y:w,point1:{...d.object.point1},point2:{...d.object.point2}})}else M(null),ee.current=null,K([]),re(null),J([])},S=h=>{const b=N.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!ee.current){const x=ne(I,w);if(x?.object&&!ce.current){const f=Z(x.object);re(D=>D===x.object?D:x.object),J(D=>D.length===f.length&&D.every((P,V)=>P.x===f[V].x&&P.y===f[V].y)?D:f)}else re(f=>f==null?f:null),J(f=>f.length===0?f:[]);return}const d=ce.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=g.coordinateToPrice(w);if(_==null||Q==null)return;let L=j(_);if(L!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=V=>{const W=V.rawTime??V.time,$=V.normalizedTime??j(W);return{rawTime:W,normalizedTime:$,price:V.price}},f=(V,W)=>{const $=V.normalizedTime??j(V.rawTime),te=W.normalizedTime??j(W.rawTime);if($==null||te==null)return;const ue=W.price-V.price,me=ue/Math.abs(V.price)*100,xe=nA(de)||3600,Le=Math.abs(te-$),$e=Math.max(1,Math.round(Le/xe)),Ye=Math.max(1,Math.round(Le/86400)),Re=p.timeScale().timeToCoordinate(V.rawTime),dt=g.priceToCoordinate(V.price),at=p.timeScale().timeToCoordinate(W.rawTime),pt=g.priceToCoordinate(W.price),Qt=Re!=null&&dt!=null&&at!=null&&pt!=null?Math.atan2(-(pt-dt),at-Re)*(180/Math.PI):d.primitive?.info?.angle??0,Rt={priceDiff:ue,pricePct:me,bars:$e,days:Ye,angle:Qt},Yt=d.primitive;if(Yt){Yt.p1={rawTime:V.rawTime,price:V.price},Yt.p2={rawTime:W.rawTime,price:W.price},Yt.info=Rt;try{c.current?.applyOptions({})}catch{}}const rA={...d,rawP1Time:V.rawTime,rawP2Time:W.rawTime,p1:{rawTime:V.rawTime,normalizedTime:$,price:V.price},p2:{rawTime:W.rawTime,normalizedTime:te,price:W.price}};Te(_A=>{const yi=_A.map(Us=>Us===d?rA:Us);return v.current=yi,yi}),M(rA),ce.current=rA,Re!=null&&dt!=null&&at!=null&&pt!=null&&K([{x:Re,y:dt},{x:at,y:pt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(ee.current==="handle1"){const V=p.timeScale().coordinateToTime(I)??_;f({rawTime:V,normalizedTime:L,price:Q},P)}else if(ee.current==="handle2"){const V=p.timeScale().coordinateToTime(I)??_;f(D,{rawTime:V,normalizedTime:L,price:Q})}else if(ee.current==="line"){const V=ae.current;if(!V)return;const W=x(V.p1),$=x(V.p2);if(W.rawTime==null||W.normalizedTime==null||$.rawTime==null||$.normalizedTime==null)return;const te=p.timeScale().coordinateToTime(V.x)??W.rawTime,ue=g.coordinateToPrice(V.y);if(te==null||ue==null)return;const me=j(te)??W.normalizedTime;if(me==null)return;const xe=L-me,Le=Q-ue,$e=j(W.normalizedTime+xe),Ye=j($.normalizedTime+xe);if($e==null||Ye==null)return;const Re=_-te;f({rawTime:W.rawTime+Re,normalizedTime:$e,price:W.price+Le},{rawTime:$.rawTime+Re,normalizedTime:Ye,price:$.price+Le})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(f,D)=>{const P=f.normalizedTime??f.rawTime,V=D.normalizedTime??D.rawTime,W=D.price-f.price,$=W/Math.abs(f.price)*100,te=xs(Qs,f.rawTime,D.rawTime,de),ue=Math.abs(V-P),me=Math.max(1,Math.round(ue/86400)),xe={priceDiff:W,pricePct:$,bars:te,days:me},Le=d.primitive;if(Le){Le.p1={rawTime:f.rawTime,price:f.price},Le.p2={rawTime:D.rawTime,price:D.price},Le.info=xe;const pt=D.price>=f.price;Le.color=pt?"#3b82f6":"#ef5350",Le.fillColor=pt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const $e={...d,rawP1Time:f.rawTime,rawP2Time:D.rawTime,p1:f,p2:D};Te(pt=>{const Qt=pt.map(Rt=>Rt===d?$e:Rt);return v.current=Qt,Qt}),M($e),ce.current=$e;const Ye=p.timeScale().timeToCoordinate(f.rawTime),Re=g.priceToCoordinate(f.price),dt=p.timeScale().timeToCoordinate(D.rawTime),at=g.priceToCoordinate(D.price);Ye!=null&&Re!=null&&dt!=null&&at!=null&&K([{x:Ye,y:Re},{x:(Ye+dt)/2,y:(Re+at)/2},{x:dt,y:at}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(me=>{const xe=me.map(Le=>Le===d?V:Le);return v.current=xe,xe}),M(V),ce.current=V;const W=p.timeScale().timeToCoordinate(f.rawTime),$=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&$!=null&&te!=null&&ue!=null&&K([{x:W,y:$},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(me=>{const xe=me.map(Le=>Le===d?V:Le);return v.current=xe,xe}),M(V),ce.current=V;const W=p.timeScale().timeToCoordinate(f.rawTime),$=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&$!=null&&te!=null&&ue!=null&&K([{x:W,y:$},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=j(f);if(D==null)return;x(d.p1,{rawTime:f,normalizedTime:D,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(me=>{const xe=me.map(Le=>Le===d?V:Le);return v.current=xe,xe}),M(V),ce.current=V;const W=p.timeScale().timeToCoordinate(f.rawTime),$=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&$!=null&&te!=null&&ue!=null&&K([{x:W,y:$},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="crossline"&&d.p){const x=D=>{const P=d.primitive;if(P){P.center={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p:D};Te(te=>{const ue=te.map(me=>me===d?V:me);return v.current=ue,ue}),M(V),ce.current=V;const W=p.timeScale().timeToCoordinate(D.rawTime),$=g.priceToCoordinate(D.price);W!=null&&$!=null&&K([{x:W,y:$}])},f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=g.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const f=c.current?c.current.paneSize().width:400,D=g.priceToCoordinate(x);D!=null&&K([{x:f/2,y:D}]);const P={...d,price:x};Te(V=>{const W=V.map($=>$===d?P:$);return v.current=W,W}),M(P),ce.current=P;return}if(d.type==="text"){const x=p.timeScale().coordinateToTime(I);if(x==null)return;const f=d.primitive;if(f){f.rawTime=x,f.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};Te(P=>{const V=P.map(W=>W===d?D:W);return v.current=V,V}),M(D),ce.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(me=>{const xe=me.map(Le=>Le===d?V:Le);return v.current=xe,xe}),M(V),ce.current=V;const W=p.timeScale().timeToCoordinate(f.rawTime),$=g.priceToCoordinate(f.price),te=p.timeScale().timeToCoordinate(D.rawTime),ue=g.priceToCoordinate(D.price);W!=null&&$!=null&&te!=null&&ue!=null&&K([{x:W,y:$},{x:te,y:ue}])};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"||ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const V=$d(f,D,P);if(!V)return;const W=d.primitive;if(W){W.p1={rawTime:f.rawTime,price:f.price},W.p2={rawTime:D.rawTime,price:D.price},W.b1={rawTime:V.b1.rawTime,price:V.b1.price},W.b2={rawTime:V.b2.rawTime,price:V.b2.price},W.p3={rawTime:V.bottomMid.rawTime,price:V.bottomMid.price};try{c.current?.applyOptions({})}catch{}}const $={...d,p1:f,p2:D,p3:V.bottomMid,b1:V.b1,b2:V.b2,bottomMid:V.bottomMid};Te(te=>{const ue=te.map(me=>me===d?$:me);return v.current=ue,ue}),M($),ce.current=$};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??j(d.p3.rawTime),price:Q});return}if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V),ue=j(f.p3.normalizedTime+V);if($==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Vi(Ge,f,D,d.stdMultiplier??1);if(!P)return;const V=d.primitive;if(V){V.mid1={rawTime:P.p1.rawTime,price:P.p1.price},V.mid2={rawTime:P.p2.rawTime,price:P.p2.price},V.top1={rawTime:P.top1.rawTime,price:P.top1.price},V.top2={rawTime:P.top2.rawTime,price:P.top2.price},V.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},V.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,intercept:P.intercept,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),ce.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(f,D)=>{const P=Ir(Ge,f,D,d.stdMultiplier??1);if(!P)return;const V=d.primitive;if(V){V.mid1={rawTime:P.p1.rawTime,price:P.p1.price},V.mid2={rawTime:P.p2.rawTime,price:P.p2.price},V.top1={rawTime:P.top1.rawTime,price:P.top1.price},V.top2={rawTime:P.top2.rawTime,price:P.top2.price},V.bot1={rawTime:P.bot1.rawTime,price:P.bot1.price},V.bot2={rawTime:P.bot2.rawTime,price:P.bot2.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:P.p1,p2:P.p2,top1:P.top1,top2:P.top2,bot1:P.bot1,bot2:P.bot2,slope:P.slope,stdDev:P.stdDev,offset:P.offset,barCount:P.barCount};Te($=>{const te=$.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),ce.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L},d.p2);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L});return}if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(f,D,P)=>{const V=d.primitive;if(V){V.p1={rawTime:f.rawTime,price:f.price},V.p2={rawTime:D.rawTime,price:D.price},V.p3={rawTime:P.rawTime,price:P.price};try{c.current?.applyOptions({})}catch{}}const W={...d,p1:f,p2:D,p3:P};Te($=>{const te=$.map(ue=>ue===d?W:ue);return v.current=te,te}),M(W),ce.current=W};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q},d.p3);return}if(ee.current==="handle3"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,d.p2,{rawTime:f,normalizedTime:L,price:Q});return}if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V),ue=j(f.p3.normalizedTime+V);if($==null||te==null||ue==null)return;const me=_-D;x({rawTime:f.p1.rawTime+me,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+me,normalizedTime:te,price:f.p2.price+W},{rawTime:f.p3.rawTime+me,normalizedTime:ue,price:f.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,$,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:$.rawTime,price:$.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:$,p3:te,p4:ue};Te(Le=>{const $e=Le.map(Ye=>Ye===d?xe:Ye);return v.current=$e,$e}),M(xe),ce.current=xe},f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const V=(W,$,te,ue)=>{const me=W.normalizedTime??j(W.rawTime);if(me==null)return null;const xe=j(me+te);return xe==null?null:{rawTime:W.rawTime+$,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),$=g.coordinateToPrice(f.y);if(W==null||$==null)return;const te=j(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-$,Le=V(f.p1,ue,me,xe),$e=V(f.p2,ue,me,xe),Ye=V(f.p3,ue,me,xe),Re=V(f.p4,ue,me,xe);if(!Le||!$e||!Ye||!Re)return;x(Le,$e,Ye,Re);return}if(ee.current==="handle1"){const W=(f.p1.price+f.p2.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x($,te,f.p3,f.p4);return}if(ee.current==="handle3"){const W=(f.p3.price+f.p4.price)/2,$={rawTime:D,normalizedTime:P,price:Q},te={rawTime:D,normalizedTime:P,price:2*W-Q};x(f.p1,f.p2,$,te);return}if(ee.current==="handle2"){const W=(f.p1.price+f.p2.price)/2,$={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??j(f.p1.rawTime),price:Q};if($.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??j(f.p1.rawTime),price:2*W-Q};if(te.normalizedTime==null)return;x(te,$,f.p3,f.p4);return}if(ee.current==="handle4"){const W=Q-f.p4.price,$={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??j(f.p3.rawTime),price:f.p4.price+W};if($.normalizedTime==null)return;const te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??j(f.p1.rawTime),price:f.p2.price+W};if(te.normalizedTime==null)return;x(f.p1,te,f.p3,$);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,$,te,ue)=>{const me=d.primitive;if(me){me.p1={rawTime:W.rawTime,price:W.price},me.p2={rawTime:$.rawTime,price:$.price},me.p3={rawTime:te.rawTime,price:te.price},me.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const xe={...d,p1:W,p2:$,p3:te,p4:ue};Te(Le=>{const $e=Le.map(Ye=>Ye===d?xe:Ye);return v.current=$e,$e}),M(xe),ce.current=xe},f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const V=(W,$,te,ue)=>{const me=W.normalizedTime??j(W.rawTime);if(me==null)return null;const xe=j(me+te);return xe==null?null:{rawTime:W.rawTime+$,normalizedTime:xe,price:W.price+ue}};if(ee.current==="line"){const W=p.timeScale().coordinateToTime(f.x),$=g.coordinateToPrice(f.y);if(W==null||$==null)return;const te=j(W);if(te==null)return;const ue=D-W,me=P-te,xe=Q-$,Le=V(f.p1,ue,me,xe),$e=V(f.p2,ue,me,xe),Ye=V(f.p3,ue,me,xe),Re=V(f.p4,ue,me,xe);if(!Le||!$e||!Ye||!Re)return;x(Le,$e,Ye,Re);return}if(ee.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:f.p2.price};x(W,$,f.p3,f.p4);return}if(ee.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},$={rawTime:D,normalizedTime:P,price:f.p4.price};x(f.p1,f.p2,W,$);return}if(ee.current==="handle2"||ee.current==="handle4"){const W=ee.current==="handle2"?f.p2:f.p4,$=Q-W.price,te={rawTime:f.p1.rawTime,normalizedTime:f.p1.normalizedTime??j(f.p1.rawTime),price:f.p2.price+$},ue={rawTime:f.p3.rawTime,normalizedTime:f.p3.normalizedTime??j(f.p3.rawTime),price:f.p4.price+$};if(te.normalizedTime==null||ue.normalizedTime==null)return;x(f.p1,te,f.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(W=>{const $=W.map(te=>te===d?V:te);return v.current=$,$}),M(V),ce.current=V};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(at,pt)=>{const Qt=d.primitive;if(Qt){Qt.p1={rawTime:at.rawTime,price:at.price},Qt.p2={rawTime:pt.rawTime,price:pt.price};try{c.current?.applyOptions({})}catch{}}const Rt={...d,p1:at,p2:pt};Te(Yt=>{const rA=Yt.map(_A=>_A===d?Rt:_A);return v.current=rA,rA}),M(Rt),ce.current=Rt},f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(ee.current==="line"){const at=p.timeScale().coordinateToTime(f.x),pt=g.coordinateToPrice(f.y);if(at==null||pt==null)return;const Qt=j(at);if(Qt==null)return;const Rt=P-Qt,Yt=Q-pt,rA=j(f.p1.normalizedTime+Rt),_A=j(f.p2.normalizedTime+Rt);if(rA==null||_A==null)return;const yi=_-at;x({rawTime:f.p1.rawTime+yi,normalizedTime:rA,price:f.p1.price+Yt},{rawTime:f.p2.rawTime+yi,normalizedTime:_A,price:f.p2.price+Yt});return}const V=Math.min(f.p1.normalizedTime,f.p2.normalizedTime),W=Math.max(f.p1.normalizedTime,f.p2.normalizedTime),$=Math.max(f.p1.price,f.p2.price),te=Math.min(f.p1.price,f.p2.price),ue=f.p1.normalizedTime<=f.p2.normalizedTime?f.p1.rawTime:f.p2.rawTime,me=f.p1.normalizedTime<=f.p2.normalizedTime?f.p2.rawTime:f.p1.rawTime;let xe=V,Le=W,$e=$,Ye=te,Re=ue,dt=me;if((ee.current==="handle1"||ee.current==="handle4"||ee.current==="handle6")&&(xe=P,Re=D),(ee.current==="handle3"||ee.current==="handle5"||ee.current==="handle8")&&(Le=P,dt=D),(ee.current==="handle1"||ee.current==="handle2"||ee.current==="handle3")&&($e=Q),(ee.current==="handle6"||ee.current==="handle7"||ee.current==="handle8")&&(Ye=Q),xe>Le){const at=xe,pt=Re;xe=Le,Re=dt,Le=at,dt=pt}if($e<Ye){const at=$e;$e=Ye,Ye=at}x({rawTime:Re,normalizedTime:xe,price:$e},{rawTime:dt,normalizedTime:Le,price:Ye});return}if(d.type==="circle"&&d.p1&&d.p2){const x=($e,Ye)=>{const Re=d.primitive;if(Re){Re.p1={rawTime:$e.rawTime,price:$e.price},Re.p2={rawTime:Ye.rawTime,price:Ye.price};try{c.current?.applyOptions({})}catch{}}const dt={...d,p1:$e,p2:Ye};Te(at=>{const pt=at.map(Qt=>Qt===d?dt:Qt);return v.current=pt,pt}),M(dt),ce.current=dt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=j(f);if(D==null)return;if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const V=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(V==null||W==null)return;const $=j(V);if($==null)return;const te=D-$,ue=Q-W,me=j(P.p1.normalizedTime+te),xe=j(P.p2.normalizedTime+te);if(me==null||xe==null)return;const Le=_-V;x({rawTime:P.p1.rawTime+Le,normalizedTime:me,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Le,normalizedTime:xe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Re,dt,at)=>{const pt=d.primitive;if(pt){pt.p1={rawTime:Re.rawTime,price:Re.price},pt.p2={rawTime:dt.rawTime,price:dt.price},pt.p3={rawTime:at.rawTime,price:at.price};try{c.current?.applyOptions({})}catch{}}const Qt={...d,p1:Re,p2:dt,p3:at};Te(Rt=>{const Yt=Rt.map(rA=>rA===d?Qt:rA);return v.current=Yt,Yt}),M(Qt),ce.current=Qt},f=p.timeScale().coordinateToTime(I);if(f==null)return;const D=j(f);if(D==null)return;if(ee.current==="handle1"){x({rawTime:f,normalizedTime:D,price:Q},d.p2,d.p3);return}if(ee.current==="handle2"){x(d.p1,{rawTime:f,normalizedTime:D,price:Q},d.p3);return}if(ee.current==="handle3"){x(d.p1,d.p2,{rawTime:f,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const V=p.timeScale().coordinateToTime(P.x),W=g.coordinateToPrice(P.y);if(V==null||W==null)return;const $=j(V);if($==null)return;const te=D-$,ue=Q-W,me=_-V,xe=Re=>{const dt=Re.normalizedTime??j(Re.rawTime);if(dt==null)return null;const at=j(dt+te);return at==null?null:{rawTime:Re.rawTime+me,normalizedTime:at,price:Re.price+ue}},Le=xe(P.p1),$e=xe(P.p2),Ye=xe(P.p3);if(!Le||!$e||!Ye)return;x(Le,$e,Ye);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(V,W,$=d.minorRatio??.45)=>{const te=d.primitive;if(te){te.p1={rawTime:V.rawTime,price:V.price},te.p2={rawTime:W.rawTime,price:W.price},te.minorRatio=Math.max(.05,$);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:V,p2:W,minorRatio:Math.max(.05,$)};Te(me=>{const xe=me.map(Le=>Le===d?ue:Le);return v.current=xe,xe}),M(ue),ce.current=ue},f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(ee.current==="line"){const V=p.timeScale().coordinateToTime(f.x),W=g.coordinateToPrice(f.y);if(V==null||W==null)return;const $=j(V);if($==null)return;const te=P-$,ue=Q-W,me=j(f.p1.normalizedTime+te),xe=j(f.p2.normalizedTime+te);if(me==null||xe==null)return;const Le=_-V;x({rawTime:f.p1.rawTime+Le,normalizedTime:me,price:f.p1.price+ue},{rawTime:f.p2.rawTime+Le,normalizedTime:xe,price:f.p2.price+ue},f.minorRatio??d.minorRatio??.45);return}if(ee.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(ee.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(ee.current==="handle2"||ee.current==="handle4"){const V=p.timeScale().timeToCoordinate(d.p1.rawTime),W=g.priceToCoordinate(d.p1.price),$=p.timeScale().timeToCoordinate(d.p2.rawTime),te=g.priceToCoordinate(d.p2.price);if(V==null||W==null||$==null||te==null)return;const ue=(V+$)/2,me=(W+te)/2,xe=$-V,Le=te-W,$e=Math.hypot(xe,Le);if($e<.001)return;const Ye=-Le/$e,Re=xe/$e,dt=Math.abs((I-ue)*Ye+(w-me)*Re),at=Math.max(.05,dt*2/$e);x(d.p1,d.p2,at);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(W=>{const $=W.map(te=>te===d?V:te);return v.current=$,$}),M(V),ce.current=V};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(f,D)=>{const P=d.primitive;if(P){P.p1={rawTime:f.rawTime,price:f.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const V={...d,p1:f,p2:D};Te(W=>{const $=W.map(te=>te===d?V:te);return v.current=$,$}),M(V),ce.current=V};if(ee.current==="handle1"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x({rawTime:f,normalizedTime:L,price:Q},d.p2)}else if(ee.current==="handle2"){const f=p.timeScale().coordinateToTime(I);if(f==null)return;x(d.p1,{rawTime:f,normalizedTime:L,price:Q})}else if(ee.current==="line"){const f=ae.current;if(!f)return;const D=p.timeScale().coordinateToTime(f.x),P=g.coordinateToPrice(f.y);if(D==null||P==null)return;const V=L-j(D),W=Q-P,$=j(f.p1.normalizedTime+V),te=j(f.p2.normalizedTime+V);if($==null||te==null)return;const ue=_-D;x({rawTime:f.p1.rawTime+ue,normalizedTime:$,price:f.p1.price+W},{rawTime:f.p2.rawTime+ue,normalizedTime:te,price:f.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const f={...d,time:j(_),rawTime:_};Te(P=>{const V=P.map(W=>W===d?f:W);return v.current=V,V}),M(f),ce.current=f;const D=p.timeScale().timeToCoordinate(_);D!=null&&K([{x:D,y:x.midYCss??200}]),c.current?.applyOptions({});return}if(d.type==="horizontalray"&&d.primitive){const x=d.primitive,f=ae.current;if(!f)return;if(ee.current==="handle1"){if(x.price=Q,x.originTime=_,d.priceLine)try{d.priceLine.applyOptions({price:Q,title:d.showPrice!==!1?Q.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=Q,d.textPrimitive.originTime=_);const D={...d,price:x.price,originTime:x.originTime,rawOriginTime:_};Te(P=>{const V=P.map(W=>W===d?D:W);return v.current=V,V}),M(D),ce.current=D,c.current?.applyOptions({})}else if(ee.current==="line"){const D=g.coordinateToPrice(f.y);if(D==null)return;const P=Q-D;if(x.price=f.price+P,d.priceLine)try{d.priceLine.applyOptions({price:x.price,title:d.showPrice!==!1?x.price.toFixed(5):""})}catch{}d.textPrimitive&&(d.textPrimitive.price=x.price);const V={...d,price:x.price};Te(W=>{const $=W.map(te=>te===d?V:te);return v.current=$,$}),M(V),ce.current=V,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(ee.current==="handle1"){const x={time:L,price:Q},f=HA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};Te(P=>{const V=P.map(W=>W===d?D:W);return v.current=V,V}),M(D),ce.current=D}else if(ee.current==="handle2"){const x={time:L,price:Q},f=HA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);f.length>0&&d.series.setData(f),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};Te(P=>{const V=P.map(W=>W===d?D:W);return v.current=V,V}),M(D),ce.current=D}else if(ee.current==="line"){const x=ae.current;if(!x)return;const f=p.timeScale().coordinateToTime(x.x),D=g.coordinateToPrice(x.y);if(f==null||D==null)return;const P=L-f,V=Q-D,W={time:j(x.point1.time+P),price:x.point1.price+V},$={time:j(x.point2.time+P),price:x.point2.price+V},te=HA([{time:W.time,value:W.price},{time:$.time,value:$.price}]);te.length>0&&d.series.setData(te),d.decoration&&(d.decoration.p1=W,d.decoration.p2=$);const ue={...d,point1:W,point2:$};Te(me=>{const xe=me.map(Le=>Le===d?ue:Le);return v.current=xe,xe}),M(ue),ce.current=ue}}}},O=()=>{ee.current=null,ae.current=null},Y=()=>{ee.current||ce.current||(re(null),J([]))},B={capture:!0,passive:!1};return N.addEventListener("mousedown",oe,B),N.addEventListener("mousemove",S,B),N.addEventListener("mouseup",O,B),N.addEventListener("mouseleave",Y,B),()=>{N.removeEventListener("mousedown",oe,B),N.removeEventListener("mousemove",S,B),N.removeEventListener("mouseup",O,B),N.removeEventListener("mouseleave",Y,B)}},[Qe,Ge,We,Te]),q.useEffect(()=>{const p=c.current,g=u.current;if(!p||!g)return;const N=()=>{const H=R;if(!H){K([]);return}const X=p.timeScale();if(H.type==="infoline"&&H.p1&&H.p2){const Z=H.p1.rawTime??H.p1.time,ne=H.p2.rawTime??H.p2.time,oe=X.timeToCoordinate(Z),S=g.priceToCoordinate(H.p1.price),O=X.timeToCoordinate(ne),Y=g.priceToCoordinate(H.p2.price);oe!=null&&S!=null&&O!=null&&Y!=null?K([{x:oe,y:S},{x:O,y:Y}]):K([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:(Z+oe)/2,y:(ne+S)/2},{x:oe,y:S}]):K([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="crossline"&&H.p){const Z=X.timeToCoordinate(H.p.rawTime),ne=g.priceToCoordinate(H.p.price);Z!=null&&ne!=null?K([{x:Z,y:ne}]):K([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const Z=X.timeToCoordinate(H.rawTime),ne=g.priceToCoordinate(H.price);Z!=null&&ne!=null?K([{x:Z,y:ne}]):K([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.b1.rawTime),Y=g.priceToCoordinate(H.b1.price),B=X.timeToCoordinate(H.b2.rawTime),h=g.priceToCoordinate(H.b2.price);Z!=null&&ne!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?K([{x:Z,y:ne},{x:oe,y:S},{x:(O+B)/2,y:(Y+h)/2}]):K([]);return}if(H.type==="regressionchannel"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);Z!=null&&ne!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?K([{x:Z,y:ne},{x:oe,y:S},{x:O,y:Y}]):K([]);return}if(H.type==="disjointchannel"&&H.p1&&H.p2&&H.p3&&H.p4){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);Z!=null&&ne!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?K([{x:Z,y:ne},{x:oe,y:S},{x:O,y:Y},{x:B,y:h}]):K([]);return}if(H.type==="flattopbottom"&&H.p1&&H.p2&&H.p3&&H.p4){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=g.priceToCoordinate(H.p4.price);Z!=null&&ne!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?K([{x:Z,y:ne},{x:oe,y:S},{x:O,y:Y},{x:B,y:h}]):K([]);return}if(H.type==="fibonacci"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const Z=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const Z=X.timeToCoordinate(H.point1.time),ne=g.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=g.priceToCoordinate(H.point2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:(Z+oe)/2,y:(ne+S)/2},{x:oe,y:S}]):K([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(Z!=null&&ne!=null&&oe!=null&&S!=null){const O=Math.min(Z,oe),Y=Math.max(Z,oe),B=Math.min(ne,S),h=Math.max(ne,S),b=(O+Y)/2,I=(B+h)/2;K([{x:O,y:B},{x:b,y:B},{x:Y,y:B},{x:O,y:I},{x:Y,y:I},{x:O,y:h},{x:b,y:h},{x:Y,y:h}])}else K([]);return}if(H.type==="circle"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=g.priceToCoordinate(H.p3.price);Z!=null&&ne!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?K([{x:Z,y:ne},{x:oe,y:S},{x:O,y:Y}]):K([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);if(Z!=null&&ne!=null&&oe!=null&&S!=null){const O=(Z+oe)/2,Y=(ne+S)/2,B=oe-Z,h=S-ne,b=Math.hypot(B,h);if(b<.001){K([]);return}const I=B/b,w=h/b,d=-w,_=I,Q=b/2,L=Q*Math.max(.05,H.minorRatio??.45);K([{x:O-I*Q,y:Y-w*Q},{x:O+d*L,y:Y+_*L},{x:O+I*Q,y:Y+w*Q},{x:O-d*L,y:Y-_*L}])}else K([]);return}if(H.type==="gannfan"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const Z=X.timeToCoordinate(H.p1.rawTime),ne=g.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=g.priceToCoordinate(H.p2.price);Z!=null&&ne!=null&&oe!=null&&S!=null?K([{x:Z,y:ne},{x:oe,y:S}]):K([]);return}if(H.type==="horizontalray"&&H.primitive){const Z=H.primitive,ne=X.timeToCoordinate(Z.originTime),oe=g.priceToCoordinate(Z.price);ne!=null&&oe!=null?K([{x:ne,y:oe}]):K([]);return}if(H.type==="verticalline"&&H.primitive){const Z=H.primitive,ne=X.timeToCoordinate(Z.time);if(ne!=null){const oe=Z.midYCss??200;K([{x:ne,y:oe}])}else K([]);return}if(H.type==="pricelevel"&&H.priceLine){const Z=u.current?.priceToCoordinate(H.price);if(Z!=null){const ne=c.current?c.current.paneSize().width:400;K([{x:ne/2,y:Z}])}else K([]);return}K([])};N();const Be=p.timeScale();return Be.subscribeVisibleTimeRangeChange(N),()=>{Be.unsubscribeVisibleTimeRangeChange(N)}},[R]),q.useEffect(()=>{let p=!1;v.current.forEach(g=>{if(g.type==="verticalline"&&g.primitive){const N=g===R||g===Ae;g.primitive.showDot!==N&&(g.primitive.showDot=N,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{let p=!1;v.current.forEach(g=>{if((g.type==="infoline"||g.type==="rulerline"||g.type==="arrowedline"||g.type==="rayline"||g.type==="extendedline"||g.type==="trendbyangle")&&g.primitive){const N=g===R||g===Ae;g.primitive.isActive!==N&&(g.primitive.isActive=N,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{!c.current||!u.current||v.current.forEach(p=>{if(p.series&&p.series.applyOptions({visible:_e}),p.priceLine){const g=_e&&p.showPrice!==!1;p.priceLine.applyOptions(_e?{color:p.lineColor??"#3b82f6",axisLabelVisible:g,title:g&&typeof p.price=="number"?p.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""})}if(p.type==="fibonacci"&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}if(p.type==="rectangle"&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}if(p.type==="parallellines"&&(p.baseLine&&p.baseLine.applyOptions({visible:_e}),p.parallelLine&&p.parallelLine.applyOptions({visible:_e}),p.firstLine&&p.firstLine.applyOptions({visible:_e}),p.secondLine&&p.secondLine.applyOptions({visible:_e})),(p.type==="horizontalray"||p.type==="verticalline"||p.type==="infoline"||p.type==="rulerline"||p.type==="arrowedline"||p.type==="rayline"||p.type==="extendedline"||p.type==="crossline"||p.type==="trendbyangle"||p.type==="equidistantchannel"||p.type==="regressionchannel"||p.type==="stddevchannel"||p.type==="gannfan"||p.type==="ganngrid"||p.type==="andrewspitchfork"||p.type==="disjointchannel"||p.type==="flattopbottom"||p.type==="circle"||p.type==="triangle"||p.type==="ellipse"||p.type==="text")&&p.primitive){p.primitive.visible=_e;try{c.current?.applyOptions({})}catch{}}})},[_e,We]),q.useEffect(()=>{!_e&&R&&(M(null),K([]))},[_e,R]),q.useEffect(()=>{if(v.current.length>We.length){const p=v.current.filter((g,N)=>!We.includes(g));R&&p.some(g=>g===R)&&(M(null),K([])),p.forEach(g=>{if(g.series&&c.current?.removeSeries(g.series),g.priceLine&&u.current?.removePriceLine(g.priceLine),g.textPrimitive)try{u.current?.detachPrimitive(g.textPrimitive)}catch{}if(g.type==="horizontalray"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="verticalline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="infoline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rulerline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="arrowedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rayline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="extendedline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="crossline"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="trendbyangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="equidistantchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="regressionchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="stddevchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="gannfan"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ganngrid"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="andrewspitchfork"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="disjointchannel"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="flattopbottom"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="fibonacci"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="rectangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="circle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="triangle"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="ellipse"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="text"&&g.primitive)try{u.current?.detachPrimitive(g.primitive)}catch{}if(g.type==="parallellines")try{g.baseLine&&c.current?.removeSeries(g.baseLine),g.parallelLine&&c.current?.removeSeries(g.parallelLine),g.firstLine&&c.current?.removeSeries(g.firstLine),g.secondLine&&c.current?.removeSeries(g.secondLine)}catch{}}),v.current=We}},[We,R]),q.useEffect(()=>{const p=u.current;return p?(Ve.current.forEach(N=>{try{p.removePriceLine(N)}catch{}}),Ve.current=[],Ne.filter(N=>N.symbol===ye).forEach(N=>{const Be=parseFloat(N.price);if(isNaN(Be))return;const X=N.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350",Z=p.createPriceLine({price:Be,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${N.type} ${N.volume} @ ${N.price}`,textColor:X});Ve.current.push(Z)}),()=>{Ve.current.forEach(N=>{try{p.removePriceLine(N)}catch{}}),Ve.current=[]}):void 0},[Ne,ye]),q.useEffect(()=>{const p=o.current;if(!p)return;const g=N=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const Be=c.current,H=u.current;if(Be&&H&&v.current.length>0){const X=p.getBoundingClientRect(),Z=N.clientX-X.left,ne=N.clientY-X.top,oe=15;for(let S=v.current.length-1;S>=0;S--){const O=v.current[S];let Y=!1;if(O.type==="text"&&O.rawTime!=null&&O.price!=null){const B=Be.timeScale().timeToCoordinate(O.rawTime),h=H.priceToCoordinate(O.price);if(B!=null&&h!=null){const b=Rd(O,B,h);Z>=b.left&&Z<=b.right&&ne>=b.top&&ne<=b.bottom&&(Y=!0)}}else if(O.point1&&O.point2){const B=Be.timeScale().timeToCoordinate(O.point1.time??O.point1.rawTime),h=H.priceToCoordinate(O.point1.price),b=Be.timeScale().timeToCoordinate(O.point2.time??O.point2.rawTime),I=H.priceToCoordinate(O.point2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.hypot(Z-B,ne-h),d=Math.hypot(Z-b,ne-I),_=(B+b)/2,Q=(h+I)/2,L=Math.hypot(Z-_,ne-Q);(w<oe||d<oe||L<oe)&&(Y=!0)}}else if(O.p1&&O.p2){const B=Be.timeScale().timeToCoordinate(O.p1.rawTime),h=H.priceToCoordinate(O.p1.price),b=Be.timeScale().timeToCoordinate(O.p2.rawTime),I=H.priceToCoordinate(O.p2.price);if(B!=null&&h!=null&&b!=null&&I!=null){const w=Math.min(B,b),d=Math.max(B,b),_=Math.min(h,I),Q=Math.max(h,I);Z>=w-5&&Z<=d+5&&ne>=_-5&&ne<=Q+5&&(Y=!0)}}else if(O.p){const B=Be.timeScale().timeToCoordinate(O.p.rawTime),h=H.priceToCoordinate(O.p.price);B!=null&&h!=null&&Math.hypot(Z-B,ne-h)<oe&&(Y=!0)}else if(O.type==="pricelevel"&&O.price!=null){const B=H.priceToCoordinate(O.price);B!=null&&Math.abs(ne-B)<oe&&(Y=!0)}if(Y){N.preventDefault(),N.stopPropagation(),typeof N.stopImmediatePropagation=="function"&&N.stopImmediatePropagation(),ie(O);return}}}N.preventDefault(),N.stopPropagation(),typeof N.stopImmediatePropagation=="function"&&N.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;Zd(c.current,Ge,de)||c.current.timeScale().fitContent();const Z=c.current.timeScale().getVisibleRange();ve(Z)},80)};return p.addEventListener("dblclick",g,!0),()=>{p.removeEventListener("dblclick",g,!0)}},[Ge,de]);const sp=R??Ae,op=R?G:he,_T=_e&&tT(sp,op),PT=AT(sp?.type);q.useEffect(()=>{const p=o.current,g=l.current;if(!p||!g)return;const N=80,Be=X=>{const Z=p.getBoundingClientRect();g.style.opacity=Z.bottom-X.clientY<=N?"1":"0"},H=()=>{g.style.opacity="0"};return p.addEventListener("mousemove",Be),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",Be),p.removeEventListener("mouseleave",H)}},[]);const kT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const N=g.to-g.from,Be=(g.from+g.to)/2,H=N*.8;try{p.setVisibleRange({from:Be-H/2,to:Be+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),NT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleRange();if(!g?.from||!g?.to)return;const N=g.to-g.from,Be=(g.from+g.to)/2,H=N*1.25;try{p.setVisibleRange({from:Be-H/2,to:Be+H/2}),ve(p.getVisibleRange())}catch{}},[ve]),OT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const N=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from-N,to:g.to-N})}catch{}},[]),KT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const g=p.getVisibleLogicalRange();if(!g)return;const N=Math.max(1,Math.round((g.to-g.from)*.1));try{p.setVisibleLogicalRange({from:g.from+N,to:g.to+N})}catch{}},[]),VT=q.useCallback(()=>{if(!c.current)return;Zd(c.current,Ge,de)||c.current.timeScale().fitContent();const g=c.current.timeScale().getVisibleRange();ve(g)},[Ge,de,ve]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${rt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:Qe===1||Qe!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Bt&&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,"..."]})]})}),!Bt&&Zt&&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:rt==="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:rt==="light"?"#64748b":"#94a3b8"},children:Zt})]})}),!Bt&&!Zt&&Ge.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:rt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ye=="object"?ye?.symbol:ye]})})}),A&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Uh,{bidPrice:e,askPrice:t,onBuyClick:LT,onSellClick:MT})}),a.jsx(Sh,{isOpen:et,onClose:HT,orderType:yt,bidPrice:e,askPrice:t}),a.jsx(Ih,{isOpen:z!==null,onClose:()=>ie(null),chartObject:z,onUpdate:IT}),Bt&&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"}})}),_T&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:op.map((p,g)=>a.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:p.x-5,top:p.y-5,backgroundColor:PT}},g))}),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:NT,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:kT,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:OT,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:KT,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:VT,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:p,onClick:g,icon:N})=>a.jsx("button",{title:p,onClick:g,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:rt==="light"?"#374151":"#94a3b8",border:"1px solid "+(rt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:Be=>{Be.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",Be.currentTarget.style.color=rt==="light"?"#111827":"#e2e8f0"},onMouseLeave:Be=>{Be.currentTarget.style.backgroundColor=rt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",Be.currentTarget.style.color=rt==="light"?"#374151":"#94a3b8"},children:N},p))})]})})}),wt={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 Yd({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Dt(),[s,o]=q.useState(!1),[l,c]=q.useState(""),[u,m]=q.useState(-1),y=q.useRef(null),v=q.useRef(null);q.useEffect(()=>{const E=k=>{y.current&&!y.current.contains(k.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),q.useEffect(()=>{s&&v.current&&v.current.focus()},[s]);const T=r.filter(E=>E.symbol.toLowerCase().includes(l.toLowerCase())),C=T.filter(E=>!E.symbol.endsWith("USDT")),U=T.filter(E=>E.symbol.endsWith("USDT")),F=E=>{A(E),o(!1),c("")};return r.find(E=>E.symbol===t),a.jsxs("div",{ref:y,style:{...wt.container,...i},className:e,children:[a.jsxs("button",{style:wt.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,wt.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[a.jsx("span",{children:n?"Loading...":t||"Select Coin"}),a.jsx("span",{style:{...wt.arrow,...s?wt.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:wt.dropdown,children:[a.jsx("div",{style:wt.searchContainer,children:a.jsx("input",{ref:v,style:wt.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:wt.list,children:T.length===0?a.jsx("div",{style:wt.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:wt.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...wt.item,...E.symbol===t?wt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:wt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...wt.symbolPrice,...parseFloat(E.change)>=0?wt.priceUp:wt.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:wt.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...wt.item,...E.symbol===t?wt.itemSelected:{}},onClick:()=>F(E.symbol),onMouseEnter:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="#334155")},onMouseLeave:k=>{E.symbol!==t&&(k.currentTarget.style.backgroundColor="transparent")},children:[a.jsx("span",{style:wt.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...wt.symbolPrice,...parseFloat(E.change)>=0?wt.priceUp:wt.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const IA={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"}},aT=[.01,.05,.1,.5,1];function qd({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=aT,showPresets:s=!0,showLabel:o=!0,label:l="Vol",style:c,className:u}){const[m,y]=q.useState(.1),v=i!==void 0?i:m,T=q.useCallback(E=>{const k=Math.max(t,Math.min(A,parseFloat(E)||t)),R=Math.round(k/r)*r,M=parseFloat(R.toFixed(8));i!==void 0||y(M),e?.(M)},[t,A,r,i,e]),C=()=>T(v+r),U=()=>T(v-r),F=(v>=1,v.toFixed(2));return a.jsxs("div",{style:{...IA.container,...c},className:u,children:[o&&a.jsx("span",{style:IA.label,children:l}),a.jsx("button",{style:IA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,IA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:IA.input,type:"text",value:F,onChange:E=>{const k=E.target.value;if(k===""||k==="."||k==="0.")return;const R=parseFloat(k);isNaN(R)||T(R)},onBlur:()=>T(v)}),a.jsx("button",{style:IA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,IA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:IA.presets,children:n.map(E=>a.jsx("button",{style:{...IA.preset,...Math.abs(v-E)<1e-4?IA.presetActive:{}},onClick:()=>T(E),onMouseEnter:k=>{Math.abs(v-E)>=1e-4&&Object.assign(k.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:k=>{Math.abs(v-E)>=1e-4&&(k.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const AA={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 jd({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:u,className:m}){const{currentSymbolData:y}=Dt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ie=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),G=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),K=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){G(he);return}const J=parseFloat(he);isNaN(J)||G(he)},Ae=M==="price"?y?.bid?parseFloat(y.bid).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...AA.container,...u},className:m,children:[l&&a.jsx("span",{style:AA.label,children:c}),s&&a.jsx("button",{style:{...AA.toggle,...R?AA.toggleOn:AA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...AA.toggleKnob,...R?AA.knobOn:AA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:AA.inputGroup,children:[a.jsx("input",{style:AA.input,type:"text",value:k,onChange:K,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#EF5350",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...AA.modeBtn,...M==="price"?AA.modeBtnActive:{}},onClick:()=>ie("price"),children:"Price"}),a.jsx("button",{style:{...AA.modeBtn,...M==="pips"?AA.modeBtnActive:{}},onClick:()=>ie("pips"),children:"Pips"})]})]})]})}const iA={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 ep({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:u,className:m}){const{currentSymbolData:y}=Dt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),k=i!==void 0?i:v,R=t!==void 0?t:C,M=r!==void 0?r:F,z=q.useCallback(re=>{t!==void 0||U(re),A?.(re)},[t,A]),ie=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),G=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),K=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){G(he);return}const J=parseFloat(he);isNaN(J)||G(he)},Ae=M==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...iA.container,...u},className:m,children:[l&&a.jsx("span",{style:iA.label,children:c}),s&&a.jsx("button",{style:{...iA.toggle,...R?iA.toggleOn:iA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...iA.toggleKnob,...R?iA.knobOn:iA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:iA.inputGroup,children:[a.jsx("input",{style:iA.input,type:"text",value:k,onChange:K,placeholder:Ae,onFocus:re=>re.currentTarget.style.borderColor="#26A69A",onBlur:re=>re.currentTarget.style.borderColor="#334155"}),o&&a.jsxs(a.Fragment,{children:[a.jsx("button",{style:{...iA.modeBtn,...M==="price"?iA.modeBtnActive:{}},onClick:()=>ie("price"),children:"Price"}),a.jsx("button",{style:{...iA.modeBtn,...M==="pips"?iA.modeBtnActive:{}},onClick:()=>ie("pips"),children:"Pips"})]})]})]})}const lT=[{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:"─"}],DA={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 tp({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:u,chartObjects:m,setChartObjects:y}=Dt(),[v,T]=q.useState(null),C=A||lT,U=k=>{l(o===k?null:k)},F=()=>{y([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...DA.container,...n},className:s,children:[i&&a.jsx("span",{style:DA.label,children:r}),C.map(k=>a.jsxs("button",{style:{...DA.btn,...o===k.id?DA.btnActive:{}},onClick:()=>U(k.id),onMouseEnter:R=>{T(k.id),o!==k.id&&Object.assign(R.currentTarget.style,DA.btnHover)},onMouseLeave:R=>{T(null),o!==k.id&&(R.currentTarget.style.borderColor="#334155",R.currentTarget.style.backgroundColor="#1e293b",R.currentTarget.style.color="#94a3b8")},title:k.name,children:[k.icon,v===k.id&&a.jsx("div",{style:DA.tooltip,children:k.name})]},k.id)),(e||t)&&a.jsx("div",{style:DA.divider}),t&&a.jsx("button",{style:{...DA.visibilityBtn,...c?{}:{color:"#64748b",backgroundColor:"#0f172a"}},onClick:E,onMouseEnter:k=>{k.currentTarget.style.borderColor="#3b82f6"},onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155"},title:c?"Hide Drawings":"Show Drawings",children:c?"👁":"○"}),e&&a.jsx("button",{style:DA.deleteBtn,onClick:F,onMouseEnter:k=>Object.assign(k.currentTarget.style,DA.deleteBtnHover),onMouseLeave:k=>{k.currentTarget.style.borderColor="#334155",k.currentTarget.style.backgroundColor="#1e293b",k.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Ap={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 cT({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:u,onStopLossEnabledChange:m,takeProfit:y,onTakeProfitChange:v,takeProfitEnabled:T,onTakeProfitEnabledChange:C,coinSelectorProps:U={},volumeControlProps:F={},stopLossProps:E={},takeProfitProps:k={},drawingToolsProps:R={},style:M,className:z}){const ie=[];i&&ie.push(a.jsx(Yd,{...U},"coin")),e&&ie.push(a.jsx(qd,{value:s,onChange:o,...F},"volume")),t&&ie.push(a.jsx(jd,{value:l,onChange:c,enabled:u,onEnabledChange:m,...E},"sl")),A&&ie.push(a.jsx(ep,{value:y,onChange:v,enabled:T,onEnabledChange:C,...k},"tp")),r&&ie.push(a.jsx(tp,{...R},"draw"));const G=[];return ie.forEach((K,Ae)=>{G.push(K),n&&Ae<ie.length-1&&G.push(a.jsx("div",{style:Ap.divider},`div-${Ae}`))}),a.jsx("div",{style:{...Ap.toolbar,...M},className:z,children:G})}const hT=[{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"}],za={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 uT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Dt();return a.jsx("div",{style:{...za.container,...i},className:e,children:hT.map(r=>a.jsx("button",{style:{...za.btn,...t===r.value?za.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 dT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Wa={container:{display:"inline-flex",alignItems:"center",gap:"2px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},btn:{padding:"4px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"11px",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"3px"},btnActive:{backgroundColor:"#1e3a5f",borderColor:"#3b82f6",color:"#60a5fa"}};function pT({style:i,className:e}){const{chartType:t,setChartType:A}=Dt();return a.jsx("div",{style:{...Wa.container,...i},className:e,children:dT.map(r=>a.jsxs("button",{style:{...Wa.btn,...t===r.value?Wa.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 Jt={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 fT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Dt(),[u,m]=q.useState(null),y=parseFloat(o?.bid||0),v=parseFloat(o?.ask||0),T=v>0&&y>0?Math.abs(v-y):0,C=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),U=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",F=q.useCallback(E=>{if(!s)return;const k=E==="BUY"?v:y;if(!k||k<=0){m({type:"error",message:"No price available"});return}const R={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:i,price:k,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,R]);const M=i*k*.01;c(z=>z-M),m({type:"success",message:`${E} executed`}),A?.(R),setTimeout(()=>m(null),3e3)},[s,v,y,i,e,t,l,c,A]);return a.jsxs("div",{style:{...Jt.container,...r},className:n,children:[a.jsx("button",{style:Jt.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Jt.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:Jt.priceBox,children:[a.jsx("span",{style:Jt.priceLabel,children:"Bid"}),a.jsx("span",{style:{...Jt.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:Jt.spread,children:[a.jsx("span",{style:Jt.spreadLabel,children:"Spread"}),a.jsx("span",{style:Jt.spreadValue,children:U(T)})]}),a.jsxs("div",{style:Jt.priceBox,children:[a.jsx("span",{style:Jt.priceLabel,children:"Ask"}),a.jsx("span",{style:{...Jt.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:Jt.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Jt.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...Jt.status,backgroundColor:u.type==="success"?"#14532d":"#7f1d1d",color:u.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${u.type==="success"?"#166534":"#991b1b"}`},children:u.message})]})}const it={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 gT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Dt(),[l,c]=q.useState(null),u=A.filter(C=>C.status==="OPEN"||!C.closeAt),m=q.useCallback((C,U)=>{const F=n.find(E=>E.symbol===C);return F?U?.toUpperCase()==="BUY"?parseFloat(F.bid||0):parseFloat(F.ask||0):0},[n]),y=q.useCallback(C=>{if(l)return;c(C.id);const U=m(C.symbol,C.type),E=(C.type?.toUpperCase()==="BUY"?U-C.price:C.price-U)*C.volume,k=C.volume*C.price*.01;r(R=>R.filter(M=>M.id!==C.id)),o(R=>R+k+E),c(null)},[l,m,r,o]),v=C=>{const U=parseFloat(C);return!U||isNaN(U)?"-":U>=1e3?U.toFixed(2):U>=1?U.toFixed(4):U.toFixed(5)},T=C=>{const U=parseFloat(C);return isNaN(U)?"-":(U>=0?"+":"")+U.toFixed(2)};return a.jsxs("div",{style:{...it.container,...i},className:e,children:[a.jsxs("div",{style:it.header,children:[a.jsxs("span",{style:it.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:it.summary,children:[a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...it.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:it.summaryItem,children:[a.jsx("span",{style:it.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...it.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...it.scrollArea,maxHeight:t},children:a.jsxs("table",{style:it.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:it.th,children:"Symbol"}),a.jsx("th",{style:it.th,children:"Type"}),a.jsx("th",{style:it.th,children:"Volume"}),a.jsx("th",{style:it.th,children:"Open Price"}),a.jsx("th",{style:it.th,children:"Current"}),a.jsx("th",{style:it.th,children:"SL"}),a.jsx("th",{style:it.th,children:"TP"}),a.jsx("th",{style:it.th,children:"Profit"}),a.jsx("th",{style:it.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:it.emptyRow,children:"No open positions"})}):u.map(C=>{const U=m(C.symbol,C.type),F=C.profit||0;return a.jsxs("tr",{children:[a.jsx("td",{style:{...it.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...it.td,...C.type?.toUpperCase()==="BUY"?it.typeBuy:it.typeSell},children:C.type}),a.jsx("td",{style:it.td,children:C.volume}),a.jsx("td",{style:it.td,children:v(C.price)}),a.jsx("td",{style:it.td,children:v(U)}),a.jsx("td",{style:it.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:it.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...it.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:it.td,children:a.jsx("button",{style:{...it.closeBtn,...l===C.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>y(C),disabled:l===C.id,onMouseEnter:E=>{l!==C.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:l===C.id?"...":"Close"})})]},C.id)})})]})})]})}function mT(i){return $t({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 wT(i){return $t({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 BT(i){return $t({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 yT(i){return $t({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 CT=({selectedSymbol:i,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:r,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:l,onDownloadChartPNG:c,onToggleFullscreen:u,marketWatchOpen:m=!0,onToggleMarketWatch:y,buySellPanelOpen:v,onMove:T})=>{const{theme:C}=Dt(),U=C==="light",F=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={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.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b min-w-max ${U?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${U?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(k=>a.jsx("button",{onClick:()=>r(k),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
13
+ ${A===k?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
14
+ `,title:k,children:E[k]},k))}),a.jsx("div",{className:`flex items-center gap-1 border-r ${U?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(k=>a.jsx("button",{onClick:()=>r(k),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
15
+ ${A===k?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
16
+ `,title:k,children:E[k]},k))}),a.jsxs("div",{className:"flex items-center gap-2",children:[F.map(k=>a.jsx("button",{onClick:()=>t(k),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===k?U?"text-sky-600":"text-sky-400":U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:k},k)),a.jsx("div",{className:`border-r h-6 mx-1 ${U?"border-slate-200":"border-slate-700"}`}),a.jsx("button",{onClick:()=>l?.(),title:v?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${v?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"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 ${U?"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 ${U?"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 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:a.jsx(mT,{className:"w-5 h-5"})}),a.jsx("button",{onClick:o,className:`p-2 ${U?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:a.jsx(wT,{className:"w-5 h-5"})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{onClick:T,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${U?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:a.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:a.jsx("path",{fillRule:"evenodd",d:"M9 4V5H15V4H17V5H19C20.1046 5 21 5.89543 21 7V18C21 19.1046 20.1046 20 19 20H5C3.89543 20 3 19.1046 3 18V7C3 5.89543 3.89543 5 5 5H7V4H9ZM7 7H6C5.44772 7 5 7.44772 5 8V17C5 17.5523 5.44772 18 6 18H18C18.5523 18 19 17.5523 19 17V8C19 7.44772 18.5523 7 18 7H17V8H15V7H9V8H7V7ZM13 14V16H11V14H13ZM9 14V16H7V14H9ZM17 14V16H15V14H17ZM13 10V12H11V10H13ZM17 10V12H15V10H17Z",clipRule:"evenodd"})})}),a.jsx("div",{className:`border-r ${U?"border-slate-200":"border-slate-700"} h-6 mx-1`}),a.jsx("button",{type:"button",onClick:()=>y?.(),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?U?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":U?"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 ${U?"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:()=>u?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${U?"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"})})})]})]})},Dr=[{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"})]})}],_r=[{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"})})}],Pr=[{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"})})}],kr=[{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"})})}],bs=({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})}),vT=({AccountId:i,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:r,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:l,chartObjects:c,setChartObjects:u,drawingsVisible:m,setDrawingsVisible:y,chartLocked:v,setChartLocked:T,theme:C,setTheme:U,setCandleColors:F,setIsShow:E}=Dt(),k={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[R,M]=q.useState(!1),[z,ie]=q.useState(null),[G,K]=q.useState(null),[Ae,re]=q.useState(0),[he,J]=q.useState(!1),[ee,ae]=q.useState(0),[ce,se]=q.useState(!1),[le,pe]=q.useState(0),[we,be]=q.useState(!1),[Fe,Ce]=q.useState(0),[ve,Qe]=q.useState(!1),[Ue,ke]=q.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Je=q.useRef(null),We=q.useRef(null),Te=q.useRef(null),Ne=q.useRef(null),ye=q.useRef(null),de=q.useRef(null);q.useEffect(()=>{const ge=De=>{const Ie=Je.current;R&&Ie&&!Ie.contains(De.target)&&(M(!1),ie(null));const Se=We.current;G==="line"&&Se&&!Se.contains(De.target)&&K(null);const He=Te.current;G==="channel"&&He&&!He.contains(De.target)&&K(null);const Ke=Ne.current;G==="gann"&&Ke&&!Ke.contains(De.target)&&K(null);const tt=ye.current;G==="shape"&&tt&&!tt.contains(De.target)&&K(null)};return window.addEventListener("mousedown",ge),()=>window.removeEventListener("mousedown",ge)},[R,G]),q.useEffect(()=>{const ge=De=>{De.key==="Escape"&&(M(!1),ie(null),K(null))};return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[]);const _e=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"},{icon:a.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[a.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),a.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),je=ge=>{const De=_e[ge].label;if(De==="Menu"){M(Ie=>!Ie),ie(null);return}if(De==="Grid"){s(!n);return}if(De==="Magnet"){l(!o),r(o?null:ge);return}if(De==="Delete"){if(c.length>0){const Ie=[...c];Ie.pop(),u(Ie)}return}if(De==="Eye"){y(!m);return}if(De==="Lock"){T(!v);return}if(De==="Light Theme"||De==="Dark Theme"){U(C==="light"?"dark":"light"),M(!1),ie(null);return}if(De==="History"){E(!0);return}r(A===ge?null:ge)};_e.slice(0,12);const At=_e.slice(12),rt=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],vt=[{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:"Trade Position",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:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),a.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),a.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",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 19L8 14L12 19H4Z",fill:"#3183FF"}),a.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),a.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP 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)"},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.688 17.773-.375.91c.43.277.911.415 1.445.415.614 0 1.104-.15 1.469-.45.367-.299.55-.68.55-1.144 0-.258-.044-.491-.132-.7a1.568 1.568 0 0 0-.387-.55c-.17-.159-.446-.332-.828-.52-.727-.354-1.09-.695-1.09-1.023 0-.198.064-.358.191-.48.13-.126.313-.188.547-.188.396 0 .772.128 1.129.383l.309-.875c-.31-.248-.796-.371-1.457-.371-.508 0-.925.146-1.25.437a1.421 1.421 0 0 0-.485 1.102c0 .237.04.453.121.648.084.195.2.365.352.508.154.14.45.322.887.543.44.219.73.417.87.594.141.177.212.363.212.558 0 .417-.299.625-.895.625-.388 0-.782-.14-1.184-.422ZM8.68 13.277V19h3.601v-.902H9.695v-4.82H8.68ZM20 20H4v1h16v-1Z",fill:"#EA4C4C"}),a.jsx("path",{d:"M10.5 10V7.895c.193.018.346.027.46.027 1.548 0 2.321-.656 2.321-1.969 0-.588-.21-1.02-.629-1.297-.416-.278-1.076-.418-1.98-.418-.115 0-.51.015-1.188.043V10H10.5Zm0-3.008V5.16c.099-.013.202-.02.309-.02.955 0 1.433.298 1.433.891 0 .35-.107.602-.32.758-.214.154-.552.23-1.016.23-.099 0-.234-.009-.406-.027Z",fill:"#3183FF",fillRule:"evenodd","clip-rule":"evenodd"}),a.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",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:"Trade Notification",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:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{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:"oneclick",label:"One Click Trading",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:"M20.9914 12.3966L18.9885 11.5954C18.7789 7.91769 15.7302 5 12 5C8.13401 5 5 8.13401 5 12C5 15.7302 7.91769 18.7789 11.5954 18.9885L12.3966 20.9914C12.2651 20.9971 12.1329 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 12.1329 20.9971 12.2651 20.9914 12.3966ZM11 11L21 15L19 17L22 20L20 22L17 19L15 21L11 11Z",fill:"currentColor"})})})})},{key:"theme",label:C==="light"?"Dark Theme":"Light Theme",icon: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"})]})},{label:"Arabic",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"})]})},{label:"Bulgarian",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",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("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",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:"M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 18H13V16H11V18ZM12 6C9.79 6 8 7.79 8 10H10C10 8.9 10.9 8 12 8C13.1 8 14 8.9 14 10C14 12 11 11.75 11 15H13C13 12.75 16 12.5 16 10C16 7.79 14.21 6 12 6Z",fill:"currentColor"})})})})},{key:"contact",label:"Contact us",icon: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:"M5 4C3.89543 4 3 4.89543 3 6V15C3 16.1046 3.89543 17 5 17H5.98719L6 21L13 17H19C20.1046 17 21 16.1046 21 15V6C21 4.89543 20.1046 4 19 4H5ZM6 6H18C18.5128 6 18.9355 6.38604 18.9933 6.88338L19 7V14C19 14.5128 18.614 14.9355 18.1166 14.9933L18 15H12.5339C12.4234 15 12.314 15.0183 12.21 15.0539L12.108 15.0952L8 17.0289V16C8 15.4872 7.61396 15.0645 7.11662 15.0067L7 15H6C5.48716 15 5.06449 14.614 5.00673 14.1166L5 14V7C5 6.48716 5.38604 6.06449 5.88338 6.00673L6 6Z",fillRule:"evenodd","clip-rule":"evenodd",fill:"currentColor"})})})})},{key:"about",label:"About program",icon:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],kt=({item:ge})=>{const De=!!ge.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{de.current&&(clearTimeout(de.current),de.current=null),De&&ie(ge.key)},onMouseLeave:()=>{De&&(de.current=setTimeout(()=>ie(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{De?ie(Ie=>Ie===ge.key?null:ge.key):(ge.key==="theme"&&U(Ie=>Ie==="light"?"dark":"light"),M(!1),ie(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:ge.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:ge.label}),ge.rightText&&a.jsx("span",{className:`text-xs ${Me?"text-slate-500":"text-slate-400"}`,children:ge.rightText}),De&&a.jsx("svg",{className:`w-4 h-4 ${Me?"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"})})]}),De&&z===ge.key&&a.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Me?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:ge.submenu.map((Ie,Se)=>{const He=Ue[ge.key]===Ie.label||Ie.selected&&Ue[ge.key]==null;return a.jsxs("button",{type:"button",onClick:()=>{ke(Ke=>({...Ke,[ge.key]:Ie.label})),ge.key==="colors"&&k[Ie.label]&&F(k[Ie.label])},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:Ie.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:Ie.label}),He&&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"})})})]},Se)})})})]})},Me=C==="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 ${Me?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:rt.map((ge,De)=>{const Ie=ge==="gann",Se=Ie?null:_e[ge],He=Ie?-1:ge;return a.jsxs(q.Fragment,{children:[He===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ke=Dr[Ae].toolId;r(A===Ke?null:Ke)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
17
+ ${A===Dr[Ae].toolId?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Dr[Ae].label,children:Dr[Ae].icon}),a.jsx("span",{onMouseEnter:()=>J(!0),onMouseLeave:()=>J(!1),onMouseDown:Ke=>{Ke.stopPropagation(),K(tt=>tt==="line"?null:"line")},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 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:Me?"#64748b":"#94a3b8"})})})]}):He===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ke=_r[ee].toolId;r(A===Ke?null:Ke)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
18
+ ${A===_r[ee].toolId?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:_r[ee].label,children:_r[ee].icon}),a.jsx("span",{onMouseEnter:()=>se(!0),onMouseLeave:()=>se(!1),onMouseDown:Ke=>{Ke.stopPropagation(),K(tt=>tt==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:ce?10:7,height:ce?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More 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:Me?"#64748b":"#94a3b8"})})})]}):Ie?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ke=Pr[le].toolId;r(A===Ke?null:Ke)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
19
+ ${A===Pr[le].toolId?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Pr[le].label,children:Pr[le].icon}),a.jsx("span",{onMouseEnter:()=>be(!0),onMouseLeave:()=>be(!1),onMouseDown:Ke=>{Ke.stopPropagation(),K(tt=>tt==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:we?10:7,height:we?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:Me?"#64748b":"#94a3b8"})})})]}):He===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Ke=kr[Fe].toolId;r(A===Ke?null:Ke)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
20
+ ${A===kr[Fe].toolId?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:kr[Fe].label,children:kr[Fe].icon}),a.jsx("span",{onMouseEnter:()=>Qe(!0),onMouseLeave:()=>Qe(!1),onMouseDown:Ke=>{Ke.stopPropagation(),K(tt=>tt==="shape"?null:"shape")},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 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:Me?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>je(He),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
21
+ ${Se.label==="Grid"&&n||Se.label==="Eye"&&!m||Se.label==="Lock"&&v||A===He?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Se.label}: ${Se.description}`,children:Se.icon}),!Ie&&Se.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Me?"border-slate-200":"border-slate-700"}`})]},Ie?"gann-slot":`${Se.label}-${ge}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:At.map((ge,De)=>{const Ie=12+De;return a.jsx("button",{onClick:()=>je(Ie),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
22
+ ${ge.label==="Grid"&&n||ge.label==="Eye"&&!m||ge.label==="Lock"&&v||A===Ie?Me?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Me?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${ge.label}: ${ge.description}`,children:ge.icon},ge.label)})})]}),G==="line"&&a.jsx(bs,{top:84,panelRef:We,isLight:Me,children:Dr.map((ge,De)=>{const Ie=Ae===De;return a.jsxs("button",{type:"button",onMouseDown:Se=>{Se.stopPropagation(),re(De),r(ge.toolId),K(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:ge.icon}),a.jsx("span",{className:"flex-1",children:ge.label}),Ie&&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"})})})]},ge.toolId)})}),G==="channel"&&a.jsx(bs,{top:128,panelRef:Te,isLight:Me,children:_r.map((ge,De)=>{const Ie=ee===De;return a.jsxs("button",{type:"button",onMouseDown:Se=>{Se.stopPropagation(),ae(De),r(ge.toolId),K(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:ge.icon}),a.jsx("span",{className:"flex-1",children:ge.label}),Ie&&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"})})})]},ge.toolId)})}),G==="gann"&&a.jsx(bs,{top:210,panelRef:Ne,isLight:Me,children:Pr.map((ge,De)=>{const Ie=le===De;return a.jsxs("button",{type:"button",onMouseDown:Se=>{Se.stopPropagation(),pe(De),r(ge.toolId),K(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:ge.icon}),a.jsx("span",{className:"flex-1",children:ge.label}),Ie&&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"})})})]},ge.toolId)})}),G==="shape"&&a.jsx(bs,{top:250,panelRef:ye,isLight:Me,children:kr.map((ge,De)=>{const Ie=Fe===De;return a.jsxs("button",{type:"button",onMouseDown:Se=>{Se.stopPropagation(),Ce(De),r(ge.toolId),K(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Me?"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 ${Me?"text-slate-500":"text-slate-400"}`,children:ge.icon}),a.jsx("span",{className:"flex-1",children:ge.label}),Ie&&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"})})})]},ge.toolId)})}),R&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{M(!1),ie(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:Je,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Me?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Me?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Me?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${Me?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:vt.map(ge=>a.jsx(kt,{item:ge},ge.key))})]})]})]})};function TT(i){return $t({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:[]}]})(i)}const xT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},bT={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},QT={binance:"CRYPTO"},FT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Dt(),o=s==="light",[l,c]=q.useState(""),u=e.filter(v=>(v.symbol||"").toLowerCase().includes(l.toLowerCase())),m=q.useMemo(()=>{const v={};for(const U of u){const F=(U.category||"other").toLowerCase();v[F]||(v[F]=[]),v[F].push(U)}const T=["forex","crypto","binance","stocks","indices","commodities"];return Object.keys(v).sort((U,F)=>{const E=T.indexOf(U),k=T.indexOf(F);return E!==-1&&k!==-1?E-k:E!==-1?-1:k!==-1?1:U.localeCompare(F)}).map(U=>({category:U,symbols:v[U]}))},[u]),y=v=>a.jsxs("tr",{onClick:()=>A(v.symbol),className:`cursor-pointer transition-colors ${t===v.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:[v.change>0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(yT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(BT,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Em,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),a.jsx("span",{children:v.symbol})]}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.bid).toFixed(5)}),a.jsx("td",{className:`px-3 py-2 text-right text-md ${v.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(v.ask).toFixed(5)}),a.jsxs("td",{className:`px-3 py-2 text-right font-medium ${v.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[v.change>=0?"+":"",v.change,"%"]})]},v.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`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${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(CT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.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..."})}):u.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:v,symbols:T})=>a.jsxs(j.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?TT[v]||"text-slate-600":vT[v]||"text-slate-400"}`,children:xT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},QT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:m}=Ht(),y=i||n,v=e||s,T=u||[],C=o==="light",U=l?"history":"trade";j.useEffect(()=>{l&&m&&m()},[l,m]);const F="#26A69A",E="#EF5350",N=C?"#f8fafc":"#12161D",R=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",z=C?"#F0F5F9":"#2B3543",Ae=C?"#f8fafc":"#131c2e",$=C?"#12161D":"#fff",V=C?"#64748b":"#fff",ie=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=y?.balance||0,ce=y?.equity??re,Z=y?.margin||0,ee=y?.freeMargin??ce-Z,oe=Z>0?ce/Z*100:0,le=ie.reduce((de,ke)=>de+(ke.livePnL??ke.profit??0),0),se=de=>{const ke=parseFloat(de);return Number.isFinite(ke)?ke.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},he=de=>{const ke=parseFloat(de);return!ke||isNaN(ke)?"—":ke>=1e4?ke.toFixed(2):ke>=10?ke.toFixed(4):ke.toFixed(5)},pe=de=>{const ke=parseFloat(de);return isNaN(ke)?"—":(ke>=0?"+":"")+ke.toFixed(2)},ge=de=>{const ke=parseFloat(de);return isNaN(ke)?"—":ke.toFixed(2)},be=de=>{if(!de)return"—";const ke=new Date(de);return isNaN(ke.getTime())?String(de):`${ke.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${ke.toTimeString().slice(0,8)}`},Ee=j.useCallback((de,ke)=>{de.stopPropagation(),t&&t(ke.id,ke)},[t]),ye=j.useCallback((de,ke)=>{de.stopPropagation(),A&&A(ke)},[A]),Ce={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:N,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:$},Fe={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ue={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Ne={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Je={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},ve=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?C?"#0ea5e9":"#38bdf8":V,borderBottom:de?`2px solid ${C?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Pe={padding:"4px 8px",textAlign:"left",color:V,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},Be={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:Ce,children:[a.jsxs("div",{style:Fe,children:[a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Balance:"}),a.jsxs("span",{style:{...Je,color:$},children:["$",se(re)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Equity:"}),a.jsxs("span",{style:{...Je,color:ce>=re?F:E},children:["$",se(ce)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Margin:"}),a.jsxs("span",{style:{...Je,color:$},children:["$",se(Z)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:Ne,children:"Free Margin:"}),a.jsxs("span",{style:{...Je,color:ee>=0?$:E},children:["$",se(ee)]})]}),a.jsxs("div",{style:{...Ue,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Ne,children:"Margin Level:"}),a.jsx("span",{style:{...Je,color:oe>=100?F:E},children:Z>0?oe.toFixed(2)+"%":"—"})]}),ie.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Ne,children:"Float P/L:"}),a.jsxs("span",{style:{...Je,color:le>=0?F:E,fontWeight:700},children:[le>=0?"+":"",se(le)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:ve(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:ve(U==="history"),onClick:()=>c&&c(!0),children:"History"})]}),U==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Pe,children:"Symbol"}),a.jsx("th",{style:Pe,children:"Ticket"}),a.jsx("th",{style:Pe,children:"Time"}),a.jsx("th",{style:Pe,children:"Type"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...Pe,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...Pe,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:ie.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Be,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):ie.map(de=>{const ke=de.livePnL??de.profit??0,qe=ke>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=Ae,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Be,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Be,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Be,color:V},children:be(de.openAt||de.time)}),a.jsx("td",{style:{...Be,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Be,textAlign:"right"},children:ge(de.volume)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.price??de.openPrice)}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?he(de.stopLoss):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?he(de.takeProfit):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:V},children:de.currentPrice?he(de.currentPrice):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:pe(ke)}),a.jsx("td",{style:{...Be,textAlign:"center"},children:a.jsx("button",{onClick:At=>ye(At,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:At=>At.currentTarget.style.color="#f59e0b",onMouseLeave:At=>At.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:a.jsx("button",{onClick:At=>Ee(At,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:At=>At.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:At=>At.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},de.id)})})]})}),U==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Pe,children:"Symbol"}),a.jsx("th",{style:Pe,children:"Ticket"}),a.jsx("th",{style:Pe,children:"Open Time"}),a.jsx("th",{style:Pe,children:"Type"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:Pe,children:"Close Time"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Pe,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Be,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):T.map(de=>{const ke=de.profit??0,qe=ke>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=Ae,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Be,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Be,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Be,color:V},children:be(de.openAt)}),a.jsx("td",{style:{...Be,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Be,textAlign:"right"},children:ge(de.volume)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.openPrice)}),a.jsx("td",{style:{...Be,color:V},children:be(de.closeAt)}),a.jsx("td",{style:{...Be,textAlign:"right"},children:he(de.closePrice)}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?he(de.stopLoss):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?he(de.takeProfit):"—"}),a.jsx("td",{style:{...Be,textAlign:"right",fontWeight:700,color:qe},children:pe(ke)})]},de.id)})})]})})]})},FT="2.3.2";tt.AccountPanel=QT,tt.BuySellPanel=Fh,tt.Chart=nT,tt.ChartTypeSelector=uT,tt.CoinSelector=Jd,tt.DrawingTools=ep,tt.LeftSidebar=yT,tt.MarketExecutionModal=Uh,tt.MarketWatch=bT,tt.PositionsPanel=pT,tt.SYMBOL_CONFIG=Ra,tt.StopLoss=qd,tt.TakeProfit=jd,tt.TimeframeSelector=cT,tt.ToolCustomizationModal=Hh,tt.TopBar=BT,tt.TradePanel=dT,tt.TradingProvider=fm,tt.TradingToolbar=aT,tt.VolumeControl=Yd,tt.alignToTimeframe=Ve,tt.detectGaps=up,tt.getSymbolConfig=Wi,tt.is24x7Symbol=hp,tt.isCryptoSymbol=Or,tt.isForexSymbol=kr,tt.isWithinTradingSession=dp,tt.normalizeCandleTimes=$a,tt.normalizeTime=q,tt.processCandles=Ya,tt.processSingleCandle=qa,tt.setSocketBaseUrl=yh,tt.timeframeToSeconds=iA,tt.useTrading=Ht,tt.validateTimeOrdering=pp,tt.version=FT,Object.defineProperty(tt,Symbol.toStringTag,{value:"Module"})}));
49
+ `}),a.jsxs("div",{style:{width:`${i}px`,minWidth:"220px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${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(TT,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),a.jsx("input",{type:"text",placeholder:"Search symbol",value:l,onChange:v=>c(v.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..."})}):u.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:v,symbols:T})=>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?bT[v]||"text-slate-600":xT[v]||"text-slate-400"}`,children:QT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},UT=({accountSummary:i,orders:e,onClose:t,onModify:A,height:r})=>{const{accountSummary:n,orders:s,theme:o,isShow:l,setIsShow:c,historyOrders:u,fetchHistoryOrders:m}=Dt(),y=i||n,v=e||s,T=u||[],C=o==="light",U=l?"history":"trade";q.useEffect(()=>{l&&m&&m()},[l,m]);const F="#26A69A",E="#EF5350",k=C?"#f8fafc":"#12161D",R=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",z=C?"#F0F5F9":"#2B3543",ie=C?"#f8fafc":"#131c2e",G=C?"#12161D":"#fff",K=C?"#64748b":"#fff",Ae=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=y?.balance||0,he=y?.equity??re,J=y?.margin||0,ee=y?.freeMargin??he-J,ae=J>0?he/J*100:0,ce=Ae.reduce((de,_e)=>de+(_e.livePnL??_e.profit??0),0),se=de=>{const _e=parseFloat(de);return Number.isFinite(_e)?_e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},le=de=>{const _e=parseFloat(de);return!_e||isNaN(_e)?"—":_e>=1e4?_e.toFixed(2):_e>=10?_e.toFixed(4):_e.toFixed(5)},pe=de=>{const _e=parseFloat(de);return isNaN(_e)?"—":(_e>=0?"+":"")+_e.toFixed(2)},we=de=>{const _e=parseFloat(de);return isNaN(_e)?"—":_e.toFixed(2)},be=de=>{if(!de)return"—";const _e=new Date(de);return isNaN(_e.getTime())?String(de):`${_e.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${_e.toTimeString().slice(0,8)}`},Fe=q.useCallback((de,_e)=>{de.stopPropagation(),t&&t(_e.id,_e)},[t]),Ce=q.useCallback((de,_e)=>{de.stopPropagation(),A&&A(_e)},[A]),ve={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:k,borderTop:`1px solid ${R}`,display:"flex",flexDirection:"column",height:r?`${r}px`:"auto",overflow:"hidden",fontSize:"11px",color:G},Qe={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ue={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},ke={color:K,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Je={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},We={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},Te=de=>({padding:"5px 14px",fontSize:"11px",fontWeight:de?700:500,color:de?C?"#0ea5e9":"#38bdf8":K,borderBottom:de?`2px solid ${C?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Ne={padding:"4px 8px",textAlign:"left",color:K,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",backgroundColor:M,position:"sticky",top:0,zIndex:1},ye={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:G};return a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:Qe,children:[a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:ke,children:"Balance:"}),a.jsxs("span",{style:{...Je,color:G},children:["$",se(re)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:ke,children:"Equity:"}),a.jsxs("span",{style:{...Je,color:he>=re?F:E},children:["$",se(he)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:ke,children:"Margin:"}),a.jsxs("span",{style:{...Je,color:G},children:["$",se(J)]})]}),a.jsxs("div",{style:Ue,children:[a.jsx("span",{style:ke,children:"Free Margin:"}),a.jsxs("span",{style:{...Je,color:ee>=0?G:E},children:["$",se(ee)]})]}),a.jsxs("div",{style:{...Ue,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:ke,children:"Margin Level:"}),a.jsx("span",{style:{...Je,color:ae>=100?F:E},children:J>0?ae.toFixed(2)+"%":"—"})]}),Ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:ke,children:"Float P/L:"}),a.jsxs("span",{style:{...Je,color:ce>=0?F:E,fontWeight:700},children:[ce>=0?"+":"",se(ce)]})]})]}),a.jsxs("div",{style:We,children:[a.jsx("button",{style:Te(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:Te(U==="history"),onClick:()=>c&&c(!0),children:"History"})]}),U==="trade"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Ne,children:"Symbol"}),a.jsx("th",{style:Ne,children:"Ticket"}),a.jsx("th",{style:Ne,children:"Time"}),a.jsx("th",{style:Ne,children:"Type"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...Ne,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...Ne,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:Ae.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...ye,textAlign:"center",padding:"16px",color:K},children:"No open positions"})}):Ae.map(de=>{const _e=de.livePnL??de.profit??0,je=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=ie,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:G,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:K,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:K},children:be(de.openAt||de.time)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:le(de.price??de.openPrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?E:K},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:K},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:K},children:de.currentPrice?le(de.currentPrice):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:je},children:pe(_e)}),a.jsx("td",{style:{...ye,textAlign:"center"},children:a.jsx("button",{onClick:At=>Ce(At,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:K,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:At=>At.currentTarget.style.color="#f59e0b",onMouseLeave:At=>At.currentTarget.style.color=K,children:"✎"})}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:je},children:a.jsx("button",{onClick:At=>Fe(At,de),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:At=>At.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:At=>At.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},de.id)})})]})}),U==="history"&&a.jsx("div",{style:{overflowY:"auto",flex:1},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:Ne,children:"Symbol"}),a.jsx("th",{style:Ne,children:"Ticket"}),a.jsx("th",{style:Ne,children:"Open Time"}),a.jsx("th",{style:Ne,children:"Type"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:Ne,children:"Close Time"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...ye,textAlign:"center",padding:"16px",color:K},children:"No trade history"})}):T.map(de=>{const _e=de.profit??0,je=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:At=>At.currentTarget.style.backgroundColor=ie,onMouseLeave:At=>At.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...ye,fontWeight:700,color:G,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...ye,color:K,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...ye,color:K},children:be(de.openAt)}),a.jsx("td",{style:{...ye,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...ye,textAlign:"right"},children:we(de.volume)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:le(de.openPrice)}),a.jsx("td",{style:{...ye,color:K},children:be(de.closeAt)}),a.jsx("td",{style:{...ye,textAlign:"right"},children:le(de.closePrice)}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.stopLoss?E:K},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",color:de.takeProfit?F:K},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...ye,textAlign:"right",fontWeight:700,color:je},children:pe(_e)})]},de.id)})})]})})]})},ST="2.3.2";qe.AccountPanel=UT,qe.BuySellPanel=Uh,qe.Chart=oT,qe.ChartTypeSelector=pT,qe.CoinSelector=Yd,qe.DrawingTools=tp,qe.LeftSidebar=vT,qe.MarketExecutionModal=Sh,qe.MarketWatch=FT,qe.PositionsPanel=gT,qe.SYMBOL_CONFIG=Ga,qe.StopLoss=jd,qe.TakeProfit=ep,qe.TimeframeSelector=uT,qe.ToolCustomizationModal=Ih,qe.TopBar=CT,qe.TradePanel=fT,qe.TradingProvider=mm,qe.TradingToolbar=cT,qe.VolumeControl=qd,qe.alignToTimeframe=ze,qe.detectGaps=pp,qe.getSymbolConfig=Ri,qe.is24x7Symbol=dp,qe.isCryptoSymbol=Kr,qe.isForexSymbol=Or,qe.isWithinTradingSession=fp,qe.normalizeCandleTimes=Xa,qe.normalizeTime=j,qe.processCandles=qa,qe.processSingleCandle=ja,qe.setSocketBaseUrl=Ch,qe.timeframeToSeconds=nA,qe.useTrading=Dt,qe.validateTimeOrdering=gp,qe.version=ST,Object.defineProperty(qe,Symbol.toStringTag,{value:"Module"})}));