@nabeeltahirdeveloper/chart-sdk 2.3.15-beta → 2.3.16-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chart-sdk.es.js +7390 -7240
- package/dist/chart-sdk.umd.js +21 -21
- package/package.json +1 -1
package/dist/chart-sdk.umd.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
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]&&
|
|
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(
|
|
5
|
-
`):" "+
|
|
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"?"👨".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=`{
|
|
1
|
+
(function(je,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(je=typeof globalThis<"u"?globalThis:je||self,a(je.ChartSDK={},je.jsxRuntime,je.React))})(this,(function(je,a,q){"use strict";var Ks=typeof document<"u"?document.currentScript:null;const Gt="17:00-17:00",$t="America/New_York",IA="24x7",DA="UTC",rl={EURUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"},BTCUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},ETHUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},BNBUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},SOLUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},ADAUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},XRPUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},DOTUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},MATICUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"},LINKUSDT:{type:"crypto",session:IA,sessionTZ:DA,priceMode:"last"}},nl={type:"forex",sessionTZ:$t,session:Gt,priceMode:"mid"};function nr(i){return i&&rl[i.toUpperCase()]||nl}function en(i){return nr(i).type==="forex"}function tn(i){return nr(i).type==="crypto"}function xp(i){return nr(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 bp(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 Qp(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 sl(i){return Array.isArray(i)?i.map(e=>({...e,time:j(e.time)})).filter(e=>e.time!=null):[]}function Fp(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 Oe(i,e){return!Number.isFinite(i)||!Number.isFinite(e)||e<=0?i:Math.floor(i/e)*e}function ol(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 al(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 ll(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 Up(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 Sp(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=Oe(y,e);y<c&&v<r;){const T=Oe(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=Oe(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 uA(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 cl(i,e,t){if(!Array.isArray(i)||i.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=nr(e),r=uA(t),o=sl(i).map(E=>({...E,time:Oe(E.time,r)})).filter(E=>ol(E)).map(E=>al(E)),l=ll(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?Up(m,"percentile"):m,v=ll(y);v.sort((E,N)=>E.time-N.time);const T=Sp(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 hl(i,e,t="1m"){if(!i||!e||!ol(i))return null;const A=j(i.time);if(A==null)return null;const r=uA(t),n=Oe(A,r);return al({...i,time:n})}function xt(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 mi(i,e){return i.width===e.width&&i.height===e.height}var Ep=(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 Lp(i){return new Ep(i)}var Mp=(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=xt({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 xt({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),i.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=xt(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;mi(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=xt(this._transformBitmapSize(e,this._canvasElementClientSize)),r=mi(this.bitmapSize,A)?null:A;t===null&&r===null||t!==null&&r!==null&&mi(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}Ip().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},i.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=ul(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Lp(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},i.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=ul(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?Dp(n[0],r):xt({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=xt({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},i})();function Hp(i,e){return new Mp(i,e.transform,e.options)}function ul(i){return i.ownerDocument.defaultView}function Ip(){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 Dp(i,e){return xt({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 _p=(function(){function i(e,t,A){if(t.width===0||t.height===0)throw new TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,A.width===0||A.height===0)throw new TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=A,this._context=e}return i.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},i.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(i.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),i})();function wi(i,e){var t=i.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=i.bitmapSize;if(A.width===0||A.height===0)return null;var r=i.canvasElement.getContext("2d",e);return r===null?null:new _p(r,t,A)}const Pp={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},kp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Np={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},Op={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},Kp={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},Vp={color:"#26a69a",base:0},dl={color:"#2196f3"},pl={title:"",visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}};var fl,gl;function Bi(i,e){const t={0:[],1:[i.lineWidth,i.lineWidth],2:[2*i.lineWidth,2*i.lineWidth],3:[6*i.lineWidth,6*i.lineWidth],4:[i.lineWidth,4*i.lineWidth]}[e];i.setLineDash(t)}function ml(i,e,t,A){i.beginPath();const r=i.lineWidth%2?.5:0;i.moveTo(t,e+r),i.lineTo(A,e+r),i.stroke()}function ii(i,e){if(!i)throw new Error("Assertion failed"+(e?": "+e:""))}function jt(i){if(i===void 0)throw new Error("Value is undefined");return i}function Se(i){if(i===null)throw new Error("Value is null");return i}function Di(i){return Se(jt(i))}(function(i){i[i.Simple=0]="Simple",i[i.WithSteps=1]="WithSteps",i[i.Curved=2]="Curved"})(fl||(fl={})),(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"})(gl||(gl={}));const wl={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 wA(i){return i<0?0:i>255?255:Math.round(i)||0}function Bl(i){return i<=0||i>1?Math.min(Math.max(i,0),1):Math.round(1e4*i)/1e4}const zp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Wp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Rp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,Gp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function sr(i){(i=i.toLowerCase())in wl&&(i=wl[i]);{const e=Gp.exec(i)||Rp.exec(i);if(e)return[wA(parseInt(e[1],10)),wA(parseInt(e[2],10)),wA(parseInt(e[3],10)),Bl(e.length<5?1:parseFloat(e[4]))]}{const e=Wp.exec(i);if(e)return[wA(parseInt(e[1],16)),wA(parseInt(e[2],16)),wA(parseInt(e[3],16)),1]}{const e=zp.exec(i);if(e)return[wA(17*parseInt(e[1],16)),wA(17*parseInt(e[2],16)),wA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${i}`)}function yl(i){return .199*i[0]+.687*i[1]+.114*i[2]}function An(i){const e=sr(i);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:yl(e)>160?"black":"white"}}class Mt{constructor(){this.h=[]}l(e,t,A){const r={o:e,_:t,u:A===!0};this.h.push(r)}v(e){const t=this.h.findIndex((A=>e===A.o));t>-1&&this.h.splice(t,1)}p(e){this.h=this.h.filter((t=>t._!==e))}m(e,t,A){const r=[...this.h];this.h=this.h.filter((n=>!n.u)),r.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function 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 _A(i){return typeof i=="number"&&isFinite(i)}function or(i){return typeof i=="number"&&i%1==0}function ar(i){return typeof i=="string"}function rn(i){return typeof i=="boolean"}function YA(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"?YA(r):r);return t}function $p(i){return i!==null}function lr(i){return i===null?void 0:i}const Vs="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function _i(i,e,t){return e===void 0&&(e=Vs),`${t=t!==void 0?`${t} `:""}${i}px ${e}`}class Xp{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=_i(t,A),e.L=2.5/12*t,e.B=e.L,e.A=t/12*e.T,e.I=t/12*e.T,e.N=0),e.V=this.$(),e.O=this.U(),this.k}$(){return this.F.W().layout.textColor}U(){return this.F.q()}j(){return this.F.W().layout.fontSize}H(){return this.F.W().layout.fontFamily}}class zs{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((r=>{r.X(e,t,A)}))}}class UA{X(e,t,A){e.useBitmapCoordinateSpace((r=>this.K(r,t,A)))}}class Jp extends UA{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 Zp(){return{it:[{nt:0,st:0,ot:0,_t:0}],lt:"",rt:"",ht:0,et:0,tt:null}}const Yp={from:0,to:1};class qp{constructor(e,t){this.ut=new zs,this.ct=[],this.dt=[],this.ft=!0,this.F=e,this.vt=t,this.ut.Z(this.ct)}bt(e){const t=this.F.wt();t.length!==this.ct.length&&(this.dt=t.map(Zp),this.ct=this.dt.map((A=>{const r=new Jp;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=Se(n.Ct());l.lt=c.Tt,l.ht=c.ht,l.et=c.Pt,l.it[0]._t=c._t,l.it[0].st=n.Dt().Rt(c._t,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=Yp}))}}let jp=class extends UA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),l=Math.round(this.zt.st*r);e.lineCap="butt",n&&o>=0&&(e.lineWidth=Math.floor(this.zt.Lt.et*A),e.strokeStyle=this.zt.Lt.V,e.fillStyle=this.zt.Lt.V,Bi(e,this.zt.Lt.Nt),(function(c,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,Bi(e,this.zt.Et.Nt),ml(e,l,0,t.width))}};class ef{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 jp(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.yt(),t=Se(this.jt.Ht()),A=t.$t().W().crosshair,r=this.Ft;if(A.mode===2)return r.Et.yt=!1,void(r.Lt.yt=!1);r.Et.yt=e&&this.jt.Ut(t),r.Lt.yt=e&&this.jt.qt(),r.Et.et=A.horzLine.width,r.Et.Nt=A.horzLine.style,r.Et.V=A.horzLine.color,r.Lt.et=A.vertLine.width,r.Lt.Nt=A.vertLine.style,r.Lt.V=A.vertLine.color,r.nt=this.jt.Yt(),r.st=this.jt.Zt()}}function tf(i,e,t,A,r,n){i.fillRect(e+n,t,A-2*n,n),i.fillRect(e+n,t+r-n,A-2*n,n),i.fillRect(e,t,n,r),i.fillRect(e+A-n,t,n,r)}function nn(i,e,t,A,r,n){i.save(),i.globalCompositeOperation="copy",i.fillStyle=n,i.fillRect(e,t,A,r),i.restore()}function Cl(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 vl(i,e,t,A,r,n,s=0,o=[0,0,0,0],l=""){if(i.save(),!s||!l||l===n)return Cl(i,e,t,A,r,o),i.fillStyle=n,i.fill(),void i.restore();const c=s/2;var u;Cl(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 Tl(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 xl{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?vl(c,m.ti,m.ii,m.ni,m.si,s,m.ei,[m.ht,0,0,m.ht],s):vl(c,m.ri,m.ii,m.ni,m.si,s,m.ei,[0,m.ht,m.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(m.ri,m.li,m.ai-m.ri,m.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(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,ne=Math.max(1,Math.floor(u));let $=Math.round(M*u);$%2!=ne%2&&($+=1);const V=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,Z=Math.round(he*u)-Math.floor(.5*u),te=Math.floor(Z+ne/2-$/2),ae=te+$,ce=r==="right",se=ce?l.width-y:y,le=ce?o.width-V:V;let pe,Be,Fe;return ce?(pe=le-Ae,Be=le-re,Fe=se-m-C-y):(pe=le+Ae,Be=le+re,Fe=se+m+C),{Qt:ce,Jt:{ii:te,li:Z,ci:ae,ni:Ae,si:$,ht:2*c,ei:V,ti:pe,ri:le,ai:Be,oi:ne,ui:o.width},di:{ii:te/u,ci:ae/u,fi:Fe,pi:N}}}}class sn{constructor(e){this.yi={ki:0,t:"#000",gi:0,wi:0},this.Ci={Kt:"",yt:!1,hi:!0,mi:!1,Ot:"",V:"#FFF",_i:!1,bi:!1},this.Ti={Kt:"",yt:!1,hi:!1,mi:!0,Ot:"",V:"#FFF",_i:!0,bi:!0},this.ft=!0,this.Pi=new(e||xl)(this.Ci,this.yi),this.Ri=new(e||xl)(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 Af extends sn{constructor(e,t,A){super(),this.jt=e,this.Li=t,this.Ei=A}zi(e,t,A){if(e.yt=!1,this.jt.W().mode===2)return;const r=this.jt.W().horzLine;if(!r.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=An(r.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const l=this.Ei(this.Li);A.ki=l.ki,e.Kt=this.Li.Fi(l._t,n),e.yt=!0}}const rf=/[1-9]/g;class bl{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,Se(this.zt).Kt,rf)))));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=Se(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,ne=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,$,ne-z)}})),e.useMediaCoordinateSpace((({context:y})=>{const v=Se(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 nf{constructor(e,t,A){this.ft=!0,this.Wt=new bl,this.Ft={yt:!1,t:"#4c525e",V:"white",Kt:"",Hi:0,ki:NaN,hi:!0},this.vt=e,this.$i=t,this.Ei=A}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt.J(this.Ft),this.Wt}Mt(){const e=this.Ft;if(e.yt=!1,this.vt.W().mode===2)return;const t=this.vt.W().vertLine;if(!t.labelVisible)return;const A=this.$i.St();if(A.Ni())return;e.Hi=A.Hi();const r=this.Ei();if(r===null)return;e.ki=r.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(Se(n)),e.yt=!0;const s=An(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class Ws{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 Ql;(function(i){i[i.Normal=0]="Normal",i[i.Magnet=1]="Magnet",i[i.Hidden=2]="Hidden"})(Ql||(Ql={}));class sf extends Ws{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 qp(e,this),this.fn=((r,n)=>s=>{const o=n(),l=r();if(s===Se(this.tn).vn())return{_t:l,ki:o};{const c=Se(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((r,n)=>()=>{const s=this.$i.St().mn(r()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new nf(this,e,A),this.wn=new ef(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 Af(this,t,A),e.set(t,r)),r}}function on(i){return i==="left"||i==="right"}class Kt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(r,n){return r===void 0?n:{Fn:Math.max(r.Fn,n.Fn),Wn:r.Wn||n.Wn}})(this.zn.get(e),t);this.zn.set(e,A)}jn(){return this.En}Hn(e){const t=this.zn.get(e);return t===void 0?{Fn:this.En}:{Fn:Math.max(this.En,t.Fn),Wn:t.Wn}}$n(){this.Un(),this.Ln=[{qn:0}]}Yn(e){this.Un(),this.Ln=[{qn:1,Vt:e}]}Zn(e){this.Xn(),this.Ln.push({qn:5,Vt:e})}Un(){this.Xn(),this.Ln.push({qn:6})}Kn(){this.Un(),this.Ln=[{qn:4}]}Gn(e){this.Un(),this.Ln.push({qn:2,Vt:e})}Jn(e){this.Un(),this.Ln.push({qn:3,Vt:e})}Qn(){return this.Ln}ts(e){for(const t of e.Ln)this.ns(t);this.En=Math.max(this.En,e.En),e.zn.forEach(((t,A)=>{this.Nn(A,t)}))}static ss(){return new Kt(2)}static es(){return new Kt(3)}ns(e){switch(e.qn){case 0:this.$n();break;case 1:this.Yn(e.Vt);break;case 2:this.Gn(e.Vt);break;case 3:this.Jn(e.Vt);break;case 4:this.Kn();break;case 5:this.Zn(e.Vt);break;case 6:this.Xn()}}Xn(){const e=this.Ln.findIndex((t=>t.qn===5));e!==-1&&this.Ln.splice(e,1)}}const Fl=".";function qA(i,e){if(!_A(i))return"n/a";if(!or(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?i.toString():("0000000000000000"+i.toString()).slice(-e)}class an{constructor(e,t){if(t||(t=1),_A(e)&&or(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+qA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(r=Fl+qA(0,n));return A.toFixed(0)+r}}class Ul extends an{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class of{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 Sl(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]=af(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 El=6;function Rs(i,e){return{nt:i.nt-e.nt,st:i.st-e.st}}function Ll(i,e){return{nt:i.nt/e,st:i.st/e}}function af(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=Ll(Rs(i[t],i[A]),El),{nt:n.nt+s.nt,st:n.st+s.st}),Rs(i[t],Ll(Rs(i[r],i[e]),El))]}function lf(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 Ml extends UA{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,Bi(u,o),u.lineWidth=1,Sl(e,A,l,r,n,this.bs.bind(this),lf.bind(null,c))}}function Gs(i,e,t){return Math.min(Math.max(i,e),t)}function ln(i,e,t){return e-i<=t}function Hl(i){const e=Math.ceil(i);return e%2==0?e-1:e}class $s{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=Gs(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 cf extends Ml{constructor(){super(...arguments),this.Ts=new $s}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function hf(i,e){const t=i.context;t.strokeStyle=e,t.stroke()}class Il extends UA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:r,fs:n,et:s,Nt:o,Ds:l}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,Bi(c,o),c.lineJoin="round";const u=this.Vs.bind(this);n!==void 0&&Sl(e,t,n,A,r,u,hf),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 ne=y[z];if(ne){const $=C(m,ne);$!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=$,N=$);const V=Math.round(ne.nt*U)+R,Ae=ne.st*F;E.moveTo(V,Ae),E.arc(V,Ae,M,0,2*Math.PI)}}E.fill()})(e,t,l,A,u)}}class Dl extends Il{Vs(e,t){return t.lt}}function _l(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 cr=_l.bind(null,!0),Pl=_l.bind(null,!1);function uf(i,e){return i.ot<e}function df(i,e){return e<i.ot}function kl(i,e,t){const A=e.Os(),r=e.ui(),n=cr(i,A,uf),s=Pl(i,r,df);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 Xs{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=kl(this.zs,A,this.Fs),this.Gs(e,t,r.Vt),this.Js())}}class cn extends Xs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.te(this.zs,A,lr(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 pf extends cn{constructor(e,t){super(e,t),this.js=new zs,this.re=new cf,this.he=new Dl,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 ff extends UA{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 ne=Math.max(C,Math.round(o.pe*A)-l),$=ne+m-1;$>C+F-1&&($=C+F-1,ne=$-m+1),e.fillRect(z,ne,u-z,$-ne+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)})(Se(this.zt).le,e)))}}class Nl extends Xs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,lr(this.Ls)),e.be(this.zs,A,lr(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 gf extends Nl{constructor(){super(...arguments),this.js=new ff}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 mf extends Ml{constructor(){super(...arguments),this.Ts=new $s}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 wf extends Il{constructor(){super(...arguments),this.Pe=new $s}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 Bf extends cn{constructor(e,t){super(e,t),this.js=new zs,this.Ve=new mf,this.Oe=new wf,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 yf extends UA{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)tf(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 Nl{constructor(){super(...arguments),this.js=new yf}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 vf{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Js extends Xs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new vf(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,lr(this.Ls))}Js(){this.wn.update({bars:this.zs.map(Tf),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function Tf(i){return{x:i.nt,time:i.ot,originalData:i.He,barColor:i.ce}}class xf extends UA{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 bf extends cn{constructor(){super(...arguments),this.js=new xf}se(e,t,A){return Object.assign(Object.assign({},this.ie(e,t)),A.$s(e))}Js(){const e={it:this.zs,le:this.Ns.St().le(),tt:this.Ls,Ye:this.Es.Dt().Rt(this.Es.W().base,Se(this.Es.Ct()).Vt)};this.js.J(e)}}class Qf extends cn{constructor(){super(...arguments),this.js=new Dl}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 Ff=/[2-9]/g;class hr{constructor(e=50){this.Ke=0,this.Ge=1,this.Je=1,this.Qe={},this.tr=new Map,this.ir=e}nr(){this.Ke=0,this.tr.clear(),this.Ge=1,this.Je=1,this.Qe={}}xi(e,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||Ff,n=String(t).replace(r,"0");if(this.tr.has(n))return jt(this.tr.get(n)).er;if(this.Ke===this.ir){const o=this.Qe[this.Je];delete this.Qe[this.Je],this.tr.delete(o),this.Je++,this.Ke--}e.save(),e.textBaseline="middle";const s=e.measureText(n);return e.restore(),s.width===0&&t.length||(this.tr.set(n,{er:s,rr:this.Ge}),this.Qe[this.Ge]=n,this.Ke++,this.Ge++),s}}class Uf{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 Ol{constructor(e,t,A){this.ur=e,this.ar=new hr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Uf(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 Sf extends UA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}wr(e,t){var A;if(!(!((A=this.zt)===null||A===void 0)&&A.yt))return null;const{st:r,et:n,gr:s}=this.zt;return t>=r-n-7&&t<=r+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*r);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),Bi(e,this.zt.Nt),ml(e,n,0,t.width))}}class Zs{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new Sf,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 Ef extends Zs{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 Lf extends UA{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 Mf=[{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 Kl(i,e,t,A){return(function(r,n){if(r==="transparent")return r;const s=sr(r),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(i,t+(A-t)*e)}function Vl(i,e){const t=i%2600/2600;let A;for(const l of Mf)if(t>=l.Vr&&t<=l.Or){A=l;break}ii(A!==void 0,"Last price animation internal logic error");const r=(t-A.Vr)/(A.Or-A.Vr);return{Rr:Kl(e,r,A.Ir,A.zr),Dr:Kl(e,r,A.Lr,A.Er),ht:(n=r,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class Hf{constructor(e){this.Wt=new Lf,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=Vl(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=Vl(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 ur(i,e){return Hl(Math.min(Math.max(i,12),30)*e)}function dr(i,e){switch(i){case"arrowDown":case"arrowUp":return ur(e,1);case"circle":return ur(e,.8);case"square":return ur(e,.7)}}function zl(i){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(ur(i,1))}function Wl(i){return Math.max(ur(i,.1),3)}function Rl(i,e,t){return e?i:t?Math.ceil(i/2):0}function Gl(i,e,t,A,r){const n=dr("square",t),s=(n-1)/2,o=i-s,l=e-s;return A>=o&&A<=o+n&&r>=l&&r<=l+n}function $l(i,e,t,A){const r=(dr("arrowUp",A)-1)/2*t.Jr,n=(Hl(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 If(i,e,t,A,r,n){return Gl(e,t,A,r,n)}class Df extends UA{constructor(){super(...arguments),this.zt=null,this.ar=new hr,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=_i(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(Pf(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),_f(o,e,t,A)}}}}function _f(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 $l(!1,n,s,r.Ks);case"arrowUp":return void $l(!0,n,s,r.Ks);case"circle":return void(function(o,l,c){const u=(dr("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=dr("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 Pf(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 If(0,A.nt,A.st,A.Ks,r,n);case"circle":return(function(s,o,l,c,u){const m=2+dr("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 Gl(A.nt,A.st,A.Ks,r,n)}})(i,e,t)}function kf(i,e,t,A,r,n,s,o,l){const c=_A(t)?t:t.Se,u=_A(t)?t:t.Me,m=_A(t)?t:t.xe,y=_A(e.size)?Math.max(e.size,0):1,v=zl(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 Nf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new Df,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=Wl(e),A=1.5*zl(e)+2*t,r=this.fh();this.ah={above:Rl(A,r.aboveBar,r.inBar),below:Rl(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=Wl(t.le()),c={sh:l,eh:l};this.zt.tt=kl(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&&kf(y,m,v,c,r.fontSize,l,e,t,s.Vt)}this.ft=!1}}class Of extends Zs{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 Kf extends sn{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.jt;if(!r.yt())return;const n=r.W(),s=n.lastValueVisible,o=r.bh()!=="",l=n.seriesLastValueMode===0,c=r.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,l),e.yt=e.Kt.length!==0),(o||l)&&(t.Kt=this.gh(c,s,o,l),t.yt=t.Kt.length>0);const u=r.mh(c.V),m=An(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 Xl(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 rA{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 rA(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 rA(Xl(Math.min,this.Ph(),e.Ph(),-1/0),Xl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!_A(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){_A(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new rA(e.minValue,e.maxValue)}}class hn{constructor(e,t){this.Ih=e,this.zh=t||null}Lh(){return this.Ih}Eh(){return this.zh}Bh(){return this.Ih===null?null:{priceRange:this.Ih.Bh(),margins:this.zh||void 0}}static Ah(e){return e===null?null:new hn(rA.Ah(e.priceRange),e.margins)}}class Vf extends Zs{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 zf extends sn{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const r=this.Nh.W(),n=r.axisLabelVisible,s=r.title!=="",o=this.jr;if(!n||!o.yt())return;const l=this.Nh.Fh();if(l===null)return;s&&(t.Kt=r.title,t.yt=!0),t.Ot=o.$t().Bt(l/o.Dt().At()),e.Kt=this.Wh(r.price),e.yt=!0;const c=An(r.axisLabelColor||r.color);A.t=c.t;const 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 Wf{constructor(e,t){this.jr=e,this.cn=t,this.jh=new Vf(e,this),this.ur=new zf(e,this),this.Hh=new Ol(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 Rf extends Ws{constructor(e){super(),this.$i=e}$t(){return this.$i}}const Gf={Bar:(i,e,t,A)=>{var r;const n=e.upColor,s=e.downColor,o=Se(i(t,A)),l=Di(o.Vt[0])<=Di(o.Vt[3]);return{ce:(r=o.V)!==null&&r!==void 0?r:l?n:s}},Candlestick:(i,e,t,A)=>{var r,n,s;const o=e.upColor,l=e.downColor,c=e.borderUpColor,u=e.borderDownColor,m=e.wickUpColor,y=e.wickDownColor,v=Se(i(t,A)),T=Di(v.Vt[0])<=Di(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=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}},Area:(i,e,t,A)=>{var r,n,s,o;const l=Se(i(t,A));return{ce:(r=l.lt)!==null&&r!==void 0?r:e.lineColor,lt:(n=l.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=l.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=l.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(i,e,t,A)=>{var r,n,s,o,l,c;const u=Se(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=Se(i(t,A));return{ce:(r=s.V)!==null&&r!==void 0?r:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(i,e,t,A)=>{var r;return{ce:(r=Se(i(t,A)).V)!==null&&r!==void 0?r:e.color}}};class $f{constructor(e){this.Kh=(t,A)=>A!==void 0?A.Vt:this.jr.In().Gh(t),this.jr=e,this.Jh=Gf[e.Qh()]}$s(e,t){return this.Jh(this.Kh,this.jr.W(),e,t)}}var Jl;(function(i){i[i.NearestLeft=-1]="NearestLeft",i[i.None=0]="None",i[i.NearestRight=1]="NearestRight"})(Jl||(Jl={}));const ri=30;class Xf{constructor(){this.tl=[],this.il=new Map,this.nl=new Map}sl(){return this.Ks()>0?this.tl[this.tl.length-1]:null}el(){return this.Ks()>0?this.rl(0):null}An(){return this.Ks()>0?this.rl(this.tl.length-1):null}Ks(){return this.tl.length}Ni(){return this.Ks()===0}Kr(e){return this.hl(e,0)!==null}Gh(e){return this.ll(e)}ll(e,t=0){const A=this.hl(e,t);return A===null?null:Object.assign(Object.assign({},this.al(A)),{ee:this.rl(A)})}ne(){return this.tl}ol(e,t,A){if(this.Ni())return null;let r=null;for(const n of A)r=un(r,this._l(e,t,n));return r}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,t){const A=this.ul(e);if(A===null&&t!==0)switch(t){case-1:return this.cl(e);case 1:return this.dl(e);default:throw new TypeError("Unknown search mode")}return A}cl(e){let t=this.fl(e);return t>0&&(t-=1),t!==this.tl.length&&this.rl(t)<e?t:null}dl(e){const t=this.vl(e);return t!==this.tl.length&&e<this.rl(t)?t:null}ul(e){const t=this.fl(e);return t===this.tl.length||e<this.tl[t].ee?null:t}fl(e){return cr(this.tl,e,((t,A)=>t.ee<A))}vl(e){return Pl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let r=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(r===null?r={ml:s,bl:s}:(s<r.ml&&(r.ml=s),s>r.bl&&(r.bl=s)))}return r}_l(e,t,A){if(this.Ni())return null;let r=null;const n=Se(this.el()),s=Se(this.An()),o=Math.max(e,n),l=Math.min(t,s),c=Math.ceil(o/ri)*ri,u=Math.max(c,Math.floor(l/ri)*ri);{const y=this.fl(o),v=this.vl(Math.min(l,c,t));r=un(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+=ri){const v=Math.floor(y/ri);let T=m.get(v);if(T===void 0){const C=this.fl(v*ri),U=this.vl((v+1)*ri-1);T=this.pl(C,U,A),m.set(v,T)}r=un(r,T)}{const y=this.fl(u),v=this.vl(l);r=un(r,this.pl(y,v,A))}return r}}function un(i,e){return i===null?e:e===null?i:{ml:Math.min(i.ml,e.ml),bl:Math.max(i.bl,e.bl)}}class Jf{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 Ys{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 Jf(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 Zl(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 Zf{constructor(e,t){this.Wt=new bl,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Zl(this.kl))),this.Wt}}class Yf extends sn{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const r=Zl(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 qf{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 Ys(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 Zf(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 Yf(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 Ys(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 Ys(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 qs(i,e,t,A){i.forEach((r=>{e(r).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function js(i){return i.Pn()}function jf(i){return i.Bl()}function e0(i){return i.Al()}class eo extends Rf{constructor(e,t,A,r,n){super(e),this.zt=new Xf,this.jh=new Of(this),this.zl=[],this.Ll=new Ef(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 Kf(this);this.rn=[s],this.Hh=new Ol(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new Hf(this)),this.Ul(),this.ql(n)}S(){this.jl!==null&&clearTimeout(this.jl)}mh(e){return this.cn.priceLineColor||e}Zr(e){const 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),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 Wf(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=[];qs(this.Hl,js,"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),qs(this.Hl,js,"normal",e),e}ua(){return this.ca(js,"bottom")}da(e){return this.ca(jf,e)}fa(e){return this.ca(e0,e)}va(e,t){return this.Hl.map((A=>A.wr(e,t))).filter((A=>A!==null))}Ji(e){return[this.Hh,...this.zl.map((t=>t.Yh()))]}Rn(e,t){if(t!==this.Yi&&!this._a())return[];const A=[...this.rn];for(const r of this.zl)A.push(r.Zh());return this.Hl.forEach((r=>{A.push(...r.Rn())})),A}Qi(){const e=[];return this.Hl.forEach((t=>{e.push(...t.Qi())})),e}Il(e,t){if(this.cn.autoscaleInfoProvider!==void 0){const A=this.cn.autoscaleInfoProvider((()=>{const r=this.pa(e,t);return r===null?null:r.Bh()}));return hn.Ah(A)}return this.pa(e,t)}ma(){return this.cn.priceFormat.minMove}ba(){return this.wa}Vn(){var e;this.wn.bt(),this.dn.bt();for(const t of this.rn)t.bt();for(const t of this.zl)t.bt();this.jh.bt(),this.Ll.bt(),(e=this.El)===null||e===void 0||e.bt(),this.Hl.forEach((t=>t.Vn()))}Dt(){return Se(super.Dt())}kt(e){if(!((this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline")&&this.cn.crosshairMarkerVisible))return null;const t=this.zt.Gh(e);return t===null?null:{_t:t.Vt[3],ht:this.ga(),Ot:this.Ma(),Pt:this.xa(),Tt:this.Sa(e)}}bh(){return this.cn.title}yt(){return this.cn.visible}ka(e){this.Hl.push(new qf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Js)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Js)return e=>this.wn.je(e)}_a(){return!on(this.Dt().Pa())}pa(e,t){if(!or(e)||!or(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 rA(r.ml,r.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,l=new rA(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 rA(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 hn(n,s)}ga(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerRadius}return 0}Ma(){switch(this.$l){case"Line":case"Area":case"Baseline":{const e=this.cn.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}xa(){switch(this.$l){case"Line":case"Area":case"Baseline":return this.cn.crosshairMarkerBorderWidth}return 0}Sa(e){switch(this.$l){case"Line":case"Area":case"Baseline":{const t=this.cn.crosshairMarkerBackgroundColor;if(t.length!==0)return t}}return this.Us().$s(e).ce}Ul(){switch(this.cn.priceFormat.type){case"custom":this.wa={format:this.cn.priceFormat.formatter};break;case"volume":this.wa=new of(this.cn.priceFormat.precision);break;case"percent":this.wa=new Ul(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new an(e,this.cn.priceFormat.minMove*e)}}this.Yi!==null&&this.Yi.Ra()}Ql(){const e=this.$t().St();if(!e.Da()||this.zt.Ni())return void(this.Wl=[]);const t=Se(this.zt.el());this.Wl=this.Fl.map(((A,r)=>{const n=Se(e.Va(A.time,!0)),s=n<t?1:-1;return{time:Se(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:r,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new Nf(this,this.$t()),this.$l){case"Bar":this.wn=new gf(this,this.$t());break;case"Candlestick":this.wn=new Cf(this,this.$t());break;case"Line":this.wn=new Qf(this,this.$t());break;case"Custom":this.wn=new Js(this,this.$t(),jt(e));break;case"Area":this.wn=new pf(this,this.$t());break;case"Baseline":this.wn=new Bf(this,this.$t());break;case"Histogram":this.wn=new bf(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return qs(this.Hl,e,t,A),A}}class t0{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 eo)).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=Di(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 A0 extends UA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(this.zt===null)return;const n=Math.max(1,Math.floor(A));e.lineWidth=n,(function(s,o){s.save(),s.lineWidth%2&&s.translate(.5,.5),o(),s.restore()})(e,(()=>{const s=Se(this.zt);if(s.Aa){e.strokeStyle=s.Ia,Bi(e,s.za),e.beginPath();for(const o of s.La){const l=Math.round(o.Ea*A);e.moveTo(l,-n),e.lineTo(l,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,Bi(e,s.Wa),e.beginPath();for(const o of s.ja){const l=Math.round(o.Ea*r);e.moveTo(-n,l),e.lineTo(t.width+n,l)}e.stroke()}}))}}class i0{constructor(e){this.Wt=new A0,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 r0{constructor(e){this.wn=new i0(e)}qh(){return this.wn}}const to={$a:4,Ua:1e-4};function Pi(i,e){const t=100*(i-e)/e;return e<0?-t:t}function n0(i,e){const t=Pi(i.Ph(),e),A=Pi(i.Rh(),e);return new rA(t,A)}function pr(i,e){const t=100*(i-e)/e+100;return e<0?-t:t}function s0(i,e){const t=pr(i.Ph(),e),A=pr(i.Rh(),e);return new rA(t,A)}function dn(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 fr(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 gr(i,e){if(i===null)return null;const t=dn(i.Ph(),e),A=dn(i.Rh(),e);return new rA(t,A)}function pn(i,e){if(i===null)return null;const t=fr(i.Ph(),e),A=fr(i.Rh(),e);return new rA(t,A)}function Ao(i){if(i===null)return to;const e=Math.abs(i.Rh()-i.Ph());if(e>=1||e<1e-15)return to;const t=Math.ceil(Math.abs(Math.log10(e))),A=to.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class io{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=ln(n,r,1e-14)&&n>r+1e-14,y=ln(n,A*o,1e-14),v=ln(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];ln(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 Yl{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 io(this.qa,[2,2.5,2]),s=new io(this.qa,[2,2,2.5]),o=new io(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 ql(i){return i.slice().sort(((e,t)=>Se(e.Xi())-Se(t.Xi())))}var jl;(function(i){i[i.Normal=0]="Normal",i[i.Logarithmic=1]="Logarithmic",i[i.Percentage=2]="Percentage",i[i.IndexedTo100=3]="IndexedTo100"})(jl||(jl={}));const ec=new Ul,tc=new an(100,1);class o0{constructor(e,t,A,r){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new Mt,this.vo=new Mt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=tc,this.xo=Ao(null),this.So=e,this.cn=t,this.ko=A,this.yo=r,this.Co=new Yl(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=jt(e.scaleMargins.top),A=jt(e.scaleMargins.bottom);if(t<0||t>1)throw new Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(A<0||A>1)throw new Error(`Invalid bottom margin - expect value between 0 and 1, given=${A}`);if(t+A>1)throw new Error(`Invalid margins - sum of margins must be less than 1, given=${t+A}`);this.Do(),this.bo=null}}Vo(){return this.cn.autoScale}ro(){return this.cn.mode===1}Mh(){return this.cn.mode===2}Oo(){return this.cn.mode===3}Cr(){return{Wn:this.cn.autoScale,Bo:this.cn.invertScale,Cr:this.cn.mode}}Ro(e){const t=this.Cr();let A=null;e.Wn!==void 0&&(this.cn.autoScale=e.Wn),e.Cr!==void 0&&(this.cn.mode=e.Cr,e.Cr!==2&&e.Cr!==3||(this.cn.autoScale=!0),this.oo._o=!1),t.Cr===1&&e.Cr!==t.Cr&&((function(n,s){if(n===null)return!1;const o=fr(n.Ph(),s),l=fr(n.Rh(),s);return isFinite(o)&&isFinite(l)})(this.Ih,this.xo)?(A=pn(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=gr(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=Pi(e,t):this.Oo()&&(e=pr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const r=this.Fo(),n=Se(this.Lh()),s=n.Ph(),o=n.Rh(),l=this.Eo()-1,c=this.Bo(),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=Se(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=ql(e),this.mo=e,this.mo}qo(e){this.po.indexOf(e)===-1&&(this.po.push(e),this.Ra(),this.Yo())}Zo(e){const t=this.po.indexOf(e);if(t===-1)throw new Error("source is not attached to scale");this.po.splice(t,1),this.po.length===0&&(this.Ro({Wn:!0}),this.Ao(null)),this.Ra(),this.Yo()}Ct(){let e=null;for(const t of this.po){const A=t.Ct();A!==null&&(e===null||A.la<e.la)&&(e=A)}return e===null?null:e.Vt}Bo(){return this.cn.invertScale}Ha(){const e=this.Ct()===null;if(this.bo!==null&&(e||this.bo.Xo===e))return this.bo.Ha;this.Co.io();const t=this.Co.Ha();return this.bo={Ha:t,Xo:e},this.fo.m(),t}Ko(){return this.fo}Go(e){this.Mh()||this.Oo()||this.wo===null&&this.ao===null&&(this.Ni()||(this.wo=this.ho-e,this.ao=Se(this.Lh()).Th()))}Jo(e){if(this.Mh()||this.Oo()||this.wo===null)return;this.Ro({Wn:!1}),(e=this.ho-e)<0&&(e=0);let t=(this.wo+.2*(this.ho-1))/(e+.2*(this.ho-1));const A=Se(this.ao).Th();t=Math.max(t,.1),A.Vh(t),this.Ao(A)}Qo(){this.Mh()||this.Oo()||(this.wo=null,this.ao=null)}t_(e){this.Vo()||this.Mo===null&&this.ao===null&&(this.Ni()||(this.Mo=e,this.ao=Se(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=Se(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const r=A*t,n=Se(this.ao).Th();n.Oh(r),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(Pi(e,t));case 3:return this.ba().format(pr(e,t));default:return this.Wh(e)}}eo(e){switch(this.cn.mode){case 2:return this.s_(e);case 3:return this.ba().format(e);default:return this.Wh(e)}}Yl(e){return this.Wh(e,Se(this.e_()).ba())}Zl(e,t){return e=Pi(e,t),this.s_(e,ec)}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=tc,this.Mh()?(this.wa=ec,t=100):this.Oo()?(this.wa=new an(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new Yl(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?dn(e,this.xo):e;const A=Se(this.Lh()),r=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(r)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),r=Se(this.Lh()),n=r.Ph()+r.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?fr(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=gr(m,this.xo);break;case 2:m=n0(m,c.Vt);break;case 3:m=s0(m,c.Vt)}if(t=t===null?m:t.ts(Se(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=pn(t,this.xo)),t=new rA(t.Ph()-c,t.Rh()+c),this.ro()&&(t=gr(t,this.xo))}if(this.ro()){const l=pn(t,this.xo),c=Ao(l);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const u=this.ao!==null?pn(this.ao,this.xo):null;this.xo=c,t=gr(l,c),u!==null&&(this.ao=gr(u,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new rA(-.5,.5)),this.xo=Ao(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?Pi:this.Oo()?pr:this.ro()?e=>dn(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 a0{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new Mt,this.yl=e,this.$i=t,this.d_=new r0(this);const A=t.W();this.f_=this.v_("left",A.leftPriceScale),this.p_=this.v_("right",A.rightPriceScale),this.f_.zo().l(this.m_.bind(this,this.f_),this),this.p_.zo().l(this.m_.bind(this,this.p_),this),this.b_(A)}b_(e){if(e.leftPriceScale&&this.f_.$h(e.leftPriceScale),e.rightPriceScale&&this.p_.$h(e.rightPriceScale),e.localization&&(this.f_.Ra(),this.p_.Ra()),e.overlayPriceScales){const t=Array.from(this.o_.values());for(const A of t){const r=Se(A[0].Dt());r.$h(e.overlayPriceScales),e.localization&&r.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?jt(this.o_.get(e))[0].Dt():null}S(){this.$t().g_().p(this),this.f_.zo().p(this),this.p_.zo().p(this),this.po.forEach((e=>{e.S&&e.S()})),this.c_.m()}M_(){return this.u_}x_(e){this.u_=e}$t(){return this.$i}Hi(){return this.__}At(){return this.ho}S_(e){this.__=e,this.k_()}Lo(e){this.ho=e,this.f_.Lo(e),this.p_.Lo(e),this.po.forEach((t=>{if(this.vr(t)){const A=t.Dt();A!==null&&A.Lo(e)}})),this.k_()}Ba(){return this.po}vr(e){const t=e.Dt();return t===null||this.f_!==t&&this.p_!==t}qo(e,t,A){const r=A!==void 0?A:this.C_().y_+1;this.T_(e,t,r)}Zo(e){const t=this.po.indexOf(e);ii(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=Se(e.Dt()).Pa();if(this.o_.has(A)){const n=jt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const r=e.Dt();r&&r.Ba().indexOf(e)>=0&&r.Zo(e),r!==null&&(r.Yo(),this.P_(r)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,t){e.Go(t)}O_(e,t){e.Jo(t),this.k_()}B_(e){e.Qo()}A_(e,t){e.t_(t)}I_(e,t){e.i_(t),this.k_()}z_(e){e.n_()}k_(){this.po.forEach((e=>{e.Vn()}))}vn(){let e=null;return this.$i.W().rightPriceScale.visible&&this.p_.Ba().length!==0?e=this.p_:this.$i.W().leftPriceScale.visible&&this.f_.Ba().length!==0?e=this.f_:this.po.length!==0&&(e=this.po[0].Dt()),e===null&&(e=this.p_),e}pr(){let e=null;return this.$i.W().rightPriceScale.visible?e=this.p_:this.$i.W().leftPriceScale.visible&&(e=this.f_),e}P_(e){e!==null&&e.Vo()&&this.L_(e)}E_(e){const t=this.yl.Xs();e.Ro({Wn:!0}),t!==null&&e.h_(t),this.k_()}N_(){this.L_(this.f_),this.L_(this.p_)}F_(){this.P_(this.f_),this.P_(this.p_),this.po.forEach((e=>{this.vr(e)&&this.P_(e.Dt())})),this.k_(),this.$i.Uh()}Uo(){return this.mo===null&&(this.mo=ql(this.po)),this.mo}W_(){return this.c_}j_(){return this.d_}L_(e){const t=e.r_();if(t&&t.length>0&&!this.yl.Ni()){const A=this.yl.Xs();A!==null&&e.h_(A)}e.Vn()}C_(){const e=this.Uo();if(e.length===0)return{H_:0,y_:0};let t=0,A=0;for(let r=0;r<e.length;r++){const n=e[r].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let r=this.w_(t);if(r===null&&(r=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!on(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}r.qo(e),e.Gi(r),e.Ki(A),this.P_(r),this.mo=null}m_(e,t,A){t.Cr!==A.Cr&&this.L_(e)}v_(e,t){const A=Object.assign({visible:!0,autoScale:!0},YA(t)),r=new o0(e,A,this.$i.W().layout,this.$i.W().localization);return r.Lo(this.At()),r}}class l0{constructor(e,t,A=50){this.Ke=0,this.Ge=1,this.Je=1,this.tr=new Map,this.Qe=new Map,this.U_=e,this.q_=t,this.ir=A}Y_(e){const t=e.time,A=this.q_.cacheKey(t),r=this.tr.get(A);if(r!==void 0)return r.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(jt(s)),this.Je++,this.Ke--}const n=this.U_(e);return this.tr.set(A,{Z_:n,rr:this.Ge}),this.Qe.set(this.Ge,A),this.Ke++,this.Ge++,n}}class mr{constructor(e,t){ii(e<=t,"right should be >= left"),this.X_=e,this.K_=t}Os(){return this.X_}ui(){return this.K_}G_(){return this.K_-this.X_+1}Kr(e){return this.X_<=e&&e<=this.K_}Ch(e){return this.X_===e.Os()&&this.K_===e.ui()}}function Ac(i,e){return i===null||e===null?i===e:i.Ch(e)}class c0{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(cr(A,e,(n=>n.index<e)),1/0)}));for(const A of t)this.J_.delete(A)}ru(e){let t=[];for(const A of Array.from(this.J_.keys()).sort(((r,n)=>n-r))){if(!this.J_.get(A))continue;const r=t;t=[];const n=r.length;let s=0;const o=jt(this.J_.get(A)),l=o.length;let c=1/0,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 ki{constructor(e){this.hu=e}lu(){return this.hu===null?null:new mr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new ki(null)}}function h0(i,e){return i.weight>e.weight?i:e}class u0{constructor(e,t,A,r){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new c0,this.du=new Map,this.fu=ki.ou(),this.vu=!0,this.pu=new Mt,this.mu=new Mt,this.bu=new Mt,this.wu=null,this.gu=null,this.Mu=[],this.cn=t,this.yo=A,this.xu=t.rightOffset,this.Su=t.barSpacing,this.$i=e,this.q_=r,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){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=cr(this.uu,this.q_.key(e),((r,n)=>this.q_.key(r.time)<n));return this.q_.key(e)<this.q_.key(this.uu[A].time)?t?A:null:A}Ni(){return this.__===0||this.uu.length===0||this._u===null}Da(){return this.uu.length>0}Xs(){return this.Ru(),this.fu.lu()}Du(){return this.Ru(),this.fu.au()}Vu(){const e=this.Xs();if(e===null)return null;const t={from:e.Os(),to:e.ui()};return this.Ou(t)}Ou(e){const t=Math.round(e.from),A=Math.round(e.to),r=Se(this.Bu()),n=Se(this.Au());return{from:Se(this.Ui(Math.max(r,t))),to:Se(this.Ui(Math.min(n,A)))}}Iu(e){return{from:Se(this.Va(e.from,!0)),to:Se(this.Va(e.to,!0))}}Hi(){return this.__}S_(e){if(!isFinite(e)||e<=0||this.__===e)return;const t=this.Du(),A=this.__;if(this.__=e,this.vu=!0,this.cn.lockVisibleTimeRangeOnResize&&A!==0){const r=this.Su*e/A;this.Su=r}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const r=A-e;this.xu-=Math.round(r/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!or(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),r=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=r;s<n;s++){const o=e[s].ot,l=A+this.xu-o,c=this.__-(l+.5)*this.Su-1;e[s].nt=c}}Nu(e){return Math.ceil(this.Fu(e))}Jn(e){this.vu=!0,this.xu=e,this.Lu(),this.$i.Wu(),this.$i.Uh()}le(){return this.Su}Gn(e){this.ju(e),this.Lu(),this.$i.Wu(),this.$i.Uh()}Hu(){return this.xu}Ha(){if(this.Ni())return null;if(this.gu!==null)return this.gu;const e=this.Su,t=5*(this.$i.W().layout.fontSize+4)/8*(this.cn.tickMarkMaxCharacterLength||8),A=Math.round(t/e),r=Se(this.Xs()),n=Math.max(r.Os(),r.Os()-A),s=Math.max(r.ui(),r.ui()-A),o=this.cu.su(e,t),l=this.Bu()+A,c=this.Au()-A,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=Gs(this.__-e,0,this.__),A=Gs(this.__-Se(this.wo),0,this.__);t!==0&&A!==0&&this.Gn(this.wu.le*t/A)}Qo(){this.wo!==null&&(this.wo=null,this.Ku())}t_(e){this.Mo===null&&this.wu===null&&(this.Ni()||(this.Mo=e,this.Xu()))}i_(e){if(this.Mo===null)return;const t=(this.Mo-e)/this.le();this.xu=Se(this.wu).Hu+t,this.vu=!0,this.Lu()}n_(){this.Mo!==null&&(this.Mo=null,this.Ku())}Gu(){this.Ju(this.cn.rightOffset)}Ju(e,t=400){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");if(!isFinite(t)||t<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const A=this.xu,r=performance.now();this.$i.Zn({Qu:n=>(n-r)/t>=1,tc:n=>{const s=(n-r)/t;return s>=1?e:A+(e-A)*s}})}bt(e,t){this.vu=!0,this.uu=e,this.cu.iu(e,t),this.Lu()}nc(){return this.pu}sc(){return this.mu}ec(){return this.bu}Eu(){return this._u||0}rc(e){const t=e.G_();this.ju(this.__/t),this.xu=e.ui()-this.Eu(),this.Lu(),this.vu=!0,this.$i.Wu(),this.$i.Uh()}hc(){const e=this.Bu(),t=this.Au();e!==null&&t!==null&&this.rc(new mr(e,t+this.cn.rightOffset))}lc(e){const t=new mr(e.from,e.to);this.rc(t)}qi(e){return this.yo.timeFormatter!==void 0?this.yo.timeFormatter(e.originalTime):this.q_.formatHorzItem(e.time)}$u(){const{handleScroll:e,handleScale:t}=this.$i.W();return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}Bu(){return this.uu.length===0?null:0}Au(){return this.uu.length===0?null:this.uu.length-1}ac(e){return(this.__-1-e)/this.Su}Fu(e){const t=this.ac(e),A=this.Eu()+this.xu-t;return Math.round(1e6*A)/1e6}ju(e){const t=this.Su;this.Su=e,this.zu(),t!==this.Su&&(this.vu=!0,this.oc())}Ru(){if(!this.vu)return;if(this.vu=!1,this.Ni())return void this._c(ki.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,r=new mr(A-t+1,A);this._c(new ki(r))}zu(){const e=this.uc();if(this.Su<e&&(this.Su=e,this.vu=!0),this.__!==0){const t=.5*this.__;this.Su>t&&(this.Su=t,this.vu=!0)}}uc(){return this.cn.fixLeftEdge&&this.cn.fixRightEdge&&this.uu.length!==0?this.__/this.uu.length:this.cn.minBarSpacing}Lu(){const e=this.cc();e!==null&&this.xu<e&&(this.xu=e,this.vu=!0);const t=this.dc();this.xu>t&&(this.xu=t,this.vu=!0)}cc(){const e=this.Bu(),t=this._u;return e===null||t===null?null:e-t-1+(this.cn.fixLeftEdge?this.__/this.Su:Math.min(2,this.uu.length))}dc(){return this.cn.fixRightEdge?0:this.__/this.Su-Math.min(2,this.uu.length)}Xu(){this.wu={le:this.le(),Hu:this.Hu()}}Ku(){this.wu=null}Uu(e){let t=this.du.get(e.weight);return t===void 0&&(t=new l0((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,Ac(t.lu(),this.fu.lu())||this.pu.m(),Ac(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 d0{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 p0 extends d0{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 f0{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new p0(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:_i(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class g0 extends Ws{constructor(e,t){super(),this.cn=t,this.wn=new f0(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var ic,rc,nc,sc,oc;(function(i){i[i.OnTouchEnd=0]="OnTouchEnd",i[i.OnNextTap=1]="OnNextTap"})(ic||(ic={}));class m0{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new Mt,this.Rc=new Mt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Xp(this),this.yl=new u0(this,t.timeScale,this.cn.localization,A),this.vt=new sf(this,t.crosshair),this.Bc=new t0(t.crosshair),this.Ac=new g0(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(Kt.es())}Uh(){this.Nc(Kt.ss())}oa(){this.Nc(new Kt(1))}Gl(e){const t=this.Fc(e);this.Nc(t)}Wc(){return this.Tc}jc(e){const t=this.Tc;this.Tc=e,t!==null&&this.Gl(t.Hc),e!==null&&this.Gl(e.Hc)}W(){return this.cn}$h(e){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 a0(this.yl,this);e!==void 0?this.yc.splice(e,0,t):this.yc.push(t);const A=e===void 0?this.yc.length-1:e,r=Kt.es();return r.Nn(A,{Fn:0,Wn:!0}),this.Nc(r),t}V_(e,t,A){e.V_(t,A)}O_(e,t,A){e.O_(t,A),this.Jl(),this.Nc(this.Gc(e,2))}B_(e,t){e.B_(t),this.Nc(this.Gc(e,2))}A_(e,t,A){t.Vo()||e.A_(t,A)}I_(e,t,A){t.Vo()||(e.I_(t,A),this.Jl(),this.Nc(this.Gc(e,2)))}z_(e,t){t.Vo()||(e.z_(t),this.Nc(this.Gc(e,2)))}E_(e,t){e.E_(t),this.Nc(this.Gc(e,2))}Jc(e){this.yl.Go(e)}Qc(e,t){const A=this.St();if(A.Ni()||t===0)return;const r=A.Hi();e=Math.max(1,Math.min(e,r)),A.Zu(e,t),this.Wu()}td(e){this.nd(0),this.sd(e),this.ed()}rd(e){this.yl.Jo(e),this.Wu()}hd(){this.yl.Qo(),this.Uh()}nd(e){this.yl.t_(e)}sd(e){this.yl.i_(e),this.Wu()}ed(){this.yl.n_(),this.Uh()}wt(){return this.Cc}ld(e,t,A,r,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const l=this.yl.Xs();l!==null&&(o=Math.min(Math.max(l.Os(),o),l.ui()));const c=r.vn(),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,Se(n)),o=this.yl.Va(t,!0),l=this.yl.It(Se(o));this.ld(l,s,null,A,!0)}od(e){this.Zc().Cn(),this.oa(),e||this.Rc.m(null,null,null)}Jl(){const e=this.vt.Ht();if(e!==null){const t=this.vt.xn(),A=this.vt.Sn();this.ld(t,A,null,e)}this.vt.Vn()}_d(e,t,A){const r=this.yl.mn(0);t!==void 0&&A!==void 0&&this.yl.bt(t,A);const n=this.yl.mn(0),s=this.yl.Eu(),o=this.yl.Xs();if(o!==null&&r!==null&&n!==null){const l=o.Kr(s),c=this.q_.key(r)>this.q_.key(n),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);ii(A!==-1,"Series not found"),this.Cc.splice(A,1),Se(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=Se(this.dr(e));A.Zo(e);const r=this.Uc(t);if(r===null){const n=e.Xi();A.qo(e,t,n)}else{const n=r.Ht===A?e.Xi():void 0;r.Ht.qo(e,t,n)}}hc(){const e=Kt.ss();e.$n(),this.Nc(e)}pd(e){const t=Kt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=Kt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=Kt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=Kt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=Kt.ss();t.Zn(e),this.Nc(t)}Un(){const e=Kt.ss();e.Un(),this.Nc(e)}md(){return this.cn.rightPriceScale.visible?"right":"left"}bd(){return this.Ec}q(){return this.zc}Bt(e){const t=this.Ec,A=this.zc;if(t===A)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Dc===null||this.Dc.Ps!==A||this.Dc.Rs!==t)this.Dc={Ps:A,Rs:t,wd:new Map};else{const n=this.Dc.wd.get(e);if(n!==void 0)return n}const r=(function(n,s,o){const[l,c,u,m]=sr(n),[y,v,T,C]=sr(s),U=[wA(l+o*(y-l)),wA(c+o*(v-c)),wA(u+o*(T-u)),Bl(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 Kt(t);if(e!==null){const r=this.yc.indexOf(e);A.Nn(r,{Fn:t})}return A}Fc(e,t){return t===void 0&&(t=2),this.Gc(this.dr(e),t)}Nc(e){this.Vc&&this.Vc(e),this.yc.forEach((t=>t.j_().qh().bt()))}fd(e,t,A,r){const n=new eo(this,e,t,A,r),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),on(s)||n.$h(e),n}Lc(e){const t=this.cn.layout;return t.background.type==="gradient"?e===0?t.background.topColor:t.background.bottomColor:t.background.color}}function ro(i){return!_A(i)&&!ar(i)}function ac(i){return _A(i)}(function(i){i[i.Disabled=0]="Disabled",i[i.Continuous=1]="Continuous",i[i.OnDataUpdate=2]="OnDataUpdate"})(rc||(rc={})),(function(i){i[i.LastBar=0]="LastBar",i[i.LastVisible=1]="LastVisible"})(nc||(nc={})),(function(i){i.Solid="solid",i.VerticalGradient="gradient"})(sc||(sc={})),(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"})(oc||(oc={}));const lc=i=>i.getUTCFullYear();function w0(i,e,t){return e.replace(/yyyy/g,(A=>qA(lc(A),4))(i)).replace(/yy/g,(A=>qA(lc(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=>qA((r=>r.getUTCMonth()+1)(A),2))(i)).replace(/dd/g,(A=>qA((r=>r.getUTCDate())(A),2))(i))}class cc{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return w0(e,this.gd,this.Md)}}class B0{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",qA(e.getUTCHours(),2)).replace("%m",qA(e.getUTCMinutes(),2)).replace("%s",qA(e.getUTCSeconds(),2))}}const y0={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class C0{constructor(e={}){const t=Object.assign(Object.assign({},y0),e);this.Td=new cc(t.Sd,t.Cd),this.Pd=new B0(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function fn(i){return 60*i*60*1e3}function no(i){return 60*i*1e3}const gn=[{Dd:(hc=1,1e3*hc),Vd:10},{Dd:no(1),Vd:20},{Dd:no(5),Vd:21},{Dd:no(30),Vd:22},{Dd:fn(1),Vd:30},{Dd:fn(3),Vd:31},{Dd:fn(6),Vd:32},{Dd:fn(12),Vd:33}];var hc;function uc(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=gn.length-1;t>=0;--t)if(Math.floor(e.getTime()/gn[t].Dd)!==Math.floor(i.getTime()/gn[t].Dd))return gn[t].Vd;return 0}function so(i){let e=i;if(ar(i)&&(e=oo(i)),!ro(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 dc(i){if(!ac(i))throw new Error("time must be of type isUTCTimestamp");return{Od:i}}function oo(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 pc(i){ar(i.time)&&(i.time=oo(i.time))}class fc{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(pc)})(e):pc(e)}createConverterToInternalObj(e){return Se((function(t){return t.length===0?null:ro(t[0].time)||ar(t[0].time)?so:dc})(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 ac(t=e)?dc(t):ro(t)?so(t):so(oo(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 cc(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(h0,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=uc(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=uc(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return FA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const Ni=typeof window<"u";function gc(){return!!Ni&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function ao(){return!!Ni&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function lo(i){return i+i%2}function co(i,e){return i.zd-e.zd}function ho(i,e,t){const A=(i.zd-e.zd)/(i.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class v0{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=ho(this.Ld,this.Ed,this.Ud),n=co(this.Ld,this.Ed),s=[r],o=[n];if(A+=n,this.Nd!==null){const c=ho(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(r)){const u=co(this.Ed,this.Nd);if(s.push(c),o.push(u),A+=u,this.Fd!==null){const m=ho(this.Nd,this.Fd,this.Ud);if(Math.sign(m)===Math.sign(r)){const y=co(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=Se(this.Wd),A=e-t.ot;return t.zd+this.Hd*(Math.pow(this.qd,A)-1)/Math.log(this.qd)}Qu(e){return this.Wd===null||this.Zd(e)===this.jd}Zd(e){const t=e-Se(this.Wd).ot;return Math.min(t,this.jd)}}class T0{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 yl(sr(this.Qd.W().layout.textColor))>160?"dark":"light"}sf(){return this.Qd.W().layout.attributionLogo}rf(){const e=new URL(location.href);return e.hostname?"&utm_source="+e.hostname+e.pathname:""}tf(){this.nf()&&(this.if(),this.en=this.sf(),this.en&&(this.Gd=this.ef(),this.Kd=document.createElement("style"),this.Kd.innerText="a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}",this.Xd=document.createElement("a"),this.Xd.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.rf()}`,this.Xd.title="Charting by TradingView",this.Xd.id="tv-attr-logo",this.Xd.target="_blank",this.Xd.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35 19" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>',this.Xd.toggleAttribute("data-dark",this.Gd==="dark"),this.Jd.appendChild(this.Kd),this.Jd.appendChild(this.Xd)))}}function yi(i,e){const t=Se(i.ownerDocument).createElement("canvas");i.appendChild(t);const A=Hp(t,{options:{allowResizeObserver:!1},transform:(r,n)=>({width:Math.max(r.width,n.width),height:Math.max(r.height,n.height)})});return A.resizeCanvasElement(e),A}function Ci(i){var e;i.width=1,i.height=1,(e=i.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function uo(i,e,t,A){i.gl&&i.gl(e,t,A)}function mn(i,e,t,A){i.X(e,t,A)}function po(i,e,t,A){const r=i(t,A);for(const n of r){const s=n.gt();s!==null&&e(s)}}function x0(i){Ni&&window.chrome!==void 0&&i.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class fo{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=!ao(),this.Af=r=>{this.If(r)},this.zf=r=>{if(this.Lf(r)){const n=this.Ef(r);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(PA(r),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(r);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(PA(r),this.af);s<5&&!this.bf&&this.Uf(n,this.Hf.qf),this.Yf()}}},this.Zf=e,this.Hf=t,this.cn=A,this.Xf()}S(){this.gf!==null&&(this.gf(),this.gf=null),this.Mf!==null&&(this.Mf(),this.Mf=null),this.Sf!==null&&(this.Sf(),this.Sf=null),this.kf!==null&&(this.kf(),this.kf=null),this.yf!==null&&(this.yf(),this.yf=null),this.xf!==null&&(this.xf(),this.xf=null),this.Kf(),this.Yf()}Gf(e){this.Sf&&this.Sf();const t=this.Jf.bind(this);if(this.Sf=()=>{this.Zf.removeEventListener("mousemove",t)},this.Zf.addEventListener("mousemove",t),this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.Qf),this.Bf=!0}Yf(){this.lf!==null&&clearTimeout(this.lf),this.hf=0,this.lf=null,this.af={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}$f(){this.uf!==null&&clearTimeout(this.uf),this._f=0,this.uf=null,this.cf={nt:Number.NEGATIVE_INFINITY,st:Number.POSITIVE_INFINITY}}Jf(e){if(this.Df||this.pf!==null||this.Lf(e))return;const t=this.Ef(e);this.Uf(t,this.Hf.tv),this.Bf=!0}iv(e){const t=go(e.changedTouches,Se(this.Of));if(t===null||(this.Vf=wn(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(PA(t),Se(this.pf)),{nv:r,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*r,l=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();l||c||(this.Rf=!0),this.mf=!0,this.wf=!0,this.Kf(),this.$f()}if(!this.Rf){const o=this.Ef(e,t);this.Wf(o,this.Hf.hv),Oi(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(PA(e),Se(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const r=this.Ef(e);this.Uf(r,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),r=Math.abs(t.st-e.st);return{nv:A,sv:r,Nf:A+r}}ov(e){let t=go(e.changedTouches,Se(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=wn(e),this.Kf(),this.pf=null,this.yf&&(this.yf(),this.yf=null);const A=this.Ef(e,t);if(this.Wf(A,this.Hf._v),++this._f,this.uf&&this._f>1){const{Nf:r}=this.Ff(PA(t),this.cf);r<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&Oi(e));this._f===0&&Oi(e),e.touches.length===0&&this.ff&&(this.ff=!1,Oi(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),gc()&&this.Zf.ownerDocument.documentElement.removeEventListener("mouseleave",this.Af),!this.Lf(e))if(this.Uf(t,this.Hf.cv),++this.hf,this.lf&&this.hf>1){const{Nf:A}=this.Ff(PA(e),this.af);A<5&&!this.bf&&this.Uf(t,this.Hf.qf),this.Yf()}else this.bf||this.Uf(t,this.Hf.dv)}Kf(){this.df!==null&&(clearTimeout(this.df),this.df=null)}fv(e){if(this.Of!==null)return;const t=e.changedTouches[0];this.Of=t.identifier,this.Vf=wn(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=PA(t),this.yf&&(this.yf(),this.yf=null);{const n=this.iv.bind(this),s=this.ov.bind(this);this.yf=()=>{A.removeEventListener("touchmove",n),A.removeEventListener("touchend",s)},A.addEventListener("touchmove",n,{passive:!1}),A.addEventListener("touchend",s,{passive:!1}),this.Kf(),this.df=setTimeout(this.vv.bind(this,e),240)}const r=this.Ef(e,t);this.Wf(r,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=PA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;gc()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=PA(e),this.kf&&(this.kf(),this.kf=null);{const r=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",r),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",r),t.addEventListener("mouseup",n)}if(this.Df=!0,this.Lf(e))return;const A=this.Ef(e);this.Uf(A,this.Hf.bv),this.lf||(this.hf=0,this.lf=setTimeout(this.Yf.bind(this),500),this.af=PA(e))}Xf(){this.Zf.addEventListener("mouseenter",this.Gf.bind(this)),this.Zf.addEventListener("touchcancel",this.Kf.bind(this));{const e=this.Zf.ownerDocument,t=A=>{this.Hf.wv&&(A.composed&&this.Zf.contains(A.composedPath()[0])||A.target&&this.Zf.contains(A.target)||this.Hf.wv())};this.Mf=()=>{e.removeEventListener("touchstart",t)},this.gf=()=>{e.removeEventListener("mousedown",t)},e.addEventListener("mousedown",t),e.addEventListener("touchstart",t,{passive:!0})}ao()&&(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}),x0(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=mc(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),Oi(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=mc(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=!ao()}vv(e){const t=go(e.touches,Se(this.Of));if(t===null)return;const A=this.Ef(e,t);this.Wf(A,this.Hf.Rv),this.wf=!0,this.ff=!0}Lf(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:wn(e)<this.Vf+500}Wf(e,t){t&&t.call(this.Hf,e)}Uf(e,t){t&&t.call(this.Hf,e)}Ef(e,t){const A=t||e,r=this.Zf.getBoundingClientRect()||{left:0,top:0};return{clientX:A.clientX,clientY:A.clientY,pageX:A.pageX,pageY:A.pageY,screenX:A.screenX,screenY:A.screenY,localX:A.clientX-r.left,localY:A.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&Oi(e)}}}}function mc(i,e){const t=i.clientX-e.clientX,A=i.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function Oi(i){i.cancelable&&i.preventDefault()}function PA(i){return{nt:i.pageX,st:i.pageY}}function wn(i){return i.timeStamp||performance.now()}function go(i,e){for(let t=0;t<i.length;++t)if(i[t].identifier===e)return i[t];return null}function Bn(i){return{Hc:i.Hc,Iv:{gr:i.zv.externalId},Lv:i.zv.cursorStyle}}function b0(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 mo(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 wc(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 Bc{constructor(e,t,A,r){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new hr(200),this.Qr=null,this.Wv=0,this.jv=!1,this.Hv=()=>{this.jv||this.tn.$v().$t().Uh()},this.Uv=()=>{this.jv||this.tn.$v().$t().Uh()},this.tn=e,this.cn=t,this.ko=t.layout,this.Oc=A,this.qv=r==="left",this.Yv=mo("normal",r),this.Zv=mo("top",r),this.Xv=mo("bottom",r),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=yi(this.Kv,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const n=this.Gv.canvasElement;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Jv=yi(this.Kv,xt({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 fo(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose(),this.Li!==null&&this.Li.Ko().p(this),this.Li=null}lp(){return this.Kv}P(){return this.ko.fontSize}ap(){const e=this.Oc.W();return this.Qr!==e.R&&(this.Fv.nr(),this.Qr=e.R),e}op(){if(this.Li===null)return 0;let e=0;const t=this.ap(),A=Se(this.Gv.canvasElement.getContext("2d"));A.save();const r=this.Li.Ha();A.font=this._p(),r.length>0&&(e=Math.max(this.Fv.xi(A,r[0].so),this.Fv.xi(A,r[r.length-1].so)));const n=this.up();for(let c=n.length;c--;){const 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 lo(Math.ceil(t.C+t.T+t.A+t.I+5+l))}cp(e){this.Ev!==null&&mi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`)}dp(){return Se(this.Ev).width}Gi(e){this.Li!==e&&(this.Li!==null&&this.Li.Ko().p(this),this.Li=e,e.Ko().l(this.fo.bind(this),this))}Dt(){return this.Li}nr(){const e=this.tn.fp();this.tn.$v().$t().E_(e,Se(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}bt(){var e;(e=this.Li)===null||e===void 0||e.Ha()}Qv(e){if(this.Li===null||this.Li.Ni()||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!0,t.V_(A,this.Li,e.localY)}tp(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp(),r=this.Li;t.O_(A,r,e.localY)}ip(){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const e=this.tn.$v().$t(),t=this.tn.fp(),A=this.Li;this.Nv&&(this.Nv=!1,e.B_(t,A))}np(e){if(this.Li===null||!this.cn.handleScale.axisPressedMouseMove.price)return;const t=this.tn.$v().$t(),A=this.tn.fp();this.Nv=!1,t.B_(A,this.Li)}sp(e){this.cn.handleScale.axisDoubleClickReset.price&&this.nr()}ep(e){this.Li!==null&&(!this.tn.$v().$t().W().handleScale.axisPressedMouseMove.price||this.Li.Mh()||this.Li.Oo()||this.kp(1))}rp(e){this.kp(0)}up(){const e=[],t=this.Li===null?void 0:this.Li;return(A=>{for(let r=0;r<A.length;++r){const n=A[r].Rn(this.tn.fp(),t);for(let s=0;s<n.length;s++)e.push(n[s])}})(this.tn.fp().Uo()),e}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,s):Tl(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)}wc(r,1,this.Ev.height,t),wc(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),r=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(Se(this.Li)).X(e,A,this.Fv,r)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],r=this.tn.fp(),n=t.Zc().Rn(r,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((l=>{l.forEach((c=>{c.gt(Se(this.Li)).X(e,s,this.Fv,o)}))}))}kp(e){this.Kv.style.cursor=e===1?"ns-resize":"default"}fo(){const e=this.op();this.Wv<e&&this.tn.$v().$t().Kl(),this.Wv=e}_p(){return _i(this.ko.fontSize,this.ko.fontFamily)}}function Q0(i,e){var t,A;return(A=(t=i.ua)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function yn(i,e){var t,A;return(A=(t=i.Pn)===null||t===void 0?void 0:t.call(i,e))!==null&&A!==void 0?A:[]}function F0(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 U0(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 wo{constructor(e,t){this.Ev=xt({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new Mt,this.Op=new Mt,this.Bp=0,this.Ap=!1,this.Ip=null,this.zp=!1,this.Lp=null,this.Ep=null,this.jv=!1,this.Hv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Uv=()=>{this.jv||this.Np===null||this.$i().Uh()},this.Qd=e,this.Np=t,this.Np.W_().l(this.Fp.bind(this),this,!0),this.Wp=document.createElement("td"),this.Wp.style.padding="0",this.Wp.style.position="relative";const A=document.createElement("div");A.style.width="100%",A.style.height="100%",A.style.position="relative",A.style.overflow="hidden",this.jp=document.createElement("td"),this.jp.style.padding="0",this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Wp.appendChild(A),this.Gv=yi(A,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const r=this.Gv.canvasElement;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.Jv=yi(A,xt({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 fo(this.Jv.canvasElement,this,{ev:()=>this.Ip===null&&!this.Qd.W().handleScroll.vertTouchDrag,rv:()=>this.Ip===null&&!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.Cp!==null&&this.Cp.S(),this.Tp!==null&&this.Tp.S(),this.Pp=null,this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return Se(this.Np)}qp(e){var t,A;this.Np!==null&&this.Np.W_().p(this),this.Np=e,this.Np!==null&&this.Np.W_().l(wo.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 T0(this.Wp,this.Qd),this.Pp.bt()):((A=this.Pp)===null||A===void 0||A.if(),this.Pp=null)}$v(){return this.Qd}lp(){return this.$p}Up(){if(this.Np!==null&&(this.Zp(),this.$i().wt().length!==0)){if(this.Cp!==null){const e=this.Np.R_();this.Cp.Gi(Se(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(Se(e))}}}Xp(){this.Cp!==null&&this.Cp.bt(),this.Tp!==null&&this.Tp.bt()}M_(){return this.Np!==null?this.Np.M_():0}x_(e){this.Np&&this.Np.x_(e)}Qf(e){if(!this.Np)return;this.Kp();const t=e.localX,A=e.localY;this.Gp(t,A,e)}bv(e){this.Kp(),this.Jp(),this.Gp(e.localX,e.localY,e)}tv(e){var t;if(!this.Np)return;this.Kp();const A=e.localX,r=e.localY;this.Gp(A,r,e);const n=this.wr(A,r);this.Qd.Qp((t=n?.Lv)!==null&&t!==void 0?t:null),this.$i().jc(n&&{Hc:n.Hc,Iv:n.Iv})}dv(e){this.Np!==null&&(this.Kp(),this.tm(e))}qf(e){this.Np!==null&&this.im(this.Op,e)}jf(e){this.qf(e)}av(e){this.Kp(),this.nm(e),this.Gp(e.localX,e.localY,e)}cv(e){this.Np!==null&&(this.Kp(),this.Ap=!1,this.sm(e))}uv(e){this.Np!==null&&this.tm(e)}Rv(e){if(this.Ap=!0,this.Ip===null){const t={x:e.localX,y:e.localY};this.rm(t,t,e)}}Pv(e){this.Np!==null&&(this.Kp(),this.Np.$t().jc(null),this.hm())}lm(){return this.Vp}am(){return this.Op}xv(){this.Bp=1,this.$i().Un()}Sv(e,t){if(!this.Qd.W().handleScale.pinch)return;const A=5*(t-this.Bp);this.Bp=t,this.$i().Qc(e.nt,A)}pv(e){this.Ap=!1,this.zp=this.Ip!==null,this.Jp();const t=this.$i().Zc();this.Ip!==null&&t.yt()&&(this.Lp={x:t.Yt(),y:t.Zt()},this.Ip={x:e.localX,y:e.localY})}hv(e){if(this.Np===null)return;const t=e.localX,A=e.localY;if(this.Ip===null)this.nm(e);else{this.zp=!1;const r=Se(this.Lp),n=r.x+(t-this.Ip.x),s=r.y+(A-this.Ip.y);this.Gp(n,s,e)}}_v(e){this.$v().W().trackingMode.exitMode===0&&(this.zp=!0),this.om(),this.sm(e)}wr(e,t){const A=this.Np;return A===null?null:(function(r,n,s){const o=r.Uo(),l=(function(c,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 Bn(l);for(const c of o){if(l&&l.Hc===c&&l.zv.zOrder!=="bottom"&&!l.zv.isBackground)return Bn(l);const u=b0(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 Bn(l)}return l?.zv?Bn(l):null})(A,e,t)}_m(e,t){Se(t==="left"?this.Cp:this.Tp).cp(xt({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){mi(this.Ev,e)||(this.Ev=e,this.jv=!0,this.Gv.resizeCanvasElement(e),this.Jv.resizeCanvasElement(e),this.jv=!1,this.Wp.style.width=e.width+"px",this.Wp.style.height=e.height+"px")}dm(){const e=Se(this.Np);e.P_(e.R_()),e.P_(e.D_());for(const t of e.Ba())if(e.vr(t)){const A=t.Dt();A!==null&&e.P_(A),t.Vn()}}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0||this.Np===null)return;if(e>1&&this.dm(),this.Cp!==null&&this.Cp.vp(e),this.Tp!==null&&this.Tp.vp(e),e!==1){this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r)})),this.Np&&(this.fm(A,Q0),this.vm(A),this.pm(A),this.fm(A,yn),this.fm(A,F0)))}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.bm(t),this.fm(t,U0))}wm(){return this.Cp}gm(){return this.Tp}bp(e,t){this.fm(e,t)}Fp(){this.Np!==null&&this.Np.W_().p(this),this.Np=null}tm(e){this.im(this.Vp,e)}im(e,t){const A=t.localX,r=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:r},t)}mp({context:e,bitmapSize:t}){const{width:A,height:r}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?nn(e,0,0,A,r,o):Tl(e,0,0,A,r,s,o)}vm(e){const t=Se(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,yn,uo,t),this.Mm(e,yn,mn,t)}bm(e){this.Mm(e,yn,mn,this.$i().Zc())}fm(e,t){const A=Se(this.Np).Uo();for(const r of A)this.Mm(e,t,uo,r);for(const r of A)this.Mm(e,t,mn,r)}Mm(e,t,A,r){const n=Se(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===r,l=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;po(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 Bc(this,e.W(),r,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new Bc(this,e.W(),r,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,Se(this.Np))}hm(){this.$i().od()}om(){this.zp&&(this.Ip=null,this.hm())}rm(e,t,A){this.Ip=e,this.zp=!1,this.Gp(t.x,t.y,A);const r=this.$i().Zc();this.Lp={x:r.Yt(),y:r.Zt()}}$i(){return this.Qd.$t()}sm(e){if(!this.Dp)return;const t=this.$i(),A=this.fp();if(t.z_(A,A.vn()),this.Rp=null,this.Dp=!1,t.ed(),this.Ep!==null){const r=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),r),this.Ep.Qu(r)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)Se(document.activeElement).blur();else{const e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Np.vn().Ni()&&this.$i().St().Ni()}}nm(e){if(this.Np===null)return;const t=this.$i(),A=t.St();if(A.Ni())return;const r=this.Qd.W(),n=r.handleScroll,s=r.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),l=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:l,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new v0(.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 yc{constructor(e,t,A,r,n){this.ft=!0,this.Ev=xt({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=r,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=yi(this.Kv,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){mi(this.Ev,e)||(this.Ev=e,this.Gv.resizeCanvasElement(e),this.Kv.style.width=`${e.width}px`,this.Kv.style.height=`${e.height}px`,this.ft=!0)}vp(e){if(e<3&&!this.ft||this.Ev.width===0||this.Ev.height===0)return;this.ft=!1,this.Gv.applySuggestedBitmapSize();const t=wi(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:r}){if(!this.Tm())return;e.fillStyle=this.cn.timeScale.borderColor;const n=Math.floor(this.Oc.W().C*A),s=Math.floor(this.Oc.W().C*r),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Pm())}}function Bo(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 S0=Bo("normal"),E0=Bo("top"),L0=Bo("bottom");class M0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=xt({width:0,height:0}),this.Om=new Mt,this.Fv=new hr(5),this.jv=!1,this.Hv=()=>{this.jv||this.Qd.$t().Uh()},this.Uv=()=>{this.jv||this.Qd.$t().Uh()},this.Qd=e,this.q_=t,this.cn=e.W().layout,this.Xd=document.createElement("tr"),this.Bm=document.createElement("td"),this.Bm.style.padding="0",this.Am=document.createElement("td"),this.Am.style.padding="0",this.Kv=document.createElement("td"),this.Kv.style.height="25px",this.Kv.style.padding="0",this.Im=document.createElement("div"),this.Im.style.width="100%",this.Im.style.height="100%",this.Im.style.position="relative",this.Im.style.overflow="hidden",this.Kv.appendChild(this.Im),this.Gv=yi(this.Im,xt({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const A=this.Gv.canvasElement;A.style.position="absolute",A.style.zIndex="1",A.style.left="0",A.style.top="0",this.Jv=yi(this.Im,xt({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 fo(this.Jv.canvasElement,this,{ev:()=>!0,rv:()=>!this.Qd.W().handleScroll.horzTouchDrag})}S(){this.hp.S(),this.Rm!==null&&this.Rm.S(),this.Dm!==null&&this.Dm.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),Ci(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),Ci(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Xd}Lm(){return this.Rm}Em(){return this.Dm}bv(e){if(this.Vm)return;this.Vm=!0;const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.Jc(e.localX)}pv(e){this.bv(e)}wv(){const e=this.Qd.$t();!e.St().Ni()&&this.Vm&&(this.Vm=!1,this.Qd.W().handleScale.axisPressedMouseMove.time&&e.hd())}av(e){const t=this.Qd.$t();!t.St().Ni()&&this.Qd.W().handleScale.axisPressedMouseMove.time&&t.rd(e.localX)}hv(e){this.av(e)}cv(){this.Vm=!1;const e=this.Qd.$t();e.St().Ni()&&!this.Qd.W().handleScale.axisPressedMouseMove.time||e.hd()}_v(){this.cv()}qf(){this.Qd.W().handleScale.axisDoubleClickReset.time&&this.Qd.$t().Kn()}jf(){this.qf()}Qf(){this.Qd.$t().W().handleScale.axisPressedMouseMove.time&&this.kp(1)}Pv(){this.kp(0)}um(){return this.Ev}Nm(){return this.Om}Fm(e,t,A){mi(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(xt({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(xt({width:A,height:e.height}))}Wm(){const e=this.jm();return Math.ceil(e.C+e.T+e.P+e.L+e.B+e.Hm)}bt(){this.Qd.$t().St().Ha()}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const r=this.xp();r.width>0&&r.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=wi(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((r=>{this.mp(r),this.Ie(r),this.$m(A,L0)})),this.wp(A),this.$m(A,S0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=wi(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:r})=>{A.clearRect(0,0,r.width,r.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,E0))}$m(e,t){const A=this.Qd.$t().wt();for(const r of A)po(t,(n=>uo(n,e,!1,void 0)),r,void 0);for(const r of A)po(t,(n=>mn(n,e,!1,void 0)),r,void 0)}mp({context:e,bitmapSize:t}){nn(e,0,0,t.width,t.height,this.Qd.$t().bd())}Ie({context:e,bitmapSize:t,verticalPixelRatio:A}){if(this.Qd.W().timeScale.borderVisible){e.fillStyle=this.qm();const r=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,r)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const r=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:l,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const 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 _i(this.j(),this.cn.fontFamily)}Zm(){return _i(this.j(),this.cn.fontFamily,"bold")}jm(){this.k===null&&(this.k={C:1,N:NaN,L:NaN,B:NaN,ji:NaN,T:5,P:NaN,R:"",Wi:new hr,Hm:0});const e=this.k,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 yc("left",t,A,r,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new yc("right",t,A,r,n),this.Am.appendChild(this.Dm.lp()))}}const H0=!!Ni&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((i=>i.brand.includes("Chromium")))&&!!Ni&&(!((yo=navigator?.userAgentData)===null||yo===void 0)&&yo.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var yo;class I0{constructor(e,t,A){var r;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new Mt,this.Op=new Mt,this.Rc=new Mt,this.ib=null,this.nb=null,this.Jd=e,this.cn=t,this.q_=A,this.Xd=document.createElement("div"),this.Xd.classList.add("tv-lightweight-charts"),this.Xd.style.overflow="hidden",this.Xd.style.direction="ltr",this.Xd.style.width="100%",this.Xd.style.height="100%",(r=this.Xd).style.userSelect="none",r.style.webkitUserSelect="none",r.style.msUserSelect="none",r.style.MozUserSelect="none",r.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Co(this.cn)&&this.hb(!0),this.$i=new m0(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new M0(this,this.q_),this.sb.appendChild(this.ab.lp());const n=t.autoSize&&this.ob();let s=this.cn.width,o=this.cn.height;if(n||s===0||o===0){const l=e.getBoundingClientRect();s=s||l.width,o=o||l.height}this._b(s,o),this.ub(),e.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],Se(this.ab).S(),this.Xd.parentElement!==null&&this.Xd.parentElement.removeChild(this.Xd),this.Rc.S(),this.Vp.S(),this.Op.S(),this.pb()}_b(e,t,A=!1){if(this.ho===t&&this.__===e)return;const r=(function(o){const l=Math.floor(o.width),c=Math.floor(o.height);return xt({width:l-l%2,height:c-c%2})})(xt({width:e,height:t}));this.ho=r.height,this.__=r.width;const n=this.ho+"px",s=this.__+"px";Se(this.Xd).style.height=n,Se(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(Kt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=Kt.es());for(let t=0;t<this.Xm.length;t++)this.Xm[t].vp(e.Hn(t).Fn);this.cn.timeScale.visible&&this.ab.vp(e.jn())}$h(e){const t=Co(this.cn);this.$i.$h(e);const A=Co(this.cn);A!==t&&this.hb(A),this.cb(),this.bb(e)}lm(){return this.Vp}am(){return this.Op}Xc(){return this.Rc}wb(){this.Qm!==null&&(this.mb(this.Qm,performance.now()),this.Qm=null);const e=this.gb(null),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const A=Se(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:Se(e==="left"?this.Xm[0].wm():this.Xm[0].gm()).dp()}kb(){return this.cn.autoSize&&this.ib!==null}yb(){return this.Xd}Qp(e){this.nb=e,this.nb?this.yb().style.setProperty("cursor",e):this.yb().style.removeProperty("cursor")}Cb(){return this.nb}Tb(){return jt(this.Xm[0]).um()}bb(e){(e.autoSize!==void 0||!this.ib||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.ib&&this.ob(),e.autoSize===!1&&this.ib!==null&&this.pb(),e.autoSize||e.width===void 0&&e.height===void 0||this._b(e.width||this.__,e.height||this.ho))}gb(e){let t=0,A=0;const r=this.Xm[0],n=(o,l)=>{let c=0;for(let u=0;u<this.Xm.length;u++){const m=this.Xm[u],y=Se(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+=Se(r.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const l=this.Xm[o],c=l.xp();e!==null&&l.Sp(e,t,A),A+=c.height}t+=r.xp().width,this.Sb()&&(n("right",t),t+=Se(r.gm()).xp().width);const s=(o,l,c)=>{Se(o==="left"?this.ab.Lm():this.ab.Em()).Sp(Se(e),l,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let l=0;this.xb()&&(s("left",l,A),l=Se(r.wm()).xp().width),this.ab.Sp(e,l,A),l+=o.width,this.Sb()&&s("right",l,A)}A+=o.height}return xt({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const T of this.Xm)this.xb()&&(t=Math.max(t,Se(T.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,Se(T.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=T.M_();t=lo(t),A=lo(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(xt({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(xt({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 H0?1/window.devicePixelRatio:1}rb(e){if(!(e.deltaX!==0&&this.cn.handleScroll.mouseWheel||e.deltaY!==0&&this.cn.handleScale.mouseWheel))return;const t=this.Rb(e),A=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(r)*Math.min(1,Math.abs(r)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const r=e.jn();r===3&&this.Db(),r!==3&&r!==2||(this.Vb(e),this.Ob(e,t),this.ab.bt(),this.Xm.forEach((n=>{n.Xp()})),((A=this.Qm)===null||A===void 0?void 0:A.jn())===3&&(this.Qm.ts(e),this.Db(),this.Vb(this.Qm),this.Ob(this.Qm,t),e=this.Qm,this.Qm=null)),this.vp(e)}Ob(e,t){for(const A of e.Qn())this.ns(A,t)}Vb(e){const t=this.$i.qc();for(let A=0;A<t.length;A++)e.Hn(A).Wn&&t[A].N_()}ns(e,t){const A=this.$i.St();switch(e.qn){case 0:A.hc();break;case 1:A.lc(e.Vt);break;case 2:A.Gn(e.Vt);break;case 3:A.Jn(e.Vt);break;case 4:A.qu();break;case 5:e.Vt.Qu(t)||A.Jn(e.Vt.tc(t))}}Vc(e){this.Qm!==null?this.Qm.ts(e):this.Qm=e,this.tb||(this.tb=!0,this.Km=window.requestAnimationFrame((t=>{if(this.tb=!1,this.Km=0,this.Qm!==null){const A=this.Qm;this.Qm=null,this.mb(A,t);for(const r of A.Qn())if(r.qn===5&&!r.Vt.Qu(t)){this.$t().Zn(r.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let r=t;r<A;r++){const n=jt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let r=A;r<t;r++){const n=new wo(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 eo?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 Co(i){return!!(i.handleScroll.mouseWheel||i.handleScale.mouseWheel)}function D0(i){return(function(e){return e.open!==void 0})(i)||(function(e){return e.value!==void 0})(i)}function Cc(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 vc(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 _0(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 P0(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 k0(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 N0(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 O0(i,e,t,A,r){const n=jt(r)(t),s=Math.max(...n),o=Math.min(...n),l=n[n.length-1],c=[l,s,o,l],u=t,{time:m,color:y}=u;return{ee:e,ot:i,Vt:c,zb:A,$e:Cc(u,["time","color"]),V:y}}function Cn(i){return i.Vt!==void 0}function Tc(i,e){return e.customValues!==void 0&&(i.jb=e.customValues),i}function vi(i){return(e,t,A,r,n,s)=>(function(o,l){return l?l(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?Tc({ot:e,ee:t,zb:r},A):Tc(i(e,t,A,r,n),A)}function xc(i){return{Candlestick:vi(N0),Bar:vi(k0),Area:vi(_0),Baseline:vi(P0),Histogram:vi(vc),Line:vi(vc),Custom:vi(O0)}[i]}function bc(i){return{ee:0,Hb:new Map,la:i}}function Qc(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)})),jt(e)}class K0{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=xc(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=bc(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=Qc(l,u),y=Qc(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=bc(r),this.qb.set(this.q_.key(r),s));const l=xc(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:Cn(m)};if(!o)return this.tw(e,-1,y);const v={timeWeight:0,time:s.la,pointData:s,originalTime:Fc(s.Hb)},T=cr(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)vo(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)?Cn(t)&&A.push(t):Cn(t)?A[A.length-1]=t:A.splice(-1,1),this.Zb.set(e,t.ot)}Jb(e,t){t.length!==0?(this.Yb.set(e,t.filter(Cn)),this.Zb.set(e,t[t.length-1].ot)):(this.Yb.delete(e),this.Zb.delete(e))}Gb(){for(const e of this.Xb)e.pointData.Hb.size===0&&this.qb.delete(this.q_.key(e.time))}Qb(e){let t=-1;for(let A=0;A<this.Xb.length&&A<e.length;++A){const r=this.Xb[A],n=e[A];if(this.q_.key(r.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=r.timeWeight,vo(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)vo(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 vo(i,e){i.ee=e,i.Hb.forEach((t=>{t.ee=e}))}function To(i){const e={value:i.Vt[3],time:i.zb};return i.jb!==void 0&&(e.customValues=i.jb),e}function Uc(i){const e=To(i);return i.V!==void 0&&(e.color=i.V),e}function V0(i){const e=To(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 z0(i){const e=To(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 Sc(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 W0(i){const e=Sc(i);return i.V!==void 0&&(e.color=i.V),e}function R0(i){const e=Sc(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 xo(i){return{Area:V0,Line:Uc,Baseline:z0,Histogram:Uc,Bar:W0,Candlestick:R0,Custom:G0}[i]}function G0(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},X0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},J0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:Vs,attributionLogo:!0},bo={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},Z0={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},Y0={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Vs,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function Ec(){return{width:0,height:0,autoSize:!1,layout:J0,crosshair:$0,grid:X0,overlayPriceScales:Object.assign({},bo),leftPriceScale:Object.assign(Object.assign({},bo),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},bo),{visible:!0}),timeScale:Z0,watermark:Y0,localization:{locale:Ni?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 q0{constructor(e,t){this.aw=e,this.ow=t}applyOptions(e){this.aw.$t().$c(this.ow,e)}options(){return this.Li().W()}width(){return on(this.ow)?this.aw.Mb(this.ow):0}Li(){return Se(this.aw.$t().Uc(this.ow)).Dt}}function Lc(i,e,t){const A=Cc(i,["time","originalTime"]),r=Object.assign({time:e},A);return t!==void 0&&(r.originalTime=t),r}const j0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class e1{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class t1{constructor(e,t,A,r,n){this.uw=new Mt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=r}S(){this.uw.S()}priceFormatter(){return this.Es.ba()}priceToCoordinate(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().Rt(e,t.Vt)}coordinateToPrice(e){const t=this.Es.Ct();return t===null?null:this.Es.Dt().pn(e,t.Vt)}barsInLogicalRange(e){if(e===null)return null;const t=new ki(new mr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const r=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=Se(A.el()),o=Se(A.An());if(r!==null&&n!==null&&r.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const l={barsBefore:r===null||r.ee===s?e.from-s:r.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return r!==null&&n!==null&&(l.from=r.zb,l.to=n.zb),l}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:xo(this.seriesType())(A)}data(){const e=xo(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=>Lc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>Lc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return YA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=FA(YA(j0),e),A=this.Es.ea(t);return new e1(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 A1{constructor(e,t,A){this.ww=new Mt,this.mu=new Mt,this.Om=new Mt,this.$i=e,this.yl=e.St(),this.ab=t,this.yl.nc().l(this.gw.bind(this)),this.yl.sc().l(this.Mw.bind(this)),this.ab.Nm().l(this.xw.bind(this)),this.q_=A}S(){this.yl.nc().p(this),this.yl.sc().p(this),this.ab.Nm().p(this),this.ww.S(),this.mu.S(),this.Om.S()}scrollPosition(){return this.yl.Hu()}scrollToPosition(e,t){t?this.yl.Ju(e,1e3):this.$i.Jn(e)}scrollToRealTime(){this.yl.Gu()}getVisibleRange(){const e=this.yl.Vu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){const t={from:this.q_.convertHorzItemToInternal(e.from),to:this.q_.convertHorzItemToInternal(e.to)},A=this.yl.Iu(t);this.$i.pd(A)}getVisibleLogicalRange(){const e=this.yl.Du();return e===null?null:{from:e.Os(),to:e.ui()}}setVisibleLogicalRange(e){ii(e.from<=e.to,"The from index cannot be after the to index."),this.$i.pd(e)}resetTimeScale(){this.$i.Kn()}fitContent(){this.$i.hc()}logicalToCoordinate(e){const t=this.$i.St();return t.Ni()?null:t.It(e)}coordinateToLogical(e){return this.yl.Ni()?null:this.yl.Nu(e)}timeToCoordinate(e){const t=this.q_.convertHorzItemToInternal(e),A=this.yl.Va(t,!1);return A===null?null:this.yl.It(A)}coordinateToTime(e){const t=this.$i.St(),A=t.Nu(e),r=t.Ui(A);return r===null?null:r.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},YA(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 i1(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 Mc(i){return(function(e){if(rn(e.handleScale)){const A=e.handleScale;e.handleScale={axisDoubleClickReset:{time:A,price:A},axisPressedMouseMove:{time:A,price:A},mouseWheel:A,pinch:A}}else if(e.handleScale!==void 0){const{axisPressedMouseMove:A,axisDoubleClickReset:r}=e.handleScale;rn(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),rn(r)&&(e.handleScale.axisDoubleClickReset={time:r,price:r})}const t=e.handleScroll;rn(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(i),i}class r1{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new Mt,this.Cw=new Mt,this.Tw=new Mt,this.Pw=new K0(t);const r=A===void 0?YA(Ec()):FA(YA(Ec()),Mc(A));this.q_=t,this.aw=new I0(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 A1(n,this.aw.fb(),this.q_)}remove(){this.aw.lm().p(this),this.aw.am().p(this),this.aw.Xc().p(this),this.Dw.S(),this.aw.S(),this.Sw.clear(),this.kw.clear(),this.yw.S(),this.Cw.S(),this.Tw.S(),this.Pw.S()}resize(e,t,A){this.autoSizeActive()||this.aw._b(e,t,A)}addCustomSeries(e,t){const A=Di(e),r=Object.assign(Object.assign({},dl),A.defaultOptions());return this.Vw("Custom",r,t,A)}addAreaSeries(e){return this.Vw("Area",Op,e)}addBaselineSeries(e){return this.Vw("Baseline",Kp,e)}addBarSeries(e){return this.Vw("Bar",kp,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",Pp,e)}addHistogramSeries(e){return this.Vw("Histogram",Vp,e)}addLineSeries(e){return this.Vw("Line",Np,e)}removeSeries(e){const t=jt(this.Sw.get(e)),A=this.Pw.vd(t);this.aw.$t().vd(t),this.Ow(A),this.Sw.delete(e),this.kw.delete(t)}pw(e,t){this.Ow(this.Pw.Kb(e,t))}bw(e,t){this.Ow(this.Pw.iw(e,t))}subscribeClick(e){this.yw.l(e)}unsubscribeClick(e){this.yw.v(e)}subscribeCrosshairMove(e){this.Tw.l(e)}unsubscribeCrosshairMove(e){this.Tw.v(e)}subscribeDblClick(e){this.Cw.l(e)}unsubscribeDblClick(e){this.Cw.v(e)}priceScale(e){return new q0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(Mc(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){i1(A.priceFormat);const n=FA(YA(pl),YA(t),A),s=this.aw.$t().dd(e,n,r),o=new t1(s,this,this,this,this.q_);return this.Sw.set(o,s),this.kw.set(s,o),o}Ow(e){const t=this.aw.$t();t._d(e.St.Eu,e.St.hw,e.St.lw),e.ew.forEach(((A,r)=>r.J(A.$e,A.rw))),t.Wu()}Bw(e){return jt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((r,n)=>{const s=n.Qh(),o=xo(s)(r);if(s!=="Custom")ii(D0(o));else{const l=n.Ta();ii(!l||l(o)===!1)}t.set(this.Bw(n),o)}));const A=e.Eb!==void 0&&this.kw.has(e.Eb)?this.Bw(e.Eb):void 0;return{time:e.zb,logical:e.ee,point:e.Lb,hoveredSeries:A,hoveredObjectId:e.Fb,seriesData:t,sourceEvent:e.Wb}}}function n1(i,e,t){let A;if(ar(i)){const n=document.getElementById(i);ii(n!==null,`Cannot find element in DOM with id=${i}`),A=n}else A=i;const r=new r1(A,e,t);return e.setOptions(r.options()),r}function s1(i,e){return n1(i,new fc,fc.Id(e))}Object.assign(Object.assign({},pl),dl);function Hc(i,e){return function(){return i.apply(e,arguments)}}const{toString:o1}=Object.prototype,{getPrototypeOf:Qo}=Object,{iterator:vn,toStringTag:Ic}=Symbol,Tn=(i=>e=>{const t=o1.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),SA=i=>(i=i.toLowerCase(),e=>Tn(e)===i),xn=i=>e=>typeof e===i,{isArray:Ki}=Array,Vi=xn("undefined");function wr(i){return i!==null&&!Vi(i)&&i.constructor!==null&&!Vi(i.constructor)&&nA(i.constructor.isBuffer)&&i.constructor.isBuffer(i)}const Dc=SA("ArrayBuffer");function a1(i){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(i):e=i&&i.buffer&&Dc(i.buffer),e}const l1=xn("string"),nA=xn("function"),_c=xn("number"),Br=i=>i!==null&&typeof i=="object",c1=i=>i===!0||i===!1,bn=i=>{if(Tn(i)!=="object")return!1;const e=Qo(i);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ic in i)&&!(vn in i)},h1=i=>{if(!Br(i)||wr(i))return!1;try{return Object.keys(i).length===0&&Object.getPrototypeOf(i)===Object.prototype}catch{return!1}},u1=SA("Date"),d1=SA("File"),p1=SA("Blob"),f1=SA("FileList"),g1=i=>Br(i)&&nA(i.pipe),m1=i=>{let e;return i&&(typeof FormData=="function"&&i instanceof FormData||nA(i.append)&&((e=Tn(i))==="formdata"||e==="object"&&nA(i.toString)&&i.toString()==="[object FormData]"))},w1=SA("URLSearchParams"),[B1,y1,C1,v1]=["ReadableStream","Request","Response","Headers"].map(SA),T1=i=>i.trim?i.trim():i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function yr(i,e,{allOwnKeys:t=!1}={}){if(i===null||typeof i>"u")return;let A,r;if(typeof i!="object"&&(i=[i]),Ki(i))for(A=0,r=i.length;A<r;A++)e.call(null,i[A],A,i);else{if(wr(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 Pc(i,e){if(wr(i))return null;e=e.toLowerCase();const t=Object.keys(i);let A=t.length,r;for(;A-- >0;)if(r=t[A],e===r.toLowerCase())return r;return null}const Ti=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kc=i=>!Vi(i)&&i!==Ti;function Fo(){const{caseless:i,skipUndefined:e}=kc(this)&&this||{},t={},A=(r,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=i&&Pc(t,n)||n;bn(t[s])&&bn(r)?t[s]=Fo(t[s],r):bn(r)?t[s]=Fo({},r):Ki(r)?t[s]=r.slice():(!e||!Vi(r))&&(t[s]=r)};for(let r=0,n=arguments.length;r<n;r++)arguments[r]&&yr(arguments[r],A);return t}const x1=(i,e,t,{allOwnKeys:A}={})=>(yr(e,(r,n)=>{t&&nA(r)?Object.defineProperty(i,n,{value:Hc(r,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(i,n,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),i),b1=i=>(i.charCodeAt(0)===65279&&(i=i.slice(1)),i),Q1=(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)},F1=(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&&Qo(i)}while(i&&(!t||t(i,e))&&i!==Object.prototype);return e},U1=(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},S1=i=>{if(!i)return null;if(Ki(i))return i;let e=i.length;if(!_c(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=i[e];return t},E1=(i=>e=>i&&e instanceof i)(typeof Uint8Array<"u"&&Qo(Uint8Array)),L1=(i,e)=>{const A=(i&&i[vn]).call(i);let r;for(;(r=A.next())&&!r.done;){const n=r.value;e.call(i,n[0],n[1])}},M1=(i,e)=>{let t;const A=[];for(;(t=i.exec(e))!==null;)A.push(t);return A},H1=SA("HTMLFormElement"),I1=i=>i.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,r){return A.toUpperCase()+r}),Nc=(({hasOwnProperty:i})=>(e,t)=>i.call(e,t))(Object.prototype),D1=SA("RegExp"),Oc=(i,e)=>{const t=Object.getOwnPropertyDescriptors(i),A={};yr(t,(r,n)=>{let s;(s=e(r,n,i))!==!1&&(A[n]=s||r)}),Object.defineProperties(i,A)},_1=i=>{Oc(i,(e,t)=>{if(nA(i)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=i[t];if(nA(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+"'")})}})},P1=(i,e)=>{const t={},A=r=>{r.forEach(n=>{t[n]=!0})};return Ki(i)?A(i):A(String(i).split(e)),t},k1=()=>{},N1=(i,e)=>i!=null&&Number.isFinite(i=+i)?i:e;function O1(i){return!!(i&&nA(i.append)&&i[Ic]==="FormData"&&i[vn])}const K1=i=>{const e=new Array(10),t=(A,r)=>{if(Br(A)){if(e.indexOf(A)>=0)return;if(wr(A))return A;if(!("toJSON"in A)){e[r]=A;const n=Ki(A)?[]:{};return yr(A,(s,o)=>{const l=t(s,r+1);!Vi(l)&&(n[o]=l)}),e[r]=void 0,n}}return A};return t(i,0)},V1=SA("AsyncFunction"),z1=i=>i&&(Br(i)||nA(i))&&nA(i.then)&&nA(i.catch),Kc=((i,e)=>i?setImmediate:e?((t,A)=>(Ti.addEventListener("message",({source:r,data:n})=>{r===Ti&&n===t&&A.length&&A.shift()()},!1),r=>{A.push(r),Ti.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",nA(Ti.postMessage)),W1=typeof queueMicrotask<"u"?queueMicrotask.bind(Ti):typeof process<"u"&&process.nextTick||Kc,fe={isArray:Ki,isArrayBuffer:Dc,isBuffer:wr,isFormData:m1,isArrayBufferView:a1,isString:l1,isNumber:_c,isBoolean:c1,isObject:Br,isPlainObject:bn,isEmptyObject:h1,isReadableStream:B1,isRequest:y1,isResponse:C1,isHeaders:v1,isUndefined:Vi,isDate:u1,isFile:d1,isBlob:p1,isRegExp:D1,isFunction:nA,isStream:g1,isURLSearchParams:w1,isTypedArray:E1,isFileList:f1,forEach:yr,merge:Fo,extend:x1,trim:T1,stripBOM:b1,inherits:Q1,toFlatObject:F1,kindOf:Tn,kindOfTest:SA,endsWith:U1,toArray:S1,forEachEntry:L1,matchAll:M1,isHTMLForm:H1,hasOwnProperty:Nc,hasOwnProp:Nc,reduceDescriptors:Oc,freezeMethods:_1,toObjectSet:P1,toCamelCase:I1,noop:k1,toFiniteNumber:N1,findKey:Pc,global:Ti,isContextDefined:kc,isSpecCompliantForm:O1,toJSONObject:K1,isAsyncFn:V1,isThenable:z1,setImmediate:Kc,asap:W1,isIterable:i=>i!=null&&nA(i[vn])};let Ge=class vp extends Error{static from(e,t,A,r,n,s){const o=new vp(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}}};Ge.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ge.ERR_BAD_OPTION="ERR_BAD_OPTION",Ge.ECONNABORTED="ECONNABORTED",Ge.ETIMEDOUT="ETIMEDOUT",Ge.ERR_NETWORK="ERR_NETWORK",Ge.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ge.ERR_DEPRECATED="ERR_DEPRECATED",Ge.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ge.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ge.ERR_CANCELED="ERR_CANCELED",Ge.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ge.ERR_INVALID_URL="ERR_INVALID_URL";const R1=null;function Uo(i){return fe.isPlainObject(i)||fe.isArray(i)}function Vc(i){return fe.endsWith(i,"[]")?i.slice(0,-2):i}function zc(i,e,t){return i?i.concat(e).map(function(r,n){return r=Vc(r),!t&&n?"["+r+"]":r}).join(t?".":""):e}function G1(i){return fe.isArray(i)&&!i.some(Uo)}const $1=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function Qn(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 Ge("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)&&G1(T)||(fe.isFileList(T)||fe.endsWith(C,"[]"))&&(F=fe.toArray(T)))return C=Vc(C),F.forEach(function(N,R){!(fe.isUndefined(N)||N===null)&&e.append(s===!0?zc([C],R,n):s===null?C:C+"[]",c(N))}),!1}return Uo(T)?!0:(e.append(zc(U,C,n),c(T)),!1)}const m=[],y=Object.assign($1,{defaultVisitor:u,convertValue:c,isVisitable:Uo});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 Wc(i){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(i).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function So(i,e){this._pairs=[],i&&Qn(i,this,e)}const Rc=So.prototype;Rc.append=function(e,t){this._pairs.push([e,t])},Rc.toString=function(e){const t=e?function(A){return e.call(this,A,Wc)}:Wc;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function X1(i){return encodeURIComponent(i).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Gc(i,e,t){if(!e)return i;const A=t&&t.encode||X1,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 So(e,r).toString(A),s){const o=i.indexOf("#");o!==-1&&(i=i.slice(0,o)),i+=(i.indexOf("?")===-1?"?":"&")+s}return i}class $c{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 Eo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},J1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:So,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Lo=typeof window<"u"&&typeof document<"u",Mo=typeof navigator=="object"&&navigator||void 0,Z1=Lo&&(!Mo||["ReactNative","NativeScript","NS"].indexOf(Mo.product)<0),Y1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",q1=Lo&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Lo,hasStandardBrowserEnv:Z1,hasStandardBrowserWebWorkerEnv:Y1,navigator:Mo,origin:q1},Symbol.toStringTag,{value:"Module"})),...J1};function j1(i,e){return Qn(i,new Xt.classes.URLSearchParams,{visitor:function(t,A,r,n){return Xt.isNode&&fe.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function eg(i){return fe.matchAll(/\w+|\[(\w*)]/g,i).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tg(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 Xc(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]=tg(r[s])),!o)}if(fe.isFormData(i)&&fe.isFunction(i.entries)){const t={};return fe.forEachEntry(i,(A,r)=>{e(eg(A),r,t,0)}),t}return null}function Ag(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 Cr={transitional:Eo,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(Xc(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 j1(e,this.formSerializer).toString();if((o=fe.isFileList(e))||A.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Qn(o?{"files[]":e}:e,l&&new l,this.formSerializer)}}return n||r?(t.setContentType("application/json",!1),Ag(e)):e}],transformResponse:[function(e){const t=this.transitional||Cr.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"?Ge.from(o,Ge.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:Xt.classes.FormData,Blob:Xt.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=>{Cr.headers[i]={}});const ig=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"]),rg=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]&&ig[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},Jc=Symbol("internals");function vr(i){return i&&String(i).trim().toLowerCase()}function Fn(i){return i===!1||i==null?i:fe.isArray(i)?i.map(Fn):String(i)}function ng(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 sg=i=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(i.trim());function Ho(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 og(i){return i.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function ag(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 sA=class{constructor(e){e&&this.set(e)}set(e,t,A){const r=this;function n(o,l,c){const u=vr(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]=Fn(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())&&!sg(e))s(rg(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=vr(e),e){const A=fe.findKey(this,e);if(A){const r=this[A];if(!t)return r;if(t===!0)return ng(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=vr(e),e){const A=fe.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||Ho(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let r=!1;function n(s){if(s=vr(s),s){const o=fe.findKey(A,s);o&&(!t||Ho(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||Ho(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]=Fn(r),delete t[n];return}const o=e?og(n):String(n).trim();o!==n&&delete t[n],t[o]=Fn(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[Jc]=this[Jc]={accessors:{}}).accessors,r=this.prototype;function n(s){const o=vr(s);A[o]||(ag(r,s),A[o]=!0)}return fe.isArray(e)?e.forEach(n):n(e),this}};sA.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),fe.reduceDescriptors(sA.prototype,({value:i},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>i,set(A){this[t]=A}}}),fe.freezeMethods(sA);function Io(i,e){const t=this||Cr,A=e||t,r=sA.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 Zc(i){return!!(i&&i.__CANCEL__)}let Tr=class extends Ge{constructor(e,t,A){super(e??"canceled",Ge.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function Yc(i,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?i(t):e(new Ge("Request failed with status code "+t.status,[Ge.ERR_BAD_REQUEST,Ge.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function lg(i){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(i);return e&&e[1]||""}function cg(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 hg(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 Un=(i,e,t=3)=>{let A=0;const r=cg(50,250);return hg(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)},qc=(i,e)=>{const t=i!=null;return[A=>e[0]({lengthComputable:t,total:i,loaded:A}),e[1]]},jc=i=>(...e)=>fe.asap(()=>i(...e)),ug=Xt.hasStandardBrowserEnv?((i,e)=>t=>(t=new URL(t,Xt.origin),i.protocol===t.protocol&&i.host===t.host&&(e||i.port===t.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,dg=Xt.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 pg(i){return typeof i!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(i)}function fg(i,e){return e?i.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):i}function eh(i,e,t){let A=!pg(e);return i&&(A||t==!1)?fg(i,e):e}const th=i=>i instanceof sA?{...i}:i;function xi(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(th(c),th(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 Ah=i=>{const e=xi({},i);let{data:t,withXSRFToken:A,xsrfHeaderName:r,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=sA.from(s),e.url=Gc(eh(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(Xt.hasStandardBrowserEnv||Xt.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(Xt.hasStandardBrowserEnv&&(A&&fe.isFunction(A)&&(A=A(e)),A||A!==!1&&ug(e.url))){const l=r&&n&&dg.read(n);l&&s.set(r,l)}return e},gg=typeof XMLHttpRequest<"u"&&function(i){return new Promise(function(t,A){const r=Ah(i);let n=r.data;const s=sA.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=sA.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};Yc(function(ne){t(ne),C()},function(ne){A(ne),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 Ge("Request aborted",Ge.ECONNABORTED,i,U)),U=null)},U.onerror=function(R){const M=R&&R.message?R.message:"Network Error",z=new Ge(M,Ge.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||Eo;r.timeoutErrorMessage&&(R=r.timeoutErrorMessage),A(new Ge(R,M.clarifyTimeoutError?Ge.ETIMEDOUT:Ge.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]=Un(c,!0),U.addEventListener("progress",y)),l&&U.upload&&([m,v]=Un(l),U.upload.addEventListener("progress",m),U.upload.addEventListener("loadend",v)),(r.cancelToken||r.signal)&&(u=N=>{U&&(A(!N||N.type?new Tr(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=lg(r.url);if(E&&Xt.protocols.indexOf(E)===-1){A(new Ge("Unsupported protocol "+E+":",Ge.ERR_BAD_REQUEST,i));return}U.send(n||null)})},mg=(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 Ge?u:new Tr(u instanceof Error?u.message:u))}};let s=e&&setTimeout(()=>{s=null,n(new Ge(`timeout of ${e}ms exceeded`,Ge.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}},wg=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},Bg=async function*(i,e){for await(const t of yg(i))yield*wg(t,e)},yg=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()}},ih=(i,e,t,A)=>{const r=Bg(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})},rh=64*1024,{isFunction:Sn}=fe,Cg=(({Request:i,Response:e})=>({Request:i,Response:e}))(fe.global),{ReadableStream:nh,TextEncoder:sh}=fe.global,oh=(i,...e)=>{try{return!!i(...e)}catch{return!1}},vg=i=>{i=fe.merge.call({skipUndefined:!0},Cg,i);const{fetch:e,Request:t,Response:A}=i,r=e?Sn(e):typeof fetch=="function",n=Sn(t),s=Sn(A);if(!r)return!1;const o=r&&Sn(nh),l=r&&(typeof sh=="function"?(T=>C=>T.encode(C))(new sh):async T=>new Uint8Array(await new t(T).arrayBuffer())),c=n&&o&&oh(()=>{let T=!1;const C=new t(Xt.origin,{body:new nh,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!C}),u=s&&o&&oh(()=>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 Ge(`Response type '${T}' is not supported`,Ge.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(Xt.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:ne,headers:$,withCredentials:V="same-origin",fetchOptions:Ae}=Ah(T),re=e||fetch;ne=ne?(ne+"").toLowerCase():"text";let he=mg([E,N&&N.toAbortSignal()],R),Z=null;const te=he&&he.unsubscribe&&(()=>{he.unsubscribe()});let ae;try{if(z&&c&&U!=="get"&&U!=="head"&&(ae=await v($,F))!==0){let Fe=new t(C,{method:"POST",body:F,duplex:"half"}),Ue;if(fe.isFormData(F)&&(Ue=Fe.headers.get("content-type"))&&$.setContentType(Ue),Fe.body){const[ye,Te]=qc(ae,Un(jc(z)));F=ih(Fe.body,rh,ye,Te)}}fe.isString(V)||(V=V?"include":"omit");const ce=n&&"credentials"in t.prototype,se={...Ae,signal:he,method:U.toUpperCase(),headers:$.normalize().toJSON(),body:F,duplex:"half",credentials:ce?V:void 0};Z=n&&new t(C,se);let le=await(n?re(Z,Ae):re(C,se));const pe=u&&(ne==="stream"||ne==="response");if(u&&(M||pe&&te)){const Fe={};["status","statusText","headers"].forEach(ve=>{Fe[ve]=le[ve]});const Ue=fe.toFiniteNumber(le.headers.get("content-length")),[ye,Te]=M&&qc(Ue,Un(jc(M),!0))||[];le=new A(ih(le.body,rh,ye,()=>{Te&&Te(),te&&te()}),Fe)}ne=ne||"text";let Be=await m[fe.findKey(m,ne)||"text"](le,T);return!pe&&te&&te(),await new Promise((Fe,Ue)=>{Yc(Fe,Ue,{data:Be,headers:sA.from(le.headers),status:le.status,statusText:le.statusText,config:T,request:Z})})}catch(ce){throw te&&te(),ce&&ce.name==="TypeError"&&/Load failed|fetch/i.test(ce.message)?Object.assign(new Ge("Network Error",Ge.ERR_NETWORK,T,Z,ce&&ce.response),{cause:ce.cause||ce}):Ge.from(ce,ce&&ce.code,T,Z,ce&&ce.response)}}},Tg=new Map,ah=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=Tg;for(;o--;)l=n[o],c=u.get(l),c===void 0&&u.set(l,c=o?new Map:vg(e)),u=c;return c};ah();const Do={http:R1,xhr:gg,fetch:{get:ah}};fe.forEach(Do,(i,e)=>{if(i){try{Object.defineProperty(i,"name",{value:e})}catch{}Object.defineProperty(i,"adapterName",{value:e})}});const lh=i=>`- ${i}`,xg=i=>fe.isFunction(i)||i===null||i===!1;function bg(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,!xg(A)&&(r=Do[(o=String(A)).toLowerCase()],r===void 0))throw new Ge(`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(lh).join(`
|
|
5
|
+
`):" "+lh(s[0]):"as no adapter specified";throw new Ge("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r}const ch={getAdapter:bg,adapters:Do};function _o(i){if(i.cancelToken&&i.cancelToken.throwIfRequested(),i.signal&&i.signal.aborted)throw new Tr(null,i)}function hh(i){return _o(i),i.headers=sA.from(i.headers),i.data=Io.call(i,i.transformRequest),["post","put","patch"].indexOf(i.method)!==-1&&i.headers.setContentType("application/x-www-form-urlencoded",!1),ch.getAdapter(i.adapter||Cr.adapter,i)(i).then(function(A){return _o(i),A.data=Io.call(i,i.transformResponse,A),A.headers=sA.from(A.headers),A},function(A){return Zc(A)||(_o(i),A&&A.response&&(A.response.data=Io.call(i,i.transformResponse,A.response),A.response.headers=sA.from(A.response.headers))),Promise.reject(A)})}const uh="1.13.5",En={};["object","boolean","number","function","string","symbol"].forEach((i,e)=>{En[i]=function(A){return typeof A===i||"a"+(e<1?"n ":" ")+i}});const dh={};En.transitional=function(e,t,A){function r(n,s){return"[Axios v"+uh+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Ge(r(s," has been removed"+(t?" in "+t:"")),Ge.ERR_DEPRECATED);return t&&!dh[s]&&(dh[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}},En.spelling=function(e){return(t,A)=>(console.warn(`${A} is likely a misspelling of ${e}`),!0)};function Qg(i,e,t){if(typeof i!="object")throw new Ge("options must be an object",Ge.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 Ge("option "+n+" must be "+l,Ge.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ge("Unknown option "+n,Ge.ERR_BAD_OPTION)}}const Ln={assertOptions:Qg,validators:En},BA=Ln.validators;let bi=class{constructor(e){this.defaults=e||{},this.interceptors={request:new $c,response:new $c}}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=xi(this.defaults,t);const{transitional:A,paramsSerializer:r,headers:n}=t;A!==void 0&&Ln.assertOptions(A,{silentJSONParsing:BA.transitional(BA.boolean),forcedJSONParsing:BA.transitional(BA.boolean),clarifyTimeoutError:BA.transitional(BA.boolean),legacyInterceptorReqResOrdering:BA.transitional(BA.boolean)},!1),r!=null&&(fe.isFunction(r)?t.paramsSerializer={serialize:r}:Ln.assertOptions(r,{encode:BA.function,serialize:BA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ln.assertOptions(t,{baseUrl:BA.spelling("baseURL"),withXsrfToken:BA.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=sA.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||Eo;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=[hh.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=hh.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=xi(this.defaults,e);const t=eh(e.baseURL,e.url,e.allowAbsoluteUrls);return Gc(t,e.params,e.paramsSerializer)}};fe.forEach(["delete","get","head","options"],function(e){bi.prototype[e]=function(t,A){return this.request(xi(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(xi(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}bi.prototype[e]=t(),bi.prototype[e+"Form"]=t(!0)});let Fg=class Tp{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 Tr(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 Tp(function(r){e=r}),cancel:e}}};function Ug(i){return function(t){return i.apply(null,t)}}function Sg(i){return fe.isObject(i)&&i.isAxiosError===!0}const Po={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(Po).forEach(([i,e])=>{Po[e]=i});function ph(i){const e=new bi(i),t=Hc(bi.prototype.request,e);return fe.extend(t,bi.prototype,e,{allOwnKeys:!0}),fe.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return ph(xi(i,r))},t}const gt=ph(Cr);gt.Axios=bi,gt.CanceledError=Tr,gt.CancelToken=Fg,gt.isCancel=Zc,gt.VERSION=uh,gt.toFormData=Qn,gt.AxiosError=Ge,gt.Cancel=gt.CanceledError,gt.all=function(e){return Promise.all(e)},gt.spread=Ug,gt.isAxiosError=Sg,gt.mergeConfig=xi,gt.AxiosHeaders=sA,gt.formToJSON=i=>Xc(fe.isHTMLForm(i)?new FormData(i):i),gt.getAdapter=ch.getAdapter,gt.HttpStatusCode=Po,gt.default=gt;const{Axios:nx,AxiosError:sx,CanceledError:ox,isCancel:ax,CancelToken:lx,VERSION:cx,all:hx,Cancel:ux,isAxiosError:dx,spread:px,toFormData:fx,AxiosHeaders:gx,HttpStatusCode:mx,formToJSON:wx,getAdapter:Bx,mergeConfig:yx}=gt,kA=Object.create(null);kA.open="0",kA.close="1",kA.ping="2",kA.pong="3",kA.message="4",kA.upgrade="5",kA.noop="6";const Mn=Object.create(null);Object.keys(kA).forEach(i=>{Mn[kA[i]]=i});const ko={type:"error",data:"parser error"},fh=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",gh=typeof ArrayBuffer=="function",mh=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer,No=({type:i,data:e},t,A)=>fh&&e instanceof Blob?t?A(e):wh(e,A):gh&&(e instanceof ArrayBuffer||mh(e))?t?A(e):wh(new Blob([e]),A):A(kA[i]+(e||"")),wh=(i,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(i)};function Bh(i){return i instanceof Uint8Array?i:i instanceof ArrayBuffer?new Uint8Array(i):new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}let Oo;function Eg(i,e){if(fh&&i.data instanceof Blob)return i.data.arrayBuffer().then(Bh).then(e);if(gh&&(i.data instanceof ArrayBuffer||mh(i.data)))return e(Bh(i.data));No(i,!1,t=>{Oo||(Oo=new TextEncoder),e(Oo.encode(t))})}const yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<yh.length;i++)xr[yh.charCodeAt(i)]=i;const Lg=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=xr[i.charCodeAt(A)],s=xr[i.charCodeAt(A+1)],o=xr[i.charCodeAt(A+2)],l=xr[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},Mg=typeof ArrayBuffer=="function",Ko=(i,e)=>{if(typeof i!="string")return{type:"message",data:Ch(i,e)};const t=i.charAt(0);return t==="b"?{type:"message",data:Hg(i.substring(1),e)}:Mn[t]?i.length>1?{type:Mn[t],data:i.substring(1)}:{type:Mn[t]}:ko},Hg=(i,e)=>{if(Mg){const t=Lg(i);return Ch(t,e)}else return{base64:!0,data:i}},Ch=(i,e)=>e==="blob"?i instanceof Blob?i:new Blob([i]):i instanceof ArrayBuffer?i:i.buffer,vh="",Ig=(i,e)=>{const t=i.length,A=new Array(t);let r=0;i.forEach((n,s)=>{No(n,!1,o=>{A[s]=o,++r===t&&e(A.join(vh))})})},Dg=(i,e)=>{const t=i.split(vh),A=[];for(let r=0;r<t.length;r++){const n=Ko(t[r],e);if(A.push(n),n.type==="error")break}return A};function _g(){return new TransformStream({transform(i,e){Eg(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 Vo;function Hn(i){return i.reduce((e,t)=>e+t.length,0)}function In(i,e){if(i[0].length===e)return i.shift();const t=new Uint8Array(e);let A=0;for(let r=0;r<e;r++)t[r]=i[0][A++],A===i[0].length&&(i.shift(),A=0);return i.length&&A<i[0].length&&(i[0]=i[0].slice(A)),t}function Pg(i,e){Vo||(Vo=new TextDecoder);const t=[];let A=0,r=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(Hn(t)<1)break;const l=In(t,1);n=(l[0]&128)===128,r=l[0]&127,r<126?A=3:r===126?A=1:A=2}else if(A===1){if(Hn(t)<2)break;const l=In(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),A=3}else if(A===2){if(Hn(t)<8)break;const l=In(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),u=c.getUint32(0);if(u>Math.pow(2,21)-1){o.enqueue(ko);break}r=u*Math.pow(2,32)+c.getUint32(4),A=3}else{if(Hn(t)<r)break;const l=In(t,r);o.enqueue(Ko(n?l:Vo.decode(l),e)),A=0}if(r===0||r>i){o.enqueue(ko);break}}}})}const Th=4;function _t(i){if(i)return kg(i)}function kg(i){for(var e in _t.prototype)i[e]=_t.prototype[e];return i}_t.prototype.on=_t.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this},_t.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this},_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.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},_t.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},_t.prototype.emitReserved=_t.prototype.emit,_t.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]},_t.prototype.hasListeners=function(i){return!!this.listeners(i).length};const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),yA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ng="arraybuffer";function Cx(){}function xh(i,...e){return e.reduce((t,A)=>(i.hasOwnProperty(A)&&(t[A]=i[A]),t),{})}const Og=yA.setTimeout,Kg=yA.clearTimeout;function _n(i,e){e.useNativeTimers?(i.setTimeoutFn=Og.bind(yA),i.clearTimeoutFn=Kg.bind(yA)):(i.setTimeoutFn=yA.setTimeout.bind(yA),i.clearTimeoutFn=yA.clearTimeout.bind(yA))}const Vg=1.33;function zg(i){return typeof i=="string"?Wg(i):Math.ceil((i.byteLength||i.size)*Vg)}function Wg(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 bh(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Rg(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function Gg(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 zo extends _t{constructor(e){super(),this.writable=!1,_n(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=Ko(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=Rg(e);return t.length?"?"+t:""}}class Xg extends zo{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let A=0;this._polling&&(A++,this.once("pollComplete",function(){--A||t()})),this.writable||(A++,this.once("drain",function(){--A||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=A=>{if(this.readyState==="opening"&&A.type==="open"&&this.onOpen(),A.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(A)};Dg(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,Ig(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]=bh()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Qh=!1;try{Qh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Jg=Qh;function Zg(){}class Yg extends Xg{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let A=location.port;A||(A=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||A!==e.port}}doWrite(e,t){const A=this.request({method:"POST",data:e});A.on("success",t),A.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,A)=>{this.onError("xhr poll error",t,A)}),this.pollXhr=e}}class NA extends _t{constructor(e,t,A){super(),this.createRequest=e,_n(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=xh(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const A=this._xhr=this.createRequest(t);try{A.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){A.setDisableHeaderCheck&&A.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&A.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{A.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{A.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(A),"withCredentials"in A&&(A.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(A.timeout=this._opts.requestTimeout),A.onreadystatechange=()=>{var r;A.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(A.getResponseHeader("set-cookie"))),A.readyState===4&&(A.status===200||A.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof A.status=="number"?A.status:0)},0))},A.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=NA.requestsCount++,NA.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Zg,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete NA.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(NA.requestsCount=0,NA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Fh);else if(typeof addEventListener=="function"){const i="onpagehide"in yA?"pagehide":"unload";addEventListener(i,Fh,!1)}}function Fh(){for(let i in NA.requests)NA.requests.hasOwnProperty(i)&&NA.requests[i].abort()}const qg=(function(){const i=Uh({xdomain:!1});return i&&i.responseType!==null})();class jg extends Yg{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=qg&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new NA(Uh,this.uri(),e)}}function Uh(i){const e=i.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Jg))return new XMLHttpRequest}catch{}if(!e)try{return new yA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Sh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class em extends zo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=Sh?{}:xh(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;No(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}r&&Dn(()=>{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]=bh()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Wo=yA.WebSocket||yA.MozWebSocket;class tm extends em{createSocket(e,t,A){return Sh?new Wo(e,t,A):t?new Wo(e,t):new Wo(e)}doWrite(e,t){this.ws.send(t)}}class Am extends zo{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Pg(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),r=_g();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&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const im={websocket:tm,webtransport:Am,polling:jg},rm=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,nm=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ro(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=rm.exec(i||""),n={},s=14;for(;s--;)n[nm[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=sm(n,n.path),n.queryKey=om(n,n.query),n}function sm(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 om(i,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,r,n){r&&(t[r]=n)}),t}const Go=typeof addEventListener=="function"&&typeof removeEventListener=="function",Pn=[];Go&&addEventListener("offline",()=>{Pn.forEach(i=>i())},!1);class ni extends _t{constructor(e,t){if(super(),this.binaryType=Ng,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=Ro(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=Ro(t.host).host);_n(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=Gg(this.opts.query)),Go&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Pn.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Th,t.transport=e,this.id&&(t.sid=this.id);const A=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](A)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ni.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",ni.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let A=0;A<this.writeBuffer.length;A++){const r=this.writeBuffer[A].data;if(r&&(t+=zg(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,Dn(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,A){return this._sendPacket("message",e,t,A),this}send(e,t,A){return this._sendPacket("message",e,t,A),this}_sendPacket(e,t,A,r){if(typeof t=="function"&&(r=t,t=void 0),typeof A=="function"&&(r=A,A=null),this.readyState==="closing"||this.readyState==="closed")return;A=A||{},A.compress=A.compress!==!1;const n={type:e,data:t,options:A};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},A=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?A():e()}):this.upgrading?A():e()),this}_onError(e){if(ni.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Go&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=Pn.indexOf(this._offlineEventListener);A!==-1&&Pn.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}ni.protocol=Th;class am extends ni{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),A=!1;ni.priorWebsocketSuccess=!1;const r=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!A)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ni.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 lm=class extends am{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=>im[r]).filter(r=>!!r)),super(e,A)}};function cm(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=Ro(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 hm=typeof ArrayBuffer=="function",um=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Eh=Object.prototype.toString,dm=typeof Blob=="function"||typeof Blob<"u"&&Eh.call(Blob)==="[object BlobConstructor]",pm=typeof File=="function"||typeof File<"u"&&Eh.call(File)==="[object FileConstructor]";function $o(i){return hm&&(i instanceof ArrayBuffer||um(i))||dm&&i instanceof Blob||pm&&i instanceof File}function kn(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,A=i.length;t<A;t++)if(kn(i[t]))return!0;return!1}if($o(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return kn(i.toJSON(),!0);for(const t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&kn(i[t]))return!0;return!1}function fm(i){const e=[],t=i.data,A=i;return A.data=Xo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Xo(i,e){if(!i)return i;if($o(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]=Xo(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]=Xo(i[A],e));return t}return i}function gm(i,e){return i.data=Jo(i.data,e),delete i.attachments,i}function Jo(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]=Jo(i[t],e);else if(typeof i=="object")for(const t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Jo(i[t],e));return i}const mm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var ct;(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"})(ct||(ct={}));class wm{constructor(e){this.replacer=e}encode(e){return(e.type===ct.EVENT||e.type===ct.ACK)&&kn(e)?this.encodeAsBinary({type:e.type===ct.EVENT?ct.BINARY_EVENT:ct.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===ct.BINARY_EVENT||e.type===ct.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=fm(e),A=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(A),r}}class Zo extends _t{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===ct.BINARY_EVENT;A||t.type===ct.BINARY_ACK?(t.type=A?ct.EVENT:ct.ACK,this.reconstructor=new Bm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if($o(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(ct[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===ct.BINARY_EVENT||A.type===ct.BINARY_ACK){const n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const s=e.substring(n,t);if(s!=Number(s)||e.charAt(t)!=="-")throw new Error("Illegal attachments");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(Zo.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 ct.CONNECT:return Lh(t);case ct.DISCONNECT:return t===void 0;case ct.CONNECT_ERROR:return typeof t=="string"||Lh(t);case ct.EVENT:case ct.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&mm.indexOf(t[0])===-1);case ct.ACK:case ct.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Bm{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=gm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Lh(i){return Object.prototype.toString.call(i)==="[object Object]"}const ym=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Zo,Encoder:wm,get PacketType(){return ct}},Symbol.toStringTag,{value:"Module"}));function EA(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 Mh extends _t{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=[EA(e,"open",this.onopen.bind(this)),EA(e,"packet",this.onpacket.bind(this)),EA(e,"error",this.onerror.bind(this)),EA(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:ct.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:ct.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(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 ct.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ct.EVENT:case ct.BINARY_EVENT:this.onevent(e);break;case ct.ACK:case ct.BINARY_ACK:this.onack(e);break;case ct.DISCONNECT:this.ondisconnect();break;case ct.CONNECT_ERROR:this.destroy();const 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:ct.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ct.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let 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 zi(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}zi.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},zi.prototype.reset=function(){this.attempts=0},zi.prototype.setMin=function(i){this.ms=i},zi.prototype.setMax=function(i){this.max=i},zi.prototype.setJitter=function(i){this.jitter=i};class Yo extends _t{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,_n(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 zi({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||ym;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 lm(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const r=EA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=EA(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(EA(e,"ping",this.onping.bind(this)),EA(e,"data",this.ondata.bind(this)),EA(e,"error",this.onerror.bind(this)),EA(e,"close",this.onclose.bind(this)),EA(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){Dn(()=>{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 Mh(this,e,t),this.nsps[e]=A),A}_destroy(e){const t=Object.keys(this.nsps);for(const A of t)if(this.nsps[A].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let A=0;A<t.length;A++)this.engine.write(t[A],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var A;this.cleanup(),(A=this.engine)===null||A===void 0||A.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const A=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&A.unref(),this.subs.push(()=>{this.clearTimeoutFn(A)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const br={};function Nn(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};const t=cm(i,e.path||"/socket.io"),A=t.source,r=t.id,n=t.path,s=br[r]&&n in br[r].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return o?l=new Yo(A,e):(br[r]||(br[r]=new Yo(A,e)),l=br[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Nn,{Manager:Yo,Socket:Mh,io:Nn,connect:Nn});function qo(i){if(!i)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(i,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(i).trim().replace(/\/+$/,"")}}let dA=qo("http://localhost:8000");function Hh(i){const e=qo(i);e&&e!==dA&&(dA=e,St&&(St.disconnect(),St.removeAllListeners(),St=null))}let St=null;function vm(){const i=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=i();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:dA,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=Nn(dA,{reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const r=i();return t.auth=r?{token:r}:{},r};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:dA,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",r=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:r,socketId:t.id})}),t.on("connect_error",r=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:r?.message,description:r?.description,context:r?.context,type:r?.type,baseUrl:dA,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",r=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:r,baseUrl:dA,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:dA})}),t.io.on("reconnect",r=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:r,socketId:t.id})}),t}function jo(){const i=qo(St?.io?.uri||null);return!St||St.io&&i&&dA&&i!==dA?(St&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:i,newBaseUrl:dA,wasConnected:St.connected,reason:"baseUrl changed"}),St.disconnect(),St.removeAllListeners(),St=null),St=vm()):St.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:St.id,connected:St.connected,baseUrl:dA,uri:i}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:St.id,baseUrl:dA}),St}function Tm(i,e){const t=jo();return t.on(i,e),()=>t.off(i,e)}function xm(i,e){St&&St.off(i,e)}function bm(i,e){jo().emit(i,e)}function Qm(){return St?St.connected?"connected":"connecting":"disconnected"}const On={getSocket:jo,on:Tm,off:xm,emit:bm,getStatus:Qm,setBaseUrl:Hh},Fm={},Ih=q.createContext(),Vt=()=>{const i=q.useContext(Ih);if(!i)throw new Error("useTrading must be used within TradingProvider");return i},Um=({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:Ks&&Ks.tagName.toUpperCase()==="SCRIPT"&&Ks.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Fm?.VITE_BASE_URL)??"http://localhost:5002";On.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,N]=q.useState(!0),[R,M]=q.useState([]),[z,ne]=q.useState(!1),[$,V]=q.useState(1e5),[Ae,re]=q.useState(null),[he,Z]=q.useState([]),[te,ae]=q.useState(!0),[ce,se]=q.useState(!1),[le,pe]=q.useState(!0),[Be,Fe]=q.useState("candles"),[Ue,ye]=q.useState(!1),[Te,ve]=q.useState("dark"),[be,Le]=q.useState(null),[Re,Ke]=q.useState(!1),[xe,De]=q.useState(!1),[Ce,de]=q.useState(!1),[_e,et]=q.useState(!1),[rt,nt]=q.useState(!1),[ut,fA]=q.useState(!1),[Xe,ke]=q.useState(!1),[at,it]=q.useState(!1),[Ct,bt]=q.useState(!1),[$A,XA]=q.useState(!1),[Rt,gA]=q.useState([]),JA=q.useRef(null),Yt=q.useRef(new Map),Et=q.useRef(null),QA=1e3,st=q.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;ne(!0);const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Pe=[];Array.isArray(ze.data)?Pe=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Pe=ze.data.data);const At=Pe.filter(Ne=>Ne.closePrice===null||Ne.closePrice===void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,comment:Ne.comment||"",status:"OPEN",swap:0,profit:Ne.profit||0,profitCurrency:"USD",time:new Date(Ne.openedAt||Ne.openAt||Date.now()).toLocaleTimeString(),openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt}));M(At)}catch(me){console.error("❌ Error fetching orders:",me.response?.data||me.message),M([])}finally{ne(!1)}},[l,A]),ft=q.useCallback((me,ze)=>!ze||!me.price||isNaN(ze)||isNaN(me.price)?me.profit||0:(me?.type?.toUpperCase()==="BUY"?ze-me.price:me.price-ze)*me.volume,[]),Ut=q.useCallback(async()=>{try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ze=await gt.get(`${l}${u.account}`,{headers:{Authorization:`Bearer ${me}`}});if(ze.data&&ze.data.data){const Pe=parseFloat(ze.data.data.balance);isNaN(Pe)||V(Pe)}}catch(me){console.error("❌ Error fetching user balance:",me.response?.data||me.message)}},[l]),Tt=q.useCallback(async()=>{if(A)try{const me=localStorage.getItem("token")??localStorage.getItem("authToken");if(!me)return;const ze=await gt.get(`${l}/trades/account/${A}`,{headers:{Authorization:`Bearer ${me}`}});let Pe=[];Array.isArray(ze.data)?Pe=ze.data:ze.data?.data&&Array.isArray(ze.data.data)&&(Pe=ze.data.data);const At=Pe.filter(Ne=>Ne.closePrice!==null&&Ne.closePrice!==void 0).map(Ne=>({id:Ne.id,ticket:23,symbol:Ne.symbol,type:Ne.type,volume:Ne.volume,openPrice:Ne.openPrice??Ne.price,closePrice:Ne.closePrice,stopLoss:Ne.stopLoss,takeProfit:Ne.takeProfit,profit:Ne.profit??Ne.profitLoss??0,profitCurrency:"USD",openAt:Ne.openedAt||Ne.openAt,closeAt:Ne.closedAt||Ne.closeAt,closeReason:Ne.closeReason||"",status:"CLOSED"}));gA(At)}catch(me){console.error("❌ Error fetching history orders:",me.response?.data||me.message),gA([])}},[l,A]),Je=q.useMemo(()=>{const me=$,ze=R.reduce((wt,Lt)=>wt+Lt.volume*Lt.price*.01,0),Pe=R.reduce((wt,Lt)=>{const cA=U.find(mA=>mA.symbol===Lt.symbol);if(cA){const mA=Lt.type?.toUpperCase()==="BUY"?parseFloat(cA.bid||0):parseFloat(cA.ask||0);if(mA&&mA>0&&!isNaN(mA))return wt+ft(Lt,mA)}return wt+(Lt.profit||0)},0),At=me+Pe,Ne=At-ze,Ye=ze>0?At/ze*100:0;return{balance:me,equity:At,margin:ze,freeMargin:Ne,level:Ye.toFixed(2)}},[R,U,$,ft]);q.useEffect(()=>{(localStorage.getItem("token")??localStorage.getItem("authToken"))&&A&&(st(),Ut(),Tt())},[st,Ut,Tt,A]),q.useEffect(()=>{(async()=>{try{N(!0);const ze=u.symbols.includes("?")?`${l}${u.symbols}`:`${l}${u.symbols}`,Pe=await gt.get(ze);let At=[];Array.isArray(Pe.data)?At=Pe.data:Pe.data&&Pe.data.data&&Array.isArray(Pe.data.data)?At=Pe.data.data:Pe.data&&Pe.data.prices&&Array.isArray(Pe.data.prices)?At=Pe.data.prices:Pe.data&&Array.isArray(Pe.data)&&(At=Pe.data);const Ne=At.map(Ye=>{const wt=Ye.symbol||Ye.name||"",Lt=Ye.category||null;return wt&&(Ye.bid!==void 0||Ye.price!==void 0)?{symbol:wt,bid:Ye.bid??Ye.price??0,ask:Ye.ask??Ye.price??0,change:Ye.change??0,category:Lt}:{...Ye,symbol:wt,category:Lt}});Ne.length>0?(F(Ne),Ne.find(wt=>wt.symbol===y)||v(Ne[0].symbol)):F([])}catch(ze){console.error("❌ Error fetching symbols:",ze.response?.data||ze.message),F([])}finally{N(!1)}})()},[l,u.symbols]);const Ie=q.useCallback(()=>{const me=Yt.current;if(me.size===0)return;const ze=new Map(me);me.clear(),F(Pe=>Pe.map(At=>{const Ne=ze.get(At.symbol);return Ne?{...At,...Ne}:At})),M(Pe=>{let At=!1;const Ne=Pe.map(Ye=>{const wt=ze.get(Ye.symbol);if(!wt)return Ye;const Lt=Ye.type?.toUpperCase()==="BUY"?parseFloat(wt.bid||0):parseFloat(wt.ask||0);if(!Lt||isNaN(Lt)||Lt<=0)return Ye;const cA=ft(Ye,Lt);return cA===Ye.profit?Ye:(At=!0,{...Ye,profit:cA})});return At?Ne:Pe})},[ft]);q.useEffect(()=>{JA.current||(JA.current=On.getSocket());const me=JA.current,ze=()=>{console.log("✅ TradingContext: Connected"),A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)})},Pe=()=>console.log("⚠️ TradingContext: Disconnected"),At=Ye=>{Ye?.symbol&&(Yt.current.set(Ye.symbol,Ye),Et.current||(Et.current=setTimeout(()=>{Et.current=null,Ie()},QA)))},Ne=async Ye=>{if(Ye){if(Ye.newBalance!==void 0){const wt=parseFloat(Ye.newBalance);isNaN(wt)||V(wt)}if(window.notify){const wt=Ye.profitLoss||Ye.profit||0,Lt=wt>=0?`+${wt.toFixed(2)}`:wt.toFixed(2),cA=Ye.symbol||"Trade",mA=Ye.reason||"Closed";window.notify(`Trade Closed: ${mA} | ${cA} | P/L: ${Lt} USD`,wt>=0?"success":"error")}Ye.tradeId&&M(wt=>wt.filter(Lt=>Lt.id!==Ye.tradeId)),await st(),await Ut()}};return me.on("connect",ze),me.on("disconnect",Pe),me.on("priceUpdate",At),me.on("tradeClosed",Ne),me.connected&&A&&Number.isFinite(Number(A))&&me.emit("joinUserRoom",{userId:Number(A)}),()=>{me.off("connect",ze),me.off("disconnect",Pe),me.off("priceUpdate",At),me.off("tradeClosed",Ne),Et.current&&(clearTimeout(Et.current),Et.current=null),Yt.current.clear()}},[Ie,st,Ut]),q.useEffect(()=>{try{const me=document.documentElement;if(!me)return;me.dataset.theme=Te}catch{}},[Te]);const tt=q.useMemo(()=>U.find(me=>me.symbol===y)||{bid:"0.00000",ask:"0.00000",change:0},[U,y]),$e=q.useMemo(()=>({selectedSymbol:y,setSelectedSymbol:v,selectedTimeframe:T,setSelectedTimeframe:C,symbols:U,setSymbols:F,symbolsLoading:E,orders:R,setOrders:M,ordersLoading:z,fetchOrders:st,fetchUserBalance:Ut,userBalance:$,setUserBalance:V,accountSummary:Je,currentSymbolData:tt,activeTool:Ae,setActiveTool:re,chartObjects:he,setChartObjects:Z,showGrid:te,setShowGrid:ae,snapToGrid:ce,setSnapToGrid:se,drawingsVisible:le,setDrawingsVisible:pe,chartType:Be,setChartType:Fe,chartLocked:Ue,setChartLocked:ye,theme:Te,setTheme:ve,candleColors:be,setCandleColors:Le,showTradeOrders:Re,setShowTradeOrders:Ke,showTradePosition:xe,setShowTradePosition:De,showTradeHistory:Ce,setShowTradeHistory:de,showSLTP:_e,setShowSLTP:et,showAskPrice:rt,setShowAskPrice:nt,showChartControls:ut,setShowChartControls:fA,showTradeNotification:Xe,setShowTradeNotification:ke,showCrosshair:at,setShowCrosshair:it,showOHLC:Ct,setShowOHLC:bt,baseUrl:l,endpoints:u,endpointParams:m,accountId:A,isShow:$A,setIsShow:XA,historyOrders:Rt,setHistoryOrders:gA,fetchHistoryOrders:Tt,indicators:s,indicatorSettings:o}),[y,T,U,E,R,z,st,Ut,$,Je,tt,Ae,he,te,ce,le,Be,Ue,Te,be,Re,xe,Ce,_e,rt,ut,Xe,at,Ct,l,u,m,$A,Rt,Tt,s,o]);return a.jsx(Ih.Provider,{value:$e,children:i})};var Dh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},_h=q.createContext&&q.createContext(Dh),Sm=["attr","size","title"];function Em(i,e){if(i==null)return{};var t=Lm(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 Lm(i,e){if(i==null)return{};var t={};for(var A in i)if(Object.prototype.hasOwnProperty.call(i,A)){if(e.indexOf(A)>=0)continue;t[A]=i[A]}return t}function Kn(){return Kn=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(i[A]=t[A])}return i},Kn.apply(this,arguments)}function Ph(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(i);e&&(A=A.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,A)}return t}function Vn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ph(Object(t),!0).forEach(function(A){Mm(i,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ph(Object(t)).forEach(function(A){Object.defineProperty(i,A,Object.getOwnPropertyDescriptor(t,A))})}return i}function Mm(i,e,t){return e=Hm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hm(i){var e=Im(i,"string");return typeof e=="symbol"?e:e+""}function Im(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 kh(i){return i&&i.map((e,t)=>q.createElement(e.tag,Vn({key:t},e.attr),kh(e.child)))}function eA(i){return e=>q.createElement(Dm,Kn({attr:Vn({},i.attr)},e),kh(i.child))}function Dm(i){var e=t=>{var{attr:A,size:r,title:n}=i,s=Em(i,Sm),o=r||t.size||"1em",l;return t.className&&(l=t.className),i.className&&(l=(l?l+" ":"")+i.className),q.createElement("svg",Kn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:l,style:Vn(Vn({color:i.color||t.color},t.style),i.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&q.createElement("title",null,n),i.children)};return _h!==void 0?q.createElement(_h.Consumer,null,t=>e(t)):e(Dh)}function _m(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zM108.1 96h231.81A12.09 12.09 0 0 0 352 83.9V44.09A12.09 12.09 0 0 0 339.91 32H108.1A12.09 12.09 0 0 0 96 44.09V83.9A12.1 12.1 0 0 0 108.1 96zm231.81 256A12.09 12.09 0 0 0 352 339.9v-39.81A12.09 12.09 0 0 0 339.91 288H108.1A12.09 12.09 0 0 0 96 300.09v39.81a12.1 12.1 0 0 0 12.1 12.1z"},child:[]}]})(i)}function Pm(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(i)}function km(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M16 224h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm416 192H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm3.17-384H172.83A12.82 12.82 0 0 0 160 44.83v38.34A12.82 12.82 0 0 0 172.83 96h262.34A12.82 12.82 0 0 0 448 83.17V44.83A12.82 12.82 0 0 0 435.17 32zm0 256H172.83A12.82 12.82 0 0 0 160 300.83v38.34A12.82 12.82 0 0 0 172.83 352h262.34A12.82 12.82 0 0 0 448 339.17v-38.34A12.82 12.82 0 0 0 435.17 288z"},child:[]}]})(i)}function Nm(i){return eA({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(i)}function Nh(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(i)}function Om(i){return eA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(i)}function Km(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(i)}function Vm(i){return eA({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(i)}function zm(i){return eA({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M290.74 93.24l128.02 128.02-277.99 277.99-114.14 12.6C11.35 513.54-1.56 500.62.14 485.34l12.7-114.22 277.9-277.88zm207.2-19.06l-60.11-60.11c-18.75-18.75-49.16-18.75-67.91 0l-56.55 56.55 128.02 128.02 56.55-56.55c18.75-18.76 18.75-49.16 0-67.91z"},child:[]}]})(i)}function Wm(i){return eA({attr:{viewBox:"0 0 352 512"},child:[{tag:"path",attr:{d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z"},child:[]}]})(i)}const Rm={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Oh=({bidPrice:i,askPrice:e,userAccountId:t,onTradeExecuted:A})=>{const{theme:r,selectedSymbol:n,fetchOrders:s,baseUrl:o,endpoints:l}=Vt(),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]",N=M=>{const z=parseFloat(u)||.01,ne=Math.max(.01,z+M);m(ne.toFixed(2))},R=async M=>{v("");const z=M,ne=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(!ne||ne<=0||isNaN(ne)){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 Ae=typeof n=="object"?n?.symbol:n,re={accountId:t,symbol:Ae,type:z,volume:$,openPrice:ne,takeProfit:null,stopLoss:null};try{const he=o||Rm?.VITE_BASE_URL||"http://localhost:8000",Z=l?.trades||"/api/trades",te=await gt.post(`${he}${Z}`,re,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(te.status<200||te.status>=300){v(te.data?.message||`Failed to place trade (${te.status})`);return}s&&s(),A&&A()}catch(he){const Z=he?.response?.data?.message||he?.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(Nh,{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(Om,{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})]})},Gm={},Kh=({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}=Vt(),N=U==="light",R={getContractSpec:Xe=>{const ke=String(Xe||"").toUpperCase();return ke.includes("BTC")||ke.includes("ETH")||ke.includes("SOL")||ke.includes("XRP")||ke.includes("ADA")||ke.includes("DOGE")||ke.includes("BNB")||ke.includes("AVAX")||ke.includes("DOT")||ke.includes("LINK")||ke.endsWith("USDT")?{contractSize:1}:ke.includes("XAU")||ke.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:Xe,volume:ke})=>{const at=R.getContractSpec(Xe);return(parseFloat(ke)||0)*(at.contractSize||1)}},M=u||R,[z,ne]=q.useState("0.01"),[$,V]=q.useState(""),[Ae,re]=q.useState(""),[he,Z]=q.useState(""),[te,ae]=q.useState(!1),[ce,se]=q.useState(null),[le,pe]=q.useState(""),[Be,Fe]=q.useState(t||"BUY"),[Ue,ye]=q.useState(parseFloat(A)||0),[Te,ve]=q.useState(parseFloat(r)||0),[be,Le]=q.useState("text-white"),[Re,Ke]=q.useState("text-white"),xe=q.useRef(parseFloat(A)||0),De=q.useRef(parseFloat(r)||0);q.useEffect(()=>{if(!i)return;const Xe=On.getSocket(),ke=it=>{if(!(!it||!it.symbol)&&it.symbol.toUpperCase()===m?.toUpperCase()){const Ct=parseFloat(it.bid)||0,bt=parseFloat(it.ask)||0;Ct>0&&(Ct>xe.current?(Le("text-green-400"),setTimeout(()=>Le("text-white"),500)):Ct<xe.current&&xe.current>0&&(Le("text-red-400"),setTimeout(()=>Le("text-white"),500)),ye(Ct),xe.current=Ct),bt>0&&(bt>De.current?(Ke("text-green-400"),setTimeout(()=>Ke("text-white"),500)):bt<De.current&&De.current>0&&(Ke("text-red-400"),setTimeout(()=>Ke("text-white"),500)),ve(bt),De.current=bt)}};Xe.on("priceUpdate",ke);const at=T.find(it=>it.symbol===m);if(at){const it=parseFloat(at.bid)||0,Ct=parseFloat(at.ask)||0;it>0&&(ye(it),xe.current=it),Ct>0&&(ve(Ct),De.current=Ct)}return()=>{Xe.off("priceUpdate",ke)}},[i,m,T]),q.useEffect(()=>{if(i){ne(o?String(o):"0.01"),V(""),re(""),Z(""),pe(""),Fe(t||"BUY");const Xe=parseFloat(A)||0,ke=parseFloat(r)||0;Xe>0&&(ye(Xe),xe.current=Xe),ke>0&&(ve(ke),De.current=ke)}},[i,t,A,r,o]);const Ce=Ue||0,de=Te||0,_e=Xe=>{const ke=parseFloat(z)||.01,at=Math.max(.01,ke+Xe);ne(at.toFixed(2))},et=Xe=>{const ke=parseFloat($)||0,at=parseFloat(Be==="BUY"?Te:Ue)||0;if(!at){pe("Current price not available. Please wait...");return}let it=ke+Xe;Be==="BUY"?it=Math.max(1e-5,Math.min(it,at-1e-5)):it=Math.max(at+1e-5,it),V(it>0?it.toFixed(5):""),pe("")},rt=Xe=>{const ke=parseFloat(Ae)||0,at=parseFloat(Be==="BUY"?Te:Ue)||0;if(!at){pe("Current price not available. Please wait...");return}let it=ke+Xe;Be==="BUY"?it=Math.max(at+1e-5,it):it=Math.max(1e-5,Math.min(it,at-1e-5)),re(it>0?it.toFixed(5):""),pe("")},nt=async Xe=>{pe("");const ke=Xe||Be,at=parseFloat(ke==="BUY"?Te:Ue),it=parseFloat(z),Ct=$?parseFloat($):null,bt=Ae?parseFloat(Ae):null;if(!it||it<=0||isNaN(it)){pe("Please enter a valid volume (minimum 0.01)");return}if(it<.01){pe("Volume must be at least 0.01");return}if(!at||at<=0||isNaN(at)){pe("Invalid price. Please refresh and try again.");return}if(Ct!==null&&Ct!==""){if(isNaN(Ct)||Ct<=0){pe("Stop Loss must be a valid positive number");return}if(ke==="BUY"&&Ct>=at){pe("Stop Loss must be below the current price for BUY orders");return}if(ke==="SELL"&&Ct<=at){pe("Stop Loss must be above the current price for SELL orders");return}}if(bt!==null&&bt!==""){if(isNaN(bt)||bt<=0){pe("Take Profit must be a valid positive number");return}if(ke==="BUY"){if(bt<=at){pe(`Take Profit must be above the entry price (${at.toFixed(5)}) for BUY orders`);return}}else if(ke==="SELL"&&bt>=at){pe(`Take Profit must be below the entry price (${at.toFixed(5)}) for SELL orders`);return}}Fe(ke),se(ke),ae(!0);const $A=new Date,XA=$A.toLocaleTimeString(),Rt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,gA=localStorage.getItem("token")??localStorage.getItem("authToken");if(!gA){pe("Please login to place trades"),ae(!1),se(null);return}const JA={accountId:s,symbol:m,type:ke,volume:it,price:at,takeProfit:bt,stopLoss:Ct,comment:he.trim()||null},Yt={ticket:Rt.substring(0,8),symbol:m,type:ke,volume:parseFloat(it),price:parseFloat(at),time:XA,stopLoss:Ct?parseFloat(Ct):null,takeProfit:bt?parseFloat(bt):null,swap:0,profit:0,profitCurrency:"USD",comment:he.trim()||"",id:Rt,status:"OPEN",openAt:$A.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:ke,lotSize:it,entryPrice:at,stopLoss:Ct,takeProfit:bt,comment:he.trim()||null};Promise.resolve(n(Et)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),C&&C()}).catch(QA=>{console.error("❌ Trade execution failed:",QA),!l&&v&&v(st=>st.filter(ft=>ft.id!==Rt))})}else{if(c){pe("Fallback API path disabled in forceParentExecution mode"),ae(!1),se(null);return}ae(!1),se(null),e();const Et=F||Gm?.VITE_BASE_URL||"http://localhost:8000",QA=E?.trades||"/api/trades";gt.post(`${Et}${QA}`,JA,{headers:{Authorization:`Bearer ${gA}`,"Content-Type":"application/json"}}).then(st=>{if(st.data&&st.data.data){const ft=st.data.data.trade;!l&&v&&v(Ut=>Ut.map(Tt=>Tt.id===Rt?{...Tt,id:ft.id,ticket:ft.id.substring(0,8),time:XA,openAt:ft.openAt}:Tt)),console.log("✅ Trade saved successfully:",ft),window.notify&&window.notify(`Trade placed successfully: ${ft.symbol} ${ft.type}`,"success")}else{!l&&v&&v(Ut=>Ut.filter(Tt=>Tt.id!==Rt));const ft=st.data?.message||"Failed to place trade";window.notify&&window.notify(ft,"error")}}).catch(st=>{console.error("Error placing trade:",st),!l&&v&&v(Ut=>Ut.filter(Tt=>Tt.id!==Rt));let ft="Failed to place trade";if(st.response){const Ut=st.response.status,Tt=st.response.data;Ut===400?ft=Tt?.message||"Invalid trade data. Please check your inputs.":Ut===401?ft="Authentication failed. Please login again.":Ut===404?ft=Tt?.message||"Symbol not found. Please select a valid symbol.":Ut===500?ft="Server error. Please try again later.":ft=Tt?.message||`Error: ${Ut}`}else st.request&&(ft="Network error. Please check your internet connection.");window.notify&&window.notify(ft,"error")})}},fA=(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:[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 ${N?"text-slate-700":"text-white"}`,children:"Volume"}),a.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[fA," ",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 ${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:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d{0,2}$/.test(ke))&&(ne(ke),pe(""))},onBlur:()=>{const Xe=parseFloat(z);ne(isNaN(Xe)||Xe<.01?"0.01":Xe.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:()=>_e(.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:()=>et(-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:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d*$/.test(ke))&&(V(ke),pe(""))},onBlur:Xe=>{const ke=parseFloat(Xe.target.value);!isNaN(ke)&&ke>0?V(ke.toFixed(5)):Xe.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:()=>et(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:()=>rt(-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:Ae,onChange:Xe=>{const ke=Xe.target.value;(ke===""||/^\d*\.?\d*$/.test(ke))&&(re(ke),pe(""))},onBlur:Xe=>{const ke=parseFloat(Xe.target.value);!isNaN(ke)&&ke>0?re(ke.toFixed(5)):Xe.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:()=>rt(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:he,onChange:Xe=>Z(Xe.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:`${be} font-medium transition-colors duration-400`,children:Ce>0?Ce.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:`${Re} 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:()=>nt("SELL"),disabled:te,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:te&&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:()=>nt("BUY"),disabled:te,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:te&&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"},Xm=[10,11,12,14,16,20,24,28,30,40],zn=[{key:"M1",label:"1 Minute"},{key:"M5",label:"5 Minutes"},{key:"M15",label:"15 Minutes"},{key:"M30",label:"30 Minutes"},{key:"H1",label:"1 Hour"},{key:"H4",label:"4 Hours"},{key:"D1",label:"Daily"},{key:"W1",label:"Weekly"},{key:"MN",label:"Monthly"}],si={width:"78%",height:"78%",display:"block"},Vh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Jm(i){return i?{background:"#ffffff",text:"#1f2937",mutedText:"#6b7280",border:"#cfd6df",fieldBg:"#ffffff",fieldBorder:"#cfd6df",fieldDisabledBg:"#e5e7eb",fieldDisabledText:"#9ca3af",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#eaf3ff",activeText:"#2f80ed",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}:{background:"#242d3d",text:"#e5e7eb",mutedText:"#a7b0c0",border:"#4a5568",fieldBg:"#2f3a4e",fieldBorder:"#5f6a80",fieldDisabledBg:"#4f5a70",fieldDisabledText:"#9aa3b2",headerBlue:"#2f80ed",headerText:"#ffffff",activeFill:"#dbeafe",activeText:"#1d4ed8",green:"#22a447",greenHover:"#2bb151",greenActive:"#1f8f3d"}}function OA(i,e="#5f8f96"){if(typeof i!="string")return e;const t=i.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const Zm=()=>a.jsx(zm,{style:si}),Ym=()=>a.jsx(Wm,{style:si}),qm=()=>a.jsx(Nm,{style:si}),jm=()=>a.jsx(Vm,{style:si}),ew=()=>a.jsx(Pm,{style:si}),tw=()=>a.jsx(_m,{style:si}),Aw=()=>a.jsx(km,{style:si}),iw=()=>a.jsx(Nh,{style:si}),ea=({size:i,children:e})=>a.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:i,height:i},children:e});function Qr({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(ea,{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:Vh}),a.jsx("span",{style:{width:18,height:18,marginRight:8,display:"inline-flex",alignItems:"center",justifyContent:"center",border:`1px solid ${A.border}`,background:A.fieldBg},children:i&&a.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),a.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Nt({value:i,onChange:e,onBlur:t,disabled:A=!1,tokens:r}){const n=OA(i,"#5f8f96"),s=(i||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${r.fieldBorder}`,background:r.fieldBg,boxSizing:"border-box"},l={position:"relative",width:20,height:20,display:"block",flexShrink:0},c={width:"100%",minWidth:0,height:"100%",border:"none",marginLeft:"4px",padding:"0 8px 0 2px",fontFamily:"ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif",fontSize:12,lineHeight:"30px",textTransform:"lowercase",outline:"none",boxSizing:"border-box",background:"transparent",color:A?r.fieldDisabledText:r.text};return a.jsxs("div",{style:o,children:[a.jsxs("label",{style:l,children:[a.jsx("input",{type:"color",value:n,onChange:u=>e(u.target.value),disabled:A,style:{...Vh,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 Qi({value:i,onChange:e,tokens:t,disabled:A=!1,width:r,children:n}){return a.jsxs("div",{style:{position:"relative",width:r??"100%",height:30,flexShrink:0},children:[a.jsx("select",{value:i,onChange:e,disabled:A,style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${A?t.fieldDisabledBg:t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:A?t.fieldDisabledBg:t.fieldBg,color:A?t.fieldDisabledText:t.text,cursor:A?"default":"pointer",opacity:A?.5:1},children:n}),a.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText,display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(iw,{})})]})}function rw({draft:i,setDraft:e,tokens:t}){const A=i.visibleTimeframes?.length===zn.length,r=()=>{e(s=>({...s,visibleTimeframes:A?[]:zn.map(o=>o.key)}))},n=s=>{e(o=>{const l=o.visibleTimeframes||[];return{...o,visibleTimeframes:l.includes(s)?l.filter(c=>c!==s):[...l,s]}})};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsx(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:zn.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 nw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>{A(n,OA(s,o))};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>r("color",i.color,"#5f8f96"),tokens:t}),a.jsx(Qi,{value:i.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),tokens:t,width:84,children:Xm.map(n=>a.jsx("option",{value:n,children:n},n))}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.fontWeight==="bold",onClick:()=>A("fontWeight",i.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:a.jsx(qm,{})}),a.jsx(Qr,{checked:i.fontStyle==="italic",onClick:()=>A("fontStyle",i.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:a.jsx(jm,{})})]}),a.jsxs("div",{style:{display:"flex"},children:[a.jsx(Qr,{checked:i.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:a.jsx(ew,{})}),a.jsx(Qr,{checked:i.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:a.jsx(tw,{})}),a.jsx(Qr,{checked:i.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:a.jsx(Aw,{})})]})]}),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(Nt,{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(Ze,{checked:!!i.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>r("bgColor",i.bgColor,"#5f8f96"),disabled:!i.bgEnabled,tokens:t}),a.jsx(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 Wn({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#22c55e",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#22c55e"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Arrows"}),a.jsx(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(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(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 sw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",gap:12},children:a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t})}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(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(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(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 ow({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:t.text,marginBottom:10},children:"Statistics"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 104px minmax(80px, 1fr) auto",alignItems:"center",gap:8,marginBottom:10},children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"Style"}),a.jsx(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(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 aw({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 Fi(i){if(!i)return"";const e=new Date(i*1e3),t=A=>String(A).padStart(2,"0");return`${t(e.getUTCDate())}.${t(e.getUTCMonth()+1)}.${e.getUTCFullYear()} ${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}`}function Ui({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(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:Fi(i.point2Time),style:n}),a.jsx(CA,{tokens:t,value:i.point2Price??"",onChange:s=>A("point2Price",s.target.value)})]})]})}function zh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>e(l=>({...l,[s]:o})),r=(s,o,l)=>A(s,OA(o,l)),n=!i.showText;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:s=>A("lineColor",s),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:s=>A("lineWidth",Number(s.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(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(Nt,{value:i.textColor||"#ffffff",onChange:s=>A("textColor",s),onBlur:()=>r("textColor",i.textColor,"#ffffff"),disabled:n,tokens:t}),a.jsxs(Qi,{value:i.textHAlign??"center",onChange:s=>A("textHAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsxs(Qi,{value:i.textVAlign??"top",onChange:s=>A("textVAlign",s.target.value),disabled:n,tokens:t,width:90,children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"middle",children:"Middle"}),a.jsx("option",{value:"bottom",children:"Bottom"})]})]}),a.jsx("textarea",{value:i.textContent||"",onChange:s=>A("textContent",s.target.value),placeholder:"Your text",rows:4,disabled:n,style:{width:"100%",resize:"none",border:`1px solid ${n?t.fieldDisabledBg:t.fieldBorder}`,padding:8,fontSize:12,lineHeight:"20px",outline:"none",boxSizing:"border-box",background:n?t.fieldDisabledBg:t.fieldBg,color:n?t.fieldDisabledText:t.text,opacity:n?.5:1}})]})}function lw({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 cw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.originTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function hw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#3b82f6",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#3b82f6"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(Ze,{checked:i.showDate!==!1,onChange:n=>A("showDate",n),label:"Show date",tokens:t}),a.jsx("div",{}),a.jsx("div",{})]})]})}function uw({draft:i,tokens:e}){const t={height:30,flex:1,border:`1px solid ${e.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:e.fieldDisabledBg,color:e.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:e.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:t})]})})}function dw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#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(Nt,{value:i.statsColor||"#5f8f96",onChange:n=>A("statsColor",n),onBlur:()=>r("statsColor",i.statsColor,"#5f8f96"),tokens:t}),a.jsxs(Qi,{value:i.statsPosition??"right",onChange:n=>A("statsPosition",n.target.value),tokens:t,children:[a.jsx("option",{value:"left",children:"Left"}),a.jsx("option",{value:"center",children:"Center"}),a.jsx("option",{value:"right",children:"Right"})]}),a.jsx(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 pw({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#06a0e3",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#06a0e3"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr",gap:8,alignItems:"center"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:t.text},children:"Properties"}),a.jsx(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 fw({draft:i,setDraft:e,tokens:t}){const A={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},r={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsx("div",{style:{padding:"12px 16px"},children:a.jsxs("div",{style:A,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.rawTime),style:r}),a.jsx(CA,{tokens:t,value:i.price??"",onChange:n=>{const s=Number(n.target.value);Number.isFinite(s)&&e(o=>({...o,price:s}))}})]})})}function Wh({draft:i,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),r=(n,s,o)=>A(n,OA(s,o));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,padding:"12px 16px"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsx(Nt,{value:i.lineColor||"#129f5c",onChange:n=>A("lineColor",n),onBlur:()=>r("lineColor",i.lineColor,"#129f5c"),tokens:t}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"range",min:"1",max:"5",step:"1",value:i.lineWidth??2,onChange:n=>A("lineWidth",Number(n.target.value)),style:{flex:1,accentColor:t.headerBlue}}),a.jsx("span",{style:{width:16,fontSize:12,color:t.text,textAlign:"right"},children:i.lineWidth??2})]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx(Ze,{checked:!!i.showBackground,onChange:n=>A("showBackground",n),label:"Background",tokens:t}),a.jsx(Nt,{value:i.fillColor||"#6aa84f",onChange:n=>A("fillColor",n),onBlur:()=>r("fillColor",i.fillColor,"#6aa84f"),tokens:t}),a.jsx(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(Ze,{checked:!!i.showPrices,onChange:n=>A("showPrices",n),label:"Prices",tokens:t}),a.jsx(Nt,{value:i.pricesColor||"#129f5c",onChange:n=>A("pricesColor",n),onBlur:()=>r("pricesColor",i.pricesColor,"#129f5c"),tokens:t})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:24},children:[a.jsx("span",{style:{fontSize:12,color:t.text,width:60},children:"Rays"}),a.jsx(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 Rh({draft:i,setDraft:e,tokens:t}){const A=(s,o)=>{const l=Number(o);Number.isFinite(l)&&e(c=>({...c,[s]:l}))},r={display:"grid",gridTemplateColumns:"100px 1fr 110px",alignItems:"center",gap:8},n={height:30,width:"100%",border:`1px solid ${t.fieldBorder}`,padding:"0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldDisabledBg,color:t.fieldDisabledText};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"12px 16px"},children:[a.jsxs("div",{style:r,children:[a.jsx("span",{style:{fontSize:12,color:t.text},children:"#1 (Bar, Price)"}),a.jsx("input",{type:"text",readOnly:!0,value:Fi(i.point1Time),style:n}),a.jsx(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:Fi(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 gw(i){if(!i)return{};const e={visibleTimeframes:i.visibleTimeframes||zn.map(t=>t.key)};if(i.type==="trendline"){const t=typeof i.series?.options=="function"?i.series.options():{};return{...e,lineColor:t.color??i.lineColor??"#22c55e",lineWidth:t.lineWidth??i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.point1?.price??0,point1Time:i.point1?.rawTime??i.point1?.time??0,point2Price:i.point2?.price??0,point2Time:i.point2?.rawTime??i.point2?.time??0}}return i.type==="text"?{...e,text:i.primitive?.text??i.text??"Text",color:i.primitive?.color??"#5f8f96",fontSize:i.primitive?.fontSize??12,fontWeight:i.primitive?.fontWeight??"normal",fontStyle:i.primitive?.fontStyle??"normal",textAlign:i.primitive?.textAlign??"center",textWrap:i.primitive?.textWrap??!1,borderEnabled:i.primitive?.borderEnabled??!1,borderColor:i.primitive?.borderColor??"#5f8f96",borderOpacity:i.primitive?.borderOpacity??.1,borderWidth:i.primitive?.borderWidth??1,bgEnabled:i.primitive?.bgEnabled??!1,bgColor:i.primitive?.bgColor??"#5f8f96",bgOpacity:i.primitive?.bgOpacity??.1,price:i.price}:i.type==="pricelevel"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price}:i.type==="horizontalray"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showPrice:i.showPrice??!0,showText:i.showText??!1,textContent:i.textContent??"",textColor:i.textColor??"#ffffff",textHAlign:i.textHAlign??"center",textVAlign:i.textVAlign??"top",price:i.price,originTime:i.rawOriginTime??i.originTime}:i.type==="verticalline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,showDate:i.showDate!==!1,rawTime:i.rawTime}:i.type==="infoline"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!0,statsPriceRange:i.statsPriceRange??!0,statsBarsRange:i.statsBarsRange??!0,statsDateRange:i.statsDateRange??!0,statsAngle:i.statsAngle??!0,statsDistance:i.statsDistance??!0,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="arrowedline"?{...e,lineColor:i.lineColor??"#f59e0b",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight!==!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="rayline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="extendedline"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft!==!1,rayRight:i.rayRight!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsBarsRange:i.statsBarsRange??!1,statsDateRange:i.statsDateRange??!1,statsAngle:i.statsAngle??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="crossline"?{...e,lineColor:i.lineColor??"#06a0e3",lineWidth:i.lineWidth??2,showTime:i.showTime??!1,showPrice:i.showPrice??!1,rawTime:i.p?.rawTime??0,price:i.p?.price??0}:i.type==="trendbyangle"?{...e,lineColor:i.lineColor??"#7aa6ae",lineWidth:i.lineWidth??2,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways??!1,statsPriceRange:i.statsPriceRange??!1,statsDistance:i.statsDistance??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:i.type==="disjointchannel"?{...e,lineColor:i.lineColor??"#129f5c",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#6aa84f",fillOpacity:i.fillOpacity??.1,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#129f5c",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="flattopbottom"?{...e,lineColor:i.lineColor??"#3b82f6",lineWidth:i.lineWidth??2,fillColor:i.fillColor??"#3b82f6",fillOpacity:i.fillOpacity??.12,showBackground:i.showBackground!==!1,showPrices:i.showPrices!==!1,pricesColor:i.pricesColor??"#3b82f6",rayLeft:i.rayLeft??!1,rayRight:i.rayRight??!1,arrowLeft:i.arrowLeft??!1,arrowRight:i.arrowRight??!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p3?.price??0,point2Time:i.p3?.rawTime??0,point3Price:i.p2?.price??0}:i.type==="rulerline"?{...e,lineColor:i.lineColor??"#3b82f6",showArea:i.showArea!==!1,statsColor:i.statsColor??"#5f8f96",statsPosition:i.statsPosition??"right",statsShowAlways:i.statsShowAlways!==!1,statsPriceRange:i.statsPriceRange!==!1,statsBarsRange:i.statsBarsRange!==!1,statsDateRange:i.statsDateRange!==!1,point1Price:i.p1?.price??0,point1Time:i.p1?.rawTime??0,point2Price:i.p2?.price??0,point2Time:i.p2?.rawTime??0}:e}const Gh=({isOpen:i,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:r}=Vt(),s=Jm(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(gw(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 ne=z.offsetParent,$=ne?ne.getBoundingClientRect():{left:0,top:0},V=z.getBoundingClientRect(),Ae=V.left-$.left,re=V.top-$.top;T.current={startMX:M.clientX,startMY:M.clientY,startX:Ae,startY:re},y({x:Ae,y:re});const he=te=>{const{startMX:ae,startMY:ce,startX:se,startY:le}=T.current;y({x:se+te.clientX-ae,y:le+te.clientY-ce})},Z=()=>{T.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",Z)};if(!i||!t)return null;const U=$m[t.type]||t.type,F=["style","coordinates","visualization"],E=()=>{if(o==="visualization")return a.jsx(rw,{draft:c,setDraft:u,tokens:s});if(t.type==="text"){if(o==="style")return a.jsx(nw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(aw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="pricelevel"){if(o==="style")return a.jsx(zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(lw,{draft:c,setDraft:u,tokens:s})}if(t.type==="horizontalray"){if(o==="style")return a.jsx(zh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(cw,{draft:c,setDraft:u,tokens:s})}if(t.type==="verticalline"){if(o==="style")return a.jsx(hw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(uw,{draft:c,tokens:s})}if(t.type==="infoline"){if(o==="style")return a.jsx(ow,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="rulerline"){if(o==="style")return a.jsx(sw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="arrowedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="rayline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="extendedline"){if(o==="style")return a.jsx(Wn,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="crossline"){if(o==="style")return a.jsx(pw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(fw,{draft:c,setDraft:u,tokens:s})}if(t.type==="trendbyangle"){if(o==="style")return a.jsx(dw,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Ui,{draft:c,setDraft:u,tokens:s})}if(t.type==="disjointchannel"){if(o==="style")return a.jsx(Wh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Rh,{draft:c,setDraft:u,tokens:s})}if(t.type==="flattopbottom"){if(o==="style")return a.jsx(Wh,{draft:c,setDraft:u,tokens:s});if(o==="coordinates")return a.jsx(Rh,{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(ea,{size:"18px",children:a.jsx(Zm,{})})})]})}),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(ea,{size:"20px",children:a.jsx(Ym,{})})})]}),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 ta=function(i,e){return ta=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])},ta(i,e)};function LA(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ta(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Aa=function(){return Aa=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},Aa.apply(this,arguments)};function tA(i,e,t,A){function r(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(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 Jt(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 Rn(i,e,t){if(arguments.length===2)for(var A=0,r=e.length,n;A<r;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return i.concat(n||e)}for(var jA=(function(){function i(e,t,A,r){this.left=e,this.top=t,this.width=A,this.height=r}return i.prototype.add=function(e,t,A,r){return new i(this.left+e,this.top+t,this.width+A,this.height+r)},i.fromClientRect=function(e,t){return new i(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},i.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(r){return r.width!==0});return A?new i(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):i.EMPTY},i.EMPTY=new i(0,0,0,0),i})(),Gn=function(i,e){return jA.fromClientRect(i,e.getBoundingClientRect())},mw=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 jA(0,0,A,r)},$n=function(i){for(var e=[],t=0,A=i.length;t<A;){var r=i.charCodeAt(t++);if(r>=55296&&r<=56319&&t<A){var n=i.charCodeAt(t++);(n&64512)===56320?e.push(((r&1023)<<10)+(n&1023)+65536):(e.push(r),t--)}else e.push(r)}return e},Ht=function(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,i);var t=i.length;if(!t)return"";for(var A=[],r=-1,n="";++r<t;){var s=i[r];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(r+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},$h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ww=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<$h.length;Xn++)ww[$h.charCodeAt(Xn)]=Xn;for(var Xh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Jn=0;Jn<Xh.length;Jn++)Fr[Xh.charCodeAt(Jn)]=Jn;for(var Bw=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=Fr[i.charCodeAt(A)],s=Fr[i.charCodeAt(A+1)],o=Fr[i.charCodeAt(A+2)],l=Fr[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},yw=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},Si=5,ia=11,ra=2,vw=ia-Si,Jh=65536>>Si,Tw=1<<Si,na=Tw-1,xw=1024>>Si,bw=Jh+xw,Qw=bw,Fw=32,Uw=Qw+Fw,Sw=65536>>ia,Ew=1<<vw,Lw=Ew-1,Zh=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},Mw=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},Hw=function(i,e){var t=Bw(i),A=Array.isArray(t)?Cw(t):new Uint32Array(t),r=Array.isArray(t)?yw(t):new Uint16Array(t),n=24,s=Zh(r,n/2,A[4]/2),o=A[5]===2?Zh(r,(n+A[4])/2):Mw(A,Math.ceil((n+A[4])/4));return new Iw(A[0],A[1],A[2],A[3],s,o)},Iw=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Si],t=(t<<ra)+(e&na),this.data[t];if(e<=65535)return t=this.index[Jh+(e-55296>>Si)],t=(t<<ra)+(e&na),this.data[t];if(e<this.highStart)return t=Uw-Sw+(e>>ia),t=this.index[t],t+=e>>Si&Lw,t=this.index[t],t=(t<<ra)+(e&na),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),Yh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dw=typeof Uint8Array>"u"?[]:new Uint8Array(256),Zn=0;Zn<Yh.length;Zn++)Dw[Yh.charCodeAt(Zn)]=Zn;var _w="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==",qh=50,Pw=1,jh=2,eu=3,kw=4,Nw=5,tu=7,Au=8,iu=9,oi=10,sa=11,ru=12,oa=13,Ow=14,Ur=15,aa=16,Yn=17,Sr=18,Kw=19,nu=20,la=21,Er=22,ca=23,Wi=24,pA=25,Lr=26,Mr=27,Ri=28,Vw=29,Ei=30,zw=31,qn=32,jn=33,ha=34,ua=35,da=36,Hr=37,pa=38,es=39,ts=40,fa=41,su=42,Ww=43,Rw=[9001,65288],ou="!",lt="×",As="÷",ga=Hw(_w),ei=[Ei,da],ma=[Pw,jh,eu,Nw],au=[oi,Au],lu=[Mr,Lr],Gw=ma.concat(au),cu=[pa,es,ts,ha,ua],$w=[Ur,oa],Xw=function(i,e){e===void 0&&(e="strict");var t=[],A=[],r=[];return i.forEach(function(n,s){var o=ga.get(n);if(o>qh?(r.push(!0),o-=qh):r.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(aa);if(o===kw||o===sa){if(s===0)return A.push(s),t.push(Ei);var l=t[s-1];return Gw.indexOf(l)===-1?(A.push(A[s-1]),t.push(l)):(A.push(s),t.push(Ei))}if(A.push(s),o===zw)return t.push(e==="strict"?la:Hr);if(o===su||o===Vw)return t.push(Ei);if(o===Ww)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(Hr):t.push(Ei);t.push(o)}),[A,t,r]},wa=function(i,e,t,A){var r=A[t];if(Array.isArray(i)?i.indexOf(r)!==-1:i===r)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==oi)break}if(r===oi)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(i)?i.indexOf(o)!==-1:i===o)for(var l=t;l<=A.length;){l++;var s=A[l];if(s===e)return!0;if(s!==oi)break}if(o!==oi)break}return!1},hu=function(i,e){for(var t=i;t>=0;){var A=e[t];if(A===oi)t--;else return A}return 0},Jw=function(i,e,t,A,r){if(t[A]===0)return lt;var n=A-1;if(Array.isArray(r)&&r[n]===!0)return lt;var s=n-1,o=n+1,l=e[n],c=s>=0?e[s]:0,u=e[o];if(l===jh&&u===eu)return lt;if(ma.indexOf(l)!==-1)return ou;if(ma.indexOf(u)!==-1||au.indexOf(u)!==-1)return lt;if(hu(n,e)===Au)return As;if(ga.get(i[n])===sa||(l===qn||l===jn)&&ga.get(i[o])===sa||l===tu||u===tu||l===iu||[oi,oa,Ur].indexOf(l)===-1&&u===iu||[Yn,Sr,Kw,Wi,Ri].indexOf(u)!==-1||hu(n,e)===Er||wa(ca,Er,n,e)||wa([Yn,Sr],la,n,e)||wa(ru,ru,n,e))return lt;if(l===oi)return As;if(l===ca||u===ca)return lt;if(u===aa||l===aa)return As;if([oa,Ur,la].indexOf(u)!==-1||l===Ow||c===da&&$w.indexOf(l)!==-1||l===Ri&&u===da||u===nu||ei.indexOf(u)!==-1&&l===pA||ei.indexOf(l)!==-1&&u===pA||l===Mr&&[Hr,qn,jn].indexOf(u)!==-1||[Hr,qn,jn].indexOf(l)!==-1&&u===Lr||ei.indexOf(l)!==-1&&lu.indexOf(u)!==-1||lu.indexOf(l)!==-1&&ei.indexOf(u)!==-1||[Mr,Lr].indexOf(l)!==-1&&(u===pA||[Er,Ur].indexOf(u)!==-1&&e[o+1]===pA)||[Er,Ur].indexOf(l)!==-1&&u===pA||l===pA&&[pA,Ri,Wi].indexOf(u)!==-1)return lt;if([pA,Ri,Wi,Yn,Sr].indexOf(u)!==-1)for(var m=n;m>=0;){var y=e[m];if(y===pA)return lt;if([Ri,Wi].indexOf(y)!==-1)m--;else break}if([Mr,Lr].indexOf(u)!==-1)for(var m=[Yn,Sr].indexOf(l)!==-1?s:n;m>=0;){var y=e[m];if(y===pA)return lt;if([Ri,Wi].indexOf(y)!==-1)m--;else break}if(pa===l&&[pa,es,ha,ua].indexOf(u)!==-1||[es,ha].indexOf(l)!==-1&&[es,ts].indexOf(u)!==-1||[ts,ua].indexOf(l)!==-1&&u===ts||cu.indexOf(l)!==-1&&[nu,Lr].indexOf(u)!==-1||cu.indexOf(u)!==-1&&l===Mr||ei.indexOf(l)!==-1&&ei.indexOf(u)!==-1||l===Wi&&ei.indexOf(u)!==-1||ei.concat(pA).indexOf(l)!==-1&&u===Er&&Rw.indexOf(i[o])===-1||ei.concat(pA).indexOf(u)!==-1&&l===Sr)return lt;if(l===fa&&u===fa){for(var v=t[n],T=1;v>0&&(v--,e[v]===fa);)T++;if(T%2!==0)return lt}return l===qn&&u===jn?lt:As},Zw=function(i,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Xw(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[pA,Ei,su].indexOf(o)!==-1?Hr: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]},Yw=(function(){function i(e,t,A,r){this.codePoints=e,this.required=t===ou,this.start=A,this.end=r}return i.prototype.slice=function(){return Ht.apply(void 0,this.codePoints.slice(this.start,this.end))},i})(),qw=function(i,e){var t=$n(i),A=Zw(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=lt;c<o&&(u=Jw(t,n,r,++c,s))===lt;);if(u!==lt||c===o){var m=new Yw(t,u,l,c);return l=c,{value:m,done:!1}}return{done:!0,value:null}}}},jw=1,eB=2,Ir=4,uu=8,is=10,du=47,Dr=92,tB=9,AB=32,rs=34,_r=61,iB=35,rB=36,nB=37,ns=39,ss=40,Pr=41,sB=95,oA=45,oB=33,aB=60,lB=62,cB=64,hB=91,uB=93,dB=61,pB=123,os=63,fB=125,pu=124,gB=126,mB=128,fu=65533,Ba=42,Li=43,wB=44,BB=58,yB=59,kr=46,CB=0,vB=8,TB=11,xB=14,bB=31,QB=127,KA=-1,gu=48,mu=97,wu=101,FB=102,UB=117,SB=122,Bu=65,yu=69,Cu=70,EB=85,LB=90,Zt=function(i){return i>=gu&&i<=57},MB=function(i){return i>=55296&&i<=57343},Gi=function(i){return Zt(i)||i>=Bu&&i<=Cu||i>=mu&&i<=FB},HB=function(i){return i>=mu&&i<=SB},IB=function(i){return i>=Bu&&i<=LB},DB=function(i){return HB(i)||IB(i)},_B=function(i){return i>=mB},as=function(i){return i===is||i===tB||i===AB},ls=function(i){return DB(i)||_B(i)||i===sB},vu=function(i){return ls(i)||Zt(i)||i===oA},PB=function(i){return i>=CB&&i<=vB||i===TB||i>=xB&&i<=bB||i===QB},ai=function(i,e){return i!==Dr?!1:e!==is},cs=function(i,e,t){return i===oA?ls(e)||ai(e,t):ls(i)?!0:!!(i===Dr&&ai(i,e))},ya=function(i,e,t){return i===Li||i===oA?Zt(e)?!0:e===kr&&Zt(t):Zt(i===kr?e:i)},kB=function(i){var e=0,t=1;(i[e]===Li||i[e]===oA)&&(i[e]===oA&&(t=-1),e++);for(var A=[];Zt(i[e]);)A.push(i[e++]);var r=A.length?parseInt(Ht.apply(void 0,A),10):0;i[e]===kr&&e++;for(var n=[];Zt(i[e]);)n.push(i[e++]);var s=n.length,o=s?parseInt(Ht.apply(void 0,n),10):0;(i[e]===yu||i[e]===wu)&&e++;var l=1;(i[e]===Li||i[e]===oA)&&(i[e]===oA&&(l=-1),e++);for(var c=[];Zt(i[e]);)c.push(i[e++]);var u=c.length?parseInt(Ht.apply(void 0,c),10):0;return t*(r+o*Math.pow(10,-s))*Math.pow(10,l*u)},NB={type:2},OB={type:3},KB={type:4},VB={type:13},zB={type:8},WB={type:21},RB={type:9},GB={type:10},$B={type:11},XB={type:12},JB={type:14},hs={type:23},ZB={type:1},YB={type:25},qB={type:24},jB={type:26},e2={type:27},t2={type:28},A2={type:29},i2={type:31},Ca={type:32},Tu=(function(){function i(){this._value=[]}return i.prototype.write=function(e){this._value=this._value.concat($n(e))},i.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Ca;)e.push(t),t=this.consumeToken();return e},i.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case rs:return this.consumeStringToken(rs);case iB:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(vu(t)||ai(A,r)){var n=cs(t,A,r)?eB:jw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case rB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),VB;break;case ns:return this.consumeStringToken(ns);case ss:return NB;case Pr:return OB;case Ba:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),JB;break;case Li:if(ya(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case wB:return KB;case oA:var o=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(ya(o,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(cs(o,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===oA&&c===lB)return this.consumeCodePoint(),this.consumeCodePoint(),qB;break;case kr:if(ya(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case du:if(this.peekCodePoint(0)===Ba)for(this.consumeCodePoint();;){var u=this.consumeCodePoint();if(u===Ba&&(u=this.consumeCodePoint(),u===du))return this.consumeToken();if(u===KA)return this.consumeToken()}break;case BB:return jB;case yB:return e2;case aB:if(this.peekCodePoint(0)===oB&&this.peekCodePoint(1)===oA&&this.peekCodePoint(2)===oA)return this.consumeCodePoint(),this.consumeCodePoint(),YB;break;case cB:var m=this.peekCodePoint(0),y=this.peekCodePoint(1),v=this.peekCodePoint(2);if(cs(m,y,v)){var s=this.consumeName();return{type:7,value:s}}break;case hB:return t2;case Dr:if(ai(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case uB:return A2;case dB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),zB;break;case pB:return $B;case fB:return XB;case UB:case EB:var T=this.peekCodePoint(0),C=this.peekCodePoint(1);return T===Li&&(Gi(C)||C===os)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case pu:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),RB;if(this.peekCodePoint(0)===pu)return this.consumeCodePoint(),WB;break;case gB:if(this.peekCodePoint(0)===_r)return this.consumeCodePoint(),GB;break;case KA:return Ca}return as(e)?(this.consumeWhiteSpace(),i2):Zt(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):ls(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Ht(e)}},i.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},i.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},i.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},i.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Gi(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===os&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var r=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?gu:l})),16),n=parseInt(Ht.apply(void 0,e.map(function(l){return l===os?Cu:l})),16);return{type:30,start:r,end:n}}var s=parseInt(Ht.apply(void 0,e),16);if(this.peekCodePoint(0)===oA&&Gi(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];Gi(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(Ht.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},i.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ss?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ss?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},i.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ns||t===rs){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Pr)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),hs)}for(;;){var r=this.consumeCodePoint();if(r===KA||r===Pr)return{type:22,value:Ht.apply(void 0,e)};if(as(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===KA||this.peekCodePoint(0)===Pr?(this.consumeCodePoint(),{type:22,value:Ht.apply(void 0,e)}):(this.consumeBadUrlRemnants(),hs);if(r===rs||r===ns||r===ss||PB(r))return this.consumeBadUrlRemnants(),hs;if(r===Dr)if(ai(r,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),hs;else e.push(r)}},i.prototype.consumeWhiteSpace=function(){for(;as(this.peekCodePoint(0));)this.consumeCodePoint()},i.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Pr||e===KA)return;ai(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},i.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var r=Math.min(t,e);A+=Ht.apply(void 0,this._value.splice(0,r)),e-=r}return this._value.shift(),A},i.prototype.consumeStringToken=function(e){var t="",A=0;do{var r=this._value[A];if(r===KA||r===void 0||r===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(r===is)return this._value.splice(0,A),ZB;if(r===Dr){var n=this._value[A+1];n!==KA&&n!==void 0&&(n===is?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):ai(r,n)&&(t+=this.consumeStringSlice(A),t+=Ht(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},i.prototype.consumeNumber=function(){var e=[],t=Ir,A=this.peekCodePoint(0);for((A===Li||A===oA)&&e.push(this.consumeCodePoint());Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(A===kr&&Zt(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uu;Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===yu||A===wu)&&((r===Li||r===oA)&&Zt(n)||Zt(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uu;Zt(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[kB(e),t]},i.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(cs(r,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return r===nB?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},i.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Gi(e)){for(var t=Ht(e);Gi(this.peekCodePoint(0))&&t.length<6;)t+=Ht(this.consumeCodePoint());as(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||MB(A)||A>1114111?fu:A}return e===KA?fu:e},i.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(vu(t))e+=Ht(t);else if(ai(t,this.peekCodePoint(0)))e+=Ht(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},i})(),xu=(function(){function i(e){this._tokens=e}return i.create=function(e){var t=new Tu;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||n2(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"?Ca:e},i.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},i})(),Nr=function(i){return i.type===15},$i=function(i){return i.type===17},mt=function(i){return i.type===20},r2=function(i){return i.type===0},va=function(i,e){return mt(i)&&i.value===e},bu=function(i){return i.type!==31},Xi=function(i){return i.type!==31&&i.type!==4},VA=function(i){var e=[],t=[];return i.forEach(function(A){if(A.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}A.type!==31&&t.push(A)}),t.length&&e.push(t),e},n2=function(i,e){return e===11&&i.type===12||e===28&&i.type===29?!0:e===2&&i.type===3},li=function(i){return i.type===17||i.type===15},Pt=function(i){return i.type===16||li(i)},Qu=function(i){return i.length>1?[i[0],i[1]]:[i[0]]},zt={type:17,number:0,flags:Ir},Ta={type:16,number:50,flags:Ir},ci={type:16,number:100,flags:Ir},Or=function(i,e,t){var A=i[0],r=i[1];return[vt(A,e),vt(typeof r<"u"?r:A,t)]},vt=function(i,e){if(i.type===16)return i.number/100*e;if(Nr(i))switch(i.unit){case"rem":case"em":return 16*i.number;default:return i.number}return i.number},Fu="deg",Uu="grad",Su="rad",Eu="turn",us={name:"angle",parse:function(i,e){if(e.type===15)switch(e.unit){case Fu:return Math.PI*e.number/180;case Uu:return Math.PI/200*e.number;case Su:return e.number;case Eu:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},Lu=function(i){return i.type===15&&(i.unit===Fu||i.unit===Uu||i.unit===Su||i.unit===Eu)},Mu=function(i){var e=i.filter(mt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[zt,zt];case"to top":case"bottom":return vA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[zt,ci];case"to right":case"left":return vA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ci,ci];case"to bottom":case"top":return vA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ci,zt];case"to left":case"right":return vA(270)}return 0},vA=function(i){return Math.PI*i/180},hi={name:"color",parse:function(i,e){if(e.type===18){var t=s2[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 di(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 di(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 di(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 di(parseInt(A,16),parseInt(r,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=ti[e.value.toUpperCase()];if(typeof o<"u")return o}return ti.TRANSPARENT}},ui=function(i){return(255&i)===0},Ot=function(i){var e=255&i,t=255&i>>8,A=255&i>>16,r=255&i>>24;return e<255?"rgba("+r+","+A+","+t+","+e/255+")":"rgb("+r+","+A+","+t+")"},di=function(i,e,t,A){return(i<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},Hu=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},Iu=function(i,e){var t=e.filter(Xi);if(t.length===3){var A=t.map(Hu),r=A[0],n=A[1],s=A[2];return di(r,n,s,1)}if(t.length===4){var o=t.map(Hu),r=o[0],n=o[1],s=o[2],l=o[3];return di(r,n,s,l)}return 0};function xa(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 Du=function(i,e){var t=e.filter(Xi),A=t[0],r=t[1],n=t[2],s=t[3],o=(A.type===17?vA(A.number):us.parse(i,A))/(Math.PI*2),l=Pt(r)?r.number/100:0,c=Pt(n)?n.number/100:0,u=typeof s<"u"&&Pt(s)?vt(s,1):1;if(l===0)return di(c*255,c*255,c*255,1);var m=c<=.5?c*(l+1):c+l-c*l,y=c*2-m,v=xa(y,m,o+1/3),T=xa(y,m,o),C=xa(y,m,o-1/3);return di(v*255,T*255,C*255,u)},s2={hsl:Du,hsla:Du,rgb:Iu,rgba:Iu},Kr=function(i,e){return hi.parse(i,xu.create(e).parseComponentValue())},ti={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},o2={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(mt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},a2={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ds=function(i,e){var t=hi.parse(i,e[0]),A=e[1];return A&&Pt(A)?{color:t,stop:A}:{color:t,stop:null}},_u=function(i,e){var t=i[0],A=i[i.length-1];t.stop===null&&(t.stop=zt),A.stop===null&&(A.stop=ci);for(var r=[],n=0,s=0;s<i.length;s++){var o=i[s].stop;if(o!==null){var l=vt(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)}})},l2=function(i,e,t){var A=e/2,r=t/2,n=vt(i[0],e)-A,s=r-vt(i[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},c2=function(i,e,t){var A=typeof i=="number"?i:l2(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]},MA=function(i,e){return Math.sqrt(i*i+e*e)},Pu=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=MA(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},h2=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(MA(e,t),MA(e,t-r),MA(e-A,t),MA(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=Pu(A,r,e,t,!0),c=l[0],u=l[1];n=MA(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(MA(e,t),MA(e,t-r),MA(e-A,t),MA(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=Pu(A,r,e,t,!1),c=m[0],u=m[1];n=MA(c-e,(u-t)/o),s=o*n}break}return Array.isArray(i.size)&&(n=vt(i.size[0],A),s=i.size.length===2?vt(i.size[1],r):n),[n,s]},u2=function(i,e){var t=vA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&s.value==="to"){t=Mu(r);return}else if(Lu(s)){t=us.parse(i,s);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},ps=function(i,e){var t=vA(180),A=[];return VA(e).forEach(function(r,n){if(n===0){var s=r[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=Mu(r);return}else if(Lu(s)){t=(us.parse(i,s)+vA(270))%vA(360);return}}var o=ds(i,r);A.push(o)}),{angle:t,stops:A,type:1}},d2=function(i,e){var t=vA(180),A=[],r=1,n=0,s=3,o=[];return VA(e).forEach(function(l,c){var u=l[0];if(c===0){if(mt(u)&&u.value==="linear"){r=1;return}else if(mt(u)&&u.value==="radial"){r=2;return}}if(u.type===18){if(u.name==="from"){var m=hi.parse(i,u.values[0]);A.push({stop:zt,color:m})}else if(u.name==="to"){var m=hi.parse(i,u.values[0]);A.push({stop:ci,color:m})}else if(u.name==="color-stop"){var y=u.values.filter(Xi);if(y.length===2){var m=hi.parse(i,y[1]),v=y[0];$i(v)&&A.push({stop:{type:16,number:v.number*100,flags:v.flags},color:m})}}}}),r===1?{angle:(t+vA(180))%vA(360),stops:A,type:r}:{size:s,shape:n,stops:A,position:o,type:r}},ku="closest-side",Nu="farthest-side",Ou="closest-corner",Ku="farthest-corner",Vu="circle",zu="ellipse",Wu="cover",Ru="contain",p2=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0){var c=!1;l=s.reduce(function(m,y){if(c)if(mt(y))switch(y.value){case"center":return n.push(Ta),m;case"top":case"left":return n.push(zt),m;case"right":case"bottom":return n.push(ci),m}else(Pt(y)||li(y))&&n.push(y);else if(mt(y))switch(y.value){case Vu:return t=0,!1;case zu:return t=1,!1;case"at":return c=!0,!1;case ku:return A=0,!1;case Wu:case Nu:return A=1,!1;case Ru:case Ou:return A=2,!1;case Ku:return A=3,!1}else if(li(y)||Pt(y))return Array.isArray(A)||(A=[]),A.push(y),!1;return m},l)}if(l){var u=ds(i,s);r.push(u)}}),{size:A,shape:t,stops:r,position:n,type:2}},fs=function(i,e){var t=0,A=3,r=[],n=[];return VA(e).forEach(function(s,o){var l=!0;if(o===0?l=s.reduce(function(u,m){if(mt(m))switch(m.value){case"center":return n.push(Ta),!1;case"top":case"left":return n.push(zt),!1;case"right":case"bottom":return n.push(ci),!1}else if(Pt(m)||li(m))return n.push(m),!1;return u},l):o===1&&(l=s.reduce(function(u,m){if(mt(m))switch(m.value){case Vu:return t=0,!1;case zu:return t=1,!1;case Ru:case ku:return A=0,!1;case Nu:return A=1,!1;case Ou:return A=2,!1;case Wu:case Ku:return A=3,!1}else if(li(m)||Pt(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return u},l)),l){var c=ds(i,s);r.push(c)}}),{size:A,shape:t,stops:r,position:n,type:2}},f2=function(i){return i.type===1},g2=function(i){return i.type===2},ba={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=Gu[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 m2(i){return!(i.type===20&&i.value==="none")&&(i.type!==18||!!Gu[i.name])}var Gu={"linear-gradient":u2,"-moz-linear-gradient":ps,"-ms-linear-gradient":ps,"-o-linear-gradient":ps,"-webkit-linear-gradient":ps,"radial-gradient":p2,"-moz-radial-gradient":fs,"-ms-radial-gradient":fs,"-o-radial-gradient":fs,"-webkit-radial-gradient":fs,"-webkit-gradient":d2},w2={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 Xi(A)&&m2(A)}).map(function(A){return ba.parse(i,A)})}},B2={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(i,e){return e.map(function(t){if(mt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},y2={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(i,e){return VA(e).map(function(t){return t.filter(Pt)}).map(Qu)}},C2={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(mt).map(function(A){return A.value}).join(" ")}).map(v2)}},v2=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}},Ji;(function(i){i.AUTO="auto",i.CONTAIN="contain",i.COVER="cover"})(Ji||(Ji={}));var T2={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(i,e){return VA(e).map(function(t){return t.filter(x2)})}},x2=function(i){return mt(i)||Pt(i)},gs=function(i){return{name:"border-"+i+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},b2=gs("top"),Q2=gs("right"),F2=gs("bottom"),U2=gs("left"),ms=function(i){return{name:"border-radius-"+i,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Qu(t.filter(Pt))}}},S2=ms("top-left"),E2=ms("top-right"),L2=ms("bottom-right"),M2=ms("bottom-left"),ws=function(i){return{name:"border-"+i+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},H2=ws("top"),I2=ws("right"),D2=ws("bottom"),_2=ws("left"),Bs=function(i){return{name:"border-"+i+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Nr(t)?t.number:0}}},P2=Bs("top"),k2=Bs("right"),N2=Bs("bottom"),O2=Bs("left"),K2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},V2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(i,e){return e==="rtl"?1:0}},z2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).reduce(function(t,A){return t|W2(A.value)},0)}},W2=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},R2={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}},G2={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(i,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},ys;(function(i){i.NORMAL="normal",i.STRICT="strict"})(ys||(ys={}));var $2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="strict"?ys.STRICT:ys.NORMAL}},X2={name:"line-height",initialValue:"normal",prefix:!1,type:4},$u=function(i,e){return mt(i)&&i.value==="normal"?1.2*e:i.type===17?e*i.number:Pt(i)?vt(i,e):e},J2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(i,e){return e.type===20&&e.value==="none"?null:ba.parse(i,e)}},Z2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(i,e){return e==="inside"?0:1}},Qa={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(i,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Cs=function(i){return{name:"margin-"+i,initialValue:"0",prefix:!1,type:4}},Y2=Cs("top"),q2=Cs("right"),j2=Cs("bottom"),ey=Cs("left"),ty={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).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}})}},Ay={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){return e==="break-word"?"break-word":"normal"}},vs=function(i){return{name:"padding-"+i,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},iy=vs("top"),ry=vs("right"),ny=vs("bottom"),sy=vs("left"),oy={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}}},ay={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}},ly={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&va(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:ti.TRANSPARENT,offsetX:zt,offsetY:zt,blur:zt},r=0,n=0;n<t.length;n++){var s=t[n];li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:A.blur=s,r++):A.color=hi.parse(i,s)}return A})}},cy={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}},hy={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=py[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},uy=function(i){var e=i.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},dy=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},py={matrix:uy,matrix3d:dy},Xu={type:16,number:50,flags:Ir},fy=[Xu,Xu],gy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(i,e){var t=e.filter(Pt);return t.length!==2?fy:[t[0],t[1]]}},my={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}}},Vr;(function(i){i.NORMAL="normal",i.BREAK_ALL="break-all",i.KEEP_ALL="keep-all"})(Vr||(Vr={}));for(var wy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"break-all":return Vr.BREAK_ALL;case"keep-all":return Vr.KEEP_ALL;default:return Vr.NORMAL}}},By={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(i,e){if(e.type===20)return{auto:!0,order:0};if($i(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Ju={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")}},yy={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(i,e){return $i(e)?e.number:1}},Cy={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},vy={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(i,e){return e.filter(mt).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})}},Ty={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+"'"})}},xy={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},by={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(i,e){return $i(e)?e.number:mt(e)&&e.value==="bold"?700:400}},Qy={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.filter(mt).map(function(t){return t.value})}},Fy={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(i,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},kt=function(i,e){return(i&e)!==0},Uy={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}},Sy={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(bu),n=0;n<r.length;n++){var s=r[n],o=r[n+1];if(s.type===20){var l=o&&$i(o)?o.number:1;A.push({counter:s.value,increment:l})}}return A}},Ey={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(i,e){if(e.length===0)return[];for(var t=[],A=e.filter(bu),r=0;r<A.length;r++){var n=A[r],s=A[r+1];if(mt(n)&&n.value!=="none"){var o=s&&$i(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},Ly={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(i,e){return e.filter(Nr).map(function(t){return Ju.parse(i,t)})}},My={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(r2);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}},Zu=function(i,e,t){if(!i)return"";var A=i[Math.min(e,i.length-1)];return A?t?A.open:A.close:""},Hy={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(i,e){return e.length===1&&va(e[0],"none")?[]:VA(e).map(function(t){for(var A={color:255,offsetX:zt,offsetY:zt,blur:zt,spread:zt,inset:!1},r=0,n=0;n<t.length;n++){var s=t[n];va(s,"inset")?A.inset=!0:li(s)?(r===0?A.offsetX=s:r===1?A.offsetY=s:r===2?A.blur=s:A.spread=s,r++):A.color=hi.parse(i,s)}return A})}},Iy={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(i,e){var t=[0,1,2],A=[];return e.filter(mt).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}},Dy={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},_y={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(i,e){return Nr(e)?e.number:0}},Py=(function(){function i(e,t){var A,r;this.animationDuration=He(e,Ly,t.animationDuration),this.backgroundClip=He(e,o2,t.backgroundClip),this.backgroundColor=He(e,a2,t.backgroundColor),this.backgroundImage=He(e,w2,t.backgroundImage),this.backgroundOrigin=He(e,B2,t.backgroundOrigin),this.backgroundPosition=He(e,y2,t.backgroundPosition),this.backgroundRepeat=He(e,C2,t.backgroundRepeat),this.backgroundSize=He(e,T2,t.backgroundSize),this.borderTopColor=He(e,b2,t.borderTopColor),this.borderRightColor=He(e,Q2,t.borderRightColor),this.borderBottomColor=He(e,F2,t.borderBottomColor),this.borderLeftColor=He(e,U2,t.borderLeftColor),this.borderTopLeftRadius=He(e,S2,t.borderTopLeftRadius),this.borderTopRightRadius=He(e,E2,t.borderTopRightRadius),this.borderBottomRightRadius=He(e,L2,t.borderBottomRightRadius),this.borderBottomLeftRadius=He(e,M2,t.borderBottomLeftRadius),this.borderTopStyle=He(e,H2,t.borderTopStyle),this.borderRightStyle=He(e,I2,t.borderRightStyle),this.borderBottomStyle=He(e,D2,t.borderBottomStyle),this.borderLeftStyle=He(e,_2,t.borderLeftStyle),this.borderTopWidth=He(e,P2,t.borderTopWidth),this.borderRightWidth=He(e,k2,t.borderRightWidth),this.borderBottomWidth=He(e,N2,t.borderBottomWidth),this.borderLeftWidth=He(e,O2,t.borderLeftWidth),this.boxShadow=He(e,Hy,t.boxShadow),this.color=He(e,K2,t.color),this.direction=He(e,V2,t.direction),this.display=He(e,z2,t.display),this.float=He(e,R2,t.cssFloat),this.fontFamily=He(e,Ty,t.fontFamily),this.fontSize=He(e,xy,t.fontSize),this.fontStyle=He(e,Fy,t.fontStyle),this.fontVariant=He(e,Qy,t.fontVariant),this.fontWeight=He(e,by,t.fontWeight),this.letterSpacing=He(e,G2,t.letterSpacing),this.lineBreak=He(e,$2,t.lineBreak),this.lineHeight=He(e,X2,t.lineHeight),this.listStyleImage=He(e,J2,t.listStyleImage),this.listStylePosition=He(e,Z2,t.listStylePosition),this.listStyleType=He(e,Qa,t.listStyleType),this.marginTop=He(e,Y2,t.marginTop),this.marginRight=He(e,q2,t.marginRight),this.marginBottom=He(e,j2,t.marginBottom),this.marginLeft=He(e,ey,t.marginLeft),this.opacity=He(e,yy,t.opacity);var n=He(e,ty,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=He(e,Ay,t.overflowWrap),this.paddingTop=He(e,iy,t.paddingTop),this.paddingRight=He(e,ry,t.paddingRight),this.paddingBottom=He(e,ny,t.paddingBottom),this.paddingLeft=He(e,sy,t.paddingLeft),this.paintOrder=He(e,Iy,t.paintOrder),this.position=He(e,ay,t.position),this.textAlign=He(e,oy,t.textAlign),this.textDecorationColor=He(e,Cy,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=He(e,vy,(r=t.textDecorationLine)!==null&&r!==void 0?r:t.textDecoration),this.textShadow=He(e,ly,t.textShadow),this.textTransform=He(e,cy,t.textTransform),this.transform=He(e,hy,t.transform),this.transformOrigin=He(e,gy,t.transformOrigin),this.visibility=He(e,my,t.visibility),this.webkitTextStrokeColor=He(e,Dy,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=He(e,_y,t.webkitTextStrokeWidth),this.wordBreak=He(e,wy,t.wordBreak),this.zIndex=He(e,By,t.zIndex)}return i.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},i.prototype.isTransparent=function(){return ui(this.backgroundColor)},i.prototype.isTransformed=function(){return this.transform!==null},i.prototype.isPositioned=function(){return this.position!==0},i.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},i.prototype.isFloating=function(){return this.float!==0},i.prototype.isInlineLevel=function(){return kt(this.display,4)||kt(this.display,33554432)||kt(this.display,268435456)||kt(this.display,536870912)||kt(this.display,67108864)||kt(this.display,134217728)},i})(),ky=(function(){function i(e,t){this.content=He(e,Uy,t.content),this.quotes=He(e,My,t.quotes)}return i})(),Yu=(function(){function i(e,t){this.counterIncrement=He(e,Sy,t.counterIncrement),this.counterReset=He(e,Ey,t.counterReset)}return i})(),He=function(i,e,t){var A=new Tu,r=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(r);var n=new xu(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(i,mt(s)?s.value:e.initialValue);case 0:return e.parse(i,n.parseComponentValue());case 1:return e.parse(i,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return us.parse(i,n.parseComponentValue());case"color":return hi.parse(i,n.parseComponentValue());case"image":return ba.parse(i,n.parseComponentValue());case"length":var o=n.parseComponentValue();return li(o)?o:zt;case"length-percentage":var l=n.parseComponentValue();return Pt(l)?l:zt;case"time":return Ju.parse(i,n.parseComponentValue())}break}},Ny="data-html2canvas-debug",Oy=function(i){var e=i.getAttribute(Ny);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=Oy(i);return t===1||e===t},zA=(function(){function i(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,Fa(t,3))debugger;this.styles=new Py(e,window.getComputedStyle(t,null)),Ka(t)&&(this.styles.animationDuration.some(function(A){return A>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=Gn(this.context,t),Fa(t,4)&&(this.flags|=16)}return i})(),Ky="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",qu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zr=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ts=0;Ts<qu.length;Ts++)zr[qu.charCodeAt(Ts)]=Ts;for(var Vy=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=zr[i.charCodeAt(A)],s=zr[i.charCodeAt(A+1)],o=zr[i.charCodeAt(A+2)],l=zr[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},zy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=2)t.push(i[A+1]<<8|i[A]);return t},Wy=function(i){for(var e=i.length,t=[],A=0;A<e;A+=4)t.push(i[A+3]<<24|i[A+2]<<16|i[A+1]<<8|i[A]);return t},Mi=5,Ua=11,Sa=2,Ry=Ua-Mi,ju=65536>>Mi,Gy=1<<Mi,Ea=Gy-1,$y=1024>>Mi,Xy=ju+$y,Jy=Xy,Zy=32,Yy=Jy+Zy,qy=65536>>Ua,jy=1<<Ry,eC=jy-1,ed=function(i,e,t){return i.slice?i.slice(e,t):new Uint16Array(Array.prototype.slice.call(i,e,t))},tC=function(i,e,t){return i.slice?i.slice(e,t):new Uint32Array(Array.prototype.slice.call(i,e,t))},AC=function(i,e){var t=Vy(i),A=Array.isArray(t)?Wy(t):new Uint32Array(t),r=Array.isArray(t)?zy(t):new Uint16Array(t),n=24,s=ed(r,n/2,A[4]/2),o=A[5]===2?ed(r,(n+A[4])/2):tC(A,Math.ceil((n+A[4])/4));return new iC(A[0],A[1],A[2],A[3],s,o)},iC=(function(){function i(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return i.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Mi],t=(t<<Sa)+(e&Ea),this.data[t];if(e<=65535)return t=this.index[ju+(e-55296>>Mi)],t=(t<<Sa)+(e&Ea),this.data[t];if(e<this.highStart)return t=Yy-qy+(e>>Ua),t=this.index[t],t+=e>>Mi&eC,t=this.index[t],t=(t<<Sa)+(e&Ea),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},i})(),td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rC=typeof Uint8Array>"u"?[]:new Uint8Array(256),xs=0;xs<td.length;xs++)rC[td.charCodeAt(xs)]=xs;var nC=1,La=2,Ma=3,Ad=4,id=5,sC=7,rd=8,Ha=9,Ia=10,nd=11,sd=12,od=13,ad=14,Da=15,oC=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},aC=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},lC=AC(Ky),TA="×",_a="÷",cC=function(i){return lC.get(i)},hC=function(i,e,t){var A=t-2,r=e[A],n=e[t-1],s=e[t];if(n===La&&s===Ma)return TA;if(n===La||n===Ma||n===Ad||s===La||s===Ma||s===Ad)return _a;if(n===rd&&[rd,Ha,nd,sd].indexOf(s)!==-1||(n===nd||n===Ha)&&(s===Ha||s===Ia)||(n===sd||n===Ia)&&s===Ia||s===od||s===id||s===sC||n===nC)return TA;if(n===od&&s===ad){for(;r===id;)r=e[--A];if(r===ad)return TA}if(n===Da&&s===Da){for(var o=0;r===Da;)o++,r=e[--A];if(o%2===0)return TA}return _a},uC=function(i){var e=oC(i),t=e.length,A=0,r=0,n=e.map(cC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=TA;A<t&&(s=hC(e,n,++A))===TA;);if(s!==TA||A===t){var o=aC.apply(null,e.slice(r,A));return r=A,{value:o,done:!1}}return{done:!0,value:null}}}},dC=function(i){for(var e=uC(i),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},pC=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},fC=function(i){var e=i.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",i.body.appendChild(e);var t=i.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,r=$n(A.data).map(function(l){return Ht(l)}),n=0,s={},o=r.every(function(l,c){t.setStart(A,n),t.setEnd(A,n+l.length);var 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},gC=function(){return typeof new Image().crossOrigin<"u"},mC=function(){return typeof new XMLHttpRequest().responseType=="string"},wC=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},ld=function(i){return i[0]===0&&i[1]===255&&i[2]===0&&i[3]===255},BC=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=Pa(t,t,0,0,r);return A.fillStyle="red",A.fillRect(0,0,t,t),cd(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",ld(l)?cd(Pa(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),ld(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},Pa=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},cd=function(i){return new Promise(function(e,t){var A=new Image;A.onload=function(){return e(A)},A.onerror=t,A.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(i))})},Wt={get SUPPORT_RANGE_BOUNDS(){var i=pC(document);return Object.defineProperty(Wt,"SUPPORT_RANGE_BOUNDS",{value:i}),i},get SUPPORT_WORD_BREAKING(){var i=Wt.SUPPORT_RANGE_BOUNDS&&fC(document);return Object.defineProperty(Wt,"SUPPORT_WORD_BREAKING",{value:i}),i},get SUPPORT_SVG_DRAWING(){var i=wC(document);return Object.defineProperty(Wt,"SUPPORT_SVG_DRAWING",{value:i}),i},get SUPPORT_FOREIGNOBJECT_DRAWING(){var i=typeof Array.from=="function"&&typeof window.fetch=="function"?BC(document):Promise.resolve(!1);return Object.defineProperty(Wt,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:i}),i},get SUPPORT_CORS_IMAGES(){var i=gC();return Object.defineProperty(Wt,"SUPPORT_CORS_IMAGES",{value:i}),i},get SUPPORT_RESPONSE_TYPE(){var i=mC();return Object.defineProperty(Wt,"SUPPORT_RESPONSE_TYPE",{value:i}),i},get SUPPORT_CORS_XHR(){var i="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wt,"SUPPORT_CORS_XHR",{value:i}),i},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var i=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wt,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:i}),i}},Wr=(function(){function i(e,t){this.text=e,this.bounds=t}return i})(),yC=function(i,e,t,A){var r=TC(e,t),n=[],s=0;return r.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Wt.SUPPORT_RANGE_BOUNDS){var l=hd(A,s,o.length).getClientRects();if(l.length>1){var c=ka(o),u=0;c.forEach(function(y){n.push(new Wr(y,jA.fromDOMRectList(i,hd(A,u+s,y.length).getClientRects()))),u+=y.length})}else n.push(new Wr(o,jA.fromDOMRectList(i,l)))}else{var m=A.splitText(o.length);n.push(new Wr(o,CC(i,A))),A=m}else Wt.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=Gn(i,A);return A.firstChild&&r.replaceChild(A.firstChild,A),n}}return jA.EMPTY},hd=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},ka=function(i){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(i)).map(function(t){return t.segment})}return dC(i)},vC=function(i,e){if(Wt.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(i)).map(function(A){return A.segment})}return bC(i,e)},TC=function(i,e){return e.letterSpacing!==0?ka(i):vC(i,e)},xC=[32,160,4961,65792,65793,4153,4241],bC=function(i,e){for(var t=qw(i,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],r,n=function(){if(r.value){var s=r.value.slice(),o=$n(s),l="";o.forEach(function(c){xC.indexOf(c)===-1?l+=Ht(c):(l.length&&A.push(l),A.push(Ht(c)),l="")}),l.length&&A.push(l)}};!(r=t.next()).done;)n();return A},QC=(function(){function i(e,t,A){this.text=FC(t.data,A.textTransform),this.textBounds=yC(e,this.text,A,t)}return i})(),FC=function(i,e){switch(e){case 1:return i.toLowerCase();case 3:return i.replace(UC,SC);case 2:return i.toUpperCase();default:return i}},UC=/(^|\s|:|-|\(|\))([a-z])/g,SC=function(i,e,t){return i.length>0?e+t.toUpperCase():i},ud=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return e})(zA),dd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return e})(zA),pd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=new XMLSerializer,s=Gn(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return e})(zA),fd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Na=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.start=A.start,r.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,r}return e})(zA),EC=[{type:15,flags:0,unit:"px",number:3}],LC=[{type:16,flags:0,number:50}],MC=function(i){return i.width>i.height?new jA(i.left+(i.width-i.height)/2,i.top,i.height,i.height):i.width<i.height?new jA(i.left,i.top+(i.height-i.width)/2,i.width,i.width):i},HC=function(i){var e=i.type===IC?new Array(i.value.length+1).join("•"):i.value;return e.length===0?i.placeholder||"":e},bs="checkbox",Qs="radio",IC="password",gd=707406591,Oa=(function(i){LA(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=HC(A),(r.type===bs||r.type===Qs)&&(r.styles.backgroundColor=3739148031,r.styles.borderTopColor=r.styles.borderRightColor=r.styles.borderBottomColor=r.styles.borderLeftColor=2779096575,r.styles.borderTopWidth=r.styles.borderRightWidth=r.styles.borderBottomWidth=r.styles.borderLeftWidth=1,r.styles.borderTopStyle=r.styles.borderRightStyle=r.styles.borderBottomStyle=r.styles.borderLeftStyle=1,r.styles.backgroundClip=[0],r.styles.backgroundOrigin=[0],r.bounds=MC(r.bounds)),r.type){case bs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=EC;break;case Qs:r.styles.borderTopRightRadius=r.styles.borderTopLeftRadius=r.styles.borderBottomRightRadius=r.styles.borderBottomLeftRadius=LC;break}return r}return e})(zA),md=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return r.value=n&&n.text||"",r}return e})(zA),wd=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.value=A.value,r}return e})(zA),Bd=(function(i){LA(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=Cd(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?Kr(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):ti.TRANSPARENT,s=A.contentWindow.document.body?Kr(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):ti.TRANSPARENT;r.backgroundColor=ui(n)?ui(s)?r.styles.backgroundColor:s:n}}catch{}return r}return e})(zA),DC=["OL","UL","MENU"],Fs=function(i,e,t,A){for(var r=e.firstChild,n=void 0;r;r=n)if(n=r.nextSibling,vd(r)&&r.data.trim().length>0)t.textNodes.push(new QC(i,r,t.styles));else if(Zi(r))if(Ud(r)&&r.assignedNodes)r.assignedNodes().forEach(function(o){return Fs(i,o,t,A)});else{var s=yd(i,r);s.styles.isVisible()&&(_C(r,s,A)?s.flags|=4:PC(s.styles)&&(s.flags|=2),DC.indexOf(r.tagName)!==-1&&(s.flags|=8),t.elements.push(s),r.slot,r.shadowRoot?Fs(i,r.shadowRoot,s,A):!Ss(r)&&!Td(r)&&!Es(r)&&Fs(i,r,s,A))}},yd=function(i,e){return za(e)?new ud(i,e):xd(e)?new dd(i,e):Td(e)?new pd(i,e):kC(e)?new fd(i,e):NC(e)?new Na(i,e):OC(e)?new Oa(i,e):Es(e)?new md(i,e):Ss(e)?new wd(i,e):Qd(e)?new Bd(i,e):new zA(i,e)},Cd=function(i,e){var t=yd(i,e);return t.flags|=4,Fs(i,e,t,t),t},_C=function(i,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Va(i)&&t.styles.isTransparent()},PC=function(i){return i.isPositioned()||i.isFloating()},vd=function(i){return i.nodeType===Node.TEXT_NODE},Zi=function(i){return i.nodeType===Node.ELEMENT_NODE},Ka=function(i){return Zi(i)&&typeof i.style<"u"&&!Us(i)},Us=function(i){return typeof i.className=="object"},kC=function(i){return i.tagName==="LI"},NC=function(i){return i.tagName==="OL"},OC=function(i){return i.tagName==="INPUT"},KC=function(i){return i.tagName==="HTML"},Td=function(i){return i.tagName==="svg"},Va=function(i){return i.tagName==="BODY"},xd=function(i){return i.tagName==="CANVAS"},bd=function(i){return i.tagName==="VIDEO"},za=function(i){return i.tagName==="IMG"},Qd=function(i){return i.tagName==="IFRAME"},Fd=function(i){return i.tagName==="STYLE"},VC=function(i){return i.tagName==="SCRIPT"},Ss=function(i){return i.tagName==="TEXTAREA"},Es=function(i){return i.tagName==="SELECT"},Ud=function(i){return i.tagName==="SLOT"},Sd=function(i){return i.tagName.indexOf("-")>0},zC=(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})(),Ed={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"]},Ld={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},WC={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},RC={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Yi=function(i,e,t,A,r,n){return i<e||i>t?Gr(i,r,n.length>0):A.integers.reduce(function(s,o,l){for(;i>=o;)i-=o,s+=A.values[l];return s},"")+n},Md=function(i,e,t,A){var r="";do t||i--,r=A(i)+r,i/=e;while(i*e>=e);return r},It=function(i,e,t,A,r){var n=t-e+1;return(i<0?"-":"")+(Md(Math.abs(i),n,A,function(s){return Ht(Math.floor(s%n)+e)})+r)},Hi=function(i,e,t){t===void 0&&(t=". ");var A=e.length;return Md(Math.abs(i),A,!1,function(r){return e[Math.floor(r%A)]})+t},qi=1,pi=2,fi=4,Rr=8,Ai=function(i,e,t,A,r,n){if(i<-9999||i>9999)return Gr(i,4,r.length>0);var s=Math.abs(i),o=r;if(s===0)return e[0]+o;for(var l=0;s>0&&l<=4;l++){var c=s%10;c===0&&kt(n,qi)&&o!==""?o=e[c]+o:c>1||c===1&&l===0||c===1&&l===1&&kt(n,pi)||c===1&&l===1&&kt(n,fi)&&i>100||c===1&&l>1&&kt(n,Rr)?o=e[c]+(l>0?t[l-1]:"")+o:c===1&&l>0&&(o=t[l-1]+o),s=Math.floor(s/10)}return(i<0?A:"")+o},Hd="十百千萬",Id="拾佰仟萬",Dd="マイナス",Wa="마이너스",Gr=function(i,e,t){var A=t?". ":"",r=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=It(i,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return Hi(i,"〇一二三四五六七八九",r);case 6:return Yi(i,1,3999,Ed,3,A).toLowerCase();case 7:return Yi(i,1,3999,Ed,3,A);case 8:return It(i,945,969,!1,A);case 9:return It(i,97,122,!1,A);case 10:return It(i,65,90,!1,A);case 11:return It(i,1632,1641,!0,A);case 12:case 49:return Yi(i,1,9999,Ld,3,A);case 35:return Yi(i,1,9999,Ld,3,A).toLowerCase();case 13:return It(i,2534,2543,!0,A);case 14:case 30:return It(i,6112,6121,!0,A);case 15:return Hi(i,"子丑寅卯辰巳午未申酉戌亥",r);case 16:return Hi(i,"甲乙丙丁戊己庚辛壬癸",r);case 17:case 48:return Ai(i,"零一二三四五六七八九",Hd,"負",r,pi|fi|Rr);case 47:return Ai(i,"零壹貳參肆伍陸柒捌玖",Id,"負",r,qi|pi|fi|Rr);case 42:return Ai(i,"零一二三四五六七八九",Hd,"负",r,pi|fi|Rr);case 41:return Ai(i,"零壹贰叁肆伍陆柒捌玖",Id,"负",r,qi|pi|fi|Rr);case 26:return Ai(i,"〇一二三四五六七八九","十百千万",Dd,r,0);case 25:return Ai(i,"零壱弐参四伍六七八九","拾百千万",Dd,r,qi|pi|fi);case 31:return Ai(i,"영일이삼사오육칠팔구","십백천만",Wa,n,qi|pi|fi);case 33:return Ai(i,"零一二三四五六七八九","十百千萬",Wa,n,0);case 32:return Ai(i,"零壹貳參四五六七八九","拾百千",Wa,n,qi|pi|fi);case 18:return It(i,2406,2415,!0,A);case 20:return Yi(i,1,19999,RC,3,A);case 21:return It(i,2790,2799,!0,A);case 22:return It(i,2662,2671,!0,A);case 22:return Yi(i,1,10999,WC,3,A);case 23:return Hi(i,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Hi(i,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return It(i,3302,3311,!0,A);case 28:return Hi(i,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",r);case 29:return Hi(i,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",r);case 34:return It(i,3792,3801,!0,A);case 37:return It(i,6160,6169,!0,A);case 38:return It(i,4160,4169,!0,A);case 39:return It(i,2918,2927,!0,A);case 40:return It(i,1776,1785,!0,A);case 43:return It(i,3046,3055,!0,A);case 44:return It(i,3174,3183,!0,A);case 45:return It(i,3664,3673,!0,A);case 46:return It(i,3872,3881,!0,A);default:return It(i,48,57,!0,A)}},_d="data-html2canvas-ignore",Pd=(function(){function i(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new zC,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=GC(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=JC(r).then(function(){return tA(A,void 0,void 0,function(){var u,m;return Jt(this,function(y){switch(y.label){case 0:return this.scrolledElements.forEach(jC),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,XC(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(YC(document.doctype)+"<html></html>"),qC(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(xd(e))return this.createCanvasClone(e);if(bd(e))return this.createVideoClone(e);if(Fd(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return za(t)&&(za(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),Sd(t)?this.createCustomElementClone(t):t},i.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ra(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){(!Zi(t)||!VC(t)&&!t.hasAttribute(_d)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Zi(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(Zi(n)&&Ud(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(vd(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Zi(e)&&(Ka(e)||Us(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&Ka(r)&&(this.clonedReferenceElement=r),Va(r)&&Av(r);var l=this.counters.parse(new Yu(this.context,n)),c=this.resolvePseudoContent(e,r,s,$r.BEFORE);Sd(e)&&(t=!0),bd(e)||this.cloneChildNodes(e,r,t),c&&r.insertBefore(c,r.firstChild);var u=this.resolvePseudoContent(e,r,o,$r.AFTER);return u&&r.appendChild(u),this.counters.pop(l),(n&&(this.options.copyStyles||Us(e))&&!Qd(e)||t)&&Ra(n,r),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Ss(e)||Es(e))&&(Ss(r)||Es(r))&&(r.value=e.value),r}return e.cloneNode(!1)},i.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,o=t.ownerDocument;if(!(!o||!s||s==="none"||s==="-moz-alt-content"||A.display==="none")){this.counters.parse(new Yu(this.context,A));var l=new ky(this.context,A),c=o.createElement("html2canvaspseudoelement");Ra(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(mt);v.length&&c.appendChild(o.createTextNode(e.getAttribute(v[0].value)||""))}else if(m.name==="counter"){var T=m.values.filter(Xi),C=T[0],U=T[1];if(C&&mt(C)){var F=n.counters.getCounterValue(C.value),E=U&&mt(U)?Qa.parse(n.context,U.value):3;c.appendChild(o.createTextNode(Gr(F,E,!1)))}}else if(m.name==="counters"){var N=m.values.filter(Xi),C=N[0],R=N[1],U=N[2];if(C&&mt(C)){var M=n.counters.getCounterValues(C.value),z=U&&mt(U)?Qa.parse(n.context,U.value):3,ne=R&&R.type===0?R.value:"",$=M.map(function(re){return Gr(re,z,!1)}).join(ne);c.appendChild(o.createTextNode($))}}}else if(m.type===20)switch(m.value){case"open-quote":c.appendChild(o.createTextNode(Zu(l.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(Zu(l.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(m.value))}}),c.className=Ga+" "+$a;var u=r===$r.BEFORE?" "+Ga:" "+$a;return Us(t)?t.className.baseValue+=u:t.className+=u,c}}},i.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},i})(),$r;(function(i){i[i.BEFORE=0]="BEFORE",i[i.AFTER=1]="AFTER"})($r||($r={}));var GC=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(_d,"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})},XC=function(i){return Promise.all([].slice.call(i.images,0).map($C))},JC=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)}})},ZC=["all","d","content"],Ra=function(i,e){for(var t=i.length-1;t>=0;t--){var A=i.item(t);ZC.indexOf(A)===-1&&e.style.setProperty(A,i.getPropertyValue(A))}return e},YC=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},qC=function(i,e,t){i&&i.defaultView&&(e!==i.defaultView.pageXOffset||t!==i.defaultView.pageYOffset)&&i.defaultView.scrollTo(e,t)},jC=function(i){var e=i[0],t=i[1],A=i[2];e.scrollLeft=t,e.scrollTop=A},ev=":before",tv=":after",Ga="___html2canvas___pseudoelement_before",$a="___html2canvas___pseudoelement_after",kd=`{
|
|
7
7
|
content: "" !important;
|
|
8
8
|
display: none !important;
|
|
9
|
-
}`,
|
|
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
|
|
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===
|
|
14
|
-
`,title:
|
|
15
|
-
${A===
|
|
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===
|
|
18
|
-
${A===
|
|
19
|
-
${A===
|
|
20
|
-
${A===
|
|
21
|
-
${
|
|
22
|
-
${
|
|
9
|
+
}`,Av=function(i){iv(i,"."+Ga+ev+kd+`
|
|
10
|
+
.`+$a+tv+kd)},iv=function(i,e){var t=i.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,i.appendChild(A)}},Nd=(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})(),rv=(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)||(Ja(e)||av(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},i.prototype.match=function(e){return this._cache[e]},i.prototype.loadImage=function(e){return tA(this,void 0,void 0,function(){var t,A,r,n,s=this;return Jt(this,function(o){switch(o.label){case 0:return t=Nd.isSameOrigin(e),A=!Xa(e)&&this._options.useCORS===!0&&Wt.SUPPORT_CORS_IMAGES&&!t,r=!Xa(e)&&!t&&!Ja(e)&&typeof this._options.proxy=="string"&&Wt.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!Xa(e)&&!Ja(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,(lv(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=Wt.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})(),nv=/^data:image\/svg\+xml/i,sv=/^data:image\/.*;base64,/i,ov=/^data:image\/.*/i,av=function(i){return Wt.SUPPORT_SVG_DRAWING||!cv(i)},Xa=function(i){return ov.test(i)},lv=function(i){return sv.test(i)},Ja=function(i){return i.substr(0,4)==="blob"},cv=function(i){return i.substr(-3).toLowerCase()==="svg"||nv.test(i)},Me=(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})(),ji=function(i,e,t){return new Me(i.x+(e.x-i.x)*t,i.y+(e.y-i.y)*t)},Ls=(function(){function i(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return i.prototype.subdivide=function(e,t){var A=ji(this.start,this.startControl,e),r=ji(this.startControl,this.endControl,e),n=ji(this.endControl,this.end,e),s=ji(A,r,e),o=ji(r,n,e),l=ji(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})(),xA=function(i){return i.type===1},hv=(function(){function i(e){var t=e.styles,A=e.bounds,r=Or(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],o=Or(t.borderTopRightRadius,A.width,A.height),l=o[0],c=o[1],u=Or(t.borderBottomRightRadius,A.width,A.height),m=u[0],y=u[1],v=Or(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,ne=t.borderRightWidth,$=t.borderBottomWidth,V=t.borderLeftWidth,Ae=vt(t.paddingTop,e.bounds.width),re=vt(t.paddingRight,e.bounds.width),he=vt(t.paddingBottom,e.bounds.width),Z=vt(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Qt(A.left+V/3,A.top+z/3,n-V/3,s-z/3,pt.TOP_LEFT):new Me(A.left+V/3,A.top+z/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Qt(A.left+E,A.top+z/3,l-ne/3,c-z/3,pt.TOP_RIGHT):new Me(A.left+A.width-ne/3,A.top+z/3),this.bottomRightBorderDoubleOuterBox=m>0||y>0?Qt(A.left+R,A.top+N,m-ne/3,y-$/3,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne/3,A.top+A.height-$/3),this.bottomLeftBorderDoubleOuterBox=T>0||C>0?Qt(A.left+V/3,A.top+M,T-V/3,C-$/3,pt.BOTTOM_LEFT):new Me(A.left+V/3,A.top+A.height-$/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Qt(A.left+V*2/3,A.top+z*2/3,n-V*2/3,s-z*2/3,pt.TOP_LEFT):new Me(A.left+V*2/3,A.top+z*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Qt(A.left+E,A.top+z*2/3,l-ne*2/3,c-z*2/3,pt.TOP_RIGHT):new Me(A.left+A.width-ne*2/3,A.top+z*2/3),this.bottomRightBorderDoubleInnerBox=m>0||y>0?Qt(A.left+R,A.top+N,m-ne*2/3,y-$*2/3,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne*2/3,A.top+A.height-$*2/3),this.bottomLeftBorderDoubleInnerBox=T>0||C>0?Qt(A.left+V*2/3,A.top+M,T-V*2/3,C-$*2/3,pt.BOTTOM_LEFT):new Me(A.left+V*2/3,A.top+A.height-$*2/3),this.topLeftBorderStroke=n>0||s>0?Qt(A.left+V/2,A.top+z/2,n-V/2,s-z/2,pt.TOP_LEFT):new Me(A.left+V/2,A.top+z/2),this.topRightBorderStroke=n>0||s>0?Qt(A.left+E,A.top+z/2,l-ne/2,c-z/2,pt.TOP_RIGHT):new Me(A.left+A.width-ne/2,A.top+z/2),this.bottomRightBorderStroke=m>0||y>0?Qt(A.left+R,A.top+N,m-ne/2,y-$/2,pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne/2,A.top+A.height-$/2),this.bottomLeftBorderStroke=T>0||C>0?Qt(A.left+V/2,A.top+M,T-V/2,C-$/2,pt.BOTTOM_LEFT):new Me(A.left+V/2,A.top+A.height-$/2),this.topLeftBorderBox=n>0||s>0?Qt(A.left,A.top,n,s,pt.TOP_LEFT):new Me(A.left,A.top),this.topRightBorderBox=l>0||c>0?Qt(A.left+E,A.top,l,c,pt.TOP_RIGHT):new Me(A.left+A.width,A.top),this.bottomRightBorderBox=m>0||y>0?Qt(A.left+R,A.top+N,m,y,pt.BOTTOM_RIGHT):new Me(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=T>0||C>0?Qt(A.left,A.top+M,T,C,pt.BOTTOM_LEFT):new Me(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Qt(A.left+V,A.top+z,Math.max(0,n-V),Math.max(0,s-z),pt.TOP_LEFT):new Me(A.left+V,A.top+z),this.topRightPaddingBox=l>0||c>0?Qt(A.left+Math.min(E,A.width-ne),A.top+z,E>A.width+ne?0:Math.max(0,l-ne),Math.max(0,c-z),pt.TOP_RIGHT):new Me(A.left+A.width-ne,A.top+z),this.bottomRightPaddingBox=m>0||y>0?Qt(A.left+Math.min(R,A.width-V),A.top+Math.min(N,A.height-$),Math.max(0,m-ne),Math.max(0,y-$),pt.BOTTOM_RIGHT):new Me(A.left+A.width-ne,A.top+A.height-$),this.bottomLeftPaddingBox=T>0||C>0?Qt(A.left+V,A.top+Math.min(M,A.height-$),Math.max(0,T-V),Math.max(0,C-$),pt.BOTTOM_LEFT):new Me(A.left+V,A.top+A.height-$),this.topLeftContentBox=n>0||s>0?Qt(A.left+V+Z,A.top+z+Ae,Math.max(0,n-(V+Z)),Math.max(0,s-(z+Ae)),pt.TOP_LEFT):new Me(A.left+V+Z,A.top+z+Ae),this.topRightContentBox=l>0||c>0?Qt(A.left+Math.min(E,A.width+V+Z),A.top+z+Ae,E>A.width+V+Z?0:l-V+Z,c-(z+Ae),pt.TOP_RIGHT):new Me(A.left+A.width-(ne+re),A.top+z+Ae),this.bottomRightContentBox=m>0||y>0?Qt(A.left+Math.min(R,A.width-(V+Z)),A.top+Math.min(N,A.height+z+Ae),Math.max(0,m-(ne+re)),y-($+he),pt.BOTTOM_RIGHT):new Me(A.left+A.width-(ne+re),A.top+A.height-($+he)),this.bottomLeftContentBox=T>0||C>0?Qt(A.left+V+Z,A.top+M,Math.max(0,T-(V+Z)),C-($+he),pt.BOTTOM_LEFT):new Me(A.left+V+Z,A.top+A.height-($+he))}return i})(),pt;(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"})(pt||(pt={}));var Qt=function(i,e,t,A,r){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,l=i+t,c=e+A;switch(r){case pt.TOP_LEFT:return new Ls(new Me(i,c),new Me(i,c-o),new Me(l-s,e),new Me(l,e));case pt.TOP_RIGHT:return new Ls(new Me(i,e),new Me(i+s,e),new Me(l,c-o),new Me(l,c));case pt.BOTTOM_RIGHT:return new Ls(new Me(l,e),new Me(l,e+o),new Me(i+s,c),new Me(i,c));case pt.BOTTOM_LEFT:default:return new Ls(new Me(l,c),new Me(l-s,c),new Me(i,e+o),new Me(i,e))}},Ms=function(i){return[i.topLeftBorderBox,i.topRightBorderBox,i.bottomRightBorderBox,i.bottomLeftBorderBox]},uv=function(i){return[i.topLeftContentBox,i.topRightContentBox,i.bottomRightContentBox,i.bottomLeftContentBox]},Hs=function(i){return[i.topLeftPaddingBox,i.topRightPaddingBox,i.bottomRightPaddingBox,i.bottomLeftPaddingBox]},dv=(function(){function i(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return i})(),Is=(function(){function i(e,t){this.path=e,this.target=t,this.type=1}return i})(),pv=(function(){function i(e){this.opacity=e,this.type=2,this.target=6}return i})(),fv=function(i){return i.type===0},Od=function(i){return i.type===1},gv=function(i){return i.type===2},Kd=function(i,e){return i.length===e.length?i.some(function(t,A){return t===e[A]}):!1},mv=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})},Vd=(function(){function i(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return i})(),zd=(function(){function i(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new hv(this.container),this.container.styles.opacity<1&&this.effects.push(new pv(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 dv(A,r,n))}if(this.container.styles.overflowX!==0){var s=Ms(this.curves),o=Hs(this.curves);Kd(s,o)?this.effects.push(new Is(s,6)):(this.effects.push(new Is(s,2)),this.effects.push(new Is(o,4)))}}return i.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(l){return!Od(l)});if(t||A.container.styles.position!==0||!A.parent){if(r.unshift.apply(r,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=Ms(A.curves),o=Hs(A.curves);Kd(s,o)||r.unshift(new Is(o,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(l){return kt(l.target,e)})},i})(),Za=function(i,e,t,A){i.container.elements.forEach(function(r){var n=kt(r.flags,4),s=kt(r.flags,2),o=new zd(r,i);kt(r.styles.display,2048)&&A.push(o);var l=kt(r.flags,8)?[]:A;if(n||s){var c=n||r.styles.isPositioned()?t:e,u=new Vd(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);Za(o,u,n?u:t,l)}else r.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Za(o,e,t,l);kt(r.flags,8)&&Wd(r,l)})},Wd=function(i,e){for(var t=i instanceof Na?i.start:1,A=i instanceof Na?i.reversed:!1,r=0;r<e.length;r++){var n=e[r];n.container instanceof fd&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=Gr(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},wv=function(i){var e=new zd(i,null),t=new Vd(e),A=[];return Za(e,t,t,A),Wd(e.container,A),t},Rd=function(i,e){switch(e){case 0:return bA(i.topLeftBorderBox,i.topLeftPaddingBox,i.topRightBorderBox,i.topRightPaddingBox);case 1:return bA(i.topRightBorderBox,i.topRightPaddingBox,i.bottomRightBorderBox,i.bottomRightPaddingBox);case 2:return bA(i.bottomRightBorderBox,i.bottomRightPaddingBox,i.bottomLeftBorderBox,i.bottomLeftPaddingBox);default:return bA(i.bottomLeftBorderBox,i.bottomLeftPaddingBox,i.topLeftBorderBox,i.topLeftPaddingBox)}},Bv=function(i,e){switch(e){case 0:return bA(i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox,i.topRightBorderBox,i.topRightBorderDoubleOuterBox);case 1:return bA(i.topRightBorderBox,i.topRightBorderDoubleOuterBox,i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox);case 2:return bA(i.bottomRightBorderBox,i.bottomRightBorderDoubleOuterBox,i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox);default:return bA(i.bottomLeftBorderBox,i.bottomLeftBorderDoubleOuterBox,i.topLeftBorderBox,i.topLeftBorderDoubleOuterBox)}},yv=function(i,e){switch(e){case 0:return bA(i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox,i.topRightBorderDoubleInnerBox,i.topRightPaddingBox);case 1:return bA(i.topRightBorderDoubleInnerBox,i.topRightPaddingBox,i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox);case 2:return bA(i.bottomRightBorderDoubleInnerBox,i.bottomRightPaddingBox,i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox);default:return bA(i.bottomLeftBorderDoubleInnerBox,i.bottomLeftPaddingBox,i.topLeftBorderDoubleInnerBox,i.topLeftPaddingBox)}},Cv=function(i,e){switch(e){case 0:return Ds(i.topLeftBorderStroke,i.topRightBorderStroke);case 1:return Ds(i.topRightBorderStroke,i.bottomRightBorderStroke);case 2:return Ds(i.bottomRightBorderStroke,i.bottomLeftBorderStroke);default:return Ds(i.bottomLeftBorderStroke,i.topLeftBorderStroke)}},Ds=function(i,e){var t=[];return xA(i)?t.push(i.subdivide(.5,!1)):t.push(i),xA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},bA=function(i,e,t,A){var r=[];return xA(i)?r.push(i.subdivide(.5,!1)):r.push(i),xA(t)?r.push(t.subdivide(.5,!0)):r.push(t),xA(A)?r.push(A.subdivide(.5,!0).reverse()):r.push(A),xA(e)?r.push(e.subdivide(.5,!1).reverse()):r.push(e),r},Gd=function(i){var e=i.bounds,t=i.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},_s=function(i){var e=i.styles,t=i.bounds,A=vt(e.paddingLeft,t.width),r=vt(e.paddingRight,t.width),n=vt(e.paddingTop,t.width),s=vt(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))},vv=function(i,e){return i===0?e.bounds:i===2?_s(e):Gd(e)},Tv=function(i,e){return i===0?e.bounds:i===2?_s(e):Gd(e)},Ya=function(i,e,t){var A=vv(tr(i.styles.backgroundOrigin,e),i),r=Tv(tr(i.styles.backgroundClip,e),i),n=xv(tr(i.styles.backgroundSize,e),t,A),s=n[0],o=n[1],l=Or(tr(i.styles.backgroundPosition,e),A.width-s,A.height-o),c=bv(tr(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]},er=function(i){return mt(i)&&i.value===Ji.AUTO},Ps=function(i){return typeof i=="number"},xv=function(i,e,t){var A=e[0],r=e[1],n=e[2],s=i[0],o=i[1];if(!s)return[0,0];if(Pt(s)&&o&&Pt(o))return[vt(s,t.width),vt(o,t.height)];var l=Ps(n);if(mt(s)&&(s.value===Ji.CONTAIN||s.value===Ji.COVER)){if(Ps(n)){var c=t.width/t.height;return c<n!=(s.value===Ji.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var u=Ps(A),m=Ps(r),y=u||m;if(er(s)&&(!o||er(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 Pt(s)?F=vt(s,t.width):Pt(o)&&(E=vt(o,t.height)),er(s)?F=E*n:(!o||er(o))&&(E=F/n),[F,E]}var N=null,R=null;if(Pt(s)?N=vt(s,t.width):o&&Pt(o)&&(R=vt(o,t.height)),N!==null&&(!o||er(o))&&(R=u&&m?N/A*r:t.height),R!==null&&er(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")},tr=function(i,e){var t=i[e];return typeof t>"u"?i[0]:t},bv=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 Me(Math.round(A.left),Math.round(A.top+s)),new Me(Math.round(A.left+A.width),Math.round(A.top+s)),new Me(Math.round(A.left+A.width),Math.round(l+A.top+s)),new Me(Math.round(A.left),Math.round(l+A.top+s))];case 3:return[new Me(Math.round(A.left+n),Math.round(A.top)),new Me(Math.round(A.left+n+o),Math.round(A.top)),new Me(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Me(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Me(Math.round(A.left+n),Math.round(A.top+s)),new Me(Math.round(A.left+n+o),Math.round(A.top+s)),new Me(Math.round(A.left+n+o),Math.round(A.top+s+l)),new Me(Math.round(A.left+n),Math.round(A.top+s+l))];default:return[new Me(Math.round(r.left),Math.round(r.top)),new Me(Math.round(r.left+r.width),Math.round(r.top)),new Me(Math.round(r.left+r.width),Math.round(r.height+r.top)),new Me(Math.round(r.left),Math.round(r.height+r.top))]}},Qv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",$d="Hidden Text",Fv=(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=Qv,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($d)),A.appendChild(n),A.appendChild(r);var o=r.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode($d)),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})(),Xd=(function(){function i(e,t){this.context=e,this.options=t}return i})(),Uv=1e4,Sv=(function(i){LA(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 Fv(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(),gv(t)&&(this.ctx.globalAlpha=t.opacity),fv(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Od(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return tA(this,void 0,void 0,function(){var A;return Jt(this,function(r){switch(r.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return tA(this,void 0,void 0,function(){return Jt(this,function(A){switch(A.label){case 0:if(kt(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return A.sent(),[4,this.renderNodeContent(t)];case 2:A.sent(),A.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,A,r){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+r);else{var s=ka(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=Iv(t.fontFamily).join(", "),n=Nr(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,r].join(" "),r,n]},e.prototype.renderTextNode=function(t,A){return tA(this,void 0,void 0,function(){var r,n,s,o,l,c,u,m,y=this;return Jt(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=Ot(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=Ot(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=Ot(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=Ot(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=_s(t),s=Hs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(r,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,E,E,c,u,m,y,R,v,T,M,C,U,F,E,N,R,M;return Jt(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 ud))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 dd&&this.renderReplacedElement(A,r,A.canvas),!(A instanceof pd))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 Bd&&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 Oa&&(m=Math.min(A.bounds.width,A.bounds.height),A.type===bs?A.checked&&(this.ctx.save(),this.path([new Me(A.bounds.left+m*.39363,A.bounds.top+m*.79),new Me(A.bounds.left+m*.16,A.bounds.top+m*.5549),new Me(A.bounds.left+m*.27347,A.bounds.top+m*.44071),new Me(A.bounds.left+m*.39694,A.bounds.top+m*.5649),new Me(A.bounds.left+m*.72983,A.bounds.top+m*.23),new Me(A.bounds.left+m*.84,A.bounds.top+m*.34085),new Me(A.bounds.left+m*.39363,A.bounds.top+m*.79)]),this.ctx.fillStyle=Ot(gd),this.ctx.fill(),this.ctx.restore()):A.type===Qs&&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=Ot(gd),this.ctx.fill(),this.ctx.restore())),Ev(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=Ot(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Mv(A.styles.textAlign),M=_s(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 Me(M.left,M.top),new Me(M.left+M.width,M.top),new Me(M.left+M.width,M.top+M.height),new Me(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Wr(A.value,U),n.letterSpacing,T),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!kt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(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=Ot(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new jA(A.bounds.left,A.bounds.top+vt(A.styles.paddingTop,A.bounds.width),A.bounds.width,$u(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Wr(t.listValue,M),n.letterSpacing,$u(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 tA(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 Jt(this,function(E){switch(E.label){case 0:if(kt(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=xA(r)?r.start:r;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),xA(r)&&A.ctx.bezierCurveTo(r.startControl.x,r.startControl.y,r.endControl.x,r.endControl.y,r.end.x,r.end.y)})},e.prototype.renderRepeat=function(t,A,r,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(r,n),this.ctx.fill(),this.ctx.translate(-r,-n)},e.prototype.resizeImage=function(t,A,r){var n;if(t.width===A&&t.height===r)return t;var s=(n=this.canvas.ownerDocument)!==null&&n!==void 0?n:document,o=s.createElement("canvas");o.width=Math.max(1,A),o.height=Math.max(1,r);var l=o.getContext("2d");return l.drawImage(t,0,0,t.width,t.height,0,0,A,r),o},e.prototype.renderBackgroundImage=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l;return Jt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,r=function(u){var m,y,v,Ae,ce,se,Z,te,$,T,Ae,ce,se,Z,te,C,U,F,E,N,R,M,z,ne,$,V,Ae,re,he,Z,te,ae,ce,se,le,pe,Be,Fe,Ue,ye,Te,ve;return Jt(this,function(be){switch(be.label){case 0:if(u.type!==0)return[3,5];m=void 0,y=u.url,be.label=1;case 1:return be.trys.push([1,3,,4]),[4,n.context.cache.match(y)];case 2:return m=be.sent(),[3,4];case 3:return be.sent(),n.context.logger.error("Error loading background-image "+y),[3,4];case 4:return m&&(v=Ya(t,A,[m.width,m.height,m.width/m.height]),Ae=v[0],ce=v[1],se=v[2],Z=v[3],te=v[4],$=n.ctx.createPattern(n.resizeImage(m,Z,te),"repeat"),n.renderRepeat(Ae,$,ce,se)),[3,6];case 5:f2(u)?(T=Ya(t,A,[null,null,null]),Ae=T[0],ce=T[1],se=T[2],Z=T[3],te=T[4],C=c2(u.angle,Z,te),U=C[0],F=C[1],E=C[2],N=C[3],R=C[4],M=document.createElement("canvas"),M.width=Z,M.height=te,z=M.getContext("2d"),ne=z.createLinearGradient(F,N,E,R),_u(u.stops,U).forEach(function(Le){return ne.addColorStop(Le.stop,Ot(Le.color))}),z.fillStyle=ne,z.fillRect(0,0,Z,te),Z>0&&te>0&&($=n.ctx.createPattern(M,"repeat"),n.renderRepeat(Ae,$,ce,se))):g2(u)&&(V=Ya(t,A,[null,null,null]),Ae=V[0],re=V[1],he=V[2],Z=V[3],te=V[4],ae=u.position.length===0?[Ta]:u.position,ce=vt(ae[0],Z),se=vt(ae[ae.length-1],te),le=h2(u,ce,se,Z,te),pe=le[0],Be=le[1],pe>0&&Be>0&&(Fe=n.ctx.createRadialGradient(re+ce,he+se,0,re+ce,he+se,pe),_u(u.stops,pe*2).forEach(function(Le){return Fe.addColorStop(Le.stop,Ot(Le.color))}),n.path(Ae),n.ctx.fillStyle=Fe,pe!==Be?(Ue=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,Te=Be/pe,ve=1/Te,n.ctx.save(),n.ctx.translate(Ue,ye),n.ctx.transform(1,0,0,Te,0,0),n.ctx.translate(-Ue,-ye),n.ctx.fillRect(re,ve*(he-ye)+ye,Z,te*ve),n.ctx.restore()):n.ctx.fill())),be.label=6;case 6:return A--,[2]}})},n=this,s=0,o=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<o.length?(l=o[s],[5,r(l)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,A,r){return tA(this,void 0,void 0,function(){return Jt(this,function(n){return this.path(Rd(r,A)),this.ctx.fillStyle=Ot(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,r,n){return tA(this,void 0,void 0,function(){var s,o;return Jt(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=Bv(n,r),this.path(s),this.ctx.fillStyle=Ot(t),this.ctx.fill(),o=yv(n,r),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return tA(this,void 0,void 0,function(){var A,r,n,s,o,l,c,u,m=this;return Jt(this,function(y){switch(y.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,r=!ui(A.backgroundColor)||A.backgroundImage.length,n=[{style:A.borderTopStyle,color:A.borderTopColor,width:A.borderTopWidth},{style:A.borderRightStyle,color:A.borderRightColor,width:A.borderRightWidth},{style:A.borderBottomStyle,color:A.borderBottomColor,width:A.borderBottomWidth},{style:A.borderLeftStyle,color:A.borderLeftColor,width:A.borderLeftWidth}],s=Lv(tr(A.backgroundClip,0),t.curves),r||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),ui(A.backgroundColor)||(this.ctx.fillStyle=Ot(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1: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:Uv,U=mv(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=Ot(v.color),m.ctx.shadowBlur=v.blur.number,m.ctx.fillStyle=v.inset?Ot(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&&!ui(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 tA(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 Jt(this,function(ne){return this.ctx.save(),o=Cv(n,r),l=Rd(n,r),s===2&&(this.path(l),this.ctx.clip()),xA(l[0])?(c=l[0].start.x,u=l[0].start.y):(c=l[0].x,u=l[0].y),xA(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=Ot(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(xA(l[0])&&(M=l[3],z=l[0],this.ctx.beginPath(),this.formatPath([new Me(M.end.x,M.end.y),new Me(z.start.x,z.start.y)]),this.ctx.stroke()),xA(l[1])&&(M=l[1],z=l[2],this.ctx.beginPath(),this.formatPath([new Me(M.end.x,M.end.y),new Me(z.start.x,z.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A;return Jt(this,function(r){switch(r.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=wv(t),[4,this.renderStack(A)];case 1:return r.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Xd),Ev=function(i){return i instanceof wd||i instanceof md?!0:i instanceof Oa&&i.type!==Qs&&i.type!==bs},Lv=function(i,e){switch(i){case 0:return Ms(e);case 2:return uv(e);default:return Hs(e)}},Mv=function(i){switch(i){case 1:return"center";case 2:return"right";default:return"left"}},Hv=["-apple-system","system-ui"],Iv=function(i){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?i.filter(function(e){return Hv.indexOf(e)===-1}):i},Dv=(function(i){LA(e,i);function e(t,A){var r=i.call(this,t,A)||this;return r.canvas=A.canvas?A.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=A,r.canvas.width=Math.floor(A.width*A.scale),r.canvas.height=Math.floor(A.height*A.scale),r.canvas.style.width=A.width+"px",r.canvas.style.height=A.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-A.x,-A.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),r}return e.prototype.render=function(t){return tA(this,void 0,void 0,function(){var A,r;return Jt(this,function(n){switch(n.label){case 0:return A=Pa(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,_v(A)];case 1:return r=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ot(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(r,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Xd),_v=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))})},Pv=(function(){function i(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return i.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.getTime=function(){return Date.now()-this.start},i.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Rn([this.id,this.getTime()+"ms"],e))},i.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Rn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},i.instances={},i})(),kv=(function(){function i(e,t){var A;this.windowBounds=t,this.instanceName="#"+i.instanceCount++,this.logger=new Pv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new rv(this,e)}return i.instanceCount=1,i})(),Nv=function(i,e){return e===void 0&&(e={}),Ov(i,e)};typeof window<"u"&&Nd.setContext(window);var Ov=function(i,e){return tA(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,ne,z,ne,$,V,Ae,re,he,Z,te,ae,ce,se,le,pe,Be,Fe,Ue,ye,Te;return Jt(this,function(ve){switch(ve.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:(Ae=e.useCORS)!==null&&Ae!==void 0?Ae:!1},n=Aa({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:(Z=e.windowHeight)!==null&&Z!==void 0?Z:A.innerHeight,scrollX:(te=e.scrollX)!==null&&te!==void 0?te:A.pageXOffset,scrollY:(ae=e.scrollY)!==null&&ae!==void 0?ae:A.pageYOffset},o=new jA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),l=new kv(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 Pd(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=ve.sent(),T=Va(y)||KC(y)?mw(y.ownerDocument):Gn(l,y),C=T.width,U=T.height,F=T.left,E=T.top,N=Kv(l,y,e.backgroundColor),R={canvas:e.canvas,backgroundColor:N,scale:(pe=(le=e.scale)!==null&&le!==void 0?le:A.devicePixelRatio)!==null&&pe!==void 0?pe:1,x:((Be=e.x)!==null&&Be!==void 0?Be:0)+F,y:((Fe=e.y)!==null&&Fe!==void 0?Fe:0)+E,width:(Ue=e.width)!==null&&Ue!==void 0?Ue: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"),ne=new Dv(l,R),[4,ne.render(y)]):[3,3];case 2:return M=ve.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=Cd(l,y),N===z.styles.backgroundColor&&(z.styles.backgroundColor=ti.TRANSPARENT),l.logger.debug("Starting renderer for element at "+R.x+","+R.y+" with size "+R.width+"x"+R.height),ne=new Sv(l,R),[4,ne.render(z)];case 4:M=ve.sent(),ve.label=5;case 5:return(!((Te=e.removeContainer)!==null&&Te!==void 0)||Te)&&(Pd.destroy(v)||l.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),l.logger.debug("Finished rendering"),[2,M]}})})},Kv=function(i,e,t){var A=e.ownerDocument,r=A.documentElement?Kr(i,getComputedStyle(A.documentElement).backgroundColor):ti.TRANSPARENT,n=A.body?Kr(i,getComputedStyle(A.body).backgroundColor):ti.TRANSPARENT,s=typeof t=="string"?Kr(i,t):t===null?ti.TRANSPARENT:4294967295;return e===A.documentElement?ui(r)?ui(n)?s:n:r:s};const Vv={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class zv{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 Jd{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 Wv{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:ne,bars:$,days:V,angle:Ae}=s.info,re=z>=0?"+":"",he=[];if(s.statsPriceRange!==!1&&he.push(`${re}${z.toFixed(5)} (${re}${ne.toFixed(2)}%)`),s.statsBarsRange!==!1&&he.push(`${$} bars`),s.statsDateRange!==!1&&he.push(`${V} 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 Z=Math.round(11*y);M.font=`${Z}px sans-serif`;const te=Z*1.6,ae=8*y,ce=Math.max(...he.map(Re=>M.measureText(Re).width))+ae*2,se=he.length*te+ae*2,le=s.statsPosition??"right";let pe,Be;le==="left"?(pe=F,Be=E):le==="center"?(pe=Math.round((F+N)/2),Be=Math.round((E+R)/2)):(pe=N,Be=R);let Fe,Ue;le==="left"?(Fe=pe-ce-10*m,Ue=Be-se-4*y):le==="center"?(Fe=pe-ce/2,Ue=Be-se-8*y):(Fe=pe+10*m,Ue=Be-se-4*y);const ye=l.bitmapSize.width,Te=l.bitmapSize.height,ve=Math.min(Math.max(0,Fe),ye-ce-4*m),be=Math.min(Math.max(4*y,Ue),Te-se-4*y),Le=4*y;M.beginPath(),M.moveTo(ve+Le,be),M.lineTo(ve+ce-Le,be),M.quadraticCurveTo(ve+ce,be,ve+ce,be+Le),M.lineTo(ve+ce,be+se-Le),M.quadraticCurveTo(ve+ce,be+se,ve+ce-Le,be+se),M.lineTo(ve+Le,be+se),M.quadraticCurveTo(ve,be+se,ve,be+se-Le),M.lineTo(ve,be+Le),M.quadraticCurveTo(ve,be,ve+Le,be),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((Re,Ke)=>{M.fillText(Re,ve+ae,be+ae+Z+Ke*te)}),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 Zd{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:ne,pricePct:$,bars:V,days:Ae}=s.info,re=ne>=0?"+":"",he=[];if(s.statsPriceRange&&he.push(re+ne.toFixed(5)+" ("+re+$.toFixed(2)+"%)"),s.statsBarsRange&&he.push(V+" bars"),s.statsDateRange&&he.push(Ae+" days"),he.length===0){z.restore();return}const Z=Math.round(11*y);z.font=Z+"px sans-serif";const te=Z*1.6,ae=8*y,ce=Math.max(...he.map(ve=>z.measureText(ve).width))+ae*2,se=he.length*te+ae*2,le=l.bitmapSize.width,pe=l.bitmapSize.height;let Be,Fe;if(s.statsPosition==="left")Be=F-ce-10*m,Fe=E-se-4*y;else if(s.statsPosition==="center"){const ve=(F+N)/2,be=(E+R)/2;Be=ve-ce/2,Fe=be-se-4*y}else Be=N+10*m,Fe=R-se-4*y;const Ue=Math.min(Math.max(0,Be),le-ce-4*m),ye=Math.min(Math.max(4*y,Fe),pe-se-4*y),Te=4*y;z.beginPath(),z.moveTo(Ue+Te,ye),z.lineTo(Ue+ce-Te,ye),z.quadraticCurveTo(Ue+ce,ye,Ue+ce,ye+Te),z.lineTo(Ue+ce,ye+se-Te),z.quadraticCurveTo(Ue+ce,ye+se,Ue+ce-Te,ye+se),z.lineTo(Ue+Te,ye+se),z.quadraticCurveTo(Ue,ye+se,Ue,ye+se-Te),z.lineTo(Ue,ye+Te),z.quadraticCurveTo(Ue,ye,Ue+Te,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",he.forEach((ve,be)=>{z.fillText(ve,Ue+ae,ye+ae+Z+be*te)}),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 Rv{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 Gv{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 $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,N=v*m,R=T*u,M=C*m,z=U*u,ne=F*m,$=o.context;$.save(),$.beginPath(),$.moveTo(E,N),$.lineTo(R,M),$.lineTo(z,ne),$.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 Xv{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 ne=(C+F)/2,$=(U+E)/2,V=Math.atan2(R,N),Ae=M/2,re=Math.max(1,Ae*Math.max(.05,r.minorRatio));z.beginPath(),z.ellipse(ne,$,Ae,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 Yd{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 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 ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,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,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*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),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/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=N/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,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+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 Jv{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 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 ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,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,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*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),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/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=N/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,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+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 Zv{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 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 ne=Math.atan2(E-U,F-C),$=(r.lineWidth*4+4)*u,V=Math.PI/7;if(r.arrowRight){const re=F-$*Math.cos(ne-V),he=E-$*Math.sin(ne-V),Z=F-$*Math.cos(ne+V),te=E-$*Math.sin(ne+V);M.beginPath(),M.moveTo(F,E),M.lineTo(re,he),M.lineTo(Z,te),M.closePath(),M.fill()}if(r.arrowLeft){const re=ne+Math.PI,he=C-$*Math.cos(re-V),Z=U-$*Math.sin(re-V),te=C-$*Math.cos(re+V),ae=U-$*Math.sin(re+V);M.beginPath(),M.moveTo(C,U),M.lineTo(he,Z),M.lineTo(te,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,Z=r.p1.price,te=r.p2.price,ae=[];if(r.statsPriceRange){const se=Math.abs(te-Z),le=Z!==0?Math.abs((te-Z)/Z*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),Be=o.timeScale().coordinateToLogical(le);pe!=null&&Be!=null&&ce.push("↔ "+Math.abs(Math.round(Be-pe))+" bars")}}catch{}if(r.statsDateRange){const se=Math.abs(he-re),le=Math.floor(se/86400),pe=Math.floor(se%86400/3600),Be=Math.floor(se%3600/60);let Fe=le>0?le+" day"+(le!==1?"s":""):"";pe>0&&(Fe+=(Fe?" ":"")+pe+" hour"+(pe!==1?"s":"")),!le&&!pe&&(Fe=Be+" min"+(Be!==1?"s":"")),r.statsBarsRange&&ce.length>0?ce[ce.length-1]+=" ("+Fe+")":ce.push(Fe)}if(r.statsDistance){const se=N/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=N/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,Be=5*se;M.font=le+"px sans-serif";const Ue=ae.reduce((Ce,de)=>Math.max(Ce,M.measureText(de).width),0)+Be*2,ye=ae.length*pe+Be*2,[Te,ve,be,Le]=C<=F?[C,U,F,E]:[F,E,C,U];let Re,Ke;r.statsPosition==="left"?(Re=Te,Ke=ve):r.statsPosition==="center"?(Re=(Te+be)/2,Ke=(ve+Le)/2):(Re=be,Ke=Le);const xe=Re-Ue/2,De=Ke-ye-12*se;M.fillStyle="rgba(20, 20, 30, 0.72)",M.fillRect(xe,De,Ue,ye),M.strokeStyle=r.statsColor,M.lineWidth=1*se,M.strokeRect(xe,De,Ue,ye),M.fillStyle=r.statsColor,M.textBaseline="top",M.textAlign="left",ae.forEach((Ce,de)=>{M.fillText(Ce,xe+Be,De+Be+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 Yv{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,ne,$,V]=E<=R?[E,N,R,M]:[R,M,E,N];let Ae=$-z,re=V-ne;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Z=o.context;if(Z.save(),Z.strokeStyle=n.color,Z.fillStyle=n.color,Z.lineWidth=n.lineWidth*v,Z.setLineDash([]),n.rayLeft){const le=ne+he*(0-z);Z.beginPath(),Z.moveTo(0,le),Z.lineTo(z,ne),Z.stroke()}if(n.rayRight){const se=o.bitmapSize.width,le=V+he*(se-$);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,le),Z.stroke()}const te=Math.atan2(re,Ae),ae=(n.lineWidth*4+4)*v,ce=Math.PI/7;if(n.arrowRight){const se=$-ae*Math.cos(te-ce),le=V-ae*Math.sin(te-ce),pe=$-ae*Math.cos(te+ce),Be=V-ae*Math.sin(te+ce);Z.beginPath(),Z.moveTo($,V),Z.lineTo(se,le),Z.lineTo(pe,Be),Z.closePath(),Z.fill()}if(n.arrowLeft){const se=te+Math.PI,le=z-ae*Math.cos(se-ce),pe=ne-ae*Math.sin(se-ce),Be=z-ae*Math.cos(se+ce),Fe=ne-ae*Math.sin(se+ce);Z.beginPath(),Z.moveTo(z,ne),Z.lineTo(le,pe),Z.lineTo(Be,Fe),Z.closePath(),Z.fill()}if(c){const se=n.p1.rawTime??n.p1.time,le=n.p2.rawTime??n.p2.time,pe=n.p1.price,Be=n.p2.price,Fe=[];if(n.statsPriceRange){const ye=Math.abs(Be-pe),Te=pe!==0?Math.abs((Be-pe)/pe*100):0,ve=ye<1e-4?6:ye<.01?5:ye<1?4:2;Fe.push("↕ "+ye.toFixed(ve)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(n.statsBarsRange)try{const ye=u.timeScale().timeToCoordinate(se),Te=u.timeScale().timeToCoordinate(le);if(ye!=null&&Te!=null){const ve=u.timeScale().coordinateToLogical(ye),be=u.timeScale().coordinateToLogical(Te);ve!=null&&be!=null&&Ue.push("↔ "+Math.abs(Math.round(be-ve))+" bars")}}catch{}if(n.statsDateRange){const ye=Math.abs(le-se),Te=Math.floor(ye/86400),ve=Math.floor(ye%86400/3600),be=Math.floor(ye%3600/60);let Le=Te>0?Te+" day"+(Te!==1?"s":""):"";ve>0&&(Le+=(Le?" ":"")+ve+" hour"+(ve!==1?"s":"")),!Te&&!ve&&(Le=be+" min"+(be!==1?"s":"")),n.statsBarsRange&&Ue.length>0?Ue[Ue.length-1]+=" ("+Le+")":Ue.push(Le)}if(n.statsDistance){const ye=(R-E)/y,Te=(M-N)/v;Ue.push("distance: "+Math.sqrt(ye*ye+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),n.statsAngle){const ye=Ae/y,Te=re/v,ve=Math.atan2(Te,ye)*180/Math.PI;Fe.push("∠ "+ve.toFixed(0)+"°")}if(Fe.length>0){const ye=Math.min(y,v),Te=11*ye,ve=Te*1.5,be=5*ye;Z.font=Te+"px sans-serif";const Re=Fe.reduce((_e,et)=>Math.max(_e,Z.measureText(et).width),0)+be*2,Ke=Fe.length*ve+be*2;let xe,De;n.statsPosition==="left"?(xe=z,De=ne):n.statsPosition==="center"?(xe=(z+$)/2,De=(ne+V)/2):(xe=$,De=V);const Ce=xe-Re/2,de=De-Ke-12*ye;Z.fillStyle="rgba(20, 20, 30, 0.72)",Z.fillRect(Ce,de,Re,Ke),Z.strokeStyle=n.statsColor,Z.lineWidth=1*ye,Z.strokeRect(Ce,de,Re,Ke),Z.fillStyle=n.statsColor,Z.textBaseline="top",Z.textAlign="left",Fe.forEach((_e,et)=>{Z.fillText(_e,Ce+be,de+be+et*ve)})}}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 qv{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,ne=N+2*R,$=T-ne-Math.round(2*l),V=v-z/2;U.fillStyle=A.color,U.fillRect($,V,ne,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,ne=Math.round(6*l),$=Math.round(3*c),V=M+2*$,Ae=z+2*ne,re=y-Ae/2,he=C-V-Math.round(4*c);U.fillStyle=A.color,U.fillRect(re,he,Ae,V),U.fillStyle="#ffffff",U.fillText(R,y,he+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 jv{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)),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 Be=U+re*(0-C);Ae.beginPath(),Ae.moveTo(0,Be),Ae.lineTo(C,U),Ae.stroke()}if(r.rayRight){const pe=s.bitmapSize.width,Be=E+re*(pe-F);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,Be),Ae.stroke()}Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(F,E),Ae.stroke();const he=Math.atan2(z,M),Z=(r.lineWidth*4+4)*u,te=Math.PI/7;if(r.arrowRight){const pe=F-Z*Math.cos(he-te),Be=E-Z*Math.sin(he-te),Fe=F-Z*Math.cos(he+te),Ue=E-Z*Math.sin(he+te);Ae.beginPath(),Ae.moveTo(F,E),Ae.lineTo(pe,Be),Ae.lineTo(Fe,Ue),Ae.closePath(),Ae.fill()}if(r.arrowLeft){const pe=he+Math.PI,Be=C-Z*Math.cos(pe-te),Fe=U-Z*Math.sin(pe-te),Ue=C-Z*Math.cos(pe+te),ye=U-Z*Math.sin(pe+te);Ae.beginPath(),Ae.moveTo(C,U),Ae.lineTo(Be,Fe),Ae.lineTo(Ue,ye),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,$,$<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($/2),se=E+(ae+10*u)*Math.sin($/2);if(Ae.fillText(`${V}°`,ce,se),(r.statsShowAlways||r.isActive)&&(r.statsPriceRange||r.statsDistance)){const pe=r.p1.price,Be=r.p2.price,Fe=[];if(r.statsPriceRange){const ye=Math.abs(Be-pe),Te=pe!==0?Math.abs((Be-pe)/pe*100):0,ve=ye<1e-4?6:ye<.01?5:ye<1?4:2;Fe.push("↕ "+ye.toFixed(ve)+" ("+Te.toFixed(2)+"%)")}const Ue=[];if(r.statsDistance){const ye=M/c,Te=z/u;Ue.push("distance: "+Math.sqrt(ye*ye+Te*Te).toFixed(2))}if(Ue.length>0&&Fe.push(Ue.join(", ")),Fe.length>0){const ye=Math.min(c,u),Te=11*ye,ve=Te*1.5,be=5*ye;Ae.font=Te+"px sans-serif";const Re=Fe.reduce((ut,fA)=>Math.max(ut,Ae.measureText(fA).width),0)+be*2,Ke=Fe.length*ve+be*2,[xe,De,Ce,de]=C<=F?[C,U,F,E]:[F,E,C,U];let _e,et;r.statsPosition==="left"?(_e=xe,et=De):r.statsPosition==="center"?(_e=(xe+Ce)/2,et=(De+de)/2):(_e=Ce,et=de);const rt=_e-Re/2,nt=et-Ke-12*ye;Ae.fillStyle="rgba(20, 20, 30, 0.72)",Ae.fillRect(rt,nt,Re,Ke),Ae.strokeStyle=r.statsColor,Ae.lineWidth=1*ye,Ae.strokeRect(rt,nt,Re,Ke),Ae.fillStyle=r.statsColor,Ae.textBaseline="top",Ae.textAlign="left",Fe.forEach((ut,fA)=>{Ae.fillText(ut,rt+be,nt+be+fA*ve)})}}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 eT{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,ne=F*u,$=(R+z)/2,V=(M+ne)/2;let Ae=$-E,re=V-N;Math.abs(Ae)<1e-4&&(Ae=1e-4);const he=re/Ae,Z=s.bitmapSize.width,te=(R-z)/2,ae=(M-ne)/2,ce=ye=>({x:$+te*ye,y:V+ae*ye}),se=(ye,Te)=>({x:Z,y:Te+he*(Z-ye)}),le=ce(1),pe=ce(-1),Be=se(le.x,le.y),Fe=se(pe.x,pe.y);m.save(),m.beginPath(),m.moveTo(le.x,le.y),m.lineTo(Be.x,Be.y),m.lineTo(Fe.x,Fe.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,ne),m.stroke(),r._levels.forEach(ye=>{const Te=ce(ye.k),ve=se(Te.x,Te.y);m.beginPath(),m.strokeStyle=ye.color,m.lineWidth=ye.width*u,m.moveTo(Te.x,Te.y),m.lineTo(ve.x,ve.y),m.stroke()});const Ue=se(E,N);m.beginPath(),m.strokeStyle="rgba(161, 98, 7, 0.9)",m.lineWidth=1.1*u,m.moveTo(E,N),m.lineTo(Ue.x,Ue.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 tT{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,ne=z>0?N:0,$=C+z*Math.min(220*l,Math.max(80*l,N*.35)),V=A._rays.map(re=>{const he=M*re.ratio;return{...re,yEnd:U+he*(ne-C),yLabel:U+he*($-C)}});u.save();const Ae=(re,he,Z)=>{!re||!he||(u.beginPath(),u.moveTo(C,U),u.lineTo(ne,re.yEnd),u.lineTo(ne,he.yEnd),u.closePath(),u.fillStyle=Z,u.fill())};Ae(V[0],V[3],"rgba(161, 98, 7, 0.10)"),Ae(V[3],V[4],"rgba(5, 150, 105, 0.10)"),Ae(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(ne,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 he=$+(z>0?4*l:-4*l),Z=re.yLabel;Z<-20||Z>n.bitmapSize.height+20||u.fillText(re.label,he,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 AT{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 ne=R/z,$=M/z,V=-$,Ae=ne,re=E+V*z,he=N+Ae*z,Z=U+V*z,te=F+Ae*z,ae=(se,le)=>({x:U+ne*z*se+V*z*le,y:F+$*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,Be=ae(0,le),Fe=ae(1,le),Ue=ae(1,pe),ye=ae(0,pe);m.beginPath(),m.moveTo(Be.x,Be.y),m.lineTo(Fe.x,Fe.y),m.lineTo(Ue.x,Ue.y),m.lineTo(ye.x,ye.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),Be=ae(1,le),Fe=ae(le,0),Ue=ae(le,1);m.beginPath(),m.moveTo(pe.x,pe.y),m.lineTo(Be.x,Be.y),m.stroke(),m.beginPath(),m.moveTo(Fe.x,Fe.y),m.lineTo(Ue.x,Ue.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,N),m.lineTo(Z,te),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,he),m.lineTo(Z,te),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 qa{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,ne=N.verticalPixelRatio,$=[F.p1,F.p3,F.p4,F.p2].map(Ke=>{const xe=R.timeScale().timeToCoordinate(Ke.rawTime),De=M.priceToCoordinate(Ke.price);return xe==null||De==null?null:{x:xe*z,y:De*ne}}).filter(Boolean);if($.length!==4)return;const[V,Ae,re,he]=$,Z=N.context;Z.save();const te=Ae.x-V.x,ae=Ae.y-V.y,ce=Math.sqrt(te*te+ae*ae)||1,se=te/ce,le=ae/ce,pe=re.x-he.x,Be=re.y-he.y,Fe=Math.sqrt(pe*pe+Be*Be)||1,Ue=pe/Fe,ye=Be/Fe,Te=1e5,ve=F.rayLeft?{x:V.x-se*Te,y:V.y-le*Te}:V,be=F.rayRight?{x:Ae.x+se*Te,y:Ae.y+le*Te}:Ae,Le=F.rayLeft?{x:he.x-Ue*Te,y:he.y-ye*Te}:he,Re=F.rayRight?{x:re.x+Ue*Te,y:re.y+ye*Te}:re;if(F.showBackground){const Ke=F.fillColor||"#6aa84f",xe=parseInt(Ke.slice(1,3),16),De=parseInt(Ke.slice(3,5),16),Ce=parseInt(Ke.slice(5,7),16);Z.beginPath(),Z.moveTo(V.x,V.y),Z.lineTo(Ae.x,Ae.y),Z.lineTo(re.x,re.y),Z.lineTo(he.x,he.y),Z.closePath(),Z.fillStyle=`rgba(${xe},${De},${Ce},${F.fillOpacity??.1})`,Z.fill()}if(Z.strokeStyle=F.lineColor,Z.lineWidth=F.lineWidth*ne,Z.setLineDash([]),Z.beginPath(),Z.moveTo(ve.x,ve.y),Z.lineTo(be.x,be.y),Z.moveTo(Le.x,Le.y),Z.lineTo(Re.x,Re.y),Z.moveTo(V.x,V.y),Z.lineTo(he.x,he.y),Z.moveTo(Ae.x,Ae.y),Z.lineTo(re.x,re.y),Z.stroke(),F.arrowLeft||F.arrowRight){const Ke=8*ne,xe=(De,Ce,de)=>{Z.save(),Z.translate(De,Ce),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&&(xe(ve.x,ve.y,Math.atan2(-le,-se)),xe(Le.x,Le.y,Math.atan2(-ye,-Ue))),F.arrowRight&&(xe(be.x,be.y,Math.atan2(le,se)),xe(Re.x,Re.y,Math.atan2(ye,Ue)))}if(Z.fillStyle="#ffffff",Z.strokeStyle="#3b82f6",Z.lineWidth=2*ne,[V,Ae,re,he].forEach(Ke=>{Z.beginPath(),Z.arc(Ke.x,Ke.y,6*ne,0,Math.PI*2),Z.fill(),Z.stroke()}),F.showPrices){const Ke=[F.p1,F.p3,F.p2,F.p4],xe=[V,Ae,he,re];Z.fillStyle=F.pricesColor||F.lineColor,Z.font=`${Math.round(10*ne)}px sans-serif`,Z.textAlign="left",Z.textBaseline="middle",xe.forEach((De,Ce)=>{const de=Ke[Ce]?.price;typeof de=="number"&&Z.fillText(de.toFixed(5),De.x+8*z,De.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 qd extends qa{constructor(e,t,A,r,n={}){super(e,t,A,r,{lineColor:"#3b82f6",fillColor:"#3b82f6",fillOpacity:.12,pricesColor:"#3b82f6",...n})}}class jd{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 ja{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),Ae=y.priceToCoordinate($.price);return V==null||Ae==null?null:{x:V*v,y:Ae*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 ne=($,V,Ae)=>{C.beginPath(),C.strokeStyle=Ae,C.lineWidth=l.lineWidth*T,C.setLineDash([]),C.moveTo($.x,$.y),C.lineTo(V.x,V.y),C.stroke()};if(ne(N,R,l.upperStrokeColor),ne(F,E,l.centerStrokeColor),ne(M,z,l.lowerStrokeColor),l.showDeviationLabel){const $=Math.abs(l.top1.price-l.mid1.price),V=Number.isFinite($)?$.toFixed(5):null;if(V){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(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 ep extends ja{}class tp{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:Ae})=>{const re=C($),he=C(V),Z=o.priceToCoordinate(re),te=o.priceToCoordinate(he);if(Z==null||te==null)return;const ae=Math.round(Z*c),ce=Math.round(te*c);u.fillStyle=Ae,u.fillRect(R,Math.min(ae,ce),z,Math.abs(ce-ae))}),A._levels.forEach(({ratio:$,label:V})=>{const Ae=C($),re=o.priceToCoordinate(Ae);if(re==null)return;const he=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,he),u.lineTo(M,he),u.stroke(),u.setLineDash([])});const ne=Math.round(11*c);if(u.font=`${ne}px sans-serif`,u.textAlign="left",A._levels.forEach(({ratio:$,label:V})=>{const Ae=C($),re=o.priceToCoordinate(Ae);if(re==null)return;const he=Math.round(re*c),Z=A._levelColors[$]||"#888888",te=`${V} (${Ae.toFixed(5)})`;u.fillStyle=Z,u.textAlign="right",u.fillText(te,R-4*l,he-4*c)}),U!=null&&F!=null&&E!=null&&N!=null){const $=Math.round(U*l),V=Math.round(E*c),Ae=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(Ae,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(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 iT{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 N=y.measureText(F).width,R=Math.round(6*o.horizontalPixelRatio),M=Math.round(3*o.verticalPixelRatio),z=E+2*M,ne=N+2*R,$=u-ne/2,V=m-z-Math.round(4*o.verticalPixelRatio);y.fillStyle=n.color,y.fillRect($,V,ne,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 Ap(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 rT(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 ip(i,e,t){const A=i?.primitive??{},r=Number(A.fontSize)||12,n=!!A.textWrap,s=rT(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 nT{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=le=>{if(!r.textWrap||le.length===0){N.push(le);return}const pe=le.split(/\s+/);let Be="";for(const Fe of pe){const Ue=Be?`${Be} ${Fe}`:Fe;C.measureText(Ue).width<=E||!Be?Be=Ue:(N.push(Be),Be=Fe)}N.push(Be)};F.split(`
|
|
12
|
+
`).forEach(R),N.length===0&&N.push("");const M=N.map(le=>C.measureText(le).width),z=Math.max(...M,20*m),ne=8*m,$=5*y,V=z+ne*2,Ae=U*1.2,re=Ae*N.length+$*2,he=["left","center","right"].includes(r.textAlign)?r.textAlign:"center",Z=v-V/2,te=T-re;r.bgEnabled&&(C.fillStyle=Ap(r.bgColor,Math.max(0,Math.min(1,r.bgOpacity??.1))),C.beginPath(),C.rect(Z,te,V,re),C.fill()),r.borderEnabled&&(C.strokeStyle=Ap(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,te,V,re),C.stroke()),C.fillStyle=r.color,C.textAlign=he,C.textBaseline="middle";const ae=he==="left"?Z+ne:he==="right"?Z+V-ne:Z+V/2;for(let le=0;le<N.length;le++)C.fillText(N[le],ae,te+$+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 sT={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function rp(i){if(!i)return 7;const e=String(i).toUpperCase();return sT[e]??7}function oT(i,e){const t=String(i||"").toUpperCase(),A=e||rp(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 WA=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 ht(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 aT(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 lT(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 gi(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 np(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 Ar(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($=>({time:j($.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=$,Ae=l[$].close;u+=V,m+=Ae,y+=V*Ae,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*$,Ae=l[$].close-V;F+=Ae*Ae}const E=Math.sqrt(F/c),N=Math.max(E*A,1e-8),R=l[0].time,M=l[c-1].time,z=U,ne=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:ne},top1:{rawTime:R,normalizedTime:R,price:z+N},top2:{rawTime:M,normalizedTime:M,price:ne+N},bot1:{rawTime:R,normalizedTime:R,price:z-N},bot2:{rawTime:M,normalizedTime:M,price:ne-N}}}function Xr(i,e,t,A=1){return Ar(i,e,t,A)}const cT={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}},hT={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 uT(i,e){if(!i||!i.type)return!1;const t=cT[i.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!i[A])}function dT(i){return i?hT[i]??"#22c55e":"#22c55e"}const pT=300,sp=24,fT=150,op=150;function el(i,e,t=pT){if(!Array.isArray(i)||i.length===0)return[];const A=uA(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 gT(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 mT(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 ks(i,e,t,A){const r=j(e),n=j(t),s=uA(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=mT(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 ap(i,e,t){if(!i)return!1;const A=i.timeScale();if(!A)return!1;const r=gT(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(op,y/2),T=Math.max(20,y-v),C={from:c-T,to:c+v};try{return A.setVisibleLogicalRange(C),!0}catch{}}}const s=uA(t),o=Number.isFinite(s)&&s>0?s:60,l={from:r-fT*o,to:r+op*o};try{return A.setVisibleRange(l),!0}catch{return!1}}const wT=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),N=q.useRef([]),[R,M]=q.useState(null),[z,ne]=q.useState(null),[$,V]=q.useState([]),[Ae,re]=q.useState(null),[he,Z]=q.useState([]),te=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(f=>{if(f.type==="trendline"&&f.decoration){const k=f===R;f.decoration.isSelected!==k&&(f.decoration.isSelected=k,p=!0)}}),p&&c.current?.applyOptions({})},[R]);const pe=q.useRef(new Map),Be=q.useRef(null),Fe=q.useRef(null),Ue=(p,f)=>`${p}_${f}`,ye=()=>{const p=Ue(Ce,de);return pe.current.get(p)||null},Te=p=>{if(!p)return;const f=Ue(Ce,de);pe.current.set(f,p)},{activeTool:ve,setActiveTool:be,showGrid:Le,snapToGrid:Re,chartObjects:Ke,setChartObjects:xe,orders:De,selectedSymbol:Ce,selectedTimeframe:de,drawingsVisible:_e,chartType:et,chartLocked:rt,theme:nt,candleColors:ut,showTradeOrders:fA,showTradePosition:Xe,showTradeHistory:ke,showSLTP:at,showAskPrice:it,showChartControls:Ct,showCrosshair:bt,showOHLC:$A,currentSymbolData:XA,baseUrl:Rt,endpoints:gA,endpointParams:JA,indicators:Yt,indicatorSettings:Et}=Vt(),QA=q.useRef({}),[st,ft]=q.useState({}),Ut=q.useRef(0),Tt=q.useRef([]),[Je,Ie]=q.useState(!1),[tt,$e]=q.useState(null),[me,ze]=q.useState([]),[Pe,At]=q.useState(!0),[Ne,Ye]=q.useState(null),[wt,Lt]=q.useState(0),cA=q.useMemo(()=>{const p=me.map(f=>j(f?.time)).filter(f=>Number.isFinite(f));return p.sort((f,k)=>f-k),p},[me]),mA=q.useRef(null),ir=q.useRef(new Map);q.useRef(null);const fp=q.useRef(0),HA=q.useRef(null),rr=q.useRef(!1),jr=q.useRef(!1);q.useEffect(()=>{const p=m.current;p&&p.setData(el(me,de))},[me,de]),q.useImperativeHandle(s,()=>({zoomIn:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},zoomOut:()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f||!f.from||!f.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const p=o.current;if(!p){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const f=p.querySelectorAll("canvas"),k=nt==="light"?"#ffffff":"#12161d";let ge=null,H=0;if(f.forEach(X=>{if(X.width>0&&X.height>0){const J=X.width*X.height;J>H&&(H=J,ge=X)}}),ge)try{const X=document.createElement("canvas");X.width=ge.width,X.height=ge.height;const J=X.getContext("2d");J.fillStyle=k,J.fillRect(0,0,X.width,X.height),J.drawImage(ge,0,0);const ie=document.createElement("a");ie.download=`chart-${Ce}-${de}-${Date.now()}.png`,ie.href=X.toDataURL("image/png"),ie.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(X){console.warn("Canvas export failed, trying html2canvas",X)}Nv(p,{useCORS:!0,allowTaint:!0,backgroundColor:k,scale:2,logging:!1}).then(X=>{const J=document.createElement("a");J.download=`chart-${Ce}-${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")})}}),[Ce,de,nt]);const il=q.useMemo(()=>me.length===0?[]:et==="line"||et==="area"?me.map(p=>({time:p.time,value:p.close})):me,[me,et]),KT=p=>{r?r(p):($e("BUY"),Ie(!0))},VT=p=>{n?n(p):($e("SELL"),Ie(!0))},zT=()=>{Ie(!1),$e(null)},WT=p=>{const f=z;if(!f||!p)return;const k=(X,J)=>{if(typeof X!="string")return J;const ie=X.trim(),oe=ie.startsWith("#")?ie:`#${ie}`;return/^#[0-9A-Fa-f]{6}$/.test(oe)?oe.toLowerCase():J},ge=(X,J)=>{const ie=Number(X);return Number.isFinite(ie)?Math.max(0,Math.min(1,ie)):J};let H={...f,visibleTimeframes:Array.isArray(p.visibleTimeframes)?[...p.visibleTimeframes]:f.visibleTimeframes};if(f.type==="text"){const X=Number.isFinite(Number(p.price))?Number(p.price):f.price,J=f.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=ge(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=ge(p.bgOpacity,J.bgOpacity??.1),J.price=X),H={...H,price:X,text:typeof p.text=="string"?p.text:f.text}}if(f.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(f.series)try{f.series.applyOptions({color:X,lineWidth:J})}catch{}const ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.point1?.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.point2?.price;if(f.series&&f.point1&&f.point2){const Y=f.point1.time??f.point1.rawTime,B=f.point2.time??f.point2.rawTime;try{const h=WA([{time:Y,value:ie},{time:B,value:oe}]);h.length>0&&f.series.setData(h)}catch{}}const S={...f.point1,price:ie},O={...f.point2,price:oe};f.decoration&&(f.decoration.color=X,f.decoration.lineWidth=J,f.decoration.arrowLeft=!!p.arrowLeft,f.decoration.arrowRight=!!p.arrowRight,f.decoration.rayLeft=!!p.rayLeft,f.decoration.rayRight=!!p.rayRight,f.decoration.statsColor=k(p.statsColor,"#5f8f96"),f.decoration.statsPosition=p.statsPosition??"right",f.decoration.statsShowAlways=!!p.statsShowAlways,f.decoration.statsPriceRange=!!p.statsPriceRange,f.decoration.statsBarsRange=!!p.statsBarsRange,f.decoration.statsDateRange=!!p.statsDateRange,f.decoration.statsAngle=!!p.statsAngle,f.decoration.statsDistance=!!p.statsDistance,f.decoration.p1=S,f.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:f.decoration}}if(f.type==="pricelevel"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showPrice!==!1,oe=!!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):f.price;if(f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,lineWidth:J,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const b=u.current;if(oe&&S&&b)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=O,f.textPrimitive.hAlign=Y,f.textPrimitive.vAlign=B,f.textPrimitive.price=h;else{const I=new Jd(h,{text:S,textColor:O,hAlign:Y,vAlign:B});try{b.attachPrimitive(I)}catch{}f.textPrimitive=I}else if(f.textPrimitive&&b){try{b.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ie,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:f.textPrimitive}}if(f.type==="horizontalray"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showPrice!==!1,oe=!!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):f.price,b=f.primitive;if(b&&(b.price=h,b.color=X,b.lineWidth=J),f.priceLine)try{f.priceLine.applyOptions({price:h,color:X,axisLabelVisible:ie,title:ie&&typeof h=="number"?h.toFixed(5):""})}catch{}const I=u.current;if(oe&&S&&I)if(f.textPrimitive)f.textPrimitive.text=S,f.textPrimitive.textColor=O,f.textPrimitive.hAlign=Y,f.textPrimitive.vAlign=B,f.textPrimitive.price=h,f.textPrimitive.originTime=f.rawOriginTime;else{const w=new Jd(h,{text:S,textColor:O,hAlign:Y,vAlign:B,originTime:f.rawOriginTime});try{I.attachPrimitive(w)}catch{}f.textPrimitive=w}else if(f.textPrimitive&&I){try{I.detachPrimitive(f.textPrimitive)}catch{}f.textPrimitive=null}H={...H,price:h,lineColor:X,lineWidth:J,showPrice:ie,showText:oe,textContent:S,textColor:O,textHAlign:Y,textVAlign:B,textPrimitive:f.textPrimitive}}if(f.type==="verticalline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.showDate!==!1,oe=f.primitive;oe&&(oe.color=X,oe.lineWidth=J,oe.showDate=ie),H={...H,lineColor:X,lineWidth:J,showDate:ie}}if(f.type==="infoline"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=p.statsShowAlways!==!1,oe=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):f.p1.price,w=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,d=f.p1.rawTime,_=f.p2.rawTime,Q=w-I,L=I!==0?Q/Math.abs(I)*100:0,x=f.p1.normalizedTime??0,g=f.p2.normalizedTime??0,D=uA(de)||3600,P=Math.abs(g-x),K=Math.max(1,Math.round(P/D)),W=Math.max(1,Math.round(P/86400)),G=c.current,ee=u.current,ue=G?G.timeScale().timeToCoordinate(d):null,we=ee?ee.priceToCoordinate(I):null,Qe=G?G.timeScale().timeToCoordinate(_):null,Ee=ee?ee.priceToCoordinate(w):null,We=ue!=null&&we!=null&&Qe!=null&&Ee!=null?Math.atan2(-(Ee-we),Qe-ue)*(180/Math.PI):f.primitive?.info?.angle??0,qe={priceDiff:Q,pricePct:L,bars:K,days:W,angle:We},Ve=f.primitive;Ve&&(Ve.color=X,Ve.lineWidth=J,Ve.statsShowAlways=ie,Ve.statsColor=oe,Ve.statsPosition=S,Ve.statsPriceRange=O,Ve.statsBarsRange=Y,Ve.statsDateRange=B,Ve.statsAngle=h,Ve.statsDistance=b,Ve.p1={...f.p1,price:I},Ve.p2={...f.p2,price:w},Ve.info=qe),H={...H,lineColor:X,lineWidth:J,statsShowAlways:ie,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B,statsAngle:h,statsDistance:b,p1:{...f.p1,price:I},p2:{...f.p2,price:w}}}if(f.type==="rulerline"){const X=k(p.lineColor,"#3b82f6"),J=p.showArea!==!1,ie=!!p.statsShowAlways,oe=k(p.statsColor,"#5f8f96"),S=["left","center","right"].includes(p.statsPosition)?p.statsPosition:"right",O=!!p.statsPriceRange,Y=!!p.statsBarsRange,B=!!p.statsDateRange,h=f.primitive;h&&(h.lineColor=X,h.showArea=J,h.statsShowAlways=ie,h.statsColor=oe,h.statsPosition=S,h.statsPriceRange=O,h.statsBarsRange=Y,h.statsDateRange=B),H={...H,lineColor:X,showArea:J,statsShowAlways:ie,statsColor:oe,statsPosition:S,statsPriceRange:O,statsBarsRange:Y,statsDateRange:B}}if(f.type==="arrowedline"){const X=k(p.lineColor,"#f59e0b"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.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={...f.p1,price:ie},S.p2={...f.p2,price:oe}),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:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="rayline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.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={...f.p1,price:ie},S.p2={...f.p2,price:oe}),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:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="extendedline"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.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={...f.p1,price:ie},S.p2={...f.p2,price:oe}),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:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="crossline"){const X=k(p.lineColor,"#06a0e3"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.price))?Number(p.price):f.p.price,oe=f.primitive;oe&&(oe.color=X,oe.lineWidth=J,oe.showTime=!!p.showTime,oe.showPrice=!!p.showPrice,oe.center={...f.p,price:ie}),H={...H,lineColor:X,lineWidth:J,showTime:!!p.showTime,showPrice:!!p.showPrice,p:{...f.p,price:ie}}}if(f.type==="trendbyangle"){const X=k(p.lineColor,"#7aa6ae"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,oe=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p2.price,S=f.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={...f.p1,price:ie},S.p2={...f.p2,price:oe}),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:{...f.p1,price:ie},p2:{...f.p2,price:oe}}}if(f.type==="disjointchannel"){const X=k(p.lineColor,"#129f5c"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=k(p.fillColor,"#6aa84f"),oe=ge(p.fillOpacity,.1),S=k(p.pricesColor,"#129f5c"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ie,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={...f.p1,price:O},h.p3={...f.p3,price:Y},h.p2={...f.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ie,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:O},p3:{...f.p3,price:Y},p2:{...f.p2,price:B}}}if(f.type==="flattopbottom"){const X=k(p.lineColor,"#3b82f6"),J=Math.max(1,Math.min(5,Number.isFinite(Number(p.lineWidth))?Number(p.lineWidth):2)),ie=k(p.fillColor,"#3b82f6"),oe=ge(p.fillOpacity,.12),S=k(p.pricesColor,"#3b82f6"),O=Number.isFinite(Number(p.point1Price))?Number(p.point1Price):f.p1.price,Y=Number.isFinite(Number(p.point2Price))?Number(p.point2Price):f.p3.price,B=Number.isFinite(Number(p.point3Price))?Number(p.point3Price):f.p2.price,h=f.primitive;h&&(h.lineColor=X,h.lineWidth=J,h.fillColor=ie,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={...f.p1,price:O},h.p3={...f.p3,price:Y},h.p2={...f.p2,price:B}),H={...H,lineColor:X,lineWidth:J,fillColor:ie,fillOpacity:oe,showBackground:!!p.showBackground,showPrices:!!p.showPrices,pricesColor:S,rayLeft:!!p.rayLeft,rayRight:!!p.rayRight,arrowLeft:!!p.arrowLeft,arrowRight:!!p.arrowRight,p1:{...f.p1,price:O},p3:{...f.p3,price:Y},p2:{...f.p2,price:B}}}xe(X=>{const J=X.map(ie=>ie===f?H:ie);return v.current=J,J}),ce.current===f&&(ce.current=H),M(X=>X===f?H:X),re(X=>X===f?H:X),ne(H);try{c.current?.applyOptions({})}catch{}};q.useEffect(()=>{const p=o.current;if(!p)return;const f=p.getBoundingClientRect(),k=w=>{const d=Math.abs(Number(w));return Number.isFinite(d)?d>=1e3?d.toFixed(2):d.toFixed(5):"0"},ge=nt==="light",H=s1(p,{width:f.width||p.clientWidth,height:f.height||p.clientHeight,autoSize:!0,localization:{priceFormatter:k},layout:{background:{color:ge?"#FFFFFF":"#0d1117",type:"solid"},textColor:ge?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:Le,color:Le?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?ge?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}},rightPriceScale:{borderColor:ge?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,minimumWidth:80,textColor:ge?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:ge?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:ve===1?1:0,vertLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:ge?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:ge?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:ve===1,horzLineVisible:ve===1},handleScroll:{mouseWheel:!0,pressedMouseMove:ve===null||ve===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),X=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),J=X.includes("JPY"),ie=tn(X),oe=en(X);let S,O;J?(S=.001,O=w=>Math.abs(Number(w)).toFixed(3)):ie?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:ge?"#089981":"#26a69a",downColor:ge?"#f23645":"#ef5350",wickUpColor:ge?"#089981":"#26a69a",wickDownColor:ge?"#f23645":"#ef5350",borderUpColor:ge?"#089981":"#26a69a",borderDownColor:ge?"#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(el(me,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&&ir.current.size>0){const w=h.getVisibleRange();w&&Te(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=[],HA.current&&clearTimeout(HA.current)}},[]),q.useEffect(()=>{c.current&&c.current.applyOptions({grid:{vertLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0},horzLines:{visible:Le,color:Le?"rgba(110, 118, 129, 0.15)":"transparent",style:Le?2:0}}})},[Le]),q.useEffect(()=>{const p=c.current;if(!p)return;const f=nt==="light";p.applyOptions({layout:{background:{color:f?"#FFFFFF":"#12161d"},textColor:f?"#020617":"#fff"},grid:{vertLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:Le?f?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:f?"#e5e7eb":"#1e293b"},timeScale:{borderColor:f?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1},horzLine:{color:f?"#3b82f6":"#58a6ff",labelBackgroundColor:f?"#eff6ff":"#161b22",width:1}}})},[nt,Le]),q.useEffect(()=>{const p=u.current;!p||!ut||p.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})},[ut]),q.useEffect(()=>{if(!c.current)return;const f=!rt&&!(ve!==null&&ve!==1&&ve!==0),k=!rt;c.current.applyOptions({crosshair:{mode:ve===1?1:0,vertLine:{visible:ve===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:ve===1||bt,width:1,color:nt==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:nt==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:k,pressedMouseMove:f,horzTouchDrag:f,vertTouchDrag:f},handleScale:{axisPressedMouseMove:{time:f,price:f},axisDoubleClickReset:{time:!1,price:k},axisTouch:{time:f,price:f},mouseWheel:k,pinch:k}})},[ve,rt,bt,nt]);const RT=()=>{const p=u.current;v.current.forEach(f=>{if(f.primitive){try{p&&p.detachPrimitive(f.primitive)}catch{}if(f.series&&f.series!==p)try{f.series.detachPrimitive(f.primitive)}catch{}}if(f.priceLine&&p)try{p.removePriceLine(f.priceLine)}catch{}if(f.textPrimitive&&p)try{p.detachPrimitive(f.textPrimitive)}catch{}}),v.current=[],xe([]),be(null)},gp=(p,f=!1)=>{p&&v.current.forEach(k=>{if(k.primitive){try{p.detachPrimitive(k.primitive)}catch{}try{p.attachPrimitive(k.primitive)}catch{}}if(f&&k.type==="pricelevel"&&k.priceLine)try{const ge=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,axisLabelVisible:ge,title:ge&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}if(f&&k.type==="horizontalray"&&k.priceLine)try{const ge=k.showPrice!==!1,H=p.createPriceLine({price:k.price,color:k.lineColor??"#3b82f6",lineWidth:k.lineWidth??2,lineStyle:0,lineVisible:!1,axisLabelVisible:ge,title:ge&&typeof k.price=="number"?k.price.toFixed(5):""});k.priceLine=H}catch{}})};q.useEffect(()=>{(async()=>{if(!Ce||!de){ze([]),le.current=!1;return}try{if(HA.current&&(clearTimeout(HA.current),HA.current=null),rr.current=!0,At(!0),Ye(null),ze([]),le.current=!1,jr.current=!1,Fe.current!==null&&Fe.current!==Ce&&RT(),Fe.current=Ce,u.current)try{u.current.setData([])}catch{}const f=rp(de),k=oT(de,f),ge=Rt||Vv?.VITE_BASE_URL||"http://localhost:5002",H=gA?.candles||"/api/chart/candles",X=JA?.candles||{},J={symbol:X.symbol||"symbol",timeframe:X.timeframe||"timeframe",limit:X.limit||"limit",daysBack:X.daysBack||"daysBack"},ie={};ie[J.symbol]=Ce,ie[J.timeframe]=de,ie[J.limit]=k,X.daysBack!==!1&&(ie[J.daysBack]=f);const oe=await gt.get(`${ge}${H}`,{params:ie,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}=cl(S,Ce,de);O.length>0?(ze(O),ir.current=new Map,O.forEach(B=>{ir.current.set(B.time,B)}),jr.current=!0,rr.current=!1,mA.current?.connected&&Ce&&de&&mA.current.emit("subscribeCandles",{symbol:Ce,timeframe:de})):(console.warn(`⚠️ No valid candles after processing for ${Ce}`),rr.current=!1,ze([]))}else console.warn(`⚠️ No candle data returned for ${Ce}`),rr.current=!1,ze([])}catch(f){console.error(`❌ Error fetching ${Ce}:`,f.message);const k=f.code==="ECONNABORTED"||f.message&&f.message.includes("timeout");Ye(k?"Request timed out. No data available for this symbol.":f.message||"Failed to load candles."),rr.current=!1,ze([]),At(!1)}})()},[Ce,de,wt]),q.useEffect(()=>{mA.current=On.getSocket();const p=mA.current,f=()=>{if(jr.current&&Ce&&de&&p.connected){const ie={symbol:Ce,timeframe:de};p.emit("subscribeCandles",ie)}},k=()=>{setTimeout(()=>{Ce&&de&&f()},200)},ge=ie=>{},H=ie=>{};p.on("connect",k),p.on("disconnect",ge),p.on("connect_error",H),p.on("subscription:confirmed",ie=>{ie.type});const X=ie=>{if(!jr.current||!ie||!ie.candle||!ie.symbol)return;const oe=_=>String(_||"").toUpperCase().replace(/[^A-Z0-9]/g,"");if(oe(ie.symbol)!==oe(Ce)||ie.timeframe&&ie.timeframe!==de)return;const{candle:S}=ie,O=hl(S,Ce,de);if(!O)return;const Y=Date.now();if(Y-fp.current<200)return;fp.current=Y;const B=c.current?.timeScale(),h=B?.getVisibleRange(),b=u.current,I=c.current;if(!(!b||!I||!le.current&&!jr.current||b?.seriesType?.()!==(et==="line"?"Line":et==="area"?"Area":et==="bars"?"Bar":"Candlestick")))try{const _=ir.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;ir.current.set(O.time,L),Q&&m.current&&m.current.setData(el(Array.from(ir.current.values()),de));try{et==="line"||et==="area"?b.update({time:L.time,value:L.close}):b.update(L),B&&h&&Te(h)}catch(x){throw x}}catch{}};p.on("candleUpdate",X);const J=()=>{p.connected&&Ce&&de&&f()};if(p.connected)J();else{const ie=()=>{setTimeout(J,200)};p.once("connect",ie),setTimeout(()=>{p.connected&&J()},500)}return()=>{p.off("candleUpdate",X),p.off("connect",k),p.off("disconnect",ge),p.off("connect_error",H),p.off("subscription:confirmed"),Ce&&de&&p.connected&&p.emit("unsubscribeCandles",{symbol:Ce,timeframe:de})}},[Ce,de,Rt]),q.useEffect(()=>{const p=u.current,f=c.current;if(!(!p||!f)&&!(rr.current&&me.length>0)&&!(me.length===0&&le.current)){if(me.length===0&&!le.current){if(Pe)return;const k=f.timeScale();p.setData([]),k.fitContent(),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>At(!1)),400);return}if(!le.current){const k=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),ge=k.includes("JPY"),H=en(k),X=tn(k);let J,ie;ge?(J=.001,ie=h=>Math.abs(Number(h)).toFixed(3)):X?k.startsWith("BTC")||k.startsWith("ETH")?(J=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ie=h=>Math.abs(Number(h)).toFixed(4)):H&&(k.startsWith("XAU")||k.startsWith("XAG"))?(J=.01,ie=h=>Math.abs(Number(h)).toFixed(2)):(J=1e-4,ie=h=>Math.abs(Number(h)).toFixed(5));try{p.applyOptions({priceFormat:{type:"custom",minMove:J,formatter:ie}})}catch{}const oe=f.timeScale(),S=Ue(Ce,de);Be.current,Be.current=S;const O=[...me].sort((h,b)=>h.time-b.time);if(et==="line"||et==="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);ut&&p.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor}),gp(p);const Y=uA(de)||60;if(v.current.forEach(h=>{if(h.type==="horizontalray"&&h.primitive){const Q=h.rawOriginTime??h.primitive.originTime,L=Oe(Q,Y);h.primitive.originTime=L,h.originTime=L;return}if(h.type==="verticalline"&&h.primitive){const Q=h.rawTime??h.primitive.time,L=Oe(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,g=O.length>0?O[O.length-1].time:null,D=W=>{const G=Oe(W,Y);return x==null||g==null?G:Math.min(Math.max(G,x),g)},P=D(Q),K=D(L);h.p1.rawTime=P,h.p1.normalizedTime=j(P),h.p2.rawTime=K,h.p2.normalizedTime=j(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,g=O.length>0?O[O.length-1].time:null,D=ue=>{const we=Oe(ue,Y);return x==null||g==null?we:Math.min(Math.max(we,x),g)},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=j(P),G=j(K),ee=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:ks(cA,P,K,de),days:Math.max(1,Math.round(ee/86400))};return}if(h.type==="arrowedline"&&h.primitive&&h.p1&&h.p2){const Q=h.p1.rawTime,L=h.p2.rawTime,x=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,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=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,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=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,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=Oe(Q,Y),g=Oe(L,Y);h.p1.rawTime=x,h.p1.normalizedTime=j(x),h.p2.rawTime=g,h.p2.normalizedTime=j(g),h.primitive.p1={rawTime:x,price:h.p1.price},h.primitive.p2={rawTime:g,price:h.p2.price};return}if(h.type==="disjointchannel"&&h.primitive&&h.p1&&h.p2&&h.p3&&h.p4){const Q=L=>{const x=Oe(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=Oe(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=Ar(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=Xr(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=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y),x=Oe(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=Oe(h.p1.rawTime,Y),L=Oe(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=Oe(h.p1.rawTime,Y),L=Oe(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=Oe(h.p1.rawTime,Y),L=Oe(h.p2.rawTime,Y),x=Oe(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=Oe(h.p1.rawTime,Y),L=Oe(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=Oe(b,Y),d=Oe(I,Y);h.point1.time=w,h.point2.time=d;const _=WA([{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=uA(de)||60,w=h-(de==="M1"?150:de==="M5"?120:100)*b;try{oe.setVisibleRange({from:w,to:h+b*sp})}catch{oe.fitContent()}}else oe.fitContent();try{f.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0;const B=oe.getVisibleRange();Te(B),HA.current&&clearTimeout(HA.current),HA.current=setTimeout(()=>requestAnimationFrame(()=>At(!1)),400)}}},[me.length,et,Ce,de]),q.useEffect(()=>{const p=c.current;if(!p||!le.current||me.length===0)return;const f=p.timeScale(),k=f.getVisibleRange()||ye();if(u.current)try{p.removeSeries(u.current)}catch{}if(y.current)try{p.removeSeries(y.current),y.current=null}catch{}let ge;const H=(typeof Ce=="string"?Ce:Ce?.symbol||"").replace(/[\/\s]/g,"").toUpperCase(),X=H.includes("JPY"),J=en(H),ie=tn(H);let oe,S;X?(oe=.001,S=B=>Math.abs(Number(B)).toFixed(3)):ie?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)):J&&(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(et==="bars"){const B=nt==="light";ge=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=[...me].sort((b,I)=>b.time-I.time);h?.length>0&&ge.setData(h)}else if(et==="line"){ge=p.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,priceFormat:O,scaleMargins:{top:.1,bottom:.1}});const B=WA(il);B.length>0&&ge.setData(B)}else if(et==="area"){ge=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=WA(il);B.length>0&&ge.setData(B)}else if(et==="volume ticks"||et==="volume"){const B=nt==="light";ge=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=[...me].sort((w,d)=>w.time-d.time);h?.length>0&&ge.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=nt==="light";ge=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=[...me].sort((b,I)=>b.time-I.time);h?.length>0&&ge.setData(h)}if(u.current=ge,ut&&ge)try{ge.applyOptions({upColor:ut.upColor,downColor:ut.downColor,wickUpColor:ut.upColor,wickDownColor:ut.downColor,borderUpColor:ut.upColor,borderDownColor:ut.downColor})}catch{}gp(ge,!0);const Y=uA(de)||60;if(v.current.forEach(B=>{if(B.type==="horizontalray"&&B.primitive){const L=B.rawOriginTime??B.primitive.originTime,x=Oe(L,Y);B.primitive.originTime=x,B.originTime=x;return}if(B.type==="verticalline"&&B.primitive){const L=B.rawTime??B.primitive.time,x=Oe(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,g=[...me].sort((ee,ue)=>ee.time-ue.time),D=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,K=ee=>{const ue=Oe(ee,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=j(W),B.p2.rawTime=G,B.p2.normalizedTime=j(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,g=[...me].sort((Qe,Ee)=>Qe.time-Ee.time),D=g.length>0?g[0].time:null,P=g.length>0?g[g.length-1].time:null,K=Qe=>{const Ee=Oe(Qe,Y);return D==null||P==null?Ee:Math.min(Math.max(Ee,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 ee=j(W),ue=j(G),we=Math.abs((ue??0)-(ee??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:ks(cA,W,G,de),days:Math.max(1,Math.round(we/86400))};return}if(B.type==="arrowedline"&&B.primitive&&B.p1&&B.p2){const L=B.p1.rawTime,x=B.p2.rawTime,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,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,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,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,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,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,g=Oe(L,Y),D=Oe(x,Y);B.p1.rawTime=g,B.p1.normalizedTime=j(g),B.p2.rawTime=D,B.p2.normalizedTime=j(D),B.primitive.p1={rawTime:g,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 g=Oe(x.rawTime,Y);x.rawTime=g,x.normalizedTime=j(g)};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 g=Oe(x.rawTime,Y);x.rawTime=g,x.normalizedTime=j(g)};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=[...me].sort((D,P)=>D.time-P.time),x=Ar(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const g=B.primitive;g.mid1={rawTime:x.p1.rawTime,price:x.p1.price},g.mid2={rawTime:x.p2.rawTime,price:x.p2.price},g.top1={rawTime:x.top1.rawTime,price:x.top1.price},g.top2={rawTime:x.top2.rawTime,price:x.top2.price},g.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},g.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=[...me].sort((D,P)=>D.time-P.time),x=Xr(L,B.p1,B.p2,B.stdMultiplier??1);if(!x)return;const g=B.primitive;g.mid1={rawTime:x.p1.rawTime,price:x.p1.price},g.mid2={rawTime:x.p2.rawTime,price:x.p2.price},g.top1={rawTime:x.top1.rawTime,price:x.top1.price},g.top2={rawTime:x.top2.rawTime,price:x.top2.price},g.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},g.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=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y),g=Oe(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=g,B.p3.normalizedTime=j(g),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:g,price:B.p3.price};return}if((B.type==="gannfan"||B.type==="ganngrid")&&B.primitive&&B.p1&&B.p2){const L=Oe(B.p1.rawTime,Y),x=Oe(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=Oe(B.p1.rawTime,Y),x=Oe(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=Oe(B.p1.rawTime,Y),x=Oe(B.p2.rawTime,Y),g=Oe(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=g,B.p3.normalizedTime=j(g),B.primitive.p1={rawTime:L,price:B.p1.price},B.primitive.p2={rawTime:x,price:B.p2.price},B.primitive.p3={rawTime:g,price:B.p3.price};return}if((B.type==="fibonacci"||B.type==="rectangle")&&B.primitive&&B.p1&&B.p2){const L=Oe(B.p1.rawTime,Y),x=Oe(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=Oe(I,Y),_=Oe(w,Y);B.point1.time=d,B.point2.time=_;const Q=WA([{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&&le.current)setTimeout(()=>{try{f.setVisibleRange(k),Te(k)}catch{if(me.length>0)try{const h=me[me.length-1].time,b=uA(de)||60,I=h-100*b;f.setVisibleRange({from:I,to:h+b*sp}),Te(f.getVisibleRange())}catch{f.fitContent(),Te(f.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){f.fitContent();try{p.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}le.current=!0,Te(f.getVisibleRange())}},[et,me.length,il.length,Ce,ut]),q.useEffect(()=>{const p=c.current,f=y.current;if(!p||!f||!le.current||me.length===0||et!=="volume"&&et!=="volume ticks")return;const ge=[...me].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)"}));ge.length>0&&f.setData(ge)},[me,et]),q.useEffect(()=>{if(!Ce||!de||!Yt)return;const f=Object.entries(Yt).filter(([J,ie])=>ie).map(([J])=>J).filter(J=>J.startsWith("sma")||J.startsWith("ema")||J==="rsi"||J==="macd");if(f.length===0){ft({});return}const k=f.map(J=>J==="sma20"?`sma:${Et?.smaPeriod||20}`:J==="sma50"?"sma:50":J==="ema12"?`ema:${Et?.emaPeriod||12}`:J==="rsi"?`rsi:${Et?.rsiPeriod||14}`:J==="macd"?"macd:12:26:9":null).filter(Boolean).join(",");if(!k)return;const ge=++Ut.current,H=Rt||"http://localhost:5002",X=gA?.indicators||"/api/market-data/indicators";gt.get(`${H}${X}`,{params:{symbol:Ce,timeframe:de,indicators:k}}).then(J=>{ge===Ut.current&&ft(J.data?.data||{})}).catch(J=>{console.error("[ChartArea] Indicator fetch error:",J?.message),ge===Ut.current&&ft({})})},[Ce,de,Yt,Et,Rt,gA]),q.useEffect(()=>{const p=c.current;if(!p||!le.current)return;const f=QA.current,k=(oe,S)=>(f[oe]||(f[oe]=p.addLineSeries({lineWidth:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,...S})),f[oe]),ge=oe=>{if(f[oe]){try{p.removeSeries(f[oe])}catch{}delete f[oe]}},H=()=>{["macdLine","macdSignal","macdHist"].forEach(ge)},X=Yt||{};if(X.sma20&&st.sma20?.data?.length?k("sma20",{color:"#2196F3",lineWidth:1.5}).setData(st.sma20.data.map(S=>({time:S.time,value:S.value}))):ge("sma20"),X.sma50&&st.sma50?.data?.length?k("sma50",{color:"#FF9800",lineWidth:1.5}).setData(st.sma50.data.map(S=>({time:S.time,value:S.value}))):ge("sma50"),X.ema12&&st.ema12?.data?.length?k("ema12",{color:"#9C27B0",lineWidth:1.5}).setData(st.ema12.data.map(S=>({time:S.time,value:S.value}))):ge("ema12"),X.rsi&&st.rsi?.data?.length){const oe=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}),oe.setData(st.rsi.data.map(B=>({time:B.time,value:B.value}))),f.rsi70||(f.rsi70=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"})),f.rsi30||(f.rsi30=p.addLineSeries({color:"rgba(255,87,34,0.3)",lineWidth:1,lineStyle:2,priceLineVisible:!1,lastValueVisible:!1,crosshairMarkerVisible:!1,priceScaleId:"rsi"}));const S=st.rsi.data,O=S[0]?.time,Y=S[S.length-1]?.time;O&&Y&&(f.rsi70.setData([{time:O,value:70},{time:Y,value:70}]),f.rsi30.setData([{time:O,value:30},{time:Y,value:30}]))}else ge("rsi"),ge("rsi70"),ge("rsi30");if(X.macd&&st.macd?.data?.length){const oe=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"});f.macdHist||(f.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=st.macd.data;oe.setData(Y.map(B=>({time:B.time,value:B.value}))),S.setData(Y.map(B=>({time:B.time,value:B.signal}))),f.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&&st.rsi?.data?.length||X.macd&&st.macd?.data?.length,ie=X.rsi&&st.rsi?.data?.length&&X.macd&&st.macd?.data?.length;try{p.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:ie?.4:J?.25:.05}})}catch{}},[st,Yt,me.length]),q.useEffect(()=>()=>{const p=c.current;if(!p)return;const f=QA.current;Object.keys(f).forEach(k=>{try{p.removeSeries(f[k])}catch{}}),QA.current={}},[Ce,de]),q.useEffect(()=>{const p=c.current,f=u.current,k=o.current;if(!p||!f||!k)return;const H=ve!==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"][ve]: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{f.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=f.coordinateToPrice(h);if(b==null||I==null)return;const d={type:"pricelevel",priceLine:f.createPriceLine({price:I,color:"#3b82f6",lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:I.toFixed(5)}),price:I,showPrice:!0,showText:!1};xe(_=>[..._,d]),v.current.push(d),be(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=f.coordinateToPrice(h);if(b==null||I==null)return;const w=new zv(I,b);f.attachPrimitive(w);const d=f.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};xe(L=>[...L,Q]),v.current.push(Q),be(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 iT(h);f.attachPrimitive(b);const I=j(h),w={type:"verticalline",primitive:b,time:I,rawTime:h,lineColor:"#3b82f6",lineWidth:2,showDate:!0};xe(d=>[...d,w]),v.current.push(w),be(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=f.coordinateToPrice(h);if(b==null||I==null)return;const w=new nT(b,I);f.attachPrimitive(w);const d={type:"text",primitive:w,rawTime:b,price:I,text:"Text"};xe(_=>[..._,d]),v.current.push(d),be(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),_=f.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=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=p.timeScale().coordinateToTime(I),_=f.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,g=x/Math.abs(S.price)*100,D=uA(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,ee=S.y,ue=I,Qe=Math.atan2(-(w-ee),ue-G)*(180/Math.PI),Ee={priceDiff:x,pricePct:g,bars:K,days:W,angle:Qe},We=new Wv({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_},Ee);f.attachPrimitive(We);const qe={type:"infoline",primitive:We,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};xe(Ve=>[...Ve,qe]),v.current.push(qe),S=null,be(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 _=j(b),Q=j(w),L=d-I,x=L/Math.abs(I)*100,g=ks(cA,b,w,de),D=Math.abs((Q??0)-(_??0)),P=Math.max(1,Math.round(D/86400));return{priceDiff:L,pricePct:x,bars:g,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=f.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 Zd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},x),f.attachPrimitive(O);else{O.p2={rawTime:_,price:Q},O.info=x;const g=Q>=S.price;O.color=g?"#3b82f6":"#ef5350",O.fillColor=g?"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=f.coordinateToPrice(d);if(_==null||Q==null)return;if(!S){S={rawTime:_,price:Q,normalizedTime:j(_)};return}if(O){try{f.detachPrimitive(O)}catch{}O=null}const L=S.normalizedTime,x=j(_);if(L==null||x==null)return;const g=Y(S.rawTime,S.price,_,Q),D=new Zd({rawTime:S.rawTime,price:S.price},{rawTime:_,price:Q},g);f.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};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.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),_=f.coordinateToPrice(w);if(d==null||_==null)return;const Q=j(d);if(!(Q==null||Q===S.normalizedTime))if(!O)O=new Yd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),f.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),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{f.detachPrimitive(O)}catch{}O=null}const Q=S.normalizedTime,L=j(d);if(Q==null||L==null||Q===L)return;const x=new Yd({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});f.attachPrimitive(x);const g={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};xe(D=>[...D,g]),v.current.push(g),S=null,be(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{f.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=f.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 Jv({rawTime:b,price:I},{rawTime:d,price:I});f.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};xe(g=>[...g,x]),v.current.push(x),be(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=f.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 Zv({rawTime:b,price:I},{rawTime:d,price:I});f.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};xe(g=>[...g,x]),v.current.push(x),be(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=f.coordinateToPrice(h);if(b==null||I==null)return;const w=j(b);if(w==null)return;const d=new qv({rawTime:b,price:I});f.attachPrimitive(d);const _={type:"crossline",primitive:d,p:{rawTime:b,normalizedTime:w,price:I},lineColor:"#06a0e3",lineWidth:2,showTime:!1,showPrice:!1};xe(Q=>[...Q,_]),v.current.push(_),be(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=f.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 jv({rawTime:b,price:I},{rawTime:d,price:I});f.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};xe(g=>[...g,x]),v.current.push(x),be(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 qa(_,Q,L,x),f.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 g=f.coordinateToPrice(x);if(g==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:g},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 g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P==null)return;const K=(S.price+O.price)/2;D>=K?(Y={rawTime:g,normalizedTime:P,price:D},B={rawTime:g,normalizedTime:P,price:2*K-D}):(B={rawTime:g,normalizedTime:P,price:D},Y={rawTime:g,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,g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P!=null){if(h===0){S={rawTime:g,normalizedTime:P,price:D},O={rawTime:g,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=f.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{f.detachPrimitive(b)}catch{}const K=new qa(b.p1,b.p2,b.p3,b.p4);f.attachPrimitive(K);const W={type:"disjointchannel",primitive:K,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};xe(G=>[...G,W]),v.current.push(W),be(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{f.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 qd(_,Q,L,x),f.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 g=f.coordinateToPrice(x);if(g==null)return;O={rawTime:S.rawTime,normalizedTime:S.normalizedTime,price:g},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 g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P==null)return;Y={rawTime:g,normalizedTime:P,price:D},B={rawTime:g,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,g=p.timeScale().coordinateToTime(L),D=f.coordinateToPrice(x);if(g==null||D==null)return;const P=j(g);if(P!=null){if(h===0){S={rawTime:g,normalizedTime:P,price:D},O={rawTime:g,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=f.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{f.detachPrimitive(b)}catch{}const K=new qd(b.p1,b.p2,b.p3,b.p4);f.attachPrimitive(K);const W={type:"flattopbottom",primitive:K,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};xe(G=>[...G,W]),v.current.push(W),be(null)}}};return k.addEventListener("mousemove",w),k.addEventListener("click",d),()=>{if(k.removeEventListener("mousemove",w),k.removeEventListener("click",d),b)try{f.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=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const g=Ar(me,S,{rawTime:_,normalizedTime:L},1);if(g)if(!O)O=new ja({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),f.attachPrimitive(O);else{Y(O,g);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=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const g=Ar(me,S,{rawTime:_,normalizedTime:L},1);if(!g)return;if(O){try{f.detachPrimitive(O)}catch{}O=null}const D=new ja({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});f.attachPrimitive(D);const P={type:"regressionchannel",primitive:D,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,intercept:g.intercept,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.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=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;const g=Xr(me,S,{rawTime:_,normalizedTime:L},1);if(g)if(!O)O=new ep({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price}),f.attachPrimitive(O);else{Y(O,g);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=f.coordinateToPrice(d);if(_==null||Q==null)return;const L=j(_);if(L==null)return;if(!S){S={rawTime:_,normalizedTime:L,price:Q};return}const g=Xr(me,S,{rawTime:_,normalizedTime:L},1);if(!g)return;if(O){try{f.detachPrimitive(O)}catch{}O=null}const D=new ep({rawTime:g.p1.rawTime,price:g.p1.price},{rawTime:g.p2.rawTime,price:g.p2.price},{rawTime:g.top1.rawTime,price:g.top1.price},{rawTime:g.top2.rawTime,price:g.top2.price},{rawTime:g.bot1.rawTime,price:g.bot1.price},{rawTime:g.bot2.rawTime,price:g.bot2.price});f.attachPrimitive(D);const P={type:"stddevchannel",primitive:D,p1:g.p1,p2:g.p2,top1:g.top1,top2:g.top2,bot1:g.bot1,bot2:g.bot2,slope:g.slope,stdDev:g.stdDev,offset:g.offset,barCount:g.barCount,stdMultiplier:1};xe(K=>[...K,P]),v.current.push(P),S=null,be(null)};return k.addEventListener("mousemove",B),k.addEventListener("click",h),()=>{if(k.removeEventListener("mousemove",B),k.removeEventListener("click",h),O)try{f.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=f.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},g={rawTime:b,normalizedTime:w,price:I},D=new eT({rawTime:L.rawTime,price:L.price},{rawTime:x.rawTime,price:x.price},{rawTime:g.rawTime,price:g.price});f.attachPrimitive(D);const P={type:"andrewspitchfork",primitive:D,p1:L,p2:x,p3:g};xe(K=>[...K,P]),v.current.push(P),M(P),ce.current=P,be(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=f.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 tT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const L={type:"gannfan",primitive:Q,p1:d,p2:_};xe(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,be(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=f.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 AT({rawTime:d.rawTime,price:d.price},{rawTime:_.rawTime,price:_.price});f.attachPrimitive(Q);const L={type:"ganngrid",primitive:Q,p1:d,p2:_};xe(x=>[...x,L]),v.current.push(L),M(L),ce.current=L,be(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=f.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,g={time:Q,price:L},D=1,P=1e-5,K=Math.abs(g.time-x.time),W=Math.abs(g.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},ee={time:g.time,rawTime:g.time,price:g.price},ue=WA([{time:G.time,value:G.price},{time:ee.time,value:ee.price}]);if(ue.length>0){F.current.series.setData(ue);const we=new Yv(G,ee,O,2);try{F.current.series.attachPrimitive(we)}catch{}const Qe={type:S,series:F.current.series,point1:G,point2:ee,decoration:we};xe(Ee=>[...Ee,Qe]),v.current.push(Qe)}be(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=f.coordinateToPrice(_);if(Q==null||L==null||(Q=j(Q),Q==null))return;const x=E.current,g=WA([{time:x.time,value:x.price},{time:Q,value:L}]);g.length>0&&F.current.series.setData(g)},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,g,D)=>{L.p1={rawTime:x.rawTime,price:x.price},L.p2={rawTime:g.rawTime,price:g.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,g)=>{const D=np(L,x,g);if(!D)return null;if(!h)h=new jd({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}),f.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(),g=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(g),K=f.coordinateToPrice(D);if(P==null||K==null)return;const W=j(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=j((S.normalizedTime+O.normalizedTime)/2);if(G==null)return;const ee=(S.price+O.price)/2;Y={rawTime:G,normalizedTime:G,price:ee},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{f.detachPrimitive(h)}catch{}const ee=new jd({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});f.attachPrimitive(ee);const ue={type:"equidistantchannel",primitive:ee,p1:S,p2:O,p3:G.bottomMid,b1:G.b1,b2:G.b2,bottomMid:G.bottomMid};xe(we=>[...we,ue]),v.current.push(ue),be(null),B=0,S=null,O=null,Y=null,h=null}}},d=L=>{if(B===0||!S)return;const x=k.getBoundingClientRect(),g=L.clientX-x.left,D=L.clientY-x.top,P=p.timeScale().coordinateToTime(g),K=f.coordinateToPrice(D);if(P==null||K==null)return;const W=j(P);if(W!=null){if(B===1){const G={rawTime:P,normalizedTime:W,price:K},ee=j((S.normalizedTime+G.normalizedTime)/2);if(ee==null)return;const ue=(S.price+G.price)/2;I(S,G,{rawTime:ee,normalizedTime:ee,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{f.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),_=f.coordinateToPrice(w);if(!(d==null||_==null))if(!O)O=new tp({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_}),f.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),_=f.coordinateToPrice(w);if(d==null||_==null)return;if(!S){S={rawTime:d,price:_,normalizedTime:j(d)};return}if(O){try{f.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 tp({rawTime:S.rawTime,price:S.price},{rawTime:d,price:_});f.attachPrimitive(x);const g={type:"fibonacci",primitive:x,p1:{rawTime:S.rawTime,normalizedTime:Q,price:S.price},p2:{rawTime:d,normalizedTime:L,price:_}};xe(D=>[...D,g]),v.current.push(g),S=null,be(null)};return k.addEventListener("mousemove",Y),k.addEventListener("click",B),()=>{if(k.removeEventListener("mousemove",Y),k.removeEventListener("click",B),O)try{f.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=f.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 Rv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});f.attachPrimitive(w),F.current={type:"rectangle",primitive:w}}if(H==="circle"){const w=new Gv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1});f.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});f.attachPrimitive(w),F.current={type:"triangle",primitive:w}}if(H==="ellipse"){const w=new Xv({rawTime:I,price:b},{rawTime:I,price:b},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});f.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}}}},ie=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=f.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};xe(h=>[...h,B]),v.current.push(B),be(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},g={rawTime:L,normalizedTime:d,price:I};_.p1={rawTime:x.rawTime,price:x.price},_.p2={rawTime:g.rawTime,price:g.price};const D={type:"rectangle",primitive:_,p1:x,p2:g};xe(P=>[...P,D]),v.current.push(D),be(null)}else try{f.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=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=f.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};xe(x=>[...x,L]),v.current.push(L),be(null)}else try{f.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};xe(d=>[...d,w]),v.current.push(w),be(null)}else try{f.detachPrimitive(F.current.primitive)}catch{}}else try{f.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=f.priceToCoordinate(h.price),d=p.timeScale().timeToCoordinate(b.rawTime),_=f.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};xe(x=>[...x,L]),v.current.push(L),be(null)}else try{f.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",ie,S),k.addEventListener("mousemove",O,S),k.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{f.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",ie,S),k.removeEventListener("mousemove",O,S),k.removeEventListener("mouseup",oe,S)}}},[ve,me,xe,be]),q.useEffect(()=>{const p=c.current,f=u.current,k=o.current,ge=ve===null||ve===1;if(!ge||!p||!f||!k){ge||(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=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.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=f.priceToCoordinate(h.point1.price),w=p.timeScale().timeToCoordinate(h.point2.time),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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),g=(_+Q)/2,D=(L+x)/2;return[{x:_,y:L},{x:g,y:L},{x:Q,y:L},{x:_,y:D},{x:Q,y:D},{x:_,y:x},{x:g,y:x},{x:Q,y:x}]}if(h.type==="circle"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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,g=Math.hypot(L,x);if(g<.001)return[];const D=L/g,P=x/g,K=-P,W=D,G=g/2,ee=G*Math.max(.05,h.minorRatio??.45);return[{x:_-D*G,y:Q-P*G},{x:_+K*ee,y:Q+W*ee},{x:_+D*G,y:Q+P*G},{x:_-K*ee,y:Q-W*ee}]}if(h.type==="gannfan"&&h.p1&&h.p2){const b=p.timeScale().timeToCoordinate(h.p1.rawTime),I=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p.price);return b==null||I==null?[]:[{x:b,y:I}]}if(h.type==="pricelevel"&&h.price!=null){const b=f.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=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.b1.rawTime),Q=f.priceToCoordinate(h.b1.price),L=p.timeScale().timeToCoordinate(h.b2.rawTime),x=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.priceToCoordinate(h.p2.price),_=p.timeScale().timeToCoordinate(h.p3.rawTime),Q=f.priceToCoordinate(h.p3.price),L=p.timeScale().timeToCoordinate(h.p4.rawTime),x=f.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=f.priceToCoordinate(h.p1.price),_=p.timeScale().timeToCoordinate(I),Q=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.priceToCoordinate(h.p1.price),w=p.timeScale().timeToCoordinate(h.p2.rawTime),d=f.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=f.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 ie(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),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(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),_=f.priceToCoordinate(w.point1.price),Q=p.timeScale().timeToCoordinate(w.point2.time),L=f.priceToCoordinate(w.point2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);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(ht(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.min(d,Q),g=Math.max(d,Q),D=Math.min(_,L),P=Math.max(_,L),K=(x+g)/2,W=(D+P)/2,G=[{x,y:D,mode:"handle1"},{x:K,y:D,mode:"handle2"},{x:g,y:D,mode:"handle3"},{x,y:W,mode:"handle4"},{x:g,y:W,mode:"handle5"},{x,y:P,mode:"handle6"},{x:K,y:P,mode:"handle7"},{x:g,y:P,mode:"handle8"}];for(const Ee of G)if(Math.hypot(h-Ee.x,b-Ee.y)<H)return{object:w,mode:Ee.mode};const ee=ht(h,b,x,D,g,D),ue=ht(h,b,x,P,g,P),we=ht(h,b,x,D,x,P),Qe=ht(h,b,g,D,g,P);if(ee<X||ue<X||we<X||Qe<X||gi(h,b,[{x,y:D},{x:g,y:D},{x:g,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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.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 g=Math.hypot(h-d,b-_),D=Math.hypot(h-Q,b-L);if(g<H)return{object:w,mode:"handle1"};if(D<H)return{object:w,mode:"handle2"};if(Math.abs(g-x)<X||g<x)return{object:w,mode:"line"}}if(w.type==="triangle"&&w.p1&&w.p2&&w.p3){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);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=ht(h,b,d,_,Q,L),G=ht(h,b,Q,L,x,g),ee=ht(h,b,x,g,d,_);if(W<X||G<X||ee<X||gi(h,b,[{x:d,y:_},{x:Q,y:L},{x,y:g}]))return{object:w,mode:"line"}}if(w.type==="ellipse"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Q-d,P=L-_,K=Math.hypot(D,P);if(K<2)continue;const W=D/K,G=P/K,ee=-G,ue=W,we=K/2,Qe=we*Math.max(.05,w.minorRatio??.45);if(we<2||Qe<2)continue;const Ee=x-W*we,We=g-G*we,qe=x+ee*Qe,Ve=g+ue*Qe,Bt=x+W*we,dt=g+G*we,yt=x-ee*Qe,Dt=g-ue*Qe,qt=Math.hypot(h-Ee,b-We),iA=Math.hypot(h-qe,b-Ve),hA=Math.hypot(h-Bt,b-dt),ZA=Math.hypot(h-yt,b-Dt);if(qt<H)return{object:w,mode:"handle1"};if(iA<H)return{object:w,mode:"handle2"};if(hA<H)return{object:w,mode:"handle3"};if(ZA<H)return{object:w,mode:"handle4"};const Ii=(h-x)*W+(b-g)*G,Os=(h-x)*ee+(b-g)*ue,Bp=Ii/we,yp=Os/Qe,Cp=Bp*Bp+yp*yp;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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),g=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ht(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-Q,b-L),g=Math.hypot(h-d,b-_);if(x<H)return{object:w,mode:"handle2"};if(g<H)return{object:w,mode:"handle1"};if(ht(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(aT(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(lT(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),_=f.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),_=f.priceToCoordinate(w.price);if(d==null||_==null)continue;const Q=ip(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.b1.rawTime),g=f.priceToCoordinate(w.b1.price),D=p.timeScale().timeToCoordinate(w.b2.rawTime),P=f.priceToCoordinate(w.b2.price),K=x!=null&&D!=null?(x+D)/2:null,W=g!=null&&P!=null?(g+P)/2:null;if(d==null||_==null||Q==null||L==null||K==null||W==null||x==null||g==null||D==null||P==null)continue;const G=Math.hypot(h-d,b-_),ee=Math.hypot(h-Q,b-L),ue=Math.hypot(h-K,b-W),we=Math.hypot(d-K,_-W)<H*1.5;if(we&&Math.min(G,ue)<H*1.5)return{object:w,mode:"handle3"};if(ue<H)return{object:w,mode:"handle3"};if(ee<H)return{object:w,mode:"handle2"};if(we)continue;if(G<H)return{object:w,mode:"handle1"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x:Q,y:L},{x:D,y:P},{x,y:g}]))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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),we=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(we<H)return{object:w,mode:"handle2"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P),We=ht(h,b,K,W,G,ee);if(Qe<X||Ee<X||We<X||gi(h,b,[{x,y:g},{x:D,y:P},{x:G,y:ee},{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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.top1.rawTime),g=f.priceToCoordinate(w.top1.price),D=p.timeScale().timeToCoordinate(w.top2.rawTime),P=f.priceToCoordinate(w.top2.price),K=p.timeScale().timeToCoordinate(w.bot1.rawTime),W=f.priceToCoordinate(w.bot1.price),G=p.timeScale().timeToCoordinate(w.bot2.rawTime),ee=f.priceToCoordinate(w.bot2.price);if(d==null||_==null||Q==null||L==null||x==null||g==null||D==null||P==null||K==null||W==null||G==null||ee==null)continue;const ue=Math.hypot(h-d,b-_),we=Math.hypot(h-Q,b-L);if(ue<H)return{object:w,mode:"handle1"};if(we<H)return{object:w,mode:"handle2"};const Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P),We=ht(h,b,K,W,G,ee);if(Qe<X||Ee<X||We<X||gi(h,b,[{x,y:g},{x:D,y:P},{x:G,y:ee},{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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price);if(d==null||_==null||Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);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+g)/2;let ee=W-d,ue=G-_;Math.abs(ee)<1e-4&&(ee=1e-4);const we=ue/ee,Qe=k.clientWidth,Ee=L+we*(Qe-Q),We=g+we*(Qe-x),qe=ht(h,b,Q,L,Qe,Ee),Ve=ht(h,b,x,g,Qe,We);if(qe<X||Ve<X||gi(h,b,[{x:Q,y:L},{x:Qe,y:Ee},{x:Qe,y:We},{x,y:g}]))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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||g==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-g),ee=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(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,b,d,_,x,g),we=ht(h,b,Q,L,D,P),Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(ue<X||we<X||Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x,y:g},{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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price),x=p.timeScale().timeToCoordinate(w.p3.rawTime),g=f.priceToCoordinate(w.p3.price),D=p.timeScale().timeToCoordinate(w.p4.rawTime),P=f.priceToCoordinate(w.p4.price);if(d==null||_==null||Q==null||L==null||x==null||g==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-g),ee=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(ee<H)return{object:w,mode:"handle4"};const ue=ht(h,b,d,_,x,g),we=ht(h,b,Q,L,D,P),Qe=ht(h,b,d,_,Q,L),Ee=ht(h,b,x,g,D,P);if(ue<X||we<X||Qe<X||Ee<X||gi(h,b,[{x:d,y:_},{x,y:g},{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),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=(d+Q)/2,g=(_+L)/2,D=Math.hypot(h-d,b-_),P=Math.hypot(h-Q,b-L),K=Math.hypot(h-x,b-g);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(ht(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=f.priceToCoordinate(w.p1.price),x=p.timeScale().timeToCoordinate(_),g=f.priceToCoordinate(w.p2.price);if(Q==null||L==null||x==null||g==null)continue;const D=Math.hypot(h-Q,b-L),P=Math.hypot(h-x,b-g);if(D<H)return{object:w,mode:"handle1"};if(P<H)return{object:w,mode:"handle2"};if(ht(h,b,Q,L,x,g)<X)return{object:w,mode:"line"}}if(w.type==="fibonacci"&&w.p1&&w.p2){const d=p.timeScale().timeToCoordinate(w.p1.rawTime),_=f.priceToCoordinate(w.p1.price),Q=p.timeScale().timeToCoordinate(w.p2.rawTime),L=f.priceToCoordinate(w.p2.price);if(d==null||_==null||Q==null||L==null)continue;const x=Math.hypot(h-d,b-_),g=Math.hypot(h-Q,b-L);if(x<H)return{object:w,mode:"handle1"};if(g<H)return{object:w,mode:"handle2"};if(ht(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=f.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=f.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=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top,d=ie(I,w);if(d){if(h.preventDefault(),h.stopPropagation(),h.detail>=2){se.current=!0,ne(d.object),te.current=null,ae.current=null;return}M(d.object),re(null),Z([]),te.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),te.current=null,V([]),re(null),Z([])},S=h=>{const b=k.getBoundingClientRect(),I=h.clientX-b.left,w=h.clientY-b.top;if(!te.current){const x=ie(I,w);if(x?.object&&!ce.current){const g=J(x.object);re(D=>D===x.object?D:x.object),Z(D=>D.length===g.length&&D.every((P,K)=>P.x===g[K].x&&P.y===g[K].y)?D:g)}else re(g=>g==null?g:null),Z(g=>g.length===0?g:[]);return}const d=ce.current;if(!d)return;const _=p.timeScale().coordinateToTime(I),Q=f.coordinateToPrice(w);if(_==null||Q==null)return;let L=j(_);if(L!=null){if(d.type==="infoline"&&d.p1&&d.p2){const x=K=>{const W=K.rawTime??K.time,G=K.normalizedTime??j(W);return{rawTime:W,normalizedTime:G,price:K.price}},g=(K,W)=>{const G=K.normalizedTime??j(K.rawTime),ee=W.normalizedTime??j(W.rawTime);if(G==null||ee==null)return;const ue=W.price-K.price,we=ue/Math.abs(K.price)*100,Qe=uA(de)||3600,Ee=Math.abs(ee-G),We=Math.max(1,Math.round(Ee/Qe)),qe=Math.max(1,Math.round(Ee/86400)),Ve=p.timeScale().timeToCoordinate(K.rawTime),Bt=f.priceToCoordinate(K.price),dt=p.timeScale().timeToCoordinate(W.rawTime),yt=f.priceToCoordinate(W.price),Dt=Ve!=null&&Bt!=null&&dt!=null&&yt!=null?Math.atan2(-(yt-Bt),dt-Ve)*(180/Math.PI):d.primitive?.info?.angle??0,qt={priceDiff:ue,pricePct:we,bars:We,days:qe,angle:Dt},iA=d.primitive;if(iA){iA.p1={rawTime:K.rawTime,price:K.price},iA.p2={rawTime:W.rawTime,price:W.price},iA.info=qt;try{c.current?.applyOptions({})}catch{}}const hA={...d,rawP1Time:K.rawTime,rawP2Time:W.rawTime,p1:{rawTime:K.rawTime,normalizedTime:G,price:K.price},p2:{rawTime:W.rawTime,normalizedTime:ee,price:W.price}};xe(ZA=>{const Ii=ZA.map(Os=>Os===d?hA:Os);return v.current=Ii,Ii}),M(hA),ce.current=hA,Ve!=null&&Bt!=null&&dt!=null&&yt!=null&&V([{x:Ve,y:Bt},{x:dt,y:yt}])},D=x(d.p1),P=x(d.p2);if(D.rawTime==null||D.normalizedTime==null||P.rawTime==null||P.normalizedTime==null)return;if(te.current==="handle1"){const K=p.timeScale().coordinateToTime(I)??_;g({rawTime:K,normalizedTime:L,price:Q},P)}else if(te.current==="handle2"){const K=p.timeScale().coordinateToTime(I)??_;g(D,{rawTime:K,normalizedTime:L,price:Q})}else if(te.current==="line"){const K=ae.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 ee=p.timeScale().coordinateToTime(K.x)??W.rawTime,ue=f.coordinateToPrice(K.y);if(ee==null||ue==null)return;const we=j(ee)??W.normalizedTime;if(we==null)return;const Qe=L-we,Ee=Q-ue,We=j(W.normalizedTime+Qe),qe=j(G.normalizedTime+Qe);if(We==null||qe==null)return;const Ve=_-ee;g({rawTime:W.rawTime+Ve,normalizedTime:We,price:W.price+Ee},{rawTime:G.rawTime+Ve,normalizedTime:qe,price:G.price+Ee})}return}if(d.type==="rulerline"&&d.p1&&d.p2){const x=(g,D)=>{const P=g.normalizedTime??g.rawTime,K=D.normalizedTime??D.rawTime,W=D.price-g.price,G=W/Math.abs(g.price)*100,ee=ks(cA,g.rawTime,D.rawTime,de),ue=Math.abs(K-P),we=Math.max(1,Math.round(ue/86400)),Qe={priceDiff:W,pricePct:G,bars:ee,days:we},Ee=d.primitive;if(Ee){Ee.p1={rawTime:g.rawTime,price:g.price},Ee.p2={rawTime:D.rawTime,price:D.price},Ee.info=Qe;const yt=D.price>=g.price;Ee.color=yt?"#3b82f6":"#ef5350",Ee.fillColor=yt?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{c.current?.applyOptions({})}catch{}}const We={...d,rawP1Time:g.rawTime,rawP2Time:D.rawTime,p1:g,p2:D};xe(yt=>{const Dt=yt.map(qt=>qt===d?We:qt);return v.current=Dt,Dt}),M(We),ce.current=We;const qe=p.timeScale().timeToCoordinate(g.rawTime),Ve=f.priceToCoordinate(g.price),Bt=p.timeScale().timeToCoordinate(D.rawTime),dt=f.priceToCoordinate(D.price);qe!=null&&Ve!=null&&Bt!=null&&dt!=null&&V([{x:qe,y:Ve},{x:(qe+Bt)/2,y:(Ve+dt)/2},{x:Bt,y:dt}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="arrowedline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="rayline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;x(d.p1,{rawTime:g,normalizedTime:D,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="extendedline"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.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};xe(ee=>{const ue=ee.map(we=>we===d?K:we);return v.current=ue,ue}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(D.rawTime),G=f.priceToCoordinate(D.price);W!=null&&G!=null&&V([{x:W,y:G}])},g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q});return}if(d.type==="pricelevel"&&d.price!=null){const x=f.coordinateToPrice(w);if(x==null)return;try{d.priceLine.applyOptions({price:x,title:x.toFixed(5)})}catch{}d.textPrimitive&&(d.textPrimitive.price=x);const g=c.current?c.current.paneSize().width:400,D=f.priceToCoordinate(x);D!=null&&V([{x:g/2,y:D}]);const P={...d,price:x};xe(K=>{const W=K.map(G=>G===d?P:G);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 g=d.primitive;if(g){g.rawTime=x,g.price=Q;try{c.current?.applyOptions({})}catch{}}const D={...d,rawTime:x,price:Q};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D;return}if(d.type==="trendbyangle"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(we=>{const Qe=we.map(Ee=>Ee===d?K:Ee);return v.current=Qe,Qe}),M(K),ce.current=K;const W=p.timeScale().timeToCoordinate(g.rawTime),G=f.priceToCoordinate(g.price),ee=p.timeScale().timeToCoordinate(D.rawTime),ue=f.priceToCoordinate(D.price);W!=null&&G!=null&&ee!=null&&ue!=null&&V([{x:W,y:G},{x:ee,y:ue}])};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"||te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="equidistantchannel"&&d.p1&&d.p2&&d.p3){const x=(g,D,P)=>{const K=np(g,D,P);if(!K)return;const W=d.primitive;if(W){W.p1={rawTime:g.rawTime,price:g.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:g,p2:D,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};xe(ee=>{const ue=ee.map(we=>we===d?G:we);return v.current=ue,ue}),M(G),ce.current=G};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q},d.p3);return}if(te.current==="handle3"){x(d.p1,d.p2,{rawTime:d.p3.rawTime,normalizedTime:d.p3.normalizedTime??j(d.p3.rawTime),price:Q});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K),ue=j(g.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const we=_-D;x({rawTime:g.p1.rawTime+we,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+we,normalizedTime:ee,price:g.p2.price+W},{rawTime:g.p3.rawTime+we,normalizedTime:ue,price:g.p3.price+W});return}}if(d.type==="regressionchannel"&&d.p1&&d.p2){const x=(g,D)=>{const P=Ar(me,g,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};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L},d.p2);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W});return}}if(d.type==="stddevchannel"&&d.p1&&d.p2){const x=(g,D)=>{const P=Xr(me,g,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};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L},d.p2);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W});return}}if(d.type==="andrewspitchfork"&&d.p1&&d.p2&&d.p3){const x=(g,D,P)=>{const K=d.primitive;if(K){K.p1={rawTime:g.rawTime,price:g.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:g,p2:D,p3:P};xe(G=>{const ee=G.map(ue=>ue===d?W:ue);return v.current=ee,ee}),M(W),ce.current=W};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q},d.p3);return}if(te.current==="handle3"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,d.p2,{rawTime:g,normalizedTime:L,price:Q});return}if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K),ue=j(g.p3.normalizedTime+K);if(G==null||ee==null||ue==null)return;const we=_-D;x({rawTime:g.p1.rawTime+we,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+we,normalizedTime:ee,price:g.p2.price+W},{rawTime:g.p3.rawTime+we,normalizedTime:ue,price:g.p3.price+W});return}}if(d.type==="disjointchannel"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const we=d.primitive;if(we){we.p1={rawTime:W.rawTime,price:W.price},we.p2={rawTime:G.rawTime,price:G.price},we.p3={rawTime:ee.rawTime,price:ee.price},we.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...d,p1:W,p2:G,p3:ee,p4:ue};xe(Ee=>{const We=Ee.map(qe=>qe===d?Qe:qe);return v.current=We,We}),M(Qe),ce.current=Qe},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const K=(W,G,ee,ue)=>{const we=W.normalizedTime??j(W.rawTime);if(we==null)return null;const Qe=j(we+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=p.timeScale().coordinateToTime(g.x),G=f.coordinateToPrice(g.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,we=P-ee,Qe=Q-G,Ee=K(g.p1,ue,we,Qe),We=K(g.p2,ue,we,Qe),qe=K(g.p3,ue,we,Qe),Ve=K(g.p4,ue,we,Qe);if(!Ee||!We||!qe||!Ve)return;x(Ee,We,qe,Ve);return}if(te.current==="handle1"){const W=(g.p1.price+g.p2.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(G,ee,g.p3,g.p4);return}if(te.current==="handle3"){const W=(g.p3.price+g.p4.price)/2,G={rawTime:D,normalizedTime:P,price:Q},ee={rawTime:D,normalizedTime:P,price:2*W-Q};x(g.p1,g.p2,G,ee);return}if(te.current==="handle2"){const W=(g.p1.price+g.p2.price)/2,G={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:Q};if(G.normalizedTime==null)return;const ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:2*W-Q};if(ee.normalizedTime==null)return;x(ee,G,g.p3,g.p4);return}if(te.current==="handle4"){const W=Q-g.p4.price,G={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??j(g.p3.rawTime),price:g.p4.price+W};if(G.normalizedTime==null)return;const ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:g.p2.price+W};if(ee.normalizedTime==null)return;x(g.p1,ee,g.p3,G);return}}if(d.type==="flattopbottom"&&d.p1&&d.p2&&d.p3&&d.p4){const x=(W,G,ee,ue)=>{const we=d.primitive;if(we){we.p1={rawTime:W.rawTime,price:W.price},we.p2={rawTime:G.rawTime,price:G.price},we.p3={rawTime:ee.rawTime,price:ee.price},we.p4={rawTime:ue.rawTime,price:ue.price};try{c.current?.applyOptions({})}catch{}}const Qe={...d,p1:W,p2:G,p3:ee,p4:ue};xe(Ee=>{const We=Ee.map(qe=>qe===d?Qe:qe);return v.current=We,We}),M(Qe),ce.current=Qe},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;const K=(W,G,ee,ue)=>{const we=W.normalizedTime??j(W.rawTime);if(we==null)return null;const Qe=j(we+ee);return Qe==null?null:{rawTime:W.rawTime+G,normalizedTime:Qe,price:W.price+ue}};if(te.current==="line"){const W=p.timeScale().coordinateToTime(g.x),G=f.coordinateToPrice(g.y);if(W==null||G==null)return;const ee=j(W);if(ee==null)return;const ue=D-W,we=P-ee,Qe=Q-G,Ee=K(g.p1,ue,we,Qe),We=K(g.p2,ue,we,Qe),qe=K(g.p3,ue,we,Qe),Ve=K(g.p4,ue,we,Qe);if(!Ee||!We||!qe||!Ve)return;x(Ee,We,qe,Ve);return}if(te.current==="handle1"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:g.p2.price};x(W,G,g.p3,g.p4);return}if(te.current==="handle3"){const W={rawTime:D,normalizedTime:P,price:Q},G={rawTime:D,normalizedTime:P,price:g.p4.price};x(g.p1,g.p2,W,G);return}if(te.current==="handle2"||te.current==="handle4"){const W=te.current==="handle2"?g.p2:g.p4,G=Q-W.price,ee={rawTime:g.p1.rawTime,normalizedTime:g.p1.normalizedTime??j(g.p1.rawTime),price:g.p2.price+G},ue={rawTime:g.p3.rawTime,normalizedTime:g.p3.normalizedTime??j(g.p3.rawTime),price:g.p4.price+G};if(ee.normalizedTime==null||ue.normalizedTime==null)return;x(g.p1,ee,g.p3,ue);return}}if(d.type==="fibonacci"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="rectangle"&&d.p1&&d.p2){const x=(dt,yt)=>{const Dt=d.primitive;if(Dt){Dt.p1={rawTime:dt.rawTime,price:dt.price},Dt.p2={rawTime:yt.rawTime,price:yt.price};try{c.current?.applyOptions({})}catch{}}const qt={...d,p1:dt,p2:yt};xe(iA=>{const hA=iA.map(ZA=>ZA===d?qt:ZA);return v.current=hA,hA}),M(qt),ce.current=qt},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(te.current==="line"){const dt=p.timeScale().coordinateToTime(g.x),yt=f.coordinateToPrice(g.y);if(dt==null||yt==null)return;const Dt=j(dt);if(Dt==null)return;const qt=P-Dt,iA=Q-yt,hA=j(g.p1.normalizedTime+qt),ZA=j(g.p2.normalizedTime+qt);if(hA==null||ZA==null)return;const Ii=_-dt;x({rawTime:g.p1.rawTime+Ii,normalizedTime:hA,price:g.p1.price+iA},{rawTime:g.p2.rawTime+Ii,normalizedTime:ZA,price:g.p2.price+iA});return}const K=Math.min(g.p1.normalizedTime,g.p2.normalizedTime),W=Math.max(g.p1.normalizedTime,g.p2.normalizedTime),G=Math.max(g.p1.price,g.p2.price),ee=Math.min(g.p1.price,g.p2.price),ue=g.p1.normalizedTime<=g.p2.normalizedTime?g.p1.rawTime:g.p2.rawTime,we=g.p1.normalizedTime<=g.p2.normalizedTime?g.p2.rawTime:g.p1.rawTime;let Qe=K,Ee=W,We=G,qe=ee,Ve=ue,Bt=we;if((te.current==="handle1"||te.current==="handle4"||te.current==="handle6")&&(Qe=P,Ve=D),(te.current==="handle3"||te.current==="handle5"||te.current==="handle8")&&(Ee=P,Bt=D),(te.current==="handle1"||te.current==="handle2"||te.current==="handle3")&&(We=Q),(te.current==="handle6"||te.current==="handle7"||te.current==="handle8")&&(qe=Q),Qe>Ee){const dt=Qe,yt=Ve;Qe=Ee,Ve=Bt,Ee=dt,Bt=yt}if(We<qe){const dt=We;We=qe,qe=dt}x({rawTime:Ve,normalizedTime:Qe,price:We},{rawTime:Bt,normalizedTime:Ee,price:qe});return}if(d.type==="circle"&&d.p1&&d.p2){const x=(We,qe)=>{const Ve=d.primitive;if(Ve){Ve.p1={rawTime:We.rawTime,price:We.price},Ve.p2={rawTime:qe.rawTime,price:qe.price};try{c.current?.applyOptions({})}catch{}}const Bt={...d,p1:We,p2:qe};xe(dt=>{const yt=dt.map(Dt=>Dt===d?Bt:Dt);return v.current=yt,yt}),M(Bt),ce.current=Bt},g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;if(te.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=f.coordinateToPrice(P.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,we=j(P.p1.normalizedTime+ee),Qe=j(P.p2.normalizedTime+ee);if(we==null||Qe==null)return;const Ee=_-K;x({rawTime:P.p1.rawTime+Ee,normalizedTime:we,price:P.p1.price+ue},{rawTime:P.p2.rawTime+Ee,normalizedTime:Qe,price:P.p2.price+ue});return}if(d.type==="triangle"&&d.p1&&d.p2&&d.p3){const x=(Ve,Bt,dt)=>{const yt=d.primitive;if(yt){yt.p1={rawTime:Ve.rawTime,price:Ve.price},yt.p2={rawTime:Bt.rawTime,price:Bt.price},yt.p3={rawTime:dt.rawTime,price:dt.price};try{c.current?.applyOptions({})}catch{}}const Dt={...d,p1:Ve,p2:Bt,p3:dt};xe(qt=>{const iA=qt.map(hA=>hA===d?Dt:hA);return v.current=iA,iA}),M(Dt),ce.current=Dt},g=p.timeScale().coordinateToTime(I);if(g==null)return;const D=j(g);if(D==null)return;if(te.current==="handle1"){x({rawTime:g,normalizedTime:D,price:Q},d.p2,d.p3);return}if(te.current==="handle2"){x(d.p1,{rawTime:g,normalizedTime:D,price:Q},d.p3);return}if(te.current==="handle3"){x(d.p1,d.p2,{rawTime:g,normalizedTime:D,price:Q});return}const P=ae.current;if(!P)return;const K=p.timeScale().coordinateToTime(P.x),W=f.coordinateToPrice(P.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=D-G,ue=Q-W,we=_-K,Qe=Ve=>{const Bt=Ve.normalizedTime??j(Ve.rawTime);if(Bt==null)return null;const dt=j(Bt+ee);return dt==null?null:{rawTime:Ve.rawTime+we,normalizedTime:dt,price:Ve.price+ue}},Ee=Qe(P.p1),We=Qe(P.p2),qe=Qe(P.p3);if(!Ee||!We||!qe)return;x(Ee,We,qe);return}if(d.type==="ellipse"&&d.p1&&d.p2){const x=(K,W,G=d.minorRatio??.45)=>{const ee=d.primitive;if(ee){ee.p1={rawTime:K.rawTime,price:K.price},ee.p2={rawTime:W.rawTime,price:W.price},ee.minorRatio=Math.max(.05,G);try{c.current?.applyOptions({})}catch{}}const ue={...d,p1:K,p2:W,minorRatio:Math.max(.05,G)};xe(we=>{const Qe=we.map(Ee=>Ee===d?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue},g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(I);if(D==null)return;const P=j(D);if(P==null)return;if(te.current==="line"){const K=p.timeScale().coordinateToTime(g.x),W=f.coordinateToPrice(g.y);if(K==null||W==null)return;const G=j(K);if(G==null)return;const ee=P-G,ue=Q-W,we=j(g.p1.normalizedTime+ee),Qe=j(g.p2.normalizedTime+ee);if(we==null||Qe==null)return;const Ee=_-K;x({rawTime:g.p1.rawTime+Ee,normalizedTime:we,price:g.p1.price+ue},{rawTime:g.p2.rawTime+Ee,normalizedTime:Qe,price:g.p2.price+ue},g.minorRatio??d.minorRatio??.45);return}if(te.current==="handle1"){x({rawTime:D,normalizedTime:P,price:Q},d.p2,d.minorRatio??.45);return}if(te.current==="handle3"){x(d.p1,{rawTime:D,normalizedTime:P,price:Q},d.minorRatio??.45);return}if(te.current==="handle2"||te.current==="handle4"){const K=p.timeScale().timeToCoordinate(d.p1.rawTime),W=f.priceToCoordinate(d.p1.price),G=p.timeScale().timeToCoordinate(d.p2.rawTime),ee=f.priceToCoordinate(d.p2.price);if(K==null||W==null||G==null||ee==null)return;const ue=(K+G)/2,we=(W+ee)/2,Qe=G-K,Ee=ee-W,We=Math.hypot(Qe,Ee);if(We<.001)return;const qe=-Ee/We,Ve=Qe/We,Bt=Math.abs((I-ue)*qe+(w-we)*Ve),dt=Math.max(.05,Bt*2/We);x(d.p1,d.p2,dt);return}return}if(d.type==="gannfan"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="ganngrid"&&d.p1&&d.p2){const x=(g,D)=>{const P=d.primitive;if(P){P.p1={rawTime:g.rawTime,price:g.price},P.p2={rawTime:D.rawTime,price:D.price};try{c.current?.applyOptions({})}catch{}}const K={...d,p1:g,p2:D};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K};if(te.current==="handle1"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x({rawTime:g,normalizedTime:L,price:Q},d.p2)}else if(te.current==="handle2"){const g=p.timeScale().coordinateToTime(I);if(g==null)return;x(d.p1,{rawTime:g,normalizedTime:L,price:Q})}else if(te.current==="line"){const g=ae.current;if(!g)return;const D=p.timeScale().coordinateToTime(g.x),P=f.coordinateToPrice(g.y);if(D==null||P==null)return;const K=L-j(D),W=Q-P,G=j(g.p1.normalizedTime+K),ee=j(g.p2.normalizedTime+K);if(G==null||ee==null)return;const ue=_-D;x({rawTime:g.p1.rawTime+ue,normalizedTime:G,price:g.p1.price+W},{rawTime:g.p2.rawTime+ue,normalizedTime:ee,price:g.p2.price+W})}return}if(d.type==="verticalline"&&d.primitive){const x=d.primitive;x.time=_;const g={...d,time:j(_),rawTime:_};xe(P=>{const K=P.map(W=>W===d?g:W);return v.current=K,K}),M(g),ce.current=g;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,g=ae.current;if(!g)return;if(te.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:_};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D,c.current?.applyOptions({})}else if(te.current==="line"){const D=f.coordinateToPrice(g.y);if(D==null)return;const P=Q-D;if(x.price=g.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};xe(W=>{const G=W.map(ee=>ee===d?K:ee);return v.current=G,G}),M(K),ce.current=K,c.current?.applyOptions({})}return}if(!(d.type!=="trendline"&&d.type!=="gannline")&&!(!d.point1||!d.point2)){if(te.current==="handle1"){const x={time:L,price:Q},g=WA([{time:x.time,value:x.price},{time:d.point2.time,value:d.point2.price}]);g.length>0&&d.series.setData(g),d.decoration&&(d.decoration.p1=x);const D={...d,point1:x};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="handle2"){const x={time:L,price:Q},g=WA([{time:d.point1.time,value:d.point1.price},{time:x.time,value:x.price}]);g.length>0&&d.series.setData(g),d.decoration&&(d.decoration.p2=x);const D={...d,point2:x};xe(P=>{const K=P.map(W=>W===d?D:W);return v.current=K,K}),M(D),ce.current=D}else if(te.current==="line"){const x=ae.current;if(!x)return;const g=p.timeScale().coordinateToTime(x.x),D=f.coordinateToPrice(x.y);if(g==null||D==null)return;const P=L-g,K=Q-D,W={time:j(x.point1.time+P),price:x.point1.price+K},G={time:j(x.point2.time+P),price:x.point2.price+K},ee=WA([{time:W.time,value:W.price},{time:G.time,value:G.price}]);ee.length>0&&d.series.setData(ee),d.decoration&&(d.decoration.p1=W,d.decoration.p2=G);const ue={...d,point1:W,point2:G};xe(we=>{const Qe=we.map(Ee=>Ee===d?ue:Ee);return v.current=Qe,Qe}),M(ue),ce.current=ue}}}},O=()=>{te.current=null,ae.current=null},Y=()=>{te.current||ce.current||(re(null),Z([]))},B={capture:!0,passive:!1};return k.addEventListener("mousedown",oe,B),k.addEventListener("mousemove",S,B),k.addEventListener("mouseup",O,B),k.addEventListener("mouseleave",Y,B),()=>{k.removeEventListener("mousedown",oe,B),k.removeEventListener("mousemove",S,B),k.removeEventListener("mouseup",O,B),k.removeEventListener("mouseleave",Y,B)}},[ve,me,Ke,xe]),q.useEffect(()=>{const p=c.current,f=u.current;if(!p||!f)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,ie=H.p2.rawTime??H.p2.time,oe=X.timeToCoordinate(J),S=f.priceToCoordinate(H.p1.price),O=X.timeToCoordinate(ie),Y=f.priceToCoordinate(H.p2.price);oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:oe,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="rulerline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:(J+oe)/2,y:(ie+S)/2},{x:oe,y:S}]):V([]);return}if(H.type==="arrowedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="rayline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="extendedline"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="crossline"&&H.p){const J=X.timeToCoordinate(H.p.rawTime),ie=f.priceToCoordinate(H.p.price);J!=null&&ie!=null?V([{x:J,y:ie}]):V([]);return}if(H.type==="text"&&H.rawTime!=null&&H.price!=null){const J=X.timeToCoordinate(H.rawTime),ie=f.priceToCoordinate(H.price);J!=null&&ie!=null?V([{x:J,y:ie}]):V([]);return}if(H.type==="trendbyangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="equidistantchannel"&&H.p1&&H.p2&&H.b1&&H.b2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.b1.rawTime),Y=f.priceToCoordinate(H.b1.price),B=X.timeToCoordinate(H.b2.rawTime),h=f.priceToCoordinate(H.b2.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="stddevchannel"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="andrewspitchfork"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ie},{x:oe,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price),B=X.timeToCoordinate(H.p4.rawTime),h=f.priceToCoordinate(H.p4.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null&&B!=null&&h!=null?V([{x:J,y:ie},{x:oe,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="trendline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=f.priceToCoordinate(H.point2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="gannline"&&H.point1&&H.point2){const J=X.timeToCoordinate(H.point1.time),ie=f.priceToCoordinate(H.point1.price),oe=X.timeToCoordinate(H.point2.time),S=f.priceToCoordinate(H.point2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:(J+oe)/2,y:(ie+S)/2},{x:oe,y:S}]):V([]);return}if(H.type==="rectangle"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);if(J!=null&&ie!=null&&oe!=null&&S!=null){const O=Math.min(J,oe),Y=Math.max(J,oe),B=Math.min(ie,S),h=Math.max(ie,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="triangle"&&H.p1&&H.p2&&H.p3){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price),O=X.timeToCoordinate(H.p3.rawTime),Y=f.priceToCoordinate(H.p3.price);J!=null&&ie!=null&&oe!=null&&S!=null&&O!=null&&Y!=null?V([{x:J,y:ie},{x:oe,y:S},{x:O,y:Y}]):V([]);return}if(H.type==="ellipse"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);if(J!=null&&ie!=null&&oe!=null&&S!=null){const O=(J+oe)/2,Y=(ie+S)/2,B=oe-J,h=S-ie,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),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="ganngrid"&&H.p1&&H.p2){const J=X.timeToCoordinate(H.p1.rawTime),ie=f.priceToCoordinate(H.p1.price),oe=X.timeToCoordinate(H.p2.rawTime),S=f.priceToCoordinate(H.p2.price);J!=null&&ie!=null&&oe!=null&&S!=null?V([{x:J,y:ie},{x:oe,y:S}]):V([]);return}if(H.type==="horizontalray"&&H.primitive){const J=H.primitive,ie=X.timeToCoordinate(J.originTime),oe=f.priceToCoordinate(J.price);ie!=null&&oe!=null?V([{x:ie,y:oe}]):V([]);return}if(H.type==="verticalline"&&H.primitive){const J=H.primitive,ie=X.timeToCoordinate(J.time);if(ie!=null){const oe=J.midYCss??200;V([{x:ie,y:oe}])}else V([]);return}if(H.type==="pricelevel"&&H.priceLine){const J=u.current?.priceToCoordinate(H.price);if(J!=null){const ie=c.current?c.current.paneSize().width:400;V([{x:ie/2,y:J}])}else V([]);return}V([])};k();const ge=p.timeScale();return ge.subscribeVisibleTimeRangeChange(k),()=>{ge.unsubscribeVisibleTimeRangeChange(k)}},[R]),q.useEffect(()=>{let p=!1;v.current.forEach(f=>{if(f.type==="verticalline"&&f.primitive){const k=f===R||f===Ae;f.primitive.showDot!==k&&(f.primitive.showDot=k,p=!0)}}),p&&c.current?.applyOptions({})},[R,Ae]),q.useEffect(()=>{let p=!1;v.current.forEach(f=>{if((f.type==="infoline"||f.type==="rulerline"||f.type==="arrowedline"||f.type==="rayline"||f.type==="extendedline"||f.type==="trendbyangle")&&f.primitive){const k=f===R||f===Ae;f.primitive.isActive!==k&&(f.primitive.isActive=k,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 f=_e&&p.showPrice!==!1;p.priceLine.applyOptions(_e?{color:p.lineColor??"#3b82f6",axisLabelVisible:f,title:f&&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,Ke]),q.useEffect(()=>{!_e&&R&&(M(null),V([]))},[_e,R]),q.useEffect(()=>{if(v.current.length>Ke.length){const p=v.current.filter((f,k)=>!Ke.includes(f));R&&p.some(f=>f===R)&&(M(null),V([])),p.forEach(f=>{if(f.series&&c.current?.removeSeries(f.series),f.priceLine&&u.current?.removePriceLine(f.priceLine),f.textPrimitive)try{u.current?.detachPrimitive(f.textPrimitive)}catch{}if(f.type==="horizontalray"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="verticalline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="infoline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rulerline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="arrowedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rayline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="extendedline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="crossline"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="trendbyangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="equidistantchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="regressionchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="stddevchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="gannfan"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ganngrid"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="andrewspitchfork"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="disjointchannel"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="flattopbottom"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="fibonacci"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="rectangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="circle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="triangle"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="ellipse"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="text"&&f.primitive)try{u.current?.detachPrimitive(f.primitive)}catch{}if(f.type==="parallellines")try{f.baseLine&&c.current?.removeSeries(f.baseLine),f.parallelLine&&c.current?.removeSeries(f.parallelLine),f.firstLine&&c.current?.removeSeries(f.firstLine),f.secondLine&&c.current?.removeSeries(f.secondLine)}catch{}}),v.current=Ke}},[Ke,R]),q.useEffect(()=>{const p=u.current;return p?(Tt.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Tt.current=[],De.filter(k=>k.symbol===Ce).forEach(k=>{const ge=parseFloat(k.openPrice??k.price),X=k.type?.toUpperCase()==="BUY"?"#26A69A":"#EF5350";if(fA&&!isNaN(ge)&&Tt.current.push(p.createPriceLine({price:ge,color:X,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${k.type} ${k.volume}`})),at){const J=parseFloat(k.stopLoss),ie=parseFloat(k.takeProfit);!isNaN(J)&&J>0&&Tt.current.push(p.createPriceLine({price:J,color:"#ef5350",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"SL"})),!isNaN(ie)&&ie>0&&Tt.current.push(p.createPriceLine({price:ie,color:"#26a69a",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:"TP"}))}}),()=>{Tt.current.forEach(k=>{try{p.removePriceLine(k)}catch{}}),Tt.current=[]}):void 0},[De,Ce,fA,at]),q.useEffect(()=>{const p=u.current;if(!p||!it)return;const f=parseFloat(XA?.ask);if(isNaN(f)||f<=0)return;let k;try{k=p.createPriceLine({price:f,color:"#3b82f6",lineWidth:1,lineStyle:3,axisLabelVisible:!0,title:"Ask"})}catch{}return()=>{if(k)try{p.removePriceLine(k)}catch{}}},[it,XA]),q.useEffect(()=>{const p=o.current;if(!p)return;const f=k=>{if(se.current){se.current=!1;return}if(T.current||!c.current)return;const ge=c.current,H=u.current;if(ge&&H&&v.current.length>0){const X=p.getBoundingClientRect(),J=k.clientX-X.left,ie=k.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=ge.timeScale().timeToCoordinate(O.rawTime),h=H.priceToCoordinate(O.price);if(B!=null&&h!=null){const b=ip(O,B,h);J>=b.left&&J<=b.right&&ie>=b.top&&ie<=b.bottom&&(Y=!0)}}else if(O.point1&&O.point2){const B=ge.timeScale().timeToCoordinate(O.point1.time??O.point1.rawTime),h=H.priceToCoordinate(O.point1.price),b=ge.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,ie-h),d=Math.hypot(J-b,ie-I),_=(B+b)/2,Q=(h+I)/2,L=Math.hypot(J-_,ie-Q);(w<oe||d<oe||L<oe)&&(Y=!0)}}else if(O.p1&&O.p2){const B=ge.timeScale().timeToCoordinate(O.p1.rawTime),h=H.priceToCoordinate(O.p1.price),b=ge.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&&ie>=_-5&&ie<=Q+5&&(Y=!0)}}else if(O.p){const B=ge.timeScale().timeToCoordinate(O.p.rawTime),h=H.priceToCoordinate(O.p.price);B!=null&&h!=null&&Math.hypot(J-B,ie-h)<oe&&(Y=!0)}else if(O.type==="pricelevel"&&O.price!=null){const B=H.priceToCoordinate(O.price);B!=null&&Math.abs(ie-B)<oe&&(Y=!0)}if(Y){k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),ne(O);return}}}k.preventDefault(),k.stopPropagation(),typeof k.stopImmediatePropagation=="function"&&k.stopImmediatePropagation(),setTimeout(()=>{if(!c.current)return;ap(c.current,me,de)||c.current.timeScale().fitContent();const J=c.current.timeScale().getVisibleRange();Te(J)},80)};return p.addEventListener("dblclick",f,!0),()=>{p.removeEventListener("dblclick",f,!0)}},[me,de]);const mp=R??Ae,wp=R?$:he,GT=_e&&uT(mp,wp),$T=dT(mp?.type);q.useEffect(()=>{const p=o.current,f=l.current;if(!p||!f)return;const k=80,ge=X=>{const J=p.getBoundingClientRect();f.style.opacity=J.bottom-X.clientY<=k?"1":"0"},H=()=>{f.style.opacity="0"};return p.addEventListener("mousemove",ge),p.addEventListener("mouseleave",H),()=>{p.removeEventListener("mousemove",ge),p.removeEventListener("mouseleave",H)}},[]);const XT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*.8;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),JT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleRange();if(!f?.from||!f?.to)return;const k=f.to-f.from,ge=(f.from+f.to)/2,H=k*1.25;try{p.setVisibleRange({from:ge-H/2,to:ge+H/2}),Te(p.getVisibleRange())}catch{}},[Te]),ZT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const k=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from-k,to:f.to-k})}catch{}},[]),YT=q.useCallback(()=>{const p=c.current?.timeScale();if(!p)return;const f=p.getVisibleLogicalRange();if(!f)return;const k=Math.max(1,Math.round((f.to-f.from)*.1));try{p.setVisibleLogicalRange({from:f.from+k,to:f.to+k})}catch{}},[]),qT=q.useCallback(()=>{if(!c.current)return;ap(c.current,me,de)||c.current.timeScale().fitContent();const f=c.current.timeScale().getVisibleRange();Te(f)},[me,de,Te]);return a.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${nt==="light"?"bg-white":"bg-[#12161d]"}`,children:a.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:ve===1||ve!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Pe&&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 Ce=="object"?Ce?.symbol:Ce,"..."]})]})}),!Pe&&Ne&&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:nt==="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:nt==="light"?"#64748b":"#94a3b8"},children:Ne})]})}),!Pe&&!Ne&&me.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:nt==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof Ce=="object"?Ce?.symbol:Ce]})})}),$A&&me.length>0&&(()=>{const p=me[me.length-1],f=k=>{const ge=Number(k);return Number.isFinite(ge)?ge>=100?ge.toFixed(2):ge.toFixed(5):"-"};return a.jsxs("div",{className:"pointer-events-none absolute top-2 left-2 z-20 flex gap-3 text-xs font-mono",style:{color:nt==="light"?"#64748b":"#94a3b8"},children:[a.jsxs("span",{children:["O ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.open)})]}),a.jsxs("span",{children:["H ",a.jsx("span",{style:{color:"#26a69a"},children:f(p?.high)})]}),a.jsxs("span",{children:["L ",a.jsx("span",{style:{color:"#ef5350"},children:f(p?.low)})]}),a.jsxs("span",{children:["C ",a.jsx("span",{style:{color:nt==="light"?"#1e293b":"#e2e8f0"},children:f(p?.close)})]})]})})(),(A||Ct)&&a.jsx("div",{className:"absolute top-3 left-3 z-50",children:a.jsx(Oh,{bidPrice:e,askPrice:t,onBuyClick:KT,onSellClick:VT})}),a.jsx(Kh,{isOpen:Je,onClose:zT,orderType:tt,bidPrice:e,askPrice:t}),a.jsx(Gh,{isOpen:z!==null,onClose:()=>ne(null),chartObject:z,onUpdate:WT}),Pe&&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"}})}),GT&&a.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:wp.map((p,f)=>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:$T}},f))}),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:JT,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:XT,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:ZT,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:YT,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:qT,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:f,icon:k})=>a.jsx("button",{title:p,onClick:f,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"50%",cursor:"pointer",transition:"background-color 150ms, color 150ms",backgroundColor:nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",color:nt==="light"?"#374151":"#94a3b8",border:"1px solid "+(nt==="light"?"rgba(0,0,0,0.1)":"rgba(255,255,255,0.1)")},onMouseEnter:ge=>{ge.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.2)":"rgba(255,255,255,0.15)",ge.currentTarget.style.color=nt==="light"?"#111827":"#e2e8f0"},onMouseLeave:ge=>{ge.currentTarget.style.backgroundColor=nt==="light"?"rgba(0,0,0,0.12)":"rgba(255,255,255,0.08)",ge.currentTarget.style.color=nt==="light"?"#374151":"#94a3b8"},children:k},p))})]})})}),Ft={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function lp({style:i,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:r,symbolsLoading:n}=Vt(),[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=N=>{y.current&&!y.current.contains(N.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:{...Ft.container,...i},className:e,children:[a.jsxs("button",{style:Ft.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,Ft.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:{...Ft.arrow,...s?Ft.arrowOpen:{}},children:"▼"})]}),s&&a.jsxs("div",{style:Ft.dropdown,children:[a.jsx("div",{style:Ft.searchContainer,children:a.jsx("input",{ref:v,style:Ft.searchInput,type:"text",placeholder:"Search symbol...",value:l,onChange:E=>c(E.target.value)})}),a.jsx("div",{style:Ft.list,children:T.length===0?a.jsx("div",{style:Ft.empty,children:"No symbols found"}):a.jsxs(a.Fragment,{children:[C.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Forex & Metals"}),C.map(E=>a.jsxs("div",{style:{...Ft.item,...E.symbol===t?Ft.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:Ft.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(E.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),U.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:Ft.categoryLabel,children:"Crypto"}),U.map(E=>a.jsxs("div",{style:{...Ft.item,...E.symbol===t?Ft.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:Ft.symbolName,children:E.symbol}),E.bid&&a.jsx("span",{style:{...Ft.symbolPrice,...parseFloat(E.change)>=0?Ft.priceUp:Ft.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const RA={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"}},BT=[.01,.05,.1,.5,1];function cp({value:i,onChange:e,min:t=.01,max:A=100,step:r=.01,presets:n=BT,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 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:{...RA.container,...c},className:u,children:[o&&a.jsx("span",{style:RA.label,children:l}),a.jsx("button",{style:RA.btn,onClick:U,onMouseEnter:E=>Object.assign(E.currentTarget.style,RA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),a.jsx("input",{style:RA.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:RA.btn,onClick:C,onMouseEnter:E=>Object.assign(E.currentTarget.style,RA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&a.jsx("div",{style:RA.presets,children:n.map(E=>a.jsx("button",{style:{...RA.preset,...Math.abs(v-E)<1e-4?RA.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 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 hp({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}=Vt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),N=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]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){$(he);return}const Z=parseFloat(he);isNaN(Z)||$(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:N,onChange:V,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:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...aA.modeBtn,...M==="pips"?aA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const lA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#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 up({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}=Vt(),[v,T]=q.useState(""),[C,U]=q.useState(!1),[F,E]=q.useState("price"),N=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]),ne=q.useCallback(re=>{r!==void 0||E(re),n?.(re)},[r,n]),$=q.useCallback(re=>{i!==void 0||T(re),e?.(re)},[i,e]),V=re=>{const he=re.target.value;if(he===""||he==="."||he==="0."){$(he);return}const Z=parseFloat(he);isNaN(Z)||$(he)},Ae=M==="price"?y?.ask?parseFloat(y.ask).toFixed(5):"0.00000":"50";return a.jsxs("div",{style:{...lA.container,...u},className:m,children:[l&&a.jsx("span",{style:lA.label,children:c}),s&&a.jsx("button",{style:{...lA.toggle,...R?lA.toggleOn:lA.toggleOff},onClick:()=>z(!R),children:a.jsx("div",{style:{...lA.toggleKnob,...R?lA.knobOn:lA.knobOff}})}),(R||!s)&&a.jsxs("div",{style:lA.inputGroup,children:[a.jsx("input",{style:lA.input,type:"text",value:N,onChange:V,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:{...lA.modeBtn,...M==="price"?lA.modeBtnActive:{}},onClick:()=>ne("price"),children:"Price"}),a.jsx("button",{style:{...lA.modeBtn,...M==="pips"?lA.modeBtnActive:{}},onClick:()=>ne("pips"),children:"Pips"})]})]})]})}const yT=[{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:"─"}],GA={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 dp({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}=Vt(),[v,T]=q.useState(null),C=A||yT,U=N=>{l(o===N?null:N)},F=()=>{y([]),l(null)},E=()=>{u(!c)};return a.jsxs("div",{style:{...GA.container,...n},className:s,children:[i&&a.jsx("span",{style:GA.label,children:r}),C.map(N=>a.jsxs("button",{style:{...GA.btn,...o===N.id?GA.btnActive:{}},onClick:()=>U(N.id),onMouseEnter:R=>{T(N.id),o!==N.id&&Object.assign(R.currentTarget.style,GA.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:GA.tooltip,children:N.name})]},N.id)),(e||t)&&a.jsx("div",{style:GA.divider}),t&&a.jsx("button",{style:{...GA.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:GA.deleteBtn,onClick:F,onMouseEnter:N=>Object.assign(N.currentTarget.style,GA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const pp={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:N={},drawingToolsProps:R={},style:M,className:z}){const ne=[];i&&ne.push(a.jsx(lp,{...U},"coin")),e&&ne.push(a.jsx(cp,{value:s,onChange:o,...F},"volume")),t&&ne.push(a.jsx(hp,{value:l,onChange:c,enabled:u,onEnabledChange:m,...E},"sl")),A&&ne.push(a.jsx(up,{value:y,onChange:v,enabled:T,onEnabledChange:C,...N},"tp")),r&&ne.push(a.jsx(dp,{...R},"draw"));const $=[];return ne.forEach((V,Ae)=>{$.push(V),n&&Ae<ne.length-1&&$.push(a.jsx("div",{style:pp.divider},`div-${Ae}`))}),a.jsx("div",{style:{...pp.toolbar,...M},className:z,children:$})}const vT=[{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"}],tl={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 TT({style:i,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Vt();return a.jsx("div",{style:{...tl.container,...i},className:e,children:vT.map(r=>a.jsx("button",{style:{...tl.btn,...t===r.value?tl.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 xT=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Al={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 bT({style:i,className:e}){const{chartType:t,setChartType:A}=Vt();return a.jsx("div",{style:{...Al.container,...i},className:e,children:xT.map(r=>a.jsxs("button",{style:{...Al.btn,...t===r.value?Al.btnActive:{}},onClick:()=>A(r.value),onMouseEnter:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==r.value&&(n.currentTarget.style.borderColor="#334155")},title:r.label,children:[a.jsx("span",{children:r.icon}),a.jsx("span",{children:r.label})]},r.value))})}const AA={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},priceBox:{display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 10px",backgroundColor:"#0f172a",borderRadius:"4px",minWidth:"80px"},priceLabel:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},priceValue:{fontSize:"13px",fontWeight:700,fontFamily:"monospace"},spread:{fontSize:"9px",color:"#64748b",padding:"0 4px",display:"flex",flexDirection:"column",alignItems:"center",gap:"1px"},spreadLabel:{fontSize:"8px",textTransform:"uppercase",letterSpacing:"0.05em"},spreadValue:{fontSize:"10px",fontWeight:700,color:"#94a3b8"},sellBtn:{padding:"6px 16px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"4px",color:"#fca5a5",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},sellBtnHover:{backgroundColor:"#991b1b",borderColor:"#EF5350"},buyBtn:{padding:"6px 16px",backgroundColor:"#14532d",border:"1px solid #166534",borderRadius:"4px",color:"#86efac",fontSize:"12px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease",textTransform:"uppercase",letterSpacing:"0.03em",minWidth:"70px"},buyBtnHover:{backgroundColor:"#166534",borderColor:"#26A69A"},status:{fontSize:"10px",padding:"2px 8px",borderRadius:"3px",fontWeight:600,whiteSpace:"nowrap"}};function QT({volume:i=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:r,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:l,setUserBalance:c}=Vt(),[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 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:{...AA.container,...r},className:n,children:[a.jsx("button",{style:AA.sellBtn,onClick:()=>F("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Bid"}),a.jsx("span",{style:{...AA.priceValue,color:"#EF5350"},children:C(y)})]}),a.jsxs("div",{style:AA.spread,children:[a.jsx("span",{style:AA.spreadLabel,children:"Spread"}),a.jsx("span",{style:AA.spreadValue,children:U(T)})]}),a.jsxs("div",{style:AA.priceBox,children:[a.jsx("span",{style:AA.priceLabel,children:"Ask"}),a.jsx("span",{style:{...AA.priceValue,color:"#26A69A"},children:C(v)})]}),a.jsx("button",{style:AA.buyBtn,onClick:()=>F("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,AA.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),u&&a.jsx("span",{style:{...AA.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 ot={container:{fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",backgroundColor:"#0f172a",borderTop:"1px solid #1e293b",fontSize:"11px",overflow:"hidden",display:"flex",flexDirection:"column"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b"},headerTitle:{color:"#94a3b8",fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em"},summary:{display:"flex",gap:"16px",fontSize:"11px"},summaryItem:{display:"flex",gap:"4px",alignItems:"center"},summaryLabel:{color:"#64748b",fontWeight:600},summaryValue:{fontWeight:700,fontFamily:"monospace"},table:{width:"100%",borderCollapse:"collapse"},th:{padding:"4px 8px",textAlign:"left",color:"#64748b",fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap"},td:{padding:"4px 8px",color:"#cbd5e1",borderBottom:"1px solid #1e293b",whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px"},closeBtn:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer",transition:"all 0.15s ease"},emptyRow:{padding:"16px",textAlign:"center",color:"#475569",fontSize:"12px"},scrollArea:{overflowY:"auto",maxHeight:"200px"},typeBuy:{color:"#26A69A",fontWeight:700},typeSell:{color:"#EF5350",fontWeight:700}};function FT({style:i,className:e,maxHeight:t=200}){const{orders:A,setOrders:r,symbols:n,accountSummary:s,setUserBalance:o}=Vt(),[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,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:{...ot.container,...i},className:e,children:[a.jsxs("div",{style:ot.header,children:[a.jsxs("span",{style:ot.headerTitle,children:["Positions (",u.length,")"]}),a.jsxs("div",{style:ot.summary,children:[a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Balance:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Equity:"}),a.jsxs("span",{style:{...ot.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),a.jsxs("div",{style:ot.summaryItem,children:[a.jsx("span",{style:ot.summaryLabel,children:"Free:"}),a.jsxs("span",{style:{...ot.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),a.jsx("div",{style:{...ot.scrollArea,maxHeight:t},children:a.jsxs("table",{style:ot.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{style:ot.th,children:"Symbol"}),a.jsx("th",{style:ot.th,children:"Type"}),a.jsx("th",{style:ot.th,children:"Volume"}),a.jsx("th",{style:ot.th,children:"Open Price"}),a.jsx("th",{style:ot.th,children:"Current"}),a.jsx("th",{style:ot.th,children:"SL"}),a.jsx("th",{style:ot.th,children:"TP"}),a.jsx("th",{style:ot.th,children:"Profit"}),a.jsx("th",{style:ot.th,children:"Action"})]})}),a.jsx("tbody",{children:u.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:9,style:ot.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:{...ot.td,fontWeight:700,color:"#e2e8f0"},children:C.symbol}),a.jsx("td",{style:{...ot.td,...C.type?.toUpperCase()==="BUY"?ot.typeBuy:ot.typeSell},children:C.type}),a.jsx("td",{style:ot.td,children:C.volume}),a.jsx("td",{style:ot.td,children:v(C.price)}),a.jsx("td",{style:ot.td,children:v(U)}),a.jsx("td",{style:ot.td,children:C.stopLoss?v(C.stopLoss):"-"}),a.jsx("td",{style:ot.td,children:C.takeProfit?v(C.takeProfit):"-"}),a.jsx("td",{style:{...ot.td,color:F>=0?"#26A69A":"#EF5350",fontWeight:700},children:T(F)}),a.jsx("td",{style:ot.td,children:a.jsx("button",{style:{...ot.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 UT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(i)}function ST(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(i)}function ET(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(i)}function LT(i){return eA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 14 5-5 5 5z"},child:[]}]})(i)}const MT=({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}=Vt(),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(UT,{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(ST,{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"})})})]})]})},Jr=[{label:"Trendline",toolId:2,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})]})},{label:"Horizontal Line",toolId:20,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),a.jsx("path",{d:"M19 9l3 3-3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Vertical Line",toolId:22,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M19.054 7.988a2.988 2.988 0 0 1-1.31-.312l-10 10a3.027 3.027 0 1 1-1.38-1.381l10-10a2.994 2.994 0 1 1 2.69 1.693Zm-14 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm14-14a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),a.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),a.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),a.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),a.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",d:"M5.054 17.988a2.988 2.988 0 0 1-1.31-.312 2.994 2.994 0 1 1 2.69 1.693 2.988 2.988 0 0 1-1.38-.381Zm-1 2a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"}),a.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),a.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),a.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),a.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),a.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Zr=[{label:"Regression Channel",toolId:40,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382Zm10 10 8.048-8.048a.977.977 0 1 1 1.381 1.381l-8.048 8.049a.977.977 0 0 1-1.381-1.382ZM19 8a2.966 2.966 0 0 1-1.308-.312l-10 10c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l10-10A2.993 2.993 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Equidistant Channel",toolId:3,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M15 8a2.966 2.966 0 0 1-1.308-.312l-6 6c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l6-6A2.992 2.992 0 1 1 15 8ZM5 14a1 1 0 1 0 0 2.001A1 1 0 0 0 5 14ZM15 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm6.714 6.666-7.026 7.026a3.03 3.03 0 1 1-1.381-1.381l7.026-7.026a.977.977 0 1 1 1.381 1.381ZM12 18a1 1 0 1 0 0 2.001A1 1 0 0 0 12 18Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"StdDev Channel",toolId:41,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m2.285 10.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.381-1.382ZM10 15H9v4a1 1 0 1 1-2 0v-1H6a1 1 0 0 1 0-2h1v-4a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm7-7h-1v4a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1V5a1 1 0 1 1 2 0v1h1a1 1 0 0 1 0 2Zm-4.714 12.333 8.048-8.048a.977.977 0 0 1 1.382 1.381l-8.049 8.049a.977.977 0 0 1-1.382-1.382h.001Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Andrews Pitchfork",toolId:42,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"m21.714 13.666-4.026 4.026c.203.406.31.854.312 1.308a3 3 0 0 1-6 0c.002-.454.11-.902.312-1.308L10 15.381l-2.312 2.311a3.03 3.03 0 1 1-1.381-1.381L8.619 14l-2.311-2.312a3 3 0 1 1-.001-5.377l4.026-4.026a.976.976 0 1 1 1.381 1.381L7.688 7.692a2.9 2.9 0 0 1 0 2.615L10 12.619l8.333-8.334a.976.976 0 1 1 1.381 1.381L11.381 14l2.312 2.312a2.9 2.9 0 0 1 2.614 0l4.026-4.026a.977.977 0 1 1 1.381 1.38ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10 10a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],Yr=[{label:"Gann Line",toolId:43,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3 3 0 0 1-3 3 2.965 2.965 0 0 1-1.308-.312l-3 3c.202.408.307.857.308 1.312a3.03 3.03 0 1 1-1.693-2.689l3-3a2.98 2.98 0 0 1 4-4l3-3A2.992 2.992 0 1 1 19 8ZM5 18a1 1 0 1 0 0 2.001A1 1 0 0 0 5 18Zm7-7a1 1 0 1 0 0 2.001A1 1 0 0 0 12 11Zm7-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Fan",toolId:44,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M21.72 3.584 17.694 7.61c.202.407.31.854.312 1.308a3 3 0 0 1-3 3 2.967 2.967 0 0 1-1.308-.312l-4.45 4.45 10.109-4.042a.987.987 0 0 1 .834 1.79L8.167 18.61l7.75-.7a1.004 1.004 0 1 1 .18 2l-8.684.79a2.992 2.992 0 1 1-4.2-4.164l.794-8.7a1.004 1.004 0 1 1 2 .181L5.3 15.765 9.673 4.591a.969.969 0 0 1 1.3-.48 1 1 0 0 1 .47 1.32L7.79 14.77l4.538-4.538a2.98 2.98 0 0 1 4-4l4.026-4.026a.977.977 0 0 1 1.367 1.377ZM5.006 19.918a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm10-12a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})},{label:"Gann Grid",toolId:45,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",d:"M19 8a2.966 2.966 0 0 1-1.308-.312l-.5.5L21 12l-3.809 3.809.5.5a3.034 3.034 0 1 1-1.381 1.381l-.5-.5L12 21l-3.809-3.809-.5.5c.202.407.308.855.309 1.309a3.03 3.03 0 1 1-1.693-2.689l.5-.5L3 12l3.81-3.81-.5-.5A2.966 2.966 0 0 1 5 8a3.031 3.031 0 1 1 2.689-1.693l.5.5L12 3l3.809 3.81.5-.5A2.993 2.993 0 1 1 19 8Zm0 12a1 1 0 1 0 0-2.002A1 1 0 0 0 19 20ZM5 18a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM5 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm7 14.452 2.536-2.536L12 13.381l-2.536 2.535L12 18.452ZM5.547 12l2.536 2.535L10.619 12 8.083 9.464 5.547 12ZM12 5.547 9.464 8.083 12 10.619l2.535-2.536L12 5.547Zm3.916 3.917L13.381 12l2.536 2.535L18.452 12l-2.536-2.536ZM19 4a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z",clipRule:"evenodd",fill:"currentColor"})})}],qr=[{label:"Rectangle",toolId:5,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{d:"M3 6C3 7.30622 3.83481 8.41746 5 8.82929V15.1707C3.83481 15.5825 3 16.6938 3 18C3 19.6569 4.34315 21 6 21C7.30622 21 8.41746 20.1652 8.82929 19H15.1707C15.5825 20.1652 16.6938 21 18 21C19.6569 21 21 19.6569 21 18C21 16.6938 20.1652 15.5825 19 15.1707V8.82929C20.1652 8.41746 21 7.30622 21 6C21 4.34315 19.6569 3 18 3C16.6938 3 15.5825 3.83481 15.1707 5H8.82929C8.41746 3.83481 7.30622 3 6 3C4.34315 3 3 4.34315 3 6ZM6 7C6.55228 7 7 6.55228 7 6C7 5.44772 6.55228 5 6 5C5.44772 5 5 5.44772 5 6C5 6.55228 5.44772 7 6 7ZM17 15.1707V8.82929C16.1476 8.52801 15.472 7.85242 15.1707 7H8.82929C8.52801 7.85241 7.85241 8.52801 7 8.82929V15.1707C7.85241 15.472 8.52801 16.1476 8.82929 17H15.1707C15.472 16.1476 16.1476 15.472 17 15.1707ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7ZM7 18C7 18.5523 6.55228 19 6 19C5.44772 19 5 18.5523 5 18C5 17.4477 5.44772 17 6 17C6.55228 17 7 17.4477 7 18ZM19 18C19 18.5523 18.5523 19 18 19C17.4477 19 17 18.5523 17 18C17 17.4477 17.4477 17 18 17C18.5523 17 19 17.4477 19 18Z",fillRule:"evenodd",clipRule:"evenodd",fill:"currentColor"})})},{label:"Circle",toolId:46,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12C22 10.2504 21.5507 8.60571 20.7611 7.17509C20.9149 6.81421 21 6.41704 21 6C21 4.34315 19.6569 3 18 3C17.583 3 17.1858 3.0851 16.8249 3.23888C15.3943 2.44933 13.7496 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12ZM12 20C16.4183 20 20 16.4183 20 12C20 10.8264 19.7473 9.7118 19.2933 8.70768C18.9017 8.89507 18.4631 9 18 9C17.5369 9 17.0983 8.89506 16.7066 8.70766L14.7077 10.7066C14.8951 11.0983 15 11.5369 15 12C15 13.6569 13.6569 15 12 15C10.3431 15 9 13.6569 9 12C9 10.3431 10.3431 9 12 9C12.4632 9 12.9018 9.10496 13.2935 9.2924L15.2924 7.29348C15.105 6.90183 15 6.46317 15 6C15 5.5369 15.1049 5.09831 15.2923 4.7067C14.2882 4.25272 13.1736 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11C12.5523 11 13 11.4477 13 12ZM18 7C18.5523 7 19 6.55228 19 6C19 5.44772 18.5523 5 18 5C17.4477 5 17 5.44772 17 6C17 6.55228 17.4477 7 18 7Z",fill:"currentColor"})})},{label:"Triangle",toolId:47,icon:a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 6C15 7.65685 13.6569 9 12 9C11.763 9 11.5324 8.97252 11.3113 8.92057L7.37081 16.1613C6.95686 15.6284 6.36717 15.2388 5.68872 15.0794L9.62925 7.83858C9.23484 7.33074 9 6.6928 9 6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6ZM13 6C13 6.55228 12.5523 7 12 7C11.4477 7 11 6.55228 11 6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.3708 7.83867C13.9569 8.37162 13.3672 8.76126 12.6887 8.9206L16.6292 16.1614C16.4344 16.4122 16.2786 16.6948 16.1707 17H7.82941C7.93996 17.3128 8.00012 17.6494 8.00012 18C8.00012 18.3506 7.93996 18.6872 7.8294 19H16.1707C16.5826 20.1652 17.6938 21 19 21C20.6569 21 22 19.6569 22 18C22 16.3431 20.6569 15 19 15C18.763 15 18.5324 15.0275 18.3113 15.0794L14.3708 7.83867ZM19 19C19.5523 19 20 18.5523 20 18C20 17.4477 19.5523 17 19 17C18.4477 17 18 17.4477 18 18C18 18.5523 18.4477 19 19 19Z",fill:"currentColor"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.00012 18C8.00012 19.6569 6.65685 21 5 21C3.34315 21 2 19.6569 2 18C2 16.3431 3.34315 15 5 15C6.65685 15 8.00012 16.3431 8.00012 18ZM6 18C6 18.5523 5.55228 19 5 19C4.44772 19 4 18.5523 4 18C4 17.4477 4.44772 17 5 17C5.55228 17 6 17.4477 6 18Z",fill:"currentColor"})]})},{label:"Ellipse",toolId:48,icon:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3a3.001 3.001 0 0 0-2.935 2.378c-1.25.333-2.381.874-3.322 1.58a7.344 7.344 0 0 0-1.886 2.045 3 3 0 0 0 0 5.994 7.343 7.343 0 0 0 1.886 2.046C7.38 18.27 9.595 19 12 19s4.62-.73 6.257-1.957a7.343 7.343 0 0 0 1.886-2.046 3 3 0 0 0 0-5.994 7.344 7.344 0 0 0-1.886-2.046c-.94-.705-2.073-1.246-3.322-1.579A3.001 3.001 0 0 0 12 3Zm-1 3a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm7.156 3.634a5.584 5.584 0 0 0-1.1-1.077 7.61 7.61 0 0 0-2.391-1.177 3 3 0 0 1-5.33 0 7.61 7.61 0 0 0-2.392 1.177c-.437.328-.805.69-1.099 1.076A2.995 2.995 0 0 1 7 12c0 .962-.452 1.818-1.156 2.367.294.386.662.748 1.1 1.076C8.201 16.387 9.985 17 12 17c2.014 0 3.798-.613 5.057-1.557.437-.328.805-.69 1.099-1.077A2.995 2.995 0 0 1 17 12c0-.961.452-1.817 1.156-2.366ZM3 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm16 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Z",fill:"currentColor"})})}],Ns=({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})}),HT=({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,setShowTradeOrders:E,showTradeOrders:N,setShowTradePosition:R,showTradePosition:M,setShowTradeHistory:z,showTradeHistory:ne,setShowSLTP:$,showSLTP:V,setShowAskPrice:Ae,showAskPrice:re,setShowChartControls:he,showChartControls:Z,setShowTradeNotification:te,showTradeNotification:ae,setShowCrosshair:ce,showCrosshair:se,setShowOHLC:le,showOHLC:pe,setIsShow:Be}=Vt(),Fe={"Green & Red":{upColor:"#26a69a",downColor:"#ef5350"},"Blue & Red":{upColor:"#578cf2",downColor:"#ff574d"},"Black & White":{upColor:"#ffffff",downColor:"#7a7a7a"},Neutral:{upColor:"#76ac85",downColor:"#c86a6a"}},[Ue,ye]=q.useState(!1),[Te,ve]=q.useState(null),[be,Le]=q.useState(null),[Re,Ke]=q.useState(0),[xe,De]=q.useState(!1),[Ce,de]=q.useState(0),[_e,et]=q.useState(!1),[rt,nt]=q.useState(0),[ut,fA]=q.useState(!1),[Xe,ke]=q.useState(0),[at,it]=q.useState(!1),[Ct,bt]=q.useState({chart:["Grid"],colors:"Green & Red",lang:"English"}),$A=q.useRef(null),XA=q.useRef(null),Rt=q.useRef(null),gA=q.useRef(null),JA=q.useRef(null),Yt=q.useRef(null);q.useEffect(()=>{const Ie=tt=>{const $e=$A.current;Ue&&$e&&!$e.contains(tt.target)&&(ye(!1),ve(null));const me=XA.current;be==="line"&&me&&!me.contains(tt.target)&&Le(null);const ze=Rt.current;be==="channel"&&ze&&!ze.contains(tt.target)&&Le(null);const Pe=gA.current;be==="gann"&&Pe&&!Pe.contains(tt.target)&&Le(null);const At=JA.current;be==="shape"&&At&&!At.contains(tt.target)&&Le(null)};return window.addEventListener("mousedown",Ie),()=>window.removeEventListener("mousedown",Ie)},[Ue,be]),q.useEffect(()=>{const Ie=tt=>{tt.key==="Escape"&&(ye(!1),ve(null),Le(null))};return window.addEventListener("keydown",Ie),()=>window.removeEventListener("keydown",Ie)},[]);const Et=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"}],[]),QA=Ie=>{const tt=Et[Ie].label;if(tt==="Menu"){ye($e=>!$e),ve(null);return}if(tt==="Grid"){s(!n);return}if(tt==="Magnet"){l(!o),r(o?null:Ie);return}if(tt==="Delete"){if(c.length>0){const $e=[...c];$e.pop(),u($e)}return}if(tt==="Eye"){y(!m);return}if(tt==="Lock"){T(!v);return}if(tt==="Light Theme"||tt==="Dark Theme"){U(C==="light"?"dark":"light"),ye(!1),ve(null);return}if(tt==="History"){Be(!0);return}r(A===Ie?null:Ie)};Et.slice(0,12);const st=Et.slice(12),ft=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],Ut=[{key:"accounts",label:"Trading accounts",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:a.jsx("path",{d:"M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 14a6 6 0 0 0-5 2 8 8 0 0 0 5 2l5-2a6 6 0 0 0-5-2zm0-12a8 8 0 0 0-6 13 8 8 0 0 1 6-3 8 8 0 0 1 6 3 8 8 0 0 0-6-13zm0 2a4 4 0 1 1 0 8 4 4 0 0 1 0-8zm0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",fill:"currentColor"})})})}),submenu:[{label:"Connect to account",icon:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}]},{key:"chart",label:"Chart settings",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{clipPath:"url(#a)",children:a.jsx("path",{fillRule:"evenodd","clip-rule":"evenodd",d:"M20 6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6zm-2 3V6h-3v3h3zm-4-3h-4v2.999h4V6zM9 6H6v3l3-.001V6zm-3 4v4l3-.001v-4H6zm0 5v3h3v-3.001H6zm4 3h4v-3.001h-4V18zm5 0h3v-3h-3v3zm3-4v-4h-3v4h3zm-8-.001v-4h4v4h-4z",fill:"currentColor"})})})},{label:"Trade Orders",icon:a.jsx(a.Fragment,{children:a.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),a.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),a.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"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"})]})}],Tt=({item:Ie})=>{const tt=!!Ie.submenu?.length;return a.jsxs("div",{className:"relative",onMouseEnter:()=>{Yt.current&&(clearTimeout(Yt.current),Yt.current=null),tt&&ve(Ie.key)},onMouseLeave:()=>{tt&&(Yt.current=setTimeout(()=>ve(null),120))},children:[a.jsxs("button",{type:"button",onClick:()=>{tt?ve($e=>$e===Ie.key?null:Ie.key):(Ie.key==="theme"&&U($e=>$e==="light"?"dark":"light"),ye(!1),ve(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1 text-[15px]",children:Ie.label}),Ie.rightText&&a.jsx("span",{className:`text-xs ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.rightText}),tt&&a.jsx("svg",{className:`w-4 h-4 ${Je?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),tt&&Te===Ie.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 ${Je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:a.jsx("div",{className:"py-1",children:Ie.submenu.map(($e,me)=>{const ze=Ct[Ie.key],Pe=Array.isArray(ze)?ze.includes($e.label):ze===$e.label||$e.selected&&ze==null;return a.jsxs("button",{type:"button",onClick:()=>{Ie.key==="chart"?(bt(Ne=>{const Ye=Array.isArray(Ne.chart)?Ne.chart:[Ne.chart],wt=Ye.includes($e.label)?Ye.filter(Lt=>Lt!==$e.label):[...Ye,$e.label];return{...Ne,chart:wt}}),{Grid:()=>s(!n),"Trade Orders":()=>E(!N),"Trade Position":()=>R(!M),"Trade History":()=>z(!ne),"SL/TP Levels":()=>$(!V),"Ask Price":()=>Ae(!re),"Chart Controls":()=>he(!Z),"Trade Notification":()=>te(!ae),"Crosshair cursor":()=>ce(!se),"Show OHLC":()=>le(!pe)}[$e.label]?.()):(bt(At=>({...At,[Ie.key]:$e.label})),Ie.key==="colors"&&Fe[$e.label]&&F(Fe[$e.label]))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:$e.icon||null}),a.jsx("span",{className:"flex-1 min-w-0",children:$e.label}),Pe&&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"})})})]},me)})})})]})},Je=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 ${Je?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[a.jsx("div",{className:"flex flex-col items-center gap-2",children:ft.map((Ie,tt)=>{const $e=Ie==="gann",me=$e?null:Et[Ie],ze=$e?-1:Ie;return a.jsxs(q.Fragment,{children:[ze===2?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Pe=Jr[Re].toolId;r(A===Pe?null:Pe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
+
${A===Jr[Re].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Jr[Re].label,children:Jr[Re].icon}),a.jsx("span",{onMouseEnter:()=>De(!0),onMouseLeave:()=>De(!1),onMouseDown:Pe=>{Pe.stopPropagation(),Le(At=>At==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:xe?10:7,height:xe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:Je?"#64748b":"#94a3b8"})})})]}):ze===3?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Pe=Zr[Ce].toolId;r(A===Pe?null:Pe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
18
|
+
${A===Zr[Ce].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Zr[Ce].label,children:Zr[Ce].icon}),a.jsx("span",{onMouseEnter:()=>et(!0),onMouseLeave:()=>et(!1),onMouseDown:Pe=>{Pe.stopPropagation(),Le(At=>At==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:_e?10:7,height:_e?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:Je?"#64748b":"#94a3b8"})})})]}):$e?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Pe=Yr[rt].toolId;r(A===Pe?null:Pe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
19
|
+
${A===Yr[rt].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Yr[rt].label,children:Yr[rt].icon}),a.jsx("span",{onMouseEnter:()=>fA(!0),onMouseLeave:()=>fA(!1),onMouseDown:Pe=>{Pe.stopPropagation(),Le(At=>At==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:ut?10:7,height:ut?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:Je?"#64748b":"#94a3b8"})})})]}):ze===5?a.jsxs("div",{className:"relative",children:[a.jsx("button",{onClick:()=>{const Pe=qr[Xe].toolId;r(A===Pe?null:Pe)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
20
|
+
${A===qr[Xe].toolId?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:qr[Xe].label,children:qr[Xe].icon}),a.jsx("span",{onMouseEnter:()=>it(!0),onMouseLeave:()=>it(!1),onMouseDown:Pe=>{Pe.stopPropagation(),Le(At=>At==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:at?10:7,height:at?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:a.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("polygon",{points:"10,10 0,10 10,0",fill:Je?"#64748b":"#94a3b8"})})})]}):a.jsx("button",{onClick:()=>QA(ze),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
21
|
+
${me.label==="Grid"&&n||me.label==="Eye"&&!m||me.label==="Lock"&&v||A===ze?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${me.label}: ${me.description}`,children:me.icon}),!$e&&me.label==="Text"&&a.jsx("div",{className:`w-8 border-t my-1 ${Je?"border-slate-200":"border-slate-700"}`})]},$e?"gann-slot":`${me.label}-${Ie}`)})}),a.jsx("div",{className:"flex-1"}),a.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:st.map((Ie,tt)=>{const $e=12+tt;return a.jsx("button",{onClick:()=>QA($e),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
22
|
+
${Ie.label==="Grid"&&n||Ie.label==="Eye"&&!m||Ie.label==="Lock"&&v||A===$e?Je?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Je?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Ie.label}: ${Ie.description}`,children:Ie.icon},Ie.label)})})]}),be==="line"&&a.jsx(Ns,{top:84,panelRef:XA,isLight:Je,children:Jr.map((Ie,tt)=>{const $e=Re===tt;return a.jsxs("button",{type:"button",onMouseDown:me=>{me.stopPropagation(),Ke(tt),r(Ie.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1",children:Ie.label}),$e&&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"})})})]},Ie.toolId)})}),be==="channel"&&a.jsx(Ns,{top:128,panelRef:Rt,isLight:Je,children:Zr.map((Ie,tt)=>{const $e=Ce===tt;return a.jsxs("button",{type:"button",onMouseDown:me=>{me.stopPropagation(),de(tt),r(Ie.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1",children:Ie.label}),$e&&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"})})})]},Ie.toolId)})}),be==="gann"&&a.jsx(Ns,{top:210,panelRef:gA,isLight:Je,children:Yr.map((Ie,tt)=>{const $e=rt===tt;return a.jsxs("button",{type:"button",onMouseDown:me=>{me.stopPropagation(),nt(tt),r(Ie.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1",children:Ie.label}),$e&&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"})})})]},Ie.toolId)})}),be==="shape"&&a.jsx(Ns,{top:250,panelRef:JA,isLight:Je,children:qr.map((Ie,tt)=>{const $e=Xe===tt;return a.jsxs("button",{type:"button",onMouseDown:me=>{me.stopPropagation(),ke(tt),r(Ie.toolId),Le(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Je?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[a.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Je?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),a.jsx("span",{className:"flex-1",children:Ie.label}),$e&&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"})})})]},Ie.toolId)})}),Ue&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{ye(!1),ve(null)},"aria-hidden":"true"}),a.jsxs("div",{ref:$A,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Je?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[a.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Je?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[a.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Je?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),i!=0&&a.jsx("div",{className:`text-[12px] mt-0.5 ${Je?"text-slate-500":"text-slate-400"}`,children:i})]}),a.jsx("div",{className:"py-2",children:Ut.map(Ie=>a.jsx(Tt,{item:Ie},Ie.key))})]})]})]})};function IT(i){return eA({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 DT={forex:"text-sky-400",crypto:"text-emerald-400",binance:"text-emerald-400",stocks:"text-purple-400",indices:"text-amber-400",commodities:"text-orange-400"},_T={forex:"text-sky-600",crypto:"text-emerald-600",binance:"text-emerald-600",stocks:"text-purple-600",indices:"text-amber-600",commodities:"text-orange-600"},PT={binance:"CRYPTO"},kT=({width:i=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:r=!1,isOpen:n})=>{const{theme:s}=Vt(),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),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(LT,{className:"text-2xl text-emerald-500"})}):v.change<0?a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(ET,{className:"text-2xl text-red-500"})}):a.jsx("span",{className:"w-6 flex items-center justify-center",children:a.jsx(Km,{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(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"})}));
|
|
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(IT,{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?_T[v]||"text-slate-600":DT[v]||"text-slate-400"}`,children:PT[v]||v.toUpperCase()})}),T.map(y)]},v))})]})})]})]})},NT=({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}=Vt(),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",N=C?"#f8fafc":"#12161D",R=C?"#e2e8f0":"#1e293b",M=C?"#f1f5f9":"#12161D",z=C?"#F0F5F9":"#2B3543",ne=C?"#f8fafc":"#131c2e",$=C?"#12161D":"#fff",V=C?"#64748b":"#fff",Ae=(v||[]).filter(de=>de.status==="OPEN"||!de.closeAt),re=y?.balance||0,he=y?.equity??re,Z=y?.margin||0,te=y?.freeMargin??he-Z,ae=Z>0?he/Z*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)},Be=de=>{const _e=parseFloat(de);return isNaN(_e)?"—":_e.toFixed(2)},Fe=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)}`},Ue=q.useCallback((de,_e)=>{de.stopPropagation(),t&&t(_e.id,_e)},[t]),ye=q.useCallback((de,_e)=>{de.stopPropagation(),A&&A(_e)},[A]),Te={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:$},ve={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:z,borderBottom:`1px solid ${R}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},be={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${R}`,whiteSpace:"nowrap"},Le={color:V,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},Re={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ke={display:"flex",borderBottom:`1px solid ${R}`,flexShrink:0,backgroundColor:M},xe=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"}),De={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},Ce={padding:"3px 8px",borderBottom:`1px solid ${R}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:$};return a.jsxs("div",{style:Te,children:[a.jsxs("div",{style:ve,children:[a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Balance:"}),a.jsxs("span",{style:{...Re,color:$},children:["$",se(re)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Equity:"}),a.jsxs("span",{style:{...Re,color:he>=re?F:E},children:["$",se(he)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Margin:"}),a.jsxs("span",{style:{...Re,color:$},children:["$",se(Z)]})]}),a.jsxs("div",{style:be,children:[a.jsx("span",{style:Le,children:"Free Margin:"}),a.jsxs("span",{style:{...Re,color:te>=0?$:E},children:["$",se(te)]})]}),a.jsxs("div",{style:{...be,borderRight:"none",marginRight:0,paddingRight:0},children:[a.jsx("span",{style:Le,children:"Margin Level:"}),a.jsx("span",{style:{...Re,color:ae>=100?F:E},children:Z>0?ae.toFixed(2)+"%":"—"})]}),Ae.length>0&&a.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[a.jsx("span",{style:Le,children:"Float P/L:"}),a.jsxs("span",{style:{...Re,color:ce>=0?F:E,fontWeight:700},children:[ce>=0?"+":"",se(ce)]})]})]}),a.jsxs("div",{style:Ke,children:[a.jsx("button",{style:xe(U==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),a.jsx("button",{style:xe(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:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Current"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Action"}),a.jsx("th",{style:{...De,textAlign:"center"},children:"Close"})]})}),a.jsx("tbody",{children:Ae.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:12,style:{...Ce,textAlign:"center",padding:"16px",color:V},children:"No open positions"})}):Ae.map(de=>{const _e=de.livePnL??de.profit??0,et=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Ce,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Ce,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.openAt||de.time)}),a.jsx("td",{style:{...Ce,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:Be(de.volume)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.price??de.openPrice)}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:V},children:de.currentPrice?le(de.currentPrice):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:pe(_e)}),a.jsx("td",{style:{...Ce,textAlign:"center"},children:a.jsx("button",{onClick:rt=>ye(rt,de),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:V,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:rt=>rt.currentTarget.style.color="#f59e0b",onMouseLeave:rt=>rt.currentTarget.style.color=V,children:"✎"})}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:a.jsx("button",{onClick:rt=>Ue(rt,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:rt=>rt.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:rt=>rt.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:De,children:"Symbol"}),a.jsx("th",{style:De,children:"Ticket"}),a.jsx("th",{style:De,children:"Open Time"}),a.jsx("th",{style:De,children:"Type"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Volume"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Open Price"}),a.jsx("th",{style:De,children:"Close Time"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Close Price"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"S/L"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"T/P"}),a.jsx("th",{style:{...De,textAlign:"right"},children:"Profit"})]})}),a.jsx("tbody",{children:T.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:11,style:{...Ce,textAlign:"center",padding:"16px",color:V},children:"No trade history"})}):T.map(de=>{const _e=de.profit??0,et=_e>=0?F:E;return a.jsxs("tr",{style:{cursor:"default"},onMouseEnter:rt=>rt.currentTarget.style.backgroundColor=ne,onMouseLeave:rt=>rt.currentTarget.style.backgroundColor="transparent",children:[a.jsx("td",{style:{...Ce,fontWeight:700,color:$,letterSpacing:"0.02em"},children:de.symbol}),a.jsx("td",{style:{...Ce,color:V,fontSize:"10px"},children:String(de.id||"").slice(0,8).toUpperCase()}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.openAt)}),a.jsx("td",{style:{...Ce,fontWeight:700,color:de.type?.toUpperCase()==="BUY"?F:E},children:de.type?.toUpperCase()}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:Be(de.volume)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.openPrice)}),a.jsx("td",{style:{...Ce,color:V},children:Fe(de.closeAt)}),a.jsx("td",{style:{...Ce,textAlign:"right"},children:le(de.closePrice)}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.stopLoss?E:V},children:de.stopLoss?le(de.stopLoss):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",color:de.takeProfit?F:V},children:de.takeProfit?le(de.takeProfit):"—"}),a.jsx("td",{style:{...Ce,textAlign:"right",fontWeight:700,color:et},children:pe(_e)})]},de.id)})})]})})]})},OT="2.3.2";je.AccountPanel=NT,je.BuySellPanel=Oh,je.Chart=wT,je.ChartTypeSelector=bT,je.CoinSelector=lp,je.DrawingTools=dp,je.LeftSidebar=HT,je.MarketExecutionModal=Kh,je.MarketWatch=kT,je.PositionsPanel=FT,je.SYMBOL_CONFIG=rl,je.StopLoss=hp,je.TakeProfit=up,je.TimeframeSelector=TT,je.ToolCustomizationModal=Gh,je.TopBar=MT,je.TradePanel=QT,je.TradingProvider=Um,je.TradingToolbar=CT,je.VolumeControl=cp,je.alignToTimeframe=Oe,je.detectGaps=bp,je.getSymbolConfig=nr,je.is24x7Symbol=xp,je.isCryptoSymbol=tn,je.isForexSymbol=en,je.isWithinTradingSession=Qp,je.normalizeCandleTimes=sl,je.normalizeTime=j,je.processCandles=cl,je.processSingleCandle=hl,je.setSocketBaseUrl=Hh,je.timeframeToSeconds=uA,je.useTrading=Vt,je.validateTimeOrdering=Fp,je.version=OT,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})}));
|