@nabeeltahirdeveloper/chart-sdk 2.3.7 → 2.3.8
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 +3227 -3087
- package/dist/chart-sdk.umd.js +17 -17
- package/package.json +1 -1
package/dist/chart-sdk.umd.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(function(We,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],l):(We=typeof globalThis<"u"?globalThis:We||self,l(We.ChartSDK={},We.jsxRuntime,We.React))})(this,(function(We,l,Y){"use strict";var ds=typeof document<"u"?document.currentScript:null;const St="17:00-17:00",Ht="America/New_York",pA="24x7",fA="UTC",La={EURUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},BTCUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},ETHUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},BNBUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},SOLUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},ADAUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},XRPUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},DOTUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},MATICUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},LINKUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"}},Ma={type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"};function Mr(r){return r&&La[r.toUpperCase()]||Ma}function $d(r){return Mr(r).type==="forex"}function Xd(r){return Mr(r).type==="crypto"}function Zd(r){return Mr(r).session==="24x7"}function q(r){if(r==null)return null;if(typeof r=="number"){if(Number.isNaN(r)||!Number.isFinite(r))return null;let e;r>1e10?e=r/1e3:(r<1e9,e=r);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof r=="string"){const e=Date.parse(r);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof r=="object"&&"year"in r&&"month"in r&&"day"in r){const t=new Date(Date.UTC(r.year,r.month-1,r.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Jd(r,e){if(!r||r.length<2)return[];const t=[],A=2;for(let i=1;i<r.length;i++){const n=r[i-1].time,s=r[i].time,o=s-n;o>e*A&&t.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return t}function qd(r,e="America/New_York"){const t=new Date(r*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),i=A.getDay();return!(i===0||i===6||i===5&&A.getHours()>=17)}function Ia(r){return Array.isArray(r)?r.map(e=>({...e,time:q(e.time)})).filter(e=>e.time!=null):[]}function Yd(r){if(!r||r.length<2)return!0;for(let e=1;e<r.length;e++)if(r[e].time<=r[e-1].time)return!1;return!0}function $e(r,e){return!Number.isFinite(r)||!Number.isFinite(e)||e<=0?r:Math.floor(r/e)*e}function _a(r){if(!r||typeof r!="object")return!1;const{time:e,open:t,high:A,low:i,close:n,volume:s}=r;return!(q(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof i!="number"||!Number.isFinite(i)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<i||i>t||i>n||i>A||t<=0||A<=0||i<=0||n<=0)}function Da(r){const e=s=>Math.round(s*1e5)/1e5;let t=e(r.open),A=e(r.high),i=e(r.low),n=e(r.close);return A=Math.max(A,t,n,i),i=Math.min(i,t,n,A),{...r,open:t,high:A,low:i,close:n,volume:r.volume!=null?Math.round(r.volume):r.volume}}function ka(r){if(!Array.isArray(r)||r.length===0)return[];const e=new Map;return r.forEach(t=>{const A=q(t.time);if(A!=null)if(e.has(A)){const i=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(i.high,t.high),low:Math.min(i.low,t.low),close:t.close,volume:(i.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function jd(r,e="percentile"){if(!Array.isArray(r)||r.length<3)return r;const t=r.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return r;const A=[...t].sort((s,o)=>s-o);let i,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),a=A[s],c=A[o],h=c-a;i=a-1.5*h,n=c+1.5*h}else{const s=t.reduce((c,h)=>c+h,0)/t.length,o=t.reduce((c,h)=>c+Math.pow(h-s,2),0)/t.length,a=Math.sqrt(o);if(a===0)return r;i=s-3*a,n=s+3*a}return r.map((s,o)=>{const a=s.close;if(a<i||a>n){if(o===0)return s;const c=r[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function ep(r,e){if(!Array.isArray(r)||r.length===0)return r;const t=[],A=Math.max(e*10080,604800),i=1e4;for(let o=0;o<r.length;o++)if(t.push(r[o]),o<r.length-1){const a=r[o].time,c=r[o+1].time,h=c-a;if(h>A&&((h/3600).toFixed(1),(A/3600).toFixed(1)),h>e&&h<=A){const d=r[o];let m=a+e,x=0;for(m=$e(m,e);m<c&&x<i;){const v=$e(m,e);t.some(y=>y.time===v)||(t.push({time:v,open:d.close,high:d.close,low:d.close,close:d.close,volume:0}),x++),m+=e}if(m<c&&x>=i){const v=$e(c-e,e);t.some(y=>y.time===v)||t.push({time:v,open:d.close,high:d.close,low:d.close,close:d.close,volume:0})}}}t.sort((o,a)=>o.time-a.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 jt(r){if(!r||typeof r!="string")return 60;const e=r.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=r.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),i=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[i]||60)}return 60}function Oa(r,e,t){if(!Array.isArray(r)||r.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Mr(e),i=jt(t),o=Ia(r).map(y=>({...y,time:$e(y.time,i)})).filter(y=>_a(y)).map(y=>Da(y)),a=ka(o);a.sort((y,D)=>y.time-D.time);const c=a.filter((y,D)=>D===0?!0:y.time>a[D-1].time),h=c.length>10?jd(c,"percentile"):c,d=ka(h);d.sort((y,D)=>y.time-D.time);const m=ep(d,i),x=[];for(let y=1;y<m.length;y++){const D=m[y].time-m[y-1].time;D>i*2&&x.push({from:m[y-1].time,to:m[y].time,gapSeconds:D,gapMinutes:Math.round(D/60),fromDate:new Date(m[y-1].time*1e3).toISOString(),toDate:new Date(m[y].time*1e3).toISOString()})}const v=h.filter((y,D)=>D===0?!1:y.close===h[D-1].close&&y.open===h[D-1].close).length,B={original:r.length,processed:m.length,duplicates:r.length-a.length,outliers:v,gaps:x,filledGaps:m.length-d.length,symbolConfig:A};return{candles:m,stats:B}}function Na(r,e,t="1m"){if(!r||!e||!_a(r))return null;const A=q(r.time);if(A==null)return null;const i=jt(t),n=$e(A,i);return Da({...r,time:n})}function ot(r){var e=r.width,t=r.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 JA(r,e){return r.width===e.width&&r.height===e.height}var tp=(function(){function r(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return r.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(r.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),r.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(i){return i!==A})}}},r.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},r.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},r.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},r.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},r})();function Ap(r){return new tp(r)}var rp=(function(){function r(e,t,A){var i;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=ot({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(i=A?.allowResizeObserver)!==null&&i!==void 0?i:!0,this._chooseAndInitObserver()}return r.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(r.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bitmapSize",{get:function(){return ot({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),r.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=ot(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},r.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(r.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),r.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},r.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},r.prototype._resizeBitmap=function(e){var t=this.bitmapSize;JA(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},r.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(i){return i.call(A,e,t)})},r.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=ot(this._transformBitmapSize(e,this._canvasElementClientSize)),i=JA(this.bitmapSize,A)?null:A;t===null&&i===null||t!==null&&i!==null&&JA(t,i)||(this._suggestedBitmapSize=i,this._emitSuggestedBitmapSizeChanged(t,i))},r.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(i){return i.call(A,e,t)})},r.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}np().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},r.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Ka(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Ap(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},r.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=Ka(this._canvasElement);if(A!==null){var i=(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?sp(n[0],i):ot({width:this._canvasElementClientSize.width*i,height:this._canvasElementClientSize.height*i});this._suggestNewBitmapSize(s)}}},r.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var i=A.devicePixelContentBoxSize[0],n=ot({width:i.inlineSize,height:i.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},r})();function ip(r,e){return new rp(r,e.transform,e.options)}function Ka(r){return r.ownerDocument.defaultView}function np(){return new Promise(function(r){var e=new ResizeObserver(function(t){r(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function sp(r,e){return ot({width:Math.round(r.left*e+r.width*e)-Math.round(r.left*e),height:Math.round(r.top*e+r.height*e)-Math.round(r.top*e)})}var op=(function(){function r(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 r.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},r.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(r.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),r})();function qA(r,e){var t=r.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=r.bitmapSize;if(A.width===0||A.height===0)return null;var i=r.canvasElement.getContext("2d",e);return i===null?null:new op(i,t,A)}const ap={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},lp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},cp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},hp={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},up={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},dp={color:"#26a69a",base:0},Pa={color:"#2196f3"},Va={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 za,Wa;function YA(r,e){const t={0:[],1:[r.lineWidth,r.lineWidth],2:[2*r.lineWidth,2*r.lineWidth],3:[6*r.lineWidth,6*r.lineWidth],4:[r.lineWidth,4*r.lineWidth]}[e];r.setLineDash(t)}function Ga(r,e,t,A){r.beginPath();const i=r.lineWidth%2?.5:0;r.moveTo(t,e+i),r.lineTo(A,e+i),r.stroke()}function IA(r,e){if(!r)throw new Error("Assertion failed"+(e?": "+e:""))}function Dt(r){if(r===void 0)throw new Error("Value is undefined");return r}function me(r){if(r===null)throw new Error("Value is null");return r}function ur(r){return me(Dt(r))}(function(r){r[r.Simple=0]="Simple",r[r.WithSteps=1]="WithSteps",r[r.Curved=2]="Curved"})(za||(za={})),(function(r){r[r.Solid=0]="Solid",r[r.Dotted=1]="Dotted",r[r.Dashed=2]="Dashed",r[r.LargeDashed=3]="LargeDashed",r[r.SparseDotted=4]="SparseDotted"})(Wa||(Wa={}));const Ra={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 eA(r){return r<0?0:r>255?255:Math.round(r)||0}function $a(r){return r<=0||r>1?Math.min(Math.max(r,0),1):Math.round(1e4*r)/1e4}const pp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,fp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,mp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,gp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Ir(r){(r=r.toLowerCase())in Ra&&(r=Ra[r]);{const e=gp.exec(r)||mp.exec(r);if(e)return[eA(parseInt(e[1],10)),eA(parseInt(e[2],10)),eA(parseInt(e[3],10)),$a(e.length<5?1:parseFloat(e[4]))]}{const e=fp.exec(r);if(e)return[eA(parseInt(e[1],16)),eA(parseInt(e[2],16)),eA(parseInt(e[3],16)),1]}{const e=pp.exec(r);if(e)return[eA(17*parseInt(e[1],16)),eA(17*parseInt(e[2],16)),eA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${r}`)}function Xa(r){return .199*r[0]+.687*r[1]+.114*r[2]}function Fi(r){const e=Ir(r);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Xa(e)>160?"black":"white"}}class dt{constructor(){this.h=[]}l(e,t,A){const i={o:e,_:t,u:A===!0};this.h.push(i)}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 i=[...this.h];this.h=this.h.filter((n=>!n.u)),i.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function aA(r,...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"||r[A]===void 0||Array.isArray(t[A])?r[A]=t[A]:aA(r[A],t[A]));return r}function mA(r){return typeof r=="number"&&isFinite(r)}function _r(r){return typeof r=="number"&&r%1==0}function Dr(r){return typeof r=="string"}function Ui(r){return typeof r=="boolean"}function QA(r){const e=r;if(!e||typeof e!="object")return e;let t,A,i;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(i=e[A],t[A]=i&&typeof i=="object"?QA(i):i);return t}function wp(r){return r!==null}function kr(r){return r===null?void 0:r}const ps="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function dr(r,e,t){return e===void 0&&(e=ps),`${t=t!==void 0?`${t} `:""}${r}px ${e}`}class Bp{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=dr(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 fs{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((i=>{i.X(e,t,A)}))}}class lA{X(e,t,A){e.useBitmapCoordinateSpace((i=>this.K(i,t,A)))}}class Cp extends lA{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 i=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=a=>{e.beginPath();for(let c=i.to-1;c>=i.from;--c){const h=n.it[c],d=Math.round(h.nt*t)+s,m=h.st*A,x=a*A+s;e.moveTo(d,m),e.arc(d,m,x,0,2*Math.PI)}e.fill()};n.et>0&&(e.fillStyle=n.rt,o(n.ht+n.et)),e.fillStyle=n.lt,o(n.ht)}}function vp(){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 bp{constructor(e,t){this.ut=new fs,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(vp),this.ct=this.dt.map((A=>{const i=new Cp;return i.J(A),i})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),i=this.F.St();t.forEach(((n,s)=>{var o;const a=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(a.tt=null);const h=me(n.Ct());a.lt=c.Tt,a.ht=c.ht,a.et=c.Pt,a.it[0]._t=c._t,a.it[0].st=n.Dt().Rt(c._t,h.Vt),a.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(a.it[0].st/n.Dt().At()),a.it[0].ot=A,a.it[0].nt=i.It(A),a.tt=yp}))}}let Tp=class extends lA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),a=Math.round(this.zt.st*i);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,YA(e,this.zt.Lt.Nt),(function(c,h,d,m){c.beginPath();const x=c.lineWidth%2?.5:0;c.moveTo(h+x,d),c.lineTo(h+x,m),c.stroke()})(e,o,0,t.height)),s&&a>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*i),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,YA(e,this.zt.Et.Nt),Ga(e,a,0,t.width))}};class xp{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 Tp(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=me(this.jt.Ht()),A=t.$t().W().crosshair,i=this.Ft;if(A.mode===2)return i.Et.yt=!1,void(i.Lt.yt=!1);i.Et.yt=e&&this.jt.Ut(t),i.Lt.yt=e&&this.jt.qt(),i.Et.et=A.horzLine.width,i.Et.Nt=A.horzLine.style,i.Et.V=A.horzLine.color,i.Lt.et=A.vertLine.width,i.Lt.Nt=A.vertLine.style,i.Lt.V=A.vertLine.color,i.nt=this.jt.Yt(),i.st=this.jt.Zt()}}function Qp(r,e,t,A,i,n){r.fillRect(e+n,t,A-2*n,n),r.fillRect(e+n,t+i-n,A-2*n,n),r.fillRect(e,t,n,i),r.fillRect(e+A-n,t,n,i)}function Ei(r,e,t,A,i,n){r.save(),r.globalCompositeOperation="copy",r.fillStyle=n,r.fillRect(e,t,A,i),r.restore()}function Za(r,e,t,A,i,n){r.beginPath(),r.roundRect?r.roundRect(e,t,A,i,n):(r.lineTo(e+A-n[1],t),n[1]!==0&&r.arcTo(e+A,t,e+A,t+n[1],n[1]),r.lineTo(e+A,t+i-n[2]),n[2]!==0&&r.arcTo(e+A,t+i,e+A-n[2],t+i,n[2]),r.lineTo(e+n[3],t+i),n[3]!==0&&r.arcTo(e,t+i,e,t+i-n[3],n[3]),r.lineTo(e,t+n[0]),n[0]!==0&&r.arcTo(e,t,e+n[0],t,n[0]))}function Ja(r,e,t,A,i,n,s=0,o=[0,0,0,0],a=""){if(r.save(),!s||!a||a===n)return Za(r,e,t,A,i,o),r.fillStyle=n,r.fill(),void r.restore();const c=s/2;var h;Za(r,e+c,t+c,A-s,i-s,(h=-c,o.map((d=>d===0?d:d+h)))),n!=="transparent"&&(r.fillStyle=n,r.fill()),a!=="transparent"&&(r.lineWidth=s,r.strokeStyle=a,r.closePath(),r.stroke()),r.restore()}function qa(r,e,t,A,i,n,s){r.save(),r.globalCompositeOperation="copy";const o=r.createLinearGradient(0,0,0,i);o.addColorStop(0,n),o.addColorStop(1,s),r.fillStyle=o,r.fillRect(e,t,A,i),r.restore()}class Ya{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,i){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((a=>{const c=a.context;c.font=t.R;const h=this.Gt(a,t,A,i),d=h.Jt;return h.Qt?Ja(c,d.ti,d.ii,d.ni,d.si,s,d.ei,[d.ht,0,0,d.ht],s):Ja(c,d.ri,d.ii,d.ni,d.si,s,d.ei,[0,d.ht,d.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(d.ri,d.li,d.ai-d.ri,d.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?d.ui-d.ei:0,d.ii,d.ei,d.ci-d.ii)),h}));e.useMediaCoordinateSpace((({context:a})=>{const c=o.di;a.font=t.R,a.textAlign=o.Qt?"right":"left",a.textBaseline="middle",a.fillStyle=n,a.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,i){var n;const{context:s,bitmapSize:o,mediaSize:a,horizontalPixelRatio:c,verticalPixelRatio:h}=e,d=this.zt.hi||!this.zt.mi?t.T:0,m=this.zt.bi?t.C:0,x=t.L+this.Xt.wi,v=t.B+this.Xt.gi,B=t.A,y=t.I,D=this.zt.Kt,E=t.P,N=A.Mi(s,D),S=Math.ceil(A.xi(s,D)),W=E+x+v,$=t.C+B+y+S+d,j=Math.max(1,Math.floor(h));let V=Math.round(W*h);V%2!=j%2&&(V+=1);const X=m>0?Math.max(1,Math.floor(m*c)):0,ce=Math.round($*c),ae=Math.round(d*c),de=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,J=Math.round(de*h)-Math.floor(.5*h),ie=Math.floor(J+j/2-V/2),pe=ie+V,Be=i==="right",Ue=Be?a.width-m:m,xe=Be?o.width-X:X;let Le,Me,Fe;return Be?(Le=xe-ce,Me=xe-ae,Fe=Ue-d-B-m):(Le=xe+ce,Me=xe+ae,Fe=Ue+d+B),{Qt:Be,Jt:{ii:ie,li:J,ci:pe,ni:ce,si:V,ht:2*c,ei:X,ti:Le,ri:xe,ai:Me,oi:j,ui:o.width},di:{ii:ie/h,ci:pe/h,fi:Fe,pi:N}}}}class Si{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||Ya)(this.Ci,this.yi),this.Ri=new(e||Ya)(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 Fp extends Si{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 i=this.jt.W().horzLine;if(!i.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=Fi(i.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const a=this.Ei(this.Li);A.ki=a.ki,e.Kt=this.Li.Fi(a._t,n),e.yt=!0}}const Up=/[1-9]/g;class ja{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:m})=>(m.font=t.R,Math.round(t.Wi.xi(m,me(this.zt).Kt,Up)))));if(A<=0)return;const i=t.ji,n=A+2*i,s=n/2,o=this.zt.Hi;let a=this.zt.ki,c=Math.floor(a-s)+.5;c<0?(a+=Math.abs(0-c),c=Math.floor(a-s)+.5):c+n>o&&(a-=Math.abs(o-(c+n)),c=Math.floor(a-s)+.5);const h=c+n,d=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:m,horizontalPixelRatio:x,verticalPixelRatio:v})=>{const B=me(this.zt);m.fillStyle=B.t;const y=Math.round(c*x),D=Math.round(0*v),E=Math.round(h*x),N=Math.round(d*v),S=Math.round(2*x);if(m.beginPath(),m.moveTo(y,D),m.lineTo(y,N-S),m.arcTo(y,N,y+S,N,S),m.lineTo(E-S,N),m.arcTo(E,N,E,N-S,S),m.lineTo(E,D),m.fill(),B.hi){const W=Math.round(B.ki*x),$=D,j=Math.round(($+t.T)*v);m.fillStyle=B.V;const V=Math.max(1,Math.floor(x)),X=Math.floor(.5*x);m.fillRect(W-X,$,V,j-$)}})),e.useMediaCoordinateSpace((({context:m})=>{const x=me(this.zt),v=0+t.C+t.T+t.L+t.P/2;m.font=t.R,m.textAlign="left",m.textBaseline="middle",m.fillStyle=x.V;const B=t.Wi.Mi(m,"Apr0");m.translate(c+i,v+B),m.fillText(x.Kt,0,0)}))}}class Ep{constructor(e,t,A){this.ft=!0,this.Wt=new ja,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 i=this.Ei();if(i===null)return;e.ki=i.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(me(n)),e.yt=!0;const s=Fi(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 el;(function(r){r[r.Normal=0]="Normal",r[r.Magnet=1]="Magnet",r[r.Hidden=2]="Hidden"})(el||(el={}));class Sp 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 bp(e,this),this.fn=((i,n)=>s=>{const o=n(),a=i();if(s===me(this.tn).vn())return{_t:a,ki:o};{const c=me(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((i,n)=>()=>{const s=this.$i.St().mn(i()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new Ep(this,e,A),this.wn=new xp(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 i=this.ln,n=this.an,s=this.nn,o=this.sn,a=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),i!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||a!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(wp),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let i=e.get(t);return i===void 0&&(i=new Fp(this,t,A),e.set(t,i)),i}}function Hi(r){return r==="left"||r==="right"}class xt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(i,n){return i===void 0?n:{Fn:Math.max(i.Fn,n.Fn),Wn:i.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 xt(2)}static es(){return new xt(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 tl=".";function FA(r,e){if(!mA(r))return"n/a";if(!_r(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?r.toString():("0000000000000000"+r.toString()).slice(-e)}class Li{constructor(e,t){if(t||(t=1),mA(e)&&_r(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),i="";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),i=tl+FA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(i=tl+FA(0,n));return A.toFixed(0)+i}}class Al extends Li{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Hp{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+$/,((i,n)=>n))}}function rl(r,e,t,A,i,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:a,verticalPixelRatio:c}=r,h=e[A.from];let d=n(r,h),m=h;if(A.to-A.from<2){const x=i/2;o.beginPath();const v={nt:h.nt-x,st:h.st},B={nt:h.nt+x,st:h.st};o.moveTo(v.nt*a,v.st*c),o.lineTo(B.nt*a,B.st*c),s(r,d,v,B)}else{const x=(B,y)=>{s(r,d,m,y),o.beginPath(),d=B,m=y};let v=m;o.beginPath(),o.moveTo(h.nt*a,h.st*c);for(let B=A.from+1;B<A.to;++B){v=e[B];const y=n(r,v);switch(t){case 0:o.lineTo(v.nt*a,v.st*c);break;case 1:o.lineTo(v.nt*a,e[B-1].st*c),y!==d&&(x(y,v),o.lineTo(v.nt*a,e[B-1].st*c)),o.lineTo(v.nt*a,v.st*c);break;case 2:{const[D,E]=Lp(e,B-1,B);o.bezierCurveTo(D.nt*a,D.st*c,E.nt*a,E.st*c,v.nt*a,v.st*c);break}}t!==1&&y!==d&&(x(y,v),o.moveTo(v.nt*a,v.st*c))}(m!==v||m===v&&t===1)&&s(r,d,m,v)}}const il=6;function gs(r,e){return{nt:r.nt-e.nt,st:r.st-e.st}}function nl(r,e){return{nt:r.nt/e,st:r.st/e}}function Lp(r,e,t){const A=Math.max(0,e-1),i=Math.min(r.length-1,t+1);var n,s;return[(n=r[e],s=nl(gs(r[t],r[A]),il),{nt:n.nt+s.nt,st:n.st+s.st}),gs(r[t],nl(gs(r[i],r[e]),il))]}function Mp(r,e,t,A,i){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(i.nt*s,r*o),n.lineTo(A.nt*s,r*o),n.closePath(),n.fillStyle=t,n.fill()}class sl extends lA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:i,ds:n,et:s,Nt:o,fs:a}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(i===null)return;const h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,YA(h,o),h.lineWidth=1,rl(e,A,a,i,n,this.bs.bind(this),Mp.bind(null,c))}}function ws(r,e,t){return Math.min(Math.max(r,e),t)}function Mi(r,e,t){return e-r<=t}function ol(r){const e=Math.ceil(r);return e%2==0?e-1:e}class Bs{ws(e,t){const A=this.gs,{Ms:i,xs:n,Ss:s,ks:o,ys:a,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==i||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==a){const h=e.context.createLinearGradient(0,0,0,a);if(h.addColorStop(0,i),c!=null){const d=ws(c*e.verticalPixelRatio/a,0,1);h.addColorStop(d,n),h.addColorStop(d,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class Ip extends sl{constructor(){super(...arguments),this.Ts=new Bs}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function _p(r,e){const t=r.context;t.strokeStyle=e,t.stroke()}class al extends lA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:i,fs:n,et:s,Nt:o,Ds:a}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,YA(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&rl(e,t,n,A,i,h,_p),a&&(function(d,m,x,v,B){const{horizontalPixelRatio:y,verticalPixelRatio:D,context:E}=d;let N=null;const S=Math.max(1,Math.floor(y))%2/2,W=x*D+S;for(let $=v.to-1;$>=v.from;--$){const j=m[$];if(j){const V=B(d,j);V!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=V,N=V);const X=Math.round(j.nt*y)+S,ce=j.st*D;E.moveTo(X,ce),E.arc(X,ce,W,0,2*Math.PI)}}E.fill()})(e,t,a,A,h)}}class ll extends al{Vs(e,t){return t.lt}}function cl(r,e,t,A,i=0,n=e.length){let s=n-i;for(;0<s;){const o=s>>1,a=i+o;A(e[a],t)===r?(i=a+1,s-=o+1):s=o}return i}const Or=cl.bind(null,!0),hl=cl.bind(null,!1);function Dp(r,e){return r.ot<e}function kp(r,e){return e<r.ot}function ul(r,e,t){const A=e.Os(),i=e.ui(),n=Or(r,A,Dp),s=hl(r,i,kp);if(!t)return{from:n,to:s};let o=n,a=s;return n>0&&n<r.length&&r[n].ot>=A&&(o=n-1),s>0&&s<r.length&&r[s-1].ot<=i&&(a=s+1),{from:o,to:a}}class Cs{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 i=this.Es.Ct();i!==null&&(this.Ls=ul(this.zs,A,this.Fs),this.Gs(e,t,i.Vt),this.Js())}}class Ii extends Cs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,kr(this.Ls)),e.te(this.zs,A,kr(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 Op extends Ii{constructor(e,t){super(e,t),this.js=new fs,this.re=new Ip,this.he=new ll,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 Np extends lA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio: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 i=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];i!==o.ce&&(e.fillStyle=o.ce,i=o.ce);const a=Math.floor(.5*this.oe),c=Math.round(o.nt*t),h=c-a,d=this.oe,m=h+d-1,x=Math.min(o.de,o.fe),v=Math.max(o.de,o.fe),B=Math.round(x*A)-a,y=Math.round(v*A)+a,D=Math.max(y-B,this.oe);e.fillRect(h,B,d,D);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const $=c-E;let j=Math.max(B,Math.round(o.pe*A)-a),V=j+d-1;V>B+D-1&&(V=B+D-1,j=V-d+1),e.fillRect($,j,h-$,V-j+1)}const N=c+E;let S=Math.max(B,Math.round(o.me*A)-a),W=S+d-1;W>B+D-1&&(W=B+D-1,S=W-d+1),e.fillRect(m+1,S,N-m,W-S+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,i){return Math.floor(.3*A*i)})(me(this.zt).le,e)))}}class dl extends Cs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,kr(this.Ls)),e.be(this.zs,A,kr(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 Kp extends dl{constructor(){super(...arguments),this.js=new Np}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 Pp extends sl{constructor(){super(...arguments),this.Ts=new Bs}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 Vp extends al{constructor(){super(...arguments),this.Pe=new Bs}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 zp extends Ii{constructor(e,t){super(e,t),this.js=new fs,this.Ve=new Pp,this.Oe=new Vp,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),i=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:i}),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:i})}}class Wp extends lA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),a=Math.floor(n*o*s),c=Math.floor(n*s),h=Math.min(a,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const i=this.ze(t);(!this.zt._i||this.ae>2*i)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",a=Math.min(Math.floor(n),Math.floor(this.zt.le*n));a=Math.max(Math.floor(n),Math.min(a,this.ae));const c=Math.floor(.5*a);let h=null;for(let d=A.from;d<A.to;d++){const m=t[d];m.Ee!==o&&(i.fillStyle=m.Ee,o=m.Ee);const x=Math.round(Math.min(m.pe,m.me)*s),v=Math.round(Math.max(m.pe,m.me)*s),B=Math.round(m.de*s),y=Math.round(m.fe*s);let D=Math.round(n*m.nt)-c;const E=D+a-1;h!==null&&(D=Math.max(h+1,D),D=Math.min(D,E));const N=E-D+1;i.fillRect(D,B,N,x-B),i.fillRect(D,v+1,N,y-v),h=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:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);let c=null;for(let h=A.from;h<A.to;h++){const d=t[h];d.Ne!==o&&(i.fillStyle=d.Ne,o=d.Ne);let m=Math.round(d.nt*n)-Math.floor(.5*this.ae);const x=m+this.ae-1,v=Math.round(Math.min(d.pe,d.me)*s),B=Math.round(Math.max(d.pe,d.me)*s);if(c!==null&&(m=Math.max(c+1,m),m=Math.min(m,x)),this.zt.le*n>2*a)Qp(i,m,v,x-m+1,B-v+1,a);else{const y=x-m+1;i.fillRect(m,v,y,B-v+1)}c=x}}Le(e,t,A){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);for(let c=A.from;c<A.to;c++){const h=t[c];let d=Math.round(Math.min(h.pe,h.me)*s),m=Math.round(Math.max(h.pe,h.me)*s),x=Math.round(h.nt*n)-Math.floor(.5*this.ae),v=x+this.ae-1;if(h.ce!==o){const B=h.ce;i.fillStyle=B,o=B}this.zt._i&&(x+=a,d+=a,v-=a,m-=a),d>m||i.fillRect(x,d,v-x+1,m-d+1)}}}class Gp extends dl{constructor(){super(...arguments),this.js=new Wp}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 Rp{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class vs extends Cs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Rp(this.wn.renderer(),(i=>{const n=e.Ct();return n===null?null:e.Dt().Rt(i,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,kr(this.Ls))}Js(){this.wn.update({bars:this.zs.map($p),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function $p(r){return{x:r.nt,time:r.ot,originalData:r.He,barColor:r.ce}}class Xp extends lA{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 i=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(i/2),s=n+i;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const a=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],h=Math.round(a.st*A);let d,m;e.fillStyle=a.ce,h<=n?(d=h,m=s):(d=n,m=h-Math.floor(i/2)+i),e.fillRect(c.Os,d,c.ui-c.Os+1,m-d)}}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 a,c;if(A%2){const h=(A-1)/2;a=o-h,c=o+h}else{const h=A/2;a=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:a,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 i=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;i=Math.min(o,i)}if(t>0&&i<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>i&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class Zp extends Ii{constructor(){super(...arguments),this.js=new Xp}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,me(this.Es.Ct()).Vt)};this.js.J(e)}}class Jp extends Ii{constructor(){super(...arguments),this.js=new ll}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 qp=/[2-9]/g;class Nr{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 i=this.sr(e,t,A);return((i.actualBoundingBoxAscent||0)-(i.actualBoundingBoxDescent||0))/2}sr(e,t,A){const i=A||qp,n=String(t).replace(i,"0");if(this.tr.has(n))return Dt(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 Yp{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 pl{constructor(e,t,A){this.ur=e,this.ar=new Nr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Yp(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 i=this.F.br();return i.P!==this.j&&(this.j=i.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),i,A),this.Wt}}class jp extends lA{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:i,et:n,gr:s}=this.zt;return t>=i-n-7&&t<=i+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*i);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),YA(e,this.zt.Nt),Ga(e,n,0,t.width))}}class ys{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new jp,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 ys{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 i=this.Es.Ct();i!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(i.Vt,i.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class tf extends lA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const i=this.zt;if(i===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(i.Xe.x*t)+s,a=i.Xe.y*A;e.fillStyle=i.Tr,e.beginPath();const c=Math.max(2,1.5*i.Pr)*t;e.arc(o,a,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.Rr,e.beginPath(),e.arc(o,a,i.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=i.Dr,e.beginPath(),e.arc(o,a,i.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Af=[{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 fl(r,e,t,A){return(function(i,n){if(i==="transparent")return i;const s=Ir(i),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(r,t+(A-t)*e)}function ml(r,e){const t=r%2600/2600;let A;for(const a of Af)if(t>=a.Vr&&t<=a.Or){A=a;break}IA(A!==void 0,"Last price animation internal logic error");const i=(t-A.Vr)/(A.Or-A.Vr);return{Rr:fl(e,i,A.Ir,A.zr),Dr:fl(e,i,A.Lr,A.Er),ht:(n=i,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class rf{constructor(e){this.Wt=new tf,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 i=this.jr.Zr(!0);if(i.Xr||!t.Kr(i.ee))return;const n={x:e.It(i.ee),y:this.jr.Dt().Rt(i._t,A.Vt)},s=i.V,o=this.jr.W().lineWidth,a=ml(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:a.Rr,Dr:a.Dr,ht:a.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const t=ml(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 Kr(r,e){return ol(Math.min(Math.max(r,12),30)*e)}function Pr(r,e){switch(r){case"arrowDown":case"arrowUp":return Kr(e,1);case"circle":return Kr(e,.8);case"square":return Kr(e,.7)}}function gl(r){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(Kr(r,1))}function wl(r){return Math.max(Kr(r,.1),3)}function Bl(r,e,t){return e?r:t?Math.ceil(r/2):0}function Cl(r,e,t,A,i){const n=Pr("square",t),s=(n-1)/2,o=r-s,a=e-s;return A>=o&&A<=o+n&&i>=a&&i<=a+n}function vl(r,e,t,A){const i=(Pr("arrowUp",A)-1)/2*t.Jr,n=(ol(A/2)-1)/2*t.Jr;e.beginPath(),r?(e.moveTo(t.nt-i,t.st),e.lineTo(t.nt,t.st-i),e.lineTo(t.nt+i,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+i),e.lineTo(t.nt-n,t.st+i),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-i,t.st),e.lineTo(t.nt,t.st+i),e.lineTo(t.nt+i,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-i),e.lineTo(t.nt-n,t.st-i),e.lineTo(t.nt-n,t.st)),e.fill()}function nf(r,e,t,A,i,n){return Cl(e,t,A,i,n)}class sf extends lA{constructor(){super(...arguments),this.zt=null,this.ar=new Nr,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=dr(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 i=this.zt.it[A];if(af(i,e,t))return{Mr:i.th,gr:i.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},i,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),of(o,e,t,A)}}}}function of(r,e,t,A){e.fillStyle=r.V,r.Kt!==void 0&&(function(i,n,s,o,a,c){i.save(),i.scale(a,c),i.fillText(n,s,o),i.restore()})(e,r.Kt.ih,r.Kt.nt,r.Kt.st,t,A),(function(i,n,s){if(i.Ks!==0){switch(i.nh){case"arrowDown":return void vl(!1,n,s,i.Ks);case"arrowUp":return void vl(!0,n,s,i.Ks);case"circle":return void(function(o,a,c){const h=(Pr("circle",c)-1)/2;o.beginPath(),o.arc(a.nt,a.st,h*a.Jr,0,2*Math.PI,!1),o.fill()})(n,s,i.Ks);case"square":return void(function(o,a,c){const h=Pr("square",c),d=(h-1)*a.Jr/2,m=a.nt-d,x=a.st-d;o.fillRect(m,x,h*a.Jr,h*a.Jr)})(n,s,i.Ks)}i.nh}})(r,e,(function(i,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(i.nt*n)+o,st:i.st*s,Jr:n}})(r,t,A))}function af(r,e,t){return!(r.Kt===void 0||!(function(A,i,n,s,o,a){const c=s/2;return o>=A&&o<=A+n&&a>=i-c&&a<=i+c})(r.Kt.nt,r.Kt.st,r.Kt.Hi,r.Kt.At,e,t))||(function(A,i,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return nf(0,A.nt,A.st,A.Ks,i,n);case"circle":return(function(s,o,a,c,h){const d=2+Pr("circle",a)/2,m=s-c,x=o-h;return Math.sqrt(m*m+x*x)<=d})(A.nt,A.st,A.Ks,i,n);case"square":return Cl(A.nt,A.st,A.Ks,i,n)}})(r,e,t)}function lf(r,e,t,A,i,n,s,o,a){const c=mA(t)?t:t.Se,h=mA(t)?t:t.Me,d=mA(t)?t:t.xe,m=mA(e.size)?Math.max(e.size,0):1,x=gl(o.le())*m,v=x/2;switch(r.Ks=x,e.position){case"inBar":return r.st=s.Rt(c,a),void(r.Kt!==void 0&&(r.Kt.st=r.st+v+n+.6*i));case"aboveBar":return r.st=s.Rt(h,a)-v-A.sh,r.Kt!==void 0&&(r.Kt.st=r.st-v-.6*i,A.sh+=1.2*i),void(A.sh+=x+n);case"belowBar":return r.st=s.Rt(d,a)+v+A.eh,r.Kt!==void 0&&(r.Kt.st=r.st+v+n+.6*i,A.eh+=1.2*i),void(A.eh+=x+n)}e.position}class cf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new sf,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*gl(e)+2*t,i=this.fh();this.ah={above:Bl(A,i.aboveBar,i.inBar),below:Bl(A,i.belowBar,i.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const i=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 a=wl(t.le()),c={sh:a,eh:a};this.zt.tt=ul(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const d=A[h];d.time!==o&&(c.sh=a,c.eh=a,o=d.time);const m=this.zt.it[h];m.nt=t.It(d.time),d.text!==void 0&&d.text.length>0&&(m.Kt={ih:d.text,nt:0,st:0,Hi:0,At:0});const x=this.jr.ph(d.time);x!==null&&lf(m,d,x,c,i.fontSize,a,e,t,s.Vt)}this.ft=!1}}class hf extends ys{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class uf extends Si{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const i=this.jt;if(!i.yt())return;const n=i.W(),s=n.lastValueVisible,o=i.bh()!=="",a=n.seriesLastValueMode===0,c=i.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,a),e.yt=e.Kt.length!==0),(o||a)&&(t.Kt=this.gh(c,s,o,a),t.yt=t.Kt.length>0);const h=i.mh(c.V),d=Fi(h);A.t=d.t,A.ki=c.ki,t.Ot=i.$t().Bt(c.ki/i.Dt().At()),e.Ot=h,e.V=d.i,t.V=d.i}gh(e,t,A,i){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&i&&(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 yl(r,e,t,A){const i=Number.isFinite(e),n=Number.isFinite(t);return i&&n?r(e,t):i||n?i?e:t:A}class Kt{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 Kt(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 Kt(yl(Math.min,this.Ph(),e.Ph(),-1/0),yl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!mA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,i=this.kh-t;A*=e,i*=e,this.yh=t+A,this.kh=t+i}Oh(e){mA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new Kt(e.minValue,e.maxValue)}}class _i{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 _i(Kt.Ah(e.priceRange),e.margins)}}class df extends ys{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 pf extends Si{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const i=this.Nh.W(),n=i.axisLabelVisible,s=i.title!=="",o=this.jr;if(!n||!o.yt())return;const a=this.Nh.Fh();if(a===null)return;s&&(t.Kt=i.title,t.yt=!0),t.Ot=o.$t().Bt(a/o.Dt().At()),e.Kt=this.Wh(i.price),e.yt=!0;const c=Fi(i.axisLabelColor||i.color);A.t=c.t;const h=i.axisLabelTextColor||c.i;e.V=h,t.V=h,A.ki=a}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class ff{constructor(e,t){this.jr=e,this.cn=t,this.jh=new df(e,this),this.ur=new pf(e,this),this.Hh=new pl(this.ur,e,e.$t())}$h(e){aA(this.cn,e),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class mf extends ms{constructor(e){super(),this.$i=e}$t(){return this.$i}}const gf={Bar:(r,e,t,A)=>{var i;const n=e.upColor,s=e.downColor,o=me(r(t,A)),a=ur(o.Vt[0])<=ur(o.Vt[3]);return{ce:(i=o.V)!==null&&i!==void 0?i:a?n:s}},Candlestick:(r,e,t,A)=>{var i,n,s;const o=e.upColor,a=e.downColor,c=e.borderUpColor,h=e.borderDownColor,d=e.wickUpColor,m=e.wickDownColor,x=me(r(t,A)),v=ur(x.Vt[0])<=ur(x.Vt[3]);return{ce:(i=x.V)!==null&&i!==void 0?i:v?o:a,Ne:(n=x.Ot)!==null&&n!==void 0?n:v?c:h,Ee:(s=x.Xh)!==null&&s!==void 0?s:v?d:m}},Custom:(r,e,t,A)=>{var i;return{ce:(i=me(r(t,A)).V)!==null&&i!==void 0?i:e.color}},Area:(r,e,t,A)=>{var i,n,s,o;const a=me(r(t,A));return{ce:(i=a.lt)!==null&&i!==void 0?i:e.lineColor,lt:(n=a.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=a.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=a.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(r,e,t,A)=>{var i,n,s,o,a,c;const h=me(r(t,A));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(i=h.Re)!==null&&i!==void 0?i:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(a=h.Ce)!==null&&a!==void 0?a:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(r,e,t,A)=>{var i,n;const s=me(r(t,A));return{ce:(i=s.V)!==null&&i!==void 0?i:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(r,e,t,A)=>{var i;return{ce:(i=me(r(t,A)).V)!==null&&i!==void 0?i:e.color}}};class wf{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 bl;(function(r){r[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight"})(bl||(bl={}));const _A=30;class Bf{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 i=null;for(const n of A)i=Di(i,this._l(e,t,n));return i}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,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 Or(this.tl,e,((t,A)=>t.ee<A))}vl(e){return hl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let i=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(i===null?i={ml:s,bl:s}:(s<i.ml&&(i.ml=s),s>i.bl&&(i.bl=s)))}return i}_l(e,t,A){if(this.Ni())return null;let i=null;const n=me(this.el()),s=me(this.An()),o=Math.max(e,n),a=Math.min(t,s),c=Math.ceil(o/_A)*_A,h=Math.max(c,Math.floor(a/_A)*_A);{const m=this.fl(o),x=this.vl(Math.min(a,c,t));i=Di(i,this.pl(m,x,A))}let d=this.il.get(A);d===void 0&&(d=new Map,this.il.set(A,d));for(let m=Math.max(c+1,o);m<h;m+=_A){const x=Math.floor(m/_A);let v=d.get(x);if(v===void 0){const B=this.fl(x*_A),y=this.vl((x+1)*_A-1);v=this.pl(B,y,A),d.set(x,v)}i=Di(i,v)}{const m=this.fl(h),x=this.vl(a);i=Di(i,this.pl(m,x,A))}return i}}function Di(r,e){return r===null?e:e===null?r:{ml:Math.min(r.ml,e.ml),bl:Math.max(r.bl,e.bl)}}class Cf{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var i,n;(n=(i=this.wl).drawBackground)===null||n===void 0||n.call(i,e)}}class bs{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 Cf(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 Tl(r){var e,t,A,i,n;return{Kt:r.text(),ki:r.coordinate(),Si:(e=r.fixedCoordinate)===null||e===void 0?void 0:e.call(r),V:r.textColor(),t:r.backColor(),yt:(A=(t=r.visible)===null||t===void 0?void 0:t.call(r))===null||A===void 0||A,hi:(n=(i=r.tickVisible)===null||i===void 0?void 0:i.call(r))===null||n===void 0||n}}class vf{constructor(e,t){this.Wt=new ja,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Tl(this.kl))),this.Wt}}class yf extends Si{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const i=Tl(this.kl);A.t=i.t,e.V=i.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=i.ki,A.Si=i.Si,e.Kt=i.Kt,e.yt=i.yt,e.hi=i.hi}}class bf{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,i;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Cl)===null||i===void 0?void 0:i.Ml)===n)return this.Cl.xl;const s=n.map((o=>new bs(o)));return this.Cl={Ml:n,xl:s},s}Qi(){var e,t,A,i;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Tl)===null||i===void 0?void 0:i.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((a=>new vf(a,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,i;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Pl)===null||i===void 0?void 0:i.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((a=>new yf(a,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,i;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Rl)===null||i===void 0?void 0:i.Ml)===n)return this.Rl.xl;const s=n.map((o=>new bs(o)));return this.Rl={Ml:n,xl:s},s}Al(){var e,t,A,i;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Dl)===null||i===void 0?void 0:i.Ml)===n)return this.Dl.xl;const s=n.map((o=>new bs(o)));return this.Dl={Ml:n,xl:s},s}Il(e,t){var A,i,n;return(n=(i=(A=this.Vl).autoscaleInfo)===null||i===void 0?void 0:i.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,i,n;return(n=(i=(A=this.Vl).hitTest)===null||i===void 0?void 0:i.call(A,e,t))!==null&&n!==void 0?n:null}}function Ts(r,e,t,A){r.forEach((i=>{e(i).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function xs(r){return r.Pn()}function Tf(r){return r.Bl()}function xf(r){return r.Al()}class Qs extends mf{constructor(e,t,A,i,n){super(e),this.zt=new Bf,this.jh=new hf(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 uf(this);this.rn=[s],this.Hh=new pl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new rf(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 i=this.$t().St().Xs(),n=this.Ct();if(i===null||n===null)return t;let s,o;if(e){const d=this.zt.sl();if(d===null)return t;s=d,o=d.ee}else{const d=this.zt.ll(i.ui(),-1);if(d===null||(s=this.zt.Gh(d.ee),s===null))return t;o=d.ee}const a=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=A.Rt(a,n.Vt);return{Xr:!1,_t:a,Kt:A.Fi(a,n.Vt),xh:A.Yl(a),Sh:A.Zl(a,n.Vt),V:c.ce,ki:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new wf(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),aA(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 ff(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=[];Ts(this.Hl,xs,"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),Ts(this.Hl,xs,"normal",e),e}ua(){return this.ca(xs,"bottom")}da(e){return this.ca(Tf,e)}fa(e){return this.ca(xf,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 i of this.zl)A.push(i.Zh());return this.Hl.forEach((i=>{A.push(...i.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 i=this.pa(e,t);return i===null?null:i.Bh()}));return _i.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 me(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 bf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof vs)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof vs)return e=>this.wn.je(e)}_a(){return!Hi(this.Dt().Pa())}pa(e,t){if(!_r(e)||!_r(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],i=this.zt.ol(e,t,A);let n=i!==null?new Kt(i.ml,i.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,a=new Kt(o,o);n=n!==null?n.ts(a):a}let s=this.dn.uh();return this.Hl.forEach((o=>{const a=o.Il(e,t);if(a?.priceRange){const x=new Kt(a.priceRange.minValue,a.priceRange.maxValue);n=n!==null?n.ts(x):x}var c,h,d,m;a?.margins&&(c=s,h=a.margins,s={above:Math.max((d=c?.above)!==null&&d!==void 0?d:0,h.above),below:Math.max((m=c?.below)!==null&&m!==void 0?m:0,h.below)})})),new _i(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 Hp(this.cn.priceFormat.precision);break;case"percent":this.wa=new Al(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Li(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=me(this.zt.el());this.Wl=this.Fl.map(((A,i)=>{const n=me(e.Va(A.time,!0)),s=n<t?1:-1;return{time:me(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:i,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new cf(this,this.$t()),this.$l){case"Bar":this.wn=new Kp(this,this.$t());break;case"Candlestick":this.wn=new Gp(this,this.$t());break;case"Line":this.wn=new Jp(this,this.$t());break;case"Custom":this.wn=new vs(this,this.$t(),Dt(e));break;case"Area":this.wn=new Op(this,this.$t());break;case"Baseline":this.wn=new zp(this,this.$t());break;case"Histogram":this.wn=new Zp(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return Ts(this.Hl,e,t,A),A}}class Qf{constructor(e){this.cn=e}Oa(e,t,A){let i=e;if(this.cn.mode===0)return i;const n=A.vn(),s=n.Ct();if(s===null)return i;const o=n.Rt(e,s),a=A.Ba().filter((h=>h instanceof Qs)).reduce(((h,d)=>{if(A.vr(d)||!d.yt())return h;const m=d.Dt(),x=d.In();if(m.Ni()||!x.Kr(t))return h;const v=x.Gh(t);if(v===null)return h;const B=ur(d.Ct());return h.concat([m.Rt(v.Vt[3],B.Vt)])}),[]);if(a.length===0)return i;a.sort(((h,d)=>Math.abs(h-o)-Math.abs(d-o)));const c=a[0];return i=n.pn(c,s),i}}class Ff extends lA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){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=me(this.zt);if(s.Aa){e.strokeStyle=s.Ia,YA(e,s.za),e.beginPath();for(const o of s.La){const a=Math.round(o.Ea*A);e.moveTo(a,-n),e.lineTo(a,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,YA(e,s.Wa),e.beginPath();for(const o of s.ja){const a=Math.round(o.Ea*i);e.moveTo(-n,a),e.lineTo(t.width+n,a)}e.stroke()}}))}}class Uf{constructor(e){this.Wt=new Ff,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 Ef{constructor(e){this.wn=new Uf(e)}qh(){return this.wn}}const Fs={$a:4,Ua:1e-4};function pr(r,e){const t=100*(r-e)/e;return e<0?-t:t}function Sf(r,e){const t=pr(r.Ph(),e),A=pr(r.Rh(),e);return new Kt(t,A)}function Vr(r,e){const t=100*(r-e)/e+100;return e<0?-t:t}function Hf(r,e){const t=Vr(r.Ph(),e),A=Vr(r.Rh(),e);return new Kt(t,A)}function ki(r,e){const t=Math.abs(r);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return r<0?-A:A}function zr(r,e){const t=Math.abs(r);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return r<0?-A:A}function Wr(r,e){if(r===null)return null;const t=ki(r.Ph(),e),A=ki(r.Rh(),e);return new Kt(t,A)}function Oi(r,e){if(r===null)return null;const t=zr(r.Ph(),e),A=zr(r.Rh(),e);return new Kt(t,A)}function Us(r){if(r===null)return Fs;const e=Math.abs(r.Rh()-r.Ph());if(e>=1||e<1e-15)return Fs;const t=Math.ceil(Math.abs(Math.log10(e))),A=Fs.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Es{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let i=A;i>1;i/=10)if(i%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let 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 i=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 d=Mi(n,i,1e-14)&&n>i+1e-14,m=Mi(n,A*o,1e-14),x=Mi(n,1,1e-14);if(!(d&&m&&x))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=i+1e-14&&(n=i),n=Math.max(1,n),this.Za.length>0&&(a=n,c=1,h=1e-14,Math.abs(a-c)<h))for(s=0,o=this.Za[0];Mi(n,A*o,1e-14)&&n>i+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var a,c,h;return n}}class xl{constructor(e,t,A,i){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=i}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),i=(e-t)*this.Qa()/A,n=new Es(this.qa,[2,2.5,2]),s=new Es(this.qa,[2,2,2.5]),o=new Es(this.qa,[2.5,2,2]),a=[];return a.push(n.Xa(e,t,i),s.Xa(e,t,i),o.Xa(e,t,i)),(function(c){if(c.length<1)throw Error("array is empty");let h=c[0];for(let d=1;d<c.length;++d)c[d]<h&&(h=c[d]);return h})(a)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),i=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,a=A-1-s,c=Math.max(i,n),h=Math.min(i,n);if(c===h)return void(this.Ka=[]);let d=this.Xa(c,h),m=c%d;m+=m<0?d:0;const x=c>=h?1:-1;let v=null,B=0;for(let y=c-m;y>h;y-=d){const D=this.Ja(y,t,!0);v!==null&&Math.abs(D-v)<this.Qa()||D<o||D>a||(B<this.Ka.length?(this.Ka[B].Ea=D,this.Ka[B].so=e.eo(y)):this.Ka.push({Ea:D,so:e.eo(y)}),B++,v=D,e.ro()&&(d=this.Xa(y*x,h)))}this.Ka.length=B}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Ql(r){return r.slice().sort(((e,t)=>me(e.Xi())-me(t.Xi())))}var Fl;(function(r){r[r.Normal=0]="Normal",r[r.Logarithmic=1]="Logarithmic",r[r.Percentage=2]="Percentage",r[r.IndexedTo100=3]="IndexedTo100"})(Fl||(Fl={}));const Ul=new Al,El=new Li(100,1);class Lf{constructor(e,t,A,i){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new dt,this.vo=new dt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=El,this.xo=Us(null),this.So=e,this.cn=t,this.ko=A,this.yo=i,this.Co=new xl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(aA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=Dt(e.scaleMargins.top),A=Dt(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=zr(n.Ph(),s),a=zr(n.Rh(),s);return isFinite(o)&&isFinite(a)})(this.Ih,this.xo)?(A=Oi(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=Wr(this.Ih,this.xo),A!==null&&this.Ao(A));const i=t.Cr!==this.cn.mode;i&&(t.Cr===2||this.Mh())&&this.Ra(),i&&(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=pr(e,t):this.Oo()&&(e=Vr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const i=this.Fo(),n=me(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,c=this.Bo(),h=a/(o-s),d=A===void 0?0:A.from,m=A===void 0?e.length:A.to,x=this.Ho();for(let v=d;v<m;v++){const B=e[v],y=B._t;if(isNaN(y))continue;let D=y;x!==null&&(D=x(B._t,t));const E=i+h*(D-s),N=c?E:this.ho-1-E;B.st=N}}be(e,t,A){this.Wo();const i=this.Fo(),n=me(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,c=this.Bo(),h=a/(o-s),d=A===void 0?0:A.from,m=A===void 0?e.length:A.to,x=this.Ho();for(let v=d;v<m;v++){const B=e[v];let y=B.ge,D=B.Me,E=B.xe,N=B.Se;x!==null&&(y=x(B.ge,t),D=x(B.Me,t),E=x(B.xe,t),N=x(B.Se,t));let S=i+h*(y-s),W=c?S:this.ho-1-S;B.pe=W,S=i+h*(D-s),W=c?S:this.ho-1-S,B.de=W,S=i+h*(E-s),W=c?S:this.ho-1-S,B.fe=W,S=i+h*(N-s),W=c?S:this.ho-1-S,B.me=W}}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(i,n){return n<0&&(i=-i),i/100*n+n})(A,t):this.Oo()&&(A=(function(i,n){return i-=100,n<0&&(i=-i),i/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=me(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=me(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=me(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=me(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const i=A*t,n=me(this.ao).Th();n.Oh(i),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(pr(e,t));case 3:return this.ba().format(Vr(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,me(this.e_()).ba())}Zl(e,t){return e=pr(e,t),this.s_(e,Ul)}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=El,this.Mh()?(this.wa=Ul,t=100):this.Oo()?(this.wa=new Li(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new xl(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?ki(e,this.xo):e;const A=me(this.Lh()),i=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(i)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),i=me(this.Lh()),n=i.Ph()+i.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?zr(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 i=0,n=0;for(const a of A){if(!a.yt())continue;const c=a.Ct();if(c===null)continue;const h=a.Il(e.Os(),e.ui());let d=h&&h.Lh();if(d!==null){switch(this.cn.mode){case 1:d=Wr(d,this.xo);break;case 2:d=Sf(d,c.Vt);break;case 3:d=Hf(d,c.Vt)}if(t=t===null?d:t.ts(me(d)),h!==null){const m=h.Eh();m!==null&&(i=Math.max(i,m.above),n=Math.max(n,m.below))}}}if(i===this.co&&n===this.do||(this.co=i,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const a=this.e_(),c=5*(a===null||this.Mh()||this.Oo()?1:a.ma());this.ro()&&(t=Oi(t,this.xo)),t=new Kt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=Wr(t,this.xo))}if(this.ro()){const a=Oi(t,this.xo),c=Us(a);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?Oi(this.ao,this.xo):null;this.xo=c,t=Wr(a,c),h!==null&&(this.ao=Wr(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new Kt(-.5,.5)),this.xo=Us(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?pr:this.Oo()?Vr:this.ro()?e=>ki(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 Mf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new dt,this.yl=e,this.$i=t,this.d_=new Ef(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 i=me(A[0].Dt());i.$h(e.overlayPriceScales),e.localization&&i.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?Dt(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 i=A!==void 0?A:this.C_().y_+1;this.T_(e,t,i)}Zo(e){const t=this.po.indexOf(e);IA(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=me(e.Dt()).Pa();if(this.o_.has(A)){const n=Dt(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const i=e.Dt();i&&i.Ba().indexOf(e)>=0&&i.Zo(e),i!==null&&(i.Yo(),this.P_(i)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,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 i=0;i<e.length;i++){const n=e[i].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let i=this.w_(t);if(i===null&&(i=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!Hi(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}i.qo(e),e.Gi(i),e.Ki(A),this.P_(i),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},QA(t)),i=new Lf(e,A,this.$i.W().layout,this.$i.W().localization);return i.Lo(this.At()),i}}class If{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),i=this.tr.get(A);if(i!==void 0)return i.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(Dt(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 Gr{constructor(e,t){IA(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 Sl(r,e){return r===null||e===null?r===e:r.Ch(e)}class _f{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 i=e[A];let n=this.J_.get(i.timeWeight);n===void 0&&(n=[],this.J_.set(i.timeWeight,n)),n.push({index:A,time:i.time,weight:i.timeWeight,originalTime:i.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,i)=>{e<=A[0].index?t.push(i):A.splice(Or(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(((i,n)=>n-i))){if(!this.J_.get(A))continue;const i=t;t=[];const n=i.length;let s=0;const o=Dt(this.J_.get(A)),a=o.length;let c=1/0,h=-1/0;for(let d=0;d<a;d++){const m=o[d],x=m.index;for(;s<n;){const v=i[s],B=v.index;if(!(B<x)){c=B;break}s++,t.push(v),h=B,c=1/0}if(c-x>=e&&x-h>=e)t.push(m),h=x;else if(this.Q_)return i}for(;s<n;s++)t.push(i[s])}return t}}class fr{constructor(e){this.hu=e}lu(){return this.hu===null?null:new Gr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new fr(null)}}function Df(r,e){return r.weight>e.weight?r:e}class kf{constructor(e,t,A,i){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new _f,this.du=new Map,this.fu=fr.ou(),this.vu=!0,this.pu=new dt,this.mu=new dt,this.bu=new dt,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_=i,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){aA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;aA(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=Or(this.uu,this.q_.key(e),((i,n)=>this.q_.key(i.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),i=me(this.Bu()),n=me(this.Au());return{from:me(this.Ui(Math.max(i,t))),to:me(this.Ui(Math.min(n,A)))}}Iu(e){return{from:me(this.Va(e.from,!0)),to:me(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 i=this.Su*e/A;this.Su=i}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const i=A-e;this.xu-=Math.round(i/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!_r(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),i=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=i;s<n;s++){const o=e[s].ot,a=A+this.xu-o,c=this.__-(a+.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),i=me(this.Xs()),n=Math.max(i.Os(),i.Os()-A),s=Math.max(i.ui(),i.ui()-A),o=this.cu.su(e,t),a=this.Bu()+A,c=this.Au()-A,h=this.$u(),d=this.cn.fixLeftEdge||h,m=this.cn.fixRightEdge||h;let x=0;for(const v of o){if(!(n<=v.index&&v.index<=s))continue;let B;x<this.Mu.length?(B=this.Mu[x],B.coord=this.It(v.index),B.label=this.Uu(v),B.weight=v.weight):(B={needAlignCoordinate:!1,coord:this.It(v.index),label:this.Uu(v),weight:v.weight},this.Mu.push(B)),this.Su>t/2&&!h?B.needAlignCoordinate=!1:B.needAlignCoordinate=d&&v.index<=a||m&&v.index>=c,x++}return this.Mu.length=x,this.gu=this.Mu,this.Mu}qu(){this.vu=!0,this.Gn(this.cn.barSpacing),this.Jn(this.cn.rightOffset)}Yu(e){this.vu=!0,this._u=e,this.Lu(),this.Tu()}Zu(e,t){const A=this.Fu(e),i=this.le(),n=i+t*(i/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=ws(this.__-e,0,this.__),A=ws(this.__-me(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=me(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,i=performance.now();this.$i.Zn({Qu:n=>(n-i)/t>=1,tc:n=>{const s=(n-i)/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 Gr(e,t+this.cn.rightOffset))}lc(e){const t=new Gr(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(fr.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,i=new Gr(A-t+1,A);this._c(new fr(i))}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 If((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,Sl(t.lu(),this.fu.lu())||this.pu.m(),Sl(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 i=this.xu-A-1;this.Jn(i)}this.zu()}Pu(){this.Lu(),this.zu()}}class Of{X(e,t,A){e.useMediaCoordinateSpace((i=>this.K(i,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((i=>this.vc(i,t,A)))}vc(e,t,A){}}class Nf extends Of{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 i=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,i+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-i)/2,0);break;case"bottom":n=Math.max(A.height-i,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 i=A.get(t);return i===void 0&&(i=e.measureText(t).width,A.set(t,i)),i}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class Kf{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Nf(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.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:dr(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class Pf extends ms{constructor(e,t){super(),this.cn=t,this.wn=new Kf(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Hl,Ll,Ml,Il,_l;(function(r){r[r.OnTouchEnd=0]="OnTouchEnd",r[r.OnNextTap=1]="OnNextTap"})(Hl||(Hl={}));class Vf{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new dt,this.Rc=new dt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Bp(this),this.yl=new kf(this,t.timeScale,this.cn.localization,A),this.vt=new Sp(this,t.crosshair),this.Bc=new Qf(t.crosshair),this.Ac=new Pf(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(xt.es())}Uh(){this.Nc(xt.ss())}oa(){this.Nc(new xt(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){aA(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 Mf(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,i=xt.es();return i.Nn(A,{Fn:0,Wn:!0}),this.Nc(i),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 i=A.Hi();e=Math.max(1,Math.min(e,i)),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,i,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const a=this.yl.Xs();a!==null&&(o=Math.min(Math.max(a.Os(),o),a.ui()));const c=i.vn(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,i),this.vt.kn(o,s,i),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const i=A.vn(),n=i.Ct(),s=i.Rt(e,me(n)),o=this.yl.Va(t,!0),a=this.yl.It(me(o));this.ld(a,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 i=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&&i!==null&&n!==null){const a=o.Kr(s),c=this.q_.key(i)>this.q_.key(n),h=e!==null&&e>s&&!c,d=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,m=a&&(A!==void 0||d)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!m){const x=e-s;this.yl.Jn(this.yl.Hu()-x)}}this.yl.Yu(e)}ia(e){e!==null&&e.F_()}dr(e){const t=this.yc.find((A=>A.Uo().includes(e)));return t===void 0?null:t}Wu(){this.Ac.Vn(),this.yc.forEach((e=>e.F_())),this.Jl()}S(){this.yc.forEach((e=>e.S())),this.yc.length=0,this.cn.localization.priceFormatter=void 0,this.cn.localization.percentageFormatter=void 0,this.cn.localization.timeFormatter=void 0}ud(){return this.Oc}br(){return this.Oc.W()}g_(){return this.Pc}dd(e,t,A){const i=this.yc[0],n=this.fd(t,e,i,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);IA(A!==-1,"Series not found"),this.Cc.splice(A,1),me(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=me(this.dr(e));A.Zo(e);const i=this.Uc(t);if(i===null){const n=e.Xi();A.qo(e,t,n)}else{const n=i.Ht===A?e.Xi():void 0;i.Ht.qo(e,t,n)}}hc(){const e=xt.ss();e.$n(),this.Nc(e)}pd(e){const t=xt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=xt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=xt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=xt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=xt.ss();t.Zn(e),this.Nc(t)}Un(){const e=xt.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 i=(function(n,s,o){const[a,c,h,d]=Ir(n),[m,x,v,B]=Ir(s),y=[eA(a+o*(m-a)),eA(c+o*(x-c)),eA(h+o*(v-h)),$a(d+o*(B-d))];return`rgba(${y[0]}, ${y[1]}, ${y[2]}, ${y[3]})`})(A,t,e/100);return this.Dc.wd.set(e,i),i}Gc(e,t){const A=new xt(t);if(e!==null){const i=this.yc.indexOf(e);A.Nn(i,{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,i){const n=new Qs(this,e,t,A,i),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Hi(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 Ss(r){return!mA(r)&&!Dr(r)}function Dl(r){return mA(r)}(function(r){r[r.Disabled=0]="Disabled",r[r.Continuous=1]="Continuous",r[r.OnDataUpdate=2]="OnDataUpdate"})(Ll||(Ll={})),(function(r){r[r.LastBar=0]="LastBar",r[r.LastVisible=1]="LastVisible"})(Ml||(Ml={})),(function(r){r.Solid="solid",r.VerticalGradient="gradient"})(Il||(Il={})),(function(r){r[r.Year=0]="Year",r[r.Month=1]="Month",r[r.DayOfMonth=2]="DayOfMonth",r[r.Time=3]="Time",r[r.TimeWithSeconds=4]="TimeWithSeconds"})(_l||(_l={}));const kl=r=>r.getUTCFullYear();function zf(r,e,t){return e.replace(/yyyy/g,(A=>FA(kl(A),4))(r)).replace(/yy/g,(A=>FA(kl(A)%100,2))(r)).replace(/MMMM/g,((A,i)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(r,t)).replace(/MMM/g,((A,i)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(r,t)).replace(/MM/g,(A=>FA((i=>i.getUTCMonth()+1)(A),2))(r)).replace(/dd/g,(A=>FA((i=>i.getUTCDate())(A),2))(r))}class Ol{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return zf(e,this.gd,this.Md)}}class Wf{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",FA(e.getUTCHours(),2)).replace("%m",FA(e.getUTCMinutes(),2)).replace("%s",FA(e.getUTCSeconds(),2))}}const Gf={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Rf{constructor(e={}){const t=Object.assign(Object.assign({},Gf),e);this.Td=new Ol(t.Sd,t.Cd),this.Pd=new Wf(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function Ni(r){return 60*r*60*1e3}function Hs(r){return 60*r*1e3}const Ki=[{Dd:(Nl=1,1e3*Nl),Vd:10},{Dd:Hs(1),Vd:20},{Dd:Hs(5),Vd:21},{Dd:Hs(30),Vd:22},{Dd:Ni(1),Vd:30},{Dd:Ni(3),Vd:31},{Dd:Ni(6),Vd:32},{Dd:Ni(12),Vd:33}];var Nl;function Kl(r,e){if(r.getUTCFullYear()!==e.getUTCFullYear())return 70;if(r.getUTCMonth()!==e.getUTCMonth())return 60;if(r.getUTCDate()!==e.getUTCDate())return 50;for(let t=Ki.length-1;t>=0;--t)if(Math.floor(e.getTime()/Ki[t].Dd)!==Math.floor(r.getTime()/Ki[t].Dd))return Ki[t].Vd;return 0}function Ls(r){let e=r;if(Dr(r)&&(e=Ms(r)),!Ss(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 Pl(r){if(!Dl(r))throw new Error("time must be of type isUTCTimestamp");return{Od:r}}function Ms(r){const e=new Date(r);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${r}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Vl(r){Dr(r.time)&&(r.time=Ms(r.time))}class zl{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(Vl)})(e):Vl(e)}createConverterToInternalObj(e){return me((function(t){return t.length===0?null:Ss(t[0].time)||Dr(t[0].time)?Ls:Pl})(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 Dl(t=e)?Pl(t):Ss(t)?Ls(t):Ls(Ms(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Rf({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Ol(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),i=this.cn.timeScale;if(i.tickMarkFormatter!==void 0){const n=i.tickMarkFormatter(e.originalTime,A,t.locale);if(n!==null)return n}return(function(n,s,o){const a={};switch(s){case 0:a.year="numeric";break;case 1:a.month="short";break;case 2:a.day="numeric";break;case 3:a.hour12=!1,a.hour="2-digit",a.minute="2-digit";break;case 4:a.hour12=!1,a.hour="2-digit",a.minute="2-digit",a.second="2-digit"}const 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,a)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(Df,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,i=0){if(A.length===0)return;let n=i===0?null:A[i-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let a=i;a<A.length;++a){const c=A[a],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=Kl(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}if(i===0&&A.length>1){const a=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-a));A[0].timeWeight=Kl(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return aA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const mr=typeof window<"u";function Wl(){return!!mr&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Is(){return!!mr&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function _s(r){return r+r%2}function Ds(r,e){return r.zd-e.zd}function ks(r,e,t){const A=(r.zd-e.zd)/(r.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class $f{constructor(e,t,A,i){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=t,this.qd=A,this.rs=i}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 i=ks(this.Ld,this.Ed,this.Ud),n=Ds(this.Ld,this.Ed),s=[i],o=[n];if(A+=n,this.Nd!==null){const c=ks(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(i)){const h=Ds(this.Ed,this.Nd);if(s.push(c),o.push(h),A+=h,this.Fd!==null){const d=ks(this.Nd,this.Fd,this.Ud);if(Math.sign(d)===Math.sign(i)){const m=Ds(this.Nd,this.Fd);s.push(d),o.push(m),A+=m}}}}let a=0;for(let c=0;c<s.length;++c)a+=o[c]/A*s[c];Math.abs(a)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=a,this.jd=(function(c,h){const d=Math.log(h);return Math.log(1*d/-c)/d})(Math.abs(a),this.qd))}tc(e){const t=me(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-me(this.Wd).ot;return Math.min(t,this.jd)}}class Xf{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 Xa(Ir(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 jA(r,e){const t=me(r.ownerDocument).createElement("canvas");r.appendChild(t);const A=ip(t,{options:{allowResizeObserver:!1},transform:(i,n)=>({width:Math.max(i.width,n.width),height:Math.max(i.height,n.height)})});return A.resizeCanvasElement(e),A}function er(r){var e;r.width=1,r.height=1,(e=r.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function Os(r,e,t,A){r.gl&&r.gl(e,t,A)}function Pi(r,e,t,A){r.X(e,t,A)}function Ns(r,e,t,A){const i=r(t,A);for(const n of i){const s=n.gt();s!==null&&e(s)}}function Zf(r){mr&&window.chrome!==void 0&&r.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Ks{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=!Is(),this.Af=i=>{this.If(i)},this.zf=i=>{if(this.Lf(i)){const n=this.Ef(i);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(gA(i),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(i);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(gA(i),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=Ps(e.changedTouches,me(this.Of));if(t===null||(this.Vf=Vi(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(gA(t),me(this.pf)),{nv:i,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*i,a=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();a||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),gr(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(gA(e),me(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const i=this.Ef(e);this.Uf(i,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),i=Math.abs(t.st-e.st);return{nv:A,sv:i,Nf:A+i}}ov(e){let t=Ps(e.changedTouches,me(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=Vi(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:i}=this.Ff(gA(t),this.cf);i<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&gr(e));this._f===0&&gr(e),e.touches.length===0&&this.ff&&(this.ff=!1,gr(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),Wl()&&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(gA(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=Vi(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=gA(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 i=this.Ef(e,t);this.Wf(i,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=gA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;Wl()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=gA(e),this.kf&&(this.kf(),this.kf=null);{const i=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",i),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=gA(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})}Is()&&(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}),Zf(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=Gl(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),gr(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=Gl(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=!Is()}vv(e){const t=Ps(e.touches,me(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:Vi(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,i=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-i.left,localY:A.clientY-i.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&gr(e)}}}}function Gl(r,e){const t=r.clientX-e.clientX,A=r.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function gr(r){r.cancelable&&r.preventDefault()}function gA(r){return{nt:r.pageX,st:r.pageY}}function Vi(r){return r.timeStamp||performance.now()}function Ps(r,e){for(let t=0;t<r.length;++t)if(r[t].identifier===e)return r[t];return null}function zi(r){return{Hc:r.Hc,Iv:{gr:r.zv.externalId},Lv:r.zv.cursorStyle}}function Jf(r,e,t){for(const A of r){const i=A.gt();if(i!==null&&i.wr){const n=i.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function Vs(r,e){return t=>{var A,i,n,s;return((i=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&i!==void 0?i:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,r))!==null&&s!==void 0?s:[]}}function Rl(r,e,t,A){if(!r.length)return;let i=0;const n=t/2,s=r[0].At(A,!0);let o=e===1?n-(r[0].Vi()-s/2):r[0].Vi()-s/2-n;o=Math.max(0,o);for(let a=1;a<r.length;a++){const c=r[a],h=r[a-1],d=h.At(A,!1),m=c.Vi(),x=h.Vi();if(e===1?m>x-d:m<x+d){const v=x-d*e;c.Oi(v);const B=v-e*d/2;if((e===1?B<0:B>t)&&o>0){const y=e===1?-1-B:B-t,D=Math.min(y,o);for(let E=i;E<r.length;E++)r[E].Oi(r[E].Vi()+e*D);o-=D}}else i=a,o=e===1?x-d-m:m-(x+d)}}class $l{constructor(e,t,A,i){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Nr(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=i==="left",this.Yv=Vs("normal",i),this.Zv=Vs("top",i),this.Xv=Vs("bottom",i),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=jA(this.Kv,ot({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=jA(this.Kv,ot({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 Ks(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(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=me(this.Gv.canvasElement.getContext("2d"));A.save();const i=this.Li.Ha();A.font=this._p(),i.length>0&&(e=Math.max(this.Fv.xi(A,i[0].so),this.Fv.xi(A,i[i.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(A,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;A.restore();const a=e||34;return _s(Math.ceil(t.C+t.T+t.A+t.I+5+a))}cp(e){this.Ev!==null&&JA(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 me(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,me(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const i=this.xp();i.width>0&&i.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(),i=this.Li;t.O_(A,i,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 i=0;i<A.length;++i){const n=A[i].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:i}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?Ei(e,0,0,A,i,s):qa(e,0,0,A,i,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 i=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-i:0,e.fillRect(n,0,i,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),i=this.ap(),n=this.qv?this.Ev.width-i.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:a})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(a)),h=Math.floor(.5*a),d=Math.round(i.T*o);s.beginPath();for(const m of t)s.rect(Math.floor(n*o),Math.round(m.Ea*a)-h,d,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 a=this.qv?Math.round(n-i.A):Math.round(n+i.T+i.A),c=t.map((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const d=t[h];s.fillText(d.so,a,d.Ea+c[h])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),i=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,i)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,i=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));i.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),a=s.ki();a>-o&&a<o&&s.Oi(o),a>this.Ev.height-o&&a<this.Ev.height+o&&s.Oi(this.Ev.height-o)}Rl(i,1,this.Ev.height,t),Rl(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),i=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(me(this.Li)).X(e,A,this.Fv,i)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],i=this.tn.fp(),n=t.Zc().Rn(i,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((a=>{a.forEach((c=>{c.gt(me(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 dr(this.ko.fontSize,this.ko.fontFamily)}}function qf(r,e){var t,A;return(A=(t=r.ua)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function Wi(r,e){var t,A;return(A=(t=r.Pn)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function Yf(r,e){var t,A;return(A=(t=r.Ji)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function jf(r,e){var t,A;return(A=(t=r.aa)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}class zs{constructor(e,t){this.Ev=ot({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new dt,this.Op=new dt,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=jA(A,ot({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=jA(A,ot({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 Ks(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),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return me(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(zs.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 Xf(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(me(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(me(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,i=e.localY;this.Gp(A,i,e);const n=this.wr(A,i);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 i=me(this.Lp),n=i.x+(t-this.Ip.x),s=i.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(i,n,s){const o=i.Uo(),a=(function(c,h,d){var m,x;let v,B;for(const E of c){const N=(x=(m=E.va)===null||m===void 0?void 0:m.call(E,h,d))!==null&&x!==void 0?x:[];for(const S of N)y=S.zOrder,(!(D=v?.zOrder)||y==="top"&&D!=="top"||y==="normal"&&D==="bottom")&&(v=S,B=E)}var y,D;return v&&B?{zv:v,Hc:B}:null})(o,n,s);if(a?.zv.zOrder==="top")return zi(a);for(const c of o){if(a&&a.Hc===c&&a.zv.zOrder!=="bottom"&&!a.zv.isBackground)return zi(a);const h=Jf(c.Pn(i),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(a&&a.Hc===c&&a.zv.zOrder!=="bottom"&&a.zv.isBackground)return zi(a)}return a?.zv?zi(a):null})(A,e,t)}_m(e,t){me(t==="left"?this.Cp:this.Tp).cp(ot({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){JA(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=me(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 i=this.xp();i.width>0&&i.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=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i)})),this.Np&&(this.fm(A,qf),this.vm(A),this.pm(A),this.fm(A,Wi),this.fm(A,Yf)))}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.bm(t),this.fm(t,jf))}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,i=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:i},t)}mp({context:e,bitmapSize:t}){const{width:A,height:i}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?Ei(e,0,0,A,i,o):qa(e,0,0,A,i,s,o)}vm(e){const t=me(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,Wi,Os,t),this.Mm(e,Wi,Pi,t)}bm(e){this.Mm(e,Wi,Pi,this.$i().Zc())}fm(e,t){const A=me(this.Np).Uo();for(const i of A)this.Mm(e,t,Os,i);for(const i of A)this.Mm(e,t,Pi,i)}Mm(e,t,A,i){const n=me(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===i,a=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;Ns(t,(c=>A(c,e,o,a)),i,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 i=e.$t().ud();t&&this.Cp===null&&(this.Cp=new $l(this,e.W(),i,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new $l(this,e.W(),i,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,me(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 i=this.$i().Zc();this.Lp={x:i.Yt(),y:i.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 i=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),i),this.Ep.Qu(i)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)me(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 i=this.Qd.W(),n=i.handleScroll,s=i.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),a=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:a,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new $f(.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(),a))}}class Xl{constructor(e,t,A,i,n){this.ft=!0,this.Ev=ot({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=i,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=jA(this.Kv,ot({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){JA(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=qA(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){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*i),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){Ei(e,0,0,t.width,t.height,this.Pm())}}function Ws(r){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,r))!==null&&A!==void 0?A:[]}}const e0=Ws("normal"),t0=Ws("top"),A0=Ws("bottom");class r0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=ot({width:0,height:0}),this.Om=new dt,this.Fv=new Nr(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=jA(this.Im,ot({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=jA(this.Im,ot({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const i=this.Jv.canvasElement;i.style.position="absolute",i.style.zIndex="2",i.style.left="0",i.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new Ks(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),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(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){JA(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(ot({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(ot({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 i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i),this.$m(A,A0)})),this.wp(A),this.$m(A,e0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,t0))}$m(e,t){const A=this.Qd.$t().wt();for(const i of A)Ns(t,(n=>Os(n,e,!1,void 0)),i,void 0);for(const i of A)Ns(t,(n=>Pi(n,e,!1,void 0)),i,void 0)}mp({context:e,bitmapSize:t}){Ei(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 i=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,i)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const i=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:a,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const h=Math.max(1,Math.floor(a)),d=Math.floor(.5*a);o.beginPath();const m=Math.round(n.T*c);for(let x=A.length;x--;){const v=Math.round(A[x].coord*a);o.rect(v-d,0,h,m)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const a=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<i){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,a)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=i){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,a)}}))}Ym(e,t,A){const i=this.Fv.xi(e,A),n=i/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+i>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+i))),t}Um(e,t){const A=this.jm();for(const i of e)for(const n of i.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return dr(this.j(),this.cn.fontFamily)}Zm(){return dr(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 Nr,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()},i=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Xl("left",t,A,i,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Xl("right",t,A,i,n),this.Am.appendChild(this.Dm.lp()))}}const i0=!!mr&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((r=>r.brand.includes("Chromium")))&&!!mr&&(!((Gs=navigator?.userAgentData)===null||Gs===void 0)&&Gs.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Gs;class n0{constructor(e,t,A){var i;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new dt,this.Op=new dt,this.Rc=new dt,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%",(i=this.Xd).style.userSelect="none",i.style.webkitUserSelect="none",i.style.msUserSelect="none",i.style.MozUserSelect="none",i.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Rs(this.cn)&&this.hb(!0),this.$i=new Vf(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new r0(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 a=e.getBoundingClientRect();s=s||a.width,o=o||a.height}this._b(s,o),this.ub(),e.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],me(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 i=(function(o){const a=Math.floor(o.width),c=Math.floor(o.height);return ot({width:a-a%2,height:c-c%2})})(ot({width:e,height:t}));this.ho=i.height,this.__=i.width;const n=this.ho+"px",s=this.__+"px";me(this.Xd).style.height=n,me(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(xt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=xt.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=Rs(this.cn);this.$i.$h(e);const A=Rs(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=me(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:me(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 Dt(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 i=this.Xm[0],n=(o,a)=>{let c=0;for(let h=0;h<this.Xm.length;h++){const d=this.Xm[h],m=me(o==="left"?d.wm():d.gm()),x=m.xp();e!==null&&m.Sp(e,a,c),c+=x.height}};this.xb()&&(n("left",0),t+=me(i.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const a=this.Xm[o],c=a.xp();e!==null&&a.Sp(e,t,A),A+=c.height}t+=i.xp().width,this.Sb()&&(n("right",t),t+=me(i.gm()).xp().width);const s=(o,a,c)=>{me(o==="left"?this.ab.Lm():this.ab.Em()).Sp(me(e),a,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let a=0;this.xb()&&(s("left",a,A),a=me(i.wm()).xp().width),this.ab.Sp(e,a,A),a+=o.width,this.Sb()&&s("right",a,A)}A+=o.height}return ot({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const v of this.Xm)this.xb()&&(t=Math.max(t,me(v.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,me(v.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=v.M_();t=_s(t),A=_s(A);const i=this.__,n=this.ho,s=Math.max(i-t-A,0),o=this.cn.timeScale.visible;let a=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;a=(c=a)+c%2;const h=0+a,d=n<h?0:n-h,m=d/e;let x=0;for(let v=0;v<this.Xm.length;++v){const B=this.Xm[v];B.qp(this.$i.qc()[v]);let y=0,D=0;D=v===this.Xm.length-1?d-x:Math.round(B.M_()*m),y=Math.max(D,2),x+=y,B.cp(ot({width:s,height:y})),this.xb()&&B._m(t,"left"),this.Sb()&&B._m(A,"right"),B.fp()&&this.$i.Kc(B.fp(),y)}this.ab.Fm(ot({width:o?s:0,height:a}),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 i0?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,i=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),i!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(i)*Math.min(1,Math.abs(i)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const i=e.jn();i===3&&this.Db(),i!==3&&i!==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 i of A.Qn())if(i.qn===5&&!i.Vt.Qu(t)){this.$t().Zn(i.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let i=t;i<A;i++){const n=Dt(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let i=A;i<t;i++){const n=new zs(this,e[i]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let i=0;i<t;i++){const n=e[i],s=this.Xm[i];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var i;const n=new Map;e!==null&&this.$i.wt().forEach((h=>{const d=h.In().ll(e);d!==null&&n.set(h,d)}));let s;if(e!==null){const h=(i=this.$i.St().Ui(e))===null||i===void 0?void 0:i.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),a=o!==null&&o.Hc instanceof Qs?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:a,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 Rs(r){return!!(r.handleScroll.mouseWheel||r.handleScale.mouseWheel)}function s0(r){return(function(e){return e.open!==void 0})(r)||(function(e){return e.value!==void 0})(r)}function Zl(r,e){var t={};for(var A in r)Object.prototype.hasOwnProperty.call(r,A)&&e.indexOf(A)<0&&(t[A]=r[A]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(A=Object.getOwnPropertySymbols(r);i<A.length;i++)e.indexOf(A[i])<0&&Object.prototype.propertyIsEnumerable.call(r,A[i])&&(t[A[i]]=r[A[i]])}return t}function Jl(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:A};return t.color!==void 0&&(n.V=t.color),n}function o0(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],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 a0(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],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 l0(r,e,t,A){const i={ee:e,ot:r,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(i.V=t.color),i}function c0(r,e,t,A){const i={ee:e,ot:r,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(i.V=t.color),t.borderColor!==void 0&&(i.Ot=t.borderColor),t.wickColor!==void 0&&(i.Xh=t.wickColor),i}function h0(r,e,t,A,i){const n=Dt(i)(t),s=Math.max(...n),o=Math.min(...n),a=n[n.length-1],c=[a,s,o,a],h=t,{time:d,color:m}=h;return{ee:e,ot:r,Vt:c,zb:A,$e:Zl(h,["time","color"]),V:m}}function Gi(r){return r.Vt!==void 0}function ql(r,e){return e.customValues!==void 0&&(r.jb=e.customValues),r}function tr(r){return(e,t,A,i,n,s)=>(function(o,a){return a?a(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?ql({ot:e,ee:t,zb:i},A):ql(r(e,t,A,i,n),A)}function Yl(r){return{Candlestick:tr(c0),Bar:tr(l0),Area:tr(o0),Baseline:tr(a0),Histogram:tr(Jl),Line:tr(Jl),Custom:tr(h0)}[r]}function jl(r){return{ee:0,Hb:new Map,la:r}}function ec(r,e){if(r!==void 0&&r.length!==0)return{$b:e.key(r[0].ot),Ub:e.key(r[r.length-1].ot)}}function tc(r){let e;return r.forEach((t=>{e===void 0&&(e=t.zb)})),Dt(e)}class u0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,i=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,i=!0,this.qb.clear();else for(const a of this.Xb)a.pointData.Hb.delete(e)&&(i=!0);let s=[];if(t.length!==0){const a=t.map((x=>x.time)),c=this.q_.createConverterToInternalObj(t),h=Yl(e.Qh()),d=e.Ca(),m=e.Ta();s=t.map(((x,v)=>{const B=c(x.time),y=this.q_.key(B);let D=this.qb.get(y);D===void 0&&(D=jl(B),this.qb.set(y,D),i=!0);const E=h(B,D.ee,x,a[v],d,m);return D.Hb.set(e,E),E}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(i){const a=[];this.qb.forEach((c=>{a.push({timeWeight:0,time:c.la,pointData:c,originalTime:tc(c.Hb)})})),a.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(a)}return this.tw(e,o,(function(a,c,h){const d=ec(a,h),m=ec(c,h);if(d!==void 0&&m!==void 0)return{ta:d.Ub>=m.Ub&&d.$b>=m.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(B){B.zb===void 0&&(B.zb=B.time)})(A),this.q_.preprocessData(t);const i=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(i)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${i}`);let s=this.qb.get(this.q_.key(i));const o=s===void 0;s===void 0&&(s=jl(i),this.qb.set(this.q_.key(i),s));const a=Yl(e.Qh()),c=e.Ca(),h=e.Ta(),d=a(i,s.ee,t,A.zb,c,h);s.Hb.set(e,d),this.nw(e,d);const m={ta:Gi(d)};if(!o)return this.tw(e,-1,m);const x={timeWeight:0,time:s.la,pointData:s,originalTime:tc(s.Hb)},v=Or(this.Xb,this.q_.key(x.time),((B,y)=>this.q_.key(B.time)<y));this.Xb.splice(v,0,x);for(let B=v;B<this.Xb.length;++B)$s(this.Xb[B].pointData,B);return this.q_.fillWeightsForPoints(this.Xb,v),this.tw(e,v,m)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const i=A.length!==0?A[A.length-1]:null;i===null||this.q_.key(t.ot)>this.q_.key(i.ot)?Gi(t)&&A.push(t):Gi(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(Gi)),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 i=this.Xb[A],n=e[A];if(this.q_.key(i.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=i.timeWeight,$s(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)$s(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 i={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{i.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||i.ew.set(e,{$e:[],rw:A}),i.St.hw=this.Xb,i.St.lw=t;else{const n=this.Yb.get(e);i.ew.set(e,{$e:n||[],rw:A})}return i}}function $s(r,e){r.ee=e,r.Hb.forEach((t=>{t.ee=e}))}function Xs(r){const e={value:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function Ac(r){const e=Xs(r);return r.V!==void 0&&(e.color=r.V),e}function d0(r){const e=Xs(r);return r.lt!==void 0&&(e.lineColor=r.lt),r.Ps!==void 0&&(e.topColor=r.Ps),r.Rs!==void 0&&(e.bottomColor=r.Rs),e}function p0(r){const e=Xs(r);return r.Re!==void 0&&(e.topLineColor=r.Re),r.De!==void 0&&(e.bottomLineColor=r.De),r.ke!==void 0&&(e.topFillColor1=r.ke),r.ye!==void 0&&(e.topFillColor2=r.ye),r.Ce!==void 0&&(e.bottomFillColor1=r.Ce),r.Te!==void 0&&(e.bottomFillColor2=r.Te),e}function rc(r){const e={open:r.Vt[0],high:r.Vt[1],low:r.Vt[2],close:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function f0(r){const e=rc(r);return r.V!==void 0&&(e.color=r.V),e}function m0(r){const e=rc(r),{V:t,Ot:A,Xh:i}=r;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),i!==void 0&&(e.wickColor=i),e}function Zs(r){return{Area:d0,Line:Ac,Baseline:p0,Histogram:Ac,Bar:f0,Candlestick:m0,Custom:g0}[r]}function g0(r){const e=r.zb;return Object.assign(Object.assign({},r.$e),{time:e})}const w0={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},B0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},C0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:ps,attributionLogo:!0},Js={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},v0={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:ps,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function ic(){return{width:0,height:0,autoSize:!1,layout:C0,crosshair:w0,grid:B0,overlayPriceScales:Object.assign({},Js),leftPriceScale:Object.assign(Object.assign({},Js),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Js),{visible:!0}),timeScale:v0,watermark:y0,localization:{locale:mr?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 b0{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 Hi(this.ow)?this.aw.Mb(this.ow):0}Li(){return me(this.aw.$t().Uc(this.ow)).Dt}}function nc(r,e,t){const A=Zl(r,["time","originalTime"]),i=Object.assign({time:e},A);return t!==void 0&&(i.originalTime=t),i}const T0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class x0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class Q0{constructor(e,t,A,i,n){this.uw=new dt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=i}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 fr(new Gr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const i=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=me(A.el()),o=me(A.An());if(i!==null&&n!==null&&i.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const a={barsBefore:i===null||i.ee===s?e.from-s:i.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return i!==null&&n!==null&&(a.from=i.zb,a.to=n.zb),a}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:Zs(this.seriesType())(A)}data(){const e=Zs(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=>nc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>nc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return QA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=aA(QA(T0),e),A=this.Es.ea(t);return new x0(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 F0{constructor(e,t,A){this.ww=new dt,this.mu=new dt,this.Om=new dt,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){IA(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),i=t.Ui(A);return i===null?null:i.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},QA(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 U0(r){if(r===void 0||r.type==="custom")return;const e=r;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 i=Math.round(t);if(Math.abs(i-t)<1e-8)return A;t*=10}return A})(e.minMove))}function sc(r){return(function(e){if(Ui(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:i}=e.handleScale;Ui(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),Ui(i)&&(e.handleScale.axisDoubleClickReset={time:i,price:i})}const t=e.handleScroll;Ui(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(r),r}class E0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new dt,this.Cw=new dt,this.Tw=new dt,this.Pw=new u0(t);const i=A===void 0?QA(ic()):aA(QA(ic()),sc(A));this.q_=t,this.aw=new n0(e,i,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 F0(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=ur(e),i=Object.assign(Object.assign({},Pa),A.defaultOptions());return this.Vw("Custom",i,t,A)}addAreaSeries(e){return this.Vw("Area",hp,e)}addBaselineSeries(e){return this.Vw("Baseline",up,e)}addBarSeries(e){return this.Vw("Bar",lp,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",ap,e)}addHistogramSeries(e){return this.Vw("Histogram",dp,e)}addLineSeries(e){return this.Vw("Line",cp,e)}removeSeries(e){const t=Dt(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 b0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(sc(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 i=this.Sw.get(A);if(i===void 0)return;const n=this.aw.$t().dr(i);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},i){U0(A.priceFormat);const n=aA(QA(Va),QA(t),A),s=this.aw.$t().dd(e,n,i),o=new Q0(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,i)=>i.J(A.$e,A.rw))),t.Wu()}Bw(e){return Dt(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((i,n)=>{const s=n.Qh(),o=Zs(s)(i);if(s!=="Custom")IA(s0(o));else{const a=n.Ta();IA(!a||a(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 S0(r,e,t){let A;if(Dr(r)){const n=document.getElementById(r);IA(n!==null,`Cannot find element in DOM with id=${r}`),A=n}else A=r;const i=new E0(A,e,t);return e.setOptions(i.options()),i}function H0(r,e){return S0(r,new zl,zl.Id(e))}Object.assign(Object.assign({},Va),Pa);function oc(r,e){return function(){return r.apply(e,arguments)}}const{toString:L0}=Object.prototype,{getPrototypeOf:qs}=Object,{iterator:Ri,toStringTag:ac}=Symbol,$i=(r=>e=>{const t=L0.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),cA=r=>(r=r.toLowerCase(),e=>$i(e)===r),Xi=r=>e=>typeof e===r,{isArray:wr}=Array,Br=Xi("undefined");function Rr(r){return r!==null&&!Br(r)&&r.constructor!==null&&!Br(r.constructor)&&Pt(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const lc=cA("ArrayBuffer");function M0(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&lc(r.buffer),e}const I0=Xi("string"),Pt=Xi("function"),cc=Xi("number"),$r=r=>r!==null&&typeof r=="object",_0=r=>r===!0||r===!1,Zi=r=>{if($i(r)!=="object")return!1;const e=qs(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ac in r)&&!(Ri in r)},D0=r=>{if(!$r(r)||Rr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},k0=cA("Date"),O0=cA("File"),N0=cA("Blob"),K0=cA("FileList"),P0=r=>$r(r)&&Pt(r.pipe),V0=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Pt(r.append)&&((e=$i(r))==="formdata"||e==="object"&&Pt(r.toString)&&r.toString()==="[object FormData]"))},z0=cA("URLSearchParams"),[W0,G0,R0,$0]=["ReadableStream","Request","Response","Headers"].map(cA),X0=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Xr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let A,i;if(typeof r!="object"&&(r=[r]),wr(r))for(A=0,i=r.length;A<i;A++)e.call(null,r[A],A,r);else{if(Rr(r))return;const n=t?Object.getOwnPropertyNames(r):Object.keys(r),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,r[o],o,r)}}function hc(r,e){if(Rr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let A=t.length,i;for(;A-- >0;)if(i=t[A],e===i.toLowerCase())return i;return null}const Ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,uc=r=>!Br(r)&&r!==Ar;function Ys(){const{caseless:r,skipUndefined:e}=uc(this)&&this||{},t={},A=(i,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=r&&hc(t,n)||n;Zi(t[s])&&Zi(i)?t[s]=Ys(t[s],i):Zi(i)?t[s]=Ys({},i):wr(i)?t[s]=i.slice():(!e||!Br(i))&&(t[s]=i)};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Xr(arguments[i],A);return t}const Z0=(r,e,t,{allOwnKeys:A}={})=>(Xr(e,(i,n)=>{t&&Pt(i)?Object.defineProperty(r,n,{value:oc(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,n,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),r),J0=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),q0=(r,e,t,A)=>{r.prototype=Object.create(e.prototype,A),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Y0=(r,e,t,A)=>{let i,n,s;const o={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),n=i.length;n-- >0;)s=i[n],(!A||A(s,r,e))&&!o[s]&&(e[s]=r[s],o[s]=!0);r=t!==!1&&qs(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},j0=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const A=r.indexOf(e,t);return A!==-1&&A===t},e1=r=>{if(!r)return null;if(wr(r))return r;let e=r.length;if(!cc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},t1=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&qs(Uint8Array)),A1=(r,e)=>{const A=(r&&r[Ri]).call(r);let i;for(;(i=A.next())&&!i.done;){const n=i.value;e.call(r,n[0],n[1])}},r1=(r,e)=>{let t;const A=[];for(;(t=r.exec(e))!==null;)A.push(t);return A},i1=cA("HTMLFormElement"),n1=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,i){return A.toUpperCase()+i}),dc=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),s1=cA("RegExp"),pc=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),A={};Xr(t,(i,n)=>{let s;(s=e(i,n,r))!==!1&&(A[n]=s||i)}),Object.defineProperties(r,A)},o1=r=>{pc(r,(e,t)=>{if(Pt(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=r[t];if(Pt(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+"'")})}})},a1=(r,e)=>{const t={},A=i=>{i.forEach(n=>{t[n]=!0})};return wr(r)?A(r):A(String(r).split(e)),t},l1=()=>{},c1=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function h1(r){return!!(r&&Pt(r.append)&&r[ac]==="FormData"&&r[Ri])}const u1=r=>{const e=new Array(10),t=(A,i)=>{if($r(A)){if(e.indexOf(A)>=0)return;if(Rr(A))return A;if(!("toJSON"in A)){e[i]=A;const n=wr(A)?[]:{};return Xr(A,(s,o)=>{const a=t(s,i+1);!Br(a)&&(n[o]=a)}),e[i]=void 0,n}}return A};return t(r,0)},d1=cA("AsyncFunction"),p1=r=>r&&($r(r)||Pt(r))&&Pt(r.then)&&Pt(r.catch),fc=((r,e)=>r?setImmediate:e?((t,A)=>(Ar.addEventListener("message",({source:i,data:n})=>{i===Ar&&n===t&&A.length&&A.shift()()},!1),i=>{A.push(i),Ar.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Pt(Ar.postMessage)),f1=typeof queueMicrotask<"u"?queueMicrotask.bind(Ar):typeof process<"u"&&process.nextTick||fc,re={isArray:wr,isArrayBuffer:lc,isBuffer:Rr,isFormData:V0,isArrayBufferView:M0,isString:I0,isNumber:cc,isBoolean:_0,isObject:$r,isPlainObject:Zi,isEmptyObject:D0,isReadableStream:W0,isRequest:G0,isResponse:R0,isHeaders:$0,isUndefined:Br,isDate:k0,isFile:O0,isBlob:N0,isRegExp:s1,isFunction:Pt,isStream:P0,isURLSearchParams:z0,isTypedArray:t1,isFileList:K0,forEach:Xr,merge:Ys,extend:Z0,trim:X0,stripBOM:J0,inherits:q0,toFlatObject:Y0,kindOf:$i,kindOfTest:cA,endsWith:j0,toArray:e1,forEachEntry:A1,matchAll:r1,isHTMLForm:i1,hasOwnProperty:dc,hasOwnProp:dc,reduceDescriptors:pc,freezeMethods:o1,toObjectSet:a1,toCamelCase:n1,noop:l1,toFiniteNumber:c1,findKey:hc,global:Ar,isContextDefined:uc,isSpecCompliantForm:h1,toJSONObject:u1,isAsyncFn:d1,isThenable:p1,setImmediate:fc,asap:f1,isIterable:r=>r!=null&&Pt(r[Ri])};let Ve=class Gd extends Error{static from(e,t,A,i,n,s){const o=new Gd(e.message,t||e.code,A,i,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,i,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),i&&(this.request=i),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}};Ve.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ve.ERR_BAD_OPTION="ERR_BAD_OPTION",Ve.ECONNABORTED="ECONNABORTED",Ve.ETIMEDOUT="ETIMEDOUT",Ve.ERR_NETWORK="ERR_NETWORK",Ve.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ve.ERR_DEPRECATED="ERR_DEPRECATED",Ve.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ve.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ve.ERR_CANCELED="ERR_CANCELED",Ve.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ve.ERR_INVALID_URL="ERR_INVALID_URL";const m1=null;function js(r){return re.isPlainObject(r)||re.isArray(r)}function mc(r){return re.endsWith(r,"[]")?r.slice(0,-2):r}function gc(r,e,t){return r?r.concat(e).map(function(i,n){return i=mc(i),!t&&n?"["+i+"]":i}).join(t?".":""):e}function g1(r){return re.isArray(r)&&!r.some(js)}const w1=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function Ji(r,e,t){if(!re.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=re.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(B,y){return!re.isUndefined(y[B])});const A=t.metaTokens,i=t.visitor||h,n=t.dots,s=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(re.isDate(v))return v.toISOString();if(re.isBoolean(v))return v.toString();if(!a&&re.isBlob(v))throw new Ve("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(v)||re.isTypedArray(v)?a&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function h(v,B,y){let D=v;if(v&&!y&&typeof v=="object"){if(re.endsWith(B,"{}"))B=A?B:B.slice(0,-2),v=JSON.stringify(v);else if(re.isArray(v)&&g1(v)||(re.isFileList(v)||re.endsWith(B,"[]"))&&(D=re.toArray(v)))return B=mc(B),D.forEach(function(N,S){!(re.isUndefined(N)||N===null)&&e.append(s===!0?gc([B],S,n):s===null?B:B+"[]",c(N))}),!1}return js(v)?!0:(e.append(gc(y,B,n),c(v)),!1)}const d=[],m=Object.assign(w1,{defaultVisitor:h,convertValue:c,isVisitable:js});function x(v,B){if(!re.isUndefined(v)){if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+B.join("."));d.push(v),re.forEach(v,function(D,E){(!(re.isUndefined(D)||D===null)&&i.call(e,D,re.isString(E)?E.trim():E,B,m))===!0&&x(D,B?B.concat(E):[E])}),d.pop()}}if(!re.isObject(r))throw new TypeError("data must be an object");return x(r),e}function wc(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function eo(r,e){this._pairs=[],r&&Ji(r,this,e)}const Bc=eo.prototype;Bc.append=function(e,t){this._pairs.push([e,t])},Bc.toString=function(e){const t=e?function(A){return e.call(this,A,wc)}:wc;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function B1(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Cc(r,e,t){if(!e)return r;const A=t&&t.encode||B1,i=re.isFunction(t)?{serialize:t}:t,n=i&&i.serialize;let s;if(n?s=n(e,i):s=re.isURLSearchParams(e)?e.toString():new eo(e,i).toString(A),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class vc{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){re.forEach(this.handlers,function(A){A!==null&&e(A)})}}const to={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},C1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:eo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Ao=typeof window<"u"&&typeof document<"u",ro=typeof navigator=="object"&&navigator||void 0,v1=Ao&&(!ro||["ReactNative","NativeScript","NS"].indexOf(ro.product)<0),y1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",b1=Ao&&window.location.href||"http://localhost",Lt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ao,hasStandardBrowserEnv:v1,hasStandardBrowserWebWorkerEnv:y1,navigator:ro,origin:b1},Symbol.toStringTag,{value:"Module"})),...C1};function T1(r,e){return Ji(r,new Lt.classes.URLSearchParams,{visitor:function(t,A,i,n){return Lt.isNode&&re.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function x1(r){return re.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Q1(r){const e={},t=Object.keys(r);let A;const i=t.length;let n;for(A=0;A<i;A++)n=t[A],e[n]=r[n];return e}function yc(r){function e(t,A,i,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),a=n>=t.length;return s=!s&&re.isArray(i)?i.length:s,a?(re.hasOwnProp(i,s)?i[s]=[i[s],A]:i[s]=A,!o):((!i[s]||!re.isObject(i[s]))&&(i[s]=[]),e(t,A,i[s],n)&&re.isArray(i[s])&&(i[s]=Q1(i[s])),!o)}if(re.isFormData(r)&&re.isFunction(r.entries)){const t={};return re.forEachEntry(r,(A,i)=>{e(x1(A),i,t,0)}),t}return null}function F1(r,e,t){if(re.isString(r))try{return(e||JSON.parse)(r),re.trim(r)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(r)}const Zr={transitional:to,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",i=A.indexOf("application/json")>-1,n=re.isObject(e);if(n&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(yc(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.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 T1(e,this.formSerializer).toString();if((o=re.isFileList(e))||A.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Ji(o?{"files[]":e}:e,a&&new a,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),F1(e)):e}],transformResponse:[function(e){const t=this.transitional||Zr.transitional,A=t&&t.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(A&&!this.responseType||i)){const s=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ve.from(o,Ve.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:Lt.classes.FormData,Blob:Lt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],r=>{Zr.headers[r]={}});const U1=re.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"]),E1=r=>{const e={};let t,A,i;return r&&r.split(`
|
|
2
|
-
`).forEach(function(s){i=s.indexOf(":"),t=s.substring(0,i).trim().toLowerCase(),A=s.substring(i+1).trim(),!(!t||e[t]&&U1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},bc=Symbol("internals");function Jr(r){return r&&String(r).trim().toLowerCase()}function qi(r){return r===!1||r==null?r:re.isArray(r)?r.map(qi):String(r)}function S1(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(r);)e[A[1]]=A[2];return e}const H1=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function
|
|
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(i=>A.set(i)),A}static accessor(e){const A=(this[bc]=this[bc]={accessors:{}}).accessors,i=this.prototype;function n(s){const o=Jr(s);A[o]||(M1(i,s),A[o]=!0)}return re.isArray(e)?e.forEach(n):n(e),this}};Vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(Vt.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(A){this[t]=A}}}),re.freezeMethods(Vt);function no(r,e){const t=this||Zr,A=e||t,i=Vt.from(A.headers);let n=A.data;return re.forEach(r,function(o){n=o.call(t,n,i.normalize(),e?e.status:void 0)}),i.normalize(),n}function Tc(r){return!!(r&&r.__CANCEL__)}let qr=class extends Ve{constructor(e,t,A){super(e??"canceled",Ve.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function xc(r,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?r(t):e(new Ve("Request failed with status code "+t.status,[Ve.ERR_BAD_REQUEST,Ve.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function I1(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function _1(r,e){r=r||10;const t=new Array(r),A=new Array(r);let i=0,n=0,s;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),h=A[n];s||(s=c),t[i]=a,A[i]=c;let d=n,m=0;for(;d!==i;)m+=t[d++],d=d%r;if(i=(i+1)%r,i===n&&(n=(n+1)%r),c-s<e)return;const x=h&&c-h;return x?Math.round(m*1e3/x):void 0}}function D1(r,e){let t=0,A=1e3/e,i,n;const s=(c,h=Date.now())=>{t=h,i=null,n&&(clearTimeout(n),n=null),r(...c)};return[(...c)=>{const h=Date.now(),d=h-t;d>=A?s(c,h):(i=c,n||(n=setTimeout(()=>{n=null,s(i)},A-d)))},()=>i&&s(i)]}const Yi=(r,e,t=3)=>{let A=0;const i=_1(50,250);return D1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-A,c=i(a),h=s<=o;A=s;const d={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(d)},t)},Qc=(r,e)=>{const t=r!=null;return[A=>e[0]({lengthComputable:t,total:r,loaded:A}),e[1]]},Fc=r=>(...e)=>re.asap(()=>r(...e)),k1=Lt.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Lt.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Lt.origin),Lt.navigator&&/(msie|trident)/i.test(Lt.navigator.userAgent)):()=>!0,O1=Lt.hasStandardBrowserEnv?{write(r,e,t,A,i,n,s){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];re.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),re.isString(A)&&o.push(`path=${A}`),re.isString(i)&&o.push(`domain=${i}`),n===!0&&o.push("secure"),re.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function N1(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function K1(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Uc(r,e,t){let A=!N1(e);return r&&(A||t==!1)?K1(r,e):e}const Ec=r=>r instanceof Vt?{...r}:r;function rr(r,e){e=e||{};const t={};function A(c,h,d,m){return re.isPlainObject(c)&&re.isPlainObject(h)?re.merge.call({caseless:m},c,h):re.isPlainObject(h)?re.merge({},h):re.isArray(h)?h.slice():h}function i(c,h,d,m){if(re.isUndefined(h)){if(!re.isUndefined(c))return A(void 0,c,d,m)}else return A(c,h,d,m)}function n(c,h){if(!re.isUndefined(h))return A(void 0,h)}function s(c,h){if(re.isUndefined(h)){if(!re.isUndefined(c))return A(void 0,c)}else return A(void 0,h)}function o(c,h,d){if(d in e)return A(c,h);if(d in r)return A(void 0,c)}const a={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,h,d)=>i(Ec(c),Ec(h),d,!0)};return re.forEach(Object.keys({...r,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const d=re.hasOwnProp(a,h)?a[h]:i,m=d(r[h],e[h],h);re.isUndefined(m)&&d!==o||(t[h]=m)}),t}const Sc=r=>{const e=rr({},r);let{data:t,withXSRFToken:A,xsrfHeaderName:i,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=Vt.from(s),e.url=Cc(Uc(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),re.isFormData(t)){if(Lt.hasStandardBrowserEnv||Lt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(re.isFunction(t.getHeaders)){const a=t.getHeaders(),c=["content-type","content-length"];Object.entries(a).forEach(([h,d])=>{c.includes(h.toLowerCase())&&s.set(h,d)})}}if(Lt.hasStandardBrowserEnv&&(A&&re.isFunction(A)&&(A=A(e)),A||A!==!1&&k1(e.url))){const a=i&&n&&O1.read(n);a&&s.set(i,a)}return e},P1=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,A){const i=Sc(r);let n=i.data;const s=Vt.from(i.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:c}=i,h,d,m,x,v;function B(){x&&x(),v&&v(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function D(){if(!y)return;const N=Vt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),W={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:N,config:r,request:y};xc(function(j){t(j),B()},function(j){A(j),B()},W),y=null}"onloadend"in y?y.onloadend=D:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(D)},y.onabort=function(){y&&(A(new Ve("Request aborted",Ve.ECONNABORTED,r,y)),y=null)},y.onerror=function(S){const W=S&&S.message?S.message:"Network Error",$=new Ve(W,Ve.ERR_NETWORK,r,y);$.event=S||null,A($),y=null},y.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const W=i.transitional||to;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),A(new Ve(S,W.clarifyTimeoutError?Ve.ETIMEDOUT:Ve.ECONNABORTED,r,y)),y=null},n===void 0&&s.setContentType(null),"setRequestHeader"in y&&re.forEach(s.toJSON(),function(S,W){y.setRequestHeader(W,S)}),re.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),o&&o!=="json"&&(y.responseType=i.responseType),c&&([m,v]=Yi(c,!0),y.addEventListener("progress",m)),a&&y.upload&&([d,x]=Yi(a),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",x)),(i.cancelToken||i.signal)&&(h=N=>{y&&(A(!N||N.type?new qr(null,r,y):N),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const E=I1(i.url);if(E&&Lt.protocols.indexOf(E)===-1){A(new Ve("Unsupported protocol "+E+":",Ve.ERR_BAD_REQUEST,r));return}y.send(n||null)})},V1=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let A=new AbortController,i;const n=function(c){if(!i){i=!0,o();const h=c instanceof Error?c:this.reason;A.abort(h instanceof Ve?h:new qr(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new Ve(`timeout of ${e}ms exceeded`,Ve.ETIMEDOUT))},e);const o=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),r=null)};r.forEach(c=>c.addEventListener("abort",n));const{signal:a}=A;return a.unsubscribe=()=>re.asap(o),a}},z1=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let A=0,i;for(;A<t;)i=A+e,yield r.slice(A,i),A=i},W1=async function*(r,e){for await(const t of G1(r))yield*z1(t,e)},G1=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},Hc=(r,e,t,A)=>{const i=W1(r,e);let n=0,s,o=a=>{s||(s=!0,A&&A(a))};return new ReadableStream({async pull(a){try{const{done:c,value:h}=await i.next();if(c){o(),a.close();return}let d=h.byteLength;if(t){let m=n+=d;t(m)}a.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(a){return o(a),i.return()}},{highWaterMark:2})},Lc=64*1024,{isFunction:ji}=re,R1=(({Request:r,Response:e})=>({Request:r,Response:e}))(re.global),{ReadableStream:Mc,TextEncoder:Ic}=re.global,_c=(r,...e)=>{try{return!!r(...e)}catch{return!1}},$1=r=>{r=re.merge.call({skipUndefined:!0},R1,r);const{fetch:e,Request:t,Response:A}=r,i=e?ji(e):typeof fetch=="function",n=ji(t),s=ji(A);if(!i)return!1;const o=i&&ji(Mc),a=i&&(typeof Ic=="function"?(v=>B=>v.encode(B))(new Ic):async v=>new Uint8Array(await new t(v).arrayBuffer())),c=n&&o&&_c(()=>{let v=!1;const B=new t(Lt.origin,{body:new Mc,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!B}),h=s&&o&&_c(()=>re.isReadableStream(new A("").body)),d={stream:h&&(v=>v.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!d[v]&&(d[v]=(B,y)=>{let D=B&&B[v];if(D)return D.call(B);throw new Ve(`Response type '${v}' is not supported`,Ve.ERR_NOT_SUPPORT,y)})});const m=async v=>{if(v==null)return 0;if(re.isBlob(v))return v.size;if(re.isSpecCompliantForm(v))return(await new t(Lt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(re.isArrayBufferView(v)||re.isArrayBuffer(v))return v.byteLength;if(re.isURLSearchParams(v)&&(v=v+""),re.isString(v))return(await a(v)).byteLength},x=async(v,B)=>{const y=re.toFiniteNumber(v.getContentLength());return y??m(B)};return async v=>{let{url:B,method:y,data:D,signal:E,cancelToken:N,timeout:S,onDownloadProgress:W,onUploadProgress:$,responseType:j,headers:V,withCredentials:X="same-origin",fetchOptions:ce}=Sc(v),ae=e||fetch;j=j?(j+"").toLowerCase():"text";let de=V1([E,N&&N.toAbortSignal()],S),J=null;const ie=de&&de.unsubscribe&&(()=>{de.unsubscribe()});let pe;try{if($&&c&&y!=="get"&&y!=="head"&&(pe=await x(V,D))!==0){let Fe=new t(B,{method:"POST",body:D,duplex:"half"}),we;if(re.isFormData(D)&&(we=Fe.headers.get("content-type"))&&V.setContentType(we),Fe.body){const[ye,De]=Qc(pe,Yi(Fc($)));D=Hc(Fe.body,Lc,ye,De)}}re.isString(X)||(X=X?"include":"omit");const Be=n&&"credentials"in t.prototype,Ue={...ce,signal:de,method:y.toUpperCase(),headers:V.normalize().toJSON(),body:D,duplex:"half",credentials:Be?X:void 0};J=n&&new t(B,Ue);let xe=await(n?ae(J,ce):ae(B,Ue));const Le=h&&(j==="stream"||j==="response");if(h&&(W||Le&&ie)){const Fe={};["status","statusText","headers"].forEach(et=>{Fe[et]=xe[et]});const we=re.toFiniteNumber(xe.headers.get("content-length")),[ye,De]=W&&Qc(we,Yi(Fc(W),!0))||[];xe=new A(Hc(xe.body,Lc,ye,()=>{De&&De(),ie&&ie()}),Fe)}j=j||"text";let Me=await d[re.findKey(d,j)||"text"](xe,v);return!Le&&ie&&ie(),await new Promise((Fe,we)=>{xc(Fe,we,{data:Me,headers:Vt.from(xe.headers),status:xe.status,statusText:xe.statusText,config:v,request:J})})}catch(Be){throw ie&&ie(),Be&&Be.name==="TypeError"&&/Load failed|fetch/i.test(Be.message)?Object.assign(new Ve("Network Error",Ve.ERR_NETWORK,v,J,Be&&Be.response),{cause:Be.cause||Be}):Ve.from(Be,Be&&Be.code,v,J,Be&&Be.response)}}},X1=new Map,Dc=r=>{let e=r&&r.env||{};const{fetch:t,Request:A,Response:i}=e,n=[A,i,t];let s=n.length,o=s,a,c,h=X1;for(;o--;)a=n[o],c=h.get(a),c===void 0&&h.set(a,c=o?new Map:$1(e)),h=c;return c};Dc();const so={http:m1,xhr:P1,fetch:{get:Dc}};re.forEach(so,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const kc=r=>`- ${r}`,Z1=r=>re.isFunction(r)||r===null||r===!1;function J1(r,e){r=re.isArray(r)?r:[r];const{length:t}=r;let A,i;const n={};for(let s=0;s<t;s++){A=r[s];let o;if(i=A,!Z1(A)&&(i=so[(o=String(A)).toLowerCase()],i===void 0))throw new Ve(`Unknown adapter '${o}'`);if(i&&(re.isFunction(i)||(i=i.get(e))))break;n[o||"#"+s]=i}if(!i){const s=Object.entries(n).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
1
|
+
(function(ze,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],l):(ze=typeof globalThis<"u"?globalThis:ze||self,l(ze.ChartSDK={},ze.jsxRuntime,ze.React))})(this,(function(ze,l,Y){"use strict";var us=typeof document<"u"?document.currentScript:null;const St="17:00-17:00",Ht="America/New_York",pA="24x7",fA="UTC",La={EURUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},GBPUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDCHF:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},AUDUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},USDCAD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},NZDUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURGBP:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},GBPJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},CADJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},EURJPY:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},XAUUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},XAGUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},OILUSD:{type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"},BTCUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},ETHUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},BNBUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},SOLUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},ADAUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},XRPUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},DOGEUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},DOTUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},MATICUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"},LINKUSDT:{type:"crypto",session:pA,sessionTZ:fA,priceMode:"last"}},Ma={type:"forex",sessionTZ:Ht,session:St,priceMode:"mid"};function Mr(r){return r&&La[r.toUpperCase()]||Ma}function $d(r){return Mr(r).type==="forex"}function Xd(r){return Mr(r).type==="crypto"}function Zd(r){return Mr(r).session==="24x7"}function q(r){if(r==null)return null;if(typeof r=="number"){if(Number.isNaN(r)||!Number.isFinite(r))return null;let e;r>1e10?e=r/1e3:(r<1e9,e=r);const t=Math.floor(e);return t<946684800||t>4102444800?null:t}if(typeof r=="string"){const e=Date.parse(r);return Number.isNaN(e)?null:Math.floor(e/1e3)}if(typeof r=="object"&&"year"in r&&"month"in r&&"day"in r){const t=new Date(Date.UTC(r.year,r.month-1,r.day)).getTime();return Number.isNaN(t)?null:Math.floor(t/1e3)}return null}function Jd(r,e){if(!r||r.length<2)return[];const t=[],A=2;for(let i=1;i<r.length;i++){const n=r[i-1].time,s=r[i].time,o=s-n;o>e*A&&t.push({from:n,to:s,gapSeconds:o,gapHours:(o/3600).toFixed(1),fromDate:new Date(n*1e3).toISOString(),toDate:new Date(s*1e3).toISOString()})}return t}function qd(r,e="America/New_York"){const t=new Date(r*1e3),A=new Date(t.toLocaleString("en-US",{timeZone:e})),i=A.getDay();return!(i===0||i===6||i===5&&A.getHours()>=17)}function Ia(r){return Array.isArray(r)?r.map(e=>({...e,time:q(e.time)})).filter(e=>e.time!=null):[]}function Yd(r){if(!r||r.length<2)return!0;for(let e=1;e<r.length;e++)if(r[e].time<=r[e-1].time)return!1;return!0}function $e(r,e){return!Number.isFinite(r)||!Number.isFinite(e)||e<=0?r:Math.floor(r/e)*e}function _a(r){if(!r||typeof r!="object")return!1;const{time:e,open:t,high:A,low:i,close:n,volume:s}=r;return!(q(e)==null||typeof t!="number"||!Number.isFinite(t)||typeof A!="number"||!Number.isFinite(A)||typeof i!="number"||!Number.isFinite(i)||typeof n!="number"||!Number.isFinite(n)||s!=null&&(typeof s!="number"||s<0||!Number.isFinite(s))||A<t||A<n||A<i||i>t||i>n||i>A||t<=0||A<=0||i<=0||n<=0)}function Da(r){const e=s=>Math.round(s*1e5)/1e5;let t=e(r.open),A=e(r.high),i=e(r.low),n=e(r.close);return A=Math.max(A,t,n,i),i=Math.min(i,t,n,A),{...r,open:t,high:A,low:i,close:n,volume:r.volume!=null?Math.round(r.volume):r.volume}}function ka(r){if(!Array.isArray(r)||r.length===0)return[];const e=new Map;return r.forEach(t=>{const A=q(t.time);if(A!=null)if(e.has(A)){const i=e.get(A);e.set(A,{...t,time:A,open:t.open,high:Math.max(i.high,t.high),low:Math.min(i.low,t.low),close:t.close,volume:(i.volume||0)+(t.volume||0)})}else e.set(A,{...t,time:A})}),Array.from(e.values())}function jd(r,e="percentile"){if(!Array.isArray(r)||r.length<3)return r;const t=r.map(s=>s.close).filter(s=>Number.isFinite(s));if(t.length<3)return r;const A=[...t].sort((s,o)=>s-o);let i,n;if(e==="percentile"){const s=Math.floor(A.length*.25),o=Math.floor(A.length*.75),a=A[s],c=A[o],h=c-a;i=a-1.5*h,n=c+1.5*h}else{const s=t.reduce((c,h)=>c+h,0)/t.length,o=t.reduce((c,h)=>c+Math.pow(h-s,2),0)/t.length,a=Math.sqrt(o);if(a===0)return r;i=s-3*a,n=s+3*a}return r.map((s,o)=>{const a=s.close;if(a<i||a>n){if(o===0)return s;const c=r[o-1].close;return{...s,open:c,high:Math.max(c,s.high),low:Math.min(c,s.low),close:c}}return s})}function ep(r,e){if(!Array.isArray(r)||r.length===0)return r;const t=[],A=Math.max(e*10080,604800),i=1e4;for(let o=0;o<r.length;o++)if(t.push(r[o]),o<r.length-1){const a=r[o].time,c=r[o+1].time,h=c-a;if(h>A&&((h/3600).toFixed(1),(A/3600).toFixed(1)),h>e&&h<=A){const d=r[o];let m=a+e,T=0;for(m=$e(m,e);m<c&&T<i;){const v=$e(m,e);t.some(y=>y.time===v)||(t.push({time:v,open:d.close,high:d.close,low:d.close,close:d.close,volume:0}),T++),m+=e}if(m<c&&T>=i){const v=$e(c-e,e);t.some(y=>y.time===v)||t.push({time:v,open:d.close,high:d.close,low:d.close,close:d.close,volume:0})}}}t.sort((o,a)=>o.time-a.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 eA(r){if(!r||typeof r!="string")return 60;const e=r.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=r.match(/^(\d+)([mhdwy])$/i),t){const A=parseInt(t[1],10),i=t[2].toLowerCase();return A*({m:60,h:3600,d:86400,w:604800,y:31536e3}[i]||60)}return 60}function Oa(r,e,t){if(!Array.isArray(r)||r.length===0)return{candles:[],stats:{original:0,processed:0,duplicates:0,outliers:0,gaps:[]}};const A=Mr(e),i=eA(t),o=Ia(r).map(y=>({...y,time:$e(y.time,i)})).filter(y=>_a(y)).map(y=>Da(y)),a=ka(o);a.sort((y,D)=>y.time-D.time);const c=a.filter((y,D)=>D===0?!0:y.time>a[D-1].time),h=c.length>10?jd(c,"percentile"):c,d=ka(h);d.sort((y,D)=>y.time-D.time);const m=ep(d,i),T=[];for(let y=1;y<m.length;y++){const D=m[y].time-m[y-1].time;D>i*2&&T.push({from:m[y-1].time,to:m[y].time,gapSeconds:D,gapMinutes:Math.round(D/60),fromDate:new Date(m[y-1].time*1e3).toISOString(),toDate:new Date(m[y].time*1e3).toISOString()})}const v=h.filter((y,D)=>D===0?!1:y.close===h[D-1].close&&y.open===h[D-1].close).length,B={original:r.length,processed:m.length,duplicates:r.length-a.length,outliers:v,gaps:T,filledGaps:m.length-d.length,symbolConfig:A};return{candles:m,stats:B}}function Na(r,e,t="1m"){if(!r||!e||!_a(r))return null;const A=q(r.time);if(A==null)return null;const i=eA(t),n=$e(A,i);return Da({...r,time:n})}function ot(r){var e=r.width,t=r.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 JA(r,e){return r.width===e.width&&r.height===e.height}var tp=(function(){function r(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return r.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(r.prototype,"value",{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),r.prototype.subscribe=function(e){var t=this,A={next:e};return this._observers.push(A),{unsubscribe:function(){t._observers=t._observers.filter(function(i){return i!==A})}}},r.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw new Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},r.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},r.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},r.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},r})();function Ap(r){return new tp(r)}var rp=(function(){function r(e,t,A){var i;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=ot({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(n){return n}),this._allowResizeObserver=(i=A?.allowResizeObserver)!==null&&i!==void 0?i:!0,this._chooseAndInitObserver()}return r.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(r.prototype,"canvasElement",{get:function(){if(this._canvasElement===null)throw new Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bitmapSize",{get:function(){return ot({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),r.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=ot(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},r.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(r.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),r.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},r.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},r.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},r.prototype._resizeBitmap=function(e){var t=this.bitmapSize;JA(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},r.prototype._emitBitmapSizeChanged=function(e,t){var A=this;this._bitmapSizeChangedListeners.forEach(function(i){return i.call(A,e,t)})},r.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,A=ot(this._transformBitmapSize(e,this._canvasElementClientSize)),i=JA(this.bitmapSize,A)?null:A;t===null&&i===null||t!==null&&i!==null&&JA(t,i)||(this._suggestedBitmapSize=i,this._emitSuggestedBitmapSizeChanged(t,i))},r.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var A=this;this._suggestedBitmapSizeChangedListeners.forEach(function(i){return i.call(A,e,t)})},r.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}np().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},r.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=Ka(this._canvasElement);if(t===null)throw new Error("No window is associated with the canvas");this._devicePixelRatioObservable=Ap(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},r.prototype._invalidateBitmapSize=function(){var e,t;if(this._canvasElement!==null){var A=Ka(this._canvasElement);if(A!==null){var i=(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?sp(n[0],i):ot({width:this._canvasElementClientSize.width*i,height:this._canvasElementClientSize.height*i});this._suggestNewBitmapSize(s)}}},r.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var A=t.find(function(s){return s.target===e._canvasElement});if(!(!A||!A.devicePixelContentBoxSize||!A.devicePixelContentBoxSize[0])){var i=A.devicePixelContentBoxSize[0],n=ot({width:i.inlineSize,height:i.blockSize});e._suggestNewBitmapSize(n)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},r})();function ip(r,e){return new rp(r,e.transform,e.options)}function Ka(r){return r.ownerDocument.defaultView}function np(){return new Promise(function(r){var e=new ResizeObserver(function(t){r(t.every(function(A){return"devicePixelContentBoxSize"in A})),e.disconnect()});e.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1})}function sp(r,e){return ot({width:Math.round(r.left*e+r.width*e)-Math.round(r.left*e),height:Math.round(r.top*e+r.height*e)-Math.round(r.top*e)})}var op=(function(){function r(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 r.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},r.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(r.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),r})();function qA(r,e){var t=r.canvasElementClientSize;if(t.width===0||t.height===0)return null;var A=r.bitmapSize;if(A.width===0||A.height===0)return null;var i=r.canvasElement.getContext("2d",e);return i===null?null:new op(i,t,A)}const ap={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},lp={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},cp={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},hp={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",invertFilledArea:!1,lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},up={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:"",lastPriceAnimation:0,pointMarkersVisible:!1},dp={color:"#26a69a",base:0},Pa={color:"#2196f3"},Va={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 za,Wa;function YA(r,e){const t={0:[],1:[r.lineWidth,r.lineWidth],2:[2*r.lineWidth,2*r.lineWidth],3:[6*r.lineWidth,6*r.lineWidth],4:[r.lineWidth,4*r.lineWidth]}[e];r.setLineDash(t)}function Ga(r,e,t,A){r.beginPath();const i=r.lineWidth%2?.5:0;r.moveTo(t,e+i),r.lineTo(A,e+i),r.stroke()}function _A(r,e){if(!r)throw new Error("Assertion failed"+(e?": "+e:""))}function _t(r){if(r===void 0)throw new Error("Value is undefined");return r}function me(r){if(r===null)throw new Error("Value is null");return r}function hr(r){return me(_t(r))}(function(r){r[r.Simple=0]="Simple",r[r.WithSteps=1]="WithSteps",r[r.Curved=2]="Curved"})(za||(za={})),(function(r){r[r.Solid=0]="Solid",r[r.Dotted=1]="Dotted",r[r.Dashed=2]="Dashed",r[r.LargeDashed=3]="LargeDashed",r[r.SparseDotted=4]="SparseDotted"})(Wa||(Wa={}));const Ra={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 tA(r){return r<0?0:r>255?255:Math.round(r)||0}function $a(r){return r<=0||r>1?Math.min(Math.max(r,0),1):Math.round(1e4*r)/1e4}const pp=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,fp=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,mp=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,gp=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d*\.?\d+)\s*\)$/;function Ir(r){(r=r.toLowerCase())in Ra&&(r=Ra[r]);{const e=gp.exec(r)||mp.exec(r);if(e)return[tA(parseInt(e[1],10)),tA(parseInt(e[2],10)),tA(parseInt(e[3],10)),$a(e.length<5?1:parseFloat(e[4]))]}{const e=fp.exec(r);if(e)return[tA(parseInt(e[1],16)),tA(parseInt(e[2],16)),tA(parseInt(e[3],16)),1]}{const e=pp.exec(r);if(e)return[tA(17*parseInt(e[1],16)),tA(17*parseInt(e[2],16)),tA(17*parseInt(e[3],16)),1]}throw new Error(`Cannot parse color: ${r}`)}function Xa(r){return .199*r[0]+.687*r[1]+.114*r[2]}function Fi(r){const e=Ir(r);return{t:`rgb(${e[0]}, ${e[1]}, ${e[2]})`,i:Xa(e)>160?"black":"white"}}class pt{constructor(){this.h=[]}l(e,t,A){const i={o:e,_:t,u:A===!0};this.h.push(i)}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 i=[...this.h];this.h=this.h.filter((n=>!n.u)),i.forEach((n=>n.o(e,t,A)))}M(){return this.h.length>0}S(){this.h=[]}}function aA(r,...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"||r[A]===void 0||Array.isArray(t[A])?r[A]=t[A]:aA(r[A],t[A]));return r}function mA(r){return typeof r=="number"&&isFinite(r)}function _r(r){return typeof r=="number"&&r%1==0}function Dr(r){return typeof r=="string"}function Ui(r){return typeof r=="boolean"}function FA(r){const e=r;if(!e||typeof e!="object")return e;let t,A,i;for(A in t=Array.isArray(e)?[]:{},e)e.hasOwnProperty(A)&&(i=e[A],t[A]=i&&typeof i=="object"?FA(i):i);return t}function wp(r){return r!==null}function kr(r){return r===null?void 0:r}const ds="-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif";function ur(r,e,t){return e===void 0&&(e=ds),`${t=t!==void 0?`${t} `:""}${r}px ${e}`}class Bp{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=ur(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 ps{constructor(){this.Y=[]}Z(e){this.Y=e}X(e,t,A){this.Y.forEach((i=>{i.X(e,t,A)}))}}class lA{X(e,t,A){e.useBitmapCoordinateSpace((i=>this.K(i,t,A)))}}class Cp extends lA{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 i=this.G.tt,n=this.G,s=Math.max(1,Math.floor(t))%2/2,o=a=>{e.beginPath();for(let c=i.to-1;c>=i.from;--c){const h=n.it[c],d=Math.round(h.nt*t)+s,m=h.st*A,T=a*A+s;e.moveTo(d,m),e.arc(d,m,T,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 vp(){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 bp{constructor(e,t){this.ut=new ps,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(vp),this.ct=this.dt.map((A=>{const i=new Cp;return i.J(A),i})),this.ut.Z(this.ct)),this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.ut}Mt(){const e=this.vt.W().mode===2,t=this.F.wt(),A=this.vt.xt(),i=this.F.St();t.forEach(((n,s)=>{var o;const a=this.dt[s],c=n.kt(A);if(e||c===null||!n.yt())return void(a.tt=null);const h=me(n.Ct());a.lt=c.Tt,a.ht=c.ht,a.et=c.Pt,a.it[0]._t=c._t,a.it[0].st=n.Dt().Rt(c._t,h.Vt),a.rt=(o=c.Ot)!==null&&o!==void 0?o:this.F.Bt(a.it[0].st/n.Dt().At()),a.it[0].ot=A,a.it[0].nt=i.It(A),a.tt=yp}))}}let Tp=class extends lA{constructor(e){super(),this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){if(this.zt===null)return;const n=this.zt.Lt.yt,s=this.zt.Et.yt;if(!n&&!s)return;const o=Math.round(this.zt.nt*A),a=Math.round(this.zt.st*i);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,YA(e,this.zt.Lt.Nt),(function(c,h,d,m){c.beginPath();const T=c.lineWidth%2?.5:0;c.moveTo(h+T,d),c.lineTo(h+T,m),c.stroke()})(e,o,0,t.height)),s&&a>=0&&(e.lineWidth=Math.floor(this.zt.Et.et*i),e.strokeStyle=this.zt.Et.V,e.fillStyle=this.zt.Et.V,YA(e,this.zt.Et.Nt),Ga(e,a,0,t.width))}};class xp{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 Tp(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=me(this.jt.Ht()),A=t.$t().W().crosshair,i=this.Ft;if(A.mode===2)return i.Et.yt=!1,void(i.Lt.yt=!1);i.Et.yt=e&&this.jt.Ut(t),i.Lt.yt=e&&this.jt.qt(),i.Et.et=A.horzLine.width,i.Et.Nt=A.horzLine.style,i.Et.V=A.horzLine.color,i.Lt.et=A.vertLine.width,i.Lt.Nt=A.vertLine.style,i.Lt.V=A.vertLine.color,i.nt=this.jt.Yt(),i.st=this.jt.Zt()}}function Qp(r,e,t,A,i,n){r.fillRect(e+n,t,A-2*n,n),r.fillRect(e+n,t+i-n,A-2*n,n),r.fillRect(e,t,n,i),r.fillRect(e+A-n,t,n,i)}function Ei(r,e,t,A,i,n){r.save(),r.globalCompositeOperation="copy",r.fillStyle=n,r.fillRect(e,t,A,i),r.restore()}function Za(r,e,t,A,i,n){r.beginPath(),r.roundRect?r.roundRect(e,t,A,i,n):(r.lineTo(e+A-n[1],t),n[1]!==0&&r.arcTo(e+A,t,e+A,t+n[1],n[1]),r.lineTo(e+A,t+i-n[2]),n[2]!==0&&r.arcTo(e+A,t+i,e+A-n[2],t+i,n[2]),r.lineTo(e+n[3],t+i),n[3]!==0&&r.arcTo(e,t+i,e,t+i-n[3],n[3]),r.lineTo(e,t+n[0]),n[0]!==0&&r.arcTo(e,t,e+n[0],t,n[0]))}function Ja(r,e,t,A,i,n,s=0,o=[0,0,0,0],a=""){if(r.save(),!s||!a||a===n)return Za(r,e,t,A,i,o),r.fillStyle=n,r.fill(),void r.restore();const c=s/2;var h;Za(r,e+c,t+c,A-s,i-s,(h=-c,o.map((d=>d===0?d:d+h)))),n!=="transparent"&&(r.fillStyle=n,r.fill()),a!=="transparent"&&(r.lineWidth=s,r.strokeStyle=a,r.closePath(),r.stroke()),r.restore()}function qa(r,e,t,A,i,n,s){r.save(),r.globalCompositeOperation="copy";const o=r.createLinearGradient(0,0,0,i);o.addColorStop(0,n),o.addColorStop(1,s),r.fillStyle=o,r.fillRect(e,t,A,i),r.restore()}class Ya{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,i){if(!this.zt.yt||this.zt.Kt.length===0)return;const n=this.zt.V,s=this.Xt.t,o=e.useBitmapCoordinateSpace((a=>{const c=a.context;c.font=t.R;const h=this.Gt(a,t,A,i),d=h.Jt;return h.Qt?Ja(c,d.ti,d.ii,d.ni,d.si,s,d.ei,[d.ht,0,0,d.ht],s):Ja(c,d.ri,d.ii,d.ni,d.si,s,d.ei,[0,d.ht,d.ht,0],s),this.zt.hi&&(c.fillStyle=n,c.fillRect(d.ri,d.li,d.ai-d.ri,d.oi)),this.zt._i&&(c.fillStyle=t.O,c.fillRect(h.Qt?d.ui-d.ei:0,d.ii,d.ei,d.ci-d.ii)),h}));e.useMediaCoordinateSpace((({context:a})=>{const c=o.di;a.font=t.R,a.textAlign=o.Qt?"right":"left",a.textBaseline="middle",a.fillStyle=n,a.fillText(this.zt.Kt,c.fi,(c.ii+c.ci)/2+c.pi)}))}Gt(e,t,A,i){var n;const{context:s,bitmapSize:o,mediaSize:a,horizontalPixelRatio:c,verticalPixelRatio:h}=e,d=this.zt.hi||!this.zt.mi?t.T:0,m=this.zt.bi?t.C:0,T=t.L+this.Xt.wi,v=t.B+this.Xt.gi,B=t.A,y=t.I,D=this.zt.Kt,E=t.P,N=A.Mi(s,D),S=Math.ceil(A.xi(s,D)),W=E+T+v,$=t.C+B+y+S+d,j=Math.max(1,Math.floor(h));let V=Math.round(W*h);V%2!=j%2&&(V+=1);const X=m>0?Math.max(1,Math.floor(m*c)):0,ce=Math.round($*c),ae=Math.round(d*c),de=(n=this.Xt.Si)!==null&&n!==void 0?n:this.Xt.ki,J=Math.round(de*h)-Math.floor(.5*h),ie=Math.floor(J+j/2-V/2),pe=ie+V,Ce=i==="right",Ue=Ce?a.width-m:m,xe=Ce?o.width-X:X;let He,Le,Fe;return Ce?(He=xe-ce,Le=xe-ae,Fe=Ue-d-B-m):(He=xe+ce,Le=xe+ae,Fe=Ue+d+B),{Qt:Ce,Jt:{ii:ie,li:J,ci:pe,ni:ce,si:V,ht:2*c,ei:X,ti:He,ri:xe,ai:Le,oi:j,ui:o.width},di:{ii:ie/h,ci:pe/h,fi:Fe,pi:N}}}}class Si{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||Ya)(this.Ci,this.yi),this.Ri=new(e||Ya)(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 Fp extends Si{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 i=this.jt.W().horzLine;if(!i.labelVisible)return;const n=this.Li.Ct();if(!this.jt.yt()||this.Li.Ni()||n===null)return;const s=Fi(i.labelBackgroundColor);A.t=s.t,e.V=s.i;const o=2/12*this.Li.P();A.wi=o,A.gi=o;const a=this.Ei(this.Li);A.ki=a.ki,e.Kt=this.Li.Fi(a._t,n),e.yt=!0}}const Up=/[1-9]/g;class ja{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:m})=>(m.font=t.R,Math.round(t.Wi.xi(m,me(this.zt).Kt,Up)))));if(A<=0)return;const i=t.ji,n=A+2*i,s=n/2,o=this.zt.Hi;let a=this.zt.ki,c=Math.floor(a-s)+.5;c<0?(a+=Math.abs(0-c),c=Math.floor(a-s)+.5):c+n>o&&(a-=Math.abs(o-(c+n)),c=Math.floor(a-s)+.5);const h=c+n,d=Math.ceil(0+t.C+t.T+t.L+t.P+t.B);e.useBitmapCoordinateSpace((({context:m,horizontalPixelRatio:T,verticalPixelRatio:v})=>{const B=me(this.zt);m.fillStyle=B.t;const y=Math.round(c*T),D=Math.round(0*v),E=Math.round(h*T),N=Math.round(d*v),S=Math.round(2*T);if(m.beginPath(),m.moveTo(y,D),m.lineTo(y,N-S),m.arcTo(y,N,y+S,N,S),m.lineTo(E-S,N),m.arcTo(E,N,E,N-S,S),m.lineTo(E,D),m.fill(),B.hi){const W=Math.round(B.ki*T),$=D,j=Math.round(($+t.T)*v);m.fillStyle=B.V;const V=Math.max(1,Math.floor(T)),X=Math.floor(.5*T);m.fillRect(W-X,$,V,j-$)}})),e.useMediaCoordinateSpace((({context:m})=>{const T=me(this.zt),v=0+t.C+t.T+t.L+t.P/2;m.font=t.R,m.textAlign="left",m.textBaseline="middle",m.fillStyle=T.V;const B=t.Wi.Mi(m,"Apr0");m.translate(c+i,v+B),m.fillText(T.Kt,0,0)}))}}class Ep{constructor(e,t,A){this.ft=!0,this.Wt=new ja,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 i=this.Ei();if(i===null)return;e.ki=i.ki;const n=A.Ui(this.vt.xt());e.Kt=A.qi(me(n)),e.yt=!0;const s=Fi(t.labelBackgroundColor);e.t=s.t,e.V=s.i,e.hi=A.W().ticksVisible}}class fs{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 el;(function(r){r[r.Normal=0]="Normal",r[r.Magnet=1]="Magnet",r[r.Hidden=2]="Hidden"})(el||(el={}));class Sp extends fs{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 bp(e,this),this.fn=((i,n)=>s=>{const o=n(),a=i();if(s===me(this.tn).vn())return{_t:a,ki:o};{const c=me(s.Ct());return{_t:s.pn(o,c),ki:o}}})((()=>this.nn),(()=>this.an));const A=((i,n)=>()=>{const s=this.$i.St().mn(i()),o=n();return s&&Number.isFinite(o)?{ot:s,ki:o}:null})((()=>this.sn),(()=>this.Yt()));this.bn=new Ep(this,e,A),this.wn=new xp(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 i=this.ln,n=this.an,s=this.nn,o=this.sn,a=this.tn,c=this.On(A);this.sn=e,this.ln=isNaN(e)?NaN:this.$i.St().It(e),this.tn=A;const h=c!==null?c.Ct():null;return c!==null&&h!==null?(this.nn=t,this.an=c.Rt(t,h)):(this.nn=NaN,this.an=NaN),i!==this.ln||n!==this.an||o!==this.sn||s!==this.nn||a!==this.tn}Tn(){const e=this.$i.wt().map((A=>A.In().An())).filter(wp),t=e.length===0?null:Math.max(...e);this.sn=t!==null?t:NaN}Dn(e,t,A){let i=e.get(t);return i===void 0&&(i=new Fp(this,t,A),e.set(t,i)),i}}function Hi(r){return r==="left"||r==="right"}class xt{constructor(e){this.zn=new Map,this.Ln=[],this.En=e}Nn(e,t){const A=(function(i,n){return i===void 0?n:{Fn:Math.max(i.Fn,n.Fn),Wn:i.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 xt(2)}static es(){return new xt(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 tl=".";function UA(r,e){if(!mA(r))return"n/a";if(!_r(e))throw new TypeError("invalid length");if(e<0||e>16)throw new TypeError("invalid length");return e===0?r.toString():("0000000000000000"+r.toString()).slice(-e)}class Li{constructor(e,t){if(t||(t=1),mA(e)&&_r(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),i="";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),i=tl+UA(+s.toFixed(this._s)*this.rs,n)}else A=Math.round(A*t)/t,n>0&&(i=tl+UA(0,n));return A.toFixed(0)+i}}class Al extends Li{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}}class Hp{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+$/,((i,n)=>n))}}function rl(r,e,t,A,i,n,s){if(e.length===0||A.from>=e.length||A.to<=0)return;const{context:o,horizontalPixelRatio:a,verticalPixelRatio:c}=r,h=e[A.from];let d=n(r,h),m=h;if(A.to-A.from<2){const T=i/2;o.beginPath();const v={nt:h.nt-T,st:h.st},B={nt:h.nt+T,st:h.st};o.moveTo(v.nt*a,v.st*c),o.lineTo(B.nt*a,B.st*c),s(r,d,v,B)}else{const T=(B,y)=>{s(r,d,m,y),o.beginPath(),d=B,m=y};let v=m;o.beginPath(),o.moveTo(h.nt*a,h.st*c);for(let B=A.from+1;B<A.to;++B){v=e[B];const y=n(r,v);switch(t){case 0:o.lineTo(v.nt*a,v.st*c);break;case 1:o.lineTo(v.nt*a,e[B-1].st*c),y!==d&&(T(y,v),o.lineTo(v.nt*a,e[B-1].st*c)),o.lineTo(v.nt*a,v.st*c);break;case 2:{const[D,E]=Lp(e,B-1,B);o.bezierCurveTo(D.nt*a,D.st*c,E.nt*a,E.st*c,v.nt*a,v.st*c);break}}t!==1&&y!==d&&(T(y,v),o.moveTo(v.nt*a,v.st*c))}(m!==v||m===v&&t===1)&&s(r,d,m,v)}}const il=6;function ms(r,e){return{nt:r.nt-e.nt,st:r.st-e.st}}function nl(r,e){return{nt:r.nt/e,st:r.st/e}}function Lp(r,e,t){const A=Math.max(0,e-1),i=Math.min(r.length-1,t+1);var n,s;return[(n=r[e],s=nl(ms(r[t],r[A]),il),{nt:n.nt+s.nt,st:n.st+s.st}),ms(r[t],nl(ms(r[i],r[e]),il))]}function Mp(r,e,t,A,i){const{context:n,horizontalPixelRatio:s,verticalPixelRatio:o}=e;n.lineTo(i.nt*s,r*o),n.lineTo(A.nt*s,r*o),n.closePath(),n.fillStyle=t,n.fill()}class sl extends lA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){var t;if(this.G===null)return;const{it:A,tt:i,ds:n,et:s,Nt:o,fs:a}=this.G,c=(t=this.G.vs)!==null&&t!==void 0?t:this.G.ps?0:e.mediaSize.height;if(i===null)return;const h=e.context;h.lineCap="butt",h.lineJoin="round",h.lineWidth=s,YA(h,o),h.lineWidth=1,rl(e,A,a,i,n,this.bs.bind(this),Mp.bind(null,c))}}function gs(r,e,t){return Math.min(Math.max(r,e),t)}function Mi(r,e,t){return e-r<=t}function ol(r){const e=Math.ceil(r);return e%2==0?e-1:e}class ws{ws(e,t){const A=this.gs,{Ms:i,xs:n,Ss:s,ks:o,ys:a,vs:c}=t;if(this.Cs===void 0||A===void 0||A.Ms!==i||A.xs!==n||A.Ss!==s||A.ks!==o||A.vs!==c||A.ys!==a){const h=e.context.createLinearGradient(0,0,0,a);if(h.addColorStop(0,i),c!=null){const d=gs(c*e.verticalPixelRatio/a,0,1);h.addColorStop(d,n),h.addColorStop(d,s)}h.addColorStop(1,o),this.Cs=h,this.gs=t}return this.Cs}}class Ip extends sl{constructor(){super(...arguments),this.Ts=new ws}bs(e,t){return this.Ts.ws(e,{Ms:t.Ps,xs:"",Ss:"",ks:t.Rs,ys:e.bitmapSize.height})}}function _p(r,e){const t=r.context;t.strokeStyle=e,t.stroke()}class al extends lA{constructor(){super(...arguments),this.G=null}J(e){this.G=e}K(e){if(this.G===null)return;const{it:t,tt:A,ds:i,fs:n,et:s,Nt:o,Ds:a}=this.G;if(A===null)return;const c=e.context;c.lineCap="butt",c.lineWidth=s*e.verticalPixelRatio,YA(c,o),c.lineJoin="round";const h=this.Vs.bind(this);n!==void 0&&rl(e,t,n,A,i,h,_p),a&&(function(d,m,T,v,B){const{horizontalPixelRatio:y,verticalPixelRatio:D,context:E}=d;let N=null;const S=Math.max(1,Math.floor(y))%2/2,W=T*D+S;for(let $=v.to-1;$>=v.from;--$){const j=m[$];if(j){const V=B(d,j);V!==N&&(E.beginPath(),N!==null&&E.fill(),E.fillStyle=V,N=V);const X=Math.round(j.nt*y)+S,ce=j.st*D;E.moveTo(X,ce),E.arc(X,ce,W,0,2*Math.PI)}}E.fill()})(e,t,a,A,h)}}class ll extends al{Vs(e,t){return t.lt}}function cl(r,e,t,A,i=0,n=e.length){let s=n-i;for(;0<s;){const o=s>>1,a=i+o;A(e[a],t)===r?(i=a+1,s-=o+1):s=o}return i}const Or=cl.bind(null,!0),hl=cl.bind(null,!1);function Dp(r,e){return r.ot<e}function kp(r,e){return e<r.ot}function ul(r,e,t){const A=e.Os(),i=e.ui(),n=Or(r,A,Dp),s=hl(r,i,kp);if(!t)return{from:n,to:s};let o=n,a=s;return n>0&&n<r.length&&r[n].ot>=A&&(o=n-1),s>0&&s<r.length&&r[s-1].ot<=i&&(a=s+1),{from:o,to:a}}class Bs{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 i=this.Es.Ct();i!==null&&(this.Ls=ul(this.zs,A,this.Fs),this.Gs(e,t,i.Vt),this.Js())}}class Ii extends Bs{constructor(e,t){super(e,t,!0)}Gs(e,t,A){t.Qs(this.zs,kr(this.Ls)),e.te(this.zs,A,kr(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 Op extends Ii{constructor(e,t){super(e,t),this.js=new ps,this.re=new Ip,this.he=new ll,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 Np extends lA{constructor(){super(...arguments),this.zt=null,this.ae=0,this.oe=0}J(e){this.zt=e}K({context:e,horizontalPixelRatio:t,verticalPixelRatio: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 i=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];i!==o.ce&&(e.fillStyle=o.ce,i=o.ce);const a=Math.floor(.5*this.oe),c=Math.round(o.nt*t),h=c-a,d=this.oe,m=h+d-1,T=Math.min(o.de,o.fe),v=Math.max(o.de,o.fe),B=Math.round(T*A)-a,y=Math.round(v*A)+a,D=Math.max(y-B,this.oe);e.fillRect(h,B,d,D);const E=Math.ceil(1.5*this.ae);if(n){if(this.zt.ve){const $=c-E;let j=Math.max(B,Math.round(o.pe*A)-a),V=j+d-1;V>B+D-1&&(V=B+D-1,j=V-d+1),e.fillRect($,j,h-$,V-j+1)}const N=c+E;let S=Math.max(B,Math.round(o.me*A)-a),W=S+d-1;W>B+D-1&&(W=B+D-1,S=W-d+1),e.fillRect(m+1,S,N-m,W-S+1)}}}_e(e){const t=Math.floor(e);return Math.max(t,Math.floor((function(A,i){return Math.floor(.3*A*i)})(me(this.zt).le,e)))}}class dl extends Bs{constructor(e,t){super(e,t,!1)}Gs(e,t,A){t.Qs(this.zs,kr(this.Ls)),e.be(this.zs,A,kr(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 Kp extends dl{constructor(){super(...arguments),this.js=new Np}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 Pp extends sl{constructor(){super(...arguments),this.Ts=new ws}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 Vp extends al{constructor(){super(...arguments),this.Pe=new ws}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 zp extends Ii{constructor(e,t){super(e,t),this.js=new ps,this.Ve=new Pp,this.Oe=new Vp,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),i=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:i}),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:i})}}class Wp extends lA{constructor(){super(...arguments),this.zt=null,this.ae=0}J(e){this.zt=e}K(e){if(this.zt===null||this.zt.In.length===0||this.zt.tt===null)return;const{horizontalPixelRatio:t}=e;this.ae=(function(n,s){if(n>=2.5&&n<=4)return Math.floor(3*s);const o=1-.2*Math.atan(Math.max(4,n)-4)/(.5*Math.PI),a=Math.floor(n*o*s),c=Math.floor(n*s),h=Math.min(a,c);return Math.max(Math.floor(s),h)})(this.zt.le,t),this.ae>=2&&Math.floor(t)%2!=this.ae%2&&this.ae--;const A=this.zt.In;this.zt.Be&&this.Ae(e,A,this.zt.tt),this.zt._i&&this.Ie(e,A,this.zt.tt);const i=this.ze(t);(!this.zt._i||this.ae>2*i)&&this.Le(e,A,this.zt.tt)}Ae(e,t,A){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="",a=Math.min(Math.floor(n),Math.floor(this.zt.le*n));a=Math.max(Math.floor(n),Math.min(a,this.ae));const c=Math.floor(.5*a);let h=null;for(let d=A.from;d<A.to;d++){const m=t[d];m.Ee!==o&&(i.fillStyle=m.Ee,o=m.Ee);const T=Math.round(Math.min(m.pe,m.me)*s),v=Math.round(Math.max(m.pe,m.me)*s),B=Math.round(m.de*s),y=Math.round(m.fe*s);let D=Math.round(n*m.nt)-c;const E=D+a-1;h!==null&&(D=Math.max(h+1,D),D=Math.min(D,E));const N=E-D+1;i.fillRect(D,B,N,T-B),i.fillRect(D,v+1,N,y-v),h=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:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);let c=null;for(let h=A.from;h<A.to;h++){const d=t[h];d.Ne!==o&&(i.fillStyle=d.Ne,o=d.Ne);let m=Math.round(d.nt*n)-Math.floor(.5*this.ae);const T=m+this.ae-1,v=Math.round(Math.min(d.pe,d.me)*s),B=Math.round(Math.max(d.pe,d.me)*s);if(c!==null&&(m=Math.max(c+1,m),m=Math.min(m,T)),this.zt.le*n>2*a)Qp(i,m,v,T-m+1,B-v+1,a);else{const y=T-m+1;i.fillRect(m,v,y,B-v+1)}c=T}}Le(e,t,A){if(this.zt===null)return;const{context:i,horizontalPixelRatio:n,verticalPixelRatio:s}=e;let o="";const a=this.ze(n);for(let c=A.from;c<A.to;c++){const h=t[c];let d=Math.round(Math.min(h.pe,h.me)*s),m=Math.round(Math.max(h.pe,h.me)*s),T=Math.round(h.nt*n)-Math.floor(.5*this.ae),v=T+this.ae-1;if(h.ce!==o){const B=h.ce;i.fillStyle=B,o=B}this.zt._i&&(T+=a,d+=a,v-=a,m-=a),d>m||i.fillRect(T,d,v-T+1,m-d+1)}}}class Gp extends dl{constructor(){super(...arguments),this.js=new Wp}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 Rp{constructor(e,t){this.Fe=e,this.Li=t}X(e,t,A){this.Fe.draw(e,this.Li,t,A)}}class Cs extends Bs{constructor(e,t,A){super(e,t,!1),this.wn=A,this.js=new Rp(this.wn.renderer(),(i=>{const n=e.Ct();return n===null?null:e.Dt().Rt(i,n.Vt)}))}We(e){return this.wn.priceValueBuilder(e)}je(e){return this.wn.isWhitespace(e)}Ys(){const e=this.Es.Us();this.zs=this.Es.In().ne().map((t=>Object.assign(Object.assign({ot:t.ee,nt:NaN},e.$s(t.ee)),{He:t.$e})))}Gs(e,t){t.Qs(this.zs,kr(this.Ls))}Js(){this.wn.update({bars:this.zs.map($p),barSpacing:this.Ns.St().le(),visibleRange:this.Ls},this.Es.W())}}function $p(r){return{x:r.nt,time:r.ot,originalData:r.He,barColor:r.ce}}class Xp extends lA{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 i=Math.max(1,Math.floor(A)),n=Math.round(this.zt.Ye*A)-Math.floor(i/2),s=n+i;for(let o=this.zt.tt.from;o<this.zt.tt.to;o++){const a=this.zt.it[o],c=this.Ue[o-this.zt.tt.from],h=Math.round(a.st*A);let d,m;e.fillStyle=a.ce,h<=n?(d=h,m=s):(d=n,m=h-Math.floor(i/2)+i),e.fillRect(c.Os,d,c.ui-c.Os+1,m-d)}}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 a,c;if(A%2){const h=(A-1)/2;a=o-h,c=o+h}else{const h=A/2;a=o-h,c=o+h-1}this.Ue[n-this.zt.tt.from]={Os:a,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 i=Math.ceil(this.zt.le*e);for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui<s.Os&&(s.ui=s.Os);const o=s.ui-s.Os+1;i=Math.min(o,i)}if(t>0&&i<4)for(let n=this.zt.tt.from;n<this.zt.tt.to;n++){const s=this.Ue[n-this.zt.tt.from];s.ui-s.Os+1>i&&(s.Ze>s.Xe?s.ui-=1:s.Os+=1)}}}class Zp extends Ii{constructor(){super(...arguments),this.js=new Xp}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,me(this.Es.Ct()).Vt)};this.js.J(e)}}class Jp extends Ii{constructor(){super(...arguments),this.js=new ll}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 qp=/[2-9]/g;class Nr{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 i=this.sr(e,t,A);return((i.actualBoundingBoxAscent||0)-(i.actualBoundingBoxDescent||0))/2}sr(e,t,A){const i=A||qp,n=String(t).replace(i,"0");if(this.tr.has(n))return _t(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 Yp{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 pl{constructor(e,t,A){this.ur=e,this.ar=new Nr(50),this.cr=t,this.F=A,this.j=-1,this.Wt=new Yp(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 i=this.F.br();return i.P!==this.j&&(this.j=i.P,this.ar.nr()),this.Wt._r(this.ur.Ii(),i,A),this.Wt}}class jp extends lA{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:i,et:n,gr:s}=this.zt;return t>=i-n-7&&t<=i+n+7?{Mr:this.zt,gr:s}:null}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){if(this.zt===null||this.zt.yt===!1)return;const n=Math.round(this.zt.st*i);n<0||n>t.height||(e.lineCap="butt",e.strokeStyle=this.zt.V,e.lineWidth=Math.floor(this.zt.et*A),YA(e,this.zt.Nt),Ga(e,n,0,t.width))}}class vs{constructor(e){this.Sr={st:0,V:"rgba(0, 0, 0, 0)",et:1,Nt:0,yt:!1},this.kr=new jp,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 vs{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 i=this.Es.Ct();i!==null&&(this.Sr.yt=!0,this.Sr.st=e.Rt(i.Vt,i.Vt),this.Sr.V=A.baseLineColor,this.Sr.et=A.baseLineWidth,this.Sr.Nt=A.baseLineStyle)}}class tf extends lA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}$e(){return this.zt}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A}){const i=this.zt;if(i===null)return;const n=Math.max(1,Math.floor(t)),s=n%2/2,o=Math.round(i.Xe.x*t)+s,a=i.Xe.y*A;e.fillStyle=i.Tr,e.beginPath();const c=Math.max(2,1.5*i.Pr)*t;e.arc(o,a,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.Rr,e.beginPath(),e.arc(o,a,i.ht*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=i.Dr,e.beginPath(),e.arc(o,a,i.ht*t+n/2,0,2*Math.PI,!1),e.stroke()}}const Af=[{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 fl(r,e,t,A){return(function(i,n){if(i==="transparent")return i;const s=Ir(i),o=s[3];return`rgba(${s[0]}, ${s[1]}, ${s[2]}, ${n*o})`})(r,t+(A-t)*e)}function ml(r,e){const t=r%2600/2600;let A;for(const a of Af)if(t>=a.Vr&&t<=a.Or){A=a;break}_A(A!==void 0,"Last price animation internal logic error");const i=(t-A.Vr)/(A.Or-A.Vr);return{Rr:fl(e,i,A.Ir,A.zr),Dr:fl(e,i,A.Lr,A.Er),ht:(n=i,s=A.Br,o=A.Ar,s+(o-s)*n)};var n,s,o}class rf{constructor(e){this.Wt=new tf,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 i=this.jr.Zr(!0);if(i.Xr||!t.Kr(i.ee))return;const n={x:e.It(i.ee),y:this.jr.Dt().Rt(i._t,A.Vt)},s=i.V,o=this.jr.W().lineWidth,a=ml(this.Gr(),s);this.Wt.J({Tr:s,Pr:o,Rr:a.Rr,Dr:a.Dr,ht:a.ht,Xe:n})}Yr(){const e=this.Wt.$e();if(e!==null){const t=ml(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 Kr(r,e){return ol(Math.min(Math.max(r,12),30)*e)}function Pr(r,e){switch(r){case"arrowDown":case"arrowUp":return Kr(e,1);case"circle":return Kr(e,.8);case"square":return Kr(e,.7)}}function gl(r){return(function(e){const t=Math.ceil(e);return t%2!=0?t-1:t})(Kr(r,1))}function wl(r){return Math.max(Kr(r,.1),3)}function Bl(r,e,t){return e?r:t?Math.ceil(r/2):0}function Cl(r,e,t,A,i){const n=Pr("square",t),s=(n-1)/2,o=r-s,a=e-s;return A>=o&&A<=o+n&&i>=a&&i<=a+n}function vl(r,e,t,A){const i=(Pr("arrowUp",A)-1)/2*t.Jr,n=(ol(A/2)-1)/2*t.Jr;e.beginPath(),r?(e.moveTo(t.nt-i,t.st),e.lineTo(t.nt,t.st-i),e.lineTo(t.nt+i,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st+i),e.lineTo(t.nt-n,t.st+i),e.lineTo(t.nt-n,t.st)):(e.moveTo(t.nt-i,t.st),e.lineTo(t.nt,t.st+i),e.lineTo(t.nt+i,t.st),e.lineTo(t.nt+n,t.st),e.lineTo(t.nt+n,t.st-i),e.lineTo(t.nt-n,t.st-i),e.lineTo(t.nt-n,t.st)),e.fill()}function nf(r,e,t,A,i,n){return Cl(e,t,A,i,n)}class sf extends lA{constructor(){super(...arguments),this.zt=null,this.ar=new Nr,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=ur(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 i=this.zt.it[A];if(af(i,e,t))return{Mr:i.th,gr:i.gr}}return null}K({context:e,horizontalPixelRatio:t,verticalPixelRatio:A},i,n){if(this.zt!==null&&this.zt.tt!==null){e.textBaseline="middle",e.font=this.Qr;for(let s=this.zt.tt.from;s<this.zt.tt.to;s++){const o=this.zt.it[s];o.Kt!==void 0&&(o.Kt.Hi=this.ar.xi(e,o.Kt.ih),o.Kt.At=this.j,o.Kt.nt=o.nt-o.Kt.Hi/2),of(o,e,t,A)}}}}function of(r,e,t,A){e.fillStyle=r.V,r.Kt!==void 0&&(function(i,n,s,o,a,c){i.save(),i.scale(a,c),i.fillText(n,s,o),i.restore()})(e,r.Kt.ih,r.Kt.nt,r.Kt.st,t,A),(function(i,n,s){if(i.Ks!==0){switch(i.nh){case"arrowDown":return void vl(!1,n,s,i.Ks);case"arrowUp":return void vl(!0,n,s,i.Ks);case"circle":return void(function(o,a,c){const h=(Pr("circle",c)-1)/2;o.beginPath(),o.arc(a.nt,a.st,h*a.Jr,0,2*Math.PI,!1),o.fill()})(n,s,i.Ks);case"square":return void(function(o,a,c){const h=Pr("square",c),d=(h-1)*a.Jr/2,m=a.nt-d,T=a.st-d;o.fillRect(m,T,h*a.Jr,h*a.Jr)})(n,s,i.Ks)}i.nh}})(r,e,(function(i,n,s){const o=Math.max(1,Math.floor(n))%2/2;return{nt:Math.round(i.nt*n)+o,st:i.st*s,Jr:n}})(r,t,A))}function af(r,e,t){return!(r.Kt===void 0||!(function(A,i,n,s,o,a){const c=s/2;return o>=A&&o<=A+n&&a>=i-c&&a<=i+c})(r.Kt.nt,r.Kt.st,r.Kt.Hi,r.Kt.At,e,t))||(function(A,i,n){if(A.Ks===0)return!1;switch(A.nh){case"arrowDown":case"arrowUp":return nf(0,A.nt,A.st,A.Ks,i,n);case"circle":return(function(s,o,a,c,h){const d=2+Pr("circle",a)/2,m=s-c,T=o-h;return Math.sqrt(m*m+T*T)<=d})(A.nt,A.st,A.Ks,i,n);case"square":return Cl(A.nt,A.st,A.Ks,i,n)}})(r,e,t)}function lf(r,e,t,A,i,n,s,o,a){const c=mA(t)?t:t.Se,h=mA(t)?t:t.Me,d=mA(t)?t:t.xe,m=mA(e.size)?Math.max(e.size,0):1,T=gl(o.le())*m,v=T/2;switch(r.Ks=T,e.position){case"inBar":return r.st=s.Rt(c,a),void(r.Kt!==void 0&&(r.Kt.st=r.st+v+n+.6*i));case"aboveBar":return r.st=s.Rt(h,a)-v-A.sh,r.Kt!==void 0&&(r.Kt.st=r.st-v-.6*i,A.sh+=1.2*i),void(A.sh+=T+n);case"belowBar":return r.st=s.Rt(d,a)+v+A.eh,r.Kt!==void 0&&(r.Kt.st=r.st+v+n+.6*i,A.eh+=1.2*i),void(A.eh+=T+n)}e.position}class cf{constructor(e,t){this.ft=!0,this.rh=!0,this.hh=!0,this.ah=null,this.oh=null,this.Wt=new sf,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*gl(e)+2*t,i=this.fh();this.ah={above:Bl(A,i.aboveBar,i.inBar),below:Bl(A,i.belowBar,i.inBar)}}else this.ah=null;this.hh=!1}return this.ah}fh(){return this.oh===null&&(this.oh=this.jr.dh().reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1})),this.oh}_h(){const e=this.jr.Dt(),t=this.$i.St(),A=this.jr.dh();this.rh&&(this.zt.it=A.map((h=>({ot:h.time,nt:0,st:0,Ks:0,nh:h.shape,V:h.color,th:h.th,gr:h.id,Kt:void 0}))),this.rh=!1);const i=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 a=wl(t.le()),c={sh:a,eh:a};this.zt.tt=ul(this.zt.it,n,!0);for(let h=this.zt.tt.from;h<this.zt.tt.to;h++){const d=A[h];d.time!==o&&(c.sh=a,c.eh=a,o=d.time);const m=this.zt.it[h];m.nt=t.It(d.time),d.text!==void 0&&d.text.length>0&&(m.Kt={ih:d.text,nt:0,st:0,Hi:0,At:0});const T=this.jr.ph(d.time);T!==null&&lf(m,d,T,c,i.fontSize,a,e,t,s.Vt)}this.ft=!1}}class hf extends vs{constructor(e){super(e)}yr(){const e=this.Sr;e.yt=!1;const t=this.Es.W();if(!t.priceLineVisible||!this.Es.yt())return;const A=this.Es.Zr(t.priceLineSource===0);A.Xr||(e.yt=!0,e.st=A.ki,e.V=this.Es.mh(A.V),e.et=t.priceLineWidth,e.Nt=t.priceLineStyle)}}class uf extends Si{constructor(e){super(),this.jt=e}zi(e,t,A){e.yt=!1,t.yt=!1;const i=this.jt;if(!i.yt())return;const n=i.W(),s=n.lastValueVisible,o=i.bh()!=="",a=n.seriesLastValueMode===0,c=i.Zr(!1);if(c.Xr)return;s&&(e.Kt=this.wh(c,s,a),e.yt=e.Kt.length!==0),(o||a)&&(t.Kt=this.gh(c,s,o,a),t.yt=t.Kt.length>0);const h=i.mh(c.V),d=Fi(h);A.t=d.t,A.ki=c.ki,t.Ot=i.$t().Bt(c.ki/i.Dt().At()),e.Ot=h,e.V=d.i,t.V=d.i}gh(e,t,A,i){let n="";const s=this.jt.bh();return A&&s.length!==0&&(n+=`${s} `),t&&i&&(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 yl(r,e,t,A){const i=Number.isFinite(e),n=Number.isFinite(t);return i&&n?r(e,t):i||n?i?e:t:A}class Pt{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 Pt(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 Pt(yl(Math.min,this.Ph(),e.Ph(),-1/0),yl(Math.max,this.Rh(),e.Rh(),1/0))}Vh(e){if(!mA(e)||this.yh-this.kh===0)return;const t=.5*(this.yh+this.kh);let A=this.yh-t,i=this.kh-t;A*=e,i*=e,this.yh=t+A,this.kh=t+i}Oh(e){mA(e)&&(this.yh+=e,this.kh+=e)}Bh(){return{minValue:this.kh,maxValue:this.yh}}static Ah(e){return e===null?null:new Pt(e.minValue,e.maxValue)}}class _i{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 _i(Pt.Ah(e.priceRange),e.margins)}}class df extends vs{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 pf extends Si{constructor(e,t){super(),this.jr=e,this.Nh=t}zi(e,t,A){e.yt=!1,t.yt=!1;const i=this.Nh.W(),n=i.axisLabelVisible,s=i.title!=="",o=this.jr;if(!n||!o.yt())return;const a=this.Nh.Fh();if(a===null)return;s&&(t.Kt=i.title,t.yt=!0),t.Ot=o.$t().Bt(a/o.Dt().At()),e.Kt=this.Wh(i.price),e.yt=!0;const c=Fi(i.axisLabelColor||i.color);A.t=c.t;const h=i.axisLabelTextColor||c.i;e.V=h,t.V=h,A.ki=a}Wh(e){const t=this.jr.Ct();return t===null?"":this.jr.Dt().Fi(e,t.Vt)}}class ff{constructor(e,t){this.jr=e,this.cn=t,this.jh=new df(e,this),this.ur=new pf(e,this),this.Hh=new pl(this.ur,e,e.$t())}$h(e){aA(this.cn,e),this.bt(),this.jr.$t().Uh()}W(){return this.cn}qh(){return this.jh}Yh(){return this.Hh}Zh(){return this.ur}bt(){this.jh.bt(),this.ur.bt()}Fh(){const e=this.jr,t=e.Dt();if(e.$t().St().Ni()||t.Ni())return null;const A=e.Ct();return A===null?null:t.Rt(this.cn.price,A.Vt)}}class mf extends fs{constructor(e){super(),this.$i=e}$t(){return this.$i}}const gf={Bar:(r,e,t,A)=>{var i;const n=e.upColor,s=e.downColor,o=me(r(t,A)),a=hr(o.Vt[0])<=hr(o.Vt[3]);return{ce:(i=o.V)!==null&&i!==void 0?i:a?n:s}},Candlestick:(r,e,t,A)=>{var i,n,s;const o=e.upColor,a=e.downColor,c=e.borderUpColor,h=e.borderDownColor,d=e.wickUpColor,m=e.wickDownColor,T=me(r(t,A)),v=hr(T.Vt[0])<=hr(T.Vt[3]);return{ce:(i=T.V)!==null&&i!==void 0?i:v?o:a,Ne:(n=T.Ot)!==null&&n!==void 0?n:v?c:h,Ee:(s=T.Xh)!==null&&s!==void 0?s:v?d:m}},Custom:(r,e,t,A)=>{var i;return{ce:(i=me(r(t,A)).V)!==null&&i!==void 0?i:e.color}},Area:(r,e,t,A)=>{var i,n,s,o;const a=me(r(t,A));return{ce:(i=a.lt)!==null&&i!==void 0?i:e.lineColor,lt:(n=a.lt)!==null&&n!==void 0?n:e.lineColor,Ps:(s=a.Ps)!==null&&s!==void 0?s:e.topColor,Rs:(o=a.Rs)!==null&&o!==void 0?o:e.bottomColor}},Baseline:(r,e,t,A)=>{var i,n,s,o,a,c;const h=me(r(t,A));return{ce:h.Vt[3]>=e.baseValue.price?e.topLineColor:e.bottomLineColor,Re:(i=h.Re)!==null&&i!==void 0?i:e.topLineColor,De:(n=h.De)!==null&&n!==void 0?n:e.bottomLineColor,ke:(s=h.ke)!==null&&s!==void 0?s:e.topFillColor1,ye:(o=h.ye)!==null&&o!==void 0?o:e.topFillColor2,Ce:(a=h.Ce)!==null&&a!==void 0?a:e.bottomFillColor1,Te:(c=h.Te)!==null&&c!==void 0?c:e.bottomFillColor2}},Line:(r,e,t,A)=>{var i,n;const s=me(r(t,A));return{ce:(i=s.V)!==null&&i!==void 0?i:e.color,lt:(n=s.V)!==null&&n!==void 0?n:e.color}},Histogram:(r,e,t,A)=>{var i;return{ce:(i=me(r(t,A)).V)!==null&&i!==void 0?i:e.color}}};class wf{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 bl;(function(r){r[r.NearestLeft=-1]="NearestLeft",r[r.None=0]="None",r[r.NearestRight=1]="NearestRight"})(bl||(bl={}));const DA=30;class Bf{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 i=null;for(const n of A)i=Di(i,this._l(e,t,n));return i}J(e){this.nl.clear(),this.il.clear(),this.tl=e}rl(e){return this.tl[e].ee}al(e){return this.tl[e]}hl(e,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 Or(this.tl,e,((t,A)=>t.ee<A))}vl(e){return hl(this.tl,e,((t,A)=>t.ee>A))}pl(e,t,A){let i=null;for(let n=e;n<t;n++){const s=this.tl[n].Vt[A];Number.isNaN(s)||(i===null?i={ml:s,bl:s}:(s<i.ml&&(i.ml=s),s>i.bl&&(i.bl=s)))}return i}_l(e,t,A){if(this.Ni())return null;let i=null;const n=me(this.el()),s=me(this.An()),o=Math.max(e,n),a=Math.min(t,s),c=Math.ceil(o/DA)*DA,h=Math.max(c,Math.floor(a/DA)*DA);{const m=this.fl(o),T=this.vl(Math.min(a,c,t));i=Di(i,this.pl(m,T,A))}let d=this.il.get(A);d===void 0&&(d=new Map,this.il.set(A,d));for(let m=Math.max(c+1,o);m<h;m+=DA){const T=Math.floor(m/DA);let v=d.get(T);if(v===void 0){const B=this.fl(T*DA),y=this.vl((T+1)*DA-1);v=this.pl(B,y,A),d.set(T,v)}i=Di(i,v)}{const m=this.fl(h),T=this.vl(a);i=Di(i,this.pl(m,T,A))}return i}}function Di(r,e){return r===null?e:e===null?r:{ml:Math.min(r.ml,e.ml),bl:Math.max(r.bl,e.bl)}}class Cf{constructor(e){this.wl=e}X(e,t,A){this.wl.draw(e)}gl(e,t,A){var i,n;(n=(i=this.wl).drawBackground)===null||n===void 0||n.call(i,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 Cf(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 Tl(r){var e,t,A,i,n;return{Kt:r.text(),ki:r.coordinate(),Si:(e=r.fixedCoordinate)===null||e===void 0?void 0:e.call(r),V:r.textColor(),t:r.backColor(),yt:(A=(t=r.visible)===null||t===void 0?void 0:t.call(r))===null||A===void 0||A,hi:(n=(i=r.tickVisible)===null||i===void 0?void 0:i.call(r))===null||n===void 0||n}}class vf{constructor(e,t){this.Wt=new ja,this.kl=e,this.yl=t}gt(){return this.Wt.J(Object.assign({Hi:this.yl.Hi()},Tl(this.kl))),this.Wt}}class yf extends Si{constructor(e,t){super(),this.kl=e,this.Li=t}zi(e,t,A){const i=Tl(this.kl);A.t=i.t,e.V=i.V;const n=2/12*this.Li.P();A.wi=n,A.gi=n,A.ki=i.ki,A.Si=i.Si,e.Kt=i.Kt,e.yt=i.yt,e.hi=i.hi}}class bf{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,i;const n=(A=(t=(e=this.Vl).paneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Cl)===null||i===void 0?void 0:i.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,i;const n=(A=(t=(e=this.Vl).timeAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Tl)===null||i===void 0?void 0:i.Ml)===n)return this.Tl.xl;const s=this.jr.$t().St(),o=n.map((a=>new vf(a,s)));return this.Tl={Ml:n,xl:o},o}Rn(){var e,t,A,i;const n=(A=(t=(e=this.Vl).priceAxisViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Pl)===null||i===void 0?void 0:i.Ml)===n)return this.Pl.xl;const s=this.jr.Dt(),o=n.map((a=>new yf(a,s)));return this.Pl={Ml:n,xl:o},o}Bl(){var e,t,A,i;const n=(A=(t=(e=this.Vl).priceAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Rl)===null||i===void 0?void 0:i.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,i;const n=(A=(t=(e=this.Vl).timeAxisPaneViews)===null||t===void 0?void 0:t.call(e))!==null&&A!==void 0?A:[];if(((i=this.Dl)===null||i===void 0?void 0:i.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,i,n;return(n=(i=(A=this.Vl).autoscaleInfo)===null||i===void 0?void 0:i.call(A,e,t))!==null&&n!==void 0?n:null}wr(e,t){var A,i,n;return(n=(i=(A=this.Vl).hitTest)===null||i===void 0?void 0:i.call(A,e,t))!==null&&n!==void 0?n:null}}function bs(r,e,t,A){r.forEach((i=>{e(i).forEach((n=>{n.Sl()===t&&A.push(n)}))}))}function Ts(r){return r.Pn()}function Tf(r){return r.Bl()}function xf(r){return r.Al()}class xs extends mf{constructor(e,t,A,i,n){super(e),this.zt=new Bf,this.jh=new hf(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 uf(this);this.rn=[s],this.Hh=new pl(s,this,e),A!=="Area"&&A!=="Line"&&A!=="Baseline"||(this.El=new rf(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 i=this.$t().St().Xs(),n=this.Ct();if(i===null||n===null)return t;let s,o;if(e){const d=this.zt.sl();if(d===null)return t;s=d,o=d.ee}else{const d=this.zt.ll(i.ui(),-1);if(d===null||(s=this.zt.Gh(d.ee),s===null))return t;o=d.ee}const a=s.Vt[3],c=this.Us().$s(o,{Vt:s}),h=A.Rt(a,n.Vt);return{Xr:!1,_t:a,Kt:A.Fi(a,n.Vt),xh:A.Yl(a),Sh:A.Zl(a,n.Vt),V:c.ce,ki:h,ee:o}}Us(){return this.Nl!==null||(this.Nl=new wf(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),aA(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 ff(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=[];bs(this.Hl,Ts,"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),bs(this.Hl,Ts,"normal",e),e}ua(){return this.ca(Ts,"bottom")}da(e){return this.ca(Tf,e)}fa(e){return this.ca(xf,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 i of this.zl)A.push(i.Zh());return this.Hl.forEach((i=>{A.push(...i.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 i=this.pa(e,t);return i===null?null:i.Bh()}));return _i.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 me(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 bf(e,this))}ya(e){this.Hl=this.Hl.filter((t=>t.Ol()!==e))}Ca(){if(this.wn instanceof Cs)return e=>this.wn.We(e)}Ta(){if(this.wn instanceof Cs)return e=>this.wn.je(e)}_a(){return!Hi(this.Dt().Pa())}pa(e,t){if(!_r(e)||!_r(t)||this.zt.Ni())return null;const A=this.$l==="Line"||this.$l==="Area"||this.$l==="Baseline"||this.$l==="Histogram"?[3]:[2,1],i=this.zt.ol(e,t,A);let n=i!==null?new Pt(i.ml,i.bl):null;if(this.Qh()==="Histogram"){const o=this.cn.base,a=new Pt(o,o);n=n!==null?n.ts(a):a}let s=this.dn.uh();return this.Hl.forEach((o=>{const a=o.Il(e,t);if(a?.priceRange){const T=new Pt(a.priceRange.minValue,a.priceRange.maxValue);n=n!==null?n.ts(T):T}var c,h,d,m;a?.margins&&(c=s,h=a.margins,s={above:Math.max((d=c?.above)!==null&&d!==void 0?d:0,h.above),below:Math.max((m=c?.below)!==null&&m!==void 0?m:0,h.below)})})),new _i(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 Hp(this.cn.priceFormat.precision);break;case"percent":this.wa=new Al(this.cn.priceFormat.precision);break;default:{const e=Math.pow(10,this.cn.priceFormat.precision);this.wa=new Li(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=me(this.zt.el());this.Wl=this.Fl.map(((A,i)=>{const n=me(e.Va(A.time,!0)),s=n<t?1:-1;return{time:me(this.zt.ll(n,s)).ee,position:A.position,shape:A.shape,color:A.color,id:A.id,th:i,text:A.text,size:A.size,originalTime:A.originalTime}}))}ql(e){switch(this.dn=new cf(this,this.$t()),this.$l){case"Bar":this.wn=new Kp(this,this.$t());break;case"Candlestick":this.wn=new Gp(this,this.$t());break;case"Line":this.wn=new Jp(this,this.$t());break;case"Custom":this.wn=new Cs(this,this.$t(),_t(e));break;case"Area":this.wn=new Op(this,this.$t());break;case"Baseline":this.wn=new zp(this,this.$t());break;case"Histogram":this.wn=new Zp(this,this.$t());break;default:throw Error("Unknown chart style assigned: "+this.$l)}}ca(e,t){const A=[];return bs(this.Hl,e,t,A),A}}class Qf{constructor(e){this.cn=e}Oa(e,t,A){let i=e;if(this.cn.mode===0)return i;const n=A.vn(),s=n.Ct();if(s===null)return i;const o=n.Rt(e,s),a=A.Ba().filter((h=>h instanceof xs)).reduce(((h,d)=>{if(A.vr(d)||!d.yt())return h;const m=d.Dt(),T=d.In();if(m.Ni()||!T.Kr(t))return h;const v=T.Gh(t);if(v===null)return h;const B=hr(d.Ct());return h.concat([m.Rt(v.Vt[3],B.Vt)])}),[]);if(a.length===0)return i;a.sort(((h,d)=>Math.abs(h-o)-Math.abs(d-o)));const c=a[0];return i=n.pn(c,s),i}}class Ff extends lA{constructor(){super(...arguments),this.zt=null}J(e){this.zt=e}K({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){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=me(this.zt);if(s.Aa){e.strokeStyle=s.Ia,YA(e,s.za),e.beginPath();for(const o of s.La){const a=Math.round(o.Ea*A);e.moveTo(a,-n),e.lineTo(a,t.height+n)}e.stroke()}if(s.Na){e.strokeStyle=s.Fa,YA(e,s.Wa),e.beginPath();for(const o of s.ja){const a=Math.round(o.Ea*i);e.moveTo(-n,a),e.lineTo(t.width+n,a)}e.stroke()}}))}}class Uf{constructor(e){this.Wt=new Ff,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 Ef{constructor(e){this.wn=new Uf(e)}qh(){return this.wn}}const Qs={$a:4,Ua:1e-4};function dr(r,e){const t=100*(r-e)/e;return e<0?-t:t}function Sf(r,e){const t=dr(r.Ph(),e),A=dr(r.Rh(),e);return new Pt(t,A)}function Vr(r,e){const t=100*(r-e)/e+100;return e<0?-t:t}function Hf(r,e){const t=Vr(r.Ph(),e),A=Vr(r.Rh(),e);return new Pt(t,A)}function ki(r,e){const t=Math.abs(r);if(t<1e-15)return 0;const A=Math.log10(t+e.Ua)+e.$a;return r<0?-A:A}function zr(r,e){const t=Math.abs(r);if(t<1e-15)return 0;const A=Math.pow(10,t-e.$a)-e.Ua;return r<0?-A:A}function Wr(r,e){if(r===null)return null;const t=ki(r.Ph(),e),A=ki(r.Rh(),e);return new Pt(t,A)}function Oi(r,e){if(r===null)return null;const t=zr(r.Ph(),e),A=zr(r.Rh(),e);return new Pt(t,A)}function Fs(r){if(r===null)return Qs;const e=Math.abs(r.Rh()-r.Ph());if(e>=1||e<1e-15)return Qs;const t=Math.ceil(Math.abs(Math.log10(e))),A=Qs.$a+t;return{$a:A,Ua:1/Math.pow(10,A)}}class Us{constructor(e,t){if(this.qa=e,this.Ya=t,(function(A){if(A<0)return!1;for(let i=A;i>1;i/=10)if(i%10!=0)return!1;return!0})(this.qa))this.Za=[2,2.5,2];else{this.Za=[];for(let 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 i=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 d=Mi(n,i,1e-14)&&n>i+1e-14,m=Mi(n,A*o,1e-14),T=Mi(n,1,1e-14);if(!(d&&m&&T))break;n/=o,o=this.Ya[++s%this.Ya.length]}if(n<=i+1e-14&&(n=i),n=Math.max(1,n),this.Za.length>0&&(a=n,c=1,h=1e-14,Math.abs(a-c)<h))for(s=0,o=this.Za[0];Mi(n,A*o,1e-14)&&n>i+1e-14;)n/=o,o=this.Za[++s%this.Za.length];var a,c,h;return n}}class xl{constructor(e,t,A,i){this.Ka=[],this.Li=e,this.qa=t,this.Ga=A,this.Ja=i}Xa(e,t){if(e<t)throw new Error("high < low");const A=this.Li.At(),i=(e-t)*this.Qa()/A,n=new Us(this.qa,[2,2.5,2]),s=new Us(this.qa,[2,2,2.5]),o=new Us(this.qa,[2.5,2,2]),a=[];return a.push(n.Xa(e,t,i),s.Xa(e,t,i),o.Xa(e,t,i)),(function(c){if(c.length<1)throw Error("array is empty");let h=c[0];for(let d=1;d<c.length;++d)c[d]<h&&(h=c[d]);return h})(a)}io(){const e=this.Li,t=e.Ct();if(t===null)return void(this.Ka=[]);const A=e.At(),i=this.Ga(A-1,t),n=this.Ga(0,t),s=this.Li.W().entireTextOnly?this.no()/2:0,o=s,a=A-1-s,c=Math.max(i,n),h=Math.min(i,n);if(c===h)return void(this.Ka=[]);let d=this.Xa(c,h),m=c%d;m+=m<0?d:0;const T=c>=h?1:-1;let v=null,B=0;for(let y=c-m;y>h;y-=d){const D=this.Ja(y,t,!0);v!==null&&Math.abs(D-v)<this.Qa()||D<o||D>a||(B<this.Ka.length?(this.Ka[B].Ea=D,this.Ka[B].so=e.eo(y)):this.Ka.push({Ea:D,so:e.eo(y)}),B++,v=D,e.ro()&&(d=this.Xa(y*T,h)))}this.Ka.length=B}Ha(){return this.Ka}no(){return this.Li.P()}Qa(){return Math.ceil(2.5*this.no())}}function Ql(r){return r.slice().sort(((e,t)=>me(e.Xi())-me(t.Xi())))}var Fl;(function(r){r[r.Normal=0]="Normal",r[r.Logarithmic=1]="Logarithmic",r[r.Percentage=2]="Percentage",r[r.IndexedTo100=3]="IndexedTo100"})(Fl||(Fl={}));const Ul=new Al,El=new Li(100,1);class Lf{constructor(e,t,A,i){this.ho=0,this.lo=null,this.Ih=null,this.ao=null,this.oo={_o:!1,uo:null},this.co=0,this.do=0,this.fo=new pt,this.vo=new pt,this.po=[],this.mo=null,this.bo=null,this.wo=null,this.Mo=null,this.wa=El,this.xo=Fs(null),this.So=e,this.cn=t,this.ko=A,this.yo=i,this.Co=new xl(this,100,this.To.bind(this),this.Po.bind(this))}Pa(){return this.So}W(){return this.cn}$h(e){if(aA(this.cn,e),this.Ra(),e.mode!==void 0&&this.Ro({Cr:e.mode}),e.scaleMargins!==void 0){const t=_t(e.scaleMargins.top),A=_t(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=zr(n.Ph(),s),a=zr(n.Rh(),s);return isFinite(o)&&isFinite(a)})(this.Ih,this.xo)?(A=Oi(this.Ih,this.xo),A!==null&&this.Ao(A)):this.cn.autoScale=!0),e.Cr===1&&e.Cr!==t.Cr&&(A=Wr(this.Ih,this.xo),A!==null&&this.Ao(A));const i=t.Cr!==this.cn.mode;i&&(t.Cr===2||this.Mh())&&this.Ra(),i&&(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=dr(e,t):this.Oo()&&(e=Vr(e,t)),this.Po(e,t)}te(e,t,A){this.Wo();const i=this.Fo(),n=me(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,c=this.Bo(),h=a/(o-s),d=A===void 0?0:A.from,m=A===void 0?e.length:A.to,T=this.Ho();for(let v=d;v<m;v++){const B=e[v],y=B._t;if(isNaN(y))continue;let D=y;T!==null&&(D=T(B._t,t));const E=i+h*(D-s),N=c?E:this.ho-1-E;B.st=N}}be(e,t,A){this.Wo();const i=this.Fo(),n=me(this.Lh()),s=n.Ph(),o=n.Rh(),a=this.Eo()-1,c=this.Bo(),h=a/(o-s),d=A===void 0?0:A.from,m=A===void 0?e.length:A.to,T=this.Ho();for(let v=d;v<m;v++){const B=e[v];let y=B.ge,D=B.Me,E=B.xe,N=B.Se;T!==null&&(y=T(B.ge,t),D=T(B.Me,t),E=T(B.xe,t),N=T(B.Se,t));let S=i+h*(y-s),W=c?S:this.ho-1-S;B.pe=W,S=i+h*(D-s),W=c?S:this.ho-1-S,B.de=W,S=i+h*(E-s),W=c?S:this.ho-1-S,B.fe=W,S=i+h*(N-s),W=c?S:this.ho-1-S,B.me=W}}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(i,n){return n<0&&(i=-i),i/100*n+n})(A,t):this.Oo()&&(A=(function(i,n){return i-=100,n<0&&(i=-i),i/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=me(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=me(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=me(this.Lh()).Th()))}i_(e){if(this.Vo()||this.Mo===null)return;const t=me(this.Lh()).Dh()/(this.Eo()-1);let A=e-this.Mo;this.Bo()&&(A*=-1);const i=A*t,n=me(this.ao).Th();n.Oh(i),this.Ao(n,!0),this.bo=null}n_(){this.Vo()||this.Mo!==null&&(this.Mo=null,this.ao=null)}ba(){return this.wa||this.Ra(),this.wa}Fi(e,t){switch(this.cn.mode){case 2:return this.s_(dr(e,t));case 3:return this.ba().format(Vr(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,me(this.e_()).ba())}Zl(e,t){return e=dr(e,t),this.s_(e,Ul)}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=El,this.Mh()?(this.wa=Ul,t=100):this.Oo()?(this.wa=new Li(100,1),t=100):e!==null&&(this.wa=e.ba()),this.Co=new xl(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?ki(e,this.xo):e;const A=me(this.Lh()),i=this.Fo()+(this.Eo()-1)*(e-A.Ph())/A.Dh();return this.jo(i)}To(e,t){if(this.Wo(),this.Ni())return 0;const A=this.jo(e),i=me(this.Lh()),n=i.Ph()+i.Dh()*((A-this.Fo())/(this.Eo()-1));return this.ro()?zr(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 i=0,n=0;for(const a of A){if(!a.yt())continue;const c=a.Ct();if(c===null)continue;const h=a.Il(e.Os(),e.ui());let d=h&&h.Lh();if(d!==null){switch(this.cn.mode){case 1:d=Wr(d,this.xo);break;case 2:d=Sf(d,c.Vt);break;case 3:d=Hf(d,c.Vt)}if(t=t===null?d:t.ts(me(d)),h!==null){const m=h.Eh();m!==null&&(i=Math.max(i,m.above),n=Math.max(n,m.below))}}}if(i===this.co&&n===this.do||(this.co=i,this.do=n,this.bo=null,this.Do()),t!==null){if(t.Ph()===t.Rh()){const a=this.e_(),c=5*(a===null||this.Mh()||this.Oo()?1:a.ma());this.ro()&&(t=Oi(t,this.xo)),t=new Pt(t.Ph()-c,t.Rh()+c),this.ro()&&(t=Wr(t,this.xo))}if(this.ro()){const a=Oi(t,this.xo),c=Fs(a);if(s=c,o=this.xo,s.$a!==o.$a||s.Ua!==o.Ua){const h=this.ao!==null?Oi(this.ao,this.xo):null;this.xo=c,t=Wr(a,c),h!==null&&(this.ao=Wr(h,c))}}this.Ao(t)}else this.Ih===null&&(this.Ao(new Pt(-.5,.5)),this.xo=Fs(null));var s,o;this.oo._o=!0}Ho(){return this.Mh()?dr:this.Oo()?Vr:this.ro()?e=>ki(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 Mf{constructor(e,t){this.po=[],this.o_=new Map,this.ho=0,this.__=0,this.u_=1e3,this.mo=null,this.c_=new pt,this.yl=e,this.$i=t,this.d_=new Ef(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 i=me(A[0].Dt());i.$h(e.overlayPriceScales),e.localization&&i.Ra()}}}w_(e){switch(e){case"left":return this.f_;case"right":return this.p_}return this.o_.has(e)?_t(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 i=A!==void 0?A:this.C_().y_+1;this.T_(e,t,i)}Zo(e){const t=this.po.indexOf(e);_A(t!==-1,"removeDataSource: invalid data source"),this.po.splice(t,1);const A=me(e.Dt()).Pa();if(this.o_.has(A)){const n=_t(this.o_.get(A)),s=n.indexOf(e);s!==-1&&(n.splice(s,1),n.length===0&&this.o_.delete(A))}const i=e.Dt();i&&i.Ba().indexOf(e)>=0&&i.Zo(e),i!==null&&(i.Yo(),this.P_(i)),this.mo=null}mr(e){return e===this.f_?"left":e===this.p_?"right":"overlay"}R_(){return this.f_}D_(){return this.p_}V_(e,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 i=0;i<e.length;i++){const n=e[i].Xi();n!==null&&(n<t&&(t=n),n>A&&(A=n))}return{H_:t,y_:A}}T_(e,t,A){let i=this.w_(t);if(i===null&&(i=this.v_(t,this.$i.W().overlayPriceScales)),this.po.push(e),!Hi(t)){const n=this.o_.get(t)||[];n.push(e),this.o_.set(t,n)}i.qo(e),e.Gi(i),e.Ki(A),this.P_(i),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},FA(t)),i=new Lf(e,A,this.$i.W().layout,this.$i.W().localization);return i.Lo(this.At()),i}}class If{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),i=this.tr.get(A);if(i!==void 0)return i.Z_;if(this.Ke===this.ir){const s=this.Qe.get(this.Je);this.Qe.delete(this.Je),this.tr.delete(_t(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 Gr{constructor(e,t){_A(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 Sl(r,e){return r===null||e===null?r===e:r.Ch(e)}class _f{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 i=e[A];let n=this.J_.get(i.timeWeight);n===void 0&&(n=[],this.J_.set(i.timeWeight,n)),n.push({index:A,time:i.time,weight:i.timeWeight,originalTime:i.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,i)=>{e<=A[0].index?t.push(i):A.splice(Or(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(((i,n)=>n-i))){if(!this.J_.get(A))continue;const i=t;t=[];const n=i.length;let s=0;const o=_t(this.J_.get(A)),a=o.length;let c=1/0,h=-1/0;for(let d=0;d<a;d++){const m=o[d],T=m.index;for(;s<n;){const v=i[s],B=v.index;if(!(B<T)){c=B;break}s++,t.push(v),h=B,c=1/0}if(c-T>=e&&T-h>=e)t.push(m),h=T;else if(this.Q_)return i}for(;s<n;s++)t.push(i[s])}return t}}class pr{constructor(e){this.hu=e}lu(){return this.hu===null?null:new Gr(Math.floor(this.hu.Os()),Math.ceil(this.hu.ui()))}au(){return this.hu}static ou(){return new pr(null)}}function Df(r,e){return r.weight>e.weight?r:e}class kf{constructor(e,t,A,i){this.__=0,this._u=null,this.uu=[],this.Mo=null,this.wo=null,this.cu=new _f,this.du=new Map,this.fu=pr.ou(),this.vu=!0,this.pu=new pt,this.mu=new pt,this.bu=new pt,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_=i,this.ku(),this.cu.tu(t.uniformDistribution)}W(){return this.cn}yu(e){aA(this.yo,e),this.Cu(),this.ku()}$h(e,t){var A;aA(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=Or(this.uu,this.q_.key(e),((i,n)=>this.q_.key(i.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),i=me(this.Bu()),n=me(this.Au());return{from:me(this.Ui(Math.max(i,t))),to:me(this.Ui(Math.min(n,A)))}}Iu(e){return{from:me(this.Va(e.from,!0)),to:me(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 i=this.Su*e/A;this.Su=i}if(this.cn.fixLeftEdge&&t!==null&&t.Os()<=0){const i=A-e;this.xu-=Math.round(i/this.Su)+1,this.vu=!0}this.zu(),this.Lu()}It(e){if(this.Ni()||!_r(e))return 0;const t=this.Eu()+this.xu-e;return this.__-(t+.5)*this.Su-1}Qs(e,t){const A=this.Eu(),i=t===void 0?0:t.from,n=t===void 0?e.length:t.to;for(let s=i;s<n;s++){const o=e[s].ot,a=A+this.xu-o,c=this.__-(a+.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),i=me(this.Xs()),n=Math.max(i.Os(),i.Os()-A),s=Math.max(i.ui(),i.ui()-A),o=this.cu.su(e,t),a=this.Bu()+A,c=this.Au()-A,h=this.$u(),d=this.cn.fixLeftEdge||h,m=this.cn.fixRightEdge||h;let T=0;for(const v of o){if(!(n<=v.index&&v.index<=s))continue;let B;T<this.Mu.length?(B=this.Mu[T],B.coord=this.It(v.index),B.label=this.Uu(v),B.weight=v.weight):(B={needAlignCoordinate:!1,coord:this.It(v.index),label:this.Uu(v),weight:v.weight},this.Mu.push(B)),this.Su>t/2&&!h?B.needAlignCoordinate=!1:B.needAlignCoordinate=d&&v.index<=a||m&&v.index>=c,T++}return this.Mu.length=T,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),i=this.le(),n=i+t*(i/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.__-me(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=me(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,i=performance.now();this.$i.Zn({Qu:n=>(n-i)/t>=1,tc:n=>{const s=(n-i)/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 Gr(e,t+this.cn.rightOffset))}lc(e){const t=new Gr(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(pr.ou());const e=this.Eu(),t=this.__/this.Su,A=this.xu+e,i=new Gr(A-t+1,A);this._c(new pr(i))}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 If((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,Sl(t.lu(),this.fu.lu())||this.pu.m(),Sl(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 i=this.xu-A-1;this.Jn(i)}this.zu()}Pu(){this.Lu(),this.zu()}}class Of{X(e,t,A){e.useMediaCoordinateSpace((i=>this.K(i,t,A)))}gl(e,t,A){e.useMediaCoordinateSpace((i=>this.vc(i,t,A)))}vc(e,t,A){}}class Nf extends Of{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 i=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,i+=s.gc*s.Zu}let n=0;switch(this.zt.Mc){case"top":n=0;break;case"center":n=Math.max((A.height-i)/2,0);break;case"bottom":n=Math.max(A.height-i,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 i=A.get(t);return i===void 0&&(i=e.measureText(t).width,A.set(t,i)),i}kc(e){let t=this.mc.get(e);return t===void 0&&(t=new Map,this.mc.set(e,t)),t}}class Kf{constructor(e){this.ft=!0,this.Ft={yt:!1,V:"",bc:[],Mc:"center",xc:"center"},this.Wt=new Nf(this.Ft),this.jt=e}bt(){this.ft=!0}gt(){return this.ft&&(this.Mt(),this.ft=!1),this.Wt}Mt(){const e=this.jt.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:ur(e.fontSize,e.fontFamily,e.fontStyle),gc:1.2*e.fontSize,Sc:0,Zu:0}])}}class Pf extends fs{constructor(e,t){super(),this.cn=t,this.wn=new Kf(this)}Rn(){return[]}Pn(){return[this.wn]}W(){return this.cn}Vn(){this.wn.bt()}}var Hl,Ll,Ml,Il,_l;(function(r){r[r.OnTouchEnd=0]="OnTouchEnd",r[r.OnNextTap=1]="OnNextTap"})(Hl||(Hl={}));class Vf{constructor(e,t,A){this.yc=[],this.Cc=[],this.__=0,this.Tc=null,this.Pc=new pt,this.Rc=new pt,this.Dc=null,this.Vc=e,this.cn=t,this.q_=A,this.Oc=new Bp(this),this.yl=new kf(this,t.timeScale,this.cn.localization,A),this.vt=new Sp(this,t.crosshair),this.Bc=new Qf(t.crosshair),this.Ac=new Pf(this,t.watermark),this.Ic(),this.yc[0].x_(2e3),this.zc=this.Lc(0),this.Ec=this.Lc(1)}Kl(){this.Nc(xt.es())}Uh(){this.Nc(xt.ss())}oa(){this.Nc(new xt(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){aA(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 Mf(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,i=xt.es();return i.Nn(A,{Fn:0,Wn:!0}),this.Nc(i),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 i=A.Hi();e=Math.max(1,Math.min(e,i)),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,i,n){this.vt.gn(e,t);let s=NaN,o=this.yl.Nu(e);const a=this.yl.Xs();a!==null&&(o=Math.min(Math.max(a.Os(),o),a.ui()));const c=i.vn(),h=c.Ct();h!==null&&(s=c.pn(t,h)),s=this.Bc.Oa(s,o,i),this.vt.kn(o,s,i),this.oa(),n||this.Rc.m(this.vt.xt(),{x:e,y:t},A)}ad(e,t,A){const i=A.vn(),n=i.Ct(),s=i.Rt(e,me(n)),o=this.yl.Va(t,!0),a=this.yl.It(me(o));this.ld(a,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 i=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&&i!==null&&n!==null){const a=o.Kr(s),c=this.q_.key(i)>this.q_.key(n),h=e!==null&&e>s&&!c,d=this.yl.W().allowShiftVisibleRangeOnWhitespaceReplacement,m=a&&(A!==void 0||d)&&this.yl.W().shiftVisibleRangeOnNewBar;if(h&&!m){const T=e-s;this.yl.Jn(this.yl.Hu()-T)}}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 i=this.yc[0],n=this.fd(t,e,i,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);_A(A!==-1,"Series not found"),this.Cc.splice(A,1),me(t).Zo(e),e.S&&e.S()}Xl(e,t){const A=me(this.dr(e));A.Zo(e);const i=this.Uc(t);if(i===null){const n=e.Xi();A.qo(e,t,n)}else{const n=i.Ht===A?e.Xi():void 0;i.Ht.qo(e,t,n)}}hc(){const e=xt.ss();e.$n(),this.Nc(e)}pd(e){const t=xt.ss();t.Yn(e),this.Nc(t)}Kn(){const e=xt.ss();e.Kn(),this.Nc(e)}Gn(e){const t=xt.ss();t.Gn(e),this.Nc(t)}Jn(e){const t=xt.ss();t.Jn(e),this.Nc(t)}Zn(e){const t=xt.ss();t.Zn(e),this.Nc(t)}Un(){const e=xt.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 i=(function(n,s,o){const[a,c,h,d]=Ir(n),[m,T,v,B]=Ir(s),y=[tA(a+o*(m-a)),tA(c+o*(T-c)),tA(h+o*(v-h)),$a(d+o*(B-d))];return`rgba(${y[0]}, ${y[1]}, ${y[2]}, ${y[3]})`})(A,t,e/100);return this.Dc.wd.set(e,i),i}Gc(e,t){const A=new xt(t);if(e!==null){const i=this.yc.indexOf(e);A.Nn(i,{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,i){const n=new xs(this,e,t,A,i),s=e.priceScaleId!==void 0?e.priceScaleId:this.md();return A.qo(n,s),Hi(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 Es(r){return!mA(r)&&!Dr(r)}function Dl(r){return mA(r)}(function(r){r[r.Disabled=0]="Disabled",r[r.Continuous=1]="Continuous",r[r.OnDataUpdate=2]="OnDataUpdate"})(Ll||(Ll={})),(function(r){r[r.LastBar=0]="LastBar",r[r.LastVisible=1]="LastVisible"})(Ml||(Ml={})),(function(r){r.Solid="solid",r.VerticalGradient="gradient"})(Il||(Il={})),(function(r){r[r.Year=0]="Year",r[r.Month=1]="Month",r[r.DayOfMonth=2]="DayOfMonth",r[r.Time=3]="Time",r[r.TimeWithSeconds=4]="TimeWithSeconds"})(_l||(_l={}));const kl=r=>r.getUTCFullYear();function zf(r,e,t){return e.replace(/yyyy/g,(A=>UA(kl(A),4))(r)).replace(/yy/g,(A=>UA(kl(A)%100,2))(r)).replace(/MMMM/g,((A,i)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(i,{month:"long"}))(r,t)).replace(/MMM/g,((A,i)=>new Date(A.getUTCFullYear(),A.getUTCMonth(),1).toLocaleString(i,{month:"short"}))(r,t)).replace(/MM/g,(A=>UA((i=>i.getUTCMonth()+1)(A),2))(r)).replace(/dd/g,(A=>UA((i=>i.getUTCDate())(A),2))(r))}class Ol{constructor(e="yyyy-MM-dd",t="default"){this.gd=e,this.Md=t}Y_(e){return zf(e,this.gd,this.Md)}}class Wf{constructor(e){this.xd=e||"%h:%m:%s"}Y_(e){return this.xd.replace("%h",UA(e.getUTCHours(),2)).replace("%m",UA(e.getUTCMinutes(),2)).replace("%s",UA(e.getUTCSeconds(),2))}}const Gf={Sd:"yyyy-MM-dd",kd:"%h:%m:%s",yd:" ",Cd:"default"};class Rf{constructor(e={}){const t=Object.assign(Object.assign({},Gf),e);this.Td=new Ol(t.Sd,t.Cd),this.Pd=new Wf(t.kd),this.Rd=t.yd}Y_(e){return`${this.Td.Y_(e)}${this.Rd}${this.Pd.Y_(e)}`}}function Ni(r){return 60*r*60*1e3}function Ss(r){return 60*r*1e3}const Ki=[{Dd:(Nl=1,1e3*Nl),Vd:10},{Dd:Ss(1),Vd:20},{Dd:Ss(5),Vd:21},{Dd:Ss(30),Vd:22},{Dd:Ni(1),Vd:30},{Dd:Ni(3),Vd:31},{Dd:Ni(6),Vd:32},{Dd:Ni(12),Vd:33}];var Nl;function Kl(r,e){if(r.getUTCFullYear()!==e.getUTCFullYear())return 70;if(r.getUTCMonth()!==e.getUTCMonth())return 60;if(r.getUTCDate()!==e.getUTCDate())return 50;for(let t=Ki.length-1;t>=0;--t)if(Math.floor(e.getTime()/Ki[t].Dd)!==Math.floor(r.getTime()/Ki[t].Dd))return Ki[t].Vd;return 0}function Hs(r){let e=r;if(Dr(r)&&(e=Ls(r)),!Es(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 Pl(r){if(!Dl(r))throw new Error("time must be of type isUTCTimestamp");return{Od:r}}function Ls(r){const e=new Date(r);if(isNaN(e.getTime()))throw new Error(`Invalid date string=${r}, expected format=yyyy-mm-dd`);return{day:e.getUTCDate(),month:e.getUTCMonth()+1,year:e.getUTCFullYear()}}function Vl(r){Dr(r.time)&&(r.time=Ls(r.time))}class zl{options(){return this.cn}setOptions(e){this.cn=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?(function(t){t.forEach(Vl)})(e):Vl(e)}createConverterToInternalObj(e){return me((function(t){return t.length===0?null:Es(t[0].time)||Dr(t[0].time)?Hs:Pl})(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 Dl(t=e)?Pl(t):Es(t)?Hs(t):Hs(Ls(t));var t}updateFormatter(e){if(!this.cn)return;const t=e.dateFormat;this.cn.timeScale.timeVisible?this.Ad=new Rf({Sd:t,kd:this.cn.timeScale.secondsVisible?"%h:%m:%s":"%h:%m",yd:" ",Cd:e.locale}):this.Ad=new Ol(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),i=this.cn.timeScale;if(i.tickMarkFormatter!==void 0){const n=i.tickMarkFormatter(e.originalTime,A,t.locale);if(n!==null)return n}return(function(n,s,o){const a={};switch(s){case 0:a.year="numeric";break;case 1:a.month="short";break;case 2:a.day="numeric";break;case 3:a.hour12=!1,a.hour="2-digit",a.minute="2-digit";break;case 4:a.hour12=!1,a.hour="2-digit",a.minute="2-digit",a.second="2-digit"}const 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,a)})(e.time,A,t.locale)}maxTickMarkWeight(e){let t=e.reduce(Df,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(A,i=0){if(A.length===0)return;let n=i===0?null:A[i-1].time.Od,s=n!==null?new Date(1e3*n):null,o=0;for(let a=i;a<A.length;++a){const c=A[a],h=new Date(1e3*c.time.Od);s!==null&&(c.timeWeight=Kl(h,s)),o+=c.time.Od-(n||c.time.Od),n=c.time.Od,s=h}if(i===0&&A.length>1){const a=Math.ceil(o/(A.length-1)),c=new Date(1e3*(A[0].time.Od-a));A[0].timeWeight=Kl(new Date(1e3*A[0].time.Od),c)}})(e,t)}static Id(e){return aA({localization:{dateFormat:"dd MMM 'yy"}},e??{})}}const fr=typeof window<"u";function Wl(){return!!fr&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function Ms(){return!!fr&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Is(r){return r+r%2}function _s(r,e){return r.zd-e.zd}function Ds(r,e,t){const A=(r.zd-e.zd)/(r.ot-e.ot);return Math.sign(A)*Math.min(Math.abs(A),t)}class $f{constructor(e,t,A,i){this.Ld=null,this.Ed=null,this.Nd=null,this.Fd=null,this.Wd=null,this.jd=0,this.Hd=0,this.$d=e,this.Ud=t,this.qd=A,this.rs=i}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 i=Ds(this.Ld,this.Ed,this.Ud),n=_s(this.Ld,this.Ed),s=[i],o=[n];if(A+=n,this.Nd!==null){const c=Ds(this.Ed,this.Nd,this.Ud);if(Math.sign(c)===Math.sign(i)){const h=_s(this.Ed,this.Nd);if(s.push(c),o.push(h),A+=h,this.Fd!==null){const d=Ds(this.Nd,this.Fd,this.Ud);if(Math.sign(d)===Math.sign(i)){const m=_s(this.Nd,this.Fd);s.push(d),o.push(m),A+=m}}}}let a=0;for(let c=0;c<s.length;++c)a+=o[c]/A*s[c];Math.abs(a)<this.$d||(this.Wd={zd:e,ot:t},this.Hd=a,this.jd=(function(c,h){const d=Math.log(h);return Math.log(1*d/-c)/d})(Math.abs(a),this.qd))}tc(e){const t=me(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-me(this.Wd).ot;return Math.min(t,this.jd)}}class Xf{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 Xa(Ir(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 jA(r,e){const t=me(r.ownerDocument).createElement("canvas");r.appendChild(t);const A=ip(t,{options:{allowResizeObserver:!1},transform:(i,n)=>({width:Math.max(i.width,n.width),height:Math.max(i.height,n.height)})});return A.resizeCanvasElement(e),A}function er(r){var e;r.width=1,r.height=1,(e=r.getContext("2d"))===null||e===void 0||e.clearRect(0,0,1,1)}function ks(r,e,t,A){r.gl&&r.gl(e,t,A)}function Pi(r,e,t,A){r.X(e,t,A)}function Os(r,e,t,A){const i=r(t,A);for(const n of i){const s=n.gt();s!==null&&e(s)}}function Zf(r){fr&&window.chrome!==void 0&&r.addEventListener("mousedown",(e=>{if(e.button===1)return e.preventDefault(),!1}))}class Ns{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=!Ms(),this.Af=i=>{this.If(i)},this.zf=i=>{if(this.Lf(i)){const n=this.Ef(i);if(++this._f,this.uf&&this._f>1){const{Nf:s}=this.Ff(gA(i),this.cf);s<30&&!this.wf&&this.Wf(n,this.Hf.jf),this.$f()}}else{const n=this.Ef(i);if(++this.hf,this.lf&&this.hf>1){const{Nf:s}=this.Ff(gA(i),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=Ks(e.changedTouches,me(this.Of));if(t===null||(this.Vf=Vi(e),this.Cf!==null)||this.Rf)return;this.Pf=!0;const A=this.Ff(gA(t),me(this.pf)),{nv:i,sv:n,Nf:s}=A;if(this.mf||!(s<5)){if(!this.mf){const o=.5*i,a=n>=o&&!this.cn.ev(),c=o>n&&!this.cn.rv();a||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),mr(e)}}}lv(e){if(e.button!==0)return;const t=this.Ff(gA(e),me(this.vf)),{Nf:A}=t;if(A>=5&&(this.bf=!0,this.Yf()),this.bf){const i=this.Ef(e);this.Uf(i,this.Hf.av)}}Ff(e,t){const A=Math.abs(t.nt-e.nt),i=Math.abs(t.st-e.st);return{nv:A,sv:i,Nf:A+i}}ov(e){let t=Ks(e.changedTouches,me(this.Of));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Of=null,this.Vf=Vi(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:i}=this.Ff(gA(t),this.cf);i<30&&!this.wf&&this.Wf(A,this.Hf.jf),this.$f()}else this.wf||(this.Wf(A,this.Hf.uv),this.Hf.uv&&mr(e));this._f===0&&mr(e),e.touches.length===0&&this.ff&&(this.ff=!1,mr(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),Wl()&&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(gA(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=Vi(e);const A=this.Zf.ownerDocument.documentElement;this.wf=!1,this.mf=!1,this.Rf=!1,this.pf=gA(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 i=this.Ef(e,t);this.Wf(i,this.Hf.pv),this.uf||(this._f=0,this.uf=setTimeout(this.$f.bind(this),500),this.cf=gA(t))}mv(e){if(e.button!==0)return;const t=this.Zf.ownerDocument.documentElement;Wl()&&t.addEventListener("mouseleave",this.Af),this.bf=!1,this.vf=gA(e),this.kf&&(this.kf(),this.kf=null);{const i=this.lv.bind(this),n=this.If.bind(this);this.kf=()=>{t.removeEventListener("mousemove",i),t.removeEventListener("mouseup",n)},t.addEventListener("mousemove",i),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=gA(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})}Ms()&&(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}),Zf(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=Gl(e.touches[0],e.touches[1])/this.Tf;this.Hf.Sv(this.Cf,t),mr(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=Gl(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=!Ms()}vv(e){const t=Ks(e.touches,me(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:Vi(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,i=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-i.left,localY:A.clientY-i.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Dv:!e.type.startsWith("mouse")&&e.type!=="contextmenu"&&e.type!=="click",Vv:e.type,Ov:A.target,Bv:e.view,Av:()=>{e.type!=="touchstart"&&mr(e)}}}}function Gl(r,e){const t=r.clientX-e.clientX,A=r.clientY-e.clientY;return Math.sqrt(t*t+A*A)}function mr(r){r.cancelable&&r.preventDefault()}function gA(r){return{nt:r.pageX,st:r.pageY}}function Vi(r){return r.timeStamp||performance.now()}function Ks(r,e){for(let t=0;t<r.length;++t)if(r[t].identifier===e)return r[t];return null}function zi(r){return{Hc:r.Hc,Iv:{gr:r.zv.externalId},Lv:r.zv.cursorStyle}}function Jf(r,e,t){for(const A of r){const i=A.gt();if(i!==null&&i.wr){const n=i.wr(e,t);if(n!==null)return{Bv:A,Iv:n}}}return null}function Ps(r,e){return t=>{var A,i,n,s;return((i=(A=t.Dt())===null||A===void 0?void 0:A.Pa())!==null&&i!==void 0?i:"")!==e?[]:(s=(n=t.da)===null||n===void 0?void 0:n.call(t,r))!==null&&s!==void 0?s:[]}}function Rl(r,e,t,A){if(!r.length)return;let i=0;const n=t/2,s=r[0].At(A,!0);let o=e===1?n-(r[0].Vi()-s/2):r[0].Vi()-s/2-n;o=Math.max(0,o);for(let a=1;a<r.length;a++){const c=r[a],h=r[a-1],d=h.At(A,!1),m=c.Vi(),T=h.Vi();if(e===1?m>T-d:m<T+d){const v=T-d*e;c.Oi(v);const B=v-e*d/2;if((e===1?B<0:B>t)&&o>0){const y=e===1?-1-B:B-t,D=Math.min(y,o);for(let E=i;E<r.length;E++)r[E].Oi(r[E].Vi()+e*D);o-=D}}else i=a,o=e===1?T-d-m:m-(T+d)}}class $l{constructor(e,t,A,i){this.Li=null,this.Ev=null,this.Nv=!1,this.Fv=new Nr(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=i==="left",this.Yv=Ps("normal",i),this.Zv=Ps("top",i),this.Xv=Ps("bottom",i),this.Kv=document.createElement("div"),this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Kv.style.width="25px",this.Kv.style.left="0",this.Kv.style.position="relative",this.Gv=jA(this.Kv,ot({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=jA(this.Kv,ot({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 Ns(this.Jv.canvasElement,o,{ev:()=>!this.cn.handleScroll.vertTouchDrag,rv:()=>!0})}S(){this.hp.S(),this.Jv.unsubscribeSuggestedBitmapSizeChanged(this.Uv),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(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=me(this.Gv.canvasElement.getContext("2d"));A.save();const i=this.Li.Ha();A.font=this._p(),i.length>0&&(e=Math.max(this.Fv.xi(A,i[0].so),this.Fv.xi(A,i[i.length-1].so)));const n=this.up();for(let c=n.length;c--;){const h=this.Fv.xi(A,n[c].Kt());h>e&&(e=h)}const s=this.Li.Ct();if(s!==null&&this.Ev!==null&&(o=this.cn.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){const c=this.Li.pn(1,s),h=this.Li.pn(this.Ev.height-2,s);e=Math.max(e,this.Fv.xi(A,this.Li.Fi(Math.floor(Math.min(c,h))+.11111111111111,s)),this.Fv.xi(A,this.Li.Fi(Math.ceil(Math.max(c,h))-.11111111111111,s)))}var o;A.restore();const a=e||34;return Is(Math.ceil(t.C+t.T+t.A+t.I+5+a))}cp(e){this.Ev!==null&&JA(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 me(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,me(this.Dt()))}vp(e){if(this.Ev===null)return;if(e!==1){this.pp(),this.Gv.applySuggestedBitmapSize();const A=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i)})),this.tn.bp(A,this.Xv),this.wp(A),this.tn.bp(A,this.Yv),this.gp(A))}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.Mp(t),this.tn.bp(t,this.Zv))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const i=this.xp();i.width>0&&i.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(),i=this.Li;t.O_(A,i,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 i=0;i<A.length;++i){const n=A[i].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:i}=t,n=this.tn.fp().$t(),s=n.q(),o=n.bd();s===o?Ei(e,0,0,A,i,s):qa(e,0,0,A,i,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 i=Math.max(1,Math.floor(this.ap().C*A));let n;n=this.qv?t.width-i:0,e.fillRect(n,0,i,t.height)}wp(e){if(this.Ev===null||this.Li===null)return;const t=this.Li.Ha(),A=this.Li.W(),i=this.ap(),n=this.qv?this.Ev.width-i.T:0;A.borderVisible&&A.ticksVisible&&e.useBitmapCoordinateSpace((({context:s,horizontalPixelRatio:o,verticalPixelRatio:a})=>{s.fillStyle=A.borderColor;const c=Math.max(1,Math.floor(a)),h=Math.floor(.5*a),d=Math.round(i.T*o);s.beginPath();for(const m of t)s.rect(Math.floor(n*o),Math.round(m.Ea*a)-h,d,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 a=this.qv?Math.round(n-i.A):Math.round(n+i.T+i.A),c=t.map((h=>this.Fv.Mi(s,h.so)));for(let h=t.length;h--;){const d=t[h];s.fillText(d.so,a,d.Ea+c[h])}}))}pp(){if(this.Ev===null||this.Li===null)return;const e=[],t=this.Li.Uo().slice(),A=this.tn.fp(),i=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,i)}yp(e,t){if(this.Ev===null)return;const A=this.Ev.height/2,i=e.filter((s=>s.ki()<=A)),n=e.filter((s=>s.ki()>A));i.sort(((s,o)=>o.ki()-s.ki())),n.sort(((s,o)=>s.ki()-o.ki()));for(const s of e){const o=Math.floor(s.At(t)/2),a=s.ki();a>-o&&a<o&&s.Oi(o),a>this.Ev.height-o&&a<this.Ev.height+o&&s.Oi(this.Ev.height-o)}Rl(i,1,this.Ev.height,t),Rl(n,-1,this.Ev.height,t)}gp(e){if(this.Ev===null)return;const t=this.up(),A=this.ap(),i=this.qv?"right":"left";t.forEach((n=>{n.Ai()&&n.gt(me(this.Li)).X(e,A,this.Fv,i)}))}Mp(e){if(this.Ev===null||this.Li===null)return;const t=this.tn.$v().$t(),A=[],i=this.tn.fp(),n=t.Zc().Rn(i,this.Li);n.length&&A.push(n);const s=this.ap(),o=this.qv?"right":"left";A.forEach((a=>{a.forEach((c=>{c.gt(me(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 ur(this.ko.fontSize,this.ko.fontFamily)}}function qf(r,e){var t,A;return(A=(t=r.ua)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function Wi(r,e){var t,A;return(A=(t=r.Pn)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function Yf(r,e){var t,A;return(A=(t=r.Ji)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}function jf(r,e){var t,A;return(A=(t=r.aa)===null||t===void 0?void 0:t.call(r,e))!==null&&A!==void 0?A:[]}class Vs{constructor(e,t){this.Ev=ot({width:0,height:0}),this.Cp=null,this.Tp=null,this.Pp=null,this.Rp=null,this.Dp=!1,this.Vp=new pt,this.Op=new pt,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=jA(A,ot({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv);const i=this.Gv.canvasElement;i.style.position="absolute",i.style.zIndex="1",i.style.left="0",i.style.top="0",this.Jv=jA(A,ot({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 Ns(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),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(this.Gv.canvasElement),this.Gv.dispose(),this.Np!==null&&this.Np.W_().p(this),this.hp.S()}fp(){return me(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(Vs.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 Xf(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(me(e))}if(this.Tp!==null){const e=this.Np.D_();this.Tp.Gi(me(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,i=e.localY;this.Gp(A,i,e);const n=this.wr(A,i);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 i=me(this.Lp),n=i.x+(t-this.Ip.x),s=i.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(i,n,s){const o=i.Uo(),a=(function(c,h,d){var m,T;let v,B;for(const E of c){const N=(T=(m=E.va)===null||m===void 0?void 0:m.call(E,h,d))!==null&&T!==void 0?T:[];for(const S of N)y=S.zOrder,(!(D=v?.zOrder)||y==="top"&&D!=="top"||y==="normal"&&D==="bottom")&&(v=S,B=E)}var y,D;return v&&B?{zv:v,Hc:B}:null})(o,n,s);if(a?.zv.zOrder==="top")return zi(a);for(const c of o){if(a&&a.Hc===c&&a.zv.zOrder!=="bottom"&&!a.zv.isBackground)return zi(a);const h=Jf(c.Pn(i),n,s);if(h!==null)return{Hc:c,Bv:h.Bv,Iv:h.Iv};if(a&&a.Hc===c&&a.zv.zOrder!=="bottom"&&a.zv.isBackground)return zi(a)}return a?.zv?zi(a):null})(A,e,t)}_m(e,t){me(t==="left"?this.Cp:this.Tp).cp(ot({width:e,height:this.Ev.height}))}um(){return this.Ev}cp(e){JA(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=me(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 i=this.xp();i.width>0&&i.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=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i)})),this.Np&&(this.fm(A,qf),this.vm(A),this.pm(A),this.fm(A,Wi),this.fm(A,Yf)))}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.bm(t),this.fm(t,jf))}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,i=t.localY;e.M()&&e.m(this.$i().St().Nu(A),{x:A,y:i},t)}mp({context:e,bitmapSize:t}){const{width:A,height:i}=t,n=this.$i(),s=n.q(),o=n.bd();s===o?Ei(e,0,0,A,i,o):qa(e,0,0,A,i,s,o)}vm(e){const t=me(this.Np).j_().qh().gt();t!==null&&t.X(e,!1)}pm(e){const t=this.$i().Yc();this.Mm(e,Wi,ks,t),this.Mm(e,Wi,Pi,t)}bm(e){this.Mm(e,Wi,Pi,this.$i().Zc())}fm(e,t){const A=me(this.Np).Uo();for(const i of A)this.Mm(e,t,ks,i);for(const i of A)this.Mm(e,t,Pi,i)}Mm(e,t,A,i){const n=me(this.Np),s=n.$t().Wc(),o=s!==null&&s.Hc===i,a=s!==null&&o&&s.Iv!==void 0?s.Iv.Mr:void 0;Os(t,(c=>A(c,e,o,a)),i,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 i=e.$t().ud();t&&this.Cp===null&&(this.Cp=new $l(this,e.W(),i,"left"),this.jp.appendChild(this.Cp.lp())),A&&this.Tp===null&&(this.Tp=new $l(this,e.W(),i,"right"),this.Hp.appendChild(this.Tp.lp()))}xm(e){return e.Dv&&this.Ap||this.Ip!==null}Sm(e){return Math.max(0,Math.min(e,this.Ev.width-1))}km(e){return Math.max(0,Math.min(e,this.Ev.height-1))}Gp(e,t,A){this.$i().ld(this.Sm(e),this.km(t),A,me(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 i=this.$i().Zc();this.Lp={x:i.Yt(),y:i.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 i=performance.now(),n=t.St();this.Ep.Vr(n.Hu(),i),this.Ep.Qu(i)||t.Zn(this.Ep)}}Kp(){this.Ip=null}Jp(){if(this.Np){if(this.$i().Un(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)me(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 i=this.Qd.W(),n=i.handleScroll,s=i.kineticScroll;if((!n.pressedMouseMove||e.Dv)&&(!n.horzTouchDrag&&!n.vertTouchDrag||!e.Dv))return;const o=this.Np.vn(),a=performance.now();if(this.Rp!==null||this.xm(e)||(this.Rp={x:e.clientX,y:e.clientY,Od:a,ym:e.localX,Cm:e.localY}),this.Rp!==null&&!this.Dp&&(this.Rp.x!==e.clientX||this.Rp.y!==e.clientY)){if(e.Dv&&s.touch||!e.Dv&&s.mouse){const c=A.le();this.Ep=new $f(.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(),a))}}class Xl{constructor(e,t,A,i,n){this.ft=!0,this.Ev=ot({width:0,height:0}),this.Hv=()=>this.vp(3),this.qv=e==="left",this.Oc=A.ud,this.cn=t,this.Tm=i,this.Pm=n,this.Kv=document.createElement("div"),this.Kv.style.width="25px",this.Kv.style.height="100%",this.Kv.style.overflow="hidden",this.Gv=jA(this.Kv,ot({width:16,height:16})),this.Gv.subscribeSuggestedBitmapSizeChanged(this.Hv)}S(){this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(this.Gv.canvasElement),this.Gv.dispose()}lp(){return this.Kv}um(){return this.Ev}cp(e){JA(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=qA(this.Gv);t!==null&&t.useBitmapCoordinateSpace((A=>{this.mp(A),this.Ie(A)}))}xp(){return this.Gv.bitmapSize}Sp(e,t,A){const i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}Ie({context:e,bitmapSize:t,horizontalPixelRatio:A,verticalPixelRatio:i}){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*i),o=this.qv?t.width-n:0;e.fillRect(o,0,n,s)}mp({context:e,bitmapSize:t}){Ei(e,0,0,t.width,t.height,this.Pm())}}function zs(r){return e=>{var t,A;return(A=(t=e.fa)===null||t===void 0?void 0:t.call(e,r))!==null&&A!==void 0?A:[]}}const e0=zs("normal"),t0=zs("top"),A0=zs("bottom");class r0{constructor(e,t){this.Rm=null,this.Dm=null,this.k=null,this.Vm=!1,this.Ev=ot({width:0,height:0}),this.Om=new pt,this.Fv=new Nr(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=jA(this.Im,ot({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=jA(this.Im,ot({width:16,height:16})),this.Jv.subscribeSuggestedBitmapSizeChanged(this.Uv);const i=this.Jv.canvasElement;i.style.position="absolute",i.style.zIndex="2",i.style.left="0",i.style.top="0",this.Xd.appendChild(this.Bm),this.Xd.appendChild(this.Kv),this.Xd.appendChild(this.Am),this.zm(),this.Qd.$t().g_().l(this.zm.bind(this),this),this.hp=new Ns(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),er(this.Jv.canvasElement),this.Jv.dispose(),this.Gv.unsubscribeSuggestedBitmapSizeChanged(this.Hv),er(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){JA(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(ot({width:t,height:e.height})),this.Dm!==null&&this.Dm.cp(ot({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 i=this.xp();i.width>0&&i.height>0&&e.drawImage(this.Gv.canvasElement,t,A)}vp(e){if(e===0)return;if(e!==1){this.Gv.applySuggestedBitmapSize();const A=qA(this.Gv);A!==null&&(A.useBitmapCoordinateSpace((i=>{this.mp(i),this.Ie(i),this.$m(A,A0)})),this.wp(A),this.$m(A,e0)),this.Rm!==null&&this.Rm.vp(e),this.Dm!==null&&this.Dm.vp(e)}this.Jv.applySuggestedBitmapSize();const t=qA(this.Jv);t!==null&&(t.useBitmapCoordinateSpace((({context:A,bitmapSize:i})=>{A.clearRect(0,0,i.width,i.height)})),this.Um([...this.Qd.$t().wt(),this.Qd.$t().Zc()],t),this.$m(t,t0))}$m(e,t){const A=this.Qd.$t().wt();for(const i of A)Os(t,(n=>ks(n,e,!1,void 0)),i,void 0);for(const i of A)Os(t,(n=>Pi(n,e,!1,void 0)),i,void 0)}mp({context:e,bitmapSize:t}){Ei(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 i=Math.max(1,Math.floor(this.jm().C*A));e.fillRect(0,0,t.width,i)}}wp(e){const t=this.Qd.$t().St(),A=t.Ha();if(!A||A.length===0)return;const i=this.q_.maxTickMarkWeight(A),n=this.jm(),s=t.W();s.borderVisible&&s.ticksVisible&&e.useBitmapCoordinateSpace((({context:o,horizontalPixelRatio:a,verticalPixelRatio:c})=>{o.strokeStyle=this.qm(),o.fillStyle=this.qm();const h=Math.max(1,Math.floor(a)),d=Math.floor(.5*a);o.beginPath();const m=Math.round(n.T*c);for(let T=A.length;T--;){const v=Math.round(A[T].coord*a);o.rect(v-d,0,h,m)}o.fill()})),e.useMediaCoordinateSpace((({context:o})=>{const a=n.C+n.T+n.L+n.P/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle=this.$(),o.font=this._p();for(const c of A)if(c.weight<i){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,a)}this.Qd.W().timeScale.allowBoldLabels&&(o.font=this.Zm());for(const c of A)if(c.weight>=i){const h=c.needAlignCoordinate?this.Ym(o,c.coord,c.label):c.coord;o.fillText(c.label,h,a)}}))}Ym(e,t,A){const i=this.Fv.xi(e,A),n=i/2,s=Math.floor(t-n)+.5;return s<0?t+=Math.abs(0-s):s+i>this.Ev.width&&(t-=Math.abs(this.Ev.width-(s+i))),t}Um(e,t){const A=this.jm();for(const i of e)for(const n of i.Qi())n.gt().X(t,A)}qm(){return this.Qd.W().timeScale.borderColor}$(){return this.cn.textColor}j(){return this.cn.fontSize}_p(){return ur(this.j(),this.cn.fontFamily)}Zm(){return ur(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 Nr,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()},i=()=>t.leftPriceScale.borderVisible&&e.St().W().borderVisible,n=()=>e.bd();t.leftPriceScale.visible&&this.Rm===null&&(this.Rm=new Xl("left",t,A,i,n),this.Bm.appendChild(this.Rm.lp())),t.rightPriceScale.visible&&this.Dm===null&&(this.Dm=new Xl("right",t,A,i,n),this.Am.appendChild(this.Dm.lp()))}}const i0=!!fr&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((r=>r.brand.includes("Chromium")))&&!!fr&&(!((Ws=navigator?.userAgentData)===null||Ws===void 0)&&Ws.platform?navigator.userAgentData.platform==="Windows":navigator.userAgent.toLowerCase().indexOf("win")>=0);var Ws;class n0{constructor(e,t,A){var i;this.Xm=[],this.Km=0,this.ho=0,this.__=0,this.Gm=0,this.Jm=0,this.Qm=null,this.tb=!1,this.Vp=new pt,this.Op=new pt,this.Rc=new pt,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%",(i=this.Xd).style.userSelect="none",i.style.webkitUserSelect="none",i.style.msUserSelect="none",i.style.MozUserSelect="none",i.style.webkitTapHighlightColor="transparent",this.sb=document.createElement("table"),this.sb.setAttribute("cellspacing","0"),this.Xd.appendChild(this.sb),this.eb=this.rb.bind(this),Gs(this.cn)&&this.hb(!0),this.$i=new Vf(this.Vc.bind(this),this.cn,A),this.$t().Xc().l(this.lb.bind(this),this),this.ab=new r0(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 a=e.getBoundingClientRect();s=s||a.width,o=o||a.height}this._b(s,o),this.ub(),e.appendChild(this.Xd),this.cb(),this.$i.St().ec().l(this.$i.Kl.bind(this.$i),this),this.$i.g_().l(this.$i.Kl.bind(this.$i),this)}$t(){return this.$i}W(){return this.cn}Yp(){return this.Xm}fb(){return this.ab}S(){this.hb(!1),this.Km!==0&&window.cancelAnimationFrame(this.Km),this.$i.Xc().p(this),this.$i.St().ec().p(this),this.$i.g_().p(this),this.$i.S();for(const e of this.Xm)this.sb.removeChild(e.lp()),e.lm().p(this),e.am().p(this),e.S();this.Xm=[],me(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 i=(function(o){const a=Math.floor(o.width),c=Math.floor(o.height);return ot({width:a-a%2,height:c-c%2})})(ot({width:e,height:t}));this.ho=i.height,this.__=i.width;const n=this.ho+"px",s=this.__+"px";me(this.Xd).style.height=n,me(this.Xd).style.width=s,this.sb.style.height=n,this.sb.style.width=s,A?this.mb(xt.es(),performance.now()):this.$i.Kl()}vp(e){e===void 0&&(e=xt.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=Gs(this.cn);this.$i.$h(e);const A=Gs(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=me(t.getContext("2d"));return this.gb(A),t}Mb(e){return e==="left"&&!this.xb()||e==="right"&&!this.Sb()||this.Xm.length===0?0:me(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 _t(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 i=this.Xm[0],n=(o,a)=>{let c=0;for(let h=0;h<this.Xm.length;h++){const d=this.Xm[h],m=me(o==="left"?d.wm():d.gm()),T=m.xp();e!==null&&m.Sp(e,a,c),c+=T.height}};this.xb()&&(n("left",0),t+=me(i.wm()).xp().width);for(let o=0;o<this.Xm.length;o++){const a=this.Xm[o],c=a.xp();e!==null&&a.Sp(e,t,A),A+=c.height}t+=i.xp().width,this.Sb()&&(n("right",t),t+=me(i.gm()).xp().width);const s=(o,a,c)=>{me(o==="left"?this.ab.Lm():this.ab.Em()).Sp(me(e),a,c)};if(this.cn.timeScale.visible){const o=this.ab.xp();if(e!==null){let a=0;this.xb()&&(s("left",a,A),a=me(i.wm()).xp().width),this.ab.Sp(e,a,A),a+=o.width,this.Sb()&&s("right",a,A)}A+=o.height}return ot({width:t,height:A})}Pb(){let e=0,t=0,A=0;for(const v of this.Xm)this.xb()&&(t=Math.max(t,me(v.wm()).op(),this.cn.leftPriceScale.minimumWidth)),this.Sb()&&(A=Math.max(A,me(v.gm()).op(),this.cn.rightPriceScale.minimumWidth)),e+=v.M_();t=Is(t),A=Is(A);const i=this.__,n=this.ho,s=Math.max(i-t-A,0),o=this.cn.timeScale.visible;let a=o?Math.max(this.ab.Wm(),this.cn.timeScale.minimumHeight):0;var c;a=(c=a)+c%2;const h=0+a,d=n<h?0:n-h,m=d/e;let T=0;for(let v=0;v<this.Xm.length;++v){const B=this.Xm[v];B.qp(this.$i.qc()[v]);let y=0,D=0;D=v===this.Xm.length-1?d-T:Math.round(B.M_()*m),y=Math.max(D,2),T+=y,B.cp(ot({width:s,height:y})),this.xb()&&B._m(t,"left"),this.Sb()&&B._m(A,"right"),B.fp()&&this.$i.Kc(B.fp(),y)}this.ab.Fm(ot({width:o?s:0,height:a}),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 i0?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,i=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),i!==0&&this.cn.handleScale.mouseWheel){const n=Math.sign(i)*Math.min(1,Math.abs(i)),s=e.clientX-this.Xd.getBoundingClientRect().left;this.$t().Qc(s,n)}A!==0&&this.cn.handleScroll.mouseWheel&&this.$t().td(-80*A)}mb(e,t){var A;const i=e.jn();i===3&&this.Db(),i!==3&&i!==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 i of A.Qn())if(i.qn===5&&!i.Vt.Qu(t)){this.$t().Zn(i.Vt);break}}})))}Db(){this.ub()}ub(){const e=this.$i.qc(),t=e.length,A=this.Xm.length;for(let i=t;i<A;i++){const n=_t(this.Xm.pop());this.sb.removeChild(n.lp()),n.lm().p(this),n.am().p(this),n.S()}for(let i=A;i<t;i++){const n=new Vs(this,e[i]);n.lm().l(this.Bb.bind(this),this),n.am().l(this.Ab.bind(this),this),this.Xm.push(n),this.sb.insertBefore(n.lp(),this.ab.lp())}for(let i=0;i<t;i++){const n=e[i],s=this.Xm[i];s.fp()!==n?s.qp(n):s.Up()}this.cb(),this.Pb()}Ib(e,t,A){var i;const n=new Map;e!==null&&this.$i.wt().forEach((h=>{const d=h.In().ll(e);d!==null&&n.set(h,d)}));let s;if(e!==null){const h=(i=this.$i.St().Ui(e))===null||i===void 0?void 0:i.originalTime;h!==void 0&&(s=h)}const o=this.$t().Wc(),a=o!==null&&o.Hc instanceof xs?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:a,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 Gs(r){return!!(r.handleScroll.mouseWheel||r.handleScale.mouseWheel)}function s0(r){return(function(e){return e.open!==void 0})(r)||(function(e){return e.value!==void 0})(r)}function Zl(r,e){var t={};for(var A in r)Object.prototype.hasOwnProperty.call(r,A)&&e.indexOf(A)<0&&(t[A]=r[A]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function"){var i=0;for(A=Object.getOwnPropertySymbols(r);i<A.length;i++)e.indexOf(A[i])<0&&Object.prototype.propertyIsEnumerable.call(r,A[i])&&(t[A[i]]=r[A[i]])}return t}function Jl(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],zb:A};return t.color!==void 0&&(n.V=t.color),n}function o0(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],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 a0(r,e,t,A){const i=t.value,n={ee:e,ot:r,Vt:[i,i,i,i],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 l0(r,e,t,A){const i={ee:e,ot:r,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(i.V=t.color),i}function c0(r,e,t,A){const i={ee:e,ot:r,Vt:[t.open,t.high,t.low,t.close],zb:A};return t.color!==void 0&&(i.V=t.color),t.borderColor!==void 0&&(i.Ot=t.borderColor),t.wickColor!==void 0&&(i.Xh=t.wickColor),i}function h0(r,e,t,A,i){const n=_t(i)(t),s=Math.max(...n),o=Math.min(...n),a=n[n.length-1],c=[a,s,o,a],h=t,{time:d,color:m}=h;return{ee:e,ot:r,Vt:c,zb:A,$e:Zl(h,["time","color"]),V:m}}function Gi(r){return r.Vt!==void 0}function ql(r,e){return e.customValues!==void 0&&(r.jb=e.customValues),r}function tr(r){return(e,t,A,i,n,s)=>(function(o,a){return a?a(o):(c=o).open===void 0&&c.value===void 0;var c})(A,s)?ql({ot:e,ee:t,zb:i},A):ql(r(e,t,A,i,n),A)}function Yl(r){return{Candlestick:tr(c0),Bar:tr(l0),Area:tr(o0),Baseline:tr(a0),Histogram:tr(Jl),Line:tr(Jl),Custom:tr(h0)}[r]}function jl(r){return{ee:0,Hb:new Map,la:r}}function ec(r,e){if(r!==void 0&&r.length!==0)return{$b:e.key(r[0].ot),Ub:e.key(r[r.length-1].ot)}}function tc(r){let e;return r.forEach((t=>{e===void 0&&(e=t.zb)})),_t(e)}class u0{constructor(e){this.qb=new Map,this.Yb=new Map,this.Zb=new Map,this.Xb=[],this.q_=e}S(){this.qb.clear(),this.Yb.clear(),this.Zb.clear(),this.Xb=[]}Kb(e,t){let A=this.qb.size!==0,i=!1;const n=this.Yb.get(e);if(n!==void 0)if(this.Yb.size===1)A=!1,i=!0,this.qb.clear();else for(const a of this.Xb)a.pointData.Hb.delete(e)&&(i=!0);let s=[];if(t.length!==0){const a=t.map((T=>T.time)),c=this.q_.createConverterToInternalObj(t),h=Yl(e.Qh()),d=e.Ca(),m=e.Ta();s=t.map(((T,v)=>{const B=c(T.time),y=this.q_.key(B);let D=this.qb.get(y);D===void 0&&(D=jl(B),this.qb.set(y,D),i=!0);const E=h(B,D.ee,T,a[v],d,m);return D.Hb.set(e,E),E}))}A&&this.Gb(),this.Jb(e,s);let o=-1;if(i){const a=[];this.qb.forEach((c=>{a.push({timeWeight:0,time:c.la,pointData:c,originalTime:tc(c.Hb)})})),a.sort(((c,h)=>this.q_.key(c.time)-this.q_.key(h.time))),o=this.Qb(a)}return this.tw(e,o,(function(a,c,h){const d=ec(a,h),m=ec(c,h);if(d!==void 0&&m!==void 0)return{ta:d.Ub>=m.Ub&&d.$b>=m.$b}})(this.Yb.get(e),n,this.q_))}vd(e){return this.Kb(e,[])}iw(e,t){const A=t;(function(B){B.zb===void 0&&(B.zb=B.time)})(A),this.q_.preprocessData(t);const i=this.q_.createConverterToInternalObj([t])(t.time),n=this.Zb.get(e);if(n!==void 0&&this.q_.key(i)<this.q_.key(n))throw new Error(`Cannot update oldest data, last time=${n}, new time=${i}`);let s=this.qb.get(this.q_.key(i));const o=s===void 0;s===void 0&&(s=jl(i),this.qb.set(this.q_.key(i),s));const a=Yl(e.Qh()),c=e.Ca(),h=e.Ta(),d=a(i,s.ee,t,A.zb,c,h);s.Hb.set(e,d),this.nw(e,d);const m={ta:Gi(d)};if(!o)return this.tw(e,-1,m);const T={timeWeight:0,time:s.la,pointData:s,originalTime:tc(s.Hb)},v=Or(this.Xb,this.q_.key(T.time),((B,y)=>this.q_.key(B.time)<y));this.Xb.splice(v,0,T);for(let B=v;B<this.Xb.length;++B)Rs(this.Xb[B].pointData,B);return this.q_.fillWeightsForPoints(this.Xb,v),this.tw(e,v,m)}nw(e,t){let A=this.Yb.get(e);A===void 0&&(A=[],this.Yb.set(e,A));const i=A.length!==0?A[A.length-1]:null;i===null||this.q_.key(t.ot)>this.q_.key(i.ot)?Gi(t)&&A.push(t):Gi(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(Gi)),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 i=this.Xb[A],n=e[A];if(this.q_.key(i.time)!==this.q_.key(n.time)){t=A;break}n.timeWeight=i.timeWeight,Rs(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)Rs(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 i={ew:new Map,St:{Eu:this.sw()}};if(t!==-1)this.Yb.forEach(((n,s)=>{i.ew.set(s,{$e:n,rw:s===e?A:void 0})})),this.Yb.has(e)||i.ew.set(e,{$e:[],rw:A}),i.St.hw=this.Xb,i.St.lw=t;else{const n=this.Yb.get(e);i.ew.set(e,{$e:n||[],rw:A})}return i}}function Rs(r,e){r.ee=e,r.Hb.forEach((t=>{t.ee=e}))}function $s(r){const e={value:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function Ac(r){const e=$s(r);return r.V!==void 0&&(e.color=r.V),e}function d0(r){const e=$s(r);return r.lt!==void 0&&(e.lineColor=r.lt),r.Ps!==void 0&&(e.topColor=r.Ps),r.Rs!==void 0&&(e.bottomColor=r.Rs),e}function p0(r){const e=$s(r);return r.Re!==void 0&&(e.topLineColor=r.Re),r.De!==void 0&&(e.bottomLineColor=r.De),r.ke!==void 0&&(e.topFillColor1=r.ke),r.ye!==void 0&&(e.topFillColor2=r.ye),r.Ce!==void 0&&(e.bottomFillColor1=r.Ce),r.Te!==void 0&&(e.bottomFillColor2=r.Te),e}function rc(r){const e={open:r.Vt[0],high:r.Vt[1],low:r.Vt[2],close:r.Vt[3],time:r.zb};return r.jb!==void 0&&(e.customValues=r.jb),e}function f0(r){const e=rc(r);return r.V!==void 0&&(e.color=r.V),e}function m0(r){const e=rc(r),{V:t,Ot:A,Xh:i}=r;return t!==void 0&&(e.color=t),A!==void 0&&(e.borderColor=A),i!==void 0&&(e.wickColor=i),e}function Xs(r){return{Area:d0,Line:Ac,Baseline:p0,Histogram:Ac,Bar:f0,Candlestick:m0,Custom:g0}[r]}function g0(r){const e=r.zb;return Object.assign(Object.assign({},r.$e),{time:e})}const w0={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},B0={vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},C0={background:{type:"solid",color:"#FFFFFF"},textColor:"#191919",fontSize:12,fontFamily:ds,attributionLogo:!0},Zs={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},v0={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:ds,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"};function ic(){return{width:0,height:0,autoSize:!1,layout:C0,crosshair:w0,grid:B0,overlayPriceScales:Object.assign({},Zs),leftPriceScale:Object.assign(Object.assign({},Zs),{visible:!1}),rightPriceScale:Object.assign(Object.assign({},Zs),{visible:!0}),timeScale:v0,watermark:y0,localization:{locale:fr?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 b0{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 Hi(this.ow)?this.aw.Mb(this.ow):0}Li(){return me(this.aw.$t().Uc(this.ow)).Dt}}function nc(r,e,t){const A=Zl(r,["time","originalTime"]),i=Object.assign({time:e},A);return t!==void 0&&(i.originalTime=t),i}const T0={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",axisLabelColor:"",axisLabelTextColor:""};class x0{constructor(e){this.Nh=e}applyOptions(e){this.Nh.$h(e)}options(){return this.Nh.W()}_w(){return this.Nh}}class Q0{constructor(e,t,A,i,n){this.uw=new pt,this.Es=e,this.cw=t,this.dw=A,this.q_=n,this.fw=i}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 pr(new Gr(e.from,e.to)).lu(),A=this.Es.In();if(A.Ni())return null;const i=A.ll(t.Os(),1),n=A.ll(t.ui(),-1),s=me(A.el()),o=me(A.An());if(i!==null&&n!==null&&i.ee>n.ee)return{barsBefore:e.from-s,barsAfter:o-e.to};const a={barsBefore:i===null||i.ee===s?e.from-s:i.ee-s,barsAfter:n===null||n.ee===o?o-e.to:o-n.ee};return i!==null&&n!==null&&(a.from=i.zb,a.to=n.zb),a}setData(e){this.q_,this.Es.Qh(),this.cw.pw(this.Es,e),this.mw("full")}update(e){this.Es.Qh(),this.cw.bw(this.Es,e),this.mw("update")}dataByIndex(e,t){const A=this.Es.In().ll(e,t);return A===null?null:Xs(this.seriesType())(A)}data(){const e=Xs(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=>nc(A,this.q_.convertHorzItemToInternal(A.time),A.time)));this.Es.na(t)}markers(){return this.Es.sa().map((e=>nc(e,e.originalTime,void 0)))}applyOptions(e){this.Es.$h(e)}options(){return FA(this.Es.W())}priceScale(){return this.dw.priceScale(this.Es.Dt().Pa())}createPriceLine(e){const t=aA(FA(T0),e),A=this.Es.ea(t);return new x0(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 F0{constructor(e,t,A){this.ww=new pt,this.mu=new pt,this.Om=new pt,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){_A(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),i=t.Ui(A);return i===null?null:i.originalTime}width(){return this.ab.um().width}height(){return this.ab.um().height}subscribeVisibleTimeRangeChange(e){this.ww.l(e)}unsubscribeVisibleTimeRangeChange(e){this.ww.v(e)}subscribeVisibleLogicalRangeChange(e){this.mu.l(e)}unsubscribeVisibleLogicalRangeChange(e){this.mu.v(e)}subscribeSizeChange(e){this.Om.l(e)}unsubscribeSizeChange(e){this.Om.v(e)}applyOptions(e){this.yl.$h(e)}options(){return Object.assign(Object.assign({},FA(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 U0(r){if(r===void 0||r.type==="custom")return;const e=r;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 i=Math.round(t);if(Math.abs(i-t)<1e-8)return A;t*=10}return A})(e.minMove))}function sc(r){return(function(e){if(Ui(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:i}=e.handleScale;Ui(A)&&(e.handleScale.axisPressedMouseMove={time:A,price:A}),Ui(i)&&(e.handleScale.axisDoubleClickReset={time:i,price:i})}const t=e.handleScroll;Ui(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})})(r),r}class E0{constructor(e,t,A){this.Sw=new Map,this.kw=new Map,this.yw=new pt,this.Cw=new pt,this.Tw=new pt,this.Pw=new u0(t);const i=A===void 0?FA(ic()):aA(FA(ic()),sc(A));this.q_=t,this.aw=new n0(e,i,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 F0(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=hr(e),i=Object.assign(Object.assign({},Pa),A.defaultOptions());return this.Vw("Custom",i,t,A)}addAreaSeries(e){return this.Vw("Area",hp,e)}addBaselineSeries(e){return this.Vw("Baseline",up,e)}addBarSeries(e){return this.Vw("Bar",lp,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",ap,e)}addHistogramSeries(e){return this.Vw("Histogram",dp,e)}addLineSeries(e){return this.Vw("Line",cp,e)}removeSeries(e){const t=_t(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 b0(this.aw,e)}timeScale(){return this.Dw}applyOptions(e){this.aw.$h(sc(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 i=this.Sw.get(A);if(i===void 0)return;const n=this.aw.$t().dr(i);n!==null&&this.aw.$t().ad(e,t,n)}clearCrosshairPosition(){this.aw.$t().od(!0)}Vw(e,t,A={},i){U0(A.priceFormat);const n=aA(FA(Va),FA(t),A),s=this.aw.$t().dd(e,n,i),o=new Q0(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,i)=>i.J(A.$e,A.rw))),t.Wu()}Bw(e){return _t(this.kw.get(e))}Rw(e){const t=new Map;e.Nb.forEach(((i,n)=>{const s=n.Qh(),o=Xs(s)(i);if(s!=="Custom")_A(s0(o));else{const a=n.Ta();_A(!a||a(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 S0(r,e,t){let A;if(Dr(r)){const n=document.getElementById(r);_A(n!==null,`Cannot find element in DOM with id=${r}`),A=n}else A=r;const i=new E0(A,e,t);return e.setOptions(i.options()),i}function H0(r,e){return S0(r,new zl,zl.Id(e))}Object.assign(Object.assign({},Va),Pa);function oc(r,e){return function(){return r.apply(e,arguments)}}const{toString:L0}=Object.prototype,{getPrototypeOf:Js}=Object,{iterator:Ri,toStringTag:ac}=Symbol,$i=(r=>e=>{const t=L0.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),cA=r=>(r=r.toLowerCase(),e=>$i(e)===r),Xi=r=>e=>typeof e===r,{isArray:gr}=Array,wr=Xi("undefined");function Rr(r){return r!==null&&!wr(r)&&r.constructor!==null&&!wr(r.constructor)&&Vt(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const lc=cA("ArrayBuffer");function M0(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&lc(r.buffer),e}const I0=Xi("string"),Vt=Xi("function"),cc=Xi("number"),$r=r=>r!==null&&typeof r=="object",_0=r=>r===!0||r===!1,Zi=r=>{if($i(r)!=="object")return!1;const e=Js(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(ac in r)&&!(Ri in r)},D0=r=>{if(!$r(r)||Rr(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},k0=cA("Date"),O0=cA("File"),N0=cA("Blob"),K0=cA("FileList"),P0=r=>$r(r)&&Vt(r.pipe),V0=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Vt(r.append)&&((e=$i(r))==="formdata"||e==="object"&&Vt(r.toString)&&r.toString()==="[object FormData]"))},z0=cA("URLSearchParams"),[W0,G0,R0,$0]=["ReadableStream","Request","Response","Headers"].map(cA),X0=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Xr(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let A,i;if(typeof r!="object"&&(r=[r]),gr(r))for(A=0,i=r.length;A<i;A++)e.call(null,r[A],A,r);else{if(Rr(r))return;const n=t?Object.getOwnPropertyNames(r):Object.keys(r),s=n.length;let o;for(A=0;A<s;A++)o=n[A],e.call(null,r[o],o,r)}}function hc(r,e){if(Rr(r))return null;e=e.toLowerCase();const t=Object.keys(r);let A=t.length,i;for(;A-- >0;)if(i=t[A],e===i.toLowerCase())return i;return null}const Ar=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,uc=r=>!wr(r)&&r!==Ar;function qs(){const{caseless:r,skipUndefined:e}=uc(this)&&this||{},t={},A=(i,n)=>{if(n==="__proto__"||n==="constructor"||n==="prototype")return;const s=r&&hc(t,n)||n;Zi(t[s])&&Zi(i)?t[s]=qs(t[s],i):Zi(i)?t[s]=qs({},i):gr(i)?t[s]=i.slice():(!e||!wr(i))&&(t[s]=i)};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&Xr(arguments[i],A);return t}const Z0=(r,e,t,{allOwnKeys:A}={})=>(Xr(e,(i,n)=>{t&&Vt(i)?Object.defineProperty(r,n,{value:oc(i,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,n,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:A}),r),J0=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),q0=(r,e,t,A)=>{r.prototype=Object.create(e.prototype,A),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Y0=(r,e,t,A)=>{let i,n,s;const o={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),n=i.length;n-- >0;)s=i[n],(!A||A(s,r,e))&&!o[s]&&(e[s]=r[s],o[s]=!0);r=t!==!1&&Js(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},j0=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;const A=r.indexOf(e,t);return A!==-1&&A===t},e1=r=>{if(!r)return null;if(gr(r))return r;let e=r.length;if(!cc(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},t1=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&Js(Uint8Array)),A1=(r,e)=>{const A=(r&&r[Ri]).call(r);let i;for(;(i=A.next())&&!i.done;){const n=i.value;e.call(r,n[0],n[1])}},r1=(r,e)=>{let t;const A=[];for(;(t=r.exec(e))!==null;)A.push(t);return A},i1=cA("HTMLFormElement"),n1=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,A,i){return A.toUpperCase()+i}),dc=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),s1=cA("RegExp"),pc=(r,e)=>{const t=Object.getOwnPropertyDescriptors(r),A={};Xr(t,(i,n)=>{let s;(s=e(i,n,r))!==!1&&(A[n]=s||i)}),Object.defineProperties(r,A)},o1=r=>{pc(r,(e,t)=>{if(Vt(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const A=r[t];if(Vt(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+"'")})}})},a1=(r,e)=>{const t={},A=i=>{i.forEach(n=>{t[n]=!0})};return gr(r)?A(r):A(String(r).split(e)),t},l1=()=>{},c1=(r,e)=>r!=null&&Number.isFinite(r=+r)?r:e;function h1(r){return!!(r&&Vt(r.append)&&r[ac]==="FormData"&&r[Ri])}const u1=r=>{const e=new Array(10),t=(A,i)=>{if($r(A)){if(e.indexOf(A)>=0)return;if(Rr(A))return A;if(!("toJSON"in A)){e[i]=A;const n=gr(A)?[]:{};return Xr(A,(s,o)=>{const a=t(s,i+1);!wr(a)&&(n[o]=a)}),e[i]=void 0,n}}return A};return t(r,0)},d1=cA("AsyncFunction"),p1=r=>r&&($r(r)||Vt(r))&&Vt(r.then)&&Vt(r.catch),fc=((r,e)=>r?setImmediate:e?((t,A)=>(Ar.addEventListener("message",({source:i,data:n})=>{i===Ar&&n===t&&A.length&&A.shift()()},!1),i=>{A.push(i),Ar.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Vt(Ar.postMessage)),f1=typeof queueMicrotask<"u"?queueMicrotask.bind(Ar):typeof process<"u"&&process.nextTick||fc,re={isArray:gr,isArrayBuffer:lc,isBuffer:Rr,isFormData:V0,isArrayBufferView:M0,isString:I0,isNumber:cc,isBoolean:_0,isObject:$r,isPlainObject:Zi,isEmptyObject:D0,isReadableStream:W0,isRequest:G0,isResponse:R0,isHeaders:$0,isUndefined:wr,isDate:k0,isFile:O0,isBlob:N0,isRegExp:s1,isFunction:Vt,isStream:P0,isURLSearchParams:z0,isTypedArray:t1,isFileList:K0,forEach:Xr,merge:qs,extend:Z0,trim:X0,stripBOM:J0,inherits:q0,toFlatObject:Y0,kindOf:$i,kindOfTest:cA,endsWith:j0,toArray:e1,forEachEntry:A1,matchAll:r1,isHTMLForm:i1,hasOwnProperty:dc,hasOwnProp:dc,reduceDescriptors:pc,freezeMethods:o1,toObjectSet:a1,toCamelCase:n1,noop:l1,toFiniteNumber:c1,findKey:hc,global:Ar,isContextDefined:uc,isSpecCompliantForm:h1,toJSONObject:u1,isAsyncFn:d1,isThenable:p1,setImmediate:fc,asap:f1,isIterable:r=>r!=null&&Vt(r[Ri])};let Ve=class Gd extends Error{static from(e,t,A,i,n,s){const o=new Gd(e.message,t||e.code,A,i,n);return o.cause=e,o.name=e.name,s&&Object.assign(o,s),o}constructor(e,t,A,i,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),A&&(this.config=A),i&&(this.request=i),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}};Ve.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ve.ERR_BAD_OPTION="ERR_BAD_OPTION",Ve.ECONNABORTED="ECONNABORTED",Ve.ETIMEDOUT="ETIMEDOUT",Ve.ERR_NETWORK="ERR_NETWORK",Ve.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ve.ERR_DEPRECATED="ERR_DEPRECATED",Ve.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ve.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ve.ERR_CANCELED="ERR_CANCELED",Ve.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ve.ERR_INVALID_URL="ERR_INVALID_URL";const m1=null;function Ys(r){return re.isPlainObject(r)||re.isArray(r)}function mc(r){return re.endsWith(r,"[]")?r.slice(0,-2):r}function gc(r,e,t){return r?r.concat(e).map(function(i,n){return i=mc(i),!t&&n?"["+i+"]":i}).join(t?".":""):e}function g1(r){return re.isArray(r)&&!r.some(Ys)}const w1=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function Ji(r,e,t){if(!re.isObject(r))throw new TypeError("target must be an object");e=e||new FormData,t=re.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(B,y){return!re.isUndefined(y[B])});const A=t.metaTokens,i=t.visitor||h,n=t.dots,s=t.indexes,a=(t.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(re.isDate(v))return v.toISOString();if(re.isBoolean(v))return v.toString();if(!a&&re.isBlob(v))throw new Ve("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(v)||re.isTypedArray(v)?a&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function h(v,B,y){let D=v;if(v&&!y&&typeof v=="object"){if(re.endsWith(B,"{}"))B=A?B:B.slice(0,-2),v=JSON.stringify(v);else if(re.isArray(v)&&g1(v)||(re.isFileList(v)||re.endsWith(B,"[]"))&&(D=re.toArray(v)))return B=mc(B),D.forEach(function(N,S){!(re.isUndefined(N)||N===null)&&e.append(s===!0?gc([B],S,n):s===null?B:B+"[]",c(N))}),!1}return Ys(v)?!0:(e.append(gc(y,B,n),c(v)),!1)}const d=[],m=Object.assign(w1,{defaultVisitor:h,convertValue:c,isVisitable:Ys});function T(v,B){if(!re.isUndefined(v)){if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+B.join("."));d.push(v),re.forEach(v,function(D,E){(!(re.isUndefined(D)||D===null)&&i.call(e,D,re.isString(E)?E.trim():E,B,m))===!0&&T(D,B?B.concat(E):[E])}),d.pop()}}if(!re.isObject(r))throw new TypeError("data must be an object");return T(r),e}function wc(r){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(A){return e[A]})}function js(r,e){this._pairs=[],r&&Ji(r,this,e)}const Bc=js.prototype;Bc.append=function(e,t){this._pairs.push([e,t])},Bc.toString=function(e){const t=e?function(A){return e.call(this,A,wc)}:wc;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function B1(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Cc(r,e,t){if(!e)return r;const A=t&&t.encode||B1,i=re.isFunction(t)?{serialize:t}:t,n=i&&i.serialize;let s;if(n?s=n(e,i):s=re.isURLSearchParams(e)?e.toString():new js(e,i).toString(A),s){const o=r.indexOf("#");o!==-1&&(r=r.slice(0,o)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}class vc{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){re.forEach(this.handlers,function(A){A!==null&&e(A)})}}const eo={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},C1={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:js,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},to=typeof window<"u"&&typeof document<"u",Ao=typeof navigator=="object"&&navigator||void 0,v1=to&&(!Ao||["ReactNative","NativeScript","NS"].indexOf(Ao.product)<0),y1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",b1=to&&window.location.href||"http://localhost",Lt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:v1,hasStandardBrowserWebWorkerEnv:y1,navigator:Ao,origin:b1},Symbol.toStringTag,{value:"Module"})),...C1};function T1(r,e){return Ji(r,new Lt.classes.URLSearchParams,{visitor:function(t,A,i,n){return Lt.isNode&&re.isBuffer(t)?(this.append(A,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}function x1(r){return re.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Q1(r){const e={},t=Object.keys(r);let A;const i=t.length;let n;for(A=0;A<i;A++)n=t[A],e[n]=r[n];return e}function yc(r){function e(t,A,i,n){let s=t[n++];if(s==="__proto__")return!0;const o=Number.isFinite(+s),a=n>=t.length;return s=!s&&re.isArray(i)?i.length:s,a?(re.hasOwnProp(i,s)?i[s]=[i[s],A]:i[s]=A,!o):((!i[s]||!re.isObject(i[s]))&&(i[s]=[]),e(t,A,i[s],n)&&re.isArray(i[s])&&(i[s]=Q1(i[s])),!o)}if(re.isFormData(r)&&re.isFunction(r.entries)){const t={};return re.forEachEntry(r,(A,i)=>{e(x1(A),i,t,0)}),t}return null}function F1(r,e,t){if(re.isString(r))try{return(e||JSON.parse)(r),re.trim(r)}catch(A){if(A.name!=="SyntaxError")throw A}return(t||JSON.stringify)(r)}const Zr={transitional:eo,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const A=t.getContentType()||"",i=A.indexOf("application/json")>-1,n=re.isObject(e);if(n&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(yc(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.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 T1(e,this.formSerializer).toString();if((o=re.isFileList(e))||A.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return Ji(o?{"files[]":e}:e,a&&new a,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),F1(e)):e}],transformResponse:[function(e){const t=this.transitional||Zr.transitional,A=t&&t.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(A&&!this.responseType||i)){const s=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(o){if(s)throw o.name==="SyntaxError"?Ve.from(o,Ve.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:Lt.classes.FormData,Blob:Lt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],r=>{Zr.headers[r]={}});const U1=re.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"]),E1=r=>{const e={};let t,A,i;return r&&r.split(`
|
|
2
|
+
`).forEach(function(s){i=s.indexOf(":"),t=s.substring(0,i).trim().toLowerCase(),A=s.substring(i+1).trim(),!(!t||e[t]&&U1[t])&&(t==="set-cookie"?e[t]?e[t].push(A):e[t]=[A]:e[t]=e[t]?e[t]+", "+A:A)}),e},bc=Symbol("internals");function Jr(r){return r&&String(r).trim().toLowerCase()}function qi(r){return r===!1||r==null?r:re.isArray(r)?r.map(qi):String(r)}function S1(r){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let A;for(;A=t.exec(r);)e[A[1]]=A[2];return e}const H1=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function ro(r,e,t,A,i){if(re.isFunction(A))return A.call(this,e,t);if(i&&(e=t),!!re.isString(e)){if(re.isString(A))return e.indexOf(A)!==-1;if(re.isRegExp(A))return A.test(e)}}function L1(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,A)=>t.toUpperCase()+A)}function M1(r,e){const t=re.toCamelCase(" "+e);["get","set","has"].forEach(A=>{Object.defineProperty(r,A+t,{value:function(i,n,s){return this[A].call(this,e,i,n,s)},configurable:!0})})}let zt=class{constructor(e){e&&this.set(e)}set(e,t,A){const i=this;function n(o,a,c){const h=Jr(a);if(!h)throw new Error("header name must be a non-empty string");const d=re.findKey(i,h);(!d||i[d]===void 0||c===!0||c===void 0&&i[d]!==!1)&&(i[d||a]=qi(o))}const s=(o,a)=>re.forEach(o,(c,h)=>n(c,h,a));if(re.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(re.isString(e)&&(e=e.trim())&&!H1(e))s(E1(e),t);else if(re.isObject(e)&&re.isIterable(e)){let o={},a,c;for(const h of e){if(!re.isArray(h))throw TypeError("Object iterator must return a key-value pair");o[c=h[0]]=(a=o[c])?re.isArray(a)?[...a,h[1]]:[a,h[1]]:h[1]}s(o,t)}else e!=null&&n(t,e,A);return this}get(e,t){if(e=Jr(e),e){const A=re.findKey(this,e);if(A){const i=this[A];if(!t)return i;if(t===!0)return S1(i);if(re.isFunction(t))return t.call(this,i,A);if(re.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Jr(e),e){const A=re.findKey(this,e);return!!(A&&this[A]!==void 0&&(!t||ro(this,this[A],A,t)))}return!1}delete(e,t){const A=this;let i=!1;function n(s){if(s=Jr(s),s){const o=re.findKey(A,s);o&&(!t||ro(A,A[o],o,t))&&(delete A[o],i=!0)}}return re.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let A=t.length,i=!1;for(;A--;){const n=t[A];(!e||ro(this,this[n],n,e,!0))&&(delete this[n],i=!0)}return i}normalize(e){const t=this,A={};return re.forEach(this,(i,n)=>{const s=re.findKey(A,n);if(s){t[s]=qi(i),delete t[n];return}const o=e?L1(n):String(n).trim();o!==n&&delete t[n],t[o]=qi(i),A[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return re.forEach(this,(A,i)=>{A!=null&&A!==!1&&(t[i]=e&&re.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(i=>A.set(i)),A}static accessor(e){const A=(this[bc]=this[bc]={accessors:{}}).accessors,i=this.prototype;function n(s){const o=Jr(s);A[o]||(M1(i,s),A[o]=!0)}return re.isArray(e)?e.forEach(n):n(e),this}};zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(zt.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(A){this[t]=A}}}),re.freezeMethods(zt);function io(r,e){const t=this||Zr,A=e||t,i=zt.from(A.headers);let n=A.data;return re.forEach(r,function(o){n=o.call(t,n,i.normalize(),e?e.status:void 0)}),i.normalize(),n}function Tc(r){return!!(r&&r.__CANCEL__)}let qr=class extends Ve{constructor(e,t,A){super(e??"canceled",Ve.ERR_CANCELED,t,A),this.name="CanceledError",this.__CANCEL__=!0}};function xc(r,e,t){const A=t.config.validateStatus;!t.status||!A||A(t.status)?r(t):e(new Ve("Request failed with status code "+t.status,[Ve.ERR_BAD_REQUEST,Ve.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function I1(r){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}function _1(r,e){r=r||10;const t=new Array(r),A=new Array(r);let i=0,n=0,s;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),h=A[n];s||(s=c),t[i]=a,A[i]=c;let d=n,m=0;for(;d!==i;)m+=t[d++],d=d%r;if(i=(i+1)%r,i===n&&(n=(n+1)%r),c-s<e)return;const T=h&&c-h;return T?Math.round(m*1e3/T):void 0}}function D1(r,e){let t=0,A=1e3/e,i,n;const s=(c,h=Date.now())=>{t=h,i=null,n&&(clearTimeout(n),n=null),r(...c)};return[(...c)=>{const h=Date.now(),d=h-t;d>=A?s(c,h):(i=c,n||(n=setTimeout(()=>{n=null,s(i)},A-d)))},()=>i&&s(i)]}const Yi=(r,e,t=3)=>{let A=0;const i=_1(50,250);return D1(n=>{const s=n.loaded,o=n.lengthComputable?n.total:void 0,a=s-A,c=i(a),h=s<=o;A=s;const d={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&h?(o-s)/c:void 0,event:n,lengthComputable:o!=null,[e?"download":"upload"]:!0};r(d)},t)},Qc=(r,e)=>{const t=r!=null;return[A=>e[0]({lengthComputable:t,total:r,loaded:A}),e[1]]},Fc=r=>(...e)=>re.asap(()=>r(...e)),k1=Lt.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Lt.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Lt.origin),Lt.navigator&&/(msie|trident)/i.test(Lt.navigator.userAgent)):()=>!0,O1=Lt.hasStandardBrowserEnv?{write(r,e,t,A,i,n,s){if(typeof document>"u")return;const o=[`${r}=${encodeURIComponent(e)}`];re.isNumber(t)&&o.push(`expires=${new Date(t).toUTCString()}`),re.isString(A)&&o.push(`path=${A}`),re.isString(i)&&o.push(`domain=${i}`),n===!0&&o.push("secure"),re.isString(s)&&o.push(`SameSite=${s}`),document.cookie=o.join("; ")},read(r){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function N1(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function K1(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}function Uc(r,e,t){let A=!N1(e);return r&&(A||t==!1)?K1(r,e):e}const Ec=r=>r instanceof zt?{...r}:r;function rr(r,e){e=e||{};const t={};function A(c,h,d,m){return re.isPlainObject(c)&&re.isPlainObject(h)?re.merge.call({caseless:m},c,h):re.isPlainObject(h)?re.merge({},h):re.isArray(h)?h.slice():h}function i(c,h,d,m){if(re.isUndefined(h)){if(!re.isUndefined(c))return A(void 0,c,d,m)}else return A(c,h,d,m)}function n(c,h){if(!re.isUndefined(h))return A(void 0,h)}function s(c,h){if(re.isUndefined(h)){if(!re.isUndefined(c))return A(void 0,c)}else return A(void 0,h)}function o(c,h,d){if(d in e)return A(c,h);if(d in r)return A(void 0,c)}const a={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(c,h,d)=>i(Ec(c),Ec(h),d,!0)};return re.forEach(Object.keys({...r,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const d=re.hasOwnProp(a,h)?a[h]:i,m=d(r[h],e[h],h);re.isUndefined(m)&&d!==o||(t[h]=m)}),t}const Sc=r=>{const e=rr({},r);let{data:t,withXSRFToken:A,xsrfHeaderName:i,xsrfCookieName:n,headers:s,auth:o}=e;if(e.headers=s=zt.from(s),e.url=Cc(Uc(e.baseURL,e.url,e.allowAbsoluteUrls),r.params,r.paramsSerializer),o&&s.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),re.isFormData(t)){if(Lt.hasStandardBrowserEnv||Lt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(re.isFunction(t.getHeaders)){const a=t.getHeaders(),c=["content-type","content-length"];Object.entries(a).forEach(([h,d])=>{c.includes(h.toLowerCase())&&s.set(h,d)})}}if(Lt.hasStandardBrowserEnv&&(A&&re.isFunction(A)&&(A=A(e)),A||A!==!1&&k1(e.url))){const a=i&&n&&O1.read(n);a&&s.set(i,a)}return e},P1=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(t,A){const i=Sc(r);let n=i.data;const s=zt.from(i.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:c}=i,h,d,m,T,v;function B(){T&&T(),v&&v(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function D(){if(!y)return;const N=zt.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),W={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:N,config:r,request:y};xc(function(j){t(j),B()},function(j){A(j),B()},W),y=null}"onloadend"in y?y.onloadend=D:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(D)},y.onabort=function(){y&&(A(new Ve("Request aborted",Ve.ECONNABORTED,r,y)),y=null)},y.onerror=function(S){const W=S&&S.message?S.message:"Network Error",$=new Ve(W,Ve.ERR_NETWORK,r,y);$.event=S||null,A($),y=null},y.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const W=i.transitional||eo;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),A(new Ve(S,W.clarifyTimeoutError?Ve.ETIMEDOUT:Ve.ECONNABORTED,r,y)),y=null},n===void 0&&s.setContentType(null),"setRequestHeader"in y&&re.forEach(s.toJSON(),function(S,W){y.setRequestHeader(W,S)}),re.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),o&&o!=="json"&&(y.responseType=i.responseType),c&&([m,v]=Yi(c,!0),y.addEventListener("progress",m)),a&&y.upload&&([d,T]=Yi(a),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",T)),(i.cancelToken||i.signal)&&(h=N=>{y&&(A(!N||N.type?new qr(null,r,y):N),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));const E=I1(i.url);if(E&&Lt.protocols.indexOf(E)===-1){A(new Ve("Unsupported protocol "+E+":",Ve.ERR_BAD_REQUEST,r));return}y.send(n||null)})},V1=(r,e)=>{const{length:t}=r=r?r.filter(Boolean):[];if(e||t){let A=new AbortController,i;const n=function(c){if(!i){i=!0,o();const h=c instanceof Error?c:this.reason;A.abort(h instanceof Ve?h:new qr(h instanceof Error?h.message:h))}};let s=e&&setTimeout(()=>{s=null,n(new Ve(`timeout of ${e}ms exceeded`,Ve.ETIMEDOUT))},e);const o=()=>{r&&(s&&clearTimeout(s),s=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),r=null)};r.forEach(c=>c.addEventListener("abort",n));const{signal:a}=A;return a.unsubscribe=()=>re.asap(o),a}},z1=function*(r,e){let t=r.byteLength;if(t<e){yield r;return}let A=0,i;for(;A<t;)i=A+e,yield r.slice(A,i),A=i},W1=async function*(r,e){for await(const t of G1(r))yield*z1(t,e)},G1=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const e=r.getReader();try{for(;;){const{done:t,value:A}=await e.read();if(t)break;yield A}}finally{await e.cancel()}},Hc=(r,e,t,A)=>{const i=W1(r,e);let n=0,s,o=a=>{s||(s=!0,A&&A(a))};return new ReadableStream({async pull(a){try{const{done:c,value:h}=await i.next();if(c){o(),a.close();return}let d=h.byteLength;if(t){let m=n+=d;t(m)}a.enqueue(new Uint8Array(h))}catch(c){throw o(c),c}},cancel(a){return o(a),i.return()}},{highWaterMark:2})},Lc=64*1024,{isFunction:ji}=re,R1=(({Request:r,Response:e})=>({Request:r,Response:e}))(re.global),{ReadableStream:Mc,TextEncoder:Ic}=re.global,_c=(r,...e)=>{try{return!!r(...e)}catch{return!1}},$1=r=>{r=re.merge.call({skipUndefined:!0},R1,r);const{fetch:e,Request:t,Response:A}=r,i=e?ji(e):typeof fetch=="function",n=ji(t),s=ji(A);if(!i)return!1;const o=i&&ji(Mc),a=i&&(typeof Ic=="function"?(v=>B=>v.encode(B))(new Ic):async v=>new Uint8Array(await new t(v).arrayBuffer())),c=n&&o&&_c(()=>{let v=!1;const B=new t(Lt.origin,{body:new Mc,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!B}),h=s&&o&&_c(()=>re.isReadableStream(new A("").body)),d={stream:h&&(v=>v.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!d[v]&&(d[v]=(B,y)=>{let D=B&&B[v];if(D)return D.call(B);throw new Ve(`Response type '${v}' is not supported`,Ve.ERR_NOT_SUPPORT,y)})});const m=async v=>{if(v==null)return 0;if(re.isBlob(v))return v.size;if(re.isSpecCompliantForm(v))return(await new t(Lt.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(re.isArrayBufferView(v)||re.isArrayBuffer(v))return v.byteLength;if(re.isURLSearchParams(v)&&(v=v+""),re.isString(v))return(await a(v)).byteLength},T=async(v,B)=>{const y=re.toFiniteNumber(v.getContentLength());return y??m(B)};return async v=>{let{url:B,method:y,data:D,signal:E,cancelToken:N,timeout:S,onDownloadProgress:W,onUploadProgress:$,responseType:j,headers:V,withCredentials:X="same-origin",fetchOptions:ce}=Sc(v),ae=e||fetch;j=j?(j+"").toLowerCase():"text";let de=V1([E,N&&N.toAbortSignal()],S),J=null;const ie=de&&de.unsubscribe&&(()=>{de.unsubscribe()});let pe;try{if($&&c&&y!=="get"&&y!=="head"&&(pe=await T(V,D))!==0){let Fe=new t(B,{method:"POST",body:D,duplex:"half"}),we;if(re.isFormData(D)&&(we=Fe.headers.get("content-type"))&&V.setContentType(we),Fe.body){const[ye,De]=Qc(pe,Yi(Fc($)));D=Hc(Fe.body,Lc,ye,De)}}re.isString(X)||(X=X?"include":"omit");const Ce=n&&"credentials"in t.prototype,Ue={...ce,signal:de,method:y.toUpperCase(),headers:V.normalize().toJSON(),body:D,duplex:"half",credentials:Ce?X:void 0};J=n&&new t(B,Ue);let xe=await(n?ae(J,ce):ae(B,Ue));const He=h&&(j==="stream"||j==="response");if(h&&(W||He&&ie)){const Fe={};["status","statusText","headers"].forEach(et=>{Fe[et]=xe[et]});const we=re.toFiniteNumber(xe.headers.get("content-length")),[ye,De]=W&&Qc(we,Yi(Fc(W),!0))||[];xe=new A(Hc(xe.body,Lc,ye,()=>{De&&De(),ie&&ie()}),Fe)}j=j||"text";let Le=await d[re.findKey(d,j)||"text"](xe,v);return!He&&ie&&ie(),await new Promise((Fe,we)=>{xc(Fe,we,{data:Le,headers:zt.from(xe.headers),status:xe.status,statusText:xe.statusText,config:v,request:J})})}catch(Ce){throw ie&&ie(),Ce&&Ce.name==="TypeError"&&/Load failed|fetch/i.test(Ce.message)?Object.assign(new Ve("Network Error",Ve.ERR_NETWORK,v,J,Ce&&Ce.response),{cause:Ce.cause||Ce}):Ve.from(Ce,Ce&&Ce.code,v,J,Ce&&Ce.response)}}},X1=new Map,Dc=r=>{let e=r&&r.env||{};const{fetch:t,Request:A,Response:i}=e,n=[A,i,t];let s=n.length,o=s,a,c,h=X1;for(;o--;)a=n[o],c=h.get(a),c===void 0&&h.set(a,c=o?new Map:$1(e)),h=c;return c};Dc();const no={http:m1,xhr:P1,fetch:{get:Dc}};re.forEach(no,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});const kc=r=>`- ${r}`,Z1=r=>re.isFunction(r)||r===null||r===!1;function J1(r,e){r=re.isArray(r)?r:[r];const{length:t}=r;let A,i;const n={};for(let s=0;s<t;s++){A=r[s];let o;if(i=A,!Z1(A)&&(i=no[(o=String(A)).toLowerCase()],i===void 0))throw new Ve(`Unknown adapter '${o}'`);if(i&&(re.isFunction(i)||(i=i.get(e))))break;n[o||"#"+s]=i}if(!i){const s=Object.entries(n).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since :
|
|
4
4
|
`+s.map(kc).join(`
|
|
5
|
-
`):" "+kc(s[0]):"as no adapter specified";throw new Ve("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const Oc={getAdapter:J1,adapters:
|
|
6
|
-
`+n):A.stack=n}catch{}}throw A}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=rr(this.defaults,t);const{transitional:A,paramsSerializer:i,headers:n}=t;A!==void 0&&tn.assertOptions(A,{silentJSONParsing:tA.transitional(tA.boolean),forcedJSONParsing:tA.transitional(tA.boolean),clarifyTimeoutError:tA.transitional(tA.boolean),legacyInterceptorReqResOrdering:tA.transitional(tA.boolean)},!1),i!=null&&(re.isFunction(i)?t.paramsSerializer={serialize:i}:tn.assertOptions(i,{encode:tA.function,serialize:tA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),tn.assertOptions(t,{baseUrl:tA.spelling("baseURL"),withXsrfToken:tA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&re.merge(n.common,n[t.method]);n&&re.forEach(["delete","get","head","post","put","patch","common"],v=>{delete n[v]}),t.headers=Vt.concat(s,n);const o=[];let a=!0;this.interceptors.request.forEach(function(B){if(typeof B.runWhen=="function"&&B.runWhen(t)===!1)return;a=a&&B.synchronous;const y=t.transitional||to;y&&y.legacyInterceptorReqResOrdering?o.unshift(B.fulfilled,B.rejected):o.push(B.fulfilled,B.rejected)});const c=[];this.interceptors.response.forEach(function(B){c.push(B.fulfilled,B.rejected)});let h,d=0,m;if(!a){const v=[Nc.bind(this),void 0];for(v.unshift(...o),v.push(...c),m=v.length,h=Promise.resolve(t);d<m;)h=h.then(v[d++],v[d++]);return h}m=o.length;let x=t;for(;d<m;){const v=o[d++],B=o[d++];try{x=v(x)}catch(y){B.call(this,y);break}}try{h=Nc.call(this,x)}catch(v){return Promise.reject(v)}for(d=0,m=c.length;d<m;)h=h.then(c[d++],c[d++]);return h}getUri(e){e=rr(this.defaults,e);const t=Uc(e.baseURL,e.url,e.allowAbsoluteUrls);return Cc(t,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){ir.prototype[e]=function(t,A){return this.request(rr(A||{},{method:e,url:t,data:(A||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(rr(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}ir.prototype[e]=t(),ir.prototype[e+"Form"]=t(!0)});let Y1=class Rd{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(i=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](i);A._listeners=null}),this.promise.then=i=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(i);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new qr(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 Rd(function(i){e=i}),cancel:e}}};function j1(r){return function(t){return r.apply(null,t)}}function em(r){return re.isObject(r)&&r.isAxiosError===!0}const ao={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(ao).forEach(([r,e])=>{ao[e]=r});function Vc(r){const e=new ir(r),t=oc(ir.prototype.request,e);return re.extend(t,ir.prototype,e,{allOwnKeys:!0}),re.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Vc(rr(r,i))},t}const nt=Vc(Zr);nt.Axios=ir,nt.CanceledError=qr,nt.CancelToken=Y1,nt.isCancel=Tc,nt.VERSION=Kc,nt.toFormData=Ji,nt.AxiosError=Ve,nt.Cancel=nt.CanceledError,nt.all=function(e){return Promise.all(e)},nt.spread=j1,nt.isAxiosError=em,nt.mergeConfig=rr,nt.AxiosHeaders=Vt,nt.formToJSON=r=>yc(re.isHTMLForm(r)?new FormData(r):r),nt.getAdapter=Oc.getAdapter,nt.HttpStatusCode=ao,nt.default=nt;const{Axios:nb,AxiosError:sb,CanceledError:ob,isCancel:ab,CancelToken:lb,VERSION:cb,all:hb,Cancel:ub,isAxiosError:db,spread:pb,toFormData:fb,AxiosHeaders:mb,HttpStatusCode:gb,formToJSON:wb,getAdapter:Bb,mergeConfig:Cb}=nt,wA=Object.create(null);wA.open="0",wA.close="1",wA.ping="2",wA.pong="3",wA.message="4",wA.upgrade="5",wA.noop="6";const An=Object.create(null);Object.keys(wA).forEach(r=>{An[wA[r]]=r});const lo={type:"error",data:"parser error"},zc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Wc=typeof ArrayBuffer=="function",Gc=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,co=({type:r,data:e},t,A)=>zc&&e instanceof Blob?t?A(e):Rc(e,A):Wc&&(e instanceof ArrayBuffer||Gc(e))?t?A(e):Rc(new Blob([e]),A):A(wA[r]+(e||"")),Rc=(r,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(r)};function $c(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let ho;function tm(r,e){if(zc&&r.data instanceof Blob)return r.data.arrayBuffer().then($c).then(e);if(Wc&&(r.data instanceof ArrayBuffer||Gc(r.data)))return e($c(r.data));co(r,!1,t=>{ho||(ho=new TextEncoder),e(ho.encode(t))})}const Xc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Xc.length;r++)Yr[Xc.charCodeAt(r)]=r;const Am=r=>{let e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(A=0;A<t;A+=4)n=Yr[r.charCodeAt(A)],s=Yr[r.charCodeAt(A+1)],o=Yr[r.charCodeAt(A+2)],a=Yr[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},rm=typeof ArrayBuffer=="function",uo=(r,e)=>{if(typeof r!="string")return{type:"message",data:Zc(r,e)};const t=r.charAt(0);return t==="b"?{type:"message",data:im(r.substring(1),e)}:An[t]?r.length>1?{type:An[t],data:r.substring(1)}:{type:An[t]}:lo},im=(r,e)=>{if(rm){const t=Am(r);return Zc(t,e)}else return{base64:!0,data:r}},Zc=(r,e)=>e==="blob"?r instanceof Blob?r:new Blob([r]):r instanceof ArrayBuffer?r:r.buffer,Jc="",nm=(r,e)=>{const t=r.length,A=new Array(t);let i=0;r.forEach((n,s)=>{co(n,!1,o=>{A[s]=o,++i===t&&e(A.join(Jc))})})},sm=(r,e)=>{const t=r.split(Jc),A=[];for(let i=0;i<t.length;i++){const n=uo(t[i],e);if(A.push(n),n.type==="error")break}return A};function om(){return new TransformStream({transform(r,e){tm(r,t=>{const A=t.length;let i;if(A<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,A);else if(A<65536){i=new Uint8Array(3);const n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{i=new Uint8Array(9);const n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let po;function rn(r){return r.reduce((e,t)=>e+t.length,0)}function nn(r,e){if(r[0].length===e)return r.shift();const t=new Uint8Array(e);let A=0;for(let i=0;i<e;i++)t[i]=r[0][A++],A===r[0].length&&(r.shift(),A=0);return r.length&&A<r[0].length&&(r[0]=r[0].slice(A)),t}function am(r,e){po||(po=new TextDecoder);const t=[];let A=0,i=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(rn(t)<1)break;const a=nn(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?A=3:i===126?A=1:A=2}else if(A===1){if(rn(t)<2)break;const a=nn(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),A=3}else if(A===2){if(rn(t)<8)break;const a=nn(t,8),c=new DataView(a.buffer,a.byteOffset,a.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(lo);break}i=h*Math.pow(2,32)+c.getUint32(4),A=3}else{if(rn(t)<i)break;const a=nn(t,i);o.enqueue(uo(n?a:po.decode(a),e)),A=0}if(i===0||i>r){o.enqueue(lo);break}}}})}const qc=4;function gt(r){if(r)return lm(r)}function lm(r){for(var e in gt.prototype)r[e]=gt.prototype[e];return r}gt.prototype.on=gt.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this},gt.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this},gt.prototype.off=gt.prototype.removeListener=gt.prototype.removeAllListeners=gt.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var A,i=0;i<t.length;i++)if(A=t[i],A===e||A.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this},gt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,i=t.length;A<i;++A)t[A].apply(this,e)}return this},gt.prototype.emitReserved=gt.prototype.emit,gt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]},gt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const sn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),AA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),cm="arraybuffer";function vb(){}function Yc(r,...e){return e.reduce((t,A)=>(r.hasOwnProperty(A)&&(t[A]=r[A]),t),{})}const hm=AA.setTimeout,um=AA.clearTimeout;function on(r,e){e.useNativeTimers?(r.setTimeoutFn=hm.bind(AA),r.clearTimeoutFn=um.bind(AA)):(r.setTimeoutFn=AA.setTimeout.bind(AA),r.clearTimeoutFn=AA.clearTimeout.bind(AA))}const dm=1.33;function pm(r){return typeof r=="string"?fm(r):Math.ceil((r.byteLength||r.size)*dm)}function fm(r){let e=0,t=0;for(let A=0,i=r.length;A<i;A++)e=r.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function jc(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mm(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function gm(r){let e={},t=r.split("&");for(let A=0,i=t.length;A<i;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class wm extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class fo extends gt{constructor(e){super(),this.writable=!1,on(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 wm(e,t,A)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=uo(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=mm(e);return t.length?"?"+t:""}}class Bm extends fo{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)};sm(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,nm(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]=jc()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let eh=!1;try{eh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Cm=eh;function vm(){}class ym extends Bm{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",(i,n)=>{this.onError("xhr post error",i,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 BA extends gt{constructor(e,t,A){super(),this.createRequest=e,on(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=Yc(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 i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&A.setRequestHeader(i,this._opts.extraHeaders[i])}}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 i;A.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.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(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=BA.requestsCount++,BA.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=vm,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete BA.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(BA.requestsCount=0,BA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",th);else if(typeof addEventListener=="function"){const r="onpagehide"in AA?"pagehide":"unload";addEventListener(r,th,!1)}}function th(){for(let r in BA.requests)BA.requests.hasOwnProperty(r)&&BA.requests[r].abort()}const bm=(function(){const r=Ah({xdomain:!1});return r&&r.responseType!==null})();class Tm extends ym{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=bm&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new BA(Ah,this.uri(),e)}}function Ah(r){const e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Cm))return new XMLHttpRequest}catch{}if(!e)try{return new AA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const rh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class xm extends fo{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=rh?{}:Yc(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(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],i=t===e.length-1;co(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}i&&sn(()=>{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]=jc()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const mo=AA.WebSocket||AA.MozWebSocket;class Qm extends xm{createSocket(e,t,A){return rh?new mo(e,t,A):t?new mo(e,t):new mo(e)}doWrite(e,t){this.ws.send(t)}}class Fm extends fo{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=am(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),i=om();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const n=()=>{A.read().then(({done:o,value:a})=>{o||(this.onPacket(a),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],i=t===e.length-1;this._writer.write(A).then(()=>{i&&sn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Um={websocket:Qm,webtransport:Fm,polling:Tm},Em=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sm=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function go(r){if(r.length>8e3)throw"URI too long";const e=r,t=r.indexOf("["),A=r.indexOf("]");t!=-1&&A!=-1&&(r=r.substring(0,t)+r.substring(t,A).replace(/:/g,";")+r.substring(A,r.length));let i=Em.exec(r||""),n={},s=14;for(;s--;)n[Sm[s]]=i[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=Hm(n,n.path),n.queryKey=Lm(n,n.query),n}function Hm(r,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 Lm(r,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,i,n){i&&(t[i]=n)}),t}const wo=typeof addEventListener=="function"&&typeof removeEventListener=="function",an=[];wo&&addEventListener("offline",()=>{an.forEach(r=>r())},!1);class DA extends gt{constructor(e,t){if(super(),this.binaryType=cm,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=go(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=go(t.host).host);on(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 i=A.prototype.name;this.transports.push(i),this._transportsByName[i]=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=gm(this.opts.query)),wo&&(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"})},an.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=qc,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&&DA.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",DA.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 i=this.writeBuffer[A].data;if(i&&(t+=pm(i)),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,sn(()=>{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,i){if(typeof t=="function"&&(i=t,t=void 0),typeof A=="function"&&(i=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),i&&this.once("flush",i),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(DA.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(),wo&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const A=an.indexOf(this._offlineEventListener);A!==-1&&an.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}DA.protocol=qc;class Mm extends DA{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;DA.priorWebsocketSuccess=!1;const i=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",d=>{if(!A)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;DA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=t.name,this.emitReserved("upgradeError",m)}}))};function n(){A||(A=!0,h(),t.close(),t=null)}const s=d=>{const m=new Error("probe error: "+d);m.transport=t.name,n(),this.emitReserved("upgradeError",m)};function o(){s("transport closed")}function a(){s("socket closed")}function c(d){t&&d.name!==t.name&&n()}const h=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",i),t.once("error",s),t.once("close",o),this.once("close",a),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 Im=class extends Mm{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(i=>Um[i]).filter(i=>!!i)),super(e,A)}};function _m(r,e="",t){let A=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),A=go(r)),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 Dm=typeof ArrayBuffer=="function",km=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ih=Object.prototype.toString,Om=typeof Blob=="function"||typeof Blob<"u"&&ih.call(Blob)==="[object BlobConstructor]",Nm=typeof File=="function"||typeof File<"u"&&ih.call(File)==="[object FileConstructor]";function Bo(r){return Dm&&(r instanceof ArrayBuffer||km(r))||Om&&r instanceof Blob||Nm&&r instanceof File}function ln(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,A=r.length;t<A;t++)if(ln(r[t]))return!0;return!1}if(Bo(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return ln(r.toJSON(),!0);for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&ln(r[t]))return!0;return!1}function Km(r){const e=[],t=r.data,A=r;return A.data=Co(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Co(r,e){if(!r)return r;if(Bo(r)){const t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){const t=new Array(r.length);for(let A=0;A<r.length;A++)t[A]=Co(r[A],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){const t={};for(const A in r)Object.prototype.hasOwnProperty.call(r,A)&&(t[A]=Co(r[A],e));return t}return r}function Pm(r,e){return r.data=vo(r.data,e),delete r.attachments,r}function vo(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=vo(r[t],e);else if(typeof r=="object")for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=vo(r[t],e));return r}const Vm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Je;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(Je||(Je={}));class zm{constructor(e){this.replacer=e}encode(e){return(e.type===Je.EVENT||e.type===Je.ACK)&&ln(e)?this.encodeAsBinary({type:e.type===Je.EVENT?Je.BINARY_EVENT:Je.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===Je.BINARY_EVENT||e.type===Je.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=Km(e),A=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(A),i}}class yo extends gt{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===Je.BINARY_EVENT;A||t.type===Je.BINARY_ACK?(t.type=A?Je.EVENT:Je.ACK,this.reconstructor=new Wm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Bo(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(Je[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===Je.BINARY_EVENT||A.type===Je.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 i=e.charAt(t+1);if(i!==""&&Number(i)==i){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(yo.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 Je.CONNECT:return nh(t);case Je.DISCONNECT:return t===void 0;case Je.CONNECT_ERROR:return typeof t=="string"||nh(t);case Je.EVENT:case Je.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Vm.indexOf(t[0])===-1);case Je.ACK:case Je.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Wm{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=Pm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function nh(r){return Object.prototype.toString.call(r)==="[object Object]"}const Gm=Object.freeze(Object.defineProperty({__proto__:null,Decoder:yo,Encoder:zm,get PacketType(){return Je}},Symbol.toStringTag,{value:"Module"}));function hA(r,e,t){return r.on(e,t),function(){r.off(e,t)}}const Rm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class sh extends gt{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=[hA(e,"open",this.onopen.bind(this)),hA(e,"packet",this.onpacket.bind(this)),hA(e,"error",this.onerror.bind(this)),hA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var A,i,n;if(Rm.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:Je.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,d=t.pop();this._registerAckCallback(h,d),s.id=h}const o=(i=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const i=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(i===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"))},i),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,i)=>{const n=(s,o)=>s?i(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((i,...n)=>(this._queue[0],i!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(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:Je.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 Je.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 Je.EVENT:case Je.BINARY_EVENT:this.onevent(e);break;case Je.ACK:case Je.BINARY_ACK:this.onack(e);break;case Je.DISCONNECT:this.ondisconnect();break;case Je.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(...i){A||(A=!0,t.packet({type:Je.ACK,id:e,data:i}))}}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:Je.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 Cr(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Cr.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0},Cr.prototype.reset=function(){this.attempts=0},Cr.prototype.setMin=function(r){this.ms=r},Cr.prototype.setMax=function(r){this.max=r},Cr.prototype.setJitter=function(r){this.jitter=r};class bo extends gt{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,on(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 Cr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Gm;this.encoder=new i.Encoder,this.decoder=new i.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 Im(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const i=hA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=hA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(hA(e,"ping",this.onping.bind(this)),hA(e,"data",this.ondata.bind(this)),hA(e,"error",this.onerror.bind(this)),hA(e,"close",this.onclose.bind(this)),hA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){sn(()=>{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 sh(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(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):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 jr={};function cn(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};const t=_m(r,e.path||"/socket.io"),A=t.source,i=t.id,n=t.path,s=jr[i]&&n in jr[i].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let a;return o?a=new bo(A,e):(jr[i]||(jr[i]=new bo(A,e)),a=jr[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(cn,{Manager:bo,Socket:sh,io:cn,connect:cn});function To(r){if(!r)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(r,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(r).trim().replace(/\/+$/,"")}}let Xt=To("http://localhost:8000");function oh(r){const e=To(r);e&&e!==Xt&&(Xt=e,ut&&(ut.disconnect(),ut.removeAllListeners(),ut=null))}let ut=null;function $m(){const r=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=r();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:Xt,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=cn(Xt,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const i=r();return t.auth=i?{token:i}:{},i};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:Xt,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",i=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:i,socketId:t.id})}),t.on("connect_error",i=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:i?.message,description:i?.description,context:i?.context,type:i?.type,baseUrl:Xt,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",i=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:i,baseUrl:Xt,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:Xt})}),t.io.on("reconnect",i=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:i,socketId:t.id})}),t}function xo(){const r=To(ut?.io?.uri||null);return!ut||ut.io&&r&&Xt&&r!==Xt?(ut&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:r,newBaseUrl:Xt,wasConnected:ut.connected,reason:"baseUrl changed"}),ut.disconnect(),ut.removeAllListeners(),ut=null),ut=$m()):ut.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:ut.id,connected:ut.connected,baseUrl:Xt,uri:r}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:ut.id,baseUrl:Xt}),ut}function Xm(r,e){const t=xo();return t.on(r,e),()=>t.off(r,e)}function Zm(r,e){ut&&ut.off(r,e)}function Jm(r,e){xo().emit(r,e)}function qm(){return ut?ut.connected?"connected":"connecting":"disconnected"}const hn={getSocket:xo,on:Xm,off:Zm,emit:Jm,getStatus:qm,setBaseUrl:oh},Ym={},ah=Y.createContext(),Qt=()=>{const r=Y.useContext(ah);if(!r)throw new Error("useTrading must be used within TradingProvider");return r},jm=({children:r,baseUrl:e,endpoints:t,accountId:A,initialSymbol:i,initialTimeframe:n})=>{const s=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:ds&&ds.tagName.toUpperCase()==="SCRIPT"&&ds.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Ym?.VITE_BASE_URL)??"http://localhost:5002",a={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...t},c=t?.params||{},[h,d]=Y.useState(i||"BTC/USD"),[m,x]=Y.useState(n||"M1"),[v,B]=Y.useState([]),[y,D]=Y.useState(!0),[E,N]=Y.useState([]),[S,W]=Y.useState(!1),[$,j]=Y.useState(1e5),[V,X]=Y.useState(null),[ce,ae]=Y.useState([]),[de,J]=Y.useState(!0),[ie,pe]=Y.useState(!1),[Be,Ue]=Y.useState(!0),[xe,Le]=Y.useState("candles"),[Me,Fe]=Y.useState(!1),[we,ye]=Y.useState("dark"),[De,et]=Y.useState(!1),[Ye,be]=Y.useState([]),bt=Y.useRef(null);Y.useEffect(()=>{hn.setBaseUrl(s)},[s]);const ze=Y.useRef(new Map),Oe=Y.useRef(null),Ne=1e3,ke=Y.useCallback(async()=>{if(A)try{const oe=localStorage.getItem("token");if(!oe)return;W(!0);const ne=await nt.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${oe}`}});let ge=[];Array.isArray(ne.data)?ge=ne.data:ne.data?.data&&Array.isArray(ne.data.data)&&(ge=ne.data.data);const he=ge.filter(ue=>ue.closePrice===null||ue.closePrice===void 0).map(ue=>({id:ue.id,ticket:ue.id?.substring(0,8),symbol:ue.symbol,type:ue.type,volume:ue.volume,price:ue.openPrice,stopLoss:ue.stopLoss,takeProfit:ue.takeProfit,comment:ue.comment||"",status:"OPEN",swap:0,profit:ue.profit||0,profitCurrency:"USD",time:new Date(ue.openedAt||ue.openAt||Date.now()).toLocaleTimeString(),openAt:ue.openedAt||ue.openAt,closeAt:ue.closedAt||ue.closeAt}));N(he)}catch(oe){console.error("❌ Error fetching orders:",oe.response?.data||oe.message),N([])}finally{W(!1)}},[s,A]),Te=Y.useCallback((oe,ne)=>!ne||!oe.price||isNaN(ne)||isNaN(oe.price)?oe.profit||0:(oe.type==="BUY"?ne-oe.price:oe.price-ne)*oe.volume,[]),Ie=Y.useCallback(async()=>{try{const oe=localStorage.getItem("token");if(!oe)return;const ne=await nt.get(`${s}${a.account}`,{headers:{Authorization:`Bearer ${oe}`}});if(ne.data&&ne.data.data){const ge=parseFloat(ne.data.data.balance);isNaN(ge)||j(ge)}}catch(oe){console.error("❌ Error fetching user balance:",oe.response?.data||oe.message)}},[s]),Tt=Y.useCallback(async()=>{if(A)try{const oe=localStorage.getItem("token");if(!oe)return;const ne=await nt.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${oe}`}});let ge=[];Array.isArray(ne.data)?ge=ne.data:ne.data?.data&&Array.isArray(ne.data.data)&&(ge=ne.data.data);const he=ge.filter(ue=>ue.closePrice!==null&&ue.closePrice!==void 0).map(ue=>({id:ue.id,ticket:ue.id?.substring(0,8),symbol:ue.symbol,type:ue.type,volume:ue.volume,openPrice:ue.openPrice,closePrice:ue.closePrice,stopLoss:ue.stopLoss,takeProfit:ue.takeProfit,profit:ue.profit||0,profitCurrency:"USD",openAt:ue.openedAt||ue.openAt,closeAt:ue.closedAt||ue.closeAt,closeReason:ue.closeReason||"",status:"CLOSED"}));be(he)}catch(oe){console.error("❌ Error fetching history orders:",oe.response?.data||oe.message),be([])}},[s,A]),tt=Y.useMemo(()=>{const oe=$,ne=E.reduce((At,ht)=>At+ht.volume*ht.price*.01,0),ge=E.reduce((At,ht)=>{const vt=v.find(_t=>_t.symbol===ht.symbol);if(vt){const _t=ht.type==="BUY"?parseFloat(vt.bid||0):parseFloat(vt.ask||0);if(_t&&_t>0&&!isNaN(_t))return At+Te(ht,_t)}return At+(ht.profit||0)},0),he=oe+ge,ue=he-ne,Ee=ne>0?he/ne*100:0;return{balance:oe,equity:he,margin:ne,freeMargin:ue,level:Ee.toFixed(2)}},[E,v,$,Te]);Y.useEffect(()=>{localStorage.getItem("token")&&A&&(ke(),Ie(),Tt())},[ke,Ie,Tt,A]),Y.useEffect(()=>{(async()=>{try{D(!0);const ne=a.symbols.includes("?")?`${s}${a.symbols}`:`${s}${a.symbols}`,ge=await nt.get(ne);let he=[];Array.isArray(ge.data)?he=ge.data:ge.data&&ge.data.data&&Array.isArray(ge.data.data)?he=ge.data.data:ge.data&&ge.data.prices&&Array.isArray(ge.data.prices)?he=ge.data.prices:ge.data&&Array.isArray(ge.data)&&(he=ge.data);const ue=he.map(Ee=>Ee.symbol&&(Ee.bid!==void 0||Ee.price!==void 0)?{symbol:Ee.symbol,bid:Ee.bid??Ee.price??0,ask:Ee.ask??Ee.price??0,change:Ee.change??0}:Ee);ue.length>0?(B(ue),ue.find(At=>At.symbol===h)||d(ue[0].symbol)):B([])}catch(ne){console.error("❌ Error fetching symbols:",ne.response?.data||ne.message),B([])}finally{D(!1)}})()},[s,a.symbols]);const MA=Y.useCallback(()=>{const oe=ze.current;if(oe.size===0)return;const ne=new Map(oe);oe.clear(),B(ge=>ge.map(he=>{const ue=ne.get(he.symbol);return ue?{...he,...ue}:he})),N(ge=>{let he=!1;const ue=ge.map(Ee=>{const At=ne.get(Ee.symbol);if(!At)return Ee;const ht=Ee.type==="BUY"?parseFloat(At.bid||0):parseFloat(At.ask||0);if(!ht||isNaN(ht)||ht<=0)return Ee;const vt=Te(Ee,ht);return vt===Ee.profit?Ee:(he=!0,{...Ee,profit:vt})});return he?ue:ge})},[Te]);Y.useEffect(()=>{bt.current||(bt.current=hn.getSocket());const oe=bt.current,ne=()=>console.log("✅ TradingContext: Connected"),ge=()=>console.log("⚠️ TradingContext: Disconnected"),he=Ee=>{Ee?.symbol&&(ze.current.set(Ee.symbol,Ee),Oe.current||(Oe.current=setTimeout(()=>{Oe.current=null,MA()},Ne)))},ue=async Ee=>{if(Ee){if(Ee.newBalance!==void 0){const At=parseFloat(Ee.newBalance);isNaN(At)||j(At)}if(window.notify){const At=Ee.profitLoss||Ee.profit||0,ht=At>=0?`+${At.toFixed(2)}`:At.toFixed(2),vt=Ee.symbol||"Trade",_t=Ee.reason||"Closed";window.notify(`Trade Closed: ${_t} | ${vt} | P/L: ${ht} USD`,At>=0?"success":"error")}Ee.tradeId&&N(At=>At.filter(ht=>ht.id!==Ee.tradeId)),await ke(),await Ie()}};return oe.on("connect",ne),oe.on("disconnect",ge),oe.on("priceUpdate",he),oe.on("tradeClosed",ue),()=>{oe.off("connect",ne),oe.off("disconnect",ge),oe.off("priceUpdate",he),oe.off("tradeClosed",ue),Oe.current&&(clearTimeout(Oe.current),Oe.current=null),ze.current.clear()}},[MA,ke,Ie]),Y.useEffect(()=>{try{const oe=document.documentElement;if(!oe)return;oe.dataset.theme=we}catch{}},[we]);const Ke=Y.useMemo(()=>v.find(oe=>oe.symbol===h)||{bid:"0.00000",ask:"0.00000",change:0},[v,h]),_e=Y.useMemo(()=>({selectedSymbol:h,setSelectedSymbol:d,selectedTimeframe:m,setSelectedTimeframe:x,symbols:v,setSymbols:B,symbolsLoading:y,orders:E,setOrders:N,ordersLoading:S,fetchOrders:ke,fetchUserBalance:Ie,userBalance:$,setUserBalance:j,accountSummary:tt,currentSymbolData:Ke,activeTool:V,setActiveTool:X,chartObjects:ce,setChartObjects:ae,showGrid:de,setShowGrid:J,snapToGrid:ie,setSnapToGrid:pe,drawingsVisible:Be,setDrawingsVisible:Ue,chartType:xe,setChartType:Le,chartLocked:Me,setChartLocked:Fe,theme:we,setTheme:ye,baseUrl:s,endpoints:a,endpointParams:c,accountId:A,isShow:De,setIsShow:et,historyOrders:Ye,setHistoryOrders:be,fetchHistoryOrders:Tt}),[h,m,v,y,E,S,ke,Ie,$,tt,Ke,V,ce,de,ie,Be,xe,Me,we,s,a,c,De,Ye,Tt]);return l.jsx(ah.Provider,{value:_e,children:r})};var lh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ch=Y.createContext&&Y.createContext(lh),eg=["attr","size","title"];function tg(r,e){if(r==null)return{};var t=Ag(r,e),A,i;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(i=0;i<n.length;i++)A=n[i],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(r,A)&&(t[A]=r[A])}return t}function Ag(r,e){if(r==null)return{};var t={};for(var A in r)if(Object.prototype.hasOwnProperty.call(r,A)){if(e.indexOf(A)>=0)continue;t[A]=r[A]}return t}function un(){return un=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(r[A]=t[A])}return r},un.apply(this,arguments)}function hh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(r);e&&(A=A.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,A)}return t}function dn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hh(Object(t),!0).forEach(function(A){rg(r,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hh(Object(t)).forEach(function(A){Object.defineProperty(r,A,Object.getOwnPropertyDescriptor(t,A))})}return r}function rg(r,e,t){return e=ig(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ig(r){var e=ng(r,"string");return typeof e=="symbol"?e:e+""}function ng(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var A=t.call(r,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function uh(r){return r&&r.map((e,t)=>Y.createElement(e.tag,dn({key:t},e.attr),uh(e.child)))}function rA(r){return e=>Y.createElement(sg,un({attr:dn({},r.attr)},e),uh(r.child))}function sg(r){var e=t=>{var{attr:A,size:i,title:n}=r,s=tg(r,eg),o=i||t.size||"1em",a;return t.className&&(a=t.className),r.className&&(a=(a?a+" ":"")+r.className),Y.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:a,style:dn(dn({color:r.color||t.color},t.style),r.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),r.children)};return ch!==void 0?Y.createElement(ch.Consumer,null,t=>e(t)):e(lh)}function og(r){return rA({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:[]}]})(r)}function ag(r){return rA({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:[]}]})(r)}function lg(r){return rA({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:[]}]})(r)}function cg(r){return rA({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:[]}]})(r)}function dh(r){return rA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(r)}function hg(r){return rA({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(r)}function ug(r){return rA({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:[]}]})(r)}function dg(r){return rA({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:[]}]})(r)}function pg(r){return rA({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:[]}]})(r)}const fg={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ph=({bidPrice:r,askPrice:e,userAccountId:t})=>{const{theme:A,selectedSymbol:i,fetchOrders:n,baseUrl:s,endpoints:o}=Qt(),a=A==="light",[c,h]=Y.useState("0.01"),[d,m]=Y.useState(""),[x,v]=Y.useState(!1),B=a?"bg-slate-100":"bg-[#12161d]",y=a?"text-slate-700":"text-white",D=a?"hover:bg-slate-200":"hover:bg-[#1e2635]",E=S=>{const W=parseFloat(c)||.01,$=Math.max(.01,W+S);h($.toFixed(2))},N=async S=>{m("");const W=S,$=parseFloat(W==="BUY"?e:r),j=parseFloat(c);if(!j||j<=0||isNaN(j)){m("Please enter a valid volume (minimum 0.01)");return}if(j<.01){m("Volume must be at least 0.01");return}if(!$||$<=0||isNaN($)){m("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token");if(!V){m("Please login to place trades");return}v(!0);const X=typeof i=="object"?i?.symbol:i,ce={accountId:t,symbol:X,type:W,volume:j,openPrice:$,takeProfit:null,stopLoss:null};try{const ae=s||fg?.VITE_BASE_URL||"http://localhost:8000",de=o?.trades||"/api/trades",J=await nt.post(`${ae}${de}`,ce,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(J.status<200||J.status>=300){m(J.data?.message||`Failed to place trade (${J.status})`);return}n&&n()}catch(ae){const de=ae?.response?.data?.message||ae?.message||"Network error. Please try again.";m(de)}finally{v(!1)}};return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[l.jsxs("button",{onClick:()=>N("SELL"),disabled:x,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[l.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:r?Number(r).toFixed(5):"—"}),l.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),l.jsxs("div",{className:`flex items-stretch ${B}`,children:[l.jsx("button",{type:"button",onClick:()=>E(-.01),className:`w-5 flex items-center justify-center ${y} ${D} transition-colors`,children:l.jsx(dh,{size:8})}),l.jsx("input",{type:"number",value:c,onChange:S=>{const W=S.target.value;(W===""||/^\d*\.?\d{0,2}$/.test(W))&&h(W)},onBlur:()=>{const S=parseFloat(c);h(isNaN(S)||S<.01?"0.01":S.toFixed(2))},className:`w-14 text-center focus:outline-none ${B} ${y}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),l.jsx("button",{type:"button",onClick:()=>E(.01),className:`w-5 flex items-center justify-center ${y} ${D} transition-colors`,children:l.jsx(hg,{size:8})})]}),l.jsxs("button",{onClick:()=>N("BUY"),disabled:x,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[l.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),l.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),d&&l.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:d})]})},mg={},fh=({isOpen:r,onClose:e,orderType:t,bidPrice:A,askPrice:i,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:a=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:d,selectedTimeframe:m,setOrders:x,symbols:v,fetchOrders:B,theme:y,baseUrl:D,endpoints:E}=Qt(),N=y==="light",S={getContractSpec:oe=>{const ne=String(oe||"").toUpperCase();return ne.includes("BTC")||ne.includes("ETH")||ne.includes("SOL")||ne.includes("XRP")||ne.includes("ADA")||ne.includes("DOGE")||ne.includes("BNB")||ne.includes("AVAX")||ne.includes("DOT")||ne.includes("LINK")||ne.endsWith("USDT")?{contractSize:1}:ne.includes("XAU")||ne.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:oe,volume:ne})=>{const ge=S.getContractSpec(oe);return(parseFloat(ne)||0)*(ge.contractSize||1)}},W=h||S,[$,j]=Y.useState("0.01"),[V,X]=Y.useState(""),[ce,ae]=Y.useState(""),[de,J]=Y.useState(""),[ie,pe]=Y.useState(!1),[Be,Ue]=Y.useState(null),[xe,Le]=Y.useState(""),[Me,Fe]=Y.useState(t||"BUY"),[we,ye]=Y.useState(parseFloat(A)||0),[De,et]=Y.useState(parseFloat(i)||0),[Ye,be]=Y.useState("text-white"),[bt,ze]=Y.useState("text-white"),Oe=Y.useRef(parseFloat(A)||0),Ne=Y.useRef(parseFloat(i)||0);Y.useEffect(()=>{if(!r)return;const oe=hn.getSocket(),ne=he=>{if(!(!he||!he.symbol)&&he.symbol.toUpperCase()===d?.toUpperCase()){const ue=parseFloat(he.bid)||0,Ee=parseFloat(he.ask)||0;ue>0&&(ue>Oe.current?(be("text-green-400"),setTimeout(()=>be("text-white"),500)):ue<Oe.current&&Oe.current>0&&(be("text-red-400"),setTimeout(()=>be("text-white"),500)),ye(ue),Oe.current=ue),Ee>0&&(Ee>Ne.current?(ze("text-green-400"),setTimeout(()=>ze("text-white"),500)):Ee<Ne.current&&Ne.current>0&&(ze("text-red-400"),setTimeout(()=>ze("text-white"),500)),et(Ee),Ne.current=Ee)}};oe.on("priceUpdate",ne);const ge=v.find(he=>he.symbol===d);if(ge){const he=parseFloat(ge.bid)||0,ue=parseFloat(ge.ask)||0;he>0&&(ye(he),Oe.current=he),ue>0&&(et(ue),Ne.current=ue)}return()=>{oe.off("priceUpdate",ne)}},[r,d,v]),Y.useEffect(()=>{if(r){j(o?String(o):"0.01"),X(""),ae(""),J(""),Le(""),Fe(t||"BUY");const oe=parseFloat(A)||0,ne=parseFloat(i)||0;oe>0&&(ye(oe),Oe.current=oe),ne>0&&(et(ne),Ne.current=ne)}},[r,t,A,i,o]);const ke=we||0,Te=De||0,Ie=oe=>{const ne=parseFloat($)||.01,ge=Math.max(.01,ne+oe);j(ge.toFixed(2))},Tt=oe=>{const ne=parseFloat(V)||0,ge=parseFloat(Me==="BUY"?De:we)||0;if(!ge){Le("Current price not available. Please wait...");return}let he=ne+oe;Me==="BUY"?he=Math.max(1e-5,Math.min(he,ge-1e-5)):he=Math.max(ge+1e-5,he),X(he>0?he.toFixed(5):""),Le("")},tt=oe=>{const ne=parseFloat(ce)||0,ge=parseFloat(Me==="BUY"?De:we)||0;if(!ge){Le("Current price not available. Please wait...");return}let he=ne+oe;Me==="BUY"?he=Math.max(ge+1e-5,he):he=Math.max(1e-5,Math.min(he,ge-1e-5)),ae(he>0?he.toFixed(5):""),Le("")},MA=async oe=>{Le("");const ne=oe||Me,ge=parseFloat(ne==="BUY"?De:we),he=parseFloat($),ue=V?parseFloat(V):null,Ee=ce?parseFloat(ce):null;if(!he||he<=0||isNaN(he)){Le("Please enter a valid volume (minimum 0.01)");return}if(he<.01){Le("Volume must be at least 0.01");return}if(!ge||ge<=0||isNaN(ge)){Le("Invalid price. Please refresh and try again.");return}if(ue!==null&&ue!==""){if(isNaN(ue)||ue<=0){Le("Stop Loss must be a valid positive number");return}if(ne==="BUY"&&ue>=ge){Le("Stop Loss must be below the current price for BUY orders");return}if(ne==="SELL"&&ue<=ge){Le("Stop Loss must be above the current price for SELL orders");return}}if(Ee!==null&&Ee!==""){if(isNaN(Ee)||Ee<=0){Le("Take Profit must be a valid positive number");return}if(ne==="BUY"){if(Ee<=ge){Le(`Take Profit must be above the entry price (${ge.toFixed(5)}) for BUY orders`);return}}else if(ne==="SELL"&&Ee>=ge){Le(`Take Profit must be below the entry price (${ge.toFixed(5)}) for SELL orders`);return}}Fe(ne),Ue(ne),pe(!0);const At=new Date,ht=At.toLocaleTimeString(),vt=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,_t=localStorage.getItem("token");if(!_t){Le("Please login to place trades"),pe(!1),Ue(null);return}const hs={accountId:s,symbol:d,type:ne,volume:he,price:ge,takeProfit:Ee,stopLoss:ue,comment:de.trim()||null},XA={ticket:vt.substring(0,8),symbol:d,type:ne,volume:parseFloat(he),price:parseFloat(ge),time:ht,stopLoss:ue?parseFloat(ue):null,takeProfit:Ee?parseFloat(Ee):null,swap:0,profit:0,profitCurrency:"USD",comment:de.trim()||"",id:vt,status:"OPEN",openAt:At.toISOString()};if(!a&&x&&x(ZA=>[...ZA,XA]),c&&!n){Le("Execution handler is required in forceParentExecution mode"),pe(!1),Ue(null);return}if(n){pe(!1),Ue(null),e();const ZA={symbol:d,type:ne,lotSize:he,entryPrice:ge,stopLoss:ue,takeProfit:Ee,comment:de.trim()||null};Promise.resolve(n(ZA)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),B&&B()}).catch(cr=>{console.error("❌ Trade execution failed:",cr),!a&&x&&x(Rt=>Rt.filter(Bt=>Bt.id!==vt))})}else{if(c){Le("Fallback API path disabled in forceParentExecution mode"),pe(!1),Ue(null);return}pe(!1),Ue(null),e();const ZA=D||mg?.VITE_BASE_URL||"http://localhost:8000",cr=E?.trades||"/api/trades";nt.post(`${ZA}${cr}`,hs,{headers:{Authorization:`Bearer ${_t}`,"Content-Type":"application/json"}}).then(Rt=>{if(Rt.data&&Rt.data.data){const Bt=Rt.data.data.trade;!a&&x&&x(Jt=>Jt.map(qt=>qt.id===vt?{...qt,id:Bt.id,ticket:Bt.id.substring(0,8),time:ht,openAt:Bt.openAt}:qt)),console.log("✅ Trade saved successfully:",Bt),window.notify&&window.notify(`Trade placed successfully: ${Bt.symbol} ${Bt.type}`,"success")}else{!a&&x&&x(Jt=>Jt.filter(qt=>qt.id!==vt));const Bt=Rt.data?.message||"Failed to place trade";window.notify&&window.notify(Bt,"error")}}).catch(Rt=>{console.error("Error placing trade:",Rt),!a&&x&&x(Jt=>Jt.filter(qt=>qt.id!==vt));let Bt="Failed to place trade";if(Rt.response){const Jt=Rt.response.status,qt=Rt.response.data;Jt===400?Bt=qt?.message||"Invalid trade data. Please check your inputs.":Jt===401?Bt="Authentication failed. Please login again.":Jt===404?Bt=qt?.message||"Symbol not found. Please select a valid symbol.":Jt===500?Bt="Server error. Please try again later.":Bt=qt?.message||`Error: ${Jt}`}else Rt.request&&(Bt="Network error. Please check your internet connection.");window.notify&&window.notify(Bt,"error")})}},_e=(W?.calculateVolumeUnits?.({symbol:d,volume:parseFloat($)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return r?l.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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),l.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),l.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:l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),l.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[xe&&l.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:xe}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),l.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[_e," ",d]})]}),l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("button",{type:"button",onClick:()=>Ie(-.01),className:`absolute left-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"−"}),l.jsx("input",{type:"number",value:$,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d{0,2}$/.test(ne))&&(j(ne),Le(""))},onBlur:()=>{const oe=parseFloat($);j(isNaN(oe)||oe<.01?"0.01":oe.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"}),l.jsx("button",{type:"button",onClick:()=>Ie(.01),className:`absolute right-1 w-8 h-8 flex items-center justify-center rounded text-sm transition-colors z-10 ${N?"bg-slate-100 hover:bg-slate-400 text-slate-700":"bg-[#12161d] hover:bg-slate-600 text-white"}`,children:"+"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("button",{type:"button",onClick:()=>Tt(-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:"−"}),l.jsx("input",{type:"text",value:V,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(X(ne),Le(""))},onBlur:oe=>{const ne=parseFloat(oe.target.value);!isNaN(ne)&&ne>0?X(ne.toFixed(5)):oe.target.value===""&&X("")},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"}`}),l.jsx("button",{type:"button",onClick:()=>Tt(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:"+"})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("button",{type:"button",onClick:()=>tt(-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:"−"}),l.jsx("input",{type:"text",value:ce,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(ae(ne),Le(""))},onBlur:oe=>{const ne=parseFloat(oe.target.value);!isNaN(ne)&&ne>0?ae(ne.toFixed(5)):oe.target.value===""&&ae("")},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"}`}),l.jsx("button",{type:"button",onClick:()=>tt(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:"+"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),l.jsx("textarea",{value:de,onChange:oe=>J(oe.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"}`})]}),l.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),l.jsx("span",{className:`${Ye} font-medium transition-colors duration-400`,children:ke>0?ke.toFixed(5):"---"})]}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),l.jsx("span",{className:`${bt} font-medium transition-colors duration-400`,children:Te>0?Te.toFixed(5):"---"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[l.jsx("button",{onClick:()=>MA("SELL"),disabled:ie,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:ie&&Be==="SELL"?l.jsxs("span",{className:"flex items-center justify-center gap-2",children:[l.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),l.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"}),l.jsx("button",{onClick:()=>MA("BUY"),disabled:ie,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:ie&&Be==="BUY"?l.jsxs("span",{className:"flex items-center justify-center gap-2",children:[l.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),l.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},gg={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"},wg=[10,11,12,14,16,20,24,28,30,40],pn=[{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"}],kA={width:"78%",height:"78%",display:"block"},mh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Bg(r){return r?{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 gh(r,e="#5f8f96"){if(typeof r!="string")return e;const t=r.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const Cg=()=>l.jsx(dg,{style:kA}),vg=()=>l.jsx(pg,{style:kA}),yg=()=>l.jsx(cg,{style:kA}),bg=()=>l.jsx(ug,{style:kA}),Tg=()=>l.jsx(ag,{style:kA}),xg=()=>l.jsx(og,{style:kA}),Qg=()=>l.jsx(lg,{style:kA}),Fg=()=>l.jsx(dh,{style:kA}),Qo=({size:r,children:e})=>l.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:r,height:r},children:e});function ei({checked:r,onClick:e,hideLeftBorder:t,tokens:A,children:i,title:n}){return l.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:r?A.activeFill:"transparent",color:r?A.activeText:A.text,cursor:"pointer",padding:0},children:l.jsx(Qo,{size:"18px",children:i})})}function ti({checked:r,onChange:e,label:t,tokens:A,disabled:i=!1}){return l.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:i?.5:1,cursor:i?"default":"pointer"},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:n=>e(n.target.checked),disabled:i,style:mh}),l.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:r&&l.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),l.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Fo({value:r,onChange:e,onBlur:t,disabled:A=!1,tokens:i}){const n=gh(r,"#5f8f96"),s=(r||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${i.fieldBorder}`,background:i.fieldBg,boxSizing:"border-box"},a={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?i.fieldDisabledText:i.text};return l.jsxs("div",{style:o,children:[l.jsxs("label",{style:a,children:[l.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:A,style:{...mh,position:"absolute"}}),l.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),l.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const d=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(d?`#${d}`:"")},onBlur:t,disabled:A,style:c})]})}function Uo({tokens:r,disabled:e=!1,style:t={},...A}){return l.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?r.fieldDisabledBg:r.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?r.fieldDisabledBg:r.fieldBg,color:e?r.fieldDisabledText:r.text,...t},...A})}function Ug({draft:r,setDraft:e,tokens:t}){const A=r.visibleTimeframes?.length===pn.length,i=()=>{e(s=>({...s,visibleTimeframes:A?[]:pn.map(o=>o.key)}))},n=s=>{e(o=>{const a=o.visibleTimeframes||[];return{...o,visibleTimeframes:a.includes(s)?a.filter(c=>c!==s):[...a,s]}})};return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[l.jsx(ti,{checked:A,onChange:i,label:"Show on all the timeframes",tokens:t}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:pn.map(s=>l.jsx(ti,{checked:(r.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Eg({draft:r,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),i=(n,s,o)=>{A(n,gh(s,o))};return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l.jsx(Fo,{value:r.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>i("color",r.color,"#5f8f96"),tokens:t}),l.jsxs("div",{style:{position:"relative",width:84,height:30},children:[l.jsx("select",{value:r.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text},children:wg.map(n=>l.jsx("option",{value:n,children:n},n))}),l.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText},children:l.jsx(Fg,{})})]}),l.jsxs("div",{style:{display:"flex"},children:[l.jsx(ei,{checked:r.fontWeight==="bold",onClick:()=>A("fontWeight",r.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:l.jsx(yg,{})}),l.jsx(ei,{checked:r.fontStyle==="italic",onClick:()=>A("fontStyle",r.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:l.jsx(bg,{})})]}),l.jsxs("div",{style:{display:"flex"},children:[l.jsx(ei,{checked:r.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:l.jsx(Tg,{})}),l.jsx(ei,{checked:r.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:l.jsx(xg,{})}),l.jsx(ei,{checked:r.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:l.jsx(Qg,{})})]})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[l.jsx(ti,{checked:!!r.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),l.jsx("div",{}),l.jsx("div",{}),l.jsx("div",{}),l.jsx(ti,{checked:!!r.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),l.jsx(Fo,{value:r.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>i("borderColor",r.borderColor,"#5f8f96"),disabled:!r.borderEnabled,tokens:t}),l.jsx(Uo,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!r.borderEnabled,value:r.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),l.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[l.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!r.borderEnabled,value:r.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),l.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:r.borderWidth??1})]}),l.jsx(ti,{checked:!!r.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),l.jsx(Fo,{value:r.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>i("bgColor",r.bgColor,"#5f8f96"),disabled:!r.bgEnabled,tokens:t}),l.jsx(Uo,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!r.bgEnabled,value:r.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),l.jsx("div",{})]}),l.jsx("textarea",{value:r.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 Sg({draft:r,setDraft:e,tokens:t}){return l.jsx("div",{style:{padding:"12px 16px"},children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),l.jsx(Uo,{tokens:t,value:r.price??"",onChange:A=>{const i=Number(A.target.value);Number.isFinite(i)&&e(n=>({...n,price:i}))},style:{width:180}})]})})}function Hg(r){if(!r)return{};const e={visibleTimeframes:r.visibleTimeframes||pn.map(t=>t.key)};return r.type==="text"?{...e,text:r.primitive?.text??r.text??"Text",color:r.primitive?.color??"#5f8f96",fontSize:r.primitive?.fontSize??12,fontWeight:r.primitive?.fontWeight??"normal",fontStyle:r.primitive?.fontStyle??"normal",textAlign:r.primitive?.textAlign??"center",textWrap:r.primitive?.textWrap??!1,borderEnabled:r.primitive?.borderEnabled??!1,borderColor:r.primitive?.borderColor??"#5f8f96",borderOpacity:r.primitive?.borderOpacity??.1,borderWidth:r.primitive?.borderWidth??1,bgEnabled:r.primitive?.bgEnabled??!1,bgColor:r.primitive?.bgColor??"#5f8f96",bgOpacity:r.primitive?.bgOpacity??.1,price:r.price}:e}const wh=({isOpen:r,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:i}=Qt(),s=Bg(i==="light"),[o,a]=Y.useState("style"),[c,h]=Y.useState({});if(Y.useEffect(()=>{t&&(h(Hg(t)),a("style"))},[t]),!r||!t)return null;const d=gg[t.type]||t.type,m=["style","coordinates","visualization"],x=()=>{if(o==="visualization")return l.jsx(Ug,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return l.jsx(Eg,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return l.jsx(Sg,{draft:c,setDraft:h,tokens:s})}return l.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},v=()=>{A(c),e()};return l.jsxs("div",{style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",top:"50%",left:"50%",transform:"translate(-50%, -50%)",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:[l.jsxs("div",{style:{display:"flex",flexShrink:0},children:[l.jsx("div",{style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText},children:l.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[l.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d}),l.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:l.jsx(Qo,{size:"18px",children:l.jsx(Cg,{})})})]})}),l.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:l.jsx(Qo,{size:"20px",children:l.jsx(vg,{})})})]}),l.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:m.map(y=>{const D=o===y;return l.jsxs("button",{type:"button",onClick:()=>a(y),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:D?s.text:s.mutedText,cursor:"pointer"},children:[y.charAt(0).toUpperCase()+y.slice(1),D&&l.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},y)})}),l.jsx("div",{style:{flex:1,overflow:"auto"},children:x()}),l.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[l.jsx("button",{type:"button",onClick:v,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"}),l.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 Eo=function(r,e){return Eo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=A[i])},Eo(r,e)};function uA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Eo(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var So=function(){return So=Object.assign||function(e){for(var t,A=1,i=arguments.length;A<i;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},So.apply(this,arguments)};function kt(r,e,t,A){function i(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(A.next(h))}catch(d){s(d)}}function a(h){try{c(A.throw(h))}catch(d){s(d)}}function c(h){h.done?n(h.value):i(h.value).then(o,a)}c((A=A.apply(r,[])).next())})}function Mt(r,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,i,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(h){return a([c,h])}}function a(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,i&&(n=c[0]&2?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=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++,i=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(r,t)}catch(h){c=[6,h],i=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function fn(r,e,t){if(arguments.length===2)for(var A=0,i=e.length,n;A<i;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return r.concat(n||e)}for(var UA=(function(){function r(e,t,A,i){this.left=e,this.top=t,this.width=A,this.height=i}return r.prototype.add=function(e,t,A,i){return new r(this.left+e,this.top+t,this.width+A,this.height+i)},r.fromClientRect=function(e,t){return new r(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},r.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(i){return i.width!==0});return A?new r(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r})(),mn=function(r,e){return UA.fromClientRect(r,e.getBoundingClientRect())},Lg=function(r){var e=r.body,t=r.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)),i=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new UA(0,0,A,i)},gn=function(r){for(var e=[],t=0,A=r.length;t<A;){var i=r.charCodeAt(t++);if(i>=55296&&i<=56319&&t<A){var n=r.charCodeAt(t++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},pt=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var t=r.length;if(!t)return"";for(var A=[],i=-1,n="";++i<t;){var s=r[i];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(i+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},Bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mg=typeof Uint8Array>"u"?[]:new Uint8Array(256),wn=0;wn<Bh.length;wn++)Mg[Bh.charCodeAt(wn)]=wn;for(var Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ai=typeof Uint8Array>"u"?[]:new Uint8Array(256),Bn=0;Bn<Ch.length;Bn++)Ai[Ch.charCodeAt(Bn)]=Bn;for(var Ig=function(r){var e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Ai[r.charCodeAt(A)],s=Ai[r.charCodeAt(A+1)],o=Ai[r.charCodeAt(A+2)],a=Ai[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},_g=function(r){for(var e=r.length,t=[],A=0;A<e;A+=2)t.push(r[A+1]<<8|r[A]);return t},Dg=function(r){for(var e=r.length,t=[],A=0;A<e;A+=4)t.push(r[A+3]<<24|r[A+2]<<16|r[A+1]<<8|r[A]);return t},nr=5,Ho=11,Lo=2,kg=Ho-nr,vh=65536>>nr,Og=1<<nr,Mo=Og-1,Ng=1024>>nr,Kg=vh+Ng,Pg=Kg,Vg=32,zg=Pg+Vg,Wg=65536>>Ho,Gg=1<<kg,Rg=Gg-1,yh=function(r,e,t){return r.slice?r.slice(e,t):new Uint16Array(Array.prototype.slice.call(r,e,t))},$g=function(r,e,t){return r.slice?r.slice(e,t):new Uint32Array(Array.prototype.slice.call(r,e,t))},Xg=function(r,e){var t=Ig(r),A=Array.isArray(t)?Dg(t):new Uint32Array(t),i=Array.isArray(t)?_g(t):new Uint16Array(t),n=24,s=yh(i,n/2,A[4]/2),o=A[5]===2?yh(i,(n+A[4])/2):$g(A,Math.ceil((n+A[4])/4));return new Zg(A[0],A[1],A[2],A[3],s,o)},Zg=(function(){function r(e,t,A,i,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>nr],t=(t<<Lo)+(e&Mo),this.data[t];if(e<=65535)return t=this.index[vh+(e-55296>>nr)],t=(t<<Lo)+(e&Mo),this.data[t];if(e<this.highStart)return t=zg-Wg+(e>>Ho),t=this.index[t],t+=e>>nr&Rg,t=this.index[t],t=(t<<Lo)+(e&Mo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jg=typeof Uint8Array>"u"?[]:new Uint8Array(256),Cn=0;Cn<bh.length;Cn++)Jg[bh.charCodeAt(Cn)]=Cn;var qg="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==",Th=50,Yg=1,xh=2,Qh=3,jg=4,ew=5,Fh=7,Uh=8,Eh=9,OA=10,Io=11,Sh=12,_o=13,tw=14,ri=15,Do=16,vn=17,ii=18,Aw=19,Hh=20,ko=21,ni=22,Oo=23,vr=24,Zt=25,si=26,oi=27,yr=28,rw=29,sr=30,iw=31,yn=32,bn=33,No=34,Ko=35,Po=36,ai=37,Vo=38,Tn=39,xn=40,zo=41,Lh=42,nw=43,sw=[9001,65288],Mh="!",Ze="×",Qn="÷",Wo=Xg(qg),EA=[sr,Po],Go=[Yg,xh,Qh,ew],Ih=[OA,Uh],_h=[oi,si],ow=Go.concat(Ih),Dh=[Vo,Tn,xn,No,Ko],aw=[ri,_o],lw=function(r,e){e===void 0&&(e="strict");var t=[],A=[],i=[];return r.forEach(function(n,s){var o=Wo.get(n);if(o>Th?(i.push(!0),o-=Th):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(Do);if(o===jg||o===Io){if(s===0)return A.push(s),t.push(sr);var a=t[s-1];return ow.indexOf(a)===-1?(A.push(A[s-1]),t.push(a)):(A.push(s),t.push(sr))}if(A.push(s),o===iw)return t.push(e==="strict"?ko:ai);if(o===Lh||o===rw)return t.push(sr);if(o===nw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(ai):t.push(sr);t.push(o)}),[A,t,i]},Ro=function(r,e,t,A){var i=A[t];if(Array.isArray(r)?r.indexOf(i)!==-1:r===i)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==OA)break}if(i===OA)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(r)?r.indexOf(o)!==-1:r===o)for(var a=t;a<=A.length;){a++;var s=A[a];if(s===e)return!0;if(s!==OA)break}if(o!==OA)break}return!1},kh=function(r,e){for(var t=r;t>=0;){var A=e[t];if(A===OA)t--;else return A}return 0},cw=function(r,e,t,A,i){if(t[A]===0)return Ze;var n=A-1;if(Array.isArray(i)&&i[n]===!0)return Ze;var s=n-1,o=n+1,a=e[n],c=s>=0?e[s]:0,h=e[o];if(a===xh&&h===Qh)return Ze;if(Go.indexOf(a)!==-1)return Mh;if(Go.indexOf(h)!==-1||Ih.indexOf(h)!==-1)return Ze;if(kh(n,e)===Uh)return Qn;if(Wo.get(r[n])===Io||(a===yn||a===bn)&&Wo.get(r[o])===Io||a===Fh||h===Fh||a===Eh||[OA,_o,ri].indexOf(a)===-1&&h===Eh||[vn,ii,Aw,vr,yr].indexOf(h)!==-1||kh(n,e)===ni||Ro(Oo,ni,n,e)||Ro([vn,ii],ko,n,e)||Ro(Sh,Sh,n,e))return Ze;if(a===OA)return Qn;if(a===Oo||h===Oo)return Ze;if(h===Do||a===Do)return Qn;if([_o,ri,ko].indexOf(h)!==-1||a===tw||c===Po&&aw.indexOf(a)!==-1||a===yr&&h===Po||h===Hh||EA.indexOf(h)!==-1&&a===Zt||EA.indexOf(a)!==-1&&h===Zt||a===oi&&[ai,yn,bn].indexOf(h)!==-1||[ai,yn,bn].indexOf(a)!==-1&&h===si||EA.indexOf(a)!==-1&&_h.indexOf(h)!==-1||_h.indexOf(a)!==-1&&EA.indexOf(h)!==-1||[oi,si].indexOf(a)!==-1&&(h===Zt||[ni,ri].indexOf(h)!==-1&&e[o+1]===Zt)||[ni,ri].indexOf(a)!==-1&&h===Zt||a===Zt&&[Zt,yr,vr].indexOf(h)!==-1)return Ze;if([Zt,yr,vr,vn,ii].indexOf(h)!==-1)for(var d=n;d>=0;){var m=e[d];if(m===Zt)return Ze;if([yr,vr].indexOf(m)!==-1)d--;else break}if([oi,si].indexOf(h)!==-1)for(var d=[vn,ii].indexOf(a)!==-1?s:n;d>=0;){var m=e[d];if(m===Zt)return Ze;if([yr,vr].indexOf(m)!==-1)d--;else break}if(Vo===a&&[Vo,Tn,No,Ko].indexOf(h)!==-1||[Tn,No].indexOf(a)!==-1&&[Tn,xn].indexOf(h)!==-1||[xn,Ko].indexOf(a)!==-1&&h===xn||Dh.indexOf(a)!==-1&&[Hh,si].indexOf(h)!==-1||Dh.indexOf(h)!==-1&&a===oi||EA.indexOf(a)!==-1&&EA.indexOf(h)!==-1||a===vr&&EA.indexOf(h)!==-1||EA.concat(Zt).indexOf(a)!==-1&&h===ni&&sw.indexOf(r[o])===-1||EA.concat(Zt).indexOf(h)!==-1&&a===ii)return Ze;if(a===zo&&h===zo){for(var x=t[n],v=1;x>0&&(x--,e[x]===zo);)v++;if(v%2!==0)return Ze}return a===yn&&h===bn?Ze:Qn},hw=function(r,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=lw(r,e.lineBreak),A=t[0],i=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[Zt,sr,Lh].indexOf(o)!==-1?ai:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,a){return o&&r[a]>=19968&&r[a]<=40959}):void 0;return[A,i,s]},uw=(function(){function r(e,t,A,i){this.codePoints=e,this.required=t===Mh,this.start=A,this.end=i}return r.prototype.slice=function(){return pt.apply(void 0,this.codePoints.slice(this.start,this.end))},r})(),dw=function(r,e){var t=gn(r),A=hw(t,e),i=A[0],n=A[1],s=A[2],o=t.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=Ze;c<o&&(h=cw(t,n,i,++c,s))===Ze;);if(h!==Ze||c===o){var d=new uw(t,h,a,c);return a=c,{value:d,done:!1}}return{done:!0,value:null}}}},pw=1,fw=2,li=4,Oh=8,Fn=10,Nh=47,ci=92,mw=9,gw=32,Un=34,hi=61,ww=35,Bw=36,Cw=37,En=39,Sn=40,ui=41,vw=95,zt=45,yw=33,bw=60,Tw=62,xw=64,Qw=91,Fw=93,Uw=61,Ew=123,Hn=63,Sw=125,Kh=124,Hw=126,Lw=128,Ph=65533,$o=42,or=43,Mw=44,Iw=58,_w=59,di=46,Dw=0,kw=8,Ow=11,Nw=14,Kw=31,Pw=127,CA=-1,Vh=48,zh=97,Wh=101,Vw=102,zw=117,Ww=122,Gh=65,Rh=69,$h=70,Gw=85,Rw=90,It=function(r){return r>=Vh&&r<=57},$w=function(r){return r>=55296&&r<=57343},br=function(r){return It(r)||r>=Gh&&r<=$h||r>=zh&&r<=Vw},Xw=function(r){return r>=zh&&r<=Ww},Zw=function(r){return r>=Gh&&r<=Rw},Jw=function(r){return Xw(r)||Zw(r)},qw=function(r){return r>=Lw},Ln=function(r){return r===Fn||r===mw||r===gw},Mn=function(r){return Jw(r)||qw(r)||r===vw},Xh=function(r){return Mn(r)||It(r)||r===zt},Yw=function(r){return r>=Dw&&r<=kw||r===Ow||r>=Nw&&r<=Kw||r===Pw},NA=function(r,e){return r!==ci?!1:e!==Fn},In=function(r,e,t){return r===zt?Mn(e)||NA(e,t):Mn(r)?!0:!!(r===ci&&NA(r,e))},Xo=function(r,e,t){return r===or||r===zt?It(e)?!0:e===di&&It(t):It(r===di?e:r)},jw=function(r){var e=0,t=1;(r[e]===or||r[e]===zt)&&(r[e]===zt&&(t=-1),e++);for(var A=[];It(r[e]);)A.push(r[e++]);var i=A.length?parseInt(pt.apply(void 0,A),10):0;r[e]===di&&e++;for(var n=[];It(r[e]);)n.push(r[e++]);var s=n.length,o=s?parseInt(pt.apply(void 0,n),10):0;(r[e]===Rh||r[e]===Wh)&&e++;var a=1;(r[e]===or||r[e]===zt)&&(r[e]===zt&&(a=-1),e++);for(var c=[];It(r[e]);)c.push(r[e++]);var h=c.length?parseInt(pt.apply(void 0,c),10):0;return t*(i+o*Math.pow(10,-s))*Math.pow(10,a*h)},eB={type:2},tB={type:3},AB={type:4},rB={type:13},iB={type:8},nB={type:21},sB={type:9},oB={type:10},aB={type:11},lB={type:12},cB={type:14},_n={type:23},hB={type:1},uB={type:25},dB={type:24},pB={type:26},fB={type:27},mB={type:28},gB={type:29},wB={type:31},Zo={type:32},Zh=(function(){function r(){this._value=[]}return r.prototype.write=function(e){this._value=this._value.concat(gn(e))},r.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Zo;)e.push(t),t=this.consumeToken();return e},r.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Un:return this.consumeStringToken(Un);case ww:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Xh(t)||NA(A,i)){var n=In(t,A,i)?fw:pw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Bw:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),rB;break;case En:return this.consumeStringToken(En);case Sn:return eB;case ui:return tB;case $o:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),cB;break;case or:if(Xo(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Mw:return AB;case zt:var o=e,a=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Xo(o,a,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(In(o,a,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(a===zt&&c===Tw)return this.consumeCodePoint(),this.consumeCodePoint(),dB;break;case di:if(Xo(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Nh:if(this.peekCodePoint(0)===$o)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===$o&&(h=this.consumeCodePoint(),h===Nh))return this.consumeToken();if(h===CA)return this.consumeToken()}break;case Iw:return pB;case _w:return fB;case bw:if(this.peekCodePoint(0)===yw&&this.peekCodePoint(1)===zt&&this.peekCodePoint(2)===zt)return this.consumeCodePoint(),this.consumeCodePoint(),uB;break;case xw:var d=this.peekCodePoint(0),m=this.peekCodePoint(1),x=this.peekCodePoint(2);if(In(d,m,x)){var s=this.consumeName();return{type:7,value:s}}break;case Qw:return mB;case ci:if(NA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Fw:return gB;case Uw:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),iB;break;case Ew:return aB;case Sw:return lB;case zw:case Gw:var v=this.peekCodePoint(0),B=this.peekCodePoint(1);return v===or&&(br(B)||B===Hn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Kh:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),sB;if(this.peekCodePoint(0)===Kh)return this.consumeCodePoint(),nB;break;case Hw:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),oB;break;case CA:return Zo}return Ln(e)?(this.consumeWhiteSpace(),wB):It(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Mn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:pt(e)}},r.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},r.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},r.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},r.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();br(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===Hn&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var i=parseInt(pt.apply(void 0,e.map(function(a){return a===Hn?Vh:a})),16),n=parseInt(pt.apply(void 0,e.map(function(a){return a===Hn?$h:a})),16);return{type:30,start:i,end:n}}var s=parseInt(pt.apply(void 0,e),16);if(this.peekCodePoint(0)===zt&&br(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];br(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(pt.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},r.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Sn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Sn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},r.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===CA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===En||t===Un){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===CA||this.peekCodePoint(0)===ui)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),_n)}for(;;){var i=this.consumeCodePoint();if(i===CA||i===ui)return{type:22,value:pt.apply(void 0,e)};if(Ln(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===CA||this.peekCodePoint(0)===ui?(this.consumeCodePoint(),{type:22,value:pt.apply(void 0,e)}):(this.consumeBadUrlRemnants(),_n);if(i===Un||i===En||i===Sn||Yw(i))return this.consumeBadUrlRemnants(),_n;if(i===ci)if(NA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),_n;else e.push(i)}},r.prototype.consumeWhiteSpace=function(){for(;Ln(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ui||e===CA)return;NA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var i=Math.min(t,e);A+=pt.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),A},r.prototype.consumeStringToken=function(e){var t="",A=0;do{var i=this._value[A];if(i===CA||i===void 0||i===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(i===Fn)return this._value.splice(0,A),hB;if(i===ci){var n=this._value[A+1];n!==CA&&n!==void 0&&(n===Fn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):NA(i,n)&&(t+=this.consumeStringSlice(A),t+=pt(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},r.prototype.consumeNumber=function(){var e=[],t=li,A=this.peekCodePoint(0);for((A===or||A===zt)&&e.push(this.consumeCodePoint());It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(A===di&&It(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Oh;It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===Rh||A===Wh)&&((i===or||i===zt)&&It(n)||It(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Oh;It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[jw(e),t]},r.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(In(i,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return i===Cw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},r.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(br(e)){for(var t=pt(e);br(this.peekCodePoint(0))&&t.length<6;)t+=pt(this.consumeCodePoint());Ln(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||$w(A)||A>1114111?Ph:A}return e===CA?Ph:e},r.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Xh(t))e+=pt(t);else if(NA(t,this.peekCodePoint(0)))e+=pt(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},r})(),Jh=(function(){function r(e){this._tokens=e}return r.create=function(e){var t=new Zh;return t.write(e),new r(t.read())},r.parseValue=function(e){return r.create(e).parseComponentValue()},r.parseValues=function(e){return r.create(e).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var 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")},r.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},r.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},r.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||CB(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},r.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())}},r.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Zo:e},r.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},r})(),pi=function(r){return r.type===15},Tr=function(r){return r.type===17},rt=function(r){return r.type===20},BB=function(r){return r.type===0},Jo=function(r,e){return rt(r)&&r.value===e},qh=function(r){return r.type!==31},xr=function(r){return r.type!==31&&r.type!==4},vA=function(r){var e=[],t=[];return r.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},CB=function(r,e){return e===11&&r.type===12||e===28&&r.type===29?!0:e===2&&r.type===3},KA=function(r){return r.type===17||r.type===15},wt=function(r){return r.type===16||KA(r)},Yh=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},Ft={type:17,number:0,flags:li},qo={type:16,number:50,flags:li},PA={type:16,number:100,flags:li},fi=function(r,e,t){var A=r[0],i=r[1];return[st(A,e),st(typeof i<"u"?i:A,t)]},st=function(r,e){if(r.type===16)return r.number/100*e;if(pi(r))switch(r.unit){case"rem":case"em":return 16*r.number;default:return r.number}return r.number},jh="deg",eu="grad",tu="rad",Au="turn",Dn={name:"angle",parse:function(r,e){if(e.type===15)switch(e.unit){case jh:return Math.PI*e.number/180;case eu:return Math.PI/200*e.number;case tu:return e.number;case Au:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},ru=function(r){return r.type===15&&(r.unit===jh||r.unit===eu||r.unit===tu||r.unit===Au)},iu=function(r){var e=r.filter(rt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Ft,Ft];case"to top":case"bottom":return iA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Ft,PA];case"to right":case"left":return iA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[PA,PA];case"to bottom":case"top":return iA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[PA,Ft];case"to left":case"right":return iA(270)}return 0},iA=function(r){return Math.PI*r/180},VA={name:"color",parse:function(r,e){if(e.type===18){var t=vB[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(r,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3);return WA(parseInt(A+A,16),parseInt(i+i,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return WA(parseInt(A+A,16),parseInt(i+i,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6);return WA(parseInt(A,16),parseInt(i,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return WA(parseInt(A,16),parseInt(i,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=SA[e.value.toUpperCase()];if(typeof o<"u")return o}return SA.TRANSPARENT}},zA=function(r){return(255&r)===0},yt=function(r){var e=255&r,t=255&r>>8,A=255&r>>16,i=255&r>>24;return e<255?"rgba("+i+","+A+","+t+","+e/255+")":"rgb("+i+","+A+","+t+")"},WA=function(r,e,t,A){return(r<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},nu=function(r,e){if(r.type===17)return r.number;if(r.type===16){var t=e===3?1:255;return e===3?r.number/100*t:Math.round(r.number/100*t)}return 0},su=function(r,e){var t=e.filter(xr);if(t.length===3){var A=t.map(nu),i=A[0],n=A[1],s=A[2];return WA(i,n,s,1)}if(t.length===4){var o=t.map(nu),i=o[0],n=o[1],s=o[2],a=o[3];return WA(i,n,s,a)}return 0};function Yo(r,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-r)*t*6+r:t<1/2?e:t<2/3?(e-r)*6*(2/3-t)+r:r}var ou=function(r,e){var t=e.filter(xr),A=t[0],i=t[1],n=t[2],s=t[3],o=(A.type===17?iA(A.number):Dn.parse(r,A))/(Math.PI*2),a=wt(i)?i.number/100:0,c=wt(n)?n.number/100:0,h=typeof s<"u"&&wt(s)?st(s,1):1;if(a===0)return WA(c*255,c*255,c*255,1);var d=c<=.5?c*(a+1):c+a-c*a,m=c*2-d,x=Yo(m,d,o+1/3),v=Yo(m,d,o),B=Yo(m,d,o-1/3);return WA(x*255,v*255,B*255,h)},vB={hsl:ou,hsla:ou,rgb:su,rgba:su},mi=function(r,e){return VA.parse(r,Jh.create(e).parseComponentValue())},SA={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},yB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(t){if(rt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},bB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},kn=function(r,e){var t=VA.parse(r,e[0]),A=e[1];return A&&wt(A)?{color:t,stop:A}:{color:t,stop:null}},au=function(r,e){var t=r[0],A=r[r.length-1];t.stop===null&&(t.stop=Ft),A.stop===null&&(A.stop=PA);for(var i=[],n=0,s=0;s<r.length;s++){var o=r[s].stop;if(o!==null){var a=st(o,e);a>n?i.push(a):i.push(n),n=a}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var h=i[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var d=s-c,m=i[c-1],x=(h-m)/(d+1),v=1;v<=d;v++)i[c+v-1]=x*v;c=null}}return r.map(function(B,y){var D=B.color;return{color:D,stop:Math.max(Math.min(1,i[y]/e),0)}})},TB=function(r,e,t){var A=e/2,i=t/2,n=st(r[0],e)-A,s=i-st(r[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},xB=function(r,e,t){var A=typeof r=="number"?r:TB(r,e,t),i=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=i/2,a=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[i,n-c,n+c,s-a,s+a]},dA=function(r,e){return Math.sqrt(r*r+e*e)},lu=function(r,e,t,A,i){var n=[[0,0],[0,e],[r,0],[r,e]];return n.reduce(function(s,o){var a=o[0],c=o[1],h=dA(t-a,A-c);return(i?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},QB=function(r,e,t,A,i){var n=0,s=0;switch(r.size){case 0:r.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-i)):r.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(r.shape===0)n=s=Math.min(dA(e,t),dA(e,t-i),dA(e-A,t),dA(e-A,t-i));else if(r.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-A)),a=lu(A,i,e,t,!0),c=a[0],h=a[1];n=dA(c-e,(h-t)/o),s=o*n}break;case 1:r.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-i)):r.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(r.shape===0)n=s=Math.max(dA(e,t),dA(e,t-i),dA(e-A,t),dA(e-A,t-i));else if(r.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-A)),d=lu(A,i,e,t,!1),c=d[0],h=d[1];n=dA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(r.size)&&(n=st(r.size[0],A),s=r.size.length===2?st(r.size[1],i):n),[n,s]},FB=function(r,e){var t=iA(180),A=[];return vA(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&s.value==="to"){t=iu(i);return}else if(ru(s)){t=Dn.parse(r,s);return}}var o=kn(r,i);A.push(o)}),{angle:t,stops:A,type:1}},On=function(r,e){var t=iA(180),A=[];return vA(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=iu(i);return}else if(ru(s)){t=(Dn.parse(r,s)+iA(270))%iA(360);return}}var o=kn(r,i);A.push(o)}),{angle:t,stops:A,type:1}},UB=function(r,e){var t=iA(180),A=[],i=1,n=0,s=3,o=[];return vA(e).forEach(function(a,c){var h=a[0];if(c===0){if(rt(h)&&h.value==="linear"){i=1;return}else if(rt(h)&&h.value==="radial"){i=2;return}}if(h.type===18){if(h.name==="from"){var d=VA.parse(r,h.values[0]);A.push({stop:Ft,color:d})}else if(h.name==="to"){var d=VA.parse(r,h.values[0]);A.push({stop:PA,color:d})}else if(h.name==="color-stop"){var m=h.values.filter(xr);if(m.length===2){var d=VA.parse(r,m[1]),x=m[0];Tr(x)&&A.push({stop:{type:16,number:x.number*100,flags:x.flags},color:d})}}}}),i===1?{angle:(t+iA(180))%iA(360),stops:A,type:i}:{size:s,shape:n,stops:A,position:o,type:i}},cu="closest-side",hu="farthest-side",uu="closest-corner",du="farthest-corner",pu="circle",fu="ellipse",mu="cover",gu="contain",EB=function(r,e){var t=0,A=3,i=[],n=[];return vA(e).forEach(function(s,o){var a=!0;if(o===0){var c=!1;a=s.reduce(function(d,m){if(c)if(rt(m))switch(m.value){case"center":return n.push(qo),d;case"top":case"left":return n.push(Ft),d;case"right":case"bottom":return n.push(PA),d}else(wt(m)||KA(m))&&n.push(m);else if(rt(m))switch(m.value){case pu:return t=0,!1;case fu:return t=1,!1;case"at":return c=!0,!1;case cu:return A=0,!1;case mu:case hu:return A=1,!1;case gu:case uu:return A=2,!1;case du:return A=3,!1}else if(KA(m)||wt(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return d},a)}if(a){var h=kn(r,s);i.push(h)}}),{size:A,shape:t,stops:i,position:n,type:2}},Nn=function(r,e){var t=0,A=3,i=[],n=[];return vA(e).forEach(function(s,o){var a=!0;if(o===0?a=s.reduce(function(h,d){if(rt(d))switch(d.value){case"center":return n.push(qo),!1;case"top":case"left":return n.push(Ft),!1;case"right":case"bottom":return n.push(PA),!1}else if(wt(d)||KA(d))return n.push(d),!1;return h},a):o===1&&(a=s.reduce(function(h,d){if(rt(d))switch(d.value){case pu:return t=0,!1;case fu:return t=1,!1;case gu:case cu:return A=0,!1;case hu:return A=1,!1;case uu:return A=2,!1;case mu:case du:return A=3,!1}else if(KA(d)||wt(d))return Array.isArray(A)||(A=[]),A.push(d),!1;return h},a)),a){var c=kn(r,s);i.push(c)}}),{size:A,shape:t,stops:i,position:n,type:2}},SB=function(r){return r.type===1},HB=function(r){return r.type===2},jo={name:"image",parse:function(r,e){if(e.type===22){var t={url:e.value,type:0};return r.cache.addImage(e.value),t}if(e.type===18){var A=wu[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(r,e.values)}throw new Error("Unsupported image type "+e.type)}};function LB(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!wu[r.name])}var wu={"linear-gradient":FB,"-moz-linear-gradient":On,"-ms-linear-gradient":On,"-o-linear-gradient":On,"-webkit-linear-gradient":On,"radial-gradient":EB,"-moz-radial-gradient":Nn,"-ms-radial-gradient":Nn,"-o-radial-gradient":Nn,"-webkit-radial-gradient":Nn,"-webkit-gradient":UB},MB={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return xr(A)&&LB(A)}).map(function(A){return jo.parse(r,A)})}},IB={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(t){if(rt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},_B={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,e){return vA(e).map(function(t){return t.filter(wt)}).map(Yh)}},DB={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,e){return vA(e).map(function(t){return t.filter(rt).map(function(A){return A.value}).join(" ")}).map(kB)}},kB=function(r){switch(r){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},Qr;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(Qr||(Qr={}));var OB={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,e){return vA(e).map(function(t){return t.filter(NB)})}},NB=function(r){return rt(r)||wt(r)},Kn=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},KB=Kn("top"),PB=Kn("right"),VB=Kn("bottom"),zB=Kn("left"),Pn=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Yh(t.filter(wt))}}},WB=Pn("top-left"),GB=Pn("top-right"),RB=Pn("bottom-right"),$B=Pn("bottom-left"),Vn=function(r){return{name:"border-"+r+"-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}}},XB=Vn("top"),ZB=Vn("right"),JB=Vn("bottom"),qB=Vn("left"),zn=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return pi(t)?t.number:0}}},YB=zn("top"),jB=zn("right"),e2=zn("bottom"),t2=zn("left"),A2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},r2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,e){return e==="rtl"?1:0}},i2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).reduce(function(t,A){return t|n2(A.value)},0)}},n2=function(r){switch(r){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},s2={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},o2={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Wn;(function(r){r.NORMAL="normal",r.STRICT="strict"})(Wn||(Wn={}));var a2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="strict"?Wn.STRICT:Wn.NORMAL}},l2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Bu=function(r,e){return rt(r)&&r.value==="normal"?1.2*e:r.type===17?e*r.number:wt(r)?st(r,e):e},c2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,e){return e.type===20&&e.value==="none"?null:jo.parse(r,e)}},h2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,e){return e==="inside"?0:1}},ea={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Gn=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},u2=Gn("top"),d2=Gn("right"),p2=Gn("bottom"),f2=Gn("left"),m2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).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}})}},g2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="break-word"?"break-word":"normal"}},Rn=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},w2=Rn("top"),B2=Rn("right"),C2=Rn("bottom"),v2=Rn("left"),y2={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},b2={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},T2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Jo(e[0],"none")?[]:vA(e).map(function(t){for(var A={color:SA.TRANSPARENT,offsetX:Ft,offsetY:Ft,blur:Ft},i=0,n=0;n<t.length;n++){var s=t[n];KA(s)?(i===0?A.offsetX=s:i===1?A.offsetY=s:A.blur=s,i++):A.color=VA.parse(r,s)}return A})}},x2={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Q2={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=E2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},F2=function(r){var e=r.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},U2=function(r){var e=r.filter(function(a){return a.type===17}).map(function(a){return a.number}),t=e[0],A=e[1];e[2],e[3];var i=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,A,i,n,s,o]:null},E2={matrix:F2,matrix3d:U2},Cu={type:16,number:50,flags:li},S2=[Cu,Cu],H2={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,e){var t=e.filter(wt);return t.length!==2?S2:[t[0],t[1]]}},L2={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},gi;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(gi||(gi={}));for(var M2={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"break-all":return gi.BREAK_ALL;case"keep-all":return gi.KEEP_ALL;default:return gi.NORMAL}}},I2={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,e){if(e.type===20)return{auto:!0,order:0};if(Tr(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},vu={name:"time",parse:function(r,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},_2={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,e){return Tr(e)?e.number:1}},D2={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},k2={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).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})}},O2={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,e){var t=[],A=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},N2={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},K2={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,e){return Tr(e)?e.number:rt(e)&&e.value==="bold"?700:400}},P2={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.filter(rt).map(function(t){return t.value})}},V2={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Ct=function(r,e){return(r&e)!==0},z2={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},W2={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],i=e.filter(qh),n=0;n<i.length;n++){var s=i[n],o=i[n+1];if(s.type===20){var a=o&&Tr(o)?o.number:1;A.push({counter:s.value,increment:a})}}return A}},G2={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return[];for(var t=[],A=e.filter(qh),i=0;i<A.length;i++){var n=A[i],s=A[i+1];if(rt(n)&&n.value!=="none"){var o=s&&Tr(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},R2={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,e){return e.filter(pi).map(function(t){return vu.parse(r,t)})}},$2={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],i=e.filter(BB);if(i.length%2!==0)return null;for(var n=0;n<i.length;n+=2){var s=i[n].value,o=i[n+1].value;A.push({open:s,close:o})}return A}},yu=function(r,e,t){if(!r)return"";var A=r[Math.min(e,r.length-1)];return A?t?A.open:A.close:""},X2={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Jo(e[0],"none")?[]:vA(e).map(function(t){for(var A={color:255,offsetX:Ft,offsetY:Ft,blur:Ft,spread:Ft,inset:!1},i=0,n=0;n<t.length;n++){var s=t[n];Jo(s,"inset")?A.inset=!0:KA(s)?(i===0?A.offsetX=s:i===1?A.offsetY=s:i===2?A.blur=s:A.spread=s,i++):A.color=VA.parse(r,s)}return A})}},Z2={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,e){var t=[0,1,2],A=[];return e.filter(rt).forEach(function(i){switch(i.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(i){A.indexOf(i)===-1&&A.push(i)}),A}},J2={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},q2={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,e){return pi(e)?e.number:0}},Y2=(function(){function r(e,t){var A,i;this.animationDuration=Se(e,R2,t.animationDuration),this.backgroundClip=Se(e,yB,t.backgroundClip),this.backgroundColor=Se(e,bB,t.backgroundColor),this.backgroundImage=Se(e,MB,t.backgroundImage),this.backgroundOrigin=Se(e,IB,t.backgroundOrigin),this.backgroundPosition=Se(e,_B,t.backgroundPosition),this.backgroundRepeat=Se(e,DB,t.backgroundRepeat),this.backgroundSize=Se(e,OB,t.backgroundSize),this.borderTopColor=Se(e,KB,t.borderTopColor),this.borderRightColor=Se(e,PB,t.borderRightColor),this.borderBottomColor=Se(e,VB,t.borderBottomColor),this.borderLeftColor=Se(e,zB,t.borderLeftColor),this.borderTopLeftRadius=Se(e,WB,t.borderTopLeftRadius),this.borderTopRightRadius=Se(e,GB,t.borderTopRightRadius),this.borderBottomRightRadius=Se(e,RB,t.borderBottomRightRadius),this.borderBottomLeftRadius=Se(e,$B,t.borderBottomLeftRadius),this.borderTopStyle=Se(e,XB,t.borderTopStyle),this.borderRightStyle=Se(e,ZB,t.borderRightStyle),this.borderBottomStyle=Se(e,JB,t.borderBottomStyle),this.borderLeftStyle=Se(e,qB,t.borderLeftStyle),this.borderTopWidth=Se(e,YB,t.borderTopWidth),this.borderRightWidth=Se(e,jB,t.borderRightWidth),this.borderBottomWidth=Se(e,e2,t.borderBottomWidth),this.borderLeftWidth=Se(e,t2,t.borderLeftWidth),this.boxShadow=Se(e,X2,t.boxShadow),this.color=Se(e,A2,t.color),this.direction=Se(e,r2,t.direction),this.display=Se(e,i2,t.display),this.float=Se(e,s2,t.cssFloat),this.fontFamily=Se(e,O2,t.fontFamily),this.fontSize=Se(e,N2,t.fontSize),this.fontStyle=Se(e,V2,t.fontStyle),this.fontVariant=Se(e,P2,t.fontVariant),this.fontWeight=Se(e,K2,t.fontWeight),this.letterSpacing=Se(e,o2,t.letterSpacing),this.lineBreak=Se(e,a2,t.lineBreak),this.lineHeight=Se(e,l2,t.lineHeight),this.listStyleImage=Se(e,c2,t.listStyleImage),this.listStylePosition=Se(e,h2,t.listStylePosition),this.listStyleType=Se(e,ea,t.listStyleType),this.marginTop=Se(e,u2,t.marginTop),this.marginRight=Se(e,d2,t.marginRight),this.marginBottom=Se(e,p2,t.marginBottom),this.marginLeft=Se(e,f2,t.marginLeft),this.opacity=Se(e,_2,t.opacity);var n=Se(e,m2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Se(e,g2,t.overflowWrap),this.paddingTop=Se(e,w2,t.paddingTop),this.paddingRight=Se(e,B2,t.paddingRight),this.paddingBottom=Se(e,C2,t.paddingBottom),this.paddingLeft=Se(e,v2,t.paddingLeft),this.paintOrder=Se(e,Z2,t.paintOrder),this.position=Se(e,b2,t.position),this.textAlign=Se(e,y2,t.textAlign),this.textDecorationColor=Se(e,D2,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Se(e,k2,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Se(e,T2,t.textShadow),this.textTransform=Se(e,x2,t.textTransform),this.transform=Se(e,Q2,t.transform),this.transformOrigin=Se(e,H2,t.transformOrigin),this.visibility=Se(e,L2,t.visibility),this.webkitTextStrokeColor=Se(e,J2,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Se(e,q2,t.webkitTextStrokeWidth),this.wordBreak=Se(e,M2,t.wordBreak),this.zIndex=Se(e,I2,t.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return zA(this.backgroundColor)},r.prototype.isTransformed=function(){return this.transform!==null},r.prototype.isPositioned=function(){return this.position!==0},r.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},r.prototype.isFloating=function(){return this.float!==0},r.prototype.isInlineLevel=function(){return Ct(this.display,4)||Ct(this.display,33554432)||Ct(this.display,268435456)||Ct(this.display,536870912)||Ct(this.display,67108864)||Ct(this.display,134217728)},r})(),j2=(function(){function r(e,t){this.content=Se(e,z2,t.content),this.quotes=Se(e,$2,t.quotes)}return r})(),bu=(function(){function r(e,t){this.counterIncrement=Se(e,W2,t.counterIncrement),this.counterReset=Se(e,G2,t.counterReset)}return r})(),Se=function(r,e,t){var A=new Zh,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(i);var n=new Jh(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(r,rt(s)?s.value:e.initialValue);case 0:return e.parse(r,n.parseComponentValue());case 1:return e.parse(r,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return Dn.parse(r,n.parseComponentValue());case"color":return VA.parse(r,n.parseComponentValue());case"image":return jo.parse(r,n.parseComponentValue());case"length":var o=n.parseComponentValue();return KA(o)?o:Ft;case"length-percentage":var a=n.parseComponentValue();return wt(a)?a:Ft;case"time":return vu.parse(r,n.parseComponentValue())}break}},eC="data-html2canvas-debug",tC=function(r){var e=r.getAttribute(eC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},ta=function(r,e){var t=tC(r);return t===1||e===t},yA=(function(){function r(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,ta(t,3))debugger;this.styles=new Y2(e,window.getComputedStyle(t,null)),fa(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),ta(t,4)&&(this.flags|=16)}return r})(),AC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wi=typeof Uint8Array>"u"?[]:new Uint8Array(256),$n=0;$n<Tu.length;$n++)wi[Tu.charCodeAt($n)]=$n;for(var rC=function(r){var e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=wi[r.charCodeAt(A)],s=wi[r.charCodeAt(A+1)],o=wi[r.charCodeAt(A+2)],a=wi[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},iC=function(r){for(var e=r.length,t=[],A=0;A<e;A+=2)t.push(r[A+1]<<8|r[A]);return t},nC=function(r){for(var e=r.length,t=[],A=0;A<e;A+=4)t.push(r[A+3]<<24|r[A+2]<<16|r[A+1]<<8|r[A]);return t},ar=5,Aa=11,ra=2,sC=Aa-ar,xu=65536>>ar,oC=1<<ar,ia=oC-1,aC=1024>>ar,lC=xu+aC,cC=lC,hC=32,uC=cC+hC,dC=65536>>Aa,pC=1<<sC,fC=pC-1,Qu=function(r,e,t){return r.slice?r.slice(e,t):new Uint16Array(Array.prototype.slice.call(r,e,t))},mC=function(r,e,t){return r.slice?r.slice(e,t):new Uint32Array(Array.prototype.slice.call(r,e,t))},gC=function(r,e){var t=rC(r),A=Array.isArray(t)?nC(t):new Uint32Array(t),i=Array.isArray(t)?iC(t):new Uint16Array(t),n=24,s=Qu(i,n/2,A[4]/2),o=A[5]===2?Qu(i,(n+A[4])/2):mC(A,Math.ceil((n+A[4])/4));return new wC(A[0],A[1],A[2],A[3],s,o)},wC=(function(){function r(e,t,A,i,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ar],t=(t<<ra)+(e&ia),this.data[t];if(e<=65535)return t=this.index[xu+(e-55296>>ar)],t=(t<<ra)+(e&ia),this.data[t];if(e<this.highStart)return t=uC-dC+(e>>Aa),t=this.index[t],t+=e>>ar&fC,t=this.index[t],t=(t<<ra)+(e&ia),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),Fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BC=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<Fu.length;Xn++)BC[Fu.charCodeAt(Xn)]=Xn;var CC=1,na=2,sa=3,Uu=4,Eu=5,vC=7,Su=8,oa=9,aa=10,Hu=11,Lu=12,Mu=13,Iu=14,la=15,yC=function(r){for(var e=[],t=0,A=r.length;t<A;){var i=r.charCodeAt(t++);if(i>=55296&&i<=56319&&t<A){var n=r.charCodeAt(t++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},bC=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var t=r.length;if(!t)return"";for(var A=[],i=-1,n="";++i<t;){var s=r[i];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(i+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},TC=gC(AC),nA="×",ca="÷",xC=function(r){return TC.get(r)},QC=function(r,e,t){var A=t-2,i=e[A],n=e[t-1],s=e[t];if(n===na&&s===sa)return nA;if(n===na||n===sa||n===Uu||s===na||s===sa||s===Uu)return ca;if(n===Su&&[Su,oa,Hu,Lu].indexOf(s)!==-1||(n===Hu||n===oa)&&(s===oa||s===aa)||(n===Lu||n===aa)&&s===aa||s===Mu||s===Eu||s===vC||n===CC)return nA;if(n===Mu&&s===Iu){for(;i===Eu;)i=e[--A];if(i===Iu)return nA}if(n===la&&s===la){for(var o=0;i===la;)o++,i=e[--A];if(o%2===0)return nA}return ca},FC=function(r){var e=yC(r),t=e.length,A=0,i=0,n=e.map(xC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=nA;A<t&&(s=QC(e,n,++A))===nA;);if(s!==nA||A===t){var o=bC.apply(null,e.slice(i,A));return i=A,{value:o,done:!1}}return{done:!0,value:null}}}},UC=function(r){for(var e=FC(r),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},EC=function(r){var e=123;if(r.createRange){var t=r.createRange();if(t.getBoundingClientRect){var A=r.createElement("boundtest");A.style.height=e+"px",A.style.display="block",r.body.appendChild(A),t.selectNode(A);var i=t.getBoundingClientRect(),n=Math.round(i.height);if(r.body.removeChild(A),n===e)return!0}}return!1},SC=function(r){var e=r.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",r.body.appendChild(e);var t=r.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,i=gn(A.data).map(function(a){return pt(a)}),n=0,s={},o=i.every(function(a,c){t.setStart(A,n),t.setEnd(A,n+a.length);var h=t.getBoundingClientRect();n+=a.length;var d=h.x>s.x||h.y>s.y;return s=h,c===0?!0:d});return r.body.removeChild(e),o},HC=function(){return typeof new Image().crossOrigin<"u"},LC=function(){return typeof new XMLHttpRequest().responseType=="string"},MC=function(r){var e=new Image,t=r.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},_u=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},IC=function(r){var e=r.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 i=new Image,n=e.toDataURL();i.src=n;var s=ha(t,t,0,0,i);return A.fillStyle="red",A.fillRect(0,0,t,t),Du(s).then(function(o){A.drawImage(o,0,0);var a=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=r.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",_u(a)?Du(ha(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),_u(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},ha=function(r,e,t,A,i){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",r.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},Du=function(r){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(r))})},Ut={get SUPPORT_RANGE_BOUNDS(){var r=EC(document);return Object.defineProperty(Ut,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=Ut.SUPPORT_RANGE_BOUNDS&&SC(document);return Object.defineProperty(Ut,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=MC(document);return Object.defineProperty(Ut,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?IC(document):Promise.resolve(!1);return Object.defineProperty(Ut,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=HC();return Object.defineProperty(Ut,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=LC();return Object.defineProperty(Ut,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ut,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ut,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},Bi=(function(){function r(e,t){this.text=e,this.bounds=t}return r})(),_C=function(r,e,t,A){var i=OC(e,t),n=[],s=0;return i.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Ut.SUPPORT_RANGE_BOUNDS){var a=ku(A,s,o.length).getClientRects();if(a.length>1){var c=ua(o),h=0;c.forEach(function(m){n.push(new Bi(m,UA.fromDOMRectList(r,ku(A,h+s,m.length).getClientRects()))),h+=m.length})}else n.push(new Bi(o,UA.fromDOMRectList(r,a)))}else{var d=A.splitText(o.length);n.push(new Bi(o,DC(r,A))),A=d}else Ut.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},DC=function(r,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(A,e);var n=mn(r,A);return A.firstChild&&i.replaceChild(A.firstChild,A),n}}return UA.EMPTY},ku=function(r,e,t){var A=r.ownerDocument;if(!A)throw new Error("Node has no owner document");var i=A.createRange();return i.setStart(r,e),i.setEnd(r,e+t),i},ua=function(r){if(Ut.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(r)).map(function(t){return t.segment})}return UC(r)},kC=function(r,e){if(Ut.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(r)).map(function(A){return A.segment})}return KC(r,e)},OC=function(r,e){return e.letterSpacing!==0?ua(r):kC(r,e)},NC=[32,160,4961,65792,65793,4153,4241],KC=function(r,e){for(var t=dw(r,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],i,n=function(){if(i.value){var s=i.value.slice(),o=gn(s),a="";o.forEach(function(c){NC.indexOf(c)===-1?a+=pt(c):(a.length&&A.push(a),A.push(pt(c)),a="")}),a.length&&A.push(a)}};!(i=t.next()).done;)n();return A},PC=(function(){function r(e,t,A){this.text=VC(t.data,A.textTransform),this.textBounds=_C(e,this.text,A,t)}return r})(),VC=function(r,e){switch(e){case 1:return r.toLowerCase();case 3:return r.replace(zC,WC);case 2:return r.toUpperCase();default:return r}},zC=/(^|\s|:|-|\(|\))([a-z])/g,WC=function(r,e,t){return r.length>0?e+t.toUpperCase():r},Ou=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.src=A.currentSrc||A.src,i.intrinsicWidth=A.naturalWidth,i.intrinsicHeight=A.naturalHeight,i.context.cache.addImage(i.src),i}return e})(yA),Nu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.canvas=A,i.intrinsicWidth=A.width,i.intrinsicHeight=A.height,i}return e})(yA),Ku=(function(r){uA(e,r);function e(t,A){var i=r.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"),i.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),i.intrinsicWidth=A.width.baseVal.value,i.intrinsicHeight=A.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e})(yA),Pu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.value=A.value,i}return e})(yA),da=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.start=A.start,i.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,i}return e})(yA),GC=[{type:15,flags:0,unit:"px",number:3}],RC=[{type:16,flags:0,number:50}],$C=function(r){return r.width>r.height?new UA(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new UA(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},XC=function(r){var e=r.type===ZC?new Array(r.value.length+1).join("•"):r.value;return e.length===0?r.placeholder||"":e},Zn="checkbox",Jn="radio",ZC="password",Vu=707406591,pa=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;switch(i.type=A.type.toLowerCase(),i.checked=A.checked,i.value=XC(A),(i.type===Zn||i.type===Jn)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=$C(i.bounds)),i.type){case Zn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=GC;break;case Jn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=RC;break}return i}return e})(yA),zu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return i.value=n&&n.text||"",i}return e})(yA),Wu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.value=A.value,i}return e})(yA),Gu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;i.src=A.src,i.width=parseInt(A.width,10)||0,i.height=parseInt(A.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){i.tree=$u(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?mi(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):SA.TRANSPARENT,s=A.contentWindow.document.body?mi(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):SA.TRANSPARENT;i.backgroundColor=zA(n)?zA(s)?i.styles.backgroundColor:s:n}}catch{}return i}return e})(yA),JC=["OL","UL","MENU"],qn=function(r,e,t,A){for(var i=e.firstChild,n=void 0;i;i=n)if(n=i.nextSibling,Xu(i)&&i.data.trim().length>0)t.textNodes.push(new PC(r,i,t.styles));else if(Fr(i))if(ed(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return qn(r,o,t,A)});else{var s=Ru(r,i);s.styles.isVisible()&&(qC(i,s,A)?s.flags|=4:YC(s.styles)&&(s.flags|=2),JC.indexOf(i.tagName)!==-1&&(s.flags|=8),t.elements.push(s),i.slot,i.shadowRoot?qn(r,i.shadowRoot,s,A):!jn(i)&&!Zu(i)&&!es(i)&&qn(r,i,s,A))}},Ru=function(r,e){return ga(e)?new Ou(r,e):Ju(e)?new Nu(r,e):Zu(e)?new Ku(r,e):jC(e)?new Pu(r,e):ev(e)?new da(r,e):tv(e)?new pa(r,e):es(e)?new zu(r,e):jn(e)?new Wu(r,e):Yu(e)?new Gu(r,e):new yA(r,e)},$u=function(r,e){var t=Ru(r,e);return t.flags|=4,qn(r,e,t,t),t},qC=function(r,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||ma(r)&&t.styles.isTransparent()},YC=function(r){return r.isPositioned()||r.isFloating()},Xu=function(r){return r.nodeType===Node.TEXT_NODE},Fr=function(r){return r.nodeType===Node.ELEMENT_NODE},fa=function(r){return Fr(r)&&typeof r.style<"u"&&!Yn(r)},Yn=function(r){return typeof r.className=="object"},jC=function(r){return r.tagName==="LI"},ev=function(r){return r.tagName==="OL"},tv=function(r){return r.tagName==="INPUT"},Av=function(r){return r.tagName==="HTML"},Zu=function(r){return r.tagName==="svg"},ma=function(r){return r.tagName==="BODY"},Ju=function(r){return r.tagName==="CANVAS"},qu=function(r){return r.tagName==="VIDEO"},ga=function(r){return r.tagName==="IMG"},Yu=function(r){return r.tagName==="IFRAME"},ju=function(r){return r.tagName==="STYLE"},rv=function(r){return r.tagName==="SCRIPT"},jn=function(r){return r.tagName==="TEXTAREA"},es=function(r){return r.tagName==="SELECT"},ed=function(r){return r.tagName==="SLOT"},td=function(r){return r.tagName.indexOf("-")>0},iv=(function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},r.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},r.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},r.prototype.parse=function(e){var t=this,A=e.counterIncrement,i=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var a=t.counters[o.counter];a&&o.increment!==0&&(n=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var s=[];return n&&i.forEach(function(o){var a=t.counters[o.counter];s.push(o.counter),a||(a=t.counters[o.counter]=[]),a.push(o.reset)}),s},r})(),Ad={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"]},rd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},nv={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},sv={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ur=function(r,e,t,A,i,n){return r<e||r>t?vi(r,i,n.length>0):A.integers.reduce(function(s,o,a){for(;r>=o;)r-=o,s+=A.values[a];return s},"")+n},id=function(r,e,t,A){var i="";do t||r--,i=A(r)+i,r/=e;while(r*e>=e);return i},ft=function(r,e,t,A,i){var n=t-e+1;return(r<0?"-":"")+(id(Math.abs(r),n,A,function(s){return pt(Math.floor(s%n)+e)})+i)},lr=function(r,e,t){t===void 0&&(t=". ");var A=e.length;return id(Math.abs(r),A,!1,function(i){return e[Math.floor(i%A)]})+t},Er=1,GA=2,RA=4,Ci=8,HA=function(r,e,t,A,i,n){if(r<-9999||r>9999)return vi(r,4,i.length>0);var s=Math.abs(r),o=i;if(s===0)return e[0]+o;for(var a=0;s>0&&a<=4;a++){var c=s%10;c===0&&Ct(n,Er)&&o!==""?o=e[c]+o:c>1||c===1&&a===0||c===1&&a===1&&Ct(n,GA)||c===1&&a===1&&Ct(n,RA)&&r>100||c===1&&a>1&&Ct(n,Ci)?o=e[c]+(a>0?t[a-1]:"")+o:c===1&&a>0&&(o=t[a-1]+o),s=Math.floor(s/10)}return(r<0?A:"")+o},nd="十百千萬",sd="拾佰仟萬",od="マイナス",wa="마이너스",vi=function(r,e,t){var A=t?". ":"",i=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=ft(r,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return lr(r,"〇一二三四五六七八九",i);case 6:return Ur(r,1,3999,Ad,3,A).toLowerCase();case 7:return Ur(r,1,3999,Ad,3,A);case 8:return ft(r,945,969,!1,A);case 9:return ft(r,97,122,!1,A);case 10:return ft(r,65,90,!1,A);case 11:return ft(r,1632,1641,!0,A);case 12:case 49:return Ur(r,1,9999,rd,3,A);case 35:return Ur(r,1,9999,rd,3,A).toLowerCase();case 13:return ft(r,2534,2543,!0,A);case 14:case 30:return ft(r,6112,6121,!0,A);case 15:return lr(r,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return lr(r,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return HA(r,"零一二三四五六七八九",nd,"負",i,GA|RA|Ci);case 47:return HA(r,"零壹貳參肆伍陸柒捌玖",sd,"負",i,Er|GA|RA|Ci);case 42:return HA(r,"零一二三四五六七八九",nd,"负",i,GA|RA|Ci);case 41:return HA(r,"零壹贰叁肆伍陆柒捌玖",sd,"负",i,Er|GA|RA|Ci);case 26:return HA(r,"〇一二三四五六七八九","十百千万",od,i,0);case 25:return HA(r,"零壱弐参四伍六七八九","拾百千万",od,i,Er|GA|RA);case 31:return HA(r,"영일이삼사오육칠팔구","십백천만",wa,n,Er|GA|RA);case 33:return HA(r,"零一二三四五六七八九","十百千萬",wa,n,0);case 32:return HA(r,"零壹貳參四五六七八九","拾百千",wa,n,Er|GA|RA);case 18:return ft(r,2406,2415,!0,A);case 20:return Ur(r,1,19999,sv,3,A);case 21:return ft(r,2790,2799,!0,A);case 22:return ft(r,2662,2671,!0,A);case 22:return Ur(r,1,10999,nv,3,A);case 23:return lr(r,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return lr(r,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ft(r,3302,3311,!0,A);case 28:return lr(r,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return lr(r,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return ft(r,3792,3801,!0,A);case 37:return ft(r,6160,6169,!0,A);case 38:return ft(r,4160,4169,!0,A);case 39:return ft(r,2918,2927,!0,A);case 40:return ft(r,1776,1785,!0,A);case 43:return ft(r,3046,3055,!0,A);case 44:return ft(r,3174,3183,!0,A);case 45:return ft(r,3664,3673,!0,A);case 46:return ft(r,3872,3881,!0,A);default:return ft(r,48,57,!0,A)}},ad="data-html2canvas-ignore",ld=(function(){function r(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new iv,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 r.prototype.toIFrame=function(e,t){var A=this,i=ov(e,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,a=o.document,c=cv(i).then(function(){return kt(A,void 0,void 0,function(){var h,d;return Mt(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(pv),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,lv(a)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(a,d)}).then(function(){return i})]:[2,i]}})})});return a.open(),a.write(uv(document.doctype)+"<html></html>"),dv(this.referenceElement.ownerDocument,n,s),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),c},r.prototype.createElementClone=function(e){if(ta(e,2))debugger;if(Ju(e))return this.createCanvasClone(e);if(qu(e))return this.createVideoClone(e);if(ju(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return ga(t)&&(ga(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),td(t)?this.createCustomElementClone(t):t},r.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return Ba(e.style,t),t},r.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},""),i=e.cloneNode(!1);return i.textContent=A,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},r.prototype.createCanvasClone=function(e){var 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 i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var n=e.getContext("2d"),s=i.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();a?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},r.prototype.createVideoClone=function(e){var 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 i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},r.prototype.appendChildNode=function(e,t,A){(!Fr(t)||!rv(t)&&!t.hasAttribute(ad)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Fr(t)||!ju(t))&&e.appendChild(this.cloneNode(t,A))},r.prototype.cloneChildNodes=function(e,t,A){for(var i=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Fr(n)&&ed(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},r.prototype.cloneNode=function(e,t){if(Xu(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Fr(e)&&(fa(e)||Yn(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&fa(i)&&(this.clonedReferenceElement=i),ma(i)&&gv(i);var a=this.counters.parse(new bu(this.context,n)),c=this.resolvePseudoContent(e,i,s,yi.BEFORE);td(e)&&(t=!0),qu(e)||this.cloneChildNodes(e,i,t),c&&i.insertBefore(c,i.firstChild);var h=this.resolvePseudoContent(e,i,o,yi.AFTER);return h&&i.appendChild(h),this.counters.pop(a),(n&&(this.options.copyStyles||Yn(e))&&!Yu(e)||t)&&Ba(n,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(jn(e)||es(e))&&(jn(i)||es(i))&&(i.value=e.value),i}return e.cloneNode(!1)},r.prototype.resolvePseudoContent=function(e,t,A,i){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 bu(this.context,A));var a=new j2(this.context,A),c=o.createElement("html2canvaspseudoelement");Ba(A,c),a.content.forEach(function(d){if(d.type===0)c.appendChild(o.createTextNode(d.value));else if(d.type===22){var m=o.createElement("img");m.src=d.value,m.style.opacity="1",c.appendChild(m)}else if(d.type===18){if(d.name==="attr"){var x=d.values.filter(rt);x.length&&c.appendChild(o.createTextNode(e.getAttribute(x[0].value)||""))}else if(d.name==="counter"){var v=d.values.filter(xr),B=v[0],y=v[1];if(B&&rt(B)){var D=n.counters.getCounterValue(B.value),E=y&&rt(y)?ea.parse(n.context,y.value):3;c.appendChild(o.createTextNode(vi(D,E,!1)))}}else if(d.name==="counters"){var N=d.values.filter(xr),B=N[0],S=N[1],y=N[2];if(B&&rt(B)){var W=n.counters.getCounterValues(B.value),$=y&&rt(y)?ea.parse(n.context,y.value):3,j=S&&S.type===0?S.value:"",V=W.map(function(ae){return vi(ae,$,!1)}).join(j);c.appendChild(o.createTextNode(V))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(o.createTextNode(yu(a.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(yu(a.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(d.value))}}),c.className=Ca+" "+va;var h=i===yi.BEFORE?" "+Ca:" "+va;return Yn(t)?t.className.baseValue+=h:t.className+=h,c}}},r.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},r})(),yi;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(yi||(yi={}));var ov=function(r,e){var t=r.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(ad,"true"),r.body.appendChild(t),t},av=function(r){return new Promise(function(e){if(r.complete){e();return}if(!r.src){e();return}r.onload=e,r.onerror=e})},lv=function(r){return Promise.all([].slice.call(r.images,0).map(av))},cv=function(r){return new Promise(function(e,t){var A=r.contentWindow;if(!A)return t("No window assigned for iframe");var i=A.document;A.onload=r.onload=function(){A.onload=r.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(n),e(r))},50)}})},hv=["all","d","content"],Ba=function(r,e){for(var t=r.length-1;t>=0;t--){var A=r.item(t);hv.indexOf(A)===-1&&e.style.setProperty(A,r.getPropertyValue(A))}return e},uv=function(r){var e="";return r&&(e+="<!DOCTYPE ",r.name&&(e+=r.name),r.internalSubset&&(e+=r.internalSubset),r.publicId&&(e+='"'+r.publicId+'"'),r.systemId&&(e+='"'+r.systemId+'"'),e+=">"),e},dv=function(r,e,t){r&&r.defaultView&&(e!==r.defaultView.pageXOffset||t!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(e,t)},pv=function(r){var e=r[0],t=r[1],A=r[2];e.scrollLeft=t,e.scrollTop=A},fv=":before",mv=":after",Ca="___html2canvas___pseudoelement_before",va="___html2canvas___pseudoelement_after",cd=`{
|
|
5
|
+
`):" "+kc(s[0]):"as no adapter specified";throw new Ve("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i}const Oc={getAdapter:J1,adapters:no};function so(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new qr(null,r)}function Nc(r){return so(r),r.headers=zt.from(r.headers),r.data=io.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Oc.getAdapter(r.adapter||Zr.adapter,r)(r).then(function(A){return so(r),A.data=io.call(r,r.transformResponse,A),A.headers=zt.from(A.headers),A},function(A){return Tc(A)||(so(r),A&&A.response&&(A.response.data=io.call(r,r.transformResponse,A.response),A.response.headers=zt.from(A.response.headers))),Promise.reject(A)})}const Kc="1.13.5",en={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{en[r]=function(A){return typeof A===r||"a"+(e<1?"n ":" ")+r}});const Pc={};en.transitional=function(e,t,A){function i(n,s){return"[Axios v"+Kc+"] Transitional option '"+n+"'"+s+(A?". "+A:"")}return(n,s,o)=>{if(e===!1)throw new Ve(i(s," has been removed"+(t?" in "+t:"")),Ve.ERR_DEPRECATED);return t&&!Pc[s]&&(Pc[s]=!0,console.warn(i(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 q1(r,e,t){if(typeof r!="object")throw new Ve("options must be an object",Ve.ERR_BAD_OPTION_VALUE);const A=Object.keys(r);let i=A.length;for(;i-- >0;){const n=A[i],s=e[n];if(s){const o=r[n],a=o===void 0||s(o,n,r);if(a!==!0)throw new Ve("option "+n+" must be "+a,Ve.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Ve("Unknown option "+n,Ve.ERR_BAD_OPTION)}}const tn={assertOptions:q1,validators:en},AA=tn.validators;let ir=class{constructor(e){this.defaults=e||{},this.interceptors={request:new vc,response:new vc}}async request(e,t){try{return await this._request(e,t)}catch(A){if(A instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const n=i.stack?i.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=rr(this.defaults,t);const{transitional:A,paramsSerializer:i,headers:n}=t;A!==void 0&&tn.assertOptions(A,{silentJSONParsing:AA.transitional(AA.boolean),forcedJSONParsing:AA.transitional(AA.boolean),clarifyTimeoutError:AA.transitional(AA.boolean),legacyInterceptorReqResOrdering:AA.transitional(AA.boolean)},!1),i!=null&&(re.isFunction(i)?t.paramsSerializer={serialize:i}:tn.assertOptions(i,{encode:AA.function,serialize:AA.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),tn.assertOptions(t,{baseUrl:AA.spelling("baseURL"),withXsrfToken:AA.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=n&&re.merge(n.common,n[t.method]);n&&re.forEach(["delete","get","head","post","put","patch","common"],v=>{delete n[v]}),t.headers=zt.concat(s,n);const o=[];let a=!0;this.interceptors.request.forEach(function(B){if(typeof B.runWhen=="function"&&B.runWhen(t)===!1)return;a=a&&B.synchronous;const y=t.transitional||eo;y&&y.legacyInterceptorReqResOrdering?o.unshift(B.fulfilled,B.rejected):o.push(B.fulfilled,B.rejected)});const c=[];this.interceptors.response.forEach(function(B){c.push(B.fulfilled,B.rejected)});let h,d=0,m;if(!a){const v=[Nc.bind(this),void 0];for(v.unshift(...o),v.push(...c),m=v.length,h=Promise.resolve(t);d<m;)h=h.then(v[d++],v[d++]);return h}m=o.length;let T=t;for(;d<m;){const v=o[d++],B=o[d++];try{T=v(T)}catch(y){B.call(this,y);break}}try{h=Nc.call(this,T)}catch(v){return Promise.reject(v)}for(d=0,m=c.length;d<m;)h=h.then(c[d++],c[d++]);return h}getUri(e){e=rr(this.defaults,e);const t=Uc(e.baseURL,e.url,e.allowAbsoluteUrls);return Cc(t,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){ir.prototype[e]=function(t,A){return this.request(rr(A||{},{method:e,url:t,data:(A||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function t(A){return function(n,s,o){return this.request(rr(o||{},{method:e,headers:A?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}ir.prototype[e]=t(),ir.prototype[e+"Form"]=t(!0)});let Y1=class Rd{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(i=>{if(!A._listeners)return;let n=A._listeners.length;for(;n-- >0;)A._listeners[n](i);A._listeners=null}),this.promise.then=i=>{let n;const s=new Promise(o=>{A.subscribe(o),n=o}).then(i);return s.cancel=function(){A.unsubscribe(n)},s},e(function(n,s,o){A.reason||(A.reason=new qr(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 Rd(function(i){e=i}),cancel:e}}};function j1(r){return function(t){return r.apply(null,t)}}function em(r){return re.isObject(r)&&r.isAxiosError===!0}const oo={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(oo).forEach(([r,e])=>{oo[e]=r});function Vc(r){const e=new ir(r),t=oc(ir.prototype.request,e);return re.extend(t,ir.prototype,e,{allOwnKeys:!0}),re.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Vc(rr(r,i))},t}const nt=Vc(Zr);nt.Axios=ir,nt.CanceledError=qr,nt.CancelToken=Y1,nt.isCancel=Tc,nt.VERSION=Kc,nt.toFormData=Ji,nt.AxiosError=Ve,nt.Cancel=nt.CanceledError,nt.all=function(e){return Promise.all(e)},nt.spread=j1,nt.isAxiosError=em,nt.mergeConfig=rr,nt.AxiosHeaders=zt,nt.formToJSON=r=>yc(re.isHTMLForm(r)?new FormData(r):r),nt.getAdapter=Oc.getAdapter,nt.HttpStatusCode=oo,nt.default=nt;const{Axios:hb,AxiosError:ub,CanceledError:db,isCancel:pb,CancelToken:fb,VERSION:mb,all:gb,Cancel:wb,isAxiosError:Bb,spread:Cb,toFormData:vb,AxiosHeaders:yb,HttpStatusCode:bb,formToJSON:Tb,getAdapter:xb,mergeConfig:Qb}=nt,wA=Object.create(null);wA.open="0",wA.close="1",wA.ping="2",wA.pong="3",wA.message="4",wA.upgrade="5",wA.noop="6";const An=Object.create(null);Object.keys(wA).forEach(r=>{An[wA[r]]=r});const ao={type:"error",data:"parser error"},zc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Wc=typeof ArrayBuffer=="function",Gc=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,lo=({type:r,data:e},t,A)=>zc&&e instanceof Blob?t?A(e):Rc(e,A):Wc&&(e instanceof ArrayBuffer||Gc(e))?t?A(e):Rc(new Blob([e]),A):A(wA[r]+(e||"")),Rc=(r,e)=>{const t=new FileReader;return t.onload=function(){const A=t.result.split(",")[1];e("b"+(A||""))},t.readAsDataURL(r)};function $c(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let co;function tm(r,e){if(zc&&r.data instanceof Blob)return r.data.arrayBuffer().then($c).then(e);if(Wc&&(r.data instanceof ArrayBuffer||Gc(r.data)))return e($c(r.data));lo(r,!1,t=>{co||(co=new TextEncoder),e(co.encode(t))})}const Xc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Xc.length;r++)Yr[Xc.charCodeAt(r)]=r;const Am=r=>{let e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);const c=new ArrayBuffer(e),h=new Uint8Array(c);for(A=0;A<t;A+=4)n=Yr[r.charCodeAt(A)],s=Yr[r.charCodeAt(A+1)],o=Yr[r.charCodeAt(A+2)],a=Yr[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},rm=typeof ArrayBuffer=="function",ho=(r,e)=>{if(typeof r!="string")return{type:"message",data:Zc(r,e)};const t=r.charAt(0);return t==="b"?{type:"message",data:im(r.substring(1),e)}:An[t]?r.length>1?{type:An[t],data:r.substring(1)}:{type:An[t]}:ao},im=(r,e)=>{if(rm){const t=Am(r);return Zc(t,e)}else return{base64:!0,data:r}},Zc=(r,e)=>e==="blob"?r instanceof Blob?r:new Blob([r]):r instanceof ArrayBuffer?r:r.buffer,Jc="",nm=(r,e)=>{const t=r.length,A=new Array(t);let i=0;r.forEach((n,s)=>{lo(n,!1,o=>{A[s]=o,++i===t&&e(A.join(Jc))})})},sm=(r,e)=>{const t=r.split(Jc),A=[];for(let i=0;i<t.length;i++){const n=ho(t[i],e);if(A.push(n),n.type==="error")break}return A};function om(){return new TransformStream({transform(r,e){tm(r,t=>{const A=t.length;let i;if(A<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,A);else if(A<65536){i=new Uint8Array(3);const n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,A)}else{i=new Uint8Array(9);const n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(A))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let uo;function rn(r){return r.reduce((e,t)=>e+t.length,0)}function nn(r,e){if(r[0].length===e)return r.shift();const t=new Uint8Array(e);let A=0;for(let i=0;i<e;i++)t[i]=r[0][A++],A===r[0].length&&(r.shift(),A=0);return r.length&&A<r[0].length&&(r[0]=r[0].slice(A)),t}function am(r,e){uo||(uo=new TextDecoder);const t=[];let A=0,i=-1,n=!1;return new TransformStream({transform(s,o){for(t.push(s);;){if(A===0){if(rn(t)<1)break;const a=nn(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?A=3:i===126?A=1:A=2}else if(A===1){if(rn(t)<2)break;const a=nn(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),A=3}else if(A===2){if(rn(t)<8)break;const a=nn(t,8),c=new DataView(a.buffer,a.byteOffset,a.length),h=c.getUint32(0);if(h>Math.pow(2,21)-1){o.enqueue(ao);break}i=h*Math.pow(2,32)+c.getUint32(4),A=3}else{if(rn(t)<i)break;const a=nn(t,i);o.enqueue(ho(n?a:uo.decode(a),e)),A=0}if(i===0||i>r){o.enqueue(ao);break}}}})}const qc=4;function wt(r){if(r)return lm(r)}function lm(r){for(var e in wt.prototype)r[e]=wt.prototype[e];return r}wt.prototype.on=wt.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this},wt.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this},wt.prototype.off=wt.prototype.removeListener=wt.prototype.removeAllListeners=wt.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var A,i=0;i<t.length;i++)if(A=t[i],A===e||A.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this},wt.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],A=1;A<arguments.length;A++)e[A-1]=arguments[A];if(t){t=t.slice(0);for(var A=0,i=t.length;A<i;++A)t[A].apply(this,e)}return this},wt.prototype.emitReserved=wt.prototype.emit,wt.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]},wt.prototype.hasListeners=function(r){return!!this.listeners(r).length};const sn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),rA=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),cm="arraybuffer";function Fb(){}function Yc(r,...e){return e.reduce((t,A)=>(r.hasOwnProperty(A)&&(t[A]=r[A]),t),{})}const hm=rA.setTimeout,um=rA.clearTimeout;function on(r,e){e.useNativeTimers?(r.setTimeoutFn=hm.bind(rA),r.clearTimeoutFn=um.bind(rA)):(r.setTimeoutFn=rA.setTimeout.bind(rA),r.clearTimeoutFn=rA.clearTimeout.bind(rA))}const dm=1.33;function pm(r){return typeof r=="string"?fm(r):Math.ceil((r.byteLength||r.size)*dm)}function fm(r){let e=0,t=0;for(let A=0,i=r.length;A<i;A++)e=r.charCodeAt(A),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(A++,t+=4);return t}function jc(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function mm(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function gm(r){let e={},t=r.split("&");for(let A=0,i=t.length;A<i;A++){let n=t[A].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}class wm extends Error{constructor(e,t,A){super(e),this.description=t,this.context=A,this.type="TransportError"}}class po extends wt{constructor(e){super(),this.writable=!1,on(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 wm(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=ho(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=mm(e);return t.length?"?"+t:""}}class Bm extends po{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)};sm(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,nm(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]=jc()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let eh=!1;try{eh=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Cm=eh;function vm(){}class ym extends Bm{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",(i,n)=>{this.onError("xhr post error",i,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 BA extends wt{constructor(e,t,A){super(),this.createRequest=e,on(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=Yc(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 i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&A.setRequestHeader(i,this._opts.extraHeaders[i])}}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 i;A.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.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(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=BA.requestsCount++,BA.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=vm,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete BA.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(BA.requestsCount=0,BA.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",th);else if(typeof addEventListener=="function"){const r="onpagehide"in rA?"pagehide":"unload";addEventListener(r,th,!1)}}function th(){for(let r in BA.requests)BA.requests.hasOwnProperty(r)&&BA.requests[r].abort()}const bm=(function(){const r=Ah({xdomain:!1});return r&&r.responseType!==null})();class Tm extends ym{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=bm&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new BA(Ah,this.uri(),e)}}function Ah(r){const e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Cm))return new XMLHttpRequest}catch{}if(!e)try{return new rA[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const rh=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class xm extends po{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,A=rh?{}:Yc(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(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],i=t===e.length-1;lo(A,this.supportsBinary,n=>{try{this.doWrite(A,n)}catch{}i&&sn(()=>{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]=jc()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const fo=rA.WebSocket||rA.MozWebSocket;class Qm extends xm{createSocket(e,t,A){return rh?new fo(e,t,A):t?new fo(e,t):new fo(e)}doWrite(e,t){this.ws.send(t)}}class Fm extends po{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=am(Number.MAX_SAFE_INTEGER,this.socket.binaryType),A=e.readable.pipeThrough(t).getReader(),i=om();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const n=()=>{A.read().then(({done:o,value:a})=>{o||(this.onPacket(a),n())}).catch(o=>{})};n();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const A=e[t],i=t===e.length-1;this._writer.write(A).then(()=>{i&&sn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Um={websocket:Qm,webtransport:Fm,polling:Tm},Em=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sm=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function mo(r){if(r.length>8e3)throw"URI too long";const e=r,t=r.indexOf("["),A=r.indexOf("]");t!=-1&&A!=-1&&(r=r.substring(0,t)+r.substring(t,A).replace(/:/g,";")+r.substring(A,r.length));let i=Em.exec(r||""),n={},s=14;for(;s--;)n[Sm[s]]=i[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=Hm(n,n.path),n.queryKey=Lm(n,n.query),n}function Hm(r,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 Lm(r,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(A,i,n){i&&(t[i]=n)}),t}const go=typeof addEventListener=="function"&&typeof removeEventListener=="function",an=[];go&&addEventListener("offline",()=>{an.forEach(r=>r())},!1);class kA extends wt{constructor(e,t){if(super(),this.binaryType=cm,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const A=mo(e);t.hostname=A.host,t.secure=A.protocol==="https"||A.protocol==="wss",t.port=A.port,A.query&&(t.query=A.query)}else t.host&&(t.hostname=mo(t.host).host);on(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 i=A.prototype.name;this.transports.push(i),this._transportsByName[i]=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=gm(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"})},an.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=qc,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&&kA.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",kA.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 i=this.writeBuffer[A].data;if(i&&(t+=pm(i)),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,sn(()=>{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,i){if(typeof t=="function"&&(i=t,t=void 0),typeof A=="function"&&(i=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),i&&this.once("flush",i),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(kA.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=an.indexOf(this._offlineEventListener);A!==-1&&an.splice(A,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}kA.protocol=qc;class Mm extends kA{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;kA.priorWebsocketSuccess=!1;const i=()=>{A||(t.send([{type:"ping",data:"probe"}]),t.once("packet",d=>{if(!A)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;kA.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{A||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=t.name,this.emitReserved("upgradeError",m)}}))};function n(){A||(A=!0,h(),t.close(),t=null)}const s=d=>{const m=new Error("probe error: "+d);m.transport=t.name,n(),this.emitReserved("upgradeError",m)};function o(){s("transport closed")}function a(){s("socket closed")}function c(d){t&&d.name!==t.name&&n()}const h=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",i),t.once("error",s),t.once("close",o),this.once("close",a),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 Im=class extends Mm{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(i=>Um[i]).filter(i=>!!i)),super(e,A)}};function _m(r,e="",t){let A=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),A=mo(r)),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 Dm=typeof ArrayBuffer=="function",km=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ih=Object.prototype.toString,Om=typeof Blob=="function"||typeof Blob<"u"&&ih.call(Blob)==="[object BlobConstructor]",Nm=typeof File=="function"||typeof File<"u"&&ih.call(File)==="[object FileConstructor]";function wo(r){return Dm&&(r instanceof ArrayBuffer||km(r))||Om&&r instanceof Blob||Nm&&r instanceof File}function ln(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,A=r.length;t<A;t++)if(ln(r[t]))return!0;return!1}if(wo(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return ln(r.toJSON(),!0);for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&ln(r[t]))return!0;return!1}function Km(r){const e=[],t=r.data,A=r;return A.data=Bo(t,e),A.attachments=e.length,{packet:A,buffers:e}}function Bo(r,e){if(!r)return r;if(wo(r)){const t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){const t=new Array(r.length);for(let A=0;A<r.length;A++)t[A]=Bo(r[A],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){const t={};for(const A in r)Object.prototype.hasOwnProperty.call(r,A)&&(t[A]=Bo(r[A],e));return t}return r}function Pm(r,e){return r.data=Co(r.data,e),delete r.attachments,r}function Co(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=Co(r[t],e);else if(typeof r=="object")for(const t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=Co(r[t],e));return r}const Vm=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Je;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(Je||(Je={}));class zm{constructor(e){this.replacer=e}encode(e){return(e.type===Je.EVENT||e.type===Je.ACK)&&ln(e)?this.encodeAsBinary({type:e.type===Je.EVENT?Je.BINARY_EVENT:Je.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===Je.BINARY_EVENT||e.type===Je.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=Km(e),A=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(A),i}}class vo extends wt{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===Je.BINARY_EVENT;A||t.type===Je.BINARY_ACK?(t.type=A?Je.EVENT:Je.ACK,this.reconstructor=new Wm(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(wo(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(Je[A.type]===void 0)throw new Error("unknown packet type "+A.type);if(A.type===Je.BINARY_EVENT||A.type===Je.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 i=e.charAt(t+1);if(i!==""&&Number(i)==i){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(vo.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 Je.CONNECT:return nh(t);case Je.DISCONNECT:return t===void 0;case Je.CONNECT_ERROR:return typeof t=="string"||nh(t);case Je.EVENT:case Je.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Vm.indexOf(t[0])===-1);case Je.ACK:case Je.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Wm{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=Pm(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function nh(r){return Object.prototype.toString.call(r)==="[object Object]"}const Gm=Object.freeze(Object.defineProperty({__proto__:null,Decoder:vo,Encoder:zm,get PacketType(){return Je}},Symbol.toStringTag,{value:"Module"}));function hA(r,e,t){return r.on(e,t),function(){r.off(e,t)}}const Rm=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class sh extends wt{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=[hA(e,"open",this.onopen.bind(this)),hA(e,"packet",this.onpacket.bind(this)),hA(e,"error",this.onerror.bind(this)),hA(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var A,i,n;if(Rm.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:Je.EVENT,data:t};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const h=this.ids++,d=t.pop();this._registerAckCallback(h,d),s.id=h}const o=(i=(A=this.io.engine)===null||A===void 0?void 0:A.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var A;const i=(A=this.flags.timeout)!==null&&A!==void 0?A:this._opts.ackTimeout;if(i===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"))},i),s=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,o)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((A,i)=>{const n=(s,o)=>s?i(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((i,...n)=>(this._queue[0],i!==null?A.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(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:Je.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 Je.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 Je.EVENT:case Je.BINARY_EVENT:this.onevent(e);break;case Je.ACK:case Je.BINARY_ACK:this.onack(e);break;case Je.DISCONNECT:this.ondisconnect();break;case Je.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(...i){A||(A=!0,t.packet({type:Je.ACK,id:e,data:i}))}}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:Je.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 Br(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Br.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0},Br.prototype.reset=function(){this.attempts=0},Br.prototype.setMin=function(r){this.ms=r},Br.prototype.setMax=function(r){this.max=r},Br.prototype.setJitter=function(r){this.jitter=r};class yo extends wt{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,on(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 Br({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Gm;this.encoder=new i.Encoder,this.decoder=new i.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 Im(this.uri,this.opts);const t=this.engine,A=this;this._readyState="opening",this.skipReconnect=!1;const i=hA(t,"open",function(){A.onopen(),e&&e()}),n=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},s=hA(t,"error",n);if(this._timeout!==!1){const o=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},o);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(hA(e,"ping",this.onping.bind(this)),hA(e,"data",this.ondata.bind(this)),hA(e,"error",this.onerror.bind(this)),hA(e,"close",this.onclose.bind(this)),hA(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){sn(()=>{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 sh(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(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):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 jr={};function cn(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};const t=_m(r,e.path||"/socket.io"),A=t.source,i=t.id,n=t.path,s=jr[i]&&n in jr[i].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let a;return o?a=new yo(A,e):(jr[i]||(jr[i]=new yo(A,e)),a=jr[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(cn,{Manager:yo,Socket:sh,io:cn,connect:cn});function bo(r){if(!r)return null;try{const e=typeof window<"u"&&window?.location?.origin?window.location.origin:void 0,t=new URL(r,e),A=t.pathname.replace(/\/+$/,"");return`${t.protocol}//${t.host}${A}`}catch{return String(r).trim().replace(/\/+$/,"")}}let Xt=bo("http://localhost:8000");function oh(r){const e=bo(r);e&&e!==Xt&&(Xt=e,ut&&(ut.disconnect(),ut.removeAllListeners(),ut=null))}let ut=null;function $m(){const r=()=>{try{return localStorage.getItem("token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||localStorage.getItem("jwt_token")}catch{return null}},e=r();console.log("🔧 [SOCKET DEBUG] Creating socket for MT5 backend:",{baseUrl:Xt,hasToken:!!e,tokenLength:e?.length||0,note:"Connecting to MT5 backend WebSocket (root namespace for candles)"});const t=cn(Xt,{transports:["websocket","polling"],reconnection:!0,reconnectionDelay:1e3,reconnectionAttempts:10,timeout:15e3,forceNew:!1,withCredentials:!1,autoConnect:!0,upgrade:!0,auth:e?{token:e}:void 0}),A=()=>{const i=r();return t.auth=i?{token:i}:{},i};return t.on("connect",()=>{console.log("✅ [SOCKET DEBUG] SocketService: connected to ROOT namespace",{socketId:t.id,baseUrl:Xt,transport:t.io.engine.transport.name,namespace:t.nsp.name||"/",note:"This socket connects to CandlesGateway (root namespace)"})}),t.on("disconnect",i=>{console.log("⚠️ [SOCKET DEBUG] SocketService: disconnected:",{reason:i,socketId:t.id})}),t.on("connect_error",i=>{console.error("❌ [SOCKET DEBUG] SocketService: connection error to ROOT namespace:",{message:i?.message,description:i?.description,context:i?.context,type:i?.type,baseUrl:Xt,namespace:t.nsp.name||"/",note:"CandlesGateway requires JWT authentication - check if token is valid"})}),t.io.on("reconnect_attempt",i=>{const n=A();console.log("🔄 [SOCKET DEBUG] SocketService: reconnect attempt",{attempt:i,baseUrl:Xt,hasToken:!!n})}),t.io.on("reconnect_failed",()=>{console.error("❌ [SOCKET DEBUG] SocketService: failed to reconnect",{baseUrl:Xt})}),t.io.on("reconnect",i=>{console.log("✅ [SOCKET DEBUG] SocketService: reconnected after",{attempts:i,socketId:t.id})}),t}function To(){const r=bo(ut?.io?.uri||null);return!ut||ut.io&&r&&Xt&&r!==Xt?(ut&&(console.log("🔄 [SOCKET DEBUG] Recreating socket:",{oldUri:r,newBaseUrl:Xt,wasConnected:ut.connected,reason:"baseUrl changed"}),ut.disconnect(),ut.removeAllListeners(),ut=null),ut=$m()):ut.connected?console.log("✅ [SOCKET DEBUG] Reusing existing connected socket:",{socketId:ut.id,connected:ut.connected,baseUrl:Xt,uri:r}):console.log("⏳ [SOCKET DEBUG] Socket exists but not connected, waiting...",{socketId:ut.id,baseUrl:Xt}),ut}function Xm(r,e){const t=To();return t.on(r,e),()=>t.off(r,e)}function Zm(r,e){ut&&ut.off(r,e)}function Jm(r,e){To().emit(r,e)}function qm(){return ut?ut.connected?"connected":"connecting":"disconnected"}const hn={getSocket:To,on:Xm,off:Zm,emit:Jm,getStatus:qm,setBaseUrl:oh},Ym={},ah=Y.createContext(),Qt=()=>{const r=Y.useContext(ah);if(!r)throw new Error("useTrading must be used within TradingProvider");return r},jm=({children:r,baseUrl:e,endpoints:t,accountId:A,initialSymbol:i,initialTimeframe:n})=>{const s=e??(typeof{url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:us&&us.tagName.toUpperCase()==="SCRIPT"&&us.src||new URL("chart-sdk.umd.js",document.baseURI).href}<"u"&&Ym?.VITE_BASE_URL)??"http://localhost:5002",a={...{candles:"/api/chart/candles",symbols:"/symbols",trades:"/trades",account:"/api/user/account"},...t},c=t?.params||{},[h,d]=Y.useState(i||"BTC/USD"),[m,T]=Y.useState(n||"M1"),[v,B]=Y.useState([]),[y,D]=Y.useState(!0),[E,N]=Y.useState([]),[S,W]=Y.useState(!1),[$,j]=Y.useState(1e5),[V,X]=Y.useState(null),[ce,ae]=Y.useState([]),[de,J]=Y.useState(!0),[ie,pe]=Y.useState(!1),[Ce,Ue]=Y.useState(!0),[xe,He]=Y.useState("candles"),[Le,Fe]=Y.useState(!1),[we,ye]=Y.useState("dark"),[De,et]=Y.useState(!1),[Ye,be]=Y.useState([]),bt=Y.useRef(null);Y.useEffect(()=>{hn.setBaseUrl(s)},[s]);const Ge=Y.useRef(new Map),Oe=Y.useRef(null),Ne=1e3,ke=Y.useCallback(async()=>{if(A)try{const oe=localStorage.getItem("token");if(!oe)return;W(!0);const ne=await nt.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${oe}`}});let ge=[];Array.isArray(ne.data)?ge=ne.data:ne.data?.data&&Array.isArray(ne.data.data)&&(ge=ne.data.data);const he=ge.filter(ue=>ue.closePrice===null||ue.closePrice===void 0).map(ue=>({id:ue.id,ticket:ue.id?.substring(0,8),symbol:ue.symbol,type:ue.type,volume:ue.volume,price:ue.openPrice,stopLoss:ue.stopLoss,takeProfit:ue.takeProfit,comment:ue.comment||"",status:"OPEN",swap:0,profit:ue.profit||0,profitCurrency:"USD",time:new Date(ue.openedAt||ue.openAt||Date.now()).toLocaleTimeString(),openAt:ue.openedAt||ue.openAt,closeAt:ue.closedAt||ue.closeAt}));N(he)}catch(oe){console.error("❌ Error fetching orders:",oe.response?.data||oe.message),N([])}finally{W(!1)}},[s,A]),Te=Y.useCallback((oe,ne)=>!ne||!oe.price||isNaN(ne)||isNaN(oe.price)?oe.profit||0:(oe.type==="BUY"?ne-oe.price:oe.price-ne)*oe.volume,[]),_e=Y.useCallback(async()=>{try{const oe=localStorage.getItem("token");if(!oe)return;const ne=await nt.get(`${s}${a.account}`,{headers:{Authorization:`Bearer ${oe}`}});if(ne.data&&ne.data.data){const ge=parseFloat(ne.data.data.balance);isNaN(ge)||j(ge)}}catch(oe){console.error("❌ Error fetching user balance:",oe.response?.data||oe.message)}},[s]),Tt=Y.useCallback(async()=>{if(A)try{const oe=localStorage.getItem("token");if(!oe)return;const ne=await nt.get(`${s}/trades/account/${A}`,{headers:{Authorization:`Bearer ${oe}`}});let ge=[];Array.isArray(ne.data)?ge=ne.data:ne.data?.data&&Array.isArray(ne.data.data)&&(ge=ne.data.data);const he=ge.filter(ue=>ue.closePrice!==null&&ue.closePrice!==void 0).map(ue=>({id:ue.id,ticket:ue.id?.substring(0,8),symbol:ue.symbol,type:ue.type,volume:ue.volume,openPrice:ue.openPrice,closePrice:ue.closePrice,stopLoss:ue.stopLoss,takeProfit:ue.takeProfit,profit:ue.profit||0,profitCurrency:"USD",openAt:ue.openedAt||ue.openAt,closeAt:ue.closedAt||ue.closeAt,closeReason:ue.closeReason||"",status:"CLOSED"}));be(he)}catch(oe){console.error("❌ Error fetching history orders:",oe.response?.data||oe.message),be([])}},[s,A]),tt=Y.useMemo(()=>{const oe=$,ne=E.reduce((At,ht)=>At+ht.volume*ht.price*.01,0),ge=E.reduce((At,ht)=>{const Ct=v.find(Jt=>Jt.symbol===ht.symbol);if(Ct){const Jt=ht.type==="BUY"?parseFloat(Ct.bid||0):parseFloat(Ct.ask||0);if(Jt&&Jt>0&&!isNaN(Jt))return At+Te(ht,Jt)}return At+(ht.profit||0)},0),he=oe+ge,ue=he-ne,Me=ne>0?he/ne*100:0;return{balance:oe,equity:he,margin:ne,freeMargin:ue,level:Me.toFixed(2)}},[E,v,$,Te]);Y.useEffect(()=>{localStorage.getItem("token")&&A&&(ke(),_e(),Tt())},[ke,_e,Tt,A]),Y.useEffect(()=>{(async()=>{try{D(!0);const ne=a.symbols.includes("?")?`${s}${a.symbols}`:`${s}${a.symbols}`,ge=await nt.get(ne);let he=[];Array.isArray(ge.data)?he=ge.data:ge.data&&ge.data.data&&Array.isArray(ge.data.data)?he=ge.data.data:ge.data&&ge.data.prices&&Array.isArray(ge.data.prices)?he=ge.data.prices:ge.data&&Array.isArray(ge.data)&&(he=ge.data);const ue=he.map(Me=>Me.symbol&&(Me.bid!==void 0||Me.price!==void 0)?{symbol:Me.symbol,bid:Me.bid??Me.price??0,ask:Me.ask??Me.price??0,change:Me.change??0}:Me);ue.length>0?(B(ue),ue.find(At=>At.symbol===h)||d(ue[0].symbol)):B([])}catch(ne){console.error("❌ Error fetching symbols:",ne.response?.data||ne.message),B([])}finally{D(!1)}})()},[s,a.symbols]);const IA=Y.useCallback(()=>{const oe=Ge.current;if(oe.size===0)return;const ne=new Map(oe);oe.clear(),B(ge=>ge.map(he=>{const ue=ne.get(he.symbol);return ue?{...he,...ue}:he})),N(ge=>{let he=!1;const ue=ge.map(Me=>{const At=ne.get(Me.symbol);if(!At)return Me;const ht=Me.type==="BUY"?parseFloat(At.bid||0):parseFloat(At.ask||0);if(!ht||isNaN(ht)||ht<=0)return Me;const Ct=Te(Me,ht);return Ct===Me.profit?Me:(he=!0,{...Me,profit:Ct})});return he?ue:ge})},[Te]);Y.useEffect(()=>{bt.current||(bt.current=hn.getSocket());const oe=bt.current,ne=()=>console.log("✅ TradingContext: Connected"),ge=()=>console.log("⚠️ TradingContext: Disconnected"),he=Me=>{Me?.symbol&&(Ge.current.set(Me.symbol,Me),Oe.current||(Oe.current=setTimeout(()=>{Oe.current=null,IA()},Ne)))},ue=async Me=>{if(Me){if(Me.newBalance!==void 0){const At=parseFloat(Me.newBalance);isNaN(At)||j(At)}if(window.notify){const At=Me.profitLoss||Me.profit||0,ht=At>=0?`+${At.toFixed(2)}`:At.toFixed(2),Ct=Me.symbol||"Trade",Jt=Me.reason||"Closed";window.notify(`Trade Closed: ${Jt} | ${Ct} | P/L: ${ht} USD`,At>=0?"success":"error")}Me.tradeId&&N(At=>At.filter(ht=>ht.id!==Me.tradeId)),await ke(),await _e()}};return oe.on("connect",ne),oe.on("disconnect",ge),oe.on("priceUpdate",he),oe.on("tradeClosed",ue),()=>{oe.off("connect",ne),oe.off("disconnect",ge),oe.off("priceUpdate",he),oe.off("tradeClosed",ue),Oe.current&&(clearTimeout(Oe.current),Oe.current=null),Ge.current.clear()}},[IA,ke,_e]),Y.useEffect(()=>{try{const oe=document.documentElement;if(!oe)return;oe.dataset.theme=we}catch{}},[we]);const Ke=Y.useMemo(()=>v.find(oe=>oe.symbol===h)||{bid:"0.00000",ask:"0.00000",change:0},[v,h]),Ie=Y.useMemo(()=>({selectedSymbol:h,setSelectedSymbol:d,selectedTimeframe:m,setSelectedTimeframe:T,symbols:v,setSymbols:B,symbolsLoading:y,orders:E,setOrders:N,ordersLoading:S,fetchOrders:ke,fetchUserBalance:_e,userBalance:$,setUserBalance:j,accountSummary:tt,currentSymbolData:Ke,activeTool:V,setActiveTool:X,chartObjects:ce,setChartObjects:ae,showGrid:de,setShowGrid:J,snapToGrid:ie,setSnapToGrid:pe,drawingsVisible:Ce,setDrawingsVisible:Ue,chartType:xe,setChartType:He,chartLocked:Le,setChartLocked:Fe,theme:we,setTheme:ye,baseUrl:s,endpoints:a,endpointParams:c,accountId:A,isShow:De,setIsShow:et,historyOrders:Ye,setHistoryOrders:be,fetchHistoryOrders:Tt}),[h,m,v,y,E,S,ke,_e,$,tt,Ke,V,ce,de,ie,Ce,xe,Le,we,s,a,c,De,Ye,Tt]);return l.jsx(ah.Provider,{value:Ie,children:r})};var lh={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ch=Y.createContext&&Y.createContext(lh),eg=["attr","size","title"];function tg(r,e){if(r==null)return{};var t=Ag(r,e),A,i;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);for(i=0;i<n.length;i++)A=n[i],!(e.indexOf(A)>=0)&&Object.prototype.propertyIsEnumerable.call(r,A)&&(t[A]=r[A])}return t}function Ag(r,e){if(r==null)return{};var t={};for(var A in r)if(Object.prototype.hasOwnProperty.call(r,A)){if(e.indexOf(A)>=0)continue;t[A]=r[A]}return t}function un(){return un=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var A in t)Object.prototype.hasOwnProperty.call(t,A)&&(r[A]=t[A])}return r},un.apply(this,arguments)}function hh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var A=Object.getOwnPropertySymbols(r);e&&(A=A.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,A)}return t}function dn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hh(Object(t),!0).forEach(function(A){rg(r,A,t[A])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hh(Object(t)).forEach(function(A){Object.defineProperty(r,A,Object.getOwnPropertyDescriptor(t,A))})}return r}function rg(r,e,t){return e=ig(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ig(r){var e=ng(r,"string");return typeof e=="symbol"?e:e+""}function ng(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var A=t.call(r,e);if(typeof A!="object")return A;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function uh(r){return r&&r.map((e,t)=>Y.createElement(e.tag,dn({key:t},e.attr),uh(e.child)))}function Dt(r){return e=>Y.createElement(sg,un({attr:dn({},r.attr)},e),uh(r.child))}function sg(r){var e=t=>{var{attr:A,size:i,title:n}=r,s=tg(r,eg),o=i||t.size||"1em",a;return t.className&&(a=t.className),r.className&&(a=(a?a+" ":"")+r.className),Y.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,A,s,{className:a,style:dn(dn({color:r.color||t.color},t.style),r.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),n&&Y.createElement("title",null,n),r.children)};return ch!==void 0?Y.createElement(ch.Consumer,null,t=>e(t)):e(lh)}function og(r){return Dt({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:[]}]})(r)}function ag(r){return Dt({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:[]}]})(r)}function lg(r){return Dt({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:[]}]})(r)}function cg(r){return Dt({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:[]}]})(r)}function dh(r){return Dt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"},child:[]}]})(r)}function hg(r){return Dt({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"},child:[]}]})(r)}function ug(r){return Dt({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:[]}]})(r)}function dg(r){return Dt({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:[]}]})(r)}function pg(r){return Dt({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:[]}]})(r)}function fg(r){return Dt({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:[]}]})(r)}const mg={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ph=({bidPrice:r,askPrice:e,userAccountId:t})=>{const{theme:A,selectedSymbol:i,fetchOrders:n,baseUrl:s,endpoints:o}=Qt(),a=A==="light",[c,h]=Y.useState("0.01"),[d,m]=Y.useState(""),[T,v]=Y.useState(!1),B=a?"bg-slate-100":"bg-[#12161d]",y=a?"text-slate-700":"text-white",D=a?"hover:bg-slate-200":"hover:bg-[#1e2635]",E=S=>{const W=parseFloat(c)||.01,$=Math.max(.01,W+S);h($.toFixed(2))},N=async S=>{m("");const W=S,$=parseFloat(W==="BUY"?e:r),j=parseFloat(c);if(!j||j<=0||isNaN(j)){m("Please enter a valid volume (minimum 0.01)");return}if(j<.01){m("Volume must be at least 0.01");return}if(!$||$<=0||isNaN($)){m("Invalid price. Please refresh and try again.");return}const V=localStorage.getItem("token");if(!V){m("Please login to place trades");return}v(!0);const X=typeof i=="object"?i?.symbol:i,ce={accountId:t,symbol:X,type:W,volume:j,openPrice:$,takeProfit:null,stopLoss:null};try{const ae=s||mg?.VITE_BASE_URL||"http://localhost:8000",de=o?.trades||"/api/trades",J=await nt.post(`${ae}${de}`,ce,{headers:{Authorization:`Bearer ${V}`,"Content-Type":"application/json"}});if(J.status<200||J.status>=300){m(J.data?.message||`Failed to place trade (${J.status})`);return}n&&n()}catch(ae){const de=ae?.response?.data?.message||ae?.message||"Network error. Please try again.";m(de)}finally{v(!1)}};return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:"flex items-stretch h-[30px] text-xs font-semibold select-none",children:[l.jsxs("button",{onClick:()=>N("SELL"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[l.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#BD3E3E] text-white",children:r?Number(r).toFixed(5):"—"}),l.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#DE4848] text-white",children:"SELL"})]}),l.jsxs("div",{className:`flex items-stretch ${B}`,children:[l.jsx("button",{type:"button",onClick:()=>E(-.01),className:`w-5 flex items-center justify-center ${y} ${D} transition-colors`,children:l.jsx(dh,{size:8})}),l.jsx("input",{type:"number",value:c,onChange:S=>{const W=S.target.value;(W===""||/^\d*\.?\d{0,2}$/.test(W))&&h(W)},onBlur:()=>{const S=parseFloat(c);h(isNaN(S)||S<.01?"0.01":S.toFixed(2))},className:`w-14 text-center focus:outline-none ${B} ${y}`,step:"0.01",min:"0.01",style:{MozAppearance:"textfield"}}),l.jsx("button",{type:"button",onClick:()=>E(.01),className:`w-5 flex items-center justify-center ${y} ${D} transition-colors`,children:l.jsx(hg,{size:8})})]}),l.jsxs("button",{onClick:()=>N("BUY"),disabled:T,className:"flex items-stretch overflow-hidden opacity-100 disabled:opacity-60",children:[l.jsx("span",{className:"flex items-center px-2.5 tracking-wide bg-[#2869CE] text-white",children:"BUY"}),l.jsx("span",{className:"flex items-center px-2.5 font-mono tabular-nums bg-[#2F7CF2] text-white",children:e?Number(e).toFixed(5):"—"})]})]}),d&&l.jsx("div",{className:"text-red-400 text-xs mt-0.5 px-1",children:d})]})},gg={},fh=({isOpen:r,onClose:e,orderType:t,bidPrice:A,askPrice:i,onExecuteTrade:n,userAccountId:s,initialVolume:o,disableOptimistic:a=!1,forceParentExecution:c=!1,tradingEngine:h})=>{const{selectedSymbol:d,selectedTimeframe:m,setOrders:T,symbols:v,fetchOrders:B,theme:y,baseUrl:D,endpoints:E}=Qt(),N=y==="light",S={getContractSpec:oe=>{const ne=String(oe||"").toUpperCase();return ne.includes("BTC")||ne.includes("ETH")||ne.includes("SOL")||ne.includes("XRP")||ne.includes("ADA")||ne.includes("DOGE")||ne.includes("BNB")||ne.includes("AVAX")||ne.includes("DOT")||ne.includes("LINK")||ne.endsWith("USDT")?{contractSize:1}:ne.includes("XAU")||ne.includes("XAG")?{contractSize:100}:{contractSize:1e5}},calculateVolumeUnits:({symbol:oe,volume:ne})=>{const ge=S.getContractSpec(oe);return(parseFloat(ne)||0)*(ge.contractSize||1)}},W=h||S,[$,j]=Y.useState("0.01"),[V,X]=Y.useState(""),[ce,ae]=Y.useState(""),[de,J]=Y.useState(""),[ie,pe]=Y.useState(!1),[Ce,Ue]=Y.useState(null),[xe,He]=Y.useState(""),[Le,Fe]=Y.useState(t||"BUY"),[we,ye]=Y.useState(parseFloat(A)||0),[De,et]=Y.useState(parseFloat(i)||0),[Ye,be]=Y.useState("text-white"),[bt,Ge]=Y.useState("text-white"),Oe=Y.useRef(parseFloat(A)||0),Ne=Y.useRef(parseFloat(i)||0);Y.useEffect(()=>{if(!r)return;const oe=hn.getSocket(),ne=he=>{if(!(!he||!he.symbol)&&he.symbol.toUpperCase()===d?.toUpperCase()){const ue=parseFloat(he.bid)||0,Me=parseFloat(he.ask)||0;ue>0&&(ue>Oe.current?(be("text-green-400"),setTimeout(()=>be("text-white"),500)):ue<Oe.current&&Oe.current>0&&(be("text-red-400"),setTimeout(()=>be("text-white"),500)),ye(ue),Oe.current=ue),Me>0&&(Me>Ne.current?(Ge("text-green-400"),setTimeout(()=>Ge("text-white"),500)):Me<Ne.current&&Ne.current>0&&(Ge("text-red-400"),setTimeout(()=>Ge("text-white"),500)),et(Me),Ne.current=Me)}};oe.on("priceUpdate",ne);const ge=v.find(he=>he.symbol===d);if(ge){const he=parseFloat(ge.bid)||0,ue=parseFloat(ge.ask)||0;he>0&&(ye(he),Oe.current=he),ue>0&&(et(ue),Ne.current=ue)}return()=>{oe.off("priceUpdate",ne)}},[r,d,v]),Y.useEffect(()=>{if(r){j(o?String(o):"0.01"),X(""),ae(""),J(""),He(""),Fe(t||"BUY");const oe=parseFloat(A)||0,ne=parseFloat(i)||0;oe>0&&(ye(oe),Oe.current=oe),ne>0&&(et(ne),Ne.current=ne)}},[r,t,A,i,o]);const ke=we||0,Te=De||0,_e=oe=>{const ne=parseFloat($)||.01,ge=Math.max(.01,ne+oe);j(ge.toFixed(2))},Tt=oe=>{const ne=parseFloat(V)||0,ge=parseFloat(Le==="BUY"?De:we)||0;if(!ge){He("Current price not available. Please wait...");return}let he=ne+oe;Le==="BUY"?he=Math.max(1e-5,Math.min(he,ge-1e-5)):he=Math.max(ge+1e-5,he),X(he>0?he.toFixed(5):""),He("")},tt=oe=>{const ne=parseFloat(ce)||0,ge=parseFloat(Le==="BUY"?De:we)||0;if(!ge){He("Current price not available. Please wait...");return}let he=ne+oe;Le==="BUY"?he=Math.max(ge+1e-5,he):he=Math.max(1e-5,Math.min(he,ge-1e-5)),ae(he>0?he.toFixed(5):""),He("")},IA=async oe=>{He("");const ne=oe||Le,ge=parseFloat(ne==="BUY"?De:we),he=parseFloat($),ue=V?parseFloat(V):null,Me=ce?parseFloat(ce):null;if(!he||he<=0||isNaN(he)){He("Please enter a valid volume (minimum 0.01)");return}if(he<.01){He("Volume must be at least 0.01");return}if(!ge||ge<=0||isNaN(ge)){He("Invalid price. Please refresh and try again.");return}if(ue!==null&&ue!==""){if(isNaN(ue)||ue<=0){He("Stop Loss must be a valid positive number");return}if(ne==="BUY"&&ue>=ge){He("Stop Loss must be below the current price for BUY orders");return}if(ne==="SELL"&&ue<=ge){He("Stop Loss must be above the current price for SELL orders");return}}if(Me!==null&&Me!==""){if(isNaN(Me)||Me<=0){He("Take Profit must be a valid positive number");return}if(ne==="BUY"){if(Me<=ge){He(`Take Profit must be above the entry price (${ge.toFixed(5)}) for BUY orders`);return}}else if(ne==="SELL"&&Me>=ge){He(`Take Profit must be below the entry price (${ge.toFixed(5)}) for SELL orders`);return}}Fe(ne),Ue(ne),pe(!0);const At=new Date,ht=At.toLocaleTimeString(),Ct=`temp_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,Jt=localStorage.getItem("token");if(!Jt){He("Please login to place trades"),pe(!1),Ue(null);return}const Ha={accountId:s,symbol:d,type:ne,volume:he,price:ge,takeProfit:Me,stopLoss:ue,comment:de.trim()||null},Lr={ticket:Ct.substring(0,8),symbol:d,type:ne,volume:parseFloat(he),price:parseFloat(ge),time:ht,stopLoss:ue?parseFloat(ue):null,takeProfit:Me?parseFloat(Me):null,swap:0,profit:0,profitCurrency:"USD",comment:de.trim()||"",id:Ct,status:"OPEN",openAt:At.toISOString()};if(!a&&T&&T(ZA=>[...ZA,Lr]),c&&!n){He("Execution handler is required in forceParentExecution mode"),pe(!1),Ue(null);return}if(n){pe(!1),Ue(null),e();const ZA={symbol:d,type:ne,lotSize:he,entryPrice:ge,stopLoss:ue,takeProfit:Me,comment:de.trim()||null};Promise.resolve(n(ZA)).then(()=>{console.log("✅ Trade executed successfully via parent handler"),B&&B()}).catch(xA=>{console.error("❌ Trade execution failed:",xA),!a&&T&&T(Nt=>Nt.filter(dt=>dt.id!==Ct))})}else{if(c){He("Fallback API path disabled in forceParentExecution mode"),pe(!1),Ue(null);return}pe(!1),Ue(null),e();const ZA=D||gg?.VITE_BASE_URL||"http://localhost:8000",xA=E?.trades||"/api/trades";nt.post(`${ZA}${xA}`,Ha,{headers:{Authorization:`Bearer ${Jt}`,"Content-Type":"application/json"}}).then(Nt=>{if(Nt.data&&Nt.data.data){const dt=Nt.data.data.trade;!a&&T&&T(qt=>qt.map(Yt=>Yt.id===Ct?{...Yt,id:dt.id,ticket:dt.id.substring(0,8),time:ht,openAt:dt.openAt}:Yt)),console.log("✅ Trade saved successfully:",dt),window.notify&&window.notify(`Trade placed successfully: ${dt.symbol} ${dt.type}`,"success")}else{!a&&T&&T(qt=>qt.filter(Yt=>Yt.id!==Ct));const dt=Nt.data?.message||"Failed to place trade";window.notify&&window.notify(dt,"error")}}).catch(Nt=>{console.error("Error placing trade:",Nt),!a&&T&&T(qt=>qt.filter(Yt=>Yt.id!==Ct));let dt="Failed to place trade";if(Nt.response){const qt=Nt.response.status,Yt=Nt.response.data;qt===400?dt=Yt?.message||"Invalid trade data. Please check your inputs.":qt===401?dt="Authentication failed. Please login again.":qt===404?dt=Yt?.message||"Symbol not found. Please select a valid symbol.":qt===500?dt="Server error. Please try again later.":dt=Yt?.message||`Error: ${qt}`}else Nt.request&&(dt="Network error. Please check your internet connection.");window.notify&&window.notify(dt,"error")})}},Ie=(W?.calculateVolumeUnits?.({symbol:d,volume:parseFloat($)||0})??0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return r?l.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:[l.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:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:`text-sm font-semibold ${N?"text-slate-800":"text-white"}`,children:"Market Execution"}),l.jsx("button",{className:`p-0.5 transition-colors ${N?"text-slate-600 hover:text-slate-800":"text-white hover:text-white"}`,children:l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),l.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:l.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),l.jsxs("div",{className:"overflow-y-auto p-4 space-y-4 flex-1",children:[xe&&l.jsx("div",{className:"p-2 rounded-lg bg-rose-500/10 border border-rose-500/50 text-rose-400 text-xs",children:xe}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Volume"}),l.jsxs("span",{className:`text-sm ${N?"text-slate-700":"text-white"}`,children:[Ie," ",d]})]}),l.jsxs("div",{className:"relative flex items-center",children:[l.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:"−"}),l.jsx("input",{type:"number",value:$,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d{0,2}$/.test(ne))&&(j(ne),He(""))},onBlur:()=>{const oe=parseFloat($);j(isNaN(oe)||oe<.01?"0.01":oe.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"}),l.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:"+"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsxs("div",{children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Stop Loss"})}),l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("button",{type:"button",onClick:()=>Tt(-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:"−"}),l.jsx("input",{type:"text",value:V,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(X(ne),He(""))},onBlur:oe=>{const ne=parseFloat(oe.target.value);!isNaN(ne)&&ne>0?X(ne.toFixed(5)):oe.target.value===""&&X("")},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"}`}),l.jsx("button",{type:"button",onClick:()=>Tt(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:"+"})]})]}),l.jsxs("div",{children:[l.jsx("div",{className:"flex items-center justify-between mb-2",children:l.jsx("label",{className:`text-sm font-medium ${N?"text-slate-700":"text-white"}`,children:"Take Profit"})}),l.jsxs("div",{className:"relative flex items-center",children:[l.jsx("button",{type:"button",onClick:()=>tt(-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:"−"}),l.jsx("input",{type:"text",value:ce,onChange:oe=>{const ne=oe.target.value;(ne===""||/^\d*\.?\d*$/.test(ne))&&(ae(ne),He(""))},onBlur:oe=>{const ne=parseFloat(oe.target.value);!isNaN(ne)&&ne>0?ae(ne.toFixed(5)):oe.target.value===""&&ae("")},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"}`}),l.jsx("button",{type:"button",onClick:()=>tt(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:"+"})]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:`block text-sm font-medium mb-2 ${N?"text-slate-700":"text-white"}`,children:"Comment"}),l.jsx("textarea",{value:de,onChange:oe=>J(oe.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"}`})]}),l.jsxs("div",{className:`flex items-center justify-between py-2 border-t ${N?"border-slate-400":"border-slate-700"}`,children:[l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:N?"text-slate-700":"text-white",children:"Bid: "}),l.jsx("span",{className:`${Ye} font-medium transition-colors duration-400`,children:ke>0?ke.toFixed(5):"---"})]}),l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:N?"text-slate-700":"text-white",children:"Ask: "}),l.jsx("span",{className:`${bt} font-medium transition-colors duration-400`,children:Te>0?Te.toFixed(5):"---"})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2",children:[l.jsx("button",{onClick:()=>IA("SELL"),disabled:ie,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:ie&&Ce==="SELL"?l.jsxs("span",{className:"flex items-center justify-center gap-2",children:[l.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),l.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"}),l.jsx("button",{onClick:()=>IA("BUY"),disabled:ie,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:ie&&Ce==="BUY"?l.jsxs("span",{className:"flex items-center justify-center gap-2",children:[l.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),l.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},wg={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"},Bg=[10,11,12,14,16,20,24,28,30,40],pn=[{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"}],OA={width:"78%",height:"78%",display:"block"},mh={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function Cg(r){return r?{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 gh(r,e="#5f8f96"){if(typeof r!="string")return e;const t=r.trim();if(!t)return e;const A=t.startsWith("#")?t:`#${t}`;return/^#[0-9A-Fa-f]{6}$/.test(A)?A.toLowerCase():e}const vg=()=>l.jsx(pg,{style:OA}),yg=()=>l.jsx(fg,{style:OA}),bg=()=>l.jsx(cg,{style:OA}),Tg=()=>l.jsx(dg,{style:OA}),xg=()=>l.jsx(ag,{style:OA}),Qg=()=>l.jsx(og,{style:OA}),Fg=()=>l.jsx(lg,{style:OA}),Ug=()=>l.jsx(dh,{style:OA}),xo=({size:r,children:e})=>l.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:r,height:r},children:e});function ei({checked:r,onClick:e,hideLeftBorder:t,tokens:A,children:i,title:n}){return l.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:r?A.activeFill:"transparent",color:r?A.activeText:A.text,cursor:"pointer",padding:0},children:l.jsx(xo,{size:"18px",children:i})})}function ti({checked:r,onChange:e,label:t,tokens:A,disabled:i=!1}){return l.jsxs("label",{style:{display:"inline-flex",alignItems:"center",userSelect:"none",opacity:i?.5:1,cursor:i?"default":"pointer"},children:[l.jsx("input",{type:"checkbox",checked:r,onChange:n=>e(n.target.checked),disabled:i,style:mh}),l.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:r&&l.jsx("span",{style:{width:10,height:10,background:A.headerBlue}})}),l.jsx("span",{style:{fontSize:12,color:A.text},children:t})]})}function Qo({value:r,onChange:e,onBlur:t,disabled:A=!1,tokens:i}){const n=gh(r,"#5f8f96"),s=(r||"").replace("#",""),o={display:"inline-flex",alignItems:"center",width:104,height:30,padding:4,opacity:A?.5:1,border:`1px solid ${i.fieldBorder}`,background:i.fieldBg,boxSizing:"border-box"},a={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?i.fieldDisabledText:i.text};return l.jsxs("div",{style:o,children:[l.jsxs("label",{style:a,children:[l.jsx("input",{type:"color",value:n,onChange:h=>e(h.target.value),disabled:A,style:{...mh,position:"absolute"}}),l.jsx("span",{style:{display:"block",width:20,height:20,boxShadow:"inset 0 0 0 1px #c7cdd7",background:n}})]}),l.jsx("input",{type:"text",size:0,maxLength:6,value:s,onChange:h=>{const d=h.target.value.replace(/[^0-9a-fA-F]/g,"").slice(0,6);e(d?`#${d}`:"")},onBlur:t,disabled:A,style:c})]})}function Fo({tokens:r,disabled:e=!1,style:t={},...A}){return l.jsx("input",{type:"number",disabled:e,style:{height:30,width:"100%",border:`1px solid ${e?r.fieldDisabledBg:r.fieldBorder}`,padding:"0 4px",fontSize:12,outline:"none",boxSizing:"border-box",background:e?r.fieldDisabledBg:r.fieldBg,color:e?r.fieldDisabledText:r.text,...t},...A})}function Eg({draft:r,setDraft:e,tokens:t}){const A=r.visibleTimeframes?.length===pn.length,i=()=>{e(s=>({...s,visibleTimeframes:A?[]:pn.map(o=>o.key)}))},n=s=>{e(o=>{const a=o.visibleTimeframes||[];return{...o,visibleTimeframes:a.includes(s)?a.filter(c=>c!==s):[...a,s]}})};return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[l.jsx(ti,{checked:A,onChange:i,label:"Show on all the timeframes",tokens:t}),l.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",columnGap:12,rowGap:8},children:pn.map(s=>l.jsx(ti,{checked:(r.visibleTimeframes||[]).includes(s.key),onChange:()=>n(s.key),label:s.label,tokens:t,disabled:A},s.key))})]})}function Sg({draft:r,setDraft:e,tokens:t}){const A=(n,s)=>e(o=>({...o,[n]:s})),i=(n,s,o)=>{A(n,gh(s,o))};return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"8px 16px"},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l.jsx(Qo,{value:r.color||"#5f8f96",onChange:n=>A("color",n),onBlur:()=>i("color",r.color,"#5f8f96"),tokens:t}),l.jsxs("div",{style:{position:"relative",width:84,height:30},children:[l.jsx("select",{value:r.fontSize||12,onChange:n=>A("fontSize",Number(n.target.value)),style:{width:"100%",height:"100%",appearance:"none",border:`1px solid ${t.fieldBorder}`,padding:"0 26px 0 8px",fontSize:12,outline:"none",boxSizing:"border-box",background:t.fieldBg,color:t.text},children:Bg.map(n=>l.jsx("option",{value:n,children:n},n))}),l.jsx("div",{style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",width:16,height:16,pointerEvents:"none",color:t.mutedText},children:l.jsx(Ug,{})})]}),l.jsxs("div",{style:{display:"flex"},children:[l.jsx(ei,{checked:r.fontWeight==="bold",onClick:()=>A("fontWeight",r.fontWeight==="bold"?"normal":"bold"),tokens:t,title:"Bold",children:l.jsx(bg,{})}),l.jsx(ei,{checked:r.fontStyle==="italic",onClick:()=>A("fontStyle",r.fontStyle==="italic"?"normal":"italic"),hideLeftBorder:!0,tokens:t,title:"Italic",children:l.jsx(Tg,{})})]}),l.jsxs("div",{style:{display:"flex"},children:[l.jsx(ei,{checked:r.textAlign==="left",onClick:()=>A("textAlign","left"),tokens:t,title:"Align left",children:l.jsx(xg,{})}),l.jsx(ei,{checked:r.textAlign==="center",onClick:()=>A("textAlign","center"),hideLeftBorder:!0,tokens:t,title:"Align center",children:l.jsx(Qg,{})}),l.jsx(ei,{checked:r.textAlign==="right",onClick:()=>A("textAlign","right"),hideLeftBorder:!0,tokens:t,title:"Align right",children:l.jsx(Fg,{})})]})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"112px 104px 56px minmax(112px, 1fr)",gap:8,alignItems:"center"},children:[l.jsx(ti,{checked:!!r.textWrap,onChange:n=>A("textWrap",n),label:"Text Wrap",tokens:t}),l.jsx("div",{}),l.jsx("div",{}),l.jsx("div",{}),l.jsx(ti,{checked:!!r.borderEnabled,onChange:n=>A("borderEnabled",n),label:"Border",tokens:t}),l.jsx(Qo,{value:r.borderColor||"#5f8f96",onChange:n=>A("borderColor",n),onBlur:()=>i("borderColor",r.borderColor,"#5f8f96"),disabled:!r.borderEnabled,tokens:t}),l.jsx(Fo,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!r.borderEnabled,value:r.borderOpacity??.1,onChange:n=>A("borderOpacity",Number(n.target.value))}),l.jsxs("div",{style:{display:"flex",height:30,alignItems:"center",gap:8},children:[l.jsx("input",{type:"range",min:"1",max:"5",step:"1",disabled:!r.borderEnabled,value:r.borderWidth??1,onChange:n=>A("borderWidth",Number(n.target.value)),style:{width:"100%",accentColor:t.headerBlue}}),l.jsx("span",{style:{width:16,fontSize:12,color:t.text},children:r.borderWidth??1})]}),l.jsx(ti,{checked:!!r.bgEnabled,onChange:n=>A("bgEnabled",n),label:"Background",tokens:t}),l.jsx(Qo,{value:r.bgColor||"#5f8f96",onChange:n=>A("bgColor",n),onBlur:()=>i("bgColor",r.bgColor,"#5f8f96"),disabled:!r.bgEnabled,tokens:t}),l.jsx(Fo,{tokens:t,min:"0",max:"1",step:"0.01",disabled:!r.bgEnabled,value:r.bgOpacity??.1,onChange:n=>A("bgOpacity",Number(n.target.value))}),l.jsx("div",{})]}),l.jsx("textarea",{value:r.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 Hg({draft:r,setDraft:e,tokens:t}){return l.jsx("div",{style:{padding:"12px 16px"},children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[l.jsx("span",{style:{fontSize:12,whiteSpace:"nowrap",color:t.text},children:"#1 (Bar, Price)"}),l.jsx(Fo,{tokens:t,value:r.price??"",onChange:A=>{const i=Number(A.target.value);Number.isFinite(i)&&e(n=>({...n,price:i}))},style:{width:180}})]})})}function Lg(r){if(!r)return{};const e={visibleTimeframes:r.visibleTimeframes||pn.map(t=>t.key)};return r.type==="text"?{...e,text:r.primitive?.text??r.text??"Text",color:r.primitive?.color??"#5f8f96",fontSize:r.primitive?.fontSize??12,fontWeight:r.primitive?.fontWeight??"normal",fontStyle:r.primitive?.fontStyle??"normal",textAlign:r.primitive?.textAlign??"center",textWrap:r.primitive?.textWrap??!1,borderEnabled:r.primitive?.borderEnabled??!1,borderColor:r.primitive?.borderColor??"#5f8f96",borderOpacity:r.primitive?.borderOpacity??.1,borderWidth:r.primitive?.borderWidth??1,bgEnabled:r.primitive?.bgEnabled??!1,bgColor:r.primitive?.bgColor??"#5f8f96",bgOpacity:r.primitive?.bgOpacity??.1,price:r.price}:e}const wh=({isOpen:r,onClose:e,chartObject:t,onUpdate:A})=>{const{theme:i}=Qt(),s=Cg(i==="light"),[o,a]=Y.useState("style"),[c,h]=Y.useState({});if(Y.useEffect(()=>{t&&(h(Lg(t)),a("style"))},[t]),!r||!t)return null;const d=wg[t.type]||t.type,m=["style","coordinates","visualization"],T=()=>{if(o==="visualization")return l.jsx(Eg,{draft:c,setDraft:h,tokens:s});if(t.type==="text"){if(o==="style")return l.jsx(Sg,{draft:c,setDraft:h,tokens:s});if(o==="coordinates")return l.jsx(Hg,{draft:c,setDraft:h,tokens:s})}return l.jsx("div",{style:{padding:"24px 16px",fontSize:12,color:s.mutedText},children:"Customization for this tool is not yet available."})},v=()=>{A(c),e()};return l.jsxs("div",{style:{pointerEvents:"auto",position:"absolute",zIndex:60,display:"flex",flexDirection:"column",overflow:"hidden",top:"50%",left:"50%",transform:"translate(-50%, -50%)",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:[l.jsxs("div",{style:{display:"flex",flexShrink:0},children:[l.jsx("div",{style:{display:"flex",minHeight:40,flexGrow:1,alignItems:"center",justifyContent:"space-between",overflow:"hidden",padding:"0 16px",background:s.headerBlue,color:s.headerText},children:l.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[l.jsx("span",{style:{maxWidth:320,overflow:"hidden",fontSize:14,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d}),l.jsx("button",{type:"button",style:{background:"transparent",border:"none",padding:0,color:"inherit",cursor:"pointer"},children:l.jsx(xo,{size:"18px",children:l.jsx(vg,{})})})]})}),l.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:l.jsx(xo,{size:"20px",children:l.jsx(yg,{})})})]}),l.jsx("div",{style:{display:"flex",flexShrink:0,overflowX:"auto",borderBottom:`1px solid ${s.border}`},children:m.map(y=>{const D=o===y;return l.jsxs("button",{type:"button",onClick:()=>a(y),style:{position:"relative",height:40,padding:"0 16px",fontSize:13,whiteSpace:"nowrap",border:"none",background:"transparent",color:D?s.text:s.mutedText,cursor:"pointer"},children:[y.charAt(0).toUpperCase()+y.slice(1),D&&l.jsx("span",{style:{position:"absolute",bottom:0,left:0,height:3,width:"100%",background:s.headerBlue}})]},y)})}),l.jsx("div",{style:{flex:1,overflow:"auto"},children:T()}),l.jsxs("div",{style:{display:"flex",flexShrink:0,flexDirection:"row-reverse",gap:8,borderTop:`1px solid ${s.border}`,padding:"8px 16px"},children:[l.jsx("button",{type:"button",onClick:v,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"}),l.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 Uo=function(r,e){return Uo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,A){t.__proto__=A}||function(t,A){for(var i in A)Object.prototype.hasOwnProperty.call(A,i)&&(t[i]=A[i])},Uo(r,e)};function uA(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Uo(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Eo=function(){return Eo=Object.assign||function(e){for(var t,A=1,i=arguments.length;A<i;A++){t=arguments[A];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Eo.apply(this,arguments)};function kt(r,e,t,A){function i(n){return n instanceof t?n:new t(function(s){s(n)})}return new(t||(t=Promise))(function(n,s){function o(h){try{c(A.next(h))}catch(d){s(d)}}function a(h){try{c(A.throw(h))}catch(d){s(d)}}function c(h){h.done?n(h.value):i(h.value).then(o,a)}c((A=A.apply(r,[])).next())})}function Mt(r,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},A,i,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(c){return function(h){return a([c,h])}}function a(c){if(A)throw new TypeError("Generator is already executing.");for(;t;)try{if(A=1,i&&(n=c[0]&2?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=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++,i=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(r,t)}catch(h){c=[6,h],i=0}finally{A=n=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function fn(r,e,t){if(arguments.length===2)for(var A=0,i=e.length,n;A<i;A++)(n||!(A in e))&&(n||(n=Array.prototype.slice.call(e,0,A)),n[A]=e[A]);return r.concat(n||e)}for(var EA=(function(){function r(e,t,A,i){this.left=e,this.top=t,this.width=A,this.height=i}return r.prototype.add=function(e,t,A,i){return new r(this.left+e,this.top+t,this.width+A,this.height+i)},r.fromClientRect=function(e,t){return new r(t.left+e.windowBounds.left,t.top+e.windowBounds.top,t.width,t.height)},r.fromDOMRectList=function(e,t){var A=Array.from(t).find(function(i){return i.width!==0});return A?new r(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r})(),mn=function(r,e){return EA.fromClientRect(r,e.getBoundingClientRect())},Mg=function(r){var e=r.body,t=r.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)),i=Math.max(Math.max(e.scrollHeight,t.scrollHeight),Math.max(e.offsetHeight,t.offsetHeight),Math.max(e.clientHeight,t.clientHeight));return new EA(0,0,A,i)},gn=function(r){for(var e=[],t=0,A=r.length;t<A;){var i=r.charCodeAt(t++);if(i>=55296&&i<=56319&&t<A){var n=r.charCodeAt(t++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},ft=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var t=r.length;if(!t)return"";for(var A=[],i=-1,n="";++i<t;){var s=r[i];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(i+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},Bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ig=typeof Uint8Array>"u"?[]:new Uint8Array(256),wn=0;wn<Bh.length;wn++)Ig[Bh.charCodeAt(wn)]=wn;for(var Ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ai=typeof Uint8Array>"u"?[]:new Uint8Array(256),Bn=0;Bn<Ch.length;Bn++)Ai[Ch.charCodeAt(Bn)]=Bn;for(var _g=function(r){var e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=Ai[r.charCodeAt(A)],s=Ai[r.charCodeAt(A+1)],o=Ai[r.charCodeAt(A+2)],a=Ai[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},Dg=function(r){for(var e=r.length,t=[],A=0;A<e;A+=2)t.push(r[A+1]<<8|r[A]);return t},kg=function(r){for(var e=r.length,t=[],A=0;A<e;A+=4)t.push(r[A+3]<<24|r[A+2]<<16|r[A+1]<<8|r[A]);return t},nr=5,So=11,Ho=2,Og=So-nr,vh=65536>>nr,Ng=1<<nr,Lo=Ng-1,Kg=1024>>nr,Pg=vh+Kg,Vg=Pg,zg=32,Wg=Vg+zg,Gg=65536>>So,Rg=1<<Og,$g=Rg-1,yh=function(r,e,t){return r.slice?r.slice(e,t):new Uint16Array(Array.prototype.slice.call(r,e,t))},Xg=function(r,e,t){return r.slice?r.slice(e,t):new Uint32Array(Array.prototype.slice.call(r,e,t))},Zg=function(r,e){var t=_g(r),A=Array.isArray(t)?kg(t):new Uint32Array(t),i=Array.isArray(t)?Dg(t):new Uint16Array(t),n=24,s=yh(i,n/2,A[4]/2),o=A[5]===2?yh(i,(n+A[4])/2):Xg(A,Math.ceil((n+A[4])/4));return new Jg(A[0],A[1],A[2],A[3],s,o)},Jg=(function(){function r(e,t,A,i,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>nr],t=(t<<Ho)+(e&Lo),this.data[t];if(e<=65535)return t=this.index[vh+(e-55296>>nr)],t=(t<<Ho)+(e&Lo),this.data[t];if(e<this.highStart)return t=Wg-Gg+(e>>So),t=this.index[t],t+=e>>nr&$g,t=this.index[t],t=(t<<Ho)+(e&Lo),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qg=typeof Uint8Array>"u"?[]:new Uint8Array(256),Cn=0;Cn<bh.length;Cn++)qg[bh.charCodeAt(Cn)]=Cn;var Yg="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==",Th=50,jg=1,xh=2,Qh=3,ew=4,tw=5,Fh=7,Uh=8,Eh=9,NA=10,Mo=11,Sh=12,Io=13,Aw=14,ri=15,_o=16,vn=17,ii=18,rw=19,Hh=20,Do=21,ni=22,ko=23,Cr=24,Zt=25,si=26,oi=27,vr=28,iw=29,sr=30,nw=31,yn=32,bn=33,Oo=34,No=35,Ko=36,ai=37,Po=38,Tn=39,xn=40,Vo=41,Lh=42,sw=43,ow=[9001,65288],Mh="!",Ze="×",Qn="÷",zo=Zg(Yg),SA=[sr,Ko],Wo=[jg,xh,Qh,tw],Ih=[NA,Uh],_h=[oi,si],aw=Wo.concat(Ih),Dh=[Po,Tn,xn,Oo,No],lw=[ri,Io],cw=function(r,e){e===void 0&&(e="strict");var t=[],A=[],i=[];return r.forEach(function(n,s){var o=zo.get(n);if(o>Th?(i.push(!0),o-=Th):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(n)!==-1)return A.push(s),t.push(_o);if(o===ew||o===Mo){if(s===0)return A.push(s),t.push(sr);var a=t[s-1];return aw.indexOf(a)===-1?(A.push(A[s-1]),t.push(a)):(A.push(s),t.push(sr))}if(A.push(s),o===nw)return t.push(e==="strict"?Do:ai);if(o===Lh||o===iw)return t.push(sr);if(o===sw)return n>=131072&&n<=196605||n>=196608&&n<=262141?t.push(ai):t.push(sr);t.push(o)}),[A,t,i]},Go=function(r,e,t,A){var i=A[t];if(Array.isArray(r)?r.indexOf(i)!==-1:r===i)for(var n=t;n<=A.length;){n++;var s=A[n];if(s===e)return!0;if(s!==NA)break}if(i===NA)for(var n=t;n>0;){n--;var o=A[n];if(Array.isArray(r)?r.indexOf(o)!==-1:r===o)for(var a=t;a<=A.length;){a++;var s=A[a];if(s===e)return!0;if(s!==NA)break}if(o!==NA)break}return!1},kh=function(r,e){for(var t=r;t>=0;){var A=e[t];if(A===NA)t--;else return A}return 0},hw=function(r,e,t,A,i){if(t[A]===0)return Ze;var n=A-1;if(Array.isArray(i)&&i[n]===!0)return Ze;var s=n-1,o=n+1,a=e[n],c=s>=0?e[s]:0,h=e[o];if(a===xh&&h===Qh)return Ze;if(Wo.indexOf(a)!==-1)return Mh;if(Wo.indexOf(h)!==-1||Ih.indexOf(h)!==-1)return Ze;if(kh(n,e)===Uh)return Qn;if(zo.get(r[n])===Mo||(a===yn||a===bn)&&zo.get(r[o])===Mo||a===Fh||h===Fh||a===Eh||[NA,Io,ri].indexOf(a)===-1&&h===Eh||[vn,ii,rw,Cr,vr].indexOf(h)!==-1||kh(n,e)===ni||Go(ko,ni,n,e)||Go([vn,ii],Do,n,e)||Go(Sh,Sh,n,e))return Ze;if(a===NA)return Qn;if(a===ko||h===ko)return Ze;if(h===_o||a===_o)return Qn;if([Io,ri,Do].indexOf(h)!==-1||a===Aw||c===Ko&&lw.indexOf(a)!==-1||a===vr&&h===Ko||h===Hh||SA.indexOf(h)!==-1&&a===Zt||SA.indexOf(a)!==-1&&h===Zt||a===oi&&[ai,yn,bn].indexOf(h)!==-1||[ai,yn,bn].indexOf(a)!==-1&&h===si||SA.indexOf(a)!==-1&&_h.indexOf(h)!==-1||_h.indexOf(a)!==-1&&SA.indexOf(h)!==-1||[oi,si].indexOf(a)!==-1&&(h===Zt||[ni,ri].indexOf(h)!==-1&&e[o+1]===Zt)||[ni,ri].indexOf(a)!==-1&&h===Zt||a===Zt&&[Zt,vr,Cr].indexOf(h)!==-1)return Ze;if([Zt,vr,Cr,vn,ii].indexOf(h)!==-1)for(var d=n;d>=0;){var m=e[d];if(m===Zt)return Ze;if([vr,Cr].indexOf(m)!==-1)d--;else break}if([oi,si].indexOf(h)!==-1)for(var d=[vn,ii].indexOf(a)!==-1?s:n;d>=0;){var m=e[d];if(m===Zt)return Ze;if([vr,Cr].indexOf(m)!==-1)d--;else break}if(Po===a&&[Po,Tn,Oo,No].indexOf(h)!==-1||[Tn,Oo].indexOf(a)!==-1&&[Tn,xn].indexOf(h)!==-1||[xn,No].indexOf(a)!==-1&&h===xn||Dh.indexOf(a)!==-1&&[Hh,si].indexOf(h)!==-1||Dh.indexOf(h)!==-1&&a===oi||SA.indexOf(a)!==-1&&SA.indexOf(h)!==-1||a===Cr&&SA.indexOf(h)!==-1||SA.concat(Zt).indexOf(a)!==-1&&h===ni&&ow.indexOf(r[o])===-1||SA.concat(Zt).indexOf(h)!==-1&&a===ii)return Ze;if(a===Vo&&h===Vo){for(var T=t[n],v=1;T>0&&(T--,e[T]===Vo);)v++;if(v%2!==0)return Ze}return a===yn&&h===bn?Ze:Qn},uw=function(r,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=cw(r,e.lineBreak),A=t[0],i=t[1],n=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(o){return[Zt,sr,Lh].indexOf(o)!==-1?ai:o}));var s=e.wordBreak==="keep-all"?n.map(function(o,a){return o&&r[a]>=19968&&r[a]<=40959}):void 0;return[A,i,s]},dw=(function(){function r(e,t,A,i){this.codePoints=e,this.required=t===Mh,this.start=A,this.end=i}return r.prototype.slice=function(){return ft.apply(void 0,this.codePoints.slice(this.start,this.end))},r})(),pw=function(r,e){var t=gn(r),A=uw(t,e),i=A[0],n=A[1],s=A[2],o=t.length,a=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var h=Ze;c<o&&(h=hw(t,n,i,++c,s))===Ze;);if(h!==Ze||c===o){var d=new dw(t,h,a,c);return a=c,{value:d,done:!1}}return{done:!0,value:null}}}},fw=1,mw=2,li=4,Oh=8,Fn=10,Nh=47,ci=92,gw=9,ww=32,Un=34,hi=61,Bw=35,Cw=36,vw=37,En=39,Sn=40,ui=41,yw=95,Wt=45,bw=33,Tw=60,xw=62,Qw=64,Fw=91,Uw=93,Ew=61,Sw=123,Hn=63,Hw=125,Kh=124,Lw=126,Mw=128,Ph=65533,Ro=42,or=43,Iw=44,_w=58,Dw=59,di=46,kw=0,Ow=8,Nw=11,Kw=14,Pw=31,Vw=127,CA=-1,Vh=48,zh=97,Wh=101,zw=102,Ww=117,Gw=122,Gh=65,Rh=69,$h=70,Rw=85,$w=90,It=function(r){return r>=Vh&&r<=57},Xw=function(r){return r>=55296&&r<=57343},yr=function(r){return It(r)||r>=Gh&&r<=$h||r>=zh&&r<=zw},Zw=function(r){return r>=zh&&r<=Gw},Jw=function(r){return r>=Gh&&r<=$w},qw=function(r){return Zw(r)||Jw(r)},Yw=function(r){return r>=Mw},Ln=function(r){return r===Fn||r===gw||r===ww},Mn=function(r){return qw(r)||Yw(r)||r===yw},Xh=function(r){return Mn(r)||It(r)||r===Wt},jw=function(r){return r>=kw&&r<=Ow||r===Nw||r>=Kw&&r<=Pw||r===Vw},KA=function(r,e){return r!==ci?!1:e!==Fn},In=function(r,e,t){return r===Wt?Mn(e)||KA(e,t):Mn(r)?!0:!!(r===ci&&KA(r,e))},$o=function(r,e,t){return r===or||r===Wt?It(e)?!0:e===di&&It(t):It(r===di?e:r)},eB=function(r){var e=0,t=1;(r[e]===or||r[e]===Wt)&&(r[e]===Wt&&(t=-1),e++);for(var A=[];It(r[e]);)A.push(r[e++]);var i=A.length?parseInt(ft.apply(void 0,A),10):0;r[e]===di&&e++;for(var n=[];It(r[e]);)n.push(r[e++]);var s=n.length,o=s?parseInt(ft.apply(void 0,n),10):0;(r[e]===Rh||r[e]===Wh)&&e++;var a=1;(r[e]===or||r[e]===Wt)&&(r[e]===Wt&&(a=-1),e++);for(var c=[];It(r[e]);)c.push(r[e++]);var h=c.length?parseInt(ft.apply(void 0,c),10):0;return t*(i+o*Math.pow(10,-s))*Math.pow(10,a*h)},tB={type:2},AB={type:3},rB={type:4},iB={type:13},nB={type:8},sB={type:21},oB={type:9},aB={type:10},lB={type:11},cB={type:12},hB={type:14},_n={type:23},uB={type:1},dB={type:25},pB={type:24},fB={type:26},mB={type:27},gB={type:28},wB={type:29},BB={type:31},Xo={type:32},Zh=(function(){function r(){this._value=[]}return r.prototype.write=function(e){this._value=this._value.concat(gn(e))},r.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Xo;)e.push(t),t=this.consumeToken();return e},r.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Un:return this.consumeStringToken(Un);case Bw:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Xh(t)||KA(A,i)){var n=In(t,A,i)?mw:fw,s=this.consumeName();return{type:5,value:s,flags:n}}break;case Cw:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),iB;break;case En:return this.consumeStringToken(En);case Sn:return tB;case ui:return AB;case Ro:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),hB;break;case or:if($o(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Iw:return rB;case Wt:var o=e,a=this.peekCodePoint(0),c=this.peekCodePoint(1);if($o(o,a,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(In(o,a,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(a===Wt&&c===xw)return this.consumeCodePoint(),this.consumeCodePoint(),pB;break;case di:if($o(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Nh:if(this.peekCodePoint(0)===Ro)for(this.consumeCodePoint();;){var h=this.consumeCodePoint();if(h===Ro&&(h=this.consumeCodePoint(),h===Nh))return this.consumeToken();if(h===CA)return this.consumeToken()}break;case _w:return fB;case Dw:return mB;case Tw:if(this.peekCodePoint(0)===bw&&this.peekCodePoint(1)===Wt&&this.peekCodePoint(2)===Wt)return this.consumeCodePoint(),this.consumeCodePoint(),dB;break;case Qw:var d=this.peekCodePoint(0),m=this.peekCodePoint(1),T=this.peekCodePoint(2);if(In(d,m,T)){var s=this.consumeName();return{type:7,value:s}}break;case Fw:return gB;case ci:if(KA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Uw:return wB;case Ew:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),nB;break;case Sw:return lB;case Hw:return cB;case Ww:case Rw:var v=this.peekCodePoint(0),B=this.peekCodePoint(1);return v===or&&(yr(B)||B===Hn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Kh:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),oB;if(this.peekCodePoint(0)===Kh)return this.consumeCodePoint(),sB;break;case Lw:if(this.peekCodePoint(0)===hi)return this.consumeCodePoint(),aB;break;case CA:return Xo}return Ln(e)?(this.consumeWhiteSpace(),BB):It(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Mn(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:ft(e)}},r.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},r.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},r.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},r.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();yr(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;t===Hn&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A){var i=parseInt(ft.apply(void 0,e.map(function(a){return a===Hn?Vh:a})),16),n=parseInt(ft.apply(void 0,e.map(function(a){return a===Hn?$h:a})),16);return{type:30,start:i,end:n}}var s=parseInt(ft.apply(void 0,e),16);if(this.peekCodePoint(0)===Wt&&yr(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var o=[];yr(t)&&o.length<6;)o.push(t),t=this.consumeCodePoint();var n=parseInt(ft.apply(void 0,o),16);return{type:30,start:s,end:n}}else return{type:30,start:s,end:s}},r.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Sn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Sn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},r.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===CA)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===En||t===Un){var A=this.consumeStringToken(this.consumeCodePoint());return A.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===CA||this.peekCodePoint(0)===ui)?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),_n)}for(;;){var i=this.consumeCodePoint();if(i===CA||i===ui)return{type:22,value:ft.apply(void 0,e)};if(Ln(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===CA||this.peekCodePoint(0)===ui?(this.consumeCodePoint(),{type:22,value:ft.apply(void 0,e)}):(this.consumeBadUrlRemnants(),_n);if(i===Un||i===En||i===Sn||jw(i))return this.consumeBadUrlRemnants(),_n;if(i===ci)if(KA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),_n;else e.push(i)}},r.prototype.consumeWhiteSpace=function(){for(;Ln(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ui||e===CA)return;KA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(e){for(var t=5e4,A="";e>0;){var i=Math.min(t,e);A+=ft.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),A},r.prototype.consumeStringToken=function(e){var t="",A=0;do{var i=this._value[A];if(i===CA||i===void 0||i===e)return t+=this.consumeStringSlice(A),{type:0,value:t};if(i===Fn)return this._value.splice(0,A),uB;if(i===ci){var n=this._value[A+1];n!==CA&&n!==void 0&&(n===Fn?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):KA(i,n)&&(t+=this.consumeStringSlice(A),t+=ft(this.consumeEscapedCodePoint()),A=-1))}A++}while(!0)},r.prototype.consumeNumber=function(){var e=[],t=li,A=this.peekCodePoint(0);for((A===or||A===Wt)&&e.push(this.consumeCodePoint());It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(A===di&&It(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Oh;It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),i=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((A===Rh||A===Wh)&&((i===or||i===Wt)&&It(n)||It(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=Oh;It(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[eB(e),t]},r.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],i=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);if(In(i,n,s)){var o=this.consumeName();return{type:15,number:t,flags:A,unit:o}}return i===vw?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},r.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(yr(e)){for(var t=ft(e);yr(this.peekCodePoint(0))&&t.length<6;)t+=ft(this.consumeCodePoint());Ln(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return A===0||Xw(A)||A>1114111?Ph:A}return e===CA?Ph:e},r.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(Xh(t))e+=ft(t);else if(KA(t,this.peekCodePoint(0)))e+=ft(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},r})(),Jh=(function(){function r(e){this._tokens=e}return r.create=function(e){var t=new Zh;return t.write(e),new r(t.read())},r.parseValue=function(e){return r.create(e).parseComponentValue()},r.parseValues=function(e){return r.create(e).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var 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")},r.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},r.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},r.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(A.type===32||vB(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},r.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())}},r.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?Xo:e},r.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},r})(),pi=function(r){return r.type===15},br=function(r){return r.type===17},rt=function(r){return r.type===20},CB=function(r){return r.type===0},Zo=function(r,e){return rt(r)&&r.value===e},qh=function(r){return r.type!==31},Tr=function(r){return r.type!==31&&r.type!==4},vA=function(r){var e=[],t=[];return r.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},vB=function(r,e){return e===11&&r.type===12||e===28&&r.type===29?!0:e===2&&r.type===3},PA=function(r){return r.type===17||r.type===15},Bt=function(r){return r.type===16||PA(r)},Yh=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},Ft={type:17,number:0,flags:li},Jo={type:16,number:50,flags:li},VA={type:16,number:100,flags:li},fi=function(r,e,t){var A=r[0],i=r[1];return[st(A,e),st(typeof i<"u"?i:A,t)]},st=function(r,e){if(r.type===16)return r.number/100*e;if(pi(r))switch(r.unit){case"rem":case"em":return 16*r.number;default:return r.number}return r.number},jh="deg",eu="grad",tu="rad",Au="turn",Dn={name:"angle",parse:function(r,e){if(e.type===15)switch(e.unit){case jh:return Math.PI*e.number/180;case eu:return Math.PI/200*e.number;case tu:return e.number;case Au:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},ru=function(r){return r.type===15&&(r.unit===jh||r.unit===eu||r.unit===tu||r.unit===Au)},iu=function(r){var e=r.filter(rt).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Ft,Ft];case"to top":case"bottom":return iA(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Ft,VA];case"to right":case"left":return iA(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[VA,VA];case"to bottom":case"top":return iA(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[VA,Ft];case"to left":case"right":return iA(270)}return 0},iA=function(r){return Math.PI*r/180},zA={name:"color",parse:function(r,e){if(e.type===18){var t=yB[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(r,e.values)}if(e.type===5){if(e.value.length===3){var A=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3);return GA(parseInt(A+A,16),parseInt(i+i,16),parseInt(n+n,16),1)}if(e.value.length===4){var A=e.value.substring(0,1),i=e.value.substring(1,2),n=e.value.substring(2,3),s=e.value.substring(3,4);return GA(parseInt(A+A,16),parseInt(i+i,16),parseInt(n+n,16),parseInt(s+s,16)/255)}if(e.value.length===6){var A=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6);return GA(parseInt(A,16),parseInt(i,16),parseInt(n,16),1)}if(e.value.length===8){var A=e.value.substring(0,2),i=e.value.substring(2,4),n=e.value.substring(4,6),s=e.value.substring(6,8);return GA(parseInt(A,16),parseInt(i,16),parseInt(n,16),parseInt(s,16)/255)}}if(e.type===20){var o=HA[e.value.toUpperCase()];if(typeof o<"u")return o}return HA.TRANSPARENT}},WA=function(r){return(255&r)===0},yt=function(r){var e=255&r,t=255&r>>8,A=255&r>>16,i=255&r>>24;return e<255?"rgba("+i+","+A+","+t+","+e/255+")":"rgb("+i+","+A+","+t+")"},GA=function(r,e,t,A){return(r<<24|e<<16|t<<8|Math.round(A*255)<<0)>>>0},nu=function(r,e){if(r.type===17)return r.number;if(r.type===16){var t=e===3?1:255;return e===3?r.number/100*t:Math.round(r.number/100*t)}return 0},su=function(r,e){var t=e.filter(Tr);if(t.length===3){var A=t.map(nu),i=A[0],n=A[1],s=A[2];return GA(i,n,s,1)}if(t.length===4){var o=t.map(nu),i=o[0],n=o[1],s=o[2],a=o[3];return GA(i,n,s,a)}return 0};function qo(r,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-r)*t*6+r:t<1/2?e:t<2/3?(e-r)*6*(2/3-t)+r:r}var ou=function(r,e){var t=e.filter(Tr),A=t[0],i=t[1],n=t[2],s=t[3],o=(A.type===17?iA(A.number):Dn.parse(r,A))/(Math.PI*2),a=Bt(i)?i.number/100:0,c=Bt(n)?n.number/100:0,h=typeof s<"u"&&Bt(s)?st(s,1):1;if(a===0)return GA(c*255,c*255,c*255,1);var d=c<=.5?c*(a+1):c+a-c*a,m=c*2-d,T=qo(m,d,o+1/3),v=qo(m,d,o),B=qo(m,d,o-1/3);return GA(T*255,v*255,B*255,h)},yB={hsl:ou,hsla:ou,rgb:su,rgba:su},mi=function(r,e){return zA.parse(r,Jh.create(e).parseComponentValue())},HA={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},bB={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(t){if(rt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},TB={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},kn=function(r,e){var t=zA.parse(r,e[0]),A=e[1];return A&&Bt(A)?{color:t,stop:A}:{color:t,stop:null}},au=function(r,e){var t=r[0],A=r[r.length-1];t.stop===null&&(t.stop=Ft),A.stop===null&&(A.stop=VA);for(var i=[],n=0,s=0;s<r.length;s++){var o=r[s].stop;if(o!==null){var a=st(o,e);a>n?i.push(a):i.push(n),n=a}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var h=i[s];if(h===null)c===null&&(c=s);else if(c!==null){for(var d=s-c,m=i[c-1],T=(h-m)/(d+1),v=1;v<=d;v++)i[c+v-1]=T*v;c=null}}return r.map(function(B,y){var D=B.color;return{color:D,stop:Math.max(Math.min(1,i[y]/e),0)}})},xB=function(r,e,t){var A=e/2,i=t/2,n=st(r[0],e)-A,s=i-st(r[1],t);return(Math.atan2(s,n)+Math.PI*2)%(Math.PI*2)},QB=function(r,e,t){var A=typeof r=="number"?r:xB(r,e,t),i=Math.abs(e*Math.sin(A))+Math.abs(t*Math.cos(A)),n=e/2,s=t/2,o=i/2,a=Math.sin(A-Math.PI/2)*o,c=Math.cos(A-Math.PI/2)*o;return[i,n-c,n+c,s-a,s+a]},dA=function(r,e){return Math.sqrt(r*r+e*e)},lu=function(r,e,t,A,i){var n=[[0,0],[0,e],[r,0],[r,e]];return n.reduce(function(s,o){var a=o[0],c=o[1],h=dA(t-a,A-c);return(i?h<s.optimumDistance:h>s.optimumDistance)?{optimumCorner:o,optimumDistance:h}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},FB=function(r,e,t,A,i){var n=0,s=0;switch(r.size){case 0:r.shape===0?n=s=Math.min(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-i)):r.shape===1&&(n=Math.min(Math.abs(e),Math.abs(e-A)),s=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(r.shape===0)n=s=Math.min(dA(e,t),dA(e,t-i),dA(e-A,t),dA(e-A,t-i));else if(r.shape===1){var o=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-A)),a=lu(A,i,e,t,!0),c=a[0],h=a[1];n=dA(c-e,(h-t)/o),s=o*n}break;case 1:r.shape===0?n=s=Math.max(Math.abs(e),Math.abs(e-A),Math.abs(t),Math.abs(t-i)):r.shape===1&&(n=Math.max(Math.abs(e),Math.abs(e-A)),s=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(r.shape===0)n=s=Math.max(dA(e,t),dA(e,t-i),dA(e-A,t),dA(e-A,t-i));else if(r.shape===1){var o=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-A)),d=lu(A,i,e,t,!1),c=d[0],h=d[1];n=dA(c-e,(h-t)/o),s=o*n}break}return Array.isArray(r.size)&&(n=st(r.size[0],A),s=r.size.length===2?st(r.size[1],i):n),[n,s]},UB=function(r,e){var t=iA(180),A=[];return vA(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&s.value==="to"){t=iu(i);return}else if(ru(s)){t=Dn.parse(r,s);return}}var o=kn(r,i);A.push(o)}),{angle:t,stops:A,type:1}},On=function(r,e){var t=iA(180),A=[];return vA(e).forEach(function(i,n){if(n===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){t=iu(i);return}else if(ru(s)){t=(Dn.parse(r,s)+iA(270))%iA(360);return}}var o=kn(r,i);A.push(o)}),{angle:t,stops:A,type:1}},EB=function(r,e){var t=iA(180),A=[],i=1,n=0,s=3,o=[];return vA(e).forEach(function(a,c){var h=a[0];if(c===0){if(rt(h)&&h.value==="linear"){i=1;return}else if(rt(h)&&h.value==="radial"){i=2;return}}if(h.type===18){if(h.name==="from"){var d=zA.parse(r,h.values[0]);A.push({stop:Ft,color:d})}else if(h.name==="to"){var d=zA.parse(r,h.values[0]);A.push({stop:VA,color:d})}else if(h.name==="color-stop"){var m=h.values.filter(Tr);if(m.length===2){var d=zA.parse(r,m[1]),T=m[0];br(T)&&A.push({stop:{type:16,number:T.number*100,flags:T.flags},color:d})}}}}),i===1?{angle:(t+iA(180))%iA(360),stops:A,type:i}:{size:s,shape:n,stops:A,position:o,type:i}},cu="closest-side",hu="farthest-side",uu="closest-corner",du="farthest-corner",pu="circle",fu="ellipse",mu="cover",gu="contain",SB=function(r,e){var t=0,A=3,i=[],n=[];return vA(e).forEach(function(s,o){var a=!0;if(o===0){var c=!1;a=s.reduce(function(d,m){if(c)if(rt(m))switch(m.value){case"center":return n.push(Jo),d;case"top":case"left":return n.push(Ft),d;case"right":case"bottom":return n.push(VA),d}else(Bt(m)||PA(m))&&n.push(m);else if(rt(m))switch(m.value){case pu:return t=0,!1;case fu:return t=1,!1;case"at":return c=!0,!1;case cu:return A=0,!1;case mu:case hu:return A=1,!1;case gu:case uu:return A=2,!1;case du:return A=3,!1}else if(PA(m)||Bt(m))return Array.isArray(A)||(A=[]),A.push(m),!1;return d},a)}if(a){var h=kn(r,s);i.push(h)}}),{size:A,shape:t,stops:i,position:n,type:2}},Nn=function(r,e){var t=0,A=3,i=[],n=[];return vA(e).forEach(function(s,o){var a=!0;if(o===0?a=s.reduce(function(h,d){if(rt(d))switch(d.value){case"center":return n.push(Jo),!1;case"top":case"left":return n.push(Ft),!1;case"right":case"bottom":return n.push(VA),!1}else if(Bt(d)||PA(d))return n.push(d),!1;return h},a):o===1&&(a=s.reduce(function(h,d){if(rt(d))switch(d.value){case pu:return t=0,!1;case fu:return t=1,!1;case gu:case cu:return A=0,!1;case hu:return A=1,!1;case uu:return A=2,!1;case mu:case du:return A=3,!1}else if(PA(d)||Bt(d))return Array.isArray(A)||(A=[]),A.push(d),!1;return h},a)),a){var c=kn(r,s);i.push(c)}}),{size:A,shape:t,stops:i,position:n,type:2}},HB=function(r){return r.type===1},LB=function(r){return r.type===2},Yo={name:"image",parse:function(r,e){if(e.type===22){var t={url:e.value,type:0};return r.cache.addImage(e.value),t}if(e.type===18){var A=wu[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return A(r,e.values)}throw new Error("Unsupported image type "+e.type)}};function MB(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!wu[r.name])}var wu={"linear-gradient":UB,"-moz-linear-gradient":On,"-ms-linear-gradient":On,"-o-linear-gradient":On,"-webkit-linear-gradient":On,"radial-gradient":SB,"-moz-radial-gradient":Nn,"-ms-radial-gradient":Nn,"-o-radial-gradient":Nn,"-webkit-radial-gradient":Nn,"-webkit-gradient":EB},IB={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(A){return Tr(A)&&MB(A)}).map(function(A){return Yo.parse(r,A)})}},_B={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,e){return e.map(function(t){if(rt(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},DB={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,e){return vA(e).map(function(t){return t.filter(Bt)}).map(Yh)}},kB={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,e){return vA(e).map(function(t){return t.filter(rt).map(function(A){return A.value}).join(" ")}).map(OB)}},OB=function(r){switch(r){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}},xr;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(xr||(xr={}));var NB={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,e){return vA(e).map(function(t){return t.filter(KB)})}},KB=function(r){return rt(r)||Bt(r)},Kn=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},PB=Kn("top"),VB=Kn("right"),zB=Kn("bottom"),WB=Kn("left"),Pn=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return Yh(t.filter(Bt))}}},GB=Pn("top-left"),RB=Pn("top-right"),$B=Pn("bottom-right"),XB=Pn("bottom-left"),Vn=function(r){return{name:"border-"+r+"-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}}},ZB=Vn("top"),JB=Vn("right"),qB=Vn("bottom"),YB=Vn("left"),zn=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return pi(t)?t.number:0}}},jB=zn("top"),e2=zn("right"),t2=zn("bottom"),A2=zn("left"),r2={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},i2={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,e){return e==="rtl"?1:0}},n2={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).reduce(function(t,A){return t|s2(A.value)},0)}},s2=function(r){switch(r){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},o2={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},a2={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Wn;(function(r){r.NORMAL="normal",r.STRICT="strict"})(Wn||(Wn={}));var l2={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="strict"?Wn.STRICT:Wn.NORMAL}},c2={name:"line-height",initialValue:"normal",prefix:!1,type:4},Bu=function(r,e){return rt(r)&&r.value==="normal"?1.2*e:r.type===17?e*r.number:Bt(r)?st(r,e):e},h2={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,e){return e.type===20&&e.value==="none"?null:Yo.parse(r,e)}},u2={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,e){return e==="inside"?0:1}},jo={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},Gn=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},d2=Gn("top"),p2=Gn("right"),f2=Gn("bottom"),m2=Gn("left"),g2={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).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}})}},w2={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){return e==="break-word"?"break-word":"normal"}},Rn=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},B2=Rn("top"),C2=Rn("right"),v2=Rn("bottom"),y2=Rn("left"),b2={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},T2={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},x2={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Zo(e[0],"none")?[]:vA(e).map(function(t){for(var A={color:HA.TRANSPARENT,offsetX:Ft,offsetY:Ft,blur:Ft},i=0,n=0;n<t.length;n++){var s=t[n];PA(s)?(i===0?A.offsetX=s:i===1?A.offsetY=s:A.blur=s,i++):A.color=zA.parse(r,s)}return A})}},Q2={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},F2={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var t=S2[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},U2=function(r){var e=r.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},E2=function(r){var e=r.filter(function(a){return a.type===17}).map(function(a){return a.number}),t=e[0],A=e[1];e[2],e[3];var i=e[4],n=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],o=e[13];return e[14],e[15],e.length===16?[t,A,i,n,s,o]:null},S2={matrix:U2,matrix3d:E2},Cu={type:16,number:50,flags:li},H2=[Cu,Cu],L2={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,e){var t=e.filter(Bt);return t.length!==2?H2:[t[0],t[1]]}},M2={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}},gi;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(gi||(gi={}));for(var I2={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"break-all":return gi.BREAK_ALL;case"keep-all":return gi.KEEP_ALL;default:return gi.NORMAL}}},_2={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,e){if(e.type===20)return{auto:!0,order:0};if(br(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},vu={name:"time",parse:function(r,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},D2={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,e){return br(e)?e.number:1}},k2={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},O2={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,e){return e.filter(rt).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})}},N2={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,e){var t=[],A=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:A.push(t.join(" ")),t.length=0;break}}),t.length&&A.push(t.join(" ")),A.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},K2={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},P2={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,e){return br(e)?e.number:rt(e)&&e.value==="bold"?700:400}},V2={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.filter(rt).map(function(t){return t.value})}},z2={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},vt=function(r,e){return(r&e)!==0},W2={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e}},G2={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;for(var A=[],i=e.filter(qh),n=0;n<i.length;n++){var s=i[n],o=i[n+1];if(s.type===20){var a=o&&br(o)?o.number:1;A.push({counter:s.value,increment:a})}}return A}},R2={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return[];for(var t=[],A=e.filter(qh),i=0;i<A.length;i++){var n=A[i],s=A[i+1];if(rt(n)&&n.value!=="none"){var o=s&&br(s)?s.number:0;t.push({counter:n.value,reset:o})}}return t}},$2={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,e){return e.filter(pi).map(function(t){return vu.parse(r,t)})}},X2={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,e){if(e.length===0)return null;var t=e[0];if(t.type===20&&t.value==="none")return null;var A=[],i=e.filter(CB);if(i.length%2!==0)return null;for(var n=0;n<i.length;n+=2){var s=i[n].value,o=i[n+1].value;A.push({open:s,close:o})}return A}},yu=function(r,e,t){if(!r)return"";var A=r[Math.min(e,r.length-1)];return A?t?A.open:A.close:""},Z2={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,e){return e.length===1&&Zo(e[0],"none")?[]:vA(e).map(function(t){for(var A={color:255,offsetX:Ft,offsetY:Ft,blur:Ft,spread:Ft,inset:!1},i=0,n=0;n<t.length;n++){var s=t[n];Zo(s,"inset")?A.inset=!0:PA(s)?(i===0?A.offsetX=s:i===1?A.offsetY=s:i===2?A.blur=s:A.spread=s,i++):A.color=zA.parse(r,s)}return A})}},J2={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,e){var t=[0,1,2],A=[];return e.filter(rt).forEach(function(i){switch(i.value){case"stroke":A.push(1);break;case"fill":A.push(0);break;case"markers":A.push(2);break}}),t.forEach(function(i){A.indexOf(i)===-1&&A.push(i)}),A}},q2={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Y2={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,e){return pi(e)?e.number:0}},j2=(function(){function r(e,t){var A,i;this.animationDuration=Ee(e,$2,t.animationDuration),this.backgroundClip=Ee(e,bB,t.backgroundClip),this.backgroundColor=Ee(e,TB,t.backgroundColor),this.backgroundImage=Ee(e,IB,t.backgroundImage),this.backgroundOrigin=Ee(e,_B,t.backgroundOrigin),this.backgroundPosition=Ee(e,DB,t.backgroundPosition),this.backgroundRepeat=Ee(e,kB,t.backgroundRepeat),this.backgroundSize=Ee(e,NB,t.backgroundSize),this.borderTopColor=Ee(e,PB,t.borderTopColor),this.borderRightColor=Ee(e,VB,t.borderRightColor),this.borderBottomColor=Ee(e,zB,t.borderBottomColor),this.borderLeftColor=Ee(e,WB,t.borderLeftColor),this.borderTopLeftRadius=Ee(e,GB,t.borderTopLeftRadius),this.borderTopRightRadius=Ee(e,RB,t.borderTopRightRadius),this.borderBottomRightRadius=Ee(e,$B,t.borderBottomRightRadius),this.borderBottomLeftRadius=Ee(e,XB,t.borderBottomLeftRadius),this.borderTopStyle=Ee(e,ZB,t.borderTopStyle),this.borderRightStyle=Ee(e,JB,t.borderRightStyle),this.borderBottomStyle=Ee(e,qB,t.borderBottomStyle),this.borderLeftStyle=Ee(e,YB,t.borderLeftStyle),this.borderTopWidth=Ee(e,jB,t.borderTopWidth),this.borderRightWidth=Ee(e,e2,t.borderRightWidth),this.borderBottomWidth=Ee(e,t2,t.borderBottomWidth),this.borderLeftWidth=Ee(e,A2,t.borderLeftWidth),this.boxShadow=Ee(e,Z2,t.boxShadow),this.color=Ee(e,r2,t.color),this.direction=Ee(e,i2,t.direction),this.display=Ee(e,n2,t.display),this.float=Ee(e,o2,t.cssFloat),this.fontFamily=Ee(e,N2,t.fontFamily),this.fontSize=Ee(e,K2,t.fontSize),this.fontStyle=Ee(e,z2,t.fontStyle),this.fontVariant=Ee(e,V2,t.fontVariant),this.fontWeight=Ee(e,P2,t.fontWeight),this.letterSpacing=Ee(e,a2,t.letterSpacing),this.lineBreak=Ee(e,l2,t.lineBreak),this.lineHeight=Ee(e,c2,t.lineHeight),this.listStyleImage=Ee(e,h2,t.listStyleImage),this.listStylePosition=Ee(e,u2,t.listStylePosition),this.listStyleType=Ee(e,jo,t.listStyleType),this.marginTop=Ee(e,d2,t.marginTop),this.marginRight=Ee(e,p2,t.marginRight),this.marginBottom=Ee(e,f2,t.marginBottom),this.marginLeft=Ee(e,m2,t.marginLeft),this.opacity=Ee(e,D2,t.opacity);var n=Ee(e,g2,t.overflow);this.overflowX=n[0],this.overflowY=n[n.length>1?1:0],this.overflowWrap=Ee(e,w2,t.overflowWrap),this.paddingTop=Ee(e,B2,t.paddingTop),this.paddingRight=Ee(e,C2,t.paddingRight),this.paddingBottom=Ee(e,v2,t.paddingBottom),this.paddingLeft=Ee(e,y2,t.paddingLeft),this.paintOrder=Ee(e,J2,t.paintOrder),this.position=Ee(e,T2,t.position),this.textAlign=Ee(e,b2,t.textAlign),this.textDecorationColor=Ee(e,k2,(A=t.textDecorationColor)!==null&&A!==void 0?A:t.color),this.textDecorationLine=Ee(e,O2,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Ee(e,x2,t.textShadow),this.textTransform=Ee(e,Q2,t.textTransform),this.transform=Ee(e,F2,t.transform),this.transformOrigin=Ee(e,L2,t.transformOrigin),this.visibility=Ee(e,M2,t.visibility),this.webkitTextStrokeColor=Ee(e,q2,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Ee(e,Y2,t.webkitTextStrokeWidth),this.wordBreak=Ee(e,I2,t.wordBreak),this.zIndex=Ee(e,_2,t.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return WA(this.backgroundColor)},r.prototype.isTransformed=function(){return this.transform!==null},r.prototype.isPositioned=function(){return this.position!==0},r.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},r.prototype.isFloating=function(){return this.float!==0},r.prototype.isInlineLevel=function(){return vt(this.display,4)||vt(this.display,33554432)||vt(this.display,268435456)||vt(this.display,536870912)||vt(this.display,67108864)||vt(this.display,134217728)},r})(),eC=(function(){function r(e,t){this.content=Ee(e,W2,t.content),this.quotes=Ee(e,X2,t.quotes)}return r})(),bu=(function(){function r(e,t){this.counterIncrement=Ee(e,G2,t.counterIncrement),this.counterReset=Ee(e,R2,t.counterReset)}return r})(),Ee=function(r,e,t){var A=new Zh,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;A.write(i);var n=new Jh(A.read());switch(e.type){case 2:var s=n.parseComponentValue();return e.parse(r,rt(s)?s.value:e.initialValue);case 0:return e.parse(r,n.parseComponentValue());case 1:return e.parse(r,n.parseComponentValues());case 4:return n.parseComponentValue();case 3:switch(e.format){case"angle":return Dn.parse(r,n.parseComponentValue());case"color":return zA.parse(r,n.parseComponentValue());case"image":return Yo.parse(r,n.parseComponentValue());case"length":var o=n.parseComponentValue();return PA(o)?o:Ft;case"length-percentage":var a=n.parseComponentValue();return Bt(a)?a:Ft;case"time":return vu.parse(r,n.parseComponentValue())}break}},tC="data-html2canvas-debug",AC=function(r){var e=r.getAttribute(tC);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},ea=function(r,e){var t=AC(r);return t===1||e===t},yA=(function(){function r(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,ea(t,3))debugger;this.styles=new j2(e,window.getComputedStyle(t,null)),pa(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),ea(t,4)&&(this.flags|=16)}return r})(),rC="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Tu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wi=typeof Uint8Array>"u"?[]:new Uint8Array(256),$n=0;$n<Tu.length;$n++)wi[Tu.charCodeAt($n)]=$n;for(var iC=function(r){var e=r.length*.75,t=r.length,A,i=0,n,s,o,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),h=Array.isArray(c)?c:new Uint8Array(c);for(A=0;A<t;A+=4)n=wi[r.charCodeAt(A)],s=wi[r.charCodeAt(A+1)],o=wi[r.charCodeAt(A+2)],a=wi[r.charCodeAt(A+3)],h[i++]=n<<2|s>>4,h[i++]=(s&15)<<4|o>>2,h[i++]=(o&3)<<6|a&63;return c},nC=function(r){for(var e=r.length,t=[],A=0;A<e;A+=2)t.push(r[A+1]<<8|r[A]);return t},sC=function(r){for(var e=r.length,t=[],A=0;A<e;A+=4)t.push(r[A+3]<<24|r[A+2]<<16|r[A+1]<<8|r[A]);return t},ar=5,ta=11,Aa=2,oC=ta-ar,xu=65536>>ar,aC=1<<ar,ra=aC-1,lC=1024>>ar,cC=xu+lC,hC=cC,uC=32,dC=hC+uC,pC=65536>>ta,fC=1<<oC,mC=fC-1,Qu=function(r,e,t){return r.slice?r.slice(e,t):new Uint16Array(Array.prototype.slice.call(r,e,t))},gC=function(r,e,t){return r.slice?r.slice(e,t):new Uint32Array(Array.prototype.slice.call(r,e,t))},wC=function(r,e){var t=iC(r),A=Array.isArray(t)?sC(t):new Uint32Array(t),i=Array.isArray(t)?nC(t):new Uint16Array(t),n=24,s=Qu(i,n/2,A[4]/2),o=A[5]===2?Qu(i,(n+A[4])/2):gC(A,Math.ceil((n+A[4])/4));return new BC(A[0],A[1],A[2],A[3],s,o)},BC=(function(){function r(e,t,A,i,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=i,this.index=n,this.data=s}return r.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>ar],t=(t<<Aa)+(e&ra),this.data[t];if(e<=65535)return t=this.index[xu+(e-55296>>ar)],t=(t<<Aa)+(e&ra),this.data[t];if(e<this.highStart)return t=dC-pC+(e>>ta),t=this.index[t],t+=e>>ar&mC,t=this.index[t],t=(t<<Aa)+(e&ra),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r})(),Fu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",CC=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xn=0;Xn<Fu.length;Xn++)CC[Fu.charCodeAt(Xn)]=Xn;var vC=1,ia=2,na=3,Uu=4,Eu=5,yC=7,Su=8,sa=9,oa=10,Hu=11,Lu=12,Mu=13,Iu=14,aa=15,bC=function(r){for(var e=[],t=0,A=r.length;t<A;){var i=r.charCodeAt(t++);if(i>=55296&&i<=56319&&t<A){var n=r.charCodeAt(t++);(n&64512)===56320?e.push(((i&1023)<<10)+(n&1023)+65536):(e.push(i),t--)}else e.push(i)}return e},TC=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var t=r.length;if(!t)return"";for(var A=[],i=-1,n="";++i<t;){var s=r[i];s<=65535?A.push(s):(s-=65536,A.push((s>>10)+55296,s%1024+56320)),(i+1===t||A.length>16384)&&(n+=String.fromCharCode.apply(String,A),A.length=0)}return n},xC=wC(rC),nA="×",la="÷",QC=function(r){return xC.get(r)},FC=function(r,e,t){var A=t-2,i=e[A],n=e[t-1],s=e[t];if(n===ia&&s===na)return nA;if(n===ia||n===na||n===Uu||s===ia||s===na||s===Uu)return la;if(n===Su&&[Su,sa,Hu,Lu].indexOf(s)!==-1||(n===Hu||n===sa)&&(s===sa||s===oa)||(n===Lu||n===oa)&&s===oa||s===Mu||s===Eu||s===yC||n===vC)return nA;if(n===Mu&&s===Iu){for(;i===Eu;)i=e[--A];if(i===Iu)return nA}if(n===aa&&s===aa){for(var o=0;i===aa;)o++,i=e[--A];if(o%2===0)return nA}return la},UC=function(r){var e=bC(r),t=e.length,A=0,i=0,n=e.map(QC);return{next:function(){if(A>=t)return{done:!0,value:null};for(var s=nA;A<t&&(s=FC(e,n,++A))===nA;);if(s!==nA||A===t){var o=TC.apply(null,e.slice(i,A));return i=A,{value:o,done:!1}}return{done:!0,value:null}}}},EC=function(r){for(var e=UC(r),t=[],A;!(A=e.next()).done;)A.value&&t.push(A.value.slice());return t},SC=function(r){var e=123;if(r.createRange){var t=r.createRange();if(t.getBoundingClientRect){var A=r.createElement("boundtest");A.style.height=e+"px",A.style.display="block",r.body.appendChild(A),t.selectNode(A);var i=t.getBoundingClientRect(),n=Math.round(i.height);if(r.body.removeChild(A),n===e)return!0}}return!1},HC=function(r){var e=r.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",r.body.appendChild(e);var t=r.createRange();e.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var A=e.firstChild,i=gn(A.data).map(function(a){return ft(a)}),n=0,s={},o=i.every(function(a,c){t.setStart(A,n),t.setEnd(A,n+a.length);var h=t.getBoundingClientRect();n+=a.length;var d=h.x>s.x||h.y>s.y;return s=h,c===0?!0:d});return r.body.removeChild(e),o},LC=function(){return typeof new Image().crossOrigin<"u"},MC=function(){return typeof new XMLHttpRequest().responseType=="string"},IC=function(r){var e=new Image,t=r.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},_u=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},_C=function(r){var e=r.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 i=new Image,n=e.toDataURL();i.src=n;var s=ca(t,t,0,0,i);return A.fillStyle="red",A.fillRect(0,0,t,t),Du(s).then(function(o){A.drawImage(o,0,0);var a=A.getImageData(0,0,t,t).data;A.fillStyle="red",A.fillRect(0,0,t,t);var c=r.createElement("div");return c.style.backgroundImage="url("+n+")",c.style.height=t+"px",_u(a)?Du(ca(t,t,0,0,c)):Promise.reject(!1)}).then(function(o){return A.drawImage(o,0,0),_u(A.getImageData(0,0,t,t).data)}).catch(function(){return!1})},ca=function(r,e,t,A,i){var n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),o=document.createElementNS(n,"foreignObject");return s.setAttributeNS(null,"width",r.toString()),s.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",A.toString()),o.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(o),o.appendChild(i),s},Du=function(r){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(r))})},Ut={get SUPPORT_RANGE_BOUNDS(){var r=SC(document);return Object.defineProperty(Ut,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=Ut.SUPPORT_RANGE_BOUNDS&&HC(document);return Object.defineProperty(Ut,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=IC(document);return Object.defineProperty(Ut,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?_C(document):Promise.resolve(!1);return Object.defineProperty(Ut,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=LC();return Object.defineProperty(Ut,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=MC();return Object.defineProperty(Ut,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ut,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ut,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},Bi=(function(){function r(e,t){this.text=e,this.bounds=t}return r})(),DC=function(r,e,t,A){var i=NC(e,t),n=[],s=0;return i.forEach(function(o){if(t.textDecorationLine.length||o.trim().length>0)if(Ut.SUPPORT_RANGE_BOUNDS){var a=ku(A,s,o.length).getClientRects();if(a.length>1){var c=ha(o),h=0;c.forEach(function(m){n.push(new Bi(m,EA.fromDOMRectList(r,ku(A,h+s,m.length).getClientRects()))),h+=m.length})}else n.push(new Bi(o,EA.fromDOMRectList(r,a)))}else{var d=A.splitText(o.length);n.push(new Bi(o,kC(r,A))),A=d}else Ut.SUPPORT_RANGE_BOUNDS||(A=A.splitText(o.length));s+=o.length}),n},kC=function(r,e){var t=e.ownerDocument;if(t){var A=t.createElement("html2canvaswrapper");A.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(A,e);var n=mn(r,A);return A.firstChild&&i.replaceChild(A.firstChild,A),n}}return EA.EMPTY},ku=function(r,e,t){var A=r.ownerDocument;if(!A)throw new Error("Node has no owner document");var i=A.createRange();return i.setStart(r,e),i.setEnd(r,e+t),i},ha=function(r){if(Ut.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(r)).map(function(t){return t.segment})}return EC(r)},OC=function(r,e){if(Ut.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(r)).map(function(A){return A.segment})}return PC(r,e)},NC=function(r,e){return e.letterSpacing!==0?ha(r):OC(r,e)},KC=[32,160,4961,65792,65793,4153,4241],PC=function(r,e){for(var t=pw(r,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),A=[],i,n=function(){if(i.value){var s=i.value.slice(),o=gn(s),a="";o.forEach(function(c){KC.indexOf(c)===-1?a+=ft(c):(a.length&&A.push(a),A.push(ft(c)),a="")}),a.length&&A.push(a)}};!(i=t.next()).done;)n();return A},VC=(function(){function r(e,t,A){this.text=zC(t.data,A.textTransform),this.textBounds=DC(e,this.text,A,t)}return r})(),zC=function(r,e){switch(e){case 1:return r.toLowerCase();case 3:return r.replace(WC,GC);case 2:return r.toUpperCase();default:return r}},WC=/(^|\s|:|-|\(|\))([a-z])/g,GC=function(r,e,t){return r.length>0?e+t.toUpperCase():r},Ou=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.src=A.currentSrc||A.src,i.intrinsicWidth=A.naturalWidth,i.intrinsicHeight=A.naturalHeight,i.context.cache.addImage(i.src),i}return e})(yA),Nu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.canvas=A,i.intrinsicWidth=A.width,i.intrinsicHeight=A.height,i}return e})(yA),Ku=(function(r){uA(e,r);function e(t,A){var i=r.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"),i.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),i.intrinsicWidth=A.width.baseVal.value,i.intrinsicHeight=A.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e})(yA),Pu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.value=A.value,i}return e})(yA),ua=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.start=A.start,i.reversed=typeof A.reversed=="boolean"&&A.reversed===!0,i}return e})(yA),RC=[{type:15,flags:0,unit:"px",number:3}],$C=[{type:16,flags:0,number:50}],XC=function(r){return r.width>r.height?new EA(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new EA(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},ZC=function(r){var e=r.type===JC?new Array(r.value.length+1).join("•"):r.value;return e.length===0?r.placeholder||"":e},Zn="checkbox",Jn="radio",JC="password",Vu=707406591,da=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;switch(i.type=A.type.toLowerCase(),i.checked=A.checked,i.value=ZC(A),(i.type===Zn||i.type===Jn)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=XC(i.bounds)),i.type){case Zn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=RC;break;case Jn:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=$C;break}return i}return e})(yA),zu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this,n=A.options[A.selectedIndex||0];return i.value=n&&n.text||"",i}return e})(yA),Wu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.value=A.value,i}return e})(yA),Gu=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;i.src=A.src,i.width=parseInt(A.width,10)||0,i.height=parseInt(A.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(A.contentWindow&&A.contentWindow.document&&A.contentWindow.document.documentElement){i.tree=$u(t,A.contentWindow.document.documentElement);var n=A.contentWindow.document.documentElement?mi(t,getComputedStyle(A.contentWindow.document.documentElement).backgroundColor):HA.TRANSPARENT,s=A.contentWindow.document.body?mi(t,getComputedStyle(A.contentWindow.document.body).backgroundColor):HA.TRANSPARENT;i.backgroundColor=WA(n)?WA(s)?i.styles.backgroundColor:s:n}}catch{}return i}return e})(yA),qC=["OL","UL","MENU"],qn=function(r,e,t,A){for(var i=e.firstChild,n=void 0;i;i=n)if(n=i.nextSibling,Xu(i)&&i.data.trim().length>0)t.textNodes.push(new VC(r,i,t.styles));else if(Qr(i))if(ed(i)&&i.assignedNodes)i.assignedNodes().forEach(function(o){return qn(r,o,t,A)});else{var s=Ru(r,i);s.styles.isVisible()&&(YC(i,s,A)?s.flags|=4:jC(s.styles)&&(s.flags|=2),qC.indexOf(i.tagName)!==-1&&(s.flags|=8),t.elements.push(s),i.slot,i.shadowRoot?qn(r,i.shadowRoot,s,A):!jn(i)&&!Zu(i)&&!es(i)&&qn(r,i,s,A))}},Ru=function(r,e){return ma(e)?new Ou(r,e):Ju(e)?new Nu(r,e):Zu(e)?new Ku(r,e):ev(e)?new Pu(r,e):tv(e)?new ua(r,e):Av(e)?new da(r,e):es(e)?new zu(r,e):jn(e)?new Wu(r,e):Yu(e)?new Gu(r,e):new yA(r,e)},$u=function(r,e){var t=Ru(r,e);return t.flags|=4,qn(r,e,t,t),t},YC=function(r,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||fa(r)&&t.styles.isTransparent()},jC=function(r){return r.isPositioned()||r.isFloating()},Xu=function(r){return r.nodeType===Node.TEXT_NODE},Qr=function(r){return r.nodeType===Node.ELEMENT_NODE},pa=function(r){return Qr(r)&&typeof r.style<"u"&&!Yn(r)},Yn=function(r){return typeof r.className=="object"},ev=function(r){return r.tagName==="LI"},tv=function(r){return r.tagName==="OL"},Av=function(r){return r.tagName==="INPUT"},rv=function(r){return r.tagName==="HTML"},Zu=function(r){return r.tagName==="svg"},fa=function(r){return r.tagName==="BODY"},Ju=function(r){return r.tagName==="CANVAS"},qu=function(r){return r.tagName==="VIDEO"},ma=function(r){return r.tagName==="IMG"},Yu=function(r){return r.tagName==="IFRAME"},ju=function(r){return r.tagName==="STYLE"},iv=function(r){return r.tagName==="SCRIPT"},jn=function(r){return r.tagName==="TEXTAREA"},es=function(r){return r.tagName==="SELECT"},ed=function(r){return r.tagName==="SLOT"},td=function(r){return r.tagName.indexOf("-")>0},nv=(function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},r.prototype.getCounterValues=function(e){var t=this.counters[e];return t||[]},r.prototype.pop=function(e){var t=this;e.forEach(function(A){return t.counters[A].pop()})},r.prototype.parse=function(e){var t=this,A=e.counterIncrement,i=e.counterReset,n=!0;A!==null&&A.forEach(function(o){var a=t.counters[o.counter];a&&o.increment!==0&&(n=!1,a.length||a.push(1),a[Math.max(0,a.length-1)]+=o.increment)});var s=[];return n&&i.forEach(function(o){var a=t.counters[o.counter];s.push(o.counter),a||(a=t.counters[o.counter]=[]),a.push(o.reset)}),s},r})(),Ad={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"]},rd={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},sv={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},ov={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Fr=function(r,e,t,A,i,n){return r<e||r>t?vi(r,i,n.length>0):A.integers.reduce(function(s,o,a){for(;r>=o;)r-=o,s+=A.values[a];return s},"")+n},id=function(r,e,t,A){var i="";do t||r--,i=A(r)+i,r/=e;while(r*e>=e);return i},mt=function(r,e,t,A,i){var n=t-e+1;return(r<0?"-":"")+(id(Math.abs(r),n,A,function(s){return ft(Math.floor(s%n)+e)})+i)},lr=function(r,e,t){t===void 0&&(t=". ");var A=e.length;return id(Math.abs(r),A,!1,function(i){return e[Math.floor(i%A)]})+t},Ur=1,RA=2,$A=4,Ci=8,LA=function(r,e,t,A,i,n){if(r<-9999||r>9999)return vi(r,4,i.length>0);var s=Math.abs(r),o=i;if(s===0)return e[0]+o;for(var a=0;s>0&&a<=4;a++){var c=s%10;c===0&&vt(n,Ur)&&o!==""?o=e[c]+o:c>1||c===1&&a===0||c===1&&a===1&&vt(n,RA)||c===1&&a===1&&vt(n,$A)&&r>100||c===1&&a>1&&vt(n,Ci)?o=e[c]+(a>0?t[a-1]:"")+o:c===1&&a>0&&(o=t[a-1]+o),s=Math.floor(s/10)}return(r<0?A:"")+o},nd="十百千萬",sd="拾佰仟萬",od="マイナス",ga="마이너스",vi=function(r,e,t){var A=t?". ":"",i=t?"、":"",n=t?", ":"",s=t?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var o=mt(r,48,57,!0,A);return o.length<4?"0"+o:o;case 4:return lr(r,"〇一二三四五六七八九",i);case 6:return Fr(r,1,3999,Ad,3,A).toLowerCase();case 7:return Fr(r,1,3999,Ad,3,A);case 8:return mt(r,945,969,!1,A);case 9:return mt(r,97,122,!1,A);case 10:return mt(r,65,90,!1,A);case 11:return mt(r,1632,1641,!0,A);case 12:case 49:return Fr(r,1,9999,rd,3,A);case 35:return Fr(r,1,9999,rd,3,A).toLowerCase();case 13:return mt(r,2534,2543,!0,A);case 14:case 30:return mt(r,6112,6121,!0,A);case 15:return lr(r,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return lr(r,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return LA(r,"零一二三四五六七八九",nd,"負",i,RA|$A|Ci);case 47:return LA(r,"零壹貳參肆伍陸柒捌玖",sd,"負",i,Ur|RA|$A|Ci);case 42:return LA(r,"零一二三四五六七八九",nd,"负",i,RA|$A|Ci);case 41:return LA(r,"零壹贰叁肆伍陆柒捌玖",sd,"负",i,Ur|RA|$A|Ci);case 26:return LA(r,"〇一二三四五六七八九","十百千万",od,i,0);case 25:return LA(r,"零壱弐参四伍六七八九","拾百千万",od,i,Ur|RA|$A);case 31:return LA(r,"영일이삼사오육칠팔구","십백천만",ga,n,Ur|RA|$A);case 33:return LA(r,"零一二三四五六七八九","十百千萬",ga,n,0);case 32:return LA(r,"零壹貳參四五六七八九","拾百千",ga,n,Ur|RA|$A);case 18:return mt(r,2406,2415,!0,A);case 20:return Fr(r,1,19999,ov,3,A);case 21:return mt(r,2790,2799,!0,A);case 22:return mt(r,2662,2671,!0,A);case 22:return Fr(r,1,10999,sv,3,A);case 23:return lr(r,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return lr(r,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return mt(r,3302,3311,!0,A);case 28:return lr(r,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return lr(r,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return mt(r,3792,3801,!0,A);case 37:return mt(r,6160,6169,!0,A);case 38:return mt(r,4160,4169,!0,A);case 39:return mt(r,2918,2927,!0,A);case 40:return mt(r,1776,1785,!0,A);case 43:return mt(r,3046,3055,!0,A);case 44:return mt(r,3174,3183,!0,A);case 45:return mt(r,3664,3673,!0,A);case 46:return mt(r,3872,3881,!0,A);default:return mt(r,48,57,!0,A)}},ad="data-html2canvas-ignore",ld=(function(){function r(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new nv,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 r.prototype.toIFrame=function(e,t){var A=this,i=av(e,t);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var n=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,o=i.contentWindow,a=o.document,c=hv(i).then(function(){return kt(A,void 0,void 0,function(){var h,d;return Mt(this,function(m){switch(m.label){case 0:return this.scrolledElements.forEach(fv),o&&(o.scrollTo(t.left,t.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(o.scrollY!==t.top||o.scrollX!==t.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(o.scrollX-t.left,o.scrollY-t.top,0,0))),h=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:a.fonts&&a.fonts.ready?[4,a.fonts.ready]:[3,2];case 1:m.sent(),m.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,cv(a)]:[3,4];case 3:m.sent(),m.label=4;case 4:return typeof h=="function"?[2,Promise.resolve().then(function(){return h(a,d)}).then(function(){return i})]:[2,i]}})})});return a.open(),a.write(dv(document.doctype)+"<html></html>"),pv(this.referenceElement.ownerDocument,n,s),a.replaceChild(a.adoptNode(this.documentElement),a.documentElement),a.close(),c},r.prototype.createElementClone=function(e){if(ea(e,2))debugger;if(Ju(e))return this.createCanvasClone(e);if(qu(e))return this.createVideoClone(e);if(ju(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return ma(t)&&(ma(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager")),td(t)?this.createCustomElementClone(t):t},r.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return wa(e.style,t),t},r.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},""),i=e.cloneNode(!1);return i.textContent=A,i}}catch(n){if(this.context.logger.error("Unable to access cssRules property",n),n.name!=="SecurityError")throw n}return e.cloneNode(!1)},r.prototype.createCanvasClone=function(e){var 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 i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var n=e.getContext("2d"),s=i.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var o=(t=e.getContext("webgl2"))!==null&&t!==void 0?t:e.getContext("webgl");if(o){var a=o.getContextAttributes();a?.preserveDrawingBuffer===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},r.prototype.createVideoClone=function(e){var 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 i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},r.prototype.appendChildNode=function(e,t,A){(!Qr(t)||!iv(t)&&!t.hasAttribute(ad)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(t)))&&(!this.options.copyStyles||!Qr(t)||!ju(t))&&e.appendChild(this.cloneNode(t,A))},r.prototype.cloneChildNodes=function(e,t,A){for(var i=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Qr(n)&&ed(n)&&typeof n.assignedNodes=="function"){var s=n.assignedNodes();s.length&&s.forEach(function(o){return i.appendChildNode(t,o,A)})}else this.appendChildNode(t,n,A)},r.prototype.cloneNode=function(e,t){if(Xu(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Qr(e)&&(pa(e)||Yn(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),o=A.getComputedStyle(e,":after");this.referenceElement===e&&pa(i)&&(this.clonedReferenceElement=i),fa(i)&&wv(i);var a=this.counters.parse(new bu(this.context,n)),c=this.resolvePseudoContent(e,i,s,yi.BEFORE);td(e)&&(t=!0),qu(e)||this.cloneChildNodes(e,i,t),c&&i.insertBefore(c,i.firstChild);var h=this.resolvePseudoContent(e,i,o,yi.AFTER);return h&&i.appendChild(h),this.counters.pop(a),(n&&(this.options.copyStyles||Yn(e))&&!Yu(e)||t)&&wa(n,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(jn(e)||es(e))&&(jn(i)||es(i))&&(i.value=e.value),i}return e.cloneNode(!1)},r.prototype.resolvePseudoContent=function(e,t,A,i){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 bu(this.context,A));var a=new eC(this.context,A),c=o.createElement("html2canvaspseudoelement");wa(A,c),a.content.forEach(function(d){if(d.type===0)c.appendChild(o.createTextNode(d.value));else if(d.type===22){var m=o.createElement("img");m.src=d.value,m.style.opacity="1",c.appendChild(m)}else if(d.type===18){if(d.name==="attr"){var T=d.values.filter(rt);T.length&&c.appendChild(o.createTextNode(e.getAttribute(T[0].value)||""))}else if(d.name==="counter"){var v=d.values.filter(Tr),B=v[0],y=v[1];if(B&&rt(B)){var D=n.counters.getCounterValue(B.value),E=y&&rt(y)?jo.parse(n.context,y.value):3;c.appendChild(o.createTextNode(vi(D,E,!1)))}}else if(d.name==="counters"){var N=d.values.filter(Tr),B=N[0],S=N[1],y=N[2];if(B&&rt(B)){var W=n.counters.getCounterValues(B.value),$=y&&rt(y)?jo.parse(n.context,y.value):3,j=S&&S.type===0?S.value:"",V=W.map(function(ae){return vi(ae,$,!1)}).join(j);c.appendChild(o.createTextNode(V))}}}else if(d.type===20)switch(d.value){case"open-quote":c.appendChild(o.createTextNode(yu(a.quotes,n.quoteDepth++,!0)));break;case"close-quote":c.appendChild(o.createTextNode(yu(a.quotes,--n.quoteDepth,!1)));break;default:c.appendChild(o.createTextNode(d.value))}}),c.className=Ba+" "+Ca;var h=i===yi.BEFORE?" "+Ba:" "+Ca;return Yn(t)?t.className.baseValue+=h:t.className+=h,c}}},r.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},r})(),yi;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(yi||(yi={}));var av=function(r,e){var t=r.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(ad,"true"),r.body.appendChild(t),t},lv=function(r){return new Promise(function(e){if(r.complete){e();return}if(!r.src){e();return}r.onload=e,r.onerror=e})},cv=function(r){return Promise.all([].slice.call(r.images,0).map(lv))},hv=function(r){return new Promise(function(e,t){var A=r.contentWindow;if(!A)return t("No window assigned for iframe");var i=A.document;A.onload=r.onload=function(){A.onload=r.onload=null;var n=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(n),e(r))},50)}})},uv=["all","d","content"],wa=function(r,e){for(var t=r.length-1;t>=0;t--){var A=r.item(t);uv.indexOf(A)===-1&&e.style.setProperty(A,r.getPropertyValue(A))}return e},dv=function(r){var e="";return r&&(e+="<!DOCTYPE ",r.name&&(e+=r.name),r.internalSubset&&(e+=r.internalSubset),r.publicId&&(e+='"'+r.publicId+'"'),r.systemId&&(e+='"'+r.systemId+'"'),e+=">"),e},pv=function(r,e,t){r&&r.defaultView&&(e!==r.defaultView.pageXOffset||t!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(e,t)},fv=function(r){var e=r[0],t=r[1],A=r[2];e.scrollLeft=t,e.scrollTop=A},mv=":before",gv=":after",Ba="___html2canvas___pseudoelement_before",Ca="___html2canvas___pseudoelement_after",cd=`{
|
|
7
7
|
content: "" !important;
|
|
8
8
|
display: none !important;
|
|
9
|
-
}`,
|
|
10
|
-
.`+va+mv+cd)},wv=function(r,e){var t=r.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,r.appendChild(A)}},hd=(function(){function r(){}return r.getOrigin=function(e){var t=r._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},r.isSameOrigin=function(e){return r.getOrigin(e)===r._origin},r.setContext=function(e){r._link=e.document.createElement("a"),r._origin=r.getOrigin(e.location.href)},r._origin="about:blank",r})(),Bv=(function(){function r(e,t){this.context=e,this._options=t,this._cache={}}return r.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ba(e)||bv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},r.prototype.match=function(e){return this._cache[e]},r.prototype.loadImage=function(e){return kt(this,void 0,void 0,function(){var t,A,i,n,s=this;return Mt(this,function(o){switch(o.label){case 0:return t=hd.isSameOrigin(e),A=!ya(e)&&this._options.useCORS===!0&&Ut.SUPPORT_CORS_IMAGES&&!t,i=!ya(e)&&!t&&!ba(e)&&typeof this._options.proxy=="string"&&Ut.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!ya(e)&&!ba(e)&&!i&&!A?[2]:(n=e,i?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,c){var h=new Image;h.onload=function(){return a(h)},h.onerror=c,(Tv(n)||A)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return a(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(e){return typeof this._cache[e]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(n,s){var o=Ut.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")n(a.response);else{var d=new FileReader;d.addEventListener("load",function(){return n(d.result)},!1),d.addEventListener("error",function(m){return s(m)},!1),d.readAsDataURL(a.response)}else s("Failed to proxy resource "+i+" with status code "+a.status)},a.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(a.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;a.timeout=h,a.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+i)}}a.send()})},r})(),Cv=/^data:image\/svg\+xml/i,vv=/^data:image\/.*;base64,/i,yv=/^data:image\/.*/i,bv=function(r){return Ut.SUPPORT_SVG_DRAWING||!xv(r)},ya=function(r){return yv.test(r)},Tv=function(r){return vv.test(r)},ba=function(r){return r.substr(0,4)==="blob"},xv=function(r){return r.substr(-3).toLowerCase()==="svg"||Cv.test(r)},Qe=(function(){function r(e,t){this.type=0,this.x=e,this.y=t}return r.prototype.add=function(e,t){return new r(this.x+e,this.y+t)},r})(),Sr=function(r,e,t){return new Qe(r.x+(e.x-r.x)*t,r.y+(e.y-r.y)*t)},ts=(function(){function r(e,t,A,i){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=i}return r.prototype.subdivide=function(e,t){var A=Sr(this.start,this.startControl,e),i=Sr(this.startControl,this.endControl,e),n=Sr(this.endControl,this.end,e),s=Sr(A,i,e),o=Sr(i,n,e),a=Sr(s,o,e);return t?new r(this.start,A,s,a):new r(a,o,n,this.end)},r.prototype.add=function(e,t){return new r(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r})(),sA=function(r){return r.type===1},Qv=(function(){function r(e){var t=e.styles,A=e.bounds,i=fi(t.borderTopLeftRadius,A.width,A.height),n=i[0],s=i[1],o=fi(t.borderTopRightRadius,A.width,A.height),a=o[0],c=o[1],h=fi(t.borderBottomRightRadius,A.width,A.height),d=h[0],m=h[1],x=fi(t.borderBottomLeftRadius,A.width,A.height),v=x[0],B=x[1],y=[];y.push((n+a)/A.width),y.push((v+d)/A.width),y.push((s+B)/A.height),y.push((c+m)/A.height);var D=Math.max.apply(Math,y);D>1&&(n/=D,s/=D,a/=D,c/=D,d/=D,m/=D,v/=D,B/=D);var E=A.width-a,N=A.height-m,S=A.width-d,W=A.height-B,$=t.borderTopWidth,j=t.borderRightWidth,V=t.borderBottomWidth,X=t.borderLeftWidth,ce=st(t.paddingTop,e.bounds.width),ae=st(t.paddingRight,e.bounds.width),de=st(t.paddingBottom,e.bounds.width),J=st(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?lt(A.left+X/3,A.top+$/3,n-X/3,s-$/3,je.TOP_LEFT):new Qe(A.left+X/3,A.top+$/3),this.topRightBorderDoubleOuterBox=n>0||s>0?lt(A.left+E,A.top+$/3,a-j/3,c-$/3,je.TOP_RIGHT):new Qe(A.left+A.width-j/3,A.top+$/3),this.bottomRightBorderDoubleOuterBox=d>0||m>0?lt(A.left+S,A.top+N,d-j/3,m-V/3,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j/3,A.top+A.height-V/3),this.bottomLeftBorderDoubleOuterBox=v>0||B>0?lt(A.left+X/3,A.top+W,v-X/3,B-V/3,je.BOTTOM_LEFT):new Qe(A.left+X/3,A.top+A.height-V/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?lt(A.left+X*2/3,A.top+$*2/3,n-X*2/3,s-$*2/3,je.TOP_LEFT):new Qe(A.left+X*2/3,A.top+$*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?lt(A.left+E,A.top+$*2/3,a-j*2/3,c-$*2/3,je.TOP_RIGHT):new Qe(A.left+A.width-j*2/3,A.top+$*2/3),this.bottomRightBorderDoubleInnerBox=d>0||m>0?lt(A.left+S,A.top+N,d-j*2/3,m-V*2/3,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j*2/3,A.top+A.height-V*2/3),this.bottomLeftBorderDoubleInnerBox=v>0||B>0?lt(A.left+X*2/3,A.top+W,v-X*2/3,B-V*2/3,je.BOTTOM_LEFT):new Qe(A.left+X*2/3,A.top+A.height-V*2/3),this.topLeftBorderStroke=n>0||s>0?lt(A.left+X/2,A.top+$/2,n-X/2,s-$/2,je.TOP_LEFT):new Qe(A.left+X/2,A.top+$/2),this.topRightBorderStroke=n>0||s>0?lt(A.left+E,A.top+$/2,a-j/2,c-$/2,je.TOP_RIGHT):new Qe(A.left+A.width-j/2,A.top+$/2),this.bottomRightBorderStroke=d>0||m>0?lt(A.left+S,A.top+N,d-j/2,m-V/2,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j/2,A.top+A.height-V/2),this.bottomLeftBorderStroke=v>0||B>0?lt(A.left+X/2,A.top+W,v-X/2,B-V/2,je.BOTTOM_LEFT):new Qe(A.left+X/2,A.top+A.height-V/2),this.topLeftBorderBox=n>0||s>0?lt(A.left,A.top,n,s,je.TOP_LEFT):new Qe(A.left,A.top),this.topRightBorderBox=a>0||c>0?lt(A.left+E,A.top,a,c,je.TOP_RIGHT):new Qe(A.left+A.width,A.top),this.bottomRightBorderBox=d>0||m>0?lt(A.left+S,A.top+N,d,m,je.BOTTOM_RIGHT):new Qe(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=v>0||B>0?lt(A.left,A.top+W,v,B,je.BOTTOM_LEFT):new Qe(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?lt(A.left+X,A.top+$,Math.max(0,n-X),Math.max(0,s-$),je.TOP_LEFT):new Qe(A.left+X,A.top+$),this.topRightPaddingBox=a>0||c>0?lt(A.left+Math.min(E,A.width-j),A.top+$,E>A.width+j?0:Math.max(0,a-j),Math.max(0,c-$),je.TOP_RIGHT):new Qe(A.left+A.width-j,A.top+$),this.bottomRightPaddingBox=d>0||m>0?lt(A.left+Math.min(S,A.width-X),A.top+Math.min(N,A.height-V),Math.max(0,d-j),Math.max(0,m-V),je.BOTTOM_RIGHT):new Qe(A.left+A.width-j,A.top+A.height-V),this.bottomLeftPaddingBox=v>0||B>0?lt(A.left+X,A.top+Math.min(W,A.height-V),Math.max(0,v-X),Math.max(0,B-V),je.BOTTOM_LEFT):new Qe(A.left+X,A.top+A.height-V),this.topLeftContentBox=n>0||s>0?lt(A.left+X+J,A.top+$+ce,Math.max(0,n-(X+J)),Math.max(0,s-($+ce)),je.TOP_LEFT):new Qe(A.left+X+J,A.top+$+ce),this.topRightContentBox=a>0||c>0?lt(A.left+Math.min(E,A.width+X+J),A.top+$+ce,E>A.width+X+J?0:a-X+J,c-($+ce),je.TOP_RIGHT):new Qe(A.left+A.width-(j+ae),A.top+$+ce),this.bottomRightContentBox=d>0||m>0?lt(A.left+Math.min(S,A.width-(X+J)),A.top+Math.min(N,A.height+$+ce),Math.max(0,d-(j+ae)),m-(V+de),je.BOTTOM_RIGHT):new Qe(A.left+A.width-(j+ae),A.top+A.height-(V+de)),this.bottomLeftContentBox=v>0||B>0?lt(A.left+X+J,A.top+W,Math.max(0,v-(X+J)),B-(V+de),je.BOTTOM_LEFT):new Qe(A.left+X+J,A.top+A.height-(V+de))}return r})(),je;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(je||(je={}));var lt=function(r,e,t,A,i){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,a=r+t,c=e+A;switch(i){case je.TOP_LEFT:return new ts(new Qe(r,c),new Qe(r,c-o),new Qe(a-s,e),new Qe(a,e));case je.TOP_RIGHT:return new ts(new Qe(r,e),new Qe(r+s,e),new Qe(a,c-o),new Qe(a,c));case je.BOTTOM_RIGHT:return new ts(new Qe(a,e),new Qe(a,e+o),new Qe(r+s,c),new Qe(r,c));case je.BOTTOM_LEFT:default:return new ts(new Qe(a,c),new Qe(a-s,c),new Qe(r,e+o),new Qe(r,e))}},As=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},Fv=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},rs=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Uv=(function(){function r(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return r})(),is=(function(){function r(e,t){this.path=e,this.target=t,this.type=1}return r})(),Ev=(function(){function r(e){this.opacity=e,this.type=2,this.target=6}return r})(),Sv=function(r){return r.type===0},ud=function(r){return r.type===1},Hv=function(r){return r.type===2},dd=function(r,e){return r.length===e.length?r.some(function(t,A){return t===e[A]}):!1},Lv=function(r,e,t,A,i){return r.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+i);case 3:return n.add(e,t+i)}return n})},pd=(function(){function r(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r})(),fd=(function(){function r(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Qv(this.container),this.container.styles.opacity<1&&this.effects.push(new Ev(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new Uv(A,i,n))}if(this.container.styles.overflowX!==0){var s=As(this.curves),o=rs(this.curves);dd(s,o)?this.effects.push(new is(s,6)):(this.effects.push(new is(s,2)),this.effects.push(new is(o,4)))}}return r.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,i=this.effects.slice(0);A;){var n=A.effects.filter(function(a){return!ud(a)});if(t||A.container.styles.position!==0||!A.parent){if(i.unshift.apply(i,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=As(A.curves),o=rs(A.curves);dd(s,o)||i.unshift(new is(o,6))}}else i.unshift.apply(i,n);A=A.parent}return i.filter(function(a){return Ct(a.target,e)})},r})(),Ta=function(r,e,t,A){r.container.elements.forEach(function(i){var n=Ct(i.flags,4),s=Ct(i.flags,2),o=new fd(i,r);Ct(i.styles.display,2048)&&A.push(o);var a=Ct(i.flags,8)?[]:A;if(n||s){var c=n||i.styles.isPositioned()?t:e,h=new pd(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var m=0;c.negativeZIndex.some(function(v,B){return d>v.element.container.styles.zIndex.order?(m=B,!1):m>0}),c.negativeZIndex.splice(m,0,h)}else if(d>0){var x=0;c.positiveZIndex.some(function(v,B){return d>=v.element.container.styles.zIndex.order?(x=B+1,!1):x>0}),c.positiveZIndex.splice(x,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else i.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);Ta(o,h,n?h:t,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),Ta(o,e,t,a);Ct(i.flags,8)&&md(i,a)})},md=function(r,e){for(var t=r instanceof da?r.start:1,A=r instanceof da?r.reversed:!1,i=0;i<e.length;i++){var n=e[i];n.container instanceof Pu&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=vi(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},Mv=function(r){var e=new fd(r,null),t=new pd(e),A=[];return Ta(e,t,t,A),md(e.container,A),t},gd=function(r,e){switch(e){case 0:return oA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return oA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return oA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);default:return oA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Iv=function(r,e){switch(e){case 0:return oA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return oA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return oA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);default:return oA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},_v=function(r,e){switch(e){case 0:return oA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return oA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return oA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);default:return oA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},Dv=function(r,e){switch(e){case 0:return ns(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return ns(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return ns(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);default:return ns(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},ns=function(r,e){var t=[];return sA(r)?t.push(r.subdivide(.5,!1)):t.push(r),sA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},oA=function(r,e,t,A){var i=[];return sA(r)?i.push(r.subdivide(.5,!1)):i.push(r),sA(t)?i.push(t.subdivide(.5,!0)):i.push(t),sA(A)?i.push(A.subdivide(.5,!0).reverse()):i.push(A),sA(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},wd=function(r){var e=r.bounds,t=r.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ss=function(r){var e=r.styles,t=r.bounds,A=st(e.paddingLeft,t.width),i=st(e.paddingRight,t.width),n=st(e.paddingTop,t.width),s=st(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+i),-(e.borderTopWidth+e.borderBottomWidth+n+s))},kv=function(r,e){return r===0?e.bounds:r===2?ss(e):wd(e)},Ov=function(r,e){return r===0?e.bounds:r===2?ss(e):wd(e)},xa=function(r,e,t){var A=kv(Lr(r.styles.backgroundOrigin,e),r),i=Ov(Lr(r.styles.backgroundClip,e),r),n=Nv(Lr(r.styles.backgroundSize,e),t,A),s=n[0],o=n[1],a=fi(Lr(r.styles.backgroundPosition,e),A.width-s,A.height-o),c=Kv(Lr(r.styles.backgroundRepeat,e),a,n,A,i),h=Math.round(A.left+a[0]),d=Math.round(A.top+a[1]);return[c,h,d,s,o]},Hr=function(r){return rt(r)&&r.value===Qr.AUTO},os=function(r){return typeof r=="number"},Nv=function(r,e,t){var A=e[0],i=e[1],n=e[2],s=r[0],o=r[1];if(!s)return[0,0];if(wt(s)&&o&&wt(o))return[st(s,t.width),st(o,t.height)];var a=os(n);if(rt(s)&&(s.value===Qr.CONTAIN||s.value===Qr.COVER)){if(os(n)){var c=t.width/t.height;return c<n!=(s.value===Qr.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=os(A),d=os(i),m=h||d;if(Hr(s)&&(!o||Hr(o))){if(h&&d)return[A,i];if(!a&&!m)return[t.width,t.height];if(m&&a){var x=h?A:i*n,v=d?i:A/n;return[x,v]}var B=h?A:t.width,y=d?i:t.height;return[B,y]}if(a){var D=0,E=0;return wt(s)?D=st(s,t.width):wt(o)&&(E=st(o,t.height)),Hr(s)?D=E*n:(!o||Hr(o))&&(E=D/n),[D,E]}var N=null,S=null;if(wt(s)?N=st(s,t.width):o&&wt(o)&&(S=st(o,t.height)),N!==null&&(!o||Hr(o))&&(S=h&&d?N/A*i:t.height),S!==null&&Hr(s)&&(N=h&&d?S/i*A:t.width),N!==null&&S!==null)return[N,S];throw new Error("Unable to calculate background-size for element")},Lr=function(r,e){var t=r[e];return typeof t>"u"?r[0]:t},Kv=function(r,e,t,A,i){var n=e[0],s=e[1],o=t[0],a=t[1];switch(r){case 2:return[new Qe(Math.round(A.left),Math.round(A.top+s)),new Qe(Math.round(A.left+A.width),Math.round(A.top+s)),new Qe(Math.round(A.left+A.width),Math.round(a+A.top+s)),new Qe(Math.round(A.left),Math.round(a+A.top+s))];case 3:return[new Qe(Math.round(A.left+n),Math.round(A.top)),new Qe(Math.round(A.left+n+o),Math.round(A.top)),new Qe(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Qe(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Qe(Math.round(A.left+n),Math.round(A.top+s)),new Qe(Math.round(A.left+n+o),Math.round(A.top+s)),new Qe(Math.round(A.left+n+o),Math.round(A.top+s+a)),new Qe(Math.round(A.left+n),Math.round(A.top+s+a))];default:return[new Qe(Math.round(i.left),Math.round(i.top)),new Qe(Math.round(i.left+i.width),Math.round(i.top)),new Qe(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Qe(Math.round(i.left),Math.round(i.height+i.top))]}},Pv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Bd="Hidden Text",Vv=(function(){function r(e){this._data={},this._document=e}return r.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),i=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),i.src=Pv,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(Bd)),A.appendChild(n),A.appendChild(i);var o=i.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Bd)),A.style.lineHeight="normal",i.style.verticalAlign="super";var a=i.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:a}},r.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]},r})(),Cd=(function(){function r(e,t){this.context=e,this.options=t}return r})(),zv=1e4,Wv=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i._activeEffects=[],i.canvas=A.canvas?A.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),A.canvas||(i.canvas.width=Math.floor(A.width*A.scale),i.canvas.height=Math.floor(A.height*A.scale),i.canvas.style.width=A.width+"px",i.canvas.style.height=A.height+"px"),i.fontMetrics=new Vv(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-A.x,-A.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),i}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return A.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),Hv(t)&&(this.ctx.globalAlpha=t.opacity),Sv(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 kt(this,void 0,void 0,function(){var A;return Mt(this,function(i){switch(i.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return kt(this,void 0,void 0,function(){return Mt(this,function(A){switch(A.label){case 0:if(Ct(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,i){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var s=ua(t.text);s.reduce(function(o,a){return n.ctx.fillText(a,o,t.bounds.top+i),o+n.ctx.measureText(a).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=Zv(t.fontFamily).join(", "),n=pi(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,i].join(" "),i,n]},e.prototype.renderTextNode=function(t,A){return kt(this,void 0,void 0,function(){var i,n,s,o,a,c,h,d,m=this;return Mt(this,function(x){return i=this.createFontStyle(A),n=i[0],s=i[1],o=i[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(s,o),c=a.baseline,h=a.middle,d=A.paintOrder,t.textBounds.forEach(function(v){d.forEach(function(B){switch(B){case 0:m.ctx.fillStyle=yt(A.color),m.renderTextWithLetterSpacing(v,A.letterSpacing,c);var y=A.textShadow;y.length&&v.text.trim().length&&(y.slice(0).reverse().forEach(function(D){m.ctx.shadowColor=yt(D.color),m.ctx.shadowOffsetX=D.offsetX.number*m.options.scale,m.ctx.shadowOffsetY=D.offsetY.number*m.options.scale,m.ctx.shadowBlur=D.blur.number,m.renderTextWithLetterSpacing(v,A.letterSpacing,c)}),m.ctx.shadowColor="",m.ctx.shadowOffsetX=0,m.ctx.shadowOffsetY=0,m.ctx.shadowBlur=0),A.textDecorationLine.length&&(m.ctx.fillStyle=yt(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(D){switch(D){case 1:m.ctx.fillRect(v.bounds.left,Math.round(v.bounds.top+c),v.bounds.width,1);break;case 2:m.ctx.fillRect(v.bounds.left,Math.round(v.bounds.top),v.bounds.width,1);break;case 3:m.ctx.fillRect(v.bounds.left,Math.ceil(v.bounds.top+h),v.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&v.text.trim().length&&(m.ctx.strokeStyle=yt(A.webkitTextStrokeColor),m.ctx.lineWidth=A.webkitTextStrokeWidth,m.ctx.lineJoin=window.chrome?"miter":"round",m.ctx.strokeText(v.text,v.bounds.left,v.bounds.top+c)),m.ctx.strokeStyle="",m.ctx.lineWidth=0,m.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ss(t),s=rs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a,E,E,c,h,d,m,S,x,v,W,B,y,D,E,N,S,W;return Mt(this,function($){switch($.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,i=t.curves,n=A.styles,s=0,o=A.textNodes,$.label=1;case 1:return s<o.length?(a=o[s],[4,this.renderTextNode(a,n)]):[3,4];case 2:$.sent(),$.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof Ou))return[3,8];$.label=5;case 5:return $.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=$.sent(),this.renderReplacedElement(A,i,E),[3,8];case 7:return $.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Nu&&this.renderReplacedElement(A,i,A.canvas),!(A instanceof Ku))return[3,12];$.label=9;case 9:return $.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=$.sent(),this.renderReplacedElement(A,i,E),[3,12];case 11:return $.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof Gu&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:h=$.sent(),A.width&&A.height&&this.ctx.drawImage(h,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),$.label=14;case 14:if(A instanceof pa&&(d=Math.min(A.bounds.width,A.bounds.height),A.type===Zn?A.checked&&(this.ctx.save(),this.path([new Qe(A.bounds.left+d*.39363,A.bounds.top+d*.79),new Qe(A.bounds.left+d*.16,A.bounds.top+d*.5549),new Qe(A.bounds.left+d*.27347,A.bounds.top+d*.44071),new Qe(A.bounds.left+d*.39694,A.bounds.top+d*.5649),new Qe(A.bounds.left+d*.72983,A.bounds.top+d*.23),new Qe(A.bounds.left+d*.84,A.bounds.top+d*.34085),new Qe(A.bounds.left+d*.39363,A.bounds.top+d*.79)]),this.ctx.fillStyle=yt(Vu),this.ctx.fill(),this.ctx.restore()):A.type===Jn&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+d/2,A.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=yt(Vu),this.ctx.fill(),this.ctx.restore())),Gv(A)&&A.value.length){switch(m=this.createFontStyle(n),S=m[0],x=m[1],v=this.fontMetrics.getMetrics(S,x).baseline,this.ctx.font=S,this.ctx.fillStyle=yt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=$v(A.styles.textAlign),W=ss(A),B=0,A.styles.textAlign){case 1:B+=W.width/2;break;case 2:B+=W.width;break}y=W.add(B,0,0,-W.height/2+1),this.ctx.save(),this.path([new Qe(W.left,W.top),new Qe(W.left+W.width,W.top),new Qe(W.left+W.width,W.top+W.height),new Qe(W.left,W.top+W.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Bi(A.value,y),n.letterSpacing,v),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ct(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(D=A.styles.listStyleImage,D.type!==0)return[3,18];E=void 0,N=D.url,$.label=15;case 15:return $.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return E=$.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return $.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&&(S=this.createFontStyle(n)[0],this.ctx.font=S,this.ctx.fillStyle=yt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",W=new UA(A.bounds.left,A.bounds.top+st(A.styles.paddingTop,A.bounds.width),A.bounds.width,Bu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Bi(t.listValue,W),n.letterSpacing,Bu(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),$.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return kt(this,void 0,void 0,function(){var A,i,D,n,s,D,o,a,D,c,h,D,d,m,D,x,v,D,B,y,D;return Mt(this,function(E){switch(E.label){case 0:if(Ct(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,i=t.negativeZIndex,E.label=2;case 2:return A<i.length?(D=i[A],[4,this.renderStack(D)]):[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?(D=s[n],[4,this.renderNode(D)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,a=t.nonPositionedFloats,E.label=11;case 11:return o<a.length?(D=a[o],[4,this.renderStack(D)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,E.label=15;case 15:return c<h.length?(D=h[c],[4,this.renderStack(D)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:d=0,m=t.inlineLevel,E.label=19;case 19:return d<m.length?(D=m[d],[4,this.renderNode(D)]):[3,22];case 20:E.sent(),E.label=21;case 21:return d++,[3,19];case 22:x=0,v=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return x<v.length?(D=v[x],[4,this.renderStack(D)]):[3,26];case 24:E.sent(),E.label=25;case 25:return x++,[3,23];case 26:B=0,y=t.positiveZIndex,E.label=27;case 27:return B<y.length?(D=y[B],[4,this.renderStack(D)]):[3,30];case 28:E.sent(),E.label=29;case 29:return B++,[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(i,n){var s=sA(i)?i.start:i;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),sA(i)&&A.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(t,A,i,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(i,n),this.ctx.fill(),this.ctx.translate(-i,-n)},e.prototype.resizeImage=function(t,A,i){var n;if(t.width===A&&t.height===i)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,i);var a=o.getContext("2d");return a.drawImage(t,0,0,t.width,t.height,0,0,A,i),o},e.prototype.renderBackgroundImage=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a;return Mt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,i=function(h){var d,m,x,ce,Be,Ue,J,ie,V,v,ce,Be,Ue,J,ie,B,y,D,E,N,S,W,$,j,V,X,ce,ae,de,J,ie,pe,Be,Ue,xe,Le,Me,Fe,we,ye,De,et;return Mt(this,function(Ye){switch(Ye.label){case 0:if(h.type!==0)return[3,5];d=void 0,m=h.url,Ye.label=1;case 1:return Ye.trys.push([1,3,,4]),[4,n.context.cache.match(m)];case 2:return d=Ye.sent(),[3,4];case 3:return Ye.sent(),n.context.logger.error("Error loading background-image "+m),[3,4];case 4:return d&&(x=xa(t,A,[d.width,d.height,d.width/d.height]),ce=x[0],Be=x[1],Ue=x[2],J=x[3],ie=x[4],V=n.ctx.createPattern(n.resizeImage(d,J,ie),"repeat"),n.renderRepeat(ce,V,Be,Ue)),[3,6];case 5:SB(h)?(v=xa(t,A,[null,null,null]),ce=v[0],Be=v[1],Ue=v[2],J=v[3],ie=v[4],B=xB(h.angle,J,ie),y=B[0],D=B[1],E=B[2],N=B[3],S=B[4],W=document.createElement("canvas"),W.width=J,W.height=ie,$=W.getContext("2d"),j=$.createLinearGradient(D,N,E,S),au(h.stops,y).forEach(function(be){return j.addColorStop(be.stop,yt(be.color))}),$.fillStyle=j,$.fillRect(0,0,J,ie),J>0&&ie>0&&(V=n.ctx.createPattern(W,"repeat"),n.renderRepeat(ce,V,Be,Ue))):HB(h)&&(X=xa(t,A,[null,null,null]),ce=X[0],ae=X[1],de=X[2],J=X[3],ie=X[4],pe=h.position.length===0?[qo]:h.position,Be=st(pe[0],J),Ue=st(pe[pe.length-1],ie),xe=QB(h,Be,Ue,J,ie),Le=xe[0],Me=xe[1],Le>0&&Me>0&&(Fe=n.ctx.createRadialGradient(ae+Be,de+Ue,0,ae+Be,de+Ue,Le),au(h.stops,Le*2).forEach(function(be){return Fe.addColorStop(be.stop,yt(be.color))}),n.path(ce),n.ctx.fillStyle=Fe,Le!==Me?(we=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,De=Me/Le,et=1/De,n.ctx.save(),n.ctx.translate(we,ye),n.ctx.transform(1,0,0,De,0,0),n.ctx.translate(-we,-ye),n.ctx.fillRect(ae,et*(de-ye)+ye,J,ie*et),n.ctx.restore()):n.ctx.fill())),Ye.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?(a=o[s],[5,i(a)]):[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,i){return kt(this,void 0,void 0,function(){return Mt(this,function(n){return this.path(gd(i,A)),this.ctx.fillStyle=yt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,i,n){return kt(this,void 0,void 0,function(){var s,o;return Mt(this,function(a){switch(a.label){case 0:return A<3?[4,this.renderSolidBorder(t,i,n)]:[3,2];case 1:return a.sent(),[2];case 2:return s=Iv(n,i),this.path(s),this.ctx.fillStyle=yt(t),this.ctx.fill(),o=_v(n,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a,c,h,d=this;return Mt(this,function(m){switch(m.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,i=!zA(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=Rv(Lr(A.backgroundClip,0),t.curves),i||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),zA(A.backgroundColor)||(this.ctx.fillStyle=yt(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:m.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(x){d.ctx.save();var v=As(t.curves),B=x.inset?0:zv,y=Lv(v,-B+(x.inset?1:-1)*x.spread.number,(x.inset?1:-1)*x.spread.number,x.spread.number*(x.inset?-2:2),x.spread.number*(x.inset?-2:2));x.inset?(d.path(v),d.ctx.clip(),d.mask(y)):(d.mask(v),d.ctx.clip(),d.path(y)),d.ctx.shadowOffsetX=x.offsetX.number+B,d.ctx.shadowOffsetY=x.offsetY.number,d.ctx.shadowColor=yt(x.color),d.ctx.shadowBlur=x.blur.number,d.ctx.fillStyle=x.inset?yt(x.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),m.label=2;case 2:o=0,a=0,c=n,m.label=3;case 3:return a<c.length?(h=c[a],h.style!==0&&!zA(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return m.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return m.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return m.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:m.sent(),m.label=11;case 11:o++,m.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,i,n,s){return kt(this,void 0,void 0,function(){var o,a,c,h,d,m,x,v,B,y,D,E,N,S,W,$,W,$;return Mt(this,function(j){return this.ctx.save(),o=Dv(n,i),a=gd(n,i),s===2&&(this.path(a),this.ctx.clip()),sA(a[0])?(c=a[0].start.x,h=a[0].start.y):(c=a[0].x,h=a[0].y),sA(a[1])?(d=a[1].end.x,m=a[1].end.y):(d=a[1].x,m=a[1].y),i===0||i===2?x=Math.abs(c-d):x=Math.abs(h-m),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(a.slice(0,2)),v=A<3?A*3:A*2,B=A<3?A*2:A,s===3&&(v=A,B=A),y=!0,x<=v*2?y=!1:x<=v*2+B?(D=x/(2*v+B),v*=D,B*=D):(E=Math.floor((x+B)/(v+B)),N=(x-E*v)/(E-1),S=(x-(E+1)*v)/E,B=S<=0||Math.abs(B-N)<Math.abs(B-S)?N:S),y&&(s===3?this.ctx.setLineDash([0,v+B]):this.ctx.setLineDash([v,B])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=yt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(sA(a[0])&&(W=a[3],$=a[0],this.ctx.beginPath(),this.formatPath([new Qe(W.end.x,W.end.y),new Qe($.start.x,$.start.y)]),this.ctx.stroke()),sA(a[1])&&(W=a[1],$=a[2],this.ctx.beginPath(),this.formatPath([new Qe(W.end.x,W.end.y),new Qe($.start.x,$.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return kt(this,void 0,void 0,function(){var A;return Mt(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=yt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=Mv(t),[4,this.renderStack(A)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Cd),Gv=function(r){return r instanceof Wu||r instanceof zu?!0:r instanceof pa&&r.type!==Jn&&r.type!==Zn},Rv=function(r,e){switch(r){case 0:return As(e);case 2:return Fv(e);default:return rs(e)}},$v=function(r){switch(r){case 1:return"center";case 2:return"right";default:return"left"}},Xv=["-apple-system","system-ui"],Zv=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(e){return Xv.indexOf(e)===-1}):r},Jv=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.canvas=A.canvas?A.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=A,i.canvas.width=Math.floor(A.width*A.scale),i.canvas.height=Math.floor(A.height*A.scale),i.canvas.style.width=A.width+"px",i.canvas.style.height=A.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-A.x,-A.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),i}return e.prototype.render=function(t){return kt(this,void 0,void 0,function(){var A,i;return Mt(this,function(n){switch(n.label){case 0:return A=ha(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,qv(A)];case 1:return i=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=yt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Cd),qv=function(r){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(r))})},Yv=(function(){function r(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var e=[],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,fn([this.id,this.getTime()+"ms"],e))},r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.instances={},r})(),jv=(function(){function r(e,t){var A;this.windowBounds=t,this.instanceName="#"+r.instanceCount++,this.logger=new Yv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new Bv(this,e)}return r.instanceCount=1,r})(),ey=function(r,e){return e===void 0&&(e={}),ty(r,e)};typeof window<"u"&&hd.setContext(window);var ty=function(r,e){return kt(void 0,void 0,void 0,function(){var t,A,i,n,s,o,a,c,h,d,m,x,v,B,y,D,E,N,S,W,j,$,j,V,X,ce,ae,de,J,ie,pe,Be,Ue,xe,Le,Me,Fe,we,ye,De;return Mt(this,function(et){switch(et.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=r.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 i={allowTaint:(V=e.allowTaint)!==null&&V!==void 0?V:!1,imageTimeout:(X=e.imageTimeout)!==null&&X!==void 0?X:15e3,proxy:e.proxy,useCORS:(ce=e.useCORS)!==null&&ce!==void 0?ce:!1},n=So({logging:(ae=e.logging)!==null&&ae!==void 0?ae:!0,cache:e.cache},i),s={windowWidth:(de=e.windowWidth)!==null&&de!==void 0?de:A.innerWidth,windowHeight:(J=e.windowHeight)!==null&&J!==void 0?J:A.innerHeight,scrollX:(ie=e.scrollX)!==null&&ie!==void 0?ie:A.pageXOffset,scrollY:(pe=e.scrollY)!==null&&pe!==void 0?pe:A.pageYOffset},o=new UA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new jv(n,o),c=(Be=e.foreignObjectRendering)!==null&&Be!==void 0?Be:!1,h={allowTaint:(Ue=e.allowTaint)!==null&&Ue!==void 0?Ue:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new ld(a,r,h),m=d.clonedReferenceElement,m?[4,d.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return x=et.sent(),v=ma(m)||Av(m)?Lg(m.ownerDocument):mn(a,m),B=v.width,y=v.height,D=v.left,E=v.top,N=Ay(a,m,e.backgroundColor),S={canvas:e.canvas,backgroundColor:N,scale:(Le=(xe=e.scale)!==null&&xe!==void 0?xe:A.devicePixelRatio)!==null&&Le!==void 0?Le:1,x:((Me=e.x)!==null&&Me!==void 0?Me:0)+D,y:((Fe=e.y)!==null&&Fe!==void 0?Fe:0)+E,width:(we=e.width)!==null&&we!==void 0?we:Math.ceil(B),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(y)},c?(a.logger.debug("Document cloned, using foreign object rendering"),j=new Jv(a,S),[4,j.render(m)]):[3,3];case 2:return W=et.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+D+","+E+" with size "+B+"x"+y+" using computed rendering"),a.logger.debug("Starting DOM parsing"),$=$u(a,m),N===$.styles.backgroundColor&&($.styles.backgroundColor=SA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+S.x+","+S.y+" with size "+S.width+"x"+S.height),j=new Wv(a,S),[4,j.render($)];case 4:W=et.sent(),et.label=5;case 5:return(!((De=e.removeContainer)!==null&&De!==void 0)||De)&&(ld.destroy(x)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,W]}})})},Ay=function(r,e,t){var A=e.ownerDocument,i=A.documentElement?mi(r,getComputedStyle(A.documentElement).backgroundColor):SA.TRANSPARENT,n=A.body?mi(r,getComputedStyle(A.body).backgroundColor):SA.TRANSPARENT,s=typeof t=="string"?mi(r,t):t===null?SA.TRANSPARENT:4294967295;return e===A.documentElement?zA(i)?zA(n)?s:n:i:s};const ry={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class iy{constructor(e,t,A="#3b82f6",i=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=o.context,c=n._chart,h=n._series;if(!c||!h)return;const d=h.priceToCoordinate(n.price);if(d==null)return;const m=Math.round(d*o.verticalPixelRatio),x=c.timeScale().timeToCoordinate(n.originTime),v=x==null?0:Math.max(0,Math.round(x*o.horizontalPixelRatio)),B=o.bitmapSize.width;if(v>=B)return;a.save(),a.beginPath(),a.strokeStyle=n.color,a.lineWidth=n.lineWidth*o.verticalPixelRatio,a.setLineDash([]),a.moveTo(v,m),a.lineTo(B,m),a.stroke(),a.beginPath(),a.fillStyle=n.color;const y=3*o.verticalPixelRatio;a.arc(v,m,y,0,Math.PI*2),a.fill(),a.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ny{constructor(e,t,A,i="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=i,this.lineWidth=n,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(a=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const d=a.horizontalPixelRatio,m=a.verticalPixelRatio,x=c.timeScale().timeToCoordinate(s.p1.rawTime),v=c.timeScale().timeToCoordinate(s.p2.rawTime),B=h.priceToCoordinate(s.p1.price),y=h.priceToCoordinate(s.p2.price);if(x==null||v==null||B==null||y==null)return;const D=Math.round(x*d),E=Math.round(B*m),N=Math.round(v*d),S=Math.round(y*m),W=a.context;W.save(),W.beginPath(),W.strokeStyle=s.color,W.lineWidth=s.lineWidth*m,W.setLineDash([]),W.moveTo(D,E),W.lineTo(N,S),W.stroke(),W.beginPath(),W.fillStyle=s.color,W.arc(D,E,3*m,0,Math.PI*2),W.fill(),W.beginPath(),W.arc(N,S,3*m,0,Math.PI*2),W.fill();const{priceDiff:$,pricePct:j,bars:V,days:X,angle:ce}=s.info,ae=$>=0?"+":"",de=[`${ae}${$.toFixed(5)} (${ae}${j.toFixed(2)}%)`,`${V} bars (${X} days)`,`∠ ${ce.toFixed(1)}°`],J=Math.round(11*m);W.font=`${J}px sans-serif`;const ie=J*1.6,pe=8*m,Be=Math.max(...de.map(et=>W.measureText(et).width))+pe*2,Ue=de.length*ie+pe*2,xe=N+10*d,Le=S-Ue-4*m,Me=a.bitmapSize.width,Fe=a.bitmapSize.height,we=Math.min(Math.max(0,xe),Me-Be-4*d),ye=Math.min(Math.max(4*m,Le),Fe-Ue-4*m),De=4*m;W.beginPath(),W.moveTo(we+De,ye),W.lineTo(we+Be-De,ye),W.quadraticCurveTo(we+Be,ye,we+Be,ye+De),W.lineTo(we+Be,ye+Ue-De),W.quadraticCurveTo(we+Be,ye+Ue,we+Be-De,ye+Ue),W.lineTo(we+De,ye+Ue),W.quadraticCurveTo(we,ye+Ue,we,ye+Ue-De),W.lineTo(we,ye+De),W.quadraticCurveTo(we,ye,we+De,ye),W.closePath(),W.fillStyle="rgba(30, 41, 59, 0.92)",W.fill(),W.strokeStyle=s.color,W.lineWidth=1*m,W.stroke(),W.fillStyle="#e2e8f0",W.textAlign="left",de.forEach((et,Ye)=>{W.fillText(et,we+pe,ye+pe+J+Ye*ie)}),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,A){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null;const i=t.price>=e.price;this.color=i?"#3b82f6":"#ef5350",this.fillColor=i?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||x==null||v==null||B==null)return;const y=Math.round(m*h),D=Math.round(v*d),E=Math.round(x*h),N=Math.round(B*d),S=o.context;S.save(),S.fillStyle=n.fillColor,S.fillRect(Math.min(y,E),Math.min(D,N),Math.abs(E-y),Math.abs(N-D)),S.strokeStyle=n.color,S.lineWidth=1*d,S.setLineDash([]),S.strokeRect(Math.min(y,E),Math.min(D,N),Math.abs(E-y),Math.abs(N-D)),S.beginPath(),S.strokeStyle=n.color,S.lineWidth=2*d,S.moveTo(y,D),S.lineTo(E,N),S.stroke(),S.fillStyle=n.color,S.beginPath(),S.arc(y,D,3*d,0,Math.PI*2),S.fill(),S.beginPath(),S.arc(E,N,3*d,0,Math.PI*2),S.fill();const{priceDiff:W,pricePct:$,bars:j,days:V}=n.info,X=W>=0?"+":"",ce=[`${X}${W.toFixed(5)} (${X}${$.toFixed(2)}%)`,`${j} bars (${V} days)`],ae=Math.round(11*d);S.font=`${ae}px sans-serif`;const de=ae*1.6,J=8*d,ie=Math.max(...ce.map(ye=>S.measureText(ye).width))+J*2,pe=ce.length*de+J*2,Be=o.bitmapSize.width,Ue=o.bitmapSize.height,xe=E+10*h,Le=N-pe-4*d,Me=Math.min(Math.max(0,xe),Be-ie-4*h),Fe=Math.min(Math.max(4*d,Le),Ue-pe-4*d),we=4*d;S.beginPath(),S.moveTo(Me+we,Fe),S.lineTo(Me+ie-we,Fe),S.quadraticCurveTo(Me+ie,Fe,Me+ie,Fe+we),S.lineTo(Me+ie,Fe+pe-we),S.quadraticCurveTo(Me+ie,Fe+pe,Me+ie-we,Fe+pe),S.lineTo(Me+we,Fe+pe),S.quadraticCurveTo(Me,Fe+pe,Me,Fe+pe-we),S.lineTo(Me,Fe+we),S.quadraticCurveTo(Me,Fe,Me+we,Fe),S.closePath(),S.fillStyle="rgba(30, 41, 59, 0.92)",S.fill(),S.strokeStyle=n.color,S.lineWidth=1*d,S.stroke(),S.fillStyle="#e2e8f0",S.textAlign="left",ce.forEach((ye,De)=>{S.fillText(ye,Me+J,Fe+J+ae+De*de)}),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class sy{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=o.timeScale().timeToCoordinate(i.p2.rawTime),x=a.priceToCoordinate(i.p1.price),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||x==null||v==null)return;const B=Math.min(d,m)*c,y=Math.max(d,m)*c,D=Math.min(x,v)*h,E=Math.max(x,v)*h,N=y-B,S=E-D;if(N<.5||S<.5)return;const W=s.context;W.save(),W.fillStyle=i.fillColor,W.fillRect(B,D,N,S),W.strokeStyle=i.strokeColor,W.lineWidth=i.lineWidth*h,W.setLineDash([]),W.strokeRect(B,D,N,S),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class oy{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=a.priceToCoordinate(i.p1.price),x=o.timeScale().timeToCoordinate(i.p2.rawTime),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||x==null||v==null)return;const B=d*c,y=m*h,D=x*c,E=v*h,N=Math.hypot(D-B,E-y);if(N<.5)return;const S=s.context;S.save(),S.strokeStyle=i.strokeColor,S.lineWidth=i.lineWidth*h,S.setLineDash([]),S.beginPath(),S.arc(B,y,N,0,Math.PI*2),S.stroke(),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ay{constructor(e,t,A,i={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=c.priceToCoordinate(n.p1.price),v=a.timeScale().timeToCoordinate(n.p2.rawTime),B=c.priceToCoordinate(n.p2.price),y=a.timeScale().timeToCoordinate(n.p3.rawTime),D=c.priceToCoordinate(n.p3.price);if(m==null||x==null||v==null||B==null||y==null||D==null)return;const E=m*h,N=x*d,S=v*h,W=B*d,$=y*h,j=D*d,V=o.context;V.save(),V.beginPath(),V.moveTo(E,N),V.lineTo(S,W),V.lineTo($,j),V.closePath(),V.fillStyle=n.fillColor,V.fill(),V.strokeStyle=n.strokeColor,V.lineWidth=n.lineWidth*d,V.setLineDash([]),V.stroke(),V.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ly{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=a.priceToCoordinate(i.p1.price),x=o.timeScale().timeToCoordinate(i.p2.rawTime),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||x==null||v==null)return;const B=d*c,y=m*h,D=x*c,E=v*h,N=D-B,S=E-y,W=Math.hypot(N,S);if(W<.5)return;const $=s.context;if($.save(),$.strokeStyle=i.strokeColor,$.lineWidth=i.lineWidth*h,$.setLineDash([]),i.previewAsLine)$.beginPath(),$.moveTo(B,y),$.lineTo(D,E),$.stroke();else{const j=(B+D)/2,V=(y+E)/2,X=Math.atan2(S,N),ce=W/2,ae=Math.max(1,ce*Math.max(.05,i.minorRatio));$.beginPath(),$.ellipse(j,V,ce,ae,X,0,Math.PI*2),$.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 yd{constructor(e,t,A="#f59e0b",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||x==null||v==null||B==null)return;const y=Math.round(m*h),D=Math.round(v*d),E=Math.round(x*h),N=Math.round(B*d),S=o.context;S.save(),S.beginPath(),S.strokeStyle=n.color,S.lineWidth=n.lineWidth*d,S.setLineDash([]),S.moveTo(y,D),S.lineTo(E,N),S.stroke();const W=Math.atan2(N-D,E-y),$=11*d,j=Math.PI/7,V=E-$*Math.cos(W-j),X=N-$*Math.sin(W-j),ce=E-$*Math.cos(W+j),ae=N-$*Math.sin(W+j);S.beginPath(),S.fillStyle=n.color,S.moveTo(E,N),S.lineTo(V,X),S.lineTo(ce,ae),S.closePath(),S.fill(),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||x==null||v==null||B==null)return;const y=m*h,D=v*d;let E=x-m,N=B-v;E<0&&(E=-E,N=-N),Math.abs(E)<1e-4&&(E=1e-4);const S=N*d/(E*h),W=Math.max(0,y),$=D+S*(W-y),j=o.bitmapSize.width,V=D+S*(j-y),X=o.context;X.save(),X.beginPath(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.moveTo(W,$),X.lineTo(j,V),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||x==null||v==null||B==null)return;const y=m*h,D=v*d;let E=x-m,N=B-v;Math.abs(E)<1e-4&&(E=1e-4);const S=N*d/(E*h),W=0,$=D+S*(W-y),j=o.bitmapSize.width,V=D+S*(j-y),X=o.context;X.save(),X.beginPath(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.moveTo(W,$),X.lineTo(j,V),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class uy{constructor(e,t="#7aa6ae",A=2){this.center=e,this.color=t,this.lineWidth=A,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.center.rawTime),m=a.priceToCoordinate(i.center.price);if(d==null||m==null)return;const x=Math.round(d*c),v=Math.round(m*h),B=s.bitmapSize.width,y=s.bitmapSize.height,D=s.context;D.save(),D.strokeStyle=i.color,D.lineWidth=i.lineWidth*h,D.setLineDash([]),D.beginPath(),D.moveTo(0,v),D.lineTo(B,v),D.stroke(),D.beginPath(),D.moveTo(x,0),D.lineTo(x,y),D.stroke(),D.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),x=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||x==null||v==null||B==null)return;const y=m*h,D=v*d,E=x*h,N=B*d,S=y-E,W=D-N;if(Math.hypot(S,W)<1e-4)return;const j=Math.atan2(W,S),V=Math.round(Math.abs(j*180/Math.PI)),X=o.context;X.save(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.beginPath(),X.moveTo(y,D),X.lineTo(E,N),X.stroke();const ce=28*d;X.beginPath(),X.lineWidth=1*d,X.strokeStyle="rgba(122,166,174,0.55)",X.moveTo(E,N),X.lineTo(E+ce,N),X.stroke(),X.beginPath(),X.strokeStyle="rgba(122,166,174,0.45)",X.arc(E,N,ce,0,j,j<0),X.stroke(),X.fillStyle="#4b7c86",X.font=`${Math.round(10*d)}px sans-serif`,X.textAlign="left",X.textBaseline="middle";const ae=E+(ce+10*d)*Math.cos(j/2),de=N+(ce+10*d)*Math.sin(j/2);X.fillText(`${V}°`,ae,de),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class py{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),x=a.priceToCoordinate(i.p1.price),v=o.timeScale().timeToCoordinate(i.p2.rawTime),B=a.priceToCoordinate(i.p2.price),y=o.timeScale().timeToCoordinate(i.p3.rawTime),D=a.priceToCoordinate(i.p3.price);if(m==null||x==null||v==null||B==null||y==null||D==null)return;const E=m*c,N=x*h,S=v*c,W=B*h,$=y*c,j=D*h,V=(S+$)/2,X=(W+j)/2;let ce=V-E,ae=X-N;Math.abs(ce)<1e-4&&(ce=1e-4);const de=ae/ce,J=s.bitmapSize.width,ie=(S-$)/2,pe=(W-j)/2,Be=ye=>({x:V+ie*ye,y:X+pe*ye}),Ue=(ye,De)=>({x:J,y:De+de*(J-ye)}),xe=Be(1),Le=Be(-1),Me=Ue(xe.x,xe.y),Fe=Ue(Le.x,Le.y);d.save(),d.beginPath(),d.moveTo(xe.x,xe.y),d.lineTo(Me.x,Me.y),d.lineTo(Fe.x,Fe.y),d.lineTo(Le.x,Le.y),d.closePath(),d.fillStyle="rgba(148, 163, 184, 0.2)",d.fill(),d.beginPath(),d.strokeStyle="rgba(148, 163, 184, 0.9)",d.lineWidth=1*h,d.moveTo(S,W),d.lineTo($,j),d.stroke(),i._levels.forEach(ye=>{const De=Be(ye.k),et=Ue(De.x,De.y);d.beginPath(),d.strokeStyle=ye.color,d.lineWidth=ye.width*h,d.moveTo(De.x,De.y),d.lineTo(et.x,et.y),d.stroke()});const we=Ue(E,N);d.beginPath(),d.strokeStyle="rgba(161, 98, 7, 0.9)",d.lineWidth=1.1*h,d.moveTo(E,N),d.lineTo(we.x,we.y),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class fy{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(i){i.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const a=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,d=s.timeScale().timeToCoordinate(A.p1.rawTime),m=o.priceToCoordinate(A.p1.price),x=s.timeScale().timeToCoordinate(A.p2.rawTime),v=o.priceToCoordinate(A.p2.price);if(d==null||m==null||x==null||v==null)return;const B=d*a,y=m*c,D=x*a,E=v*c,N=n.bitmapSize.width,S=Math.abs(D-B)<1e-4?1:D-B,W=(E-y)/S,$=D>=B?1:-1,j=$>0?N:0,V=B+$*Math.min(220*a,Math.max(80*a,N*.35)),X=A._rays.map(ae=>{const de=W*ae.ratio;return{...ae,yEnd:y+de*(j-B),yLabel:y+de*(V-B)}});h.save();const ce=(ae,de,J)=>{!ae||!de||(h.beginPath(),h.moveTo(B,y),h.lineTo(j,ae.yEnd),h.lineTo(j,de.yEnd),h.closePath(),h.fillStyle=J,h.fill())};ce(X[0],X[3],"rgba(161, 98, 7, 0.10)"),ce(X[3],X[4],"rgba(5, 150, 105, 0.10)"),ce(X[4],X[5],"rgba(107, 114, 128, 0.12)"),X.forEach(ae=>{h.beginPath(),h.strokeStyle=ae.color,h.lineWidth=1*c,h.moveTo(B,y),h.lineTo(j,ae.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=$>0?"left":"right",h.textBaseline="middle",X.forEach(ae=>{h.fillStyle=ae.color;const de=V+($>0?4*a:-4*a),J=ae.yLabel;J<-20||J>n.bitmapSize.height+20||h.fillText(ae.label,de,J)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class my{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),x=a.priceToCoordinate(i.p1.price),v=o.timeScale().timeToCoordinate(i.p2.rawTime),B=a.priceToCoordinate(i.p2.price);if(m==null||x==null||v==null||B==null)return;const y=m*c,D=x*h,E=v*c,N=B*h,S=E-y,W=N-D,$=Math.hypot(S,W);if($<1e-4)return;const j=S/$,V=W/$,X=-V,ce=j,ae=E+X*$,de=N+ce*$,J=y+X*$,ie=D+ce*$,pe=(Ue,xe)=>({x:y+j*$*Ue+X*$*xe,y:D+V*$*Ue+ce*$*xe});d.save();const Be=["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 Ue=0;Ue<i.divisions;Ue++){const xe=Ue/i.divisions,Le=(Ue+1)/i.divisions,Me=pe(0,xe),Fe=pe(1,xe),we=pe(1,Le),ye=pe(0,Le);d.beginPath(),d.moveTo(Me.x,Me.y),d.lineTo(Fe.x,Fe.y),d.lineTo(we.x,we.y),d.lineTo(ye.x,ye.y),d.closePath(),d.fillStyle=Be[Ue%Be.length],d.fill()}d.lineWidth=1*h,d.strokeStyle="rgba(148, 163, 184, 0.55)";for(let Ue=0;Ue<=i.divisions;Ue++){const xe=Ue/i.divisions,Le=pe(0,xe),Me=pe(1,xe),Fe=pe(xe,0),we=pe(xe,1);d.beginPath(),d.moveTo(Le.x,Le.y),d.lineTo(Me.x,Me.y),d.stroke(),d.beginPath(),d.moveTo(Fe.x,Fe.y),d.lineTo(we.x,we.y),d.stroke()}d.strokeStyle="rgba(100, 116, 139, 0.85)",d.lineWidth=1*h,d.beginPath(),d.moveTo(y,D),d.lineTo(ae,de),d.stroke(),d.beginPath(),d.moveTo(E,N),d.lineTo(J,ie),d.stroke(),d.strokeStyle="rgba(122, 166, 174, 0.95)",d.lineWidth=1.2*h,d.beginPath(),d.moveTo(y,D),d.lineTo(E,N),d.lineTo(ae,de),d.lineTo(J,ie),d.closePath(),d.stroke(),d.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,i,n="#16a34a",s=2,o="rgba(22, 163, 74, 0.12)"){this.p1=e,this.p2=t,this.p3=A,this.p4=i,this.color=n,this.lineWidth=s,this.fillColor=o,this.visible=!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(h=>{if(!a.visible)return;const d=a._chart,m=a._series;if(!d||!m)return;const x=h.horizontalPixelRatio,v=h.verticalPixelRatio,B=[a.p1,a.p3,a.p4,a.p2].map(j=>{const V=d.timeScale().timeToCoordinate(j.rawTime),X=m.priceToCoordinate(j.price);return V==null||X==null?null:{x:V*x,y:X*v}}).filter(Boolean);if(B.length!==4)return;const[y,D,E,N]=B,S=h.context;S.save(),S.beginPath(),S.moveTo(y.x,y.y),S.lineTo(D.x,D.y),S.lineTo(E.x,E.y),S.lineTo(N.x,N.y),S.closePath(),S.fillStyle=a.fillColor,S.fill(),S.strokeStyle=a.color,S.lineWidth=a.lineWidth*v,S.setLineDash([]),S.beginPath(),S.moveTo(y.x,y.y),S.lineTo(D.x,D.y),S.moveTo(N.x,N.y),S.lineTo(E.x,E.y),S.moveTo(y.x,y.y),S.lineTo(N.x,N.y),S.moveTo(D.x,D.y),S.lineTo(E.x,E.y),S.stroke(),S.fillStyle="#ffffff",S.strokeStyle="#3b82f6",S.lineWidth=2*v,[y,D,E,N].forEach(j=>{S.beginPath(),S.arc(j.x,j.y,6*v,0,Math.PI*2),S.fill(),S.stroke()});const W=[a.p1,a.p3,a.p2,a.p4],$=[y,D,N,E];S.fillStyle=a.color,S.font=`${Math.round(10*v)}px sans-serif`,S.textAlign="left",S.textBaseline="middle",$.forEach((j,V)=>{const X=W[V]?.price;typeof X=="number"&&S.fillText(X.toFixed(5),j.x+8*x,j.y)}),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bd extends Qa{constructor(e,t,A,i,n="#3b82f6",s=2){super(e,t,A,i,n,s,"rgba(59, 130, 246, 0.12)")}}class Td{constructor(e,t,A,i,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=i,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(a){a.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const h=o._chart,d=o._series;if(!h||!d)return;const m=c.horizontalPixelRatio,x=c.verticalPixelRatio,v=c.context,B=S=>{const W=h.timeScale().timeToCoordinate(S.rawTime),$=d.priceToCoordinate(S.price);return W==null||$==null?null:{x:W*m,y:$*x}},y=B(o.p1),D=B(o.p2),E=B(o.b2),N=B(o.b1);!y||!D||!E||!N||(v.save(),v.beginPath(),v.moveTo(y.x,y.y),v.lineTo(D.x,D.y),v.lineTo(E.x,E.y),v.lineTo(N.x,N.y),v.closePath(),v.fillStyle=o.fillColor,v.fill(),v.strokeStyle=o.strokeColor,v.lineWidth=o.lineWidth*x,v.setLineDash([]),v.beginPath(),v.moveTo(y.x,y.y),v.lineTo(D.x,D.y),v.stroke(),v.beginPath(),v.moveTo(N.x,N.y),v.lineTo(E.x,E.y),v.stroke(),v.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Fa{constructor(e,t,A,i,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=i,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(h=>{if(!a.visible)return;const d=a._chart,m=a._series;if(!d||!m)return;const x=h.horizontalPixelRatio,v=h.verticalPixelRatio,B=h.context,y=V=>{const X=d.timeScale().timeToCoordinate(V.rawTime),ce=m.priceToCoordinate(V.price);return X==null||ce==null?null:{x:X*x,y:ce*v}},D=y(a.mid1),E=y(a.mid2),N=y(a.top1),S=y(a.top2),W=y(a.bot1),$=y(a.bot2);if(!D||!E||!N||!S||!W||!$)return;B.save(),B.beginPath(),B.moveTo(D.x,D.y),B.lineTo(E.x,E.y),B.lineTo(S.x,S.y),B.lineTo(N.x,N.y),B.closePath(),B.fillStyle=a.upperFillColor,B.fill(),B.beginPath(),B.moveTo(W.x,W.y),B.lineTo($.x,$.y),B.lineTo(E.x,E.y),B.lineTo(D.x,D.y),B.closePath(),B.fillStyle=a.lowerFillColor,B.fill();const j=(V,X,ce)=>{B.beginPath(),B.strokeStyle=ce,B.lineWidth=a.lineWidth*v,B.setLineDash([]),B.moveTo(V.x,V.y),B.lineTo(X.x,X.y),B.stroke()};if(j(N,S,a.upperStrokeColor),j(D,E,a.centerStrokeColor),j(W,$,a.lowerStrokeColor),a.showDeviationLabel){const V=Math.abs(a.top1.price-a.mid1.price),X=Number.isFinite(V)?V.toFixed(5):null;if(X){const ce=Math.max(10,Math.round(10*v));B.fillStyle=a.labelColor,B.font=`${ce}px sans-serif`,B.textAlign="left",B.textBaseline="top",B.fillText(X,W.x+2*x,W.y+10*v)}}B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xd extends Fa{}class Qd{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(i){i.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const a=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,d=n.bitmapSize.width;n.bitmapSize.height;const m=A.p1.price,x=A.p2.price,v=m-x,B=V=>x+v*V,y=s.timeScale().timeToCoordinate(A.p1.rawTime),D=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(m),N=o.priceToCoordinate(x),S=y!=null&&D!=null?Math.round(Math.min(y,D)*a):0,W=y!=null&&D!=null?Math.round(Math.max(y,D)*a):d,$=W-S;h.save(),A._zoneFills.forEach(({from:V,to:X,color:ce})=>{const ae=B(V),de=B(X),J=o.priceToCoordinate(ae),ie=o.priceToCoordinate(de);if(J==null||ie==null)return;const pe=Math.round(J*c),Be=Math.round(ie*c);h.fillStyle=ce,h.fillRect(S,Math.min(pe,Be),$,Math.abs(Be-pe))}),A._levels.forEach(({ratio:V,label:X})=>{const ce=B(V),ae=o.priceToCoordinate(ce);if(ae==null)return;const de=Math.round(ae*c),J=A._levelColors[V]||"#888888";h.beginPath(),h.strokeStyle=J,h.lineWidth=V===0||V===1?1.5*c:1*c,V!==0&&V!==1&&V<1?h.setLineDash([4*a,4*a]):h.setLineDash([]),h.moveTo(S,de),h.lineTo(W,de),h.stroke(),h.setLineDash([])});const j=Math.round(11*c);if(h.font=`${j}px sans-serif`,h.textAlign="left",A._levels.forEach(({ratio:V,label:X})=>{const ce=B(V),ae=o.priceToCoordinate(ce);if(ae==null)return;const de=Math.round(ae*c),J=A._levelColors[V]||"#888888",ie=`${X} (${ce.toFixed(5)})`;h.fillStyle=J,h.textAlign="right",h.fillText(ie,S-4*a,de-4*c)}),y!=null&&D!=null&&E!=null&&N!=null){const V=Math.round(y*a),X=Math.round(E*c),ce=Math.round(D*a),ae=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(V,X),h.lineTo(ce,ae),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(V,X,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(ce,ae,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class gy{constructor(e,t="#3b82f6",A=2){this.time=e,this.color=t,this.lineWidth=A,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart;if(!o)return;const a=o.timeScale().timeToCoordinate(i.time);if(a==null)return;const c=Math.round(a*s.horizontalPixelRatio),h=s.bitmapSize.height,d=s.context;d.save(),d.beginPath(),d.strokeStyle=i.color,d.lineWidth=i.lineWidth*s.horizontalPixelRatio,d.setLineDash([]),d.moveTo(c,0),d.lineTo(c,h),d.stroke();const m=Math.round(h/2);i.midYCss=m/s.verticalPixelRatio,d.beginPath(),d.strokeStyle=i.color,d.lineWidth=1.5*s.horizontalPixelRatio;const x=5*s.horizontalPixelRatio;d.arc(c,m,x,0,Math.PI*2),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Fd(r,e){const t=typeof r=="string"?r.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const i=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${i}, ${n}, ${s}, ${e})`}function wy(r,e,t){const A=`${r??""}`,i=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/i)),o=[],a=c=>{if(!t||c.length<=s){o.push(c);return}let h=c;for(;h.length>s;){let d=h.lastIndexOf(" ",s);d<=0&&(d=s),o.push(h.slice(0,d)),h=h.slice(d).trimStart()}o.push(h)};return A.split(`
|
|
11
|
-
`).forEach(a),o.length===0&&o.push(""),o}function Ud(r,e,t){const A=r?.primitive??{},i=Number(A.fontSize)||12,n=!!A.textWrap,s=
|
|
12
|
-
`).forEach(S),N.length===0&&N.push("");const W=N.map(xe=>B.measureText(xe).width),$=Math.max(...W,20*d),j=8*d,V=5*m,X=$+j*2,ce=y*1.2,ae=ce*N.length+V*2,de=["left","center","right"].includes(i.textAlign)?i.textAlign:"center",J=x-X/2,ie=v-ae;i.bgEnabled&&(B.fillStyle=Fd(i.bgColor,Math.max(0,Math.min(1,i.bgOpacity??.1))),B.beginPath(),B.rect(J,ie,X,ae),B.fill()),i.borderEnabled&&(B.strokeStyle=Fd(i.borderColor,Math.max(0,Math.min(1,i.borderOpacity??.1))),B.lineWidth=Math.max(.5,(i.borderWidth??1)*m),B.beginPath(),B.rect(J,ie,X,ae),B.stroke()),B.fillStyle=i.color,B.textAlign=de,B.textBaseline="middle";const pe=de==="left"?J+j:de==="right"?J+X-j:J+X/2;for(let xe=0;xe<N.length;xe++)B.fillText(N[xe],pe,ie+V+ce*(xe+.5));const Be=5*m,Ue=v+10*m;B.beginPath(),B.strokeStyle="#3b82f6",B.lineWidth=1.5*m,B.arc(x,Ue,Be,0,Math.PI*2),B.stroke(),B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const Cy={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Ed(r){if(!r)return 7;const e=String(r).toUpperCase();return Cy[e]??7}function vy(r,e){const t=String(r||"").toUpperCase(),A=e||Ed(r),i={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 i=="number"?i:96));return Math.min(Math.max(n,500),5e3)}const LA=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=r.map(A=>({...A,time:q(A.time)})).filter(A=>A.time!=null);e.sort((A,i)=>A.time-i.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,i)=>A.time-i.time)};function qe(r,e,t,A,i,n){const s=i-t,o=n-A,a=Math.sqrt(s*s+o*o);if(a===0)return Math.hypot(r-t,e-A);let c=((r-t)*s+(e-A)*o)/(a*a);c=Math.max(0,Math.min(1,c));const h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function yy(r,e,t,A,i,n){const s=i-t,o=n-A,a=s*s+o*o;if(a===0)return Math.hypot(r-t,e-A);let c=((r-t)*s+(e-A)*o)/a;c<0&&(c=0);const h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function by(r,e,t,A,i,n){const s=i-t,o=n-A,a=s*s+o*o;if(a===0)return Math.hypot(r-t,e-A);const c=((r-t)*s+(e-A)*o)/a,h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function $A(r,e,t){let A=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){const s=t[i].x,o=t[i].y,a=t[n].x,c=t[n].y;o>e!=c>e&&r<(a-s)*(e-o)/(c-o+1e-7)+s&&(A=!A)}return A}function Sd(r,e,t){if(!r||!e||!t)return null;const A=r.normalizedTime??q(r.rawTime),i=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(A==null||i==null||n==null)return null;const s=i-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-r.price)/s,a=t.price+o*(A-n),c=t.price+o*(i-n),h=q((A+i)/2),d=(a+c)/2;return h==null?null:{b1:{rawTime:r.rawTime,normalizedTime:A,price:a},b2:{rawTime:e.rawTime,normalizedTime:i,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:h,normalizedTime:h,price:d}}}function as(r,e,t,A=1){if(!Array.isArray(r)||r.length<2||!e||!t)return null;const i=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(i==null||n==null)return null;const s=Math.min(i,n),o=Math.max(i,n),a=r.map(V=>({time:q(V.time),close:typeof V.close=="number"?V.close:parseFloat(V.close)})).filter(V=>V.time!=null&&Number.isFinite(V.close)&&V.time>=s&&V.time<=o).sort((V,X)=>V.time-X.time);if(a.length<2)return null;const c=a.length;let h=0,d=0,m=0,x=0;for(let V=0;V<c;V++){const X=V,ce=a[V].close;h+=X,d+=ce,m+=X*ce,x+=X*X}const v=c*x-h*h,B=Math.abs(v)<1e-12?0:(c*m-h*d)/v,y=(d-B*h)/c;let D=0;for(let V=0;V<c;V++){const X=y+B*V,ce=a[V].close-X;D+=ce*ce}const E=Math.sqrt(D/c),N=Math.max(E*A,1e-8),S=a[0].time,W=a[c-1].time,$=y,j=y+B*(c-1);return{slope:B,intercept:y,stdDev:E,offset:N,barCount:c,p1:{rawTime:S,normalizedTime:S,price:$},p2:{rawTime:W,normalizedTime:W,price:j},top1:{rawTime:S,normalizedTime:S,price:$+N},top2:{rawTime:W,normalizedTime:W,price:j+N},bot1:{rawTime:S,normalizedTime:S,price:$-N},bot2:{rawTime:W,normalizedTime:W,price:j-N}}}function Ua(r,e,t,A=1){return as(r,e,t,A)}const Ty={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}},xy={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6"};function Qy(r,e){if(!r||!r.type)return!1;const t=Ty[r.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!r[A])}function Fy(r){return r?xy[r]??"#22c55e":"#22c55e"}const Uy=300,Hd=24,Ey=150,Ld=150;function Ea(r,e,t=Uy){if(!Array.isArray(r)||r.length===0)return[];const A=jt(e),i=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of r){const a=q(o?.time);a!=null&&(n==null||a>n)&&(n=a)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+i*o});return s}function Sy(r){if(!Array.isArray(r)||r.length===0)return null;let e=null;for(const t of r){const A=q(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function Hy(r,e){let t=0,A=r.length;for(;t<A;){const i=t+A>>1;r[i]<e?t=i+1:A=i}return t}function ls(r,e,t,A){const i=q(e),n=q(t),s=jt(A)||3600,o=Math.abs((n??0)-(i??0)),a=Math.max(1,Math.round(o/s));if(!Array.isArray(r)||r.length===0)return a;if(i==null||n==null)return 1;const c=m=>{const x=Hy(r,m);if(x<=0)return 0;if(x>=r.length)return r.length-1;const v=r[x-1],B=r[x];return Math.abs(m-v)<=Math.abs(B-m)?x-1:x},h=c(i),d=c(n);return Math.max(1,Math.abs(d-h)+1)}function Ly(r,e,t){if(!r)return!1;const A=r.timeScale();if(!A)return!1;const i=Sy(e);if(i==null)return!1;const n=A.timeToCoordinate(i);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const h=A.getVisibleLogicalRange(),d=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,m=Number.isFinite(d)&&d>20?d:120,x=Math.min(Ld,m/2),v=Math.max(20,m-x),B={from:c-v,to:c+x};try{return A.setVisibleLogicalRange(B),!0}catch{}}}const s=jt(t),o=Number.isFinite(s)&&s>0?s:60,a={from:i-Ey*o,to:i+Ld*o};try{return A.setVisibleRange(a),!0}catch{return!1}}const My=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:i,onSellClick:n},s){const o=Y.useRef(null),a=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),d=Y.useRef(null),m=Y.useRef([]),x=Y.useRef(!1),v=Y.useRef(null),B=Y.useRef(null),y=Y.useRef(null),D=Y.useRef(null),E=Y.useRef([]),[N,S]=Y.useState(null),[W,$]=Y.useState(null),[j,V]=Y.useState([]),[X,ce]=Y.useState(null),[ae,de]=Y.useState([]),J=Y.useRef(null),ie=Y.useRef(null),pe=Y.useRef(null),Be=Y.useRef(!1);Y.useEffect(()=>{pe.current=N},[N]);const Ue=Y.useRef(new Map),xe=Y.useRef(null),Le=(b,w)=>`${b}_${w}`,Me=()=>{const b=Le(ze,Oe);return Ue.current.get(b)||null},Fe=b=>{if(!b)return;const w=Le(ze,Oe);Ue.current.set(w,b)},{activeTool:we,setActiveTool:ye,showGrid:De,snapToGrid:et,chartObjects:Ye,setChartObjects:be,orders:bt,selectedSymbol:ze,selectedTimeframe:Oe,drawingsVisible:Ne,chartType:ke,chartLocked:Te,theme:Ie,baseUrl:Tt,endpoints:tt,endpointParams:MA}=Qt(),Ke=Y.useRef([]),[_e,oe]=Y.useState(!1),[ne,ge]=Y.useState(null),[he,ue]=Y.useState([]),[Ee,At]=Y.useState(!0),[ht,vt]=Y.useState(null),_t=Y.useMemo(()=>{const b=he.map(w=>q(w?.time)).filter(w=>Number.isFinite(w));return b.sort((w,G)=>w-G),b},[he]),hs=Y.useRef(null),XA=Y.useRef(new Map);Y.useRef(null);const ZA=Y.useRef(0);Y.useEffect(()=>{const b=h.current;b&&b.setData(Ea(he,Oe))},[he,Oe]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const b=a.current?.timeScale();if(!b)return;const w=b.getVisibleRange();if(!w||!w.from||!w.to)return;const G=w.to-w.from,Ce=(w.from+w.to)/2,Q=G*.8;try{b.setVisibleRange({from:Ce-Q/2,to:Ce+Q/2}),Fe(b.getVisibleRange())}catch{}},zoomOut:()=>{const b=a.current?.timeScale();if(!b)return;const w=b.getVisibleRange();if(!w||!w.from||!w.to)return;const G=w.to-w.from,Ce=(w.from+w.to)/2,Q=G*1.25;try{b.setVisibleRange({from:Ce-Q/2,to:Ce+Q/2}),Fe(b.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const b=o.current;if(!b){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const w=b.querySelectorAll("canvas"),G=Ie==="light"?"#ffffff":"#12161d";let Ce=null,Q=0;if(w.forEach(F=>{if(F.width>0&&F.height>0){const ee=F.width*F.height;ee>Q&&(Q=ee,Ce=F)}}),Ce)try{const F=document.createElement("canvas");F.width=Ce.width,F.height=Ce.height;const ee=F.getContext("2d");ee.fillStyle=G,ee.fillRect(0,0,F.width,F.height),ee.drawImage(Ce,0,0);const M=document.createElement("a");M.download=`chart-${ze}-${Oe}-${Date.now()}.png`,M.href=F.toDataURL("image/png"),M.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(F){console.warn("Canvas export failed, trying html2canvas",F)}ey(b,{useCORS:!0,allowTaint:!0,backgroundColor:G,scale:2,logging:!1}).then(F=>{const ee=document.createElement("a");ee.download=`chart-${ze}-${Oe}-${Date.now()}.png`,ee.href=F.toDataURL("image/png"),ee.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(F=>{console.error("Chart screenshot failed",F),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[ze,Oe,Ie]);const cr=Y.useMemo(()=>he.length===0?[]:ke==="line"||ke==="area"?he.map(b=>({time:b.time,value:b.close})):he,[he,ke]),Rt=b=>{i?i(b):(ge("BUY"),oe(!0))},Bt=b=>{n?n(b):(ge("SELL"),oe(!0))},Jt=()=>{oe(!1),ge(null)},qt=b=>{const w=W;if(!w||!b)return;const G=(F,ee)=>{if(typeof F!="string")return ee;const M=F.trim(),le=M.startsWith("#")?M:`#${M}`;return/^#[0-9A-Fa-f]{6}$/.test(le)?le.toLowerCase():ee},Ce=(F,ee)=>{const M=Number(F);return Number.isFinite(M)?Math.max(0,Math.min(1,M)):ee};let Q={...w,visibleTimeframes:Array.isArray(b.visibleTimeframes)?[...b.visibleTimeframes]:w.visibleTimeframes};if(w.type==="text"){const F=Number.isFinite(Number(b.price))?Number(b.price):w.price,ee=w.primitive;ee&&(ee.text=typeof b.text=="string"?b.text:ee.text,ee.color=G(b.color,ee.color??"#5f8f96"),ee.fontSize=Number.isFinite(Number(b.fontSize))?Number(b.fontSize):ee.fontSize,ee.fontWeight=b.fontWeight==="bold"?"bold":"normal",ee.fontStyle=b.fontStyle==="italic"?"italic":"normal",ee.textAlign=["left","center","right"].includes(b.textAlign)?b.textAlign:ee.textAlign,ee.textWrap=!!b.textWrap,ee.borderEnabled=!!b.borderEnabled,ee.borderColor=G(b.borderColor,ee.borderColor??"#5f8f96"),ee.borderOpacity=Ce(b.borderOpacity,ee.borderOpacity??.1),ee.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(b.borderWidth))?Number(b.borderWidth):1)),ee.bgEnabled=!!b.bgEnabled,ee.bgColor=G(b.bgColor,ee.bgColor??"#5f8f96"),ee.bgOpacity=Ce(b.bgOpacity,ee.bgOpacity??.1),ee.price=F),Q={...Q,price:F,text:typeof b.text=="string"?b.text:w.text}}be(F=>{const ee=F.map(M=>M===w?Q:M);return m.current=ee,ee}),pe.current===w&&(pe.current=Q),S(F=>F===w?Q:F),ce(F=>F===w?Q:F),$(Q);try{a.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const b=o.current;if(!b)return;const w=b.getBoundingClientRect(),G=P=>{const Ae=Math.abs(Number(P));return Number.isFinite(Ae)?Ae>=1e3?Ae.toFixed(2):(Ae>=1,Ae.toFixed(5)):"0"},Ce=Ie==="light",Q=H0(b,{width:w.width||b.clientWidth,height:w.height||b.clientHeight,autoSize:!0,localization:{priceFormatter:G},layout:{background:{color:Ce?"#FFFFFF":"#0d1117",type:"solid"},textColor:Ce?"#020617":"#e6edf3",fontSize:12,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},grid:{vertLines:{visible:De,color:De?Ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?Ce?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}},rightPriceScale:{borderColor:Ce?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,textColor:Ce?"#64748b":"#8b949e"},leftPriceScale:{visible:!1},timeScale:{borderColor:Ce?"#e5e7eb":"#21262d",timeVisible:!0,secondsVisible:!1,rightOffset:12,barSpacing:6,minBarSpacing:4,shiftVisibleRangeOnNewBar:!1,fixLeftEdge:!1,fixRightEdge:!1,rightBarStaysOnScroll:!0,allowShiftVisibleRangeOnWhitespaceClick:!0},crosshair:{mode:we===1?1:0,vertLine:{width:1,color:Ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Ce?"#eff6ff":"#161b22",labelVisible:!0},horzLine:{width:1,color:Ce?"#3b82f6":"#58a6ff",style:0,labelBackgroundColor:Ce?"#eff6ff":"#161b22",labelVisible:!0},vertLineVisible:we===1,horzLineVisible:we===1},handleScroll:{mouseWheel:!0,pressedMouseMove:we===null||we===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),F=Q.addCandlestickSeries({upColor:Ce?"#089981":"#26a69a",downColor:Ce?"#f23645":"#ef5350",wickUpColor:Ce?"#089981":"#26a69a",wickDownColor:Ce?"#f23645":"#ef5350",borderUpColor:Ce?"#089981":"#26a69a",borderDownColor:Ce?"#f23645":"#ef5350",borderVisible:!0}),ee=Q.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)"});a.current=Q,c.current=F,h.current=ee,ee.setData(Ea(he,Oe)),requestAnimationFrame(()=>{if(b&&Q){const P=b.getBoundingClientRect();P.width>0&&P.height>0&&Q.resize(P.width,P.height)}});const M=Q.timeScale(),le=()=>{if(Be.current&&XA.current.size>0){const P=M.getVisibleRange();P&&Fe(P)}};M.subscribeVisibleTimeRangeChange(le);const _=new ResizeObserver(P=>{for(const Ae of P){const{width:te,height:g}=Ae.contentRect;if(te>0&&g>0&&Q){const C=M.getVisibleRange();Q.resize(te,g),C&&setTimeout(()=>{try{M.setVisibleRange(C)}catch{}},0)}}});return _.observe(b),()=>{M.unsubscribeVisibleTimeRangeChange(le),_.disconnect(),Q.remove(),a.current=null,c.current=null,h.current=null,d.current=null,m.current=[]}},[]),Y.useEffect(()=>{a.current&&a.current.applyOptions({grid:{vertLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}}})},[De]),Y.useEffect(()=>{const b=a.current;if(!b)return;const w=Ie==="light";b.applyOptions({layout:{background:{color:w?"#FFFFFF":"#12161d"},textColor:w?"#020617":"#fff"},grid:{vertLines:{color:De?w?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:De?w?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:w?"#e5e7eb":"#1e293b"},timeScale:{borderColor:w?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:w?"#3b82f6":"#58a6ff",labelBackgroundColor:w?"#eff6ff":"#161b22",width:1},horzLine:{color:w?"#3b82f6":"#58a6ff",labelBackgroundColor:w?"#eff6ff":"#161b22",width:1}}})},[Ie,De]),Y.useEffect(()=>{if(!a.current)return;const w=!Te&&!(we!==null&&we!==1&&we!==0),G=!Te;a.current.applyOptions({crosshair:{mode:we===1?1:0,vertLine:{visible:we===1,width:1,color:Ie==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ie==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:we===1,width:1,color:Ie==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:Ie==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:G,pressedMouseMove:w,horzTouchDrag:w,vertTouchDrag:w},handleScale:{axisPressedMouseMove:{time:w,price:w},axisDoubleClickReset:{time:!1,price:G},axisTouch:{time:w,price:w},mouseWheel:G,pinch:G}})},[we,Te]);const Nd=(b,w=!1)=>{b&&m.current.forEach(G=>{if(G.primitive){try{b.detachPrimitive(G.primitive)}catch{}try{b.attachPrimitive(G.primitive)}catch{}}if(w&&G.type==="pricelevel"&&G.priceLine)try{const Ce=G.priceLine.options?G.priceLine.options():{},Q=b.createPriceLine({price:G.price,color:Ce.color||"#3b82f6",lineWidth:Ce.lineWidth||2,lineStyle:Ce.lineStyle??2,axisLabelVisible:Ce.axisLabelVisible??!0,title:Ce.title||(typeof G.price=="number"?G.price.toFixed(5):"")});G.priceLine=Q}catch{}})};Y.useEffect(()=>{(async()=>{if(!ze||!Oe){ue([]),Be.current=!1;return}try{if(At(!0),vt(null),ue([]),Be.current=!1,c.current)try{c.current.setData([])}catch{}const w=Ed(Oe),G=vy(Oe,w),Ce=Tt||ry?.VITE_BASE_URL||"http://localhost:5002",Q=tt?.candles||"/api/chart/candles",F=MA?.candles||{},ee={symbol:F.symbol||"symbol",timeframe:F.timeframe||"timeframe",limit:F.limit||"limit",daysBack:F.daysBack||"daysBack"},M={};M[ee.symbol]=ze,M[ee.timeframe]=Oe,M[ee.limit]=G,F.daysBack!==!1&&(M[ee.daysBack]=w);const le=await nt.get(`${Ce}${Q}`,{params:M,timeout:1e4});let _=[];if(Array.isArray(le.data)?_=le.data:le.data&&le.data.data&&Array.isArray(le.data.data)?_=le.data.data:le.data&&Array.isArray(le.data)&&(_=le.data),_&&_.length>0){const{candles:P,stats:Ae}=Oa(_,ze,Oe);P.length>0?(ue(P),XA.current=new Map,P.forEach(te=>{XA.current.set(te.time,te)})):(console.warn(`⚠️ No valid candles after processing for ${ze}`),ue([]))}else console.warn(`⚠️ No candle data returned for ${ze}`),ue([])}catch(w){console.error(`❌ Error fetching ${ze}:`,w.message);const G=w.code==="ECONNABORTED"||w.message&&w.message.includes("timeout");vt(G?"Request timed out. No data available for this symbol.":w.message||"Failed to load candles."),ue([]),At(!1)}})()},[ze,Oe]),Y.useEffect(()=>{hs.current=hn.getSocket();const b=hs.current,w=()=>{if(ze&&Oe&&b.connected){const M={symbol:ze,timeframe:Oe};b.emit("subscribeCandles",M)}},G=()=>{setTimeout(()=>{ze&&Oe&&w()},200)},Ce=M=>{},Q=M=>{};b.on("connect",G),b.on("disconnect",Ce),b.on("connect_error",Q),b.on("subscription:confirmed",M=>{M.type});const F=M=>{if(!M||!M.candle||!M.symbol||M.symbol.toUpperCase()!==ze?.toUpperCase())return;const{candle:le}=M,_=Na(le,ze,Oe);if(!_)return;const P=Date.now();if(P-ZA.current<200)return;ZA.current=P;const Ae=a.current?.timeScale(),te=Ae?.getVisibleRange(),g=c.current,C=a.current;if(!(!g||!C||!Be.current||g?.seriesType?.()!==(ke==="line"?"Line":ke==="area"?"Area":ke==="bars"?"Bar":"Candlestick")))try{const u=XA.current.get(_.time),H=!u,U=u?{time:_.time,open:u.open,high:Math.max(u.high,_.close),low:Math.min(u.low,_.close),close:_.close}:_;XA.current.set(_.time,U),H&&h.current&&h.current.setData(Ea(Array.from(XA.current.values()),Oe));try{ke==="line"||ke==="area"?g.update({time:U.time,value:U.close}):g.update(U),Ae&&te&&Fe(te)}catch(k){throw k}}catch{}};b.on("candleUpdate",F);const ee=()=>{b.connected&&ze&&Oe&&w()};if(b.connected)ee();else{const M=()=>{setTimeout(ee,200)};b.once("connect",M),setTimeout(()=>{b.connected&&ee()},500)}return()=>{b.off("candleUpdate",F),b.off("connect",G),b.off("disconnect",Ce),b.off("connect_error",Q),b.off("subscription:confirmed"),ze&&Oe&&b.connected&&b.emit("unsubscribeCandles",{symbol:ze,timeframe:Oe})}},[ze,Oe,Tt]),Y.useEffect(()=>{const b=c.current,w=a.current;if(!b||!w){At(!1);return}if(!(he.length===0&&Be.current)){if(he.length===0&&!Be.current){if(Ee)return;const G=w.timeScale();b.setData([]),G.fitContent(),requestAnimationFrame(()=>At(!1));return}if(!Be.current){const G=w.timeScale(),Ce=Le(ze,Oe);xe.current,xe.current=Ce;const Q=[...he].sort((M,le)=>M.time-le.time);if(ke==="line"||ke==="area"){const M=Q?.map(le=>({time:le.time,value:le.close})).filter(le=>le.time!=null);M.length>0&&b.setData(M)}else Q?.length>0&&b.setData(Q);Nd(b);const F=jt(Oe)||60;if(m.current.forEach(M=>{if(M.type==="horizontalray"&&M.primitive){const g=M.rawOriginTime??M.primitive.originTime,C=$e(g,F);M.primitive.originTime=C,M.originTime=C;return}if(M.type==="verticalline"&&M.primitive){const g=M.rawTime??M.primitive.time,C=$e(g,F);M.primitive.time=C,M.time=q(C);return}if(M.type==="infoline"&&M.primitive&&M.p1&&M.p2){const g=M.rawP1Time??M.p1.rawTime,C=M.rawP2Time??M.p2.rawTime,T=Q.length>0?Q[0].time:null,f=Q.length>0?Q[Q.length-1].time:null,u=k=>{const L=$e(k,F);return T==null||f==null?L:Math.min(Math.max(L,T),f)},H=u(g),U=u(C);M.p1.rawTime=H,M.p1.normalizedTime=q(H),M.p2.rawTime=U,M.p2.normalizedTime=q(U),M.primitive.p1={rawTime:H,price:M.p1.price},M.primitive.p2={rawTime:U,price:M.p2.price};return}if(M.type==="rulerline"&&M.primitive&&M.p1&&M.p2){const g=M.rawP1Time??M.p1.rawTime,C=M.rawP2Time??M.p2.rawTime,T=Q.length>0?Q[0].time:null,f=Q.length>0?Q[Q.length-1].time:null,u=I=>{const O=$e(I,F);return T==null||f==null?O:Math.min(Math.max(O,T),f)},H=u(g),U=u(C);M.p1.rawTime=H,M.p2.rawTime=U,M.primitive.p1={rawTime:H,price:M.p1.price},M.primitive.p2={rawTime:U,price:M.p2.price};const k=q(H),L=q(U),p=Math.abs((L??0)-(k??0));M.primitive.info={priceDiff:M.p2.price-M.p1.price,pricePct:(M.p2.price-M.p1.price)/Math.abs(M.p1.price||1)*100,bars:ls(_t,H,U,Oe),days:Math.max(1,Math.round(p/86400))};return}if(M.type==="arrowedline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,T=$e(g,F),f=$e(C,F);M.p1.rawTime=T,M.p1.normalizedTime=q(T),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:T,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="rayline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,T=$e(g,F),f=$e(C,F);M.p1.rawTime=T,M.p1.normalizedTime=q(T),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:T,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="extendedline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,T=$e(g,F),f=$e(C,F);M.p1.rawTime=T,M.p1.normalizedTime=q(T),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:T,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="trendbyangle"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,T=$e(g,F),f=$e(C,F);M.p1.rawTime=T,M.p1.normalizedTime=q(T),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:T,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="disjointchannel"&&M.primitive&&M.p1&&M.p2&&M.p3&&M.p4){const g=C=>{const T=$e(C.rawTime,F);C.rawTime=T,C.normalizedTime=q(T)};g(M.p1),g(M.p2),g(M.p3),g(M.p4),M.primitive.p1={rawTime:M.p1.rawTime,price:M.p1.price},M.primitive.p2={rawTime:M.p2.rawTime,price:M.p2.price},M.primitive.p3={rawTime:M.p3.rawTime,price:M.p3.price},M.primitive.p4={rawTime:M.p4.rawTime,price:M.p4.price};return}if(M.type==="flattopbottom"&&M.primitive&&M.p1&&M.p2&&M.p3&&M.p4){const g=C=>{const T=$e(C.rawTime,F);C.rawTime=T,C.normalizedTime=q(T)};g(M.p1),g(M.p2),g(M.p3),g(M.p4),M.primitive.p1={rawTime:M.p1.rawTime,price:M.p1.price},M.primitive.p2={rawTime:M.p2.rawTime,price:M.p2.price},M.primitive.p3={rawTime:M.p3.rawTime,price:M.p3.price},M.primitive.p4={rawTime:M.p4.rawTime,price:M.p4.price};return}if(M.type!=="trendline"&&M.type!=="gannline"||!M.series||!M.point1||!M.point2)return;const le=M.point1.rawTime??M.point1.time,_=M.point2.rawTime??M.point2.time,P=$e(le,F),Ae=$e(_,F);M.point1.time=P,M.point2.time=Ae;const te=LA([{time:P,value:M.point1.price},{time:Ae,value:M.point2.price}]);try{te.length>0&&M.series.setData(te)}catch{}}),Q?.length>0){const M=Q[Q?.length-1].time,le=jt(Oe)||60,P=M-(Oe==="M1"?150:Oe==="M5"?120:100)*le;try{G.setVisibleRange({from:P,to:M+le*Hd})}catch{G.fitContent()}}else G.fitContent();try{w.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Be.current=!0;const ee=G.getVisibleRange();Fe(ee),requestAnimationFrame(()=>At(!1))}}},[he.length,ke,ze,Oe]),Y.useEffect(()=>{const b=a.current;if(!b||!Be.current||he.length===0)return;const w=b.timeScale(),G=w.getVisibleRange()||Me();if(c.current)try{b.removeSeries(c.current)}catch{}if(d.current)try{b.removeSeries(d.current),d.current=null}catch{}let Ce;if(ke==="bars"){const F=Ie==="light";Ce=b.addBarSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const ee=[...he].sort((M,le)=>M.time-le.time);ee?.length>0&&Ce.setData(ee)}else if(ke==="line"){Ce=b.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const F=LA(cr);F.length>0&&Ce.setData(F)}else if(ke==="area"){Ce=b.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const F=LA(cr);F.length>0&&Ce.setData(F)}else if(ke==="volume ticks"||ke==="volume"){const F=Ie==="light";Ce=b.addCandlestickSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",wickUpColor:F?"#089981":"#26A69A",wickDownColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const ee=[...he].sort((_,P)=>_.time-P.time);ee?.length>0&&Ce.setData(ee);const M=b.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});b.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),b.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const le=ee?.map(_=>({time:_.time,value:_.volume||0,color:_.close>=_.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));le.length>0&&M.setData(le),d.current=M}else{const F=Ie==="light";Ce=b.addCandlestickSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",wickUpColor:F?"#089981":"#26A69A",wickDownColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const ee=[...he].sort((M,le)=>M.time-le.time);ee?.length>0&&Ce.setData(ee)}c.current=Ce,Nd(Ce,!0);const Q=jt(Oe)||60;if(m.current.forEach(F=>{if(F.type==="horizontalray"&&F.primitive){const g=F.rawOriginTime??F.primitive.originTime,C=$e(g,Q);F.primitive.originTime=C,F.originTime=C;return}if(F.type==="verticalline"&&F.primitive){const g=F.rawTime??F.primitive.time,C=$e(g,Q);F.primitive.time=C,F.time=q(C);return}if(F.type==="infoline"&&F.primitive&&F.p1&&F.p2){const g=F.rawP1Time??F.p1.rawTime,C=F.rawP2Time??F.p2.rawTime,T=[...he].sort((L,p)=>L.time-p.time),f=T.length>0?T[0].time:null,u=T.length>0?T[T.length-1].time:null,H=L=>{const p=$e(L,Q);return f==null||u==null?p:Math.min(Math.max(p,f),u)},U=H(g),k=H(C);F.p1.rawTime=U,F.p1.normalizedTime=q(U),F.p2.rawTime=k,F.p2.normalizedTime=q(k),F.primitive.p1={rawTime:U,price:F.p1.price},F.primitive.p2={rawTime:k,price:F.p2.price};return}if(F.type==="rulerline"&&F.primitive&&F.p1&&F.p2){const g=F.rawP1Time??F.p1.rawTime,C=F.rawP2Time??F.p2.rawTime,T=[...he].sort((O,K)=>O.time-K.time),f=T.length>0?T[0].time:null,u=T.length>0?T[T.length-1].time:null,H=O=>{const K=$e(O,Q);return f==null||u==null?K:Math.min(Math.max(K,f),u)},U=H(g),k=H(C);F.p1.rawTime=U,F.p2.rawTime=k,F.primitive.p1={rawTime:U,price:F.p1.price},F.primitive.p2={rawTime:k,price:F.p2.price};const L=q(U),p=q(k),I=Math.abs((p??0)-(L??0));F.primitive.info={priceDiff:F.p2.price-F.p1.price,pricePct:(F.p2.price-F.p1.price)/Math.abs(F.p1.price||1)*100,bars:ls(_t,U,k,Oe),days:Math.max(1,Math.round(I/86400))};return}if(F.type==="arrowedline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,T=$e(g,Q),f=$e(C,Q);F.p1.rawTime=T,F.p1.normalizedTime=q(T),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:T,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="rayline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,T=$e(g,Q),f=$e(C,Q);F.p1.rawTime=T,F.p1.normalizedTime=q(T),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:T,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="extendedline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,T=$e(g,Q),f=$e(C,Q);F.p1.rawTime=T,F.p1.normalizedTime=q(T),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:T,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="trendbyangle"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,T=$e(g,Q),f=$e(C,Q);F.p1.rawTime=T,F.p1.normalizedTime=q(T),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:T,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="disjointchannel"&&F.primitive&&F.p1&&F.p2&&F.p3&&F.p4){const g=C=>{const T=$e(C.rawTime,Q);C.rawTime=T,C.normalizedTime=q(T)};g(F.p1),g(F.p2),g(F.p3),g(F.p4),F.primitive.p1={rawTime:F.p1.rawTime,price:F.p1.price},F.primitive.p2={rawTime:F.p2.rawTime,price:F.p2.price},F.primitive.p3={rawTime:F.p3.rawTime,price:F.p3.price},F.primitive.p4={rawTime:F.p4.rawTime,price:F.p4.price};return}if(F.type==="flattopbottom"&&F.primitive&&F.p1&&F.p2&&F.p3&&F.p4){const g=C=>{const T=$e(C.rawTime,Q);C.rawTime=T,C.normalizedTime=q(T)};g(F.p1),g(F.p2),g(F.p3),g(F.p4),F.primitive.p1={rawTime:F.p1.rawTime,price:F.p1.price},F.primitive.p2={rawTime:F.p2.rawTime,price:F.p2.price},F.primitive.p3={rawTime:F.p3.rawTime,price:F.p3.price},F.primitive.p4={rawTime:F.p4.rawTime,price:F.p4.price};return}if(F.type!=="trendline"&&F.type!=="gannline"||!F.series||!F.point1||!F.point2)return;const ee=F.type==="gannline"?"#7aa6ae":"#22c55e";try{b.removeSeries(F.series)}catch{}const M=b.addLineSeries({color:ee,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1}),le=F.point1.rawTime??F.point1.time,_=F.point2.rawTime??F.point2.time,P=$e(le,Q),Ae=$e(_,Q);F.point1.time=P,F.point2.time=Ae;const te=LA([{time:P,value:F.point1.price},{time:Ae,value:F.point2.price}]);try{te.length>0&&M.setData(te)}catch{}F.series=M}),G&&Be.current)setTimeout(()=>{try{w.setVisibleRange(G),Fe(G)}catch{if(he.length>0)try{const ee=he[he.length-1].time,M=jt(Oe)||60,le=ee-100*M;w.setVisibleRange({from:le,to:ee+M*Hd}),Fe(w.getVisibleRange())}catch{w.fitContent(),Fe(w.getVisibleRange())}}try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!Be.current){w.fitContent();try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Be.current=!0,Fe(w.getVisibleRange())}},[ke,he.length,cr.length]),Y.useEffect(()=>{const b=a.current,w=d.current;if(!b||!w||!Be.current||he.length===0||ke!=="volume"&&ke!=="volume ticks")return;const Ce=[...he].sort((Q,F)=>Q.time-F.time)?.map(Q=>({time:Q.time,value:Q.volume||0,color:Q.close>=Q.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Ce.length>0&&w.setData(Ce)},[he,ke]),Y.useEffect(()=>{const b=a.current,w=c.current,G=o.current;if(!b||!w||!G)return;const Q=we!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][we]:null,F=(_,P)=>{const Ae=Math.min(_.time,P.time),te=Math.max(_.time,P.time),g=_.time<=P.time?_.rawTime:P.rawTime,C=_.time<=P.time?P.rawTime:_.rawTime,T=Math.max(_.price,P.price),f=Math.min(_.price,P.price),u=q(Math.round((Ae+te)/2));return u==null?null:{p1:{rawTime:u,normalizedTime:u,price:T},p2:{rawTime:g,normalizedTime:Ae,price:f},p3:{rawTime:C,normalizedTime:te,price:f}}};if(!Q){if(x.current=!1,v.current=null,B.current=null,D.current=null,y.current?.series)try{b.removeSeries(y.current.series)}catch{}if(y.current?.primitive)try{w.detachPrimitive(y.current.primitive)}catch{}y.current=null;return}if(Q==="pricelevel"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const u={type:"pricelevel",priceLine:w.createPriceLine({price:T,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:T.toFixed(5)}),price:T};be(H=>[...H,u]),m.current.push(u),ye(null)};return G.addEventListener("click",_),()=>{G.removeEventListener("click",_)}}if(Q==="horizontalray"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=new iy(T,C);w.attachPrimitive(f);const u=q(C),H={type:"horizontalray",primitive:f,price:T,originTime:u,rawOriginTime:C};be(U=>[...U,H]),m.current.push(H),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="verticalline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=b.timeScale().coordinateToTime(te);if(g==null)return;const C=new gy(g);w.attachPrimitive(C);const T=q(g),f={type:"verticalline",primitive:C,time:T,rawTime:g};be(u=>[...u,f]),m.current.push(f),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="text"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=new By(C,T);w.attachPrimitive(f);const u={type:"text",primitive:f,rawTime:C,price:T,text:"Text"};be(H=>[...H,u]),m.current.push(u),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="infoline"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(u==null||H==null)return;P||(P=b.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const U=_.normalizedTime,k=q(u);if(U==null||k==null||U===k)return;const L=U<=k?[{time:U,value:_.price},{time:k,value:H}]:[{time:k,value:H},{time:U,value:_.price}];try{P.setData(L)}catch{}},te=g=>{const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u),x:T,y:f};return}if(P){try{b.removeSeries(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null)return;const L=H-_.price,p=L/Math.abs(_.price)*100,I=jt(Oe)||3600,O=Math.abs(k-U),K=Math.max(1,Math.round(O/I)),z=Math.max(1,Math.round(O/86400)),R=_.x,Z=_.y,se=T,ve=Math.atan2(-(f-Z),se-R)*(180/Math.PI),He={priceDiff:L,pricePct:p,bars:K,days:z,angle:ve},Pe=new ny({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H},He);w.attachPrimitive(Pe);const Ge={type:"infoline",primitive:Pe,rawP1Time:_.rawTime,rawP2Time:u,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(Re=>[...Re,Ge]),m.current.push(Ge),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{b.removeSeries(P)}catch{}}}if(Q==="rulerline"){let _=null,P=null;const Ae=(C,T,f,u)=>{const H=q(C),U=q(f),k=u-T,L=k/Math.abs(T)*100,p=ls(_t,C,f,Oe),I=Math.abs((U??0)-(H??0)),O=Math.max(1,Math.round(I/86400));return{priceDiff:k,pricePct:L,bars:p,days:O}},te=C=>{if(!_)return;const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null||k===_.normalizedTime)return;const L=Ae(_.rawTime,_.price,H,U);if(!P)P=new vd({rawTime:_.rawTime,price:_.price},{rawTime:H,price:U},L),w.attachPrimitive(P);else{P.p2={rawTime:H,price:U},P.info=L;const p=U>=_.price;P.color=p?"#3b82f6":"#ef5350",P.fillColor=p?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}},g=C=>{const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;if(!_){_={rawTime:H,price:U,normalizedTime:q(H)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const k=_.normalizedTime,L=q(H);if(k==null||L==null)return;const p=Ae(_.rawTime,_.price,H,U),I=new vd({rawTime:_.rawTime,price:_.price},{rawTime:H,price:U},p);w.attachPrimitive(I);const O={type:"rulerline",primitive:I,rawP1Time:_.rawTime,rawP2Time:H,p1:{rawTime:_.rawTime,normalizedTime:k,price:_.price},p2:{rawTime:H,normalizedTime:L,price:U}};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="arrowedline"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(u==null||H==null)return;const U=q(u);if(!(U==null||U===_.normalizedTime))if(!P)P=new yd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H}),w.attachPrimitive(P);else{P.p2={rawTime:u,price:H};try{a.current?.applyOptions({})}catch{}}},te=g=>{const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null||U===k)return;const L=new yd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H});w.attachPrimitive(L);const p={type:"arrowedline",primitive:L,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(I=>[...I,p]),m.current.push(p),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="rayline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new cy({rawTime:C,price:T},{rawTime:u,price:T});w.attachPrimitive(k);const L={type:"rayline",primitive:k,p1:{rawTime:C,normalizedTime:H,price:T},p2:{rawTime:u,normalizedTime:U,price:T}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="extendedline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new hy({rawTime:C,price:T},{rawTime:u,price:T});w.attachPrimitive(k);const L={type:"extendedline",primitive:k,p1:{rawTime:C,normalizedTime:H,price:T},p2:{rawTime:u,normalizedTime:U,price:T}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="crossline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=q(C);if(f==null)return;const u=new uy({rawTime:C,price:T});w.attachPrimitive(u);const H={type:"crossline",primitive:u,p:{rawTime:C,normalizedTime:f,price:T}};be(U=>[...U,H]),m.current.push(H),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="trendbyangle"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new dy({rawTime:C,price:T},{rawTime:u,price:T});w.attachPrimitive(k);const L={type:"trendbyangle",primitive:k,p1:{rawTime:C,normalizedTime:H,price:T},p2:{rawTime:u,normalizedTime:U,price:T}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="disjointchannel"){let _=null,P=null,Ae=null,te=null,g=0,C=null;const T=(H,U,k,L)=>{if(!C)C=new Qa(H,U,k,L),w.attachPrimitive(C);else{C.p1=H,C.p2=U,C.p3=k,C.p4=L;try{a.current?.applyOptions({})}catch{}}},f=H=>{if(g===0||!_)return;const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top;if(g===1){const p=w.coordinateToPrice(L);if(p==null)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:p},T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===2&&P){const p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O==null)return;const K=(_.price+P.price)/2;I>=K?(Ae={rawTime:p,normalizedTime:O,price:I},te={rawTime:p,normalizedTime:O,price:2*K-I}):(te={rawTime:p,normalizedTime:O,price:I},Ae={rawTime:p,normalizedTime:O,price:2*K-I}),T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:Ae.rawTime,price:Ae.price},{rawTime:te.rawTime,price:te.price})}},u=H=>{const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top,p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O!=null){if(g===0){_={rawTime:p,normalizedTime:O,price:I},P={rawTime:p,normalizedTime:O,price:I},g=1,T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===1){const K=w.coordinateToPrice(L);if(K==null||Math.abs(K-_.price)<1e-7)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:K},g=2;return}if(g===2&&C){try{w.detachPrimitive(C)}catch{}const K=new Qa(C.p1,C.p2,C.p3,C.p4);w.attachPrimitive(K);const z={type:"disjointchannel",primitive:K,p1:_,p2:P,p3:{rawTime:C.p3.rawTime,normalizedTime:q(C.p3.rawTime),price:C.p3.price},p4:{rawTime:C.p4.rawTime,normalizedTime:q(C.p4.rawTime),price:C.p4.price}};be(R=>[...R,z]),m.current.push(z),ye(null)}}};return G.addEventListener("mousemove",f),G.addEventListener("click",u),()=>{if(G.removeEventListener("mousemove",f),G.removeEventListener("click",u),C)try{w.detachPrimitive(C)}catch{}}}if(Q==="flattopbottom"){let _=null,P=null,Ae=null,te=null,g=0,C=null;const T=(H,U,k,L)=>{if(!C)C=new bd(H,U,k,L),w.attachPrimitive(C);else{C.p1=H,C.p2=U,C.p3=k,C.p4=L;try{a.current?.applyOptions({})}catch{}}},f=H=>{if(g===0||!_)return;const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top;if(g===1){const p=w.coordinateToPrice(L);if(p==null)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:p},T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===2&&P){const p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O==null)return;Ae={rawTime:p,normalizedTime:O,price:I},te={rawTime:p,normalizedTime:O,price:P.price},T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:Ae.rawTime,price:Ae.price},{rawTime:te.rawTime,price:te.price})}},u=H=>{const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top,p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O!=null){if(g===0){_={rawTime:p,normalizedTime:O,price:I},P={rawTime:p,normalizedTime:O,price:I},g=1,T({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===1){const K=w.coordinateToPrice(L);if(K==null||Math.abs(K-_.price)<1e-7)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:K},g=2;return}if(g===2&&C){try{w.detachPrimitive(C)}catch{}const K=new bd(C.p1,C.p2,C.p3,C.p4);w.attachPrimitive(K);const z={type:"flattopbottom",primitive:K,p1:_,p2:P,p3:{rawTime:C.p3.rawTime,normalizedTime:q(C.p3.rawTime),price:C.p3.price},p4:{rawTime:C.p4.rawTime,normalizedTime:q(C.p4.rawTime),price:C.p4.price}};be(R=>[...R,z]),m.current.push(z),ye(null)}}};return G.addEventListener("mousemove",f),G.addEventListener("click",u),()=>{if(G.removeEventListener("mousemove",f),G.removeEventListener("click",u),C)try{w.detachPrimitive(C)}catch{}}}if(Q==="regressionchannel"){let _=null,P=null;const Ae=(C,T)=>{C.mid1={rawTime:T.p1.rawTime,price:T.p1.price},C.mid2={rawTime:T.p2.rawTime,price:T.p2.price},C.top1={rawTime:T.top1.rawTime,price:T.top1.price},C.top2={rawTime:T.top2.rawTime,price:T.top2.price},C.bot1={rawTime:T.bot1.rawTime,price:T.bot1.price},C.bot2={rawTime:T.bot2.rawTime,price:T.bot2.price}},te=C=>{if(!_)return;const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;const p=as(he,_,{rawTime:H,normalizedTime:k},1);if(p)if(!P)P=new Fa({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price}),w.attachPrimitive(P);else{Ae(P,p);try{b.applyOptions({})}catch{}}},g=C=>{const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;if(!_){_={rawTime:H,normalizedTime:k,price:U};return}const p=as(he,_,{rawTime:H,normalizedTime:k},1);if(!p)return;if(P){try{w.detachPrimitive(P)}catch{}P=null}const I=new Fa({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price});w.attachPrimitive(I);const O={type:"regressionchannel",primitive:I,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,stdMultiplier:1};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="stddevchannel"){let _=null,P=null;const Ae=(C,T)=>{C.mid1={rawTime:T.p1.rawTime,price:T.p1.price},C.mid2={rawTime:T.p2.rawTime,price:T.p2.price},C.top1={rawTime:T.top1.rawTime,price:T.top1.price},C.top2={rawTime:T.top2.rawTime,price:T.top2.price},C.bot1={rawTime:T.bot1.rawTime,price:T.bot1.price},C.bot2={rawTime:T.bot2.rawTime,price:T.bot2.price}},te=C=>{if(!_)return;const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;const p=Ua(he,_,{rawTime:H,normalizedTime:k},1);if(p)if(!P)P=new xd({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price}),w.attachPrimitive(P);else{Ae(P,p);try{b.applyOptions({})}catch{}}},g=C=>{const T=G.getBoundingClientRect(),f=C.clientX-T.left,u=C.clientY-T.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;if(!_){_={rawTime:H,normalizedTime:k,price:U};return}const p=Ua(he,_,{rawTime:H,normalizedTime:k},1);if(!p)return;if(P){try{w.detachPrimitive(P)}catch{}P=null}const I=new xd({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price});w.attachPrimitive(I);const O={type:"stddevchannel",primitive:I,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,stdMultiplier:1};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="andrewspitchfork"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=q(C);if(f==null)return;const u=te+140,H=b.timeScale().coordinateToTime(u);if(H==null)return;const U=q(H);if(U==null)return;const k={rawTime:C,normalizedTime:f,price:T},L={rawTime:H,normalizedTime:U,price:T},p={rawTime:C,normalizedTime:f,price:T},I=new py({rawTime:k.rawTime,price:k.price},{rawTime:L.rawTime,price:L.price},{rawTime:p.rawTime,price:p.price});w.attachPrimitive(I);const O={type:"andrewspitchfork",primitive:I,p1:k,p2:L,p3:p};be(K=>[...K,O]),m.current.push(O),S(O),pe.current=O,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="gannfan"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=q(C);if(f==null)return;const u={rawTime:C,normalizedTime:f,price:T},H={rawTime:C,normalizedTime:f,price:T},U=new fy({rawTime:u.rawTime,price:u.price},{rawTime:H.rawTime,price:H.price});w.attachPrimitive(U);const k={type:"gannfan",primitive:U,p1:u,p2:H};be(L=>[...L,k]),m.current.push(k),S(k),pe.current=k,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="ganngrid"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),T=w.coordinateToPrice(g);if(C==null||T==null)return;const f=q(C);if(f==null)return;const u={rawTime:C,normalizedTime:f,price:T},H={rawTime:C,normalizedTime:f,price:T},U=new my({rawTime:u.rawTime,price:u.price},{rawTime:H.rawTime,price:H.price});w.attachPrimitive(U);const k={type:"ganngrid",primitive:U,p1:u,p2:H};be(L=>[...L,k]),m.current.push(k),S(k),pe.current=k,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="trendline"||Q==="gannline"){const _=Q,P=_==="gannline"?"#7aa6ae":"#22c55e",Ae=T=>{T.preventDefault(),T.stopPropagation(),T.stopImmediatePropagation();const f=G.getBoundingClientRect(),u=T.clientX-f.left,H=T.clientY-f.top;let U=b.timeScale().coordinateToTime(u);const k=w.coordinateToPrice(H);if(!(U==null||k==null)&&(U=q(U),U!=null))if(D.current===null){D.current={time:U,price:k};const L=b.addLineSeries({color:P,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});y.current={type:_,series:L},L.setData([{time:U,value:k}])}else{const L=D.current,p={time:U,price:k},I=1,O=1e-5,K=Math.abs(p.time-L.time),z=Math.abs(p.price-L.price);if(K<I&&z<O){try{b.removeSeries(y.current.series)}catch{}D.current=null,y.current=null;return}const R={time:L.time,rawTime:L.time,price:L.price},Z={time:p.time,rawTime:p.time,price:p.price},se=LA([{time:R.time,value:R.price},{time:Z.time,value:Z.price}]);if(se.length>0){y.current.series.setData(se);const fe={type:_,series:y.current.series,point1:R,point2:Z};be(ve=>[...ve,fe]),m.current.push(fe)}ye(null),D.current=null,y.current=null}},te=T=>{if(D.current===null||y.current?.type!=="trendline"&&y.current?.type!=="gannline")return;T.preventDefault(),T.stopPropagation();const f=G.getBoundingClientRect(),u=T.clientX-f.left,H=T.clientY-f.top;let U=b.timeScale().coordinateToTime(u);const k=w.coordinateToPrice(H);if(U==null||k==null||(U=q(U),U==null))return;const L=D.current,p=LA([{time:L.time,value:L.price},{time:U,value:k}]);p.length>0&&y.current.series.setData(p)},g=T=>{T.stopPropagation()},C={capture:!0,passive:!1};return G.addEventListener("click",Ae,C),G.addEventListener("mousemove",te,C),G.addEventListener("mousemove",g,C),()=>{if(D.current=null,(y.current?.type==="trendline"||y.current?.type==="gannline")&&y.current?.series){try{b.removeSeries(y.current.series)}catch{}y.current=null}G.removeEventListener("click",Ae,C),G.removeEventListener("mousemove",te,C),G.removeEventListener("mousemove",g,C)}}if(Q==="parallellines"){let _=null,P=null,Ae=null,te=0,g=null;const C=(k,L,p,I)=>{k.p1={rawTime:L.rawTime,price:L.price},k.p2={rawTime:p.rawTime,price:p.price},k.b1={rawTime:I.b1.rawTime,price:I.b1.price},k.b2={rawTime:I.b2.rawTime,price:I.b2.price},k.p3={rawTime:I.bottomMid.rawTime,price:I.bottomMid.price}},T=(k,L,p)=>{const I=Sd(k,L,p);if(!I)return null;if(!g)g=new Td({rawTime:k.rawTime,price:k.price},{rawTime:L.rawTime,price:L.price},{rawTime:I.b1.rawTime,price:I.b1.price},{rawTime:I.b2.rawTime,price:I.b2.price},{rawTime:I.bottomMid.rawTime,price:I.bottomMid.price}),w.attachPrimitive(g);else{C(g,k,L,I);try{b.applyOptions({})}catch{}}return I},f=k=>{k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const L=G.getBoundingClientRect(),p=k.clientX-L.left,I=k.clientY-L.top,O=b.timeScale().coordinateToTime(p),K=w.coordinateToPrice(I);if(O==null||K==null)return;const z=q(O);if(z!=null){if(te===0){_={rawTime:O,normalizedTime:z,price:K},te=1;return}if(te===1){if(P={rawTime:O,normalizedTime:z,price:K},Math.abs(P.normalizedTime-_.normalizedTime)<1)return;const R=q((_.normalizedTime+P.normalizedTime)/2);if(R==null)return;const Z=(_.price+P.price)/2;Ae={rawTime:R,normalizedTime:R,price:Z},T(_,P,Ae),te=2;return}if(te===2&&_&&P){Ae={rawTime:O,normalizedTime:z,price:K};const R=T(_,P,Ae);if(!R||!g)return;try{w.detachPrimitive(g)}catch{}const Z=new Td({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:R.b1.rawTime,price:R.b1.price},{rawTime:R.b2.rawTime,price:R.b2.price},{rawTime:R.bottomMid.rawTime,price:R.bottomMid.price});w.attachPrimitive(Z);const se={type:"equidistantchannel",primitive:Z,p1:_,p2:P,p3:R.bottomMid,b1:R.b1,b2:R.b2,bottomMid:R.bottomMid};be(fe=>[...fe,se]),m.current.push(se),ye(null),te=0,_=null,P=null,Ae=null,g=null}}},u=k=>{if(te===0||!_)return;const L=G.getBoundingClientRect(),p=k.clientX-L.left,I=k.clientY-L.top,O=b.timeScale().coordinateToTime(p),K=w.coordinateToPrice(I);if(O==null||K==null)return;const z=q(O);if(z!=null){if(te===1){const R={rawTime:O,normalizedTime:z,price:K},Z=q((_.normalizedTime+R.normalizedTime)/2);if(Z==null)return;const se=(_.price+R.price)/2;T(_,R,{rawTime:Z,normalizedTime:Z,price:se});return}te===2&&P&&T(_,P,{rawTime:O,normalizedTime:z,price:K})}},H=k=>{k.stopPropagation()},U={capture:!0,passive:!1};return G.addEventListener("click",f,U),G.addEventListener("mousemove",u,U),G.addEventListener("mousemove",H,U),()=>{if(te=0,_=null,P=null,Ae=null,E.current=[],g)try{w.detachPrimitive(g)}catch{}g=null,G.removeEventListener("click",f,U),G.removeEventListener("mousemove",u,U),G.removeEventListener("mousemove",H,U)}}if(Q==="fibonacci"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(!(u==null||H==null))if(!P)P=new Qd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H}),w.attachPrimitive(P);else{P.p2={rawTime:u,price:H};try{b.applyOptions({})}catch{}}},te=g=>{const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(T),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null)return;if(Math.abs(H-_.price)<1e-5){_=null;return}const L=new Qd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H});w.attachPrimitive(L);const p={type:"fibonacci",primitive:L,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(I=>[...I,p]),m.current.push(p),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{w.detachPrimitive(P)}catch{}}}if(D.current=null,(y.current?.type==="trendline"||y.current?.type==="gannline")&&y.current?.series){try{b.removeSeries(y.current.series)}catch{}y.current=null}const ee=_=>{if(_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),Q==="trendline"||Q==="gannline"||Q==="parallellines"||Q==="fibonacci"||Q!=="rectangle"&&Q!=="circle"&&Q!=="triangle"&&Q!=="ellipse")return;const P=G.getBoundingClientRect(),Ae=_.clientX-P.left,te=_.clientY-P.top;let g=b.timeScale().coordinateToTime(Ae);const C=w.coordinateToPrice(te);if(g==null||C==null)return;const T=g;if(g=q(g),g!=null){if(x.current=!0,v.current={time:g,normalizedTime:g,rawTime:T,price:C},B.current=null,Q==="rectangle"){const f=new sy({rawTime:T,price:C},{rawTime:T,price:C},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});w.attachPrimitive(f),y.current={type:"rectangle",primitive:f}}if(Q==="circle"){const f=new oy({rawTime:T,price:C},{rawTime:T,price:C},{strokeColor:"#7aa6ae",lineWidth:1});w.attachPrimitive(f),y.current={type:"circle",primitive:f}}if(Q==="triangle"){const f=new ay({rawTime:T,price:C},{rawTime:T,price:C},{rawTime:T,price:C},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});w.attachPrimitive(f),y.current={type:"triangle",primitive:f}}if(Q==="ellipse"){const f=new ly({rawTime:T,price:C},{rawTime:T,price:C},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});w.attachPrimitive(f),y.current={type:"ellipse",primitive:f}}if(Q==="parallellines"){const f=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});y.current={type:"parallellines",series:f,firstLine:null,secondLine:null}}}},M=_=>{if(!x.current||!v.current||!y.current)return;_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation();const P=G.getBoundingClientRect(),Ae=_.clientX-P.left,te=_.clientY-P.top;let g=b.timeScale().coordinateToTime(Ae);const C=w.coordinateToPrice(te);if(g==null||C==null)return;const T=g;if(g=q(g),g==null)return;B.current={time:g,normalizedTime:g,rawTime:T,price:C};const f=v.current;if(y.current.type==="rectangle"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:T,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="circle"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:T,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="triangle"){const u=y.current.primitive,H=F(f,{time:g,rawTime:T,price:C});if(!H)return;u.p1={rawTime:H.p1.rawTime,price:H.p1.price},u.p2={rawTime:H.p2.rawTime,price:H.p2.price},u.p3={rawTime:H.p3.rawTime,price:H.p3.price};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="ellipse"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:T,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="parallellines")if(y.current.firstLine){const u=y.current.firstLine;u.endTime-u.startTime;const H=u.endPrice-u.startPrice,U=C,k=U+H;if(y.current.secondLine)y.current.secondLine.setData([{time:f.time,value:U},{time:g,value:k}]);else{const L=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});L.setData([{time:f.time,value:U},{time:g,value:k}]),y.current.secondLine=L}}else y.current.series.setData([{time:f.time,value:f.price},{time:g,value:C}])},le=_=>{if(_&&(_.preventDefault(),_.stopPropagation()),!x.current||!y.current||!v.current)return;const P=v.current,Ae=B.current||P;if(y.current.type==="parallellines")if(y.current.firstLine){const te={type:"parallellines",firstLine:y.current.series,secondLine:y.current.secondLine,firstLineData:y.current.firstLine};be(g=>[...g,te]),m.current.push(te),ye(null),y.current=null,x.current=!1,v.current=null,B.current=null;return}else{y.current.firstLine={startTime:P.time,startPrice:P.price,endTime:Ae.time,endPrice:Ae.price},x.current=!1,v.current=null,B.current=null;return}if(y.current.type==="rectangle"){const te=v.current,g=B.current||te,C=Math.max(te.price,g.price),T=Math.min(te.price,g.price),f=q(Math.min(te.time,g.time)),u=q(Math.max(te.time,g.time));if(f!=null&&u!=null&&Math.abs(u-f)>=1&&Math.abs(C-T)>=1e-5){const H=y.current.primitive,U=te.time<=g.time?te.rawTime:g.rawTime,k=te.time<=g.time?g.rawTime:te.rawTime,L={rawTime:U,normalizedTime:f,price:C},p={rawTime:k,normalizedTime:u,price:T};H.p1={rawTime:L.rawTime,price:L.price},H.p2={rawTime:p.rawTime,price:p.price};const I={type:"rectangle",primitive:H,p1:L,p2:p};be(O=>[...O,I]),m.current.push(I),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="circle"){const te=y.current.primitive,g={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},C={rawTime:Ae.rawTime,normalizedTime:Ae.time,price:Ae.price},T=b.timeScale().timeToCoordinate(g.rawTime),f=w.priceToCoordinate(g.price),u=b.timeScale().timeToCoordinate(C.rawTime),H=w.priceToCoordinate(C.price);if((T!=null&&f!=null&&u!=null&&H!=null?Math.hypot(u-T,H-f):0)>=3){te.p1={rawTime:g.rawTime,price:g.price},te.p2={rawTime:C.rawTime,price:C.price};const k={type:"circle",primitive:te,p1:g,p2:C};be(L=>[...L,k]),m.current.push(k),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="triangle"){const te=y.current.primitive,g=F(P,Ae);if(g){const C=Math.abs(g.p3.normalizedTime-g.p2.normalizedTime),T=Math.abs(g.p1.price-g.p2.price);if(C>=1&&T>=1e-5){te.p1={rawTime:g.p1.rawTime,price:g.p1.price},te.p2={rawTime:g.p2.rawTime,price:g.p2.price},te.p3={rawTime:g.p3.rawTime,price:g.p3.price};const f={type:"triangle",primitive:te,p1:g.p1,p2:g.p2,p3:g.p3};be(u=>[...u,f]),m.current.push(f),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="ellipse"){const te=y.current.primitive,g={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},C={rawTime:Ae.rawTime,normalizedTime:Ae.time,price:Ae.price},T=b.timeScale().timeToCoordinate(g.rawTime),f=w.priceToCoordinate(g.price),u=b.timeScale().timeToCoordinate(C.rawTime),H=w.priceToCoordinate(C.price);if((T!=null&&f!=null&&u!=null&&H!=null?Math.hypot(u-T,H-f):0)>=4){te.p1={rawTime:g.rawTime,price:g.price},te.p2={rawTime:C.rawTime,price:C.price},te.previewAsLine=!1,te.minorRatio=.45;const k={type:"ellipse",primitive:te,p1:g,p2:C,minorRatio:.45};be(L=>[...L,k]),m.current.push(k),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}x.current=!1,v.current=null,B.current=null,y.current=null};if(Q==="rectangle"||Q==="circle"||Q==="triangle"||Q==="ellipse"){const _={capture:!0,passive:!1},P=Ae=>{x.current||Ae.stopPropagation()};return G.addEventListener("mousedown",ee,_),G.addEventListener("mousemove",M,_),G.addEventListener("mousemove",P,_),G.addEventListener("mouseup",le,_),()=>{if((y.current?.type==="rectangle"||y.current?.type==="circle"||y.current?.type==="triangle"||y.current?.type==="ellipse")&&y.current?.primitive)try{w.detachPrimitive(y.current.primitive)}catch{}y.current=null,x.current=!1,v.current=null,B.current=null,G.removeEventListener("mousedown",ee,_),G.removeEventListener("mousemove",M,_),G.removeEventListener("mousemove",P,_),G.removeEventListener("mouseup",le,_)}}},[we,he,be,ye]),Y.useEffect(()=>{const b=a.current,w=c.current,G=o.current,Ce=we===null||we===1;if(!Ce||!b||!w||!G){Ce||(S(null),V([]),ce(null),de([]));return}const Q=10,F=8;function ee(g){if(!g)return[];if(g.type==="trendline"&&g.point1&&g.point2){const C=b.timeScale().timeToCoordinate(g.point1.time),T=w.priceToCoordinate(g.point1.price),f=b.timeScale().timeToCoordinate(g.point2.time),u=w.priceToCoordinate(g.point2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="gannline"&&g.point1&&g.point2){const C=b.timeScale().timeToCoordinate(g.point1.time),T=w.priceToCoordinate(g.point1.price),f=b.timeScale().timeToCoordinate(g.point2.time),u=w.priceToCoordinate(g.point2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:(C+f)/2,y:(T+u)/2},{x:f,y:u}]}if(g.type==="rectangle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);if(C==null||T==null||f==null||u==null)return[];const H=Math.min(C,f),U=Math.max(C,f),k=Math.min(T,u),L=Math.max(T,u),p=(H+U)/2,I=(k+L)/2;return[{x:H,y:k},{x:p,y:k},{x:U,y:k},{x:H,y:I},{x:U,y:I},{x:H,y:L},{x:p,y:L},{x:U,y:L}]}if(g.type==="circle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="triangle"&&g.p1&&g.p2&&g.p3){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price);return C==null||T==null||f==null||u==null||H==null||U==null?[]:[{x:C,y:T},{x:f,y:u},{x:H,y:U}]}if(g.type==="ellipse"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);if(C==null||T==null||f==null||u==null)return[];const H=(C+f)/2,U=(T+u)/2,k=f-C,L=u-T,p=Math.hypot(k,L);if(p<.001)return[];const I=k/p,O=L/p,K=-O,z=I,R=p/2,Z=R*Math.max(.05,g.minorRatio??.45);return[{x:H-I*R,y:U-O*R},{x:H+K*Z,y:U+z*Z},{x:H+I*R,y:U+O*R},{x:H-K*Z,y:U-z*Z}]}if(g.type==="gannfan"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="ganngrid"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="arrowedline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="rayline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="extendedline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="crossline"&&g.p){const C=b.timeScale().timeToCoordinate(g.p.rawTime),T=w.priceToCoordinate(g.p.price);return C==null||T==null?[]:[{x:C,y:T}]}if(g.type==="text"&&g.rawTime!=null&&g.price!=null){const C=b.timeScale().timeToCoordinate(g.rawTime),T=w.priceToCoordinate(g.price);return C==null||T==null?[]:[{x:C,y:T}]}if(g.type==="trendbyangle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="andrewspitchfork"&&g.p1&&g.p2&&g.p3){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price);return C==null||T==null||f==null||u==null||H==null||U==null?[]:[{x:C,y:T},{x:f,y:u},{x:H,y:U}]}if(g.type==="equidistantchannel"&&g.p1&&g.p2&&g.b1&&g.b2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.b1.rawTime),U=w.priceToCoordinate(g.b1.price),k=b.timeScale().timeToCoordinate(g.b2.rawTime),L=w.priceToCoordinate(g.b2.price);return C==null||T==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:T},{x:f,y:u},{x:(H+k)/2,y:(U+L)/2}]}if(g.type==="regressionchannel"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="stddevchannel"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="disjointchannel"&&g.p1&&g.p2&&g.p3&&g.p4){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price),k=b.timeScale().timeToCoordinate(g.p4.rawTime),L=w.priceToCoordinate(g.p4.price);return C==null||T==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:T},{x:f,y:u},{x:H,y:U},{x:k,y:L}]}if(g.type==="flattopbottom"&&g.p1&&g.p2&&g.p3&&g.p4){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price),k=b.timeScale().timeToCoordinate(g.p4.rawTime),L=w.priceToCoordinate(g.p4.price);return C==null||T==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:T},{x:f,y:u},{x:H,y:U},{x:k,y:L}]}if(g.type==="infoline"&&g.p1&&g.p2){const C=g.p1.rawTime??g.p1.time,T=g.p2.rawTime??g.p2.time,f=b.timeScale().timeToCoordinate(C),u=w.priceToCoordinate(g.p1.price),H=b.timeScale().timeToCoordinate(T),U=w.priceToCoordinate(g.p2.price);return f==null||u==null||H==null||U==null?[]:[{x:f,y:u},{x:H,y:U}]}if(g.type==="rulerline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:(C+f)/2,y:(T+u)/2},{x:f,y:u}]}if(g.type==="fibonacci"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),T=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||T==null||f==null||u==null?[]:[{x:C,y:T},{x:f,y:u}]}if(g.type==="horizontalray"&&g.primitive){const C=g.primitive,T=b.timeScale().timeToCoordinate(C.originTime),f=w.priceToCoordinate(C.price);return T==null||f==null?[]:[{x:T,y:f}]}if(g.type==="verticalline"&&g.primitive){const C=g.primitive,T=b.timeScale().timeToCoordinate(C.time);if(T==null)return[];const f=C.midYCss??200;return[{x:T,y:f}]}return[]}function M(g,C){for(let T=Ye.length-1;T>=0;T--){const f=Ye[T];if(f.type==="trendline"&&f.point1&&f.point2){const u=b.timeScale().timeToCoordinate(f.point1.time),H=w.priceToCoordinate(f.point1.price),U=b.timeScale().timeToCoordinate(f.point2.time),k=w.priceToCoordinate(f.point2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="gannline"&&f.point1&&f.point2){const u=b.timeScale().timeToCoordinate(f.point1.time),H=w.priceToCoordinate(f.point1.price),U=b.timeScale().timeToCoordinate(f.point2.time),k=w.priceToCoordinate(f.point2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"line"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="rectangle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.min(u,U),p=Math.max(u,U),I=Math.min(H,k),O=Math.max(H,k),K=(L+p)/2,z=(I+O)/2,R=[{x:L,y:I,mode:"handle1"},{x:K,y:I,mode:"handle2"},{x:p,y:I,mode:"handle3"},{x:L,y:z,mode:"handle4"},{x:p,y:z,mode:"handle5"},{x:L,y:O,mode:"handle6"},{x:K,y:O,mode:"handle7"},{x:p,y:O,mode:"handle8"}];for(const He of R)if(Math.hypot(g-He.x,C-He.y)<Q)return{object:f,mode:He.mode};const Z=qe(g,C,L,I,p,I),se=qe(g,C,L,O,p,O),fe=qe(g,C,L,I,L,O),ve=qe(g,C,p,I,p,O);if(Z<F||se<F||fe<F||ve<F||$A(g,C,[{x:L,y:I},{x:p,y:I},{x:p,y:O},{x:L,y:O}]))return{object:f,mode:"line"}}if(f.type==="circle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(U-u,k-H);if(L<2)continue;const p=Math.hypot(g-u,C-H),I=Math.hypot(g-U,C-k);if(p<Q)return{object:f,mode:"handle1"};if(I<Q)return{object:f,mode:"handle2"};if(Math.abs(p-L)<F||p<L)return{object:f,mode:"line"}}if(f.type==="triangle"&&f.p1&&f.p2&&f.p3){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price);if(u==null||H==null||U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"handle3"};const z=qe(g,C,u,H,U,k),R=qe(g,C,U,k,L,p),Z=qe(g,C,L,p,u,H);if(z<F||R<F||Z<F||$A(g,C,[{x:u,y:H},{x:U,y:k},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="ellipse"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=U-u,O=k-H,K=Math.hypot(I,O);if(K<2)continue;const z=I/K,R=O/K,Z=-R,se=z,fe=K/2,ve=fe*Math.max(.05,f.minorRatio??.45);if(fe<2||ve<2)continue;const He=L-z*fe,Pe=p-R*fe,Ge=L+Z*ve,Re=p+se*ve,at=L+z*fe,it=p+R*fe,mt=L-Z*ve,Et=p-se*ve,Yt=Math.hypot(g-He,C-Pe),Nt=Math.hypot(g-Ge,C-Re),$t=Math.hypot(g-at,C-it),xA=Math.hypot(g-mt,C-Et);if(Yt<Q)return{object:f,mode:"handle1"};if(Nt<Q)return{object:f,mode:"handle2"};if($t<Q)return{object:f,mode:"handle3"};if(xA<Q)return{object:f,mode:"handle4"};const hr=(g-L)*z+(C-p)*R,us=(g-L)*Z+(C-p)*se,Vd=hr/fe,zd=us/ve,Wd=Vd*Vd+zd*zd;if(Math.abs(Wd-1)<.2||Wd<1)return{object:f,mode:"line"}}if(f.type==="gannfan"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-U,C-k),p=Math.hypot(g-u,C-H);if(L<Q)return{object:f,mode:"handle2"};if(p<Q)return{object:f,mode:"handle1"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="ganngrid"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-U,C-k),p=Math.hypot(g-u,C-H);if(L<Q)return{object:f,mode:"handle2"};if(p<Q)return{object:f,mode:"handle1"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="arrowedline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="rayline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(yy(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="extendedline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(by(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="crossline"&&f.p){const u=b.timeScale().timeToCoordinate(f.p.rawTime),H=w.priceToCoordinate(f.p.price);if(u==null||H==null)continue;if(Math.hypot(g-u,C-H)<Q)return{object:f,mode:"handle1"};const k=Math.abs(C-H),L=Math.abs(g-u);if(k<F||L<F)return{object:f,mode:"line"}}if(f.type==="text"&&f.rawTime!=null&&f.price!=null){const u=b.timeScale().timeToCoordinate(f.rawTime),H=w.priceToCoordinate(f.price);if(u==null||H==null)continue;const U=Ud(f,u,H);if(g>=U.left&&g<=U.right&&C>=U.top&&C<=U.bottom)return{object:f,mode:"line"}}if(f.type==="trendbyangle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="equidistantchannel"&&f.p1&&f.p2&&f.b1&&f.b2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.b1.rawTime),p=w.priceToCoordinate(f.b1.price),I=b.timeScale().timeToCoordinate(f.b2.rawTime),O=w.priceToCoordinate(f.b2.price),K=L!=null&&I!=null?(L+I)/2:null,z=p!=null&&O!=null?(p+O)/2:null;if(u==null||H==null||U==null||k==null||K==null||z==null||L==null||p==null||I==null||O==null)continue;const R=Math.hypot(g-u,C-H),Z=Math.hypot(g-U,C-k),se=Math.hypot(g-K,C-z),fe=Math.hypot(u-K,H-z)<Q*1.5;if(fe&&Math.min(R,se)<Q*1.5)return{object:f,mode:"handle3"};if(se<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle2"};if(fe)continue;if(R<Q)return{object:f,mode:"handle1"};const ve=qe(g,C,u,H,U,k),He=qe(g,C,L,p,I,O);if(ve<F||He<F||$A(g,C,[{x:u,y:H},{x:U,y:k},{x:I,y:O},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="regressionchannel"&&f.p1&&f.p2&&f.top1&&f.top2&&f.bot1&&f.bot2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.top1.rawTime),p=w.priceToCoordinate(f.top1.price),I=b.timeScale().timeToCoordinate(f.top2.rawTime),O=w.priceToCoordinate(f.top2.price),K=b.timeScale().timeToCoordinate(f.bot1.rawTime),z=w.priceToCoordinate(f.bot1.price),R=b.timeScale().timeToCoordinate(f.bot2.rawTime),Z=w.priceToCoordinate(f.bot2.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null||K==null||z==null||R==null||Z==null)continue;const se=Math.hypot(g-u,C-H),fe=Math.hypot(g-U,C-k);if(se<Q)return{object:f,mode:"handle1"};if(fe<Q)return{object:f,mode:"handle2"};const ve=qe(g,C,u,H,U,k),He=qe(g,C,L,p,I,O),Pe=qe(g,C,K,z,R,Z);if(ve<F||He<F||Pe<F||$A(g,C,[{x:L,y:p},{x:I,y:O},{x:R,y:Z},{x:K,y:z}]))return{object:f,mode:"line"}}if(f.type==="stddevchannel"&&f.p1&&f.p2&&f.top1&&f.top2&&f.bot1&&f.bot2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.top1.rawTime),p=w.priceToCoordinate(f.top1.price),I=b.timeScale().timeToCoordinate(f.top2.rawTime),O=w.priceToCoordinate(f.top2.price),K=b.timeScale().timeToCoordinate(f.bot1.rawTime),z=w.priceToCoordinate(f.bot1.price),R=b.timeScale().timeToCoordinate(f.bot2.rawTime),Z=w.priceToCoordinate(f.bot2.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null||K==null||z==null||R==null||Z==null)continue;const se=Math.hypot(g-u,C-H),fe=Math.hypot(g-U,C-k);if(se<Q)return{object:f,mode:"handle1"};if(fe<Q)return{object:f,mode:"handle2"};const ve=qe(g,C,u,H,U,k),He=qe(g,C,L,p,I,O),Pe=qe(g,C,K,z,R,Z);if(ve<F||He<F||Pe<F||$A(g,C,[{x:L,y:p},{x:I,y:O},{x:R,y:Z},{x:K,y:z}]))return{object:f,mode:"line"}}if(f.type==="andrewspitchfork"&&f.p1&&f.p2&&f.p3){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price);if(u==null||H==null||U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"handle3"};const z=(U+L)/2,R=(k+p)/2;let Z=z-u,se=R-H;Math.abs(Z)<1e-4&&(Z=1e-4);const fe=se/Z,ve=G.clientWidth,He=k+fe*(ve-U),Pe=p+fe*(ve-L),Ge=qe(g,C,U,k,ve,He),Re=qe(g,C,L,p,ve,Pe);if(Ge<F||Re<F||$A(g,C,[{x:U,y:k},{x:ve,y:He},{x:ve,y:Pe},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="disjointchannel"&&f.p1&&f.p2&&f.p3&&f.p4){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price),I=b.timeScale().timeToCoordinate(f.p4.rawTime),O=w.priceToCoordinate(f.p4.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null)continue;const K=Math.hypot(g-u,C-H),z=Math.hypot(g-U,C-k),R=Math.hypot(g-L,C-p),Z=Math.hypot(g-I,C-O);if(K<Q)return{object:f,mode:"handle1"};if(z<Q)return{object:f,mode:"handle2"};if(R<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle4"};const se=qe(g,C,u,H,L,p),fe=qe(g,C,U,k,I,O),ve=qe(g,C,u,H,U,k),He=qe(g,C,L,p,I,O);if(se<F||fe<F||ve<F||He<F||$A(g,C,[{x:u,y:H},{x:L,y:p},{x:I,y:O},{x:U,y:k}]))return{object:f,mode:"line"}}if(f.type==="flattopbottom"&&f.p1&&f.p2&&f.p3&&f.p4){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price),I=b.timeScale().timeToCoordinate(f.p4.rawTime),O=w.priceToCoordinate(f.p4.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null)continue;const K=Math.hypot(g-u,C-H),z=Math.hypot(g-U,C-k),R=Math.hypot(g-L,C-p),Z=Math.hypot(g-I,C-O);if(K<Q)return{object:f,mode:"handle1"};if(z<Q)return{object:f,mode:"handle2"};if(R<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle4"};const se=qe(g,C,u,H,L,p),fe=qe(g,C,U,k,I,O),ve=qe(g,C,u,H,U,k),He=qe(g,C,L,p,I,O);if(se<F||fe<F||ve<F||He<F||$A(g,C,[{x:u,y:H},{x:L,y:p},{x:I,y:O},{x:U,y:k}]))return{object:f,mode:"line"}}if(f.type==="rulerline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"line"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="infoline"&&f.p1&&f.p2){const u=f.p1.rawTime??f.p1.time,H=f.p2.rawTime??f.p2.time,U=b.timeScale().timeToCoordinate(u),k=w.priceToCoordinate(f.p1.price),L=b.timeScale().timeToCoordinate(H),p=w.priceToCoordinate(f.p2.price);if(U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-U,C-k),O=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(qe(g,C,U,k,L,p)<F)return{object:f,mode:"line"}}if(f.type==="fibonacci"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="horizontalray"&&f.primitive){const u=f.primitive,H=b.timeScale().timeToCoordinate(u.originTime),U=w.priceToCoordinate(u.price);if(U==null)continue;if(H!=null&&Math.hypot(g-H,C-U)<Q)return{object:f,mode:"handle1"};const k=H==null?0:Math.max(0,H);if(g>=k&&Math.abs(C-U)<F)return{object:f,mode:"line"}}if(f.type==="verticalline"&&f.primitive){const u=f.primitive,H=b.timeScale().timeToCoordinate(u.time);if(H==null)continue;const U=u.midYCss??200;if(Math.hypot(g-H,C-U)<Q)return{object:f,mode:"handle1"};if(Math.abs(g-H)<F)return{object:f,mode:"line"}}}return null}const le=g=>{const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top,u=M(T,f);if(u){if(g.preventDefault(),g.stopPropagation(),g.detail>=2){$(u.object),J.current=null,ie.current=null;return}S(u.object),ce(null),de([]),J.current=u.mode,u.object.type==="rayline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="extendedline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="crossline"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x:T,y:f,p:{...u.object.p}}),u.object.type==="text"&&u.mode==="line"&&(ie.current={x:T,y:f,rawTime:u.object.rawTime,price:u.object.price}),u.object.type==="trendbyangle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="equidistantchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="andrewspitchfork"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="regressionchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="stddevchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="disjointchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="flattopbottom"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="fibonacci"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="gannfan"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="ganngrid"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="rectangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4"||u.mode==="handle5"||u.mode==="handle6"||u.mode==="handle7"||u.mode==="handle8")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="circle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="triangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="ellipse"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}),u.object.type==="horizontalray"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x:T,y:f,price:u.object.primitive.price,originTime:u.object.primitive.originTime}),u.object.type==="verticalline"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x:T,y:f,time:u.object.primitive.time}),u.mode==="line"&&(u.object.type==="rulerline"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="infoline"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="arrowedline"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rayline"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="extendedline"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="crossline"?ie.current={x:T,y:f,p:{...u.object.p}}:u.object.type==="text"?ie.current={x:T,y:f,rawTime:u.object.rawTime,price:u.object.price}:u.object.type==="trendbyangle"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="equidistantchannel"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="andrewspitchfork"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="regressionchannel"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="stddevchannel"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="disjointchannel"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="flattopbottom"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="fibonacci"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="gannfan"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rectangle"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="circle"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="triangle"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="ellipse"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}:u.object.type==="ganngrid"?ie.current={x:T,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="horizontalray"?ie.current={x:T,y:f,price:u.object.primitive.price,originTime:u.object.primitive.originTime}:u.object.type==="verticalline"?ie.current={x:T,y:f,time:u.object.primitive.time}:ie.current={x:T,y:f,point1:{...u.object.point1},point2:{...u.object.point2}})}else S(null),J.current=null,V([]),ce(null),de([])},_=g=>{const C=G.getBoundingClientRect(),T=g.clientX-C.left,f=g.clientY-C.top;if(!J.current){const L=M(T,f);if(L?.object&&!pe.current){const p=ee(L.object);ce(I=>I===L.object?I:L.object),de(I=>I.length===p.length&&I.every((O,K)=>O.x===p[K].x&&O.y===p[K].y)?I:p)}else ce(p=>p==null?p:null),de(p=>p.length===0?p:[]);return}const u=pe.current;if(!u)return;const H=b.timeScale().coordinateToTime(T),U=w.coordinateToPrice(f);if(H==null||U==null)return;let k=q(H);if(k!=null){if(u.type==="infoline"&&u.p1&&u.p2){const L=K=>{const z=K.rawTime??K.time,R=K.normalizedTime??q(z);return{rawTime:z,normalizedTime:R,price:K.price}},p=(K,z)=>{const R=K.normalizedTime??q(K.rawTime),Z=z.normalizedTime??q(z.rawTime);if(R==null||Z==null)return;const se=z.price-K.price,fe=se/Math.abs(K.price)*100,ve=jt(Oe)||3600,He=Math.abs(Z-R),Pe=Math.max(1,Math.round(He/ve)),Ge=Math.max(1,Math.round(He/86400)),Re=b.timeScale().timeToCoordinate(K.rawTime),at=w.priceToCoordinate(K.price),it=b.timeScale().timeToCoordinate(z.rawTime),mt=w.priceToCoordinate(z.price),Et=Re!=null&&at!=null&&it!=null&&mt!=null?Math.atan2(-(mt-at),it-Re)*(180/Math.PI):u.primitive?.info?.angle??0,Yt={priceDiff:se,pricePct:fe,bars:Pe,days:Ge,angle:Et},Nt=u.primitive;if(Nt){Nt.p1={rawTime:K.rawTime,price:K.price},Nt.p2={rawTime:z.rawTime,price:z.price},Nt.info=Yt;try{a.current?.applyOptions({})}catch{}}const $t={...u,rawP1Time:K.rawTime,rawP2Time:z.rawTime,p1:{rawTime:K.rawTime,normalizedTime:R,price:K.price},p2:{rawTime:z.rawTime,normalizedTime:Z,price:z.price}};be(xA=>{const hr=xA.map(us=>us===u?$t:us);return m.current=hr,hr}),S($t),pe.current=$t},I=L(u.p1),O=L(u.p2);if(I.rawTime==null||I.normalizedTime==null||O.rawTime==null||O.normalizedTime==null)return;if(J.current==="handle1"){const K=b.timeScale().coordinateToTime(T)??H;p({rawTime:K,normalizedTime:k,price:U},O)}else if(J.current==="handle2"){const K=b.timeScale().coordinateToTime(T)??H;p(I,{rawTime:K,normalizedTime:k,price:U})}else if(J.current==="line"){const K=ie.current;if(!K)return;const z=L(K.p1),R=L(K.p2);if(z.rawTime==null||z.normalizedTime==null||R.rawTime==null||R.normalizedTime==null)return;const Z=b.timeScale().coordinateToTime(K.x)??z.rawTime,se=w.coordinateToPrice(K.y);if(Z==null||se==null)return;const fe=q(Z)??z.normalizedTime;if(fe==null)return;const ve=k-fe,He=U-se,Pe=q(z.normalizedTime+ve),Ge=q(R.normalizedTime+ve);if(Pe==null||Ge==null)return;const Re=H-Z;p({rawTime:z.rawTime+Re,normalizedTime:Pe,price:z.price+He},{rawTime:R.rawTime+Re,normalizedTime:Ge,price:R.price+He})}return}if(u.type==="rulerline"&&u.p1&&u.p2){const L=(p,I)=>{const O=p.normalizedTime??p.rawTime,K=I.normalizedTime??I.rawTime,z=I.price-p.price,R=z/Math.abs(p.price)*100,Z=ls(_t,p.rawTime,I.rawTime,Oe),se=Math.abs(K-O),fe=Math.max(1,Math.round(se/86400)),ve={priceDiff:z,pricePct:R,bars:Z,days:fe},He=u.primitive;if(He){He.p1={rawTime:p.rawTime,price:p.price},He.p2={rawTime:I.rawTime,price:I.price},He.info=ve;const Ge=I.price>=p.price;He.color=Ge?"#3b82f6":"#ef5350",He.fillColor=Ge?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}const Pe={...u,rawP1Time:p.rawTime,rawP2Time:I.rawTime,p1:p,p2:I};be(Ge=>{const Re=Ge.map(at=>at===u?Pe:at);return m.current=Re,Re}),S(Pe),pe.current=Pe};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="arrowedline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="rayline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;const I=q(p);if(I==null)return;L(u.p1,{rawTime:p,normalizedTime:I,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="extendedline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="crossline"&&u.p){const L=I=>{const O=u.primitive;if(O){O.center={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K},p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U});return}if(u.type==="text"){const L=b.timeScale().coordinateToTime(T);if(L==null)return;const p=u.primitive;if(p){p.rawTime=L,p.price=U;try{a.current?.applyOptions({})}catch{}}const I={...u,rawTime:L,price:U};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I;return}if(u.type==="trendbyangle"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"||J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="equidistantchannel"&&u.p1&&u.p2&&u.p3){const L=(p,I,O)=>{const K=Sd(p,I,O);if(!K)return;const z=u.primitive;if(z){z.p1={rawTime:p.rawTime,price:p.price},z.p2={rawTime:I.rawTime,price:I.price},z.b1={rawTime:K.b1.rawTime,price:K.b1.price},z.b2={rawTime:K.b2.rawTime,price:K.b2.price},z.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{a.current?.applyOptions({})}catch{}}const R={...u,p1:p,p2:I,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};be(Z=>{const se=Z.map(fe=>fe===u?R:fe);return m.current=se,se}),S(R),pe.current=R};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2,u.p3);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U},u.p3);return}if(J.current==="handle3"){L(u.p1,u.p2,{rawTime:u.p3.rawTime,normalizedTime:u.p3.normalizedTime??q(u.p3.rawTime),price:U});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K),se=q(p.p3.normalizedTime+K);if(R==null||Z==null||se==null)return;const fe=H-I;L({rawTime:p.p1.rawTime+fe,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+fe,normalizedTime:Z,price:p.p2.price+z},{rawTime:p.p3.rawTime+fe,normalizedTime:se,price:p.p3.price+z});return}}if(u.type==="regressionchannel"&&u.p1&&u.p2){const L=(p,I)=>{const O=as(he,p,I,u.stdMultiplier??1);if(!O)return;const K=u.primitive;if(K){K.mid1={rawTime:O.p1.rawTime,price:O.p1.price},K.mid2={rawTime:O.p2.rawTime,price:O.p2.price},K.top1={rawTime:O.top1.rawTime,price:O.top1.price},K.top2={rawTime:O.top2.rawTime,price:O.top2.price},K.bot1={rawTime:O.bot1.rawTime,price:O.bot1.price},K.bot2={rawTime:O.bot2.rawTime,price:O.bot2.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:O.p1,p2:O.p2,top1:O.top1,top2:O.top2,bot1:O.bot1,bot2:O.bot2,slope:O.slope,intercept:O.intercept,stdDev:O.stdDev,offset:O.offset,barCount:O.barCount};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k},u.p2);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z});return}}if(u.type==="stddevchannel"&&u.p1&&u.p2){const L=(p,I)=>{const O=Ua(he,p,I,u.stdMultiplier??1);if(!O)return;const K=u.primitive;if(K){K.mid1={rawTime:O.p1.rawTime,price:O.p1.price},K.mid2={rawTime:O.p2.rawTime,price:O.p2.price},K.top1={rawTime:O.top1.rawTime,price:O.top1.price},K.top2={rawTime:O.top2.rawTime,price:O.top2.price},K.bot1={rawTime:O.bot1.rawTime,price:O.bot1.price},K.bot2={rawTime:O.bot2.rawTime,price:O.bot2.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:O.p1,p2:O.p2,top1:O.top1,top2:O.top2,bot1:O.bot1,bot2:O.bot2,slope:O.slope,stdDev:O.stdDev,offset:O.offset,barCount:O.barCount};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k},u.p2);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z});return}}if(u.type==="andrewspitchfork"&&u.p1&&u.p2&&u.p3){const L=(p,I,O)=>{const K=u.primitive;if(K){K.p1={rawTime:p.rawTime,price:p.price},K.p2={rawTime:I.rawTime,price:I.price},K.p3={rawTime:O.rawTime,price:O.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:p,p2:I,p3:O};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2,u.p3);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U},u.p3);return}if(J.current==="handle3"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,u.p2,{rawTime:p,normalizedTime:k,price:U});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K),se=q(p.p3.normalizedTime+K);if(R==null||Z==null||se==null)return;const fe=H-I;L({rawTime:p.p1.rawTime+fe,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+fe,normalizedTime:Z,price:p.p2.price+z},{rawTime:p.p3.rawTime+fe,normalizedTime:se,price:p.p3.price+z});return}}if(u.type==="disjointchannel"&&u.p1&&u.p2&&u.p3&&u.p4){const L=(z,R,Z,se)=>{const fe=u.primitive;if(fe){fe.p1={rawTime:z.rawTime,price:z.price},fe.p2={rawTime:R.rawTime,price:R.price},fe.p3={rawTime:Z.rawTime,price:Z.price},fe.p4={rawTime:se.rawTime,price:se.price};try{a.current?.applyOptions({})}catch{}}const ve={...u,p1:z,p2:R,p3:Z,p4:se};be(He=>{const Pe=He.map(Ge=>Ge===u?ve:Ge);return m.current=Pe,Pe}),S(ve),pe.current=ve},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(T);if(I==null)return;const O=q(I);if(O==null)return;const K=(z,R,Z,se)=>{const fe=z.normalizedTime??q(z.rawTime);if(fe==null)return null;const ve=q(fe+Z);return ve==null?null:{rawTime:z.rawTime+R,normalizedTime:ve,price:z.price+se}};if(J.current==="line"){const z=b.timeScale().coordinateToTime(p.x),R=w.coordinateToPrice(p.y);if(z==null||R==null)return;const Z=q(z);if(Z==null)return;const se=I-z,fe=O-Z,ve=U-R,He=K(p.p1,se,fe,ve),Pe=K(p.p2,se,fe,ve),Ge=K(p.p3,se,fe,ve),Re=K(p.p4,se,fe,ve);if(!He||!Pe||!Ge||!Re)return;L(He,Pe,Ge,Re);return}if(J.current==="handle1"){const z=(p.p1.price+p.p2.price)/2,R={rawTime:I,normalizedTime:O,price:U},Z={rawTime:I,normalizedTime:O,price:2*z-U};L(R,Z,p.p3,p.p4);return}if(J.current==="handle3"){const z=(p.p3.price+p.p4.price)/2,R={rawTime:I,normalizedTime:O,price:U},Z={rawTime:I,normalizedTime:O,price:2*z-U};L(p.p1,p.p2,R,Z);return}if(J.current==="handle2"){const z=(p.p1.price+p.p2.price)/2,R={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:U};if(R.normalizedTime==null)return;const Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:2*z-U};if(Z.normalizedTime==null)return;L(Z,R,p.p3,p.p4);return}if(J.current==="handle4"){const z=U-p.p4.price,R={rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??q(p.p3.rawTime),price:p.p4.price+z};if(R.normalizedTime==null)return;const Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:p.p2.price+z};if(Z.normalizedTime==null)return;L(p.p1,Z,p.p3,R);return}}if(u.type==="flattopbottom"&&u.p1&&u.p2&&u.p3&&u.p4){const L=(z,R,Z,se)=>{const fe=u.primitive;if(fe){fe.p1={rawTime:z.rawTime,price:z.price},fe.p2={rawTime:R.rawTime,price:R.price},fe.p3={rawTime:Z.rawTime,price:Z.price},fe.p4={rawTime:se.rawTime,price:se.price};try{a.current?.applyOptions({})}catch{}}const ve={...u,p1:z,p2:R,p3:Z,p4:se};be(He=>{const Pe=He.map(Ge=>Ge===u?ve:Ge);return m.current=Pe,Pe}),S(ve),pe.current=ve},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(T);if(I==null)return;const O=q(I);if(O==null)return;const K=(z,R,Z,se)=>{const fe=z.normalizedTime??q(z.rawTime);if(fe==null)return null;const ve=q(fe+Z);return ve==null?null:{rawTime:z.rawTime+R,normalizedTime:ve,price:z.price+se}};if(J.current==="line"){const z=b.timeScale().coordinateToTime(p.x),R=w.coordinateToPrice(p.y);if(z==null||R==null)return;const Z=q(z);if(Z==null)return;const se=I-z,fe=O-Z,ve=U-R,He=K(p.p1,se,fe,ve),Pe=K(p.p2,se,fe,ve),Ge=K(p.p3,se,fe,ve),Re=K(p.p4,se,fe,ve);if(!He||!Pe||!Ge||!Re)return;L(He,Pe,Ge,Re);return}if(J.current==="handle1"){const z={rawTime:I,normalizedTime:O,price:U},R={rawTime:I,normalizedTime:O,price:p.p2.price};L(z,R,p.p3,p.p4);return}if(J.current==="handle3"){const z={rawTime:I,normalizedTime:O,price:U},R={rawTime:I,normalizedTime:O,price:p.p4.price};L(p.p1,p.p2,z,R);return}if(J.current==="handle2"||J.current==="handle4"){const z=J.current==="handle2"?p.p2:p.p4,R=U-z.price,Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:p.p2.price+R},se={rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??q(p.p3.rawTime),price:p.p4.price+R};if(Z.normalizedTime==null||se.normalizedTime==null)return;L(p.p1,Z,p.p3,se);return}}if(u.type==="fibonacci"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="rectangle"&&u.p1&&u.p2){const L=(it,mt)=>{const Et=u.primitive;if(Et){Et.p1={rawTime:it.rawTime,price:it.price},Et.p2={rawTime:mt.rawTime,price:mt.price};try{a.current?.applyOptions({})}catch{}}const Yt={...u,p1:it,p2:mt};be(Nt=>{const $t=Nt.map(xA=>xA===u?Yt:xA);return m.current=$t,$t}),S(Yt),pe.current=Yt},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(T);if(I==null)return;const O=q(I);if(O==null)return;if(J.current==="line"){const it=b.timeScale().coordinateToTime(p.x),mt=w.coordinateToPrice(p.y);if(it==null||mt==null)return;const Et=q(it);if(Et==null)return;const Yt=O-Et,Nt=U-mt,$t=q(p.p1.normalizedTime+Yt),xA=q(p.p2.normalizedTime+Yt);if($t==null||xA==null)return;const hr=H-it;L({rawTime:p.p1.rawTime+hr,normalizedTime:$t,price:p.p1.price+Nt},{rawTime:p.p2.rawTime+hr,normalizedTime:xA,price:p.p2.price+Nt});return}const K=Math.min(p.p1.normalizedTime,p.p2.normalizedTime),z=Math.max(p.p1.normalizedTime,p.p2.normalizedTime),R=Math.max(p.p1.price,p.p2.price),Z=Math.min(p.p1.price,p.p2.price),se=p.p1.normalizedTime<=p.p2.normalizedTime?p.p1.rawTime:p.p2.rawTime,fe=p.p1.normalizedTime<=p.p2.normalizedTime?p.p2.rawTime:p.p1.rawTime;let ve=K,He=z,Pe=R,Ge=Z,Re=se,at=fe;if((J.current==="handle1"||J.current==="handle4"||J.current==="handle6")&&(ve=O,Re=I),(J.current==="handle3"||J.current==="handle5"||J.current==="handle8")&&(He=O,at=I),(J.current==="handle1"||J.current==="handle2"||J.current==="handle3")&&(Pe=U),(J.current==="handle6"||J.current==="handle7"||J.current==="handle8")&&(Ge=U),ve>He){const it=ve,mt=Re;ve=He,Re=at,He=it,at=mt}if(Pe<Ge){const it=Pe;Pe=Ge,Ge=it}L({rawTime:Re,normalizedTime:ve,price:Pe},{rawTime:at,normalizedTime:He,price:Ge});return}if(u.type==="circle"&&u.p1&&u.p2){const L=(Pe,Ge)=>{const Re=u.primitive;if(Re){Re.p1={rawTime:Pe.rawTime,price:Pe.price},Re.p2={rawTime:Ge.rawTime,price:Ge.price};try{a.current?.applyOptions({})}catch{}}const at={...u,p1:Pe,p2:Ge};be(it=>{const mt=it.map(Et=>Et===u?at:Et);return m.current=mt,mt}),S(at),pe.current=at},p=b.timeScale().coordinateToTime(T);if(p==null)return;const I=q(p);if(I==null)return;if(J.current==="handle2"){L(u.p1,{rawTime:p,normalizedTime:I,price:U});return}const O=ie.current;if(!O)return;const K=b.timeScale().coordinateToTime(O.x),z=w.coordinateToPrice(O.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=I-R,se=U-z,fe=q(O.p1.normalizedTime+Z),ve=q(O.p2.normalizedTime+Z);if(fe==null||ve==null)return;const He=H-K;L({rawTime:O.p1.rawTime+He,normalizedTime:fe,price:O.p1.price+se},{rawTime:O.p2.rawTime+He,normalizedTime:ve,price:O.p2.price+se});return}if(u.type==="triangle"&&u.p1&&u.p2&&u.p3){const L=(Re,at,it)=>{const mt=u.primitive;if(mt){mt.p1={rawTime:Re.rawTime,price:Re.price},mt.p2={rawTime:at.rawTime,price:at.price},mt.p3={rawTime:it.rawTime,price:it.price};try{a.current?.applyOptions({})}catch{}}const Et={...u,p1:Re,p2:at,p3:it};be(Yt=>{const Nt=Yt.map($t=>$t===u?Et:$t);return m.current=Nt,Nt}),S(Et),pe.current=Et},p=b.timeScale().coordinateToTime(T);if(p==null)return;const I=q(p);if(I==null)return;if(J.current==="handle1"){L({rawTime:p,normalizedTime:I,price:U},u.p2,u.p3);return}if(J.current==="handle2"){L(u.p1,{rawTime:p,normalizedTime:I,price:U},u.p3);return}if(J.current==="handle3"){L(u.p1,u.p2,{rawTime:p,normalizedTime:I,price:U});return}const O=ie.current;if(!O)return;const K=b.timeScale().coordinateToTime(O.x),z=w.coordinateToPrice(O.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=I-R,se=U-z,fe=H-K,ve=Re=>{const at=Re.normalizedTime??q(Re.rawTime);if(at==null)return null;const it=q(at+Z);return it==null?null:{rawTime:Re.rawTime+fe,normalizedTime:it,price:Re.price+se}},He=ve(O.p1),Pe=ve(O.p2),Ge=ve(O.p3);if(!He||!Pe||!Ge)return;L(He,Pe,Ge);return}if(u.type==="ellipse"&&u.p1&&u.p2){const L=(K,z,R=u.minorRatio??.45)=>{const Z=u.primitive;if(Z){Z.p1={rawTime:K.rawTime,price:K.price},Z.p2={rawTime:z.rawTime,price:z.price},Z.minorRatio=Math.max(.05,R);try{a.current?.applyOptions({})}catch{}}const se={...u,p1:K,p2:z,minorRatio:Math.max(.05,R)};be(fe=>{const ve=fe.map(He=>He===u?se:He);return m.current=ve,ve}),S(se),pe.current=se},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(T);if(I==null)return;const O=q(I);if(O==null)return;if(J.current==="line"){const K=b.timeScale().coordinateToTime(p.x),z=w.coordinateToPrice(p.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=O-R,se=U-z,fe=q(p.p1.normalizedTime+Z),ve=q(p.p2.normalizedTime+Z);if(fe==null||ve==null)return;const He=H-K;L({rawTime:p.p1.rawTime+He,normalizedTime:fe,price:p.p1.price+se},{rawTime:p.p2.rawTime+He,normalizedTime:ve,price:p.p2.price+se},p.minorRatio??u.minorRatio??.45);return}if(J.current==="handle1"){L({rawTime:I,normalizedTime:O,price:U},u.p2,u.minorRatio??.45);return}if(J.current==="handle3"){L(u.p1,{rawTime:I,normalizedTime:O,price:U},u.minorRatio??.45);return}if(J.current==="handle2"||J.current==="handle4"){const K=b.timeScale().timeToCoordinate(u.p1.rawTime),z=w.priceToCoordinate(u.p1.price),R=b.timeScale().timeToCoordinate(u.p2.rawTime),Z=w.priceToCoordinate(u.p2.price);if(K==null||z==null||R==null||Z==null)return;const se=(K+R)/2,fe=(z+Z)/2,ve=R-K,He=Z-z,Pe=Math.hypot(ve,He);if(Pe<.001)return;const Ge=-He/Pe,Re=ve/Pe,at=Math.abs((T-se)*Ge+(f-fe)*Re),it=Math.max(.05,at*2/Pe);L(u.p1,u.p2,it);return}return}if(u.type==="gannfan"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="ganngrid"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(T);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="verticalline"&&u.primitive){const L=u.primitive;L.time=H;const p={...u,time:q(H),rawTime:H};be(I=>{const O=I.map(K=>K===u?p:K);return m.current=O,O}),S(p),pe.current=p,a.current?.applyOptions({});return}if(u.type==="horizontalray"&&u.primitive){const L=u.primitive,p=ie.current;if(!p)return;if(J.current==="handle1"){L.price=U,L.originTime=H;const I={...u,price:L.price,originTime:L.originTime,rawOriginTime:H};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I,a.current?.applyOptions({})}else if(J.current==="line"){const I=w.coordinateToPrice(p.y);if(I==null)return;const O=U-I;L.price=p.price+O;const K={...u,price:L.price};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K,a.current?.applyOptions({})}return}if(!(u.type!=="trendline"&&u.type!=="gannline")&&!(!u.point1||!u.point2)){if(J.current==="handle1"){const L={time:k,price:U},p=LA([{time:L.time,value:L.price},{time:u.point2.time,value:u.point2.price}]);p.length>0&&u.series.setData(p);const I={...u,point1:L};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I}else if(J.current==="handle2"){const L={time:k,price:U},p=LA([{time:u.point1.time,value:u.point1.price},{time:L.time,value:L.price}]);p.length>0&&u.series.setData(p);const I={...u,point2:L};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I}else if(J.current==="line"){const L=ie.current;if(!L)return;const p=b.timeScale().coordinateToTime(L.x),I=w.coordinateToPrice(L.y);if(p==null||I==null)return;const O=k-p,K=U-I,z={time:q(L.point1.time+O),price:L.point1.price+K},R={time:q(L.point2.time+O),price:L.point2.price+K},Z=LA([{time:z.time,value:z.price},{time:R.time,value:R.price}]);Z.length>0&&u.series.setData(Z);const se={...u,point1:z,point2:R};be(fe=>{const ve=fe.map(He=>He===u?se:He);return m.current=ve,ve}),S(se),pe.current=se}}}},P=()=>{J.current=null,ie.current=null},Ae=()=>{J.current||pe.current||(ce(null),de([]))},te={capture:!0,passive:!1};return G.addEventListener("mousedown",le,te),G.addEventListener("mousemove",_,te),G.addEventListener("mouseup",P,te),G.addEventListener("mouseleave",Ae,te),()=>{G.removeEventListener("mousedown",le,te),G.removeEventListener("mousemove",_,te),G.removeEventListener("mouseup",P,te),G.removeEventListener("mouseleave",Ae,te)}},[we,he,Ye,be]),Y.useEffect(()=>{const b=a.current,w=c.current;if(!b||!w)return;const G=()=>{const Q=N;if(!Q){V([]);return}const F=b.timeScale();if(Q.type==="infoline"&&Q.p1&&Q.p2){const ee=Q.p1.rawTime??Q.p1.time,M=Q.p2.rawTime??Q.p2.time,le=F.timeToCoordinate(ee),_=w.priceToCoordinate(Q.p1.price),P=F.timeToCoordinate(M),Ae=w.priceToCoordinate(Q.p2.price);le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="rulerline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:(ee+le)/2,y:(M+_)/2},{x:le,y:_}]):V([]);return}if(Q.type==="arrowedline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="rayline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="extendedline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="crossline"&&Q.p){const ee=F.timeToCoordinate(Q.p.rawTime),M=w.priceToCoordinate(Q.p.price);ee!=null&&M!=null?V([{x:ee,y:M}]):V([]);return}if(Q.type==="text"&&Q.rawTime!=null&&Q.price!=null){const ee=F.timeToCoordinate(Q.rawTime),M=w.priceToCoordinate(Q.price);ee!=null&&M!=null?V([{x:ee,y:M}]):V([]);return}if(Q.type==="trendbyangle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="equidistantchannel"&&Q.p1&&Q.p2&&Q.b1&&Q.b2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.b1.rawTime),Ae=w.priceToCoordinate(Q.b1.price),te=F.timeToCoordinate(Q.b2.rawTime),g=w.priceToCoordinate(Q.b2.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:(P+te)/2,y:(Ae+g)/2}]):V([]);return}if(Q.type==="regressionchannel"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="stddevchannel"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="andrewspitchfork"&&Q.p1&&Q.p2&&Q.p3){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="disjointchannel"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price),te=F.timeToCoordinate(Q.p4.rawTime),g=w.priceToCoordinate(Q.p4.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae},{x:te,y:g}]):V([]);return}if(Q.type==="flattopbottom"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price),te=F.timeToCoordinate(Q.p4.rawTime),g=w.priceToCoordinate(Q.p4.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae},{x:te,y:g}]):V([]);return}if(Q.type==="fibonacci"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="trendline"&&Q.point1&&Q.point2){const ee=F.timeToCoordinate(Q.point1.time),M=w.priceToCoordinate(Q.point1.price),le=F.timeToCoordinate(Q.point2.time),_=w.priceToCoordinate(Q.point2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="gannline"&&Q.point1&&Q.point2){const ee=F.timeToCoordinate(Q.point1.time),M=w.priceToCoordinate(Q.point1.price),le=F.timeToCoordinate(Q.point2.time),_=w.priceToCoordinate(Q.point2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:(ee+le)/2,y:(M+_)/2},{x:le,y:_}]):V([]);return}if(Q.type==="rectangle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);if(ee!=null&&M!=null&&le!=null&&_!=null){const P=Math.min(ee,le),Ae=Math.max(ee,le),te=Math.min(M,_),g=Math.max(M,_),C=(P+Ae)/2,T=(te+g)/2;V([{x:P,y:te},{x:C,y:te},{x:Ae,y:te},{x:P,y:T},{x:Ae,y:T},{x:P,y:g},{x:C,y:g},{x:Ae,y:g}])}else V([]);return}if(Q.type==="circle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="triangle"&&Q.p1&&Q.p2&&Q.p3){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="ellipse"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);if(ee!=null&&M!=null&&le!=null&&_!=null){const P=(ee+le)/2,Ae=(M+_)/2,te=le-ee,g=_-M,C=Math.hypot(te,g);if(C<.001){V([]);return}const T=te/C,f=g/C,u=-f,H=T,U=C/2,k=U*Math.max(.05,Q.minorRatio??.45);V([{x:P-T*U,y:Ae-f*U},{x:P+u*k,y:Ae+H*k},{x:P+T*U,y:Ae+f*U},{x:P-u*k,y:Ae-H*k}])}else V([]);return}if(Q.type==="gannfan"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="ganngrid"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="horizontalray"&&Q.primitive){const ee=Q.primitive,M=F.timeToCoordinate(ee.originTime),le=w.priceToCoordinate(ee.price);M!=null&&le!=null?V([{x:M,y:le}]):V([]);return}if(Q.type==="verticalline"&&Q.primitive){const ee=Q.primitive,M=F.timeToCoordinate(ee.time);if(M!=null){const le=ee.midYCss??200;V([{x:M,y:le}])}else V([]);return}V([])};G();const Ce=b.timeScale();return Ce.subscribeVisibleTimeRangeChange(G),()=>{Ce.unsubscribeVisibleTimeRangeChange(G)}},[N]),Y.useEffect(()=>{!a.current||!c.current||m.current.forEach(b=>{if(b.series&&b.series.applyOptions({visible:Ne}),b.priceLine&&b.priceLine.applyOptions(Ne?{color:"#3b82f6",axisLabelVisible:!0,title:typeof b.price=="number"?b.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),b.type==="fibonacci"&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}if(b.type==="rectangle"&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}if(b.type==="parallellines"&&(b.baseLine&&b.baseLine.applyOptions({visible:Ne}),b.parallelLine&&b.parallelLine.applyOptions({visible:Ne}),b.firstLine&&b.firstLine.applyOptions({visible:Ne}),b.secondLine&&b.secondLine.applyOptions({visible:Ne})),(b.type==="horizontalray"||b.type==="verticalline"||b.type==="infoline"||b.type==="rulerline"||b.type==="arrowedline"||b.type==="rayline"||b.type==="extendedline"||b.type==="crossline"||b.type==="trendbyangle"||b.type==="equidistantchannel"||b.type==="regressionchannel"||b.type==="stddevchannel"||b.type==="gannfan"||b.type==="ganngrid"||b.type==="andrewspitchfork"||b.type==="disjointchannel"||b.type==="flattopbottom"||b.type==="circle"||b.type==="triangle"||b.type==="ellipse"||b.type==="text")&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}})},[Ne,Ye]),Y.useEffect(()=>{!Ne&&N&&(S(null),V([]))},[Ne,N]),Y.useEffect(()=>{if(m.current.length>Ye.length){const b=m.current.filter((w,G)=>!Ye.includes(w));N&&b.some(w=>w===N)&&(S(null),V([])),b.forEach(w=>{if(w.series&&a.current?.removeSeries(w.series),w.priceLine&&c.current?.removePriceLine(w.priceLine),w.type==="horizontalray"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="verticalline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="infoline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rulerline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="arrowedline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rayline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="extendedline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="crossline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="trendbyangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="equidistantchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="regressionchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="stddevchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="gannfan"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="ganngrid"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="andrewspitchfork"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="disjointchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="flattopbottom"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="fibonacci"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rectangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="circle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="triangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="ellipse"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="text"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="parallellines")try{w.baseLine&&a.current?.removeSeries(w.baseLine),w.parallelLine&&a.current?.removeSeries(w.parallelLine),w.firstLine&&a.current?.removeSeries(w.firstLine),w.secondLine&&a.current?.removeSeries(w.secondLine)}catch{}}),m.current=Ye}},[Ye,N]),Y.useEffect(()=>{const b=c.current;return b?(Ke.current.forEach(G=>{try{b.removePriceLine(G)}catch{}}),Ke.current=[],bt.filter(G=>G.symbol===ze).forEach(G=>{const Ce=parseFloat(G.price);if(isNaN(Ce))return;const F=G.type==="BUY"?"#26A69A":"#EF5350",ee=b.createPriceLine({price:Ce,color:F,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${G.type} ${G.volume} @ ${G.price}`,textColor:F});Ke.current.push(ee)}),()=>{Ke.current.forEach(G=>{try{b.removePriceLine(G)}catch{}}),Ke.current=[]}):void 0},[bt,ze]),Y.useEffect(()=>{const b=o.current;if(!b)return;const w=G=>{if(x.current||!a.current)return;const Ce=a.current,Q=c.current;if(Ce&&Q&&m.current.length>0){const F=b.getBoundingClientRect(),ee=G.clientX-F.left,M=G.clientY-F.top,le=15;for(let _=m.current.length-1;_>=0;_--){const P=m.current[_];let Ae=!1;if(P.type==="text"&&P.rawTime!=null&&P.price!=null){const te=Ce.timeScale().timeToCoordinate(P.rawTime),g=Q.priceToCoordinate(P.price);if(te!=null&&g!=null){const C=Ud(P,te,g);ee>=C.left&&ee<=C.right&&M>=C.top&&M<=C.bottom&&(Ae=!0)}}else if(P.point1&&P.point2){const te=Ce.timeScale().timeToCoordinate(P.point1.time??P.point1.rawTime),g=Q.priceToCoordinate(P.point1.price),C=Ce.timeScale().timeToCoordinate(P.point2.time??P.point2.rawTime),T=Q.priceToCoordinate(P.point2.price);if(te!=null&&g!=null&&C!=null&&T!=null){const f=Math.hypot(ee-te,M-g),u=Math.hypot(ee-C,M-T),H=(te+C)/2,U=(g+T)/2,k=Math.hypot(ee-H,M-U);(f<le||u<le||k<le)&&(Ae=!0)}}else if(P.p1&&P.p2){const te=Ce.timeScale().timeToCoordinate(P.p1.rawTime),g=Q.priceToCoordinate(P.p1.price),C=Ce.timeScale().timeToCoordinate(P.p2.rawTime),T=Q.priceToCoordinate(P.p2.price);if(te!=null&&g!=null&&C!=null&&T!=null){const f=Math.min(te,C),u=Math.max(te,C),H=Math.min(g,T),U=Math.max(g,T);ee>=f-5&&ee<=u+5&&M>=H-5&&M<=U+5&&(Ae=!0)}}else if(P.p){const te=Ce.timeScale().timeToCoordinate(P.p.rawTime),g=Q.priceToCoordinate(P.p.price);te!=null&&g!=null&&Math.hypot(ee-te,M-g)<le&&(Ae=!0)}if(Ae){G.preventDefault(),G.stopPropagation(),typeof G.stopImmediatePropagation=="function"&&G.stopImmediatePropagation(),$(P);return}}}G.preventDefault(),G.stopPropagation(),typeof G.stopImmediatePropagation=="function"&&G.stopImmediatePropagation(),setTimeout(()=>{if(!a.current)return;Ly(a.current,he,Oe)||a.current.timeScale().fitContent();const ee=a.current.timeScale().getVisibleRange();Fe(ee)},80)};return b.addEventListener("dblclick",w,!0),()=>{b.removeEventListener("dblclick",w,!0)}},[he,Oe]);const Kd=N??X,Pd=N?j:ae,qy=Ne&&Qy(Kd,Pd),Yy=Fy(Kd?.type);return l.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${Ie==="light"?"bg-white":"bg-[#12161d]"}`,children:l.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:we===1||we!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[Ee&&l.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center",style:{backgroundColor:Ie==="light"?"rgba(255,255,255,0.85)":"rgba(18,22,29,0.85)"},children:l.jsxs("div",{className:"flex flex-col items-center gap-3",children:[l.jsx("div",{className:"w-9 h-9 rounded-full border-[3px] border-sky-500 border-t-transparent animate-spin"}),l.jsxs("span",{className:"text-xs font-medium tracking-wide",style:{color:Ie==="light"?"#334155":"#94a3b8"},children:["Loading ",typeof ze=="object"?ze?.symbol:ze,"..."]})]})}),!Ee&&ht&&l.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:l.jsxs("div",{className:"flex flex-col items-center gap-2 px-5 py-4 rounded-lg",style:{backgroundColor:Ie==="light"?"rgba(255,255,255,0.92)":"rgba(18,22,29,0.92)",border:"1px solid rgba(239,68,68,0.4)"},children:[l.jsx("span",{className:"text-sm font-semibold text-red-400",children:"No data available"}),l.jsx("span",{className:"text-xs text-center max-w-[200px]",style:{color:Ie==="light"?"#64748b":"#94a3b8"},children:ht})]})}),!Ee&&!ht&&he.length===0&&l.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center pointer-events-none",children:l.jsx("div",{className:"flex flex-col items-center gap-2",children:l.jsxs("span",{className:"text-sm font-medium",style:{color:Ie==="light"?"#94a3b8":"#475569"},children:["No chart data for ",typeof ze=="object"?ze?.symbol:ze]})})}),A&&l.jsx("div",{className:"absolute top-3 left-3 z-50",children:l.jsx(ph,{bidPrice:e,askPrice:t,onBuyClick:Rt,onSellClick:Bt})}),l.jsx(fh,{isOpen:_e,onClose:Jt,orderType:ne,bidPrice:e,askPrice:t}),l.jsx(wh,{isOpen:W!==null,onClose:()=>$(null),chartObject:W,onUpdate:qt}),Ee&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:Ie==="light"?"#ffffff":"#12161d"},children:l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:Ie==="light"?"#64748b":"#475569"}})}),qy&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:Pd.map((b,w)=>l.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:b.x-5,top:b.y-5,backgroundColor:Yy}},w))})]})})}),ct={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function Md({style:r,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:i,symbolsLoading:n}=Qt(),[s,o]=Y.useState(!1),[a,c]=Y.useState(""),[h,d]=Y.useState(-1),m=Y.useRef(null),x=Y.useRef(null);Y.useEffect(()=>{const E=N=>{m.current&&!m.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),Y.useEffect(()=>{s&&x.current&&x.current.focus()},[s]);const v=i.filter(E=>E.symbol.toLowerCase().includes(a.toLowerCase())),B=v.filter(E=>!E.symbol.endsWith("USDT")),y=v.filter(E=>E.symbol.endsWith("USDT")),D=E=>{A(E),o(!1),c("")};return i.find(E=>E.symbol===t),l.jsxs("div",{ref:m,style:{...ct.container,...r},className:e,children:[l.jsxs("button",{style:ct.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,ct.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[l.jsx("span",{children:n?"Loading...":t||"Select Coin"}),l.jsx("span",{style:{...ct.arrow,...s?ct.arrowOpen:{}},children:"▼"})]}),s&&l.jsxs("div",{style:ct.dropdown,children:[l.jsx("div",{style:ct.searchContainer,children:l.jsx("input",{ref:x,style:ct.searchInput,type:"text",placeholder:"Search symbol...",value:a,onChange:E=>c(E.target.value)})}),l.jsx("div",{style:ct.list,children:v.length===0?l.jsx("div",{style:ct.empty,children:"No symbols found"}):l.jsxs(l.Fragment,{children:[B.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{style:ct.categoryLabel,children:"Forex & Metals"}),B.map(E=>l.jsxs("div",{style:{...ct.item,...E.symbol===t?ct.itemSelected:{}},onClick:()=>D(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[l.jsx("span",{style:ct.symbolName,children:E.symbol}),E.bid&&l.jsx("span",{style:{...ct.symbolPrice,...parseFloat(E.change)>=0?ct.priceUp:ct.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),y.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{style:ct.categoryLabel,children:"Crypto"}),y.map(E=>l.jsxs("div",{style:{...ct.item,...E.symbol===t?ct.itemSelected:{}},onClick:()=>D(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[l.jsx("span",{style:ct.symbolName,children:E.symbol}),E.bid&&l.jsx("span",{style:{...ct.symbolPrice,...parseFloat(E.change)>=0?ct.priceUp:ct.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const bA={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"}},Iy=[.01,.05,.1,.5,1];function Id({value:r,onChange:e,min:t=.01,max:A=100,step:i=.01,presets:n=Iy,showPresets:s=!0,showLabel:o=!0,label:a="Vol",style:c,className:h}){const[d,m]=Y.useState(.1),x=r!==void 0?r:d,v=Y.useCallback(E=>{const N=Math.max(t,Math.min(A,parseFloat(E)||t)),S=Math.round(N/i)*i,W=parseFloat(S.toFixed(8));r!==void 0||m(W),e?.(W)},[t,A,i,r,e]),B=()=>v(x+i),y=()=>v(x-i),D=(x>=1,x.toFixed(2));return l.jsxs("div",{style:{...bA.container,...c},className:h,children:[o&&l.jsx("span",{style:bA.label,children:a}),l.jsx("button",{style:bA.btn,onClick:y,onMouseEnter:E=>Object.assign(E.currentTarget.style,bA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),l.jsx("input",{style:bA.input,type:"text",value:D,onChange:E=>{const N=E.target.value;if(N===""||N==="."||N==="0.")return;const S=parseFloat(N);isNaN(S)||v(S)},onBlur:()=>v(x)}),l.jsx("button",{style:bA.btn,onClick:B,onMouseEnter:E=>Object.assign(E.currentTarget.style,bA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&l.jsx("div",{style:bA.presets,children:n.map(E=>l.jsx("button",{style:{...bA.preset,...Math.abs(x-E)<1e-4?bA.presetActive:{}},onClick:()=>v(E),onMouseEnter:N=>{Math.abs(x-E)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(x-E)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const Wt={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 _d({value:r,onChange:e,enabled:t,onEnabledChange:A,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:c="SL",style:h,className:d}){const{currentSymbolData:m}=Qt(),[x,v]=Y.useState(""),[B,y]=Y.useState(!1),[D,E]=Y.useState("price"),N=r!==void 0?r:x,S=t!==void 0?t:B,W=i!==void 0?i:D,$=Y.useCallback(ae=>{t!==void 0||y(ae),A?.(ae)},[t,A]),j=Y.useCallback(ae=>{i!==void 0||E(ae),n?.(ae)},[i,n]),V=Y.useCallback(ae=>{r!==void 0||v(ae),e?.(ae)},[r,e]),X=ae=>{const de=ae.target.value;if(de===""||de==="."||de==="0."){V(de);return}const J=parseFloat(de);isNaN(J)||V(de)},ce=W==="price"?m?.bid?parseFloat(m.bid).toFixed(5):"0.00000":"50";return l.jsxs("div",{style:{...Wt.container,...h},className:d,children:[a&&l.jsx("span",{style:Wt.label,children:c}),s&&l.jsx("button",{style:{...Wt.toggle,...S?Wt.toggleOn:Wt.toggleOff},onClick:()=>$(!S),children:l.jsx("div",{style:{...Wt.toggleKnob,...S?Wt.knobOn:Wt.knobOff}})}),(S||!s)&&l.jsxs("div",{style:Wt.inputGroup,children:[l.jsx("input",{style:Wt.input,type:"text",value:N,onChange:X,placeholder:ce,onFocus:ae=>ae.currentTarget.style.borderColor="#EF5350",onBlur:ae=>ae.currentTarget.style.borderColor="#334155"}),o&&l.jsxs(l.Fragment,{children:[l.jsx("button",{style:{...Wt.modeBtn,...W==="price"?Wt.modeBtnActive:{}},onClick:()=>j("price"),children:"Price"}),l.jsx("button",{style:{...Wt.modeBtn,...W==="pips"?Wt.modeBtnActive:{}},onClick:()=>j("pips"),children:"Pips"})]})]})]})}const Gt={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Dd({value:r,onChange:e,enabled:t,onEnabledChange:A,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:c="TP",style:h,className:d}){const{currentSymbolData:m}=Qt(),[x,v]=Y.useState(""),[B,y]=Y.useState(!1),[D,E]=Y.useState("price"),N=r!==void 0?r:x,S=t!==void 0?t:B,W=i!==void 0?i:D,$=Y.useCallback(ae=>{t!==void 0||y(ae),A?.(ae)},[t,A]),j=Y.useCallback(ae=>{i!==void 0||E(ae),n?.(ae)},[i,n]),V=Y.useCallback(ae=>{r!==void 0||v(ae),e?.(ae)},[r,e]),X=ae=>{const de=ae.target.value;if(de===""||de==="."||de==="0."){V(de);return}const J=parseFloat(de);isNaN(J)||V(de)},ce=W==="price"?m?.ask?parseFloat(m.ask).toFixed(5):"0.00000":"50";return l.jsxs("div",{style:{...Gt.container,...h},className:d,children:[a&&l.jsx("span",{style:Gt.label,children:c}),s&&l.jsx("button",{style:{...Gt.toggle,...S?Gt.toggleOn:Gt.toggleOff},onClick:()=>$(!S),children:l.jsx("div",{style:{...Gt.toggleKnob,...S?Gt.knobOn:Gt.knobOff}})}),(S||!s)&&l.jsxs("div",{style:Gt.inputGroup,children:[l.jsx("input",{style:Gt.input,type:"text",value:N,onChange:X,placeholder:ce,onFocus:ae=>ae.currentTarget.style.borderColor="#26A69A",onBlur:ae=>ae.currentTarget.style.borderColor="#334155"}),o&&l.jsxs(l.Fragment,{children:[l.jsx("button",{style:{...Gt.modeBtn,...W==="price"?Gt.modeBtnActive:{}},onClick:()=>j("price"),children:"Price"}),l.jsx("button",{style:{...Gt.modeBtn,...W==="pips"?Gt.modeBtnActive:{}},onClick:()=>j("pips"),children:"Pips"})]})]})]})}const _y=[{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:"─"}],TA={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 kd({showLabel:r=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:i="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:a,drawingsVisible:c,setDrawingsVisible:h,chartObjects:d,setChartObjects:m}=Qt(),[x,v]=Y.useState(null),B=A||_y,y=N=>{a(o===N?null:N)},D=()=>{m([]),a(null)},E=()=>{h(!c)};return l.jsxs("div",{style:{...TA.container,...n},className:s,children:[r&&l.jsx("span",{style:TA.label,children:i}),B.map(N=>l.jsxs("button",{style:{...TA.btn,...o===N.id?TA.btnActive:{}},onClick:()=>y(N.id),onMouseEnter:S=>{v(N.id),o!==N.id&&Object.assign(S.currentTarget.style,TA.btnHover)},onMouseLeave:S=>{v(null),o!==N.id&&(S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b",S.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,x===N.id&&l.jsx("div",{style:TA.tooltip,children:N.name})]},N.id)),(e||t)&&l.jsx("div",{style:TA.divider}),t&&l.jsx("button",{style:{...TA.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&&l.jsx("button",{style:TA.deleteBtn,onClick:D,onMouseEnter:N=>Object.assign(N.currentTarget.style,TA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Od={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function Dy({showCoinSelector:r=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:i=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:a,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:d,takeProfit:m,onTakeProfitChange:x,takeProfitEnabled:v,onTakeProfitEnabledChange:B,coinSelectorProps:y={},volumeControlProps:D={},stopLossProps:E={},takeProfitProps:N={},drawingToolsProps:S={},style:W,className:$}){const j=[];r&&j.push(l.jsx(Md,{...y},"coin")),e&&j.push(l.jsx(Id,{value:s,onChange:o,...D},"volume")),t&&j.push(l.jsx(_d,{value:a,onChange:c,enabled:h,onEnabledChange:d,...E},"sl")),A&&j.push(l.jsx(Dd,{value:m,onChange:x,enabled:v,onEnabledChange:B,...N},"tp")),i&&j.push(l.jsx(kd,{...S},"draw"));const V=[];return j.forEach((X,ce)=>{V.push(X),n&&ce<j.length-1&&V.push(l.jsx("div",{style:Od.divider},`div-${ce}`))}),l.jsx("div",{style:{...Od.toolbar,...W},className:$,children:V})}const ky=[{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"}],Sa={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 Oy({style:r,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Qt();return l.jsx("div",{style:{...Sa.container,...r},className:e,children:ky.map(i=>l.jsx("button",{style:{...Sa.btn,...t===i.value?Sa.btnActive:{}},onClick:()=>A(i.value),onMouseEnter:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#334155")},children:i.label},i.value))})}const Ny=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Ha={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 Ky({style:r,className:e}){const{chartType:t,setChartType:A}=Qt();return l.jsx("div",{style:{...Ha.container,...r},className:e,children:Ny.map(i=>l.jsxs("button",{style:{...Ha.btn,...t===i.value?Ha.btnActive:{}},onClick:()=>A(i.value),onMouseEnter:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#334155")},title:i.label,children:[l.jsx("span",{children:i.icon}),l.jsx("span",{children:i.label})]},i.value))})}const Ot={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 Py({volume:r=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:i,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:a,setUserBalance:c}=Qt(),[h,d]=Y.useState(null),m=parseFloat(o?.bid||0),x=parseFloat(o?.ask||0),v=x>0&&m>0?Math.abs(x-m):0,B=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),y=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",D=Y.useCallback(E=>{if(!s)return;const N=E==="BUY"?x:m;if(!N||N<=0){d({type:"error",message:"No price available"});return}const S={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:r,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()};a($=>[...$,S]);const W=r*N*.01;c($=>$-W),d({type:"success",message:`${E} executed`}),A?.(S),setTimeout(()=>d(null),3e3)},[s,x,m,r,e,t,a,c,A]);return l.jsxs("div",{style:{...Ot.container,...i},className:n,children:[l.jsx("button",{style:Ot.sellBtn,onClick:()=>D("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Ot.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),l.jsxs("div",{style:Ot.priceBox,children:[l.jsx("span",{style:Ot.priceLabel,children:"Bid"}),l.jsx("span",{style:{...Ot.priceValue,color:"#EF5350"},children:B(m)})]}),l.jsxs("div",{style:Ot.spread,children:[l.jsx("span",{style:Ot.spreadLabel,children:"Spread"}),l.jsx("span",{style:Ot.spreadValue,children:y(v)})]}),l.jsxs("div",{style:Ot.priceBox,children:[l.jsx("span",{style:Ot.priceLabel,children:"Ask"}),l.jsx("span",{style:{...Ot.priceValue,color:"#26A69A"},children:B(x)})]}),l.jsx("button",{style:Ot.buyBtn,onClick:()=>D("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Ot.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&l.jsx("span",{style:{...Ot.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const Xe={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 Vy({style:r,className:e,maxHeight:t=200}){const{orders:A,setOrders:i,symbols:n,accountSummary:s,setUserBalance:o}=Qt(),[a,c]=Y.useState(null),h=A.filter(B=>B.status==="OPEN"||!B.closeAt),d=Y.useCallback((B,y)=>{const D=n.find(E=>E.symbol===B);return D?parseFloat(y==="BUY"?D.bid||0:D.ask||0):0},[n]),m=Y.useCallback(B=>{if(a)return;c(B.id);const y=d(B.symbol,B.type),E=(B.type==="BUY"?y-B.price:B.price-y)*B.volume,N=B.volume*B.price*.01;i(S=>S.filter(W=>W.id!==B.id)),o(S=>S+N+E),c(null)},[a,d,i,o]),x=B=>{const y=parseFloat(B);return!y||isNaN(y)?"-":y>=1e3?y.toFixed(2):y>=1?y.toFixed(4):y.toFixed(5)},v=B=>{const y=parseFloat(B);return isNaN(y)?"-":(y>=0?"+":"")+y.toFixed(2)};return l.jsxs("div",{style:{...Xe.container,...r},className:e,children:[l.jsxs("div",{style:Xe.header,children:[l.jsxs("span",{style:Xe.headerTitle,children:["Positions (",h.length,")"]}),l.jsxs("div",{style:Xe.summary,children:[l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Balance:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Equity:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Free:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),l.jsx("div",{style:{...Xe.scrollArea,maxHeight:t},children:l.jsxs("table",{style:Xe.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Xe.th,children:"Symbol"}),l.jsx("th",{style:Xe.th,children:"Type"}),l.jsx("th",{style:Xe.th,children:"Volume"}),l.jsx("th",{style:Xe.th,children:"Open Price"}),l.jsx("th",{style:Xe.th,children:"Current"}),l.jsx("th",{style:Xe.th,children:"SL"}),l.jsx("th",{style:Xe.th,children:"TP"}),l.jsx("th",{style:Xe.th,children:"Profit"}),l.jsx("th",{style:Xe.th,children:"Action"})]})}),l.jsx("tbody",{children:h.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:9,style:Xe.emptyRow,children:"No open positions"})}):h.map(B=>{const y=d(B.symbol,B.type),D=B.profit||0;return l.jsxs("tr",{children:[l.jsx("td",{style:{...Xe.td,fontWeight:700,color:"#e2e8f0"},children:B.symbol}),l.jsx("td",{style:{...Xe.td,...B.type==="BUY"?Xe.typeBuy:Xe.typeSell},children:B.type}),l.jsx("td",{style:Xe.td,children:B.volume}),l.jsx("td",{style:Xe.td,children:x(B.price)}),l.jsx("td",{style:Xe.td,children:x(y)}),l.jsx("td",{style:Xe.td,children:B.stopLoss?x(B.stopLoss):"-"}),l.jsx("td",{style:Xe.td,children:B.takeProfit?x(B.takeProfit):"-"}),l.jsx("td",{style:{...Xe.td,color:D>=0?"#26A69A":"#EF5350",fontWeight:700},children:v(D)}),l.jsx("td",{style:Xe.td,children:l.jsx("button",{style:{...Xe.closeBtn,...a===B.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>m(B),disabled:a===B.id,onMouseEnter:E=>{a!==B.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:a===B.id?"...":"Close"})})]},B.id)})})]})})]})}function zy(r){return rA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(r)}function Wy(r){return rA({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(r)}const Gy=({selectedSymbol:r,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:i,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:a,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:d=!0,onToggleMarketWatch:m,buySellPanelOpen:x,onMove:v})=>{const{theme:B}=Qt(),y=B==="light",D=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={bars:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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"}),l.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:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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":l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.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 l.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b ${y?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${y?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>l.jsx("button",{onClick:()=>i(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
9
|
+
}`,wv=function(r){Bv(r,"."+Ba+mv+cd+`
|
|
10
|
+
.`+Ca+gv+cd)},Bv=function(r,e){var t=r.ownerDocument;if(t){var A=t.createElement("style");A.textContent=e,r.appendChild(A)}},hd=(function(){function r(){}return r.getOrigin=function(e){var t=r._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},r.isSameOrigin=function(e){return r.getOrigin(e)===r._origin},r.setContext=function(e){r._link=e.document.createElement("a"),r._origin=r.getOrigin(e.location.href)},r._origin="about:blank",r})(),Cv=(function(){function r(e,t){this.context=e,this._options=t,this._cache={}}return r.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)||(ya(e)||Tv(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),t},r.prototype.match=function(e){return this._cache[e]},r.prototype.loadImage=function(e){return kt(this,void 0,void 0,function(){var t,A,i,n,s=this;return Mt(this,function(o){switch(o.label){case 0:return t=hd.isSameOrigin(e),A=!va(e)&&this._options.useCORS===!0&&Ut.SUPPORT_CORS_IMAGES&&!t,i=!va(e)&&!t&&!ya(e)&&typeof this._options.proxy=="string"&&Ut.SUPPORT_CORS_XHR&&!A,!t&&this._options.allowTaint===!1&&!va(e)&&!ya(e)&&!i&&!A?[2]:(n=e,i?[4,this.proxy(n)]:[3,2]);case 1:n=o.sent(),o.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(a,c){var h=new Image;h.onload=function(){return a(h)},h.onerror=c,(xv(n)||A)&&(h.crossOrigin="anonymous"),h.src=n,h.complete===!0&&setTimeout(function(){return a(h)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,o.sent()]}})})},r.prototype.has=function(e){return typeof this._cache[e]<"u"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(n,s){var o=Ut.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(o==="text")n(a.response);else{var d=new FileReader;d.addEventListener("load",function(){return n(d.result)},!1),d.addEventListener("error",function(m){return s(m)},!1),d.readAsDataURL(a.response)}else s("Failed to proxy resource "+i+" with status code "+a.status)},a.onerror=s;var c=A.indexOf("?")>-1?"&":"?";if(a.open("GET",""+A+c+"url="+encodeURIComponent(e)+"&responseType="+o),o!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=o),t._options.imageTimeout){var h=t._options.imageTimeout;a.timeout=h,a.ontimeout=function(){return s("Timed out ("+h+"ms) proxying "+i)}}a.send()})},r})(),vv=/^data:image\/svg\+xml/i,yv=/^data:image\/.*;base64,/i,bv=/^data:image\/.*/i,Tv=function(r){return Ut.SUPPORT_SVG_DRAWING||!Qv(r)},va=function(r){return bv.test(r)},xv=function(r){return yv.test(r)},ya=function(r){return r.substr(0,4)==="blob"},Qv=function(r){return r.substr(-3).toLowerCase()==="svg"||vv.test(r)},Qe=(function(){function r(e,t){this.type=0,this.x=e,this.y=t}return r.prototype.add=function(e,t){return new r(this.x+e,this.y+t)},r})(),Er=function(r,e,t){return new Qe(r.x+(e.x-r.x)*t,r.y+(e.y-r.y)*t)},ts=(function(){function r(e,t,A,i){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=i}return r.prototype.subdivide=function(e,t){var A=Er(this.start,this.startControl,e),i=Er(this.startControl,this.endControl,e),n=Er(this.endControl,this.end,e),s=Er(A,i,e),o=Er(i,n,e),a=Er(s,o,e);return t?new r(this.start,A,s,a):new r(a,o,n,this.end)},r.prototype.add=function(e,t){return new r(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r})(),sA=function(r){return r.type===1},Fv=(function(){function r(e){var t=e.styles,A=e.bounds,i=fi(t.borderTopLeftRadius,A.width,A.height),n=i[0],s=i[1],o=fi(t.borderTopRightRadius,A.width,A.height),a=o[0],c=o[1],h=fi(t.borderBottomRightRadius,A.width,A.height),d=h[0],m=h[1],T=fi(t.borderBottomLeftRadius,A.width,A.height),v=T[0],B=T[1],y=[];y.push((n+a)/A.width),y.push((v+d)/A.width),y.push((s+B)/A.height),y.push((c+m)/A.height);var D=Math.max.apply(Math,y);D>1&&(n/=D,s/=D,a/=D,c/=D,d/=D,m/=D,v/=D,B/=D);var E=A.width-a,N=A.height-m,S=A.width-d,W=A.height-B,$=t.borderTopWidth,j=t.borderRightWidth,V=t.borderBottomWidth,X=t.borderLeftWidth,ce=st(t.paddingTop,e.bounds.width),ae=st(t.paddingRight,e.bounds.width),de=st(t.paddingBottom,e.bounds.width),J=st(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?lt(A.left+X/3,A.top+$/3,n-X/3,s-$/3,je.TOP_LEFT):new Qe(A.left+X/3,A.top+$/3),this.topRightBorderDoubleOuterBox=n>0||s>0?lt(A.left+E,A.top+$/3,a-j/3,c-$/3,je.TOP_RIGHT):new Qe(A.left+A.width-j/3,A.top+$/3),this.bottomRightBorderDoubleOuterBox=d>0||m>0?lt(A.left+S,A.top+N,d-j/3,m-V/3,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j/3,A.top+A.height-V/3),this.bottomLeftBorderDoubleOuterBox=v>0||B>0?lt(A.left+X/3,A.top+W,v-X/3,B-V/3,je.BOTTOM_LEFT):new Qe(A.left+X/3,A.top+A.height-V/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?lt(A.left+X*2/3,A.top+$*2/3,n-X*2/3,s-$*2/3,je.TOP_LEFT):new Qe(A.left+X*2/3,A.top+$*2/3),this.topRightBorderDoubleInnerBox=n>0||s>0?lt(A.left+E,A.top+$*2/3,a-j*2/3,c-$*2/3,je.TOP_RIGHT):new Qe(A.left+A.width-j*2/3,A.top+$*2/3),this.bottomRightBorderDoubleInnerBox=d>0||m>0?lt(A.left+S,A.top+N,d-j*2/3,m-V*2/3,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j*2/3,A.top+A.height-V*2/3),this.bottomLeftBorderDoubleInnerBox=v>0||B>0?lt(A.left+X*2/3,A.top+W,v-X*2/3,B-V*2/3,je.BOTTOM_LEFT):new Qe(A.left+X*2/3,A.top+A.height-V*2/3),this.topLeftBorderStroke=n>0||s>0?lt(A.left+X/2,A.top+$/2,n-X/2,s-$/2,je.TOP_LEFT):new Qe(A.left+X/2,A.top+$/2),this.topRightBorderStroke=n>0||s>0?lt(A.left+E,A.top+$/2,a-j/2,c-$/2,je.TOP_RIGHT):new Qe(A.left+A.width-j/2,A.top+$/2),this.bottomRightBorderStroke=d>0||m>0?lt(A.left+S,A.top+N,d-j/2,m-V/2,je.BOTTOM_RIGHT):new Qe(A.left+A.width-j/2,A.top+A.height-V/2),this.bottomLeftBorderStroke=v>0||B>0?lt(A.left+X/2,A.top+W,v-X/2,B-V/2,je.BOTTOM_LEFT):new Qe(A.left+X/2,A.top+A.height-V/2),this.topLeftBorderBox=n>0||s>0?lt(A.left,A.top,n,s,je.TOP_LEFT):new Qe(A.left,A.top),this.topRightBorderBox=a>0||c>0?lt(A.left+E,A.top,a,c,je.TOP_RIGHT):new Qe(A.left+A.width,A.top),this.bottomRightBorderBox=d>0||m>0?lt(A.left+S,A.top+N,d,m,je.BOTTOM_RIGHT):new Qe(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=v>0||B>0?lt(A.left,A.top+W,v,B,je.BOTTOM_LEFT):new Qe(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?lt(A.left+X,A.top+$,Math.max(0,n-X),Math.max(0,s-$),je.TOP_LEFT):new Qe(A.left+X,A.top+$),this.topRightPaddingBox=a>0||c>0?lt(A.left+Math.min(E,A.width-j),A.top+$,E>A.width+j?0:Math.max(0,a-j),Math.max(0,c-$),je.TOP_RIGHT):new Qe(A.left+A.width-j,A.top+$),this.bottomRightPaddingBox=d>0||m>0?lt(A.left+Math.min(S,A.width-X),A.top+Math.min(N,A.height-V),Math.max(0,d-j),Math.max(0,m-V),je.BOTTOM_RIGHT):new Qe(A.left+A.width-j,A.top+A.height-V),this.bottomLeftPaddingBox=v>0||B>0?lt(A.left+X,A.top+Math.min(W,A.height-V),Math.max(0,v-X),Math.max(0,B-V),je.BOTTOM_LEFT):new Qe(A.left+X,A.top+A.height-V),this.topLeftContentBox=n>0||s>0?lt(A.left+X+J,A.top+$+ce,Math.max(0,n-(X+J)),Math.max(0,s-($+ce)),je.TOP_LEFT):new Qe(A.left+X+J,A.top+$+ce),this.topRightContentBox=a>0||c>0?lt(A.left+Math.min(E,A.width+X+J),A.top+$+ce,E>A.width+X+J?0:a-X+J,c-($+ce),je.TOP_RIGHT):new Qe(A.left+A.width-(j+ae),A.top+$+ce),this.bottomRightContentBox=d>0||m>0?lt(A.left+Math.min(S,A.width-(X+J)),A.top+Math.min(N,A.height+$+ce),Math.max(0,d-(j+ae)),m-(V+de),je.BOTTOM_RIGHT):new Qe(A.left+A.width-(j+ae),A.top+A.height-(V+de)),this.bottomLeftContentBox=v>0||B>0?lt(A.left+X+J,A.top+W,Math.max(0,v-(X+J)),B-(V+de),je.BOTTOM_LEFT):new Qe(A.left+X+J,A.top+A.height-(V+de))}return r})(),je;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(je||(je={}));var lt=function(r,e,t,A,i){var n=4*((Math.sqrt(2)-1)/3),s=t*n,o=A*n,a=r+t,c=e+A;switch(i){case je.TOP_LEFT:return new ts(new Qe(r,c),new Qe(r,c-o),new Qe(a-s,e),new Qe(a,e));case je.TOP_RIGHT:return new ts(new Qe(r,e),new Qe(r+s,e),new Qe(a,c-o),new Qe(a,c));case je.BOTTOM_RIGHT:return new ts(new Qe(a,e),new Qe(a,e+o),new Qe(r+s,c),new Qe(r,c));case je.BOTTOM_LEFT:default:return new ts(new Qe(a,c),new Qe(a-s,c),new Qe(r,e+o),new Qe(r,e))}},As=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},Uv=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},rs=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},Ev=(function(){function r(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6}return r})(),is=(function(){function r(e,t){this.path=e,this.target=t,this.type=1}return r})(),Sv=(function(){function r(e){this.opacity=e,this.type=2,this.target=6}return r})(),Hv=function(r){return r.type===0},ud=function(r){return r.type===1},Lv=function(r){return r.type===2},dd=function(r,e){return r.length===e.length?r.some(function(t,A){return t===e[A]}):!1},Mv=function(r,e,t,A,i){return r.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+i);case 3:return n.add(e,t+i)}return n})},pd=(function(){function r(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r})(),fd=(function(){function r(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Fv(this.container),this.container.styles.opacity<1&&this.effects.push(new Sv(this.container.styles.opacity)),this.container.styles.transform!==null){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new Ev(A,i,n))}if(this.container.styles.overflowX!==0){var s=As(this.curves),o=rs(this.curves);dd(s,o)?this.effects.push(new is(s,6)):(this.effects.push(new is(s,2)),this.effects.push(new is(o,4)))}}return r.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,A=this.parent,i=this.effects.slice(0);A;){var n=A.effects.filter(function(a){return!ud(a)});if(t||A.container.styles.position!==0||!A.parent){if(i.unshift.apply(i,n),t=[2,3].indexOf(A.container.styles.position)===-1,A.container.styles.overflowX!==0){var s=As(A.curves),o=rs(A.curves);dd(s,o)||i.unshift(new is(o,6))}}else i.unshift.apply(i,n);A=A.parent}return i.filter(function(a){return vt(a.target,e)})},r})(),ba=function(r,e,t,A){r.container.elements.forEach(function(i){var n=vt(i.flags,4),s=vt(i.flags,2),o=new fd(i,r);vt(i.styles.display,2048)&&A.push(o);var a=vt(i.flags,8)?[]:A;if(n||s){var c=n||i.styles.isPositioned()?t:e,h=new pd(o);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var d=i.styles.zIndex.order;if(d<0){var m=0;c.negativeZIndex.some(function(v,B){return d>v.element.container.styles.zIndex.order?(m=B,!1):m>0}),c.negativeZIndex.splice(m,0,h)}else if(d>0){var T=0;c.positiveZIndex.some(function(v,B){return d>=v.element.container.styles.zIndex.order?(T=B+1,!1):T>0}),c.positiveZIndex.splice(T,0,h)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(h)}else i.styles.isFloating()?c.nonPositionedFloats.push(h):c.nonPositionedInlineLevel.push(h);ba(o,h,n?h:t,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(o):e.nonInlineLevel.push(o),ba(o,e,t,a);vt(i.flags,8)&&md(i,a)})},md=function(r,e){for(var t=r instanceof ua?r.start:1,A=r instanceof ua?r.reversed:!1,i=0;i<e.length;i++){var n=e[i];n.container instanceof Pu&&typeof n.container.value=="number"&&n.container.value!==0&&(t=n.container.value),n.listValue=vi(t,n.container.styles.listStyleType,!0),t+=A?-1:1}},Iv=function(r){var e=new fd(r,null),t=new pd(e),A=[];return ba(e,t,t,A),md(e.container,A),t},gd=function(r,e){switch(e){case 0:return oA(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return oA(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return oA(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);default:return oA(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},_v=function(r,e){switch(e){case 0:return oA(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return oA(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return oA(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);default:return oA(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},Dv=function(r,e){switch(e){case 0:return oA(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return oA(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return oA(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);default:return oA(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},kv=function(r,e){switch(e){case 0:return ns(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return ns(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return ns(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);default:return ns(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},ns=function(r,e){var t=[];return sA(r)?t.push(r.subdivide(.5,!1)):t.push(r),sA(e)?t.push(e.subdivide(.5,!0)):t.push(e),t},oA=function(r,e,t,A){var i=[];return sA(r)?i.push(r.subdivide(.5,!1)):i.push(r),sA(t)?i.push(t.subdivide(.5,!0)):i.push(t),sA(A)?i.push(A.subdivide(.5,!0).reverse()):i.push(A),sA(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},wd=function(r){var e=r.bounds,t=r.styles;return e.add(t.borderLeftWidth,t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth),-(t.borderTopWidth+t.borderBottomWidth))},ss=function(r){var e=r.styles,t=r.bounds,A=st(e.paddingLeft,t.width),i=st(e.paddingRight,t.width),n=st(e.paddingTop,t.width),s=st(e.paddingBottom,t.width);return t.add(A+e.borderLeftWidth,n+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+A+i),-(e.borderTopWidth+e.borderBottomWidth+n+s))},Ov=function(r,e){return r===0?e.bounds:r===2?ss(e):wd(e)},Nv=function(r,e){return r===0?e.bounds:r===2?ss(e):wd(e)},Ta=function(r,e,t){var A=Ov(Hr(r.styles.backgroundOrigin,e),r),i=Nv(Hr(r.styles.backgroundClip,e),r),n=Kv(Hr(r.styles.backgroundSize,e),t,A),s=n[0],o=n[1],a=fi(Hr(r.styles.backgroundPosition,e),A.width-s,A.height-o),c=Pv(Hr(r.styles.backgroundRepeat,e),a,n,A,i),h=Math.round(A.left+a[0]),d=Math.round(A.top+a[1]);return[c,h,d,s,o]},Sr=function(r){return rt(r)&&r.value===xr.AUTO},os=function(r){return typeof r=="number"},Kv=function(r,e,t){var A=e[0],i=e[1],n=e[2],s=r[0],o=r[1];if(!s)return[0,0];if(Bt(s)&&o&&Bt(o))return[st(s,t.width),st(o,t.height)];var a=os(n);if(rt(s)&&(s.value===xr.CONTAIN||s.value===xr.COVER)){if(os(n)){var c=t.width/t.height;return c<n!=(s.value===xr.COVER)?[t.width,t.width/n]:[t.height*n,t.height]}return[t.width,t.height]}var h=os(A),d=os(i),m=h||d;if(Sr(s)&&(!o||Sr(o))){if(h&&d)return[A,i];if(!a&&!m)return[t.width,t.height];if(m&&a){var T=h?A:i*n,v=d?i:A/n;return[T,v]}var B=h?A:t.width,y=d?i:t.height;return[B,y]}if(a){var D=0,E=0;return Bt(s)?D=st(s,t.width):Bt(o)&&(E=st(o,t.height)),Sr(s)?D=E*n:(!o||Sr(o))&&(E=D/n),[D,E]}var N=null,S=null;if(Bt(s)?N=st(s,t.width):o&&Bt(o)&&(S=st(o,t.height)),N!==null&&(!o||Sr(o))&&(S=h&&d?N/A*i:t.height),S!==null&&Sr(s)&&(N=h&&d?S/i*A:t.width),N!==null&&S!==null)return[N,S];throw new Error("Unable to calculate background-size for element")},Hr=function(r,e){var t=r[e];return typeof t>"u"?r[0]:t},Pv=function(r,e,t,A,i){var n=e[0],s=e[1],o=t[0],a=t[1];switch(r){case 2:return[new Qe(Math.round(A.left),Math.round(A.top+s)),new Qe(Math.round(A.left+A.width),Math.round(A.top+s)),new Qe(Math.round(A.left+A.width),Math.round(a+A.top+s)),new Qe(Math.round(A.left),Math.round(a+A.top+s))];case 3:return[new Qe(Math.round(A.left+n),Math.round(A.top)),new Qe(Math.round(A.left+n+o),Math.round(A.top)),new Qe(Math.round(A.left+n+o),Math.round(A.height+A.top)),new Qe(Math.round(A.left+n),Math.round(A.height+A.top))];case 1:return[new Qe(Math.round(A.left+n),Math.round(A.top+s)),new Qe(Math.round(A.left+n+o),Math.round(A.top+s)),new Qe(Math.round(A.left+n+o),Math.round(A.top+s+a)),new Qe(Math.round(A.left+n),Math.round(A.top+s+a))];default:return[new Qe(Math.round(i.left),Math.round(i.top)),new Qe(Math.round(i.left+i.width),Math.round(i.top)),new Qe(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Qe(Math.round(i.left),Math.round(i.height+i.top))]}},Vv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Bd="Hidden Text",zv=(function(){function r(e){this._data={},this._document=e}return r.prototype.parseMetrics=function(e,t){var A=this._document.createElement("div"),i=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),i.src=Vv,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",n.style.fontFamily=e,n.style.fontSize=t,n.style.margin="0",n.style.padding="0",n.appendChild(this._document.createTextNode(Bd)),A.appendChild(n),A.appendChild(i);var o=i.offsetTop-n.offsetTop+2;A.removeChild(n),A.appendChild(this._document.createTextNode(Bd)),A.style.lineHeight="normal",i.style.verticalAlign="super";var a=i.offsetTop-A.offsetTop+2;return s.removeChild(A),{baseline:o,middle:a}},r.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]},r})(),Cd=(function(){function r(e,t){this.context=e,this.options=t}return r})(),Wv=1e4,Gv=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i._activeEffects=[],i.canvas=A.canvas?A.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),A.canvas||(i.canvas.width=Math.floor(A.width*A.scale),i.canvas.height=Math.floor(A.height*A.scale),i.canvas.style.width=A.width+"px",i.canvas.style.height=A.height+"px"),i.fontMetrics=new zv(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-A.x,-A.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+A.width+"x"+A.height+") with scale "+A.scale),i}return e.prototype.applyEffects=function(t){for(var A=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return A.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),Lv(t)&&(this.ctx.globalAlpha=t.opacity),Hv(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 kt(this,void 0,void 0,function(){var A;return Mt(this,function(i){switch(i.label){case 0:return A=t.element.container.styles,A.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return kt(this,void 0,void 0,function(){return Mt(this,function(A){switch(A.label){case 0:if(vt(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,i){var n=this;if(A===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var s=ha(t.text);s.reduce(function(o,a){return n.ctx.fillText(a,o,t.bounds.top+i),o+n.ctx.measureText(a).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var A=t.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=Jv(t.fontFamily).join(", "),n=pi(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,A,t.fontWeight,n,i].join(" "),i,n]},e.prototype.renderTextNode=function(t,A){return kt(this,void 0,void 0,function(){var i,n,s,o,a,c,h,d,m=this;return Mt(this,function(T){return i=this.createFontStyle(A),n=i[0],s=i[1],o=i[2],this.ctx.font=n,this.ctx.direction=A.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(s,o),c=a.baseline,h=a.middle,d=A.paintOrder,t.textBounds.forEach(function(v){d.forEach(function(B){switch(B){case 0:m.ctx.fillStyle=yt(A.color),m.renderTextWithLetterSpacing(v,A.letterSpacing,c);var y=A.textShadow;y.length&&v.text.trim().length&&(y.slice(0).reverse().forEach(function(D){m.ctx.shadowColor=yt(D.color),m.ctx.shadowOffsetX=D.offsetX.number*m.options.scale,m.ctx.shadowOffsetY=D.offsetY.number*m.options.scale,m.ctx.shadowBlur=D.blur.number,m.renderTextWithLetterSpacing(v,A.letterSpacing,c)}),m.ctx.shadowColor="",m.ctx.shadowOffsetX=0,m.ctx.shadowOffsetY=0,m.ctx.shadowBlur=0),A.textDecorationLine.length&&(m.ctx.fillStyle=yt(A.textDecorationColor||A.color),A.textDecorationLine.forEach(function(D){switch(D){case 1:m.ctx.fillRect(v.bounds.left,Math.round(v.bounds.top+c),v.bounds.width,1);break;case 2:m.ctx.fillRect(v.bounds.left,Math.round(v.bounds.top),v.bounds.width,1);break;case 3:m.ctx.fillRect(v.bounds.left,Math.ceil(v.bounds.top+h),v.bounds.width,1);break}}));break;case 1:A.webkitTextStrokeWidth&&v.text.trim().length&&(m.ctx.strokeStyle=yt(A.webkitTextStrokeColor),m.ctx.lineWidth=A.webkitTextStrokeWidth,m.ctx.lineJoin=window.chrome?"miter":"round",m.ctx.strokeText(v.text,v.bounds.left,v.bounds.top+c)),m.ctx.strokeStyle="",m.ctx.lineWidth=0,m.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,A,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var n=ss(t),s=rs(A);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,n.left,n.top,n.width,n.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a,E,E,c,h,d,m,S,T,v,W,B,y,D,E,N,S,W;return Mt(this,function($){switch($.label){case 0:this.applyEffects(t.getEffects(4)),A=t.container,i=t.curves,n=A.styles,s=0,o=A.textNodes,$.label=1;case 1:return s<o.length?(a=o[s],[4,this.renderTextNode(a,n)]):[3,4];case 2:$.sent(),$.label=3;case 3:return s++,[3,1];case 4:if(!(A instanceof Ou))return[3,8];$.label=5;case 5:return $.trys.push([5,7,,8]),[4,this.context.cache.match(A.src)];case 6:return E=$.sent(),this.renderReplacedElement(A,i,E),[3,8];case 7:return $.sent(),this.context.logger.error("Error loading image "+A.src),[3,8];case 8:if(A instanceof Nu&&this.renderReplacedElement(A,i,A.canvas),!(A instanceof Ku))return[3,12];$.label=9;case 9:return $.trys.push([9,11,,12]),[4,this.context.cache.match(A.svg)];case 10:return E=$.sent(),this.renderReplacedElement(A,i,E),[3,12];case 11:return $.sent(),this.context.logger.error("Error loading svg "+A.svg.substring(0,255)),[3,12];case 12:return A instanceof Gu&&A.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:A.backgroundColor,x:0,y:0,width:A.width,height:A.height}),[4,c.render(A.tree)]):[3,14];case 13:h=$.sent(),A.width&&A.height&&this.ctx.drawImage(h,0,0,A.width,A.height,A.bounds.left,A.bounds.top,A.bounds.width,A.bounds.height),$.label=14;case 14:if(A instanceof da&&(d=Math.min(A.bounds.width,A.bounds.height),A.type===Zn?A.checked&&(this.ctx.save(),this.path([new Qe(A.bounds.left+d*.39363,A.bounds.top+d*.79),new Qe(A.bounds.left+d*.16,A.bounds.top+d*.5549),new Qe(A.bounds.left+d*.27347,A.bounds.top+d*.44071),new Qe(A.bounds.left+d*.39694,A.bounds.top+d*.5649),new Qe(A.bounds.left+d*.72983,A.bounds.top+d*.23),new Qe(A.bounds.left+d*.84,A.bounds.top+d*.34085),new Qe(A.bounds.left+d*.39363,A.bounds.top+d*.79)]),this.ctx.fillStyle=yt(Vu),this.ctx.fill(),this.ctx.restore()):A.type===Jn&&A.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(A.bounds.left+d/2,A.bounds.top+d/2,d/4,0,Math.PI*2,!0),this.ctx.fillStyle=yt(Vu),this.ctx.fill(),this.ctx.restore())),Rv(A)&&A.value.length){switch(m=this.createFontStyle(n),S=m[0],T=m[1],v=this.fontMetrics.getMetrics(S,T).baseline,this.ctx.font=S,this.ctx.fillStyle=yt(n.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Xv(A.styles.textAlign),W=ss(A),B=0,A.styles.textAlign){case 1:B+=W.width/2;break;case 2:B+=W.width;break}y=W.add(B,0,0,-W.height/2+1),this.ctx.save(),this.path([new Qe(W.left,W.top),new Qe(W.left+W.width,W.top),new Qe(W.left+W.width,W.top+W.height),new Qe(W.left,W.top+W.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Bi(A.value,y),n.letterSpacing,v),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!vt(A.styles.display,2048))return[3,20];if(A.styles.listStyleImage===null)return[3,19];if(D=A.styles.listStyleImage,D.type!==0)return[3,18];E=void 0,N=D.url,$.label=15;case 15:return $.trys.push([15,17,,18]),[4,this.context.cache.match(N)];case 16:return E=$.sent(),this.ctx.drawImage(E,A.bounds.left-(E.width+10),A.bounds.top),[3,18];case 17:return $.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&&(S=this.createFontStyle(n)[0],this.ctx.font=S,this.ctx.fillStyle=yt(n.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",W=new EA(A.bounds.left,A.bounds.top+st(A.styles.paddingTop,A.bounds.width),A.bounds.width,Bu(n.lineHeight,n.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Bi(t.listValue,W),n.letterSpacing,Bu(n.lineHeight,n.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),$.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return kt(this,void 0,void 0,function(){var A,i,D,n,s,D,o,a,D,c,h,D,d,m,D,T,v,D,B,y,D;return Mt(this,function(E){switch(E.label){case 0:if(vt(t.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:E.sent(),A=0,i=t.negativeZIndex,E.label=2;case 2:return A<i.length?(D=i[A],[4,this.renderStack(D)]):[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?(D=s[n],[4,this.renderNode(D)]):[3,10];case 8:E.sent(),E.label=9;case 9:return n++,[3,7];case 10:o=0,a=t.nonPositionedFloats,E.label=11;case 11:return o<a.length?(D=a[o],[4,this.renderStack(D)]):[3,14];case 12:E.sent(),E.label=13;case 13:return o++,[3,11];case 14:c=0,h=t.nonPositionedInlineLevel,E.label=15;case 15:return c<h.length?(D=h[c],[4,this.renderStack(D)]):[3,18];case 16:E.sent(),E.label=17;case 17:return c++,[3,15];case 18:d=0,m=t.inlineLevel,E.label=19;case 19:return d<m.length?(D=m[d],[4,this.renderNode(D)]):[3,22];case 20:E.sent(),E.label=21;case 21:return d++,[3,19];case 22:T=0,v=t.zeroOrAutoZIndexOrTransformedOrOpacity,E.label=23;case 23:return T<v.length?(D=v[T],[4,this.renderStack(D)]):[3,26];case 24:E.sent(),E.label=25;case 25:return T++,[3,23];case 26:B=0,y=t.positiveZIndex,E.label=27;case 27:return B<y.length?(D=y[B],[4,this.renderStack(D)]):[3,30];case 28:E.sent(),E.label=29;case 29:return B++,[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(i,n){var s=sA(i)?i.start:i;n===0?A.ctx.moveTo(s.x,s.y):A.ctx.lineTo(s.x,s.y),sA(i)&&A.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(t,A,i,n){this.path(t),this.ctx.fillStyle=A,this.ctx.translate(i,n),this.ctx.fill(),this.ctx.translate(-i,-n)},e.prototype.resizeImage=function(t,A,i){var n;if(t.width===A&&t.height===i)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,i);var a=o.getContext("2d");return a.drawImage(t,0,0,t.width,t.height,0,0,A,i),o},e.prototype.renderBackgroundImage=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a;return Mt(this,function(c){switch(c.label){case 0:A=t.styles.backgroundImage.length-1,i=function(h){var d,m,T,ce,Ce,Ue,J,ie,V,v,ce,Ce,Ue,J,ie,B,y,D,E,N,S,W,$,j,V,X,ce,ae,de,J,ie,pe,Ce,Ue,xe,He,Le,Fe,we,ye,De,et;return Mt(this,function(Ye){switch(Ye.label){case 0:if(h.type!==0)return[3,5];d=void 0,m=h.url,Ye.label=1;case 1:return Ye.trys.push([1,3,,4]),[4,n.context.cache.match(m)];case 2:return d=Ye.sent(),[3,4];case 3:return Ye.sent(),n.context.logger.error("Error loading background-image "+m),[3,4];case 4:return d&&(T=Ta(t,A,[d.width,d.height,d.width/d.height]),ce=T[0],Ce=T[1],Ue=T[2],J=T[3],ie=T[4],V=n.ctx.createPattern(n.resizeImage(d,J,ie),"repeat"),n.renderRepeat(ce,V,Ce,Ue)),[3,6];case 5:HB(h)?(v=Ta(t,A,[null,null,null]),ce=v[0],Ce=v[1],Ue=v[2],J=v[3],ie=v[4],B=QB(h.angle,J,ie),y=B[0],D=B[1],E=B[2],N=B[3],S=B[4],W=document.createElement("canvas"),W.width=J,W.height=ie,$=W.getContext("2d"),j=$.createLinearGradient(D,N,E,S),au(h.stops,y).forEach(function(be){return j.addColorStop(be.stop,yt(be.color))}),$.fillStyle=j,$.fillRect(0,0,J,ie),J>0&&ie>0&&(V=n.ctx.createPattern(W,"repeat"),n.renderRepeat(ce,V,Ce,Ue))):LB(h)&&(X=Ta(t,A,[null,null,null]),ce=X[0],ae=X[1],de=X[2],J=X[3],ie=X[4],pe=h.position.length===0?[Jo]:h.position,Ce=st(pe[0],J),Ue=st(pe[pe.length-1],ie),xe=FB(h,Ce,Ue,J,ie),He=xe[0],Le=xe[1],He>0&&Le>0&&(Fe=n.ctx.createRadialGradient(ae+Ce,de+Ue,0,ae+Ce,de+Ue,He),au(h.stops,He*2).forEach(function(be){return Fe.addColorStop(be.stop,yt(be.color))}),n.path(ce),n.ctx.fillStyle=Fe,He!==Le?(we=t.bounds.left+.5*t.bounds.width,ye=t.bounds.top+.5*t.bounds.height,De=Le/He,et=1/De,n.ctx.save(),n.ctx.translate(we,ye),n.ctx.transform(1,0,0,De,0,0),n.ctx.translate(-we,-ye),n.ctx.fillRect(ae,et*(de-ye)+ye,J,ie*et),n.ctx.restore()):n.ctx.fill())),Ye.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?(a=o[s],[5,i(a)]):[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,i){return kt(this,void 0,void 0,function(){return Mt(this,function(n){return this.path(gd(i,A)),this.ctx.fillStyle=yt(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,A,i,n){return kt(this,void 0,void 0,function(){var s,o;return Mt(this,function(a){switch(a.label){case 0:return A<3?[4,this.renderSolidBorder(t,i,n)]:[3,2];case 1:return a.sent(),[2];case 2:return s=_v(n,i),this.path(s),this.ctx.fillStyle=yt(t),this.ctx.fill(),o=Dv(n,i),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return kt(this,void 0,void 0,function(){var A,i,n,s,o,a,c,h,d=this;return Mt(this,function(m){switch(m.label){case 0:return this.applyEffects(t.getEffects(2)),A=t.container.styles,i=!WA(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=$v(Hr(A.backgroundClip,0),t.curves),i||A.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),WA(A.backgroundColor)||(this.ctx.fillStyle=yt(A.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:m.sent(),this.ctx.restore(),A.boxShadow.slice(0).reverse().forEach(function(T){d.ctx.save();var v=As(t.curves),B=T.inset?0:Wv,y=Mv(v,-B+(T.inset?1:-1)*T.spread.number,(T.inset?1:-1)*T.spread.number,T.spread.number*(T.inset?-2:2),T.spread.number*(T.inset?-2:2));T.inset?(d.path(v),d.ctx.clip(),d.mask(y)):(d.mask(v),d.ctx.clip(),d.path(y)),d.ctx.shadowOffsetX=T.offsetX.number+B,d.ctx.shadowOffsetY=T.offsetY.number,d.ctx.shadowColor=yt(T.color),d.ctx.shadowBlur=T.blur.number,d.ctx.fillStyle=T.inset?yt(T.color):"rgba(0,0,0,1)",d.ctx.fill(),d.ctx.restore()}),m.label=2;case 2:o=0,a=0,c=n,m.label=3;case 3:return a<c.length?(h=c[a],h.style!==0&&!WA(h.color)&&h.width>0?h.style!==2?[3,5]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,2)]:[3,11]):[3,13];case 4:return m.sent(),[3,11];case 5:return h.style!==3?[3,7]:[4,this.renderDashedDottedBorder(h.color,h.width,o,t.curves,3)];case 6:return m.sent(),[3,11];case 7:return h.style!==4?[3,9]:[4,this.renderDoubleBorder(h.color,h.width,o,t.curves)];case 8:return m.sent(),[3,11];case 9:return[4,this.renderSolidBorder(h.color,o,t.curves)];case 10:m.sent(),m.label=11;case 11:o++,m.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,A,i,n,s){return kt(this,void 0,void 0,function(){var o,a,c,h,d,m,T,v,B,y,D,E,N,S,W,$,W,$;return Mt(this,function(j){return this.ctx.save(),o=kv(n,i),a=gd(n,i),s===2&&(this.path(a),this.ctx.clip()),sA(a[0])?(c=a[0].start.x,h=a[0].start.y):(c=a[0].x,h=a[0].y),sA(a[1])?(d=a[1].end.x,m=a[1].end.y):(d=a[1].x,m=a[1].y),i===0||i===2?T=Math.abs(c-d):T=Math.abs(h-m),this.ctx.beginPath(),s===3?this.formatPath(o):this.formatPath(a.slice(0,2)),v=A<3?A*3:A*2,B=A<3?A*2:A,s===3&&(v=A,B=A),y=!0,T<=v*2?y=!1:T<=v*2+B?(D=T/(2*v+B),v*=D,B*=D):(E=Math.floor((T+B)/(v+B)),N=(T-E*v)/(E-1),S=(T-(E+1)*v)/E,B=S<=0||Math.abs(B-N)<Math.abs(B-S)?N:S),y&&(s===3?this.ctx.setLineDash([0,v+B]):this.ctx.setLineDash([v,B])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=A):this.ctx.lineWidth=A*2+1.1,this.ctx.strokeStyle=yt(t),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(sA(a[0])&&(W=a[3],$=a[0],this.ctx.beginPath(),this.formatPath([new Qe(W.end.x,W.end.y),new Qe($.start.x,$.start.y)]),this.ctx.stroke()),sA(a[1])&&(W=a[1],$=a[2],this.ctx.beginPath(),this.formatPath([new Qe(W.end.x,W.end.y),new Qe($.start.x,$.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return kt(this,void 0,void 0,function(){var A;return Mt(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=yt(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),A=Iv(t),[4,this.renderStack(A)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e})(Cd),Rv=function(r){return r instanceof Wu||r instanceof zu?!0:r instanceof da&&r.type!==Jn&&r.type!==Zn},$v=function(r,e){switch(r){case 0:return As(e);case 2:return Uv(e);default:return rs(e)}},Xv=function(r){switch(r){case 1:return"center";case 2:return"right";default:return"left"}},Zv=["-apple-system","system-ui"],Jv=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(e){return Zv.indexOf(e)===-1}):r},qv=(function(r){uA(e,r);function e(t,A){var i=r.call(this,t,A)||this;return i.canvas=A.canvas?A.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=A,i.canvas.width=Math.floor(A.width*A.scale),i.canvas.height=Math.floor(A.height*A.scale),i.canvas.style.width=A.width+"px",i.canvas.style.height=A.height+"px",i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-A.x,-A.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+A.width+"x"+A.height+" at "+A.x+","+A.y+") with scale "+A.scale),i}return e.prototype.render=function(t){return kt(this,void 0,void 0,function(){var A,i;return Mt(this,function(n){switch(n.label){case 0:return A=ca(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,Yv(A)];case 1:return i=n.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=yt(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e})(Cd),Yv=function(r){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(r))})},jv=(function(){function r(e){var t=e.id,A=e.enabled;this.id=t,this.enabled=A,this.start=Date.now()}return r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var e=[],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,fn([this.id,this.getTime()+"ms"],e))},r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.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,fn([this.id,this.getTime()+"ms"],e)):this.info.apply(this,e))},r.instances={},r})(),ey=(function(){function r(e,t){var A;this.windowBounds=t,this.instanceName="#"+r.instanceCount++,this.logger=new jv({id:this.instanceName,enabled:e.logging}),this.cache=(A=e.cache)!==null&&A!==void 0?A:new Cv(this,e)}return r.instanceCount=1,r})(),ty=function(r,e){return e===void 0&&(e={}),Ay(r,e)};typeof window<"u"&&hd.setContext(window);var Ay=function(r,e){return kt(void 0,void 0,void 0,function(){var t,A,i,n,s,o,a,c,h,d,m,T,v,B,y,D,E,N,S,W,j,$,j,V,X,ce,ae,de,J,ie,pe,Ce,Ue,xe,He,Le,Fe,we,ye,De;return Mt(this,function(et){switch(et.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(t=r.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 i={allowTaint:(V=e.allowTaint)!==null&&V!==void 0?V:!1,imageTimeout:(X=e.imageTimeout)!==null&&X!==void 0?X:15e3,proxy:e.proxy,useCORS:(ce=e.useCORS)!==null&&ce!==void 0?ce:!1},n=Eo({logging:(ae=e.logging)!==null&&ae!==void 0?ae:!0,cache:e.cache},i),s={windowWidth:(de=e.windowWidth)!==null&&de!==void 0?de:A.innerWidth,windowHeight:(J=e.windowHeight)!==null&&J!==void 0?J:A.innerHeight,scrollX:(ie=e.scrollX)!==null&&ie!==void 0?ie:A.pageXOffset,scrollY:(pe=e.scrollY)!==null&&pe!==void 0?pe:A.pageYOffset},o=new EA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),a=new ey(n,o),c=(Ce=e.foreignObjectRendering)!==null&&Ce!==void 0?Ce:!1,h={allowTaint:(Ue=e.allowTaint)!==null&&Ue!==void 0?Ue:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},a.logger.debug("Starting document clone with size "+o.width+"x"+o.height+" scrolled to "+-o.left+","+-o.top),d=new ld(a,r,h),m=d.clonedReferenceElement,m?[4,d.toIFrame(t,o)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return T=et.sent(),v=fa(m)||rv(m)?Mg(m.ownerDocument):mn(a,m),B=v.width,y=v.height,D=v.left,E=v.top,N=ry(a,m,e.backgroundColor),S={canvas:e.canvas,backgroundColor:N,scale:(He=(xe=e.scale)!==null&&xe!==void 0?xe:A.devicePixelRatio)!==null&&He!==void 0?He:1,x:((Le=e.x)!==null&&Le!==void 0?Le:0)+D,y:((Fe=e.y)!==null&&Fe!==void 0?Fe:0)+E,width:(we=e.width)!==null&&we!==void 0?we:Math.ceil(B),height:(ye=e.height)!==null&&ye!==void 0?ye:Math.ceil(y)},c?(a.logger.debug("Document cloned, using foreign object rendering"),j=new qv(a,S),[4,j.render(m)]):[3,3];case 2:return W=et.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+D+","+E+" with size "+B+"x"+y+" using computed rendering"),a.logger.debug("Starting DOM parsing"),$=$u(a,m),N===$.styles.backgroundColor&&($.styles.backgroundColor=HA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+S.x+","+S.y+" with size "+S.width+"x"+S.height),j=new Gv(a,S),[4,j.render($)];case 4:W=et.sent(),et.label=5;case 5:return(!((De=e.removeContainer)!==null&&De!==void 0)||De)&&(ld.destroy(T)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,W]}})})},ry=function(r,e,t){var A=e.ownerDocument,i=A.documentElement?mi(r,getComputedStyle(A.documentElement).backgroundColor):HA.TRANSPARENT,n=A.body?mi(r,getComputedStyle(A.body).backgroundColor):HA.TRANSPARENT,s=typeof t=="string"?mi(r,t):t===null?HA.TRANSPARENT:4294967295;return e===A.documentElement?WA(i)?WA(n)?s:n:i:s};const iy=({state:r="idle",symbol:e="",onRetry:t,theme:A="dark"})=>{const[i,n]=Y.useState(5);if(Y.useEffect(()=>{if(r!=="reconnecting"){n(5);return}n(5);const T=setInterval(()=>{n(v=>v<=1?(clearInterval(T),0):v-1)},1e3);return()=>clearInterval(T)},[r]),r==="idle")return null;const s=A==="light",o=s?"rgba(248,250,252,0.90)":"rgba(18,22,29,0.88)",a=s?"#ffffff":"#1a1f2b",c=s?"rgba(226,232,240,0.9)":"rgba(51,65,85,0.6)",h=s?"#1e293b":"#e2e8f0",d="#64748b",m=s?"#94a3b8":"#475569";return l.jsxs("div",{className:"absolute inset-0 z-40 flex items-center justify-center transition-opacity duration-300",style:{backgroundColor:o},children:[r==="loading"&&l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[l.jsxs("div",{className:"relative w-10 h-10",children:[l.jsx("div",{className:"absolute inset-0 rounded-full border-2",style:{borderColor:s?"rgba(14,165,233,0.15)":"rgba(56,189,248,0.15)"}}),l.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-t-transparent animate-spin",style:{borderColor:s?"#0ea5e9":"#38bdf8",borderTopColor:"transparent"}})]}),l.jsxs("div",{className:"flex flex-col items-center gap-1",children:[l.jsx("span",{className:"text-sm font-medium tracking-wide",style:{color:h},children:"Connecting to price feed"}),l.jsx("span",{className:"text-xs",style:{color:d},children:e?`Loading ${e}…`:"This may take a few seconds."})]})]}),r==="noData"&&l.jsxs("div",{className:"flex flex-col items-center gap-3 px-7 py-6 rounded-xl",style:{backgroundColor:a,border:`1px solid ${c}`,boxShadow:"0 4px 24px rgba(0,0,0,0.10)"},children:[l.jsx("svg",{width:"38",height:"38",viewBox:"0 0 24 24",fill:"none",stroke:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center p-3",children:[l.jsx("span",{className:"text-sm font-semibold",style:{color:h},children:"Chart data unavailable"}),l.jsx("span",{className:"text-xs max-w-[220px] leading-relaxed",style:{color:d},children:e?`${e} does not have historical data available on this server.`:"Historical candle data is not available for this instrument."}),l.jsx("span",{className:"text-xs",style:{color:d},children:"Try switching the timeframe or selecting a different symbol."})]}),t&&l.jsx("button",{onClick:t,className:"mt-1 px-4 py-1.5 rounded-md text-xs font-medium transition-colors duration-150",style:{border:`1px solid ${c}`,color:d,backgroundColor:"transparent"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=s?"#f1f5f9":"rgba(51,65,85,0.4)"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent"},children:"Refresh"})]}),r==="reconnecting"&&l.jsxs("div",{className:"flex flex-col items-center gap-3 px-7 py-6 rounded-xl",style:{backgroundColor:a,border:`1px solid ${c}`,boxShadow:"0 4px 24px rgba(0,0,0,0.10)"},children:[l.jsxs("div",{className:"relative flex items-center justify-center w-8 h-8",children:[l.jsx("span",{className:"absolute w-6 h-6 rounded-full bg-amber-500/25 animate-ping"}),l.jsx("span",{className:"relative w-3 h-3 rounded-full bg-amber-500"})]}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[l.jsx("span",{className:"text-sm font-semibold",style:{color:h},children:"Connection interrupted"}),l.jsx("span",{className:"text-xs",style:{color:d},children:i>0?`Reconnecting in ${i}s…`:"Attempting to reconnect…"})]}),t&&l.jsx("button",{onClick:()=>{n(5),t()},className:"mt-1 px-4 py-1.5 rounded-md text-xs font-medium transition-colors duration-150",style:{border:"1px solid rgba(245,158,11,0.5)",color:"#f59e0b",backgroundColor:"transparent"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="rgba(245,158,11,0.08)"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent"},children:"Retry now"})]})]})},ny={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};class sy{constructor(e,t,A="#3b82f6",i=2){this.price=e,this.originTime=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null,this._paneView=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=o.context,c=n._chart,h=n._series;if(!c||!h)return;const d=h.priceToCoordinate(n.price);if(d==null)return;const m=Math.round(d*o.verticalPixelRatio),T=c.timeScale().timeToCoordinate(n.originTime),v=T==null?0:Math.max(0,Math.round(T*o.horizontalPixelRatio)),B=o.bitmapSize.width;if(v>=B)return;a.save(),a.beginPath(),a.strokeStyle=n.color,a.lineWidth=n.lineWidth*o.verticalPixelRatio,a.setLineDash([]),a.moveTo(v,m),a.lineTo(B,m),a.stroke(),a.beginPath(),a.fillStyle=n.color;const y=3*o.verticalPixelRatio;a.arc(v,m,y,0,Math.PI*2),a.fill(),a.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class oy{constructor(e,t,A,i="#3b82f6",n=2){this.p1=e,this.p2=t,this.info=A,this.color=i,this.lineWidth=n,this.visible=!0,this._chart=null,this._series=null;const s=this;this._paneView={renderer(){return{draw(o){o.useBitmapCoordinateSpace(a=>{if(!s.visible)return;const c=s._chart,h=s._series;if(!c||!h)return;const d=a.horizontalPixelRatio,m=a.verticalPixelRatio,T=c.timeScale().timeToCoordinate(s.p1.rawTime),v=c.timeScale().timeToCoordinate(s.p2.rawTime),B=h.priceToCoordinate(s.p1.price),y=h.priceToCoordinate(s.p2.price);if(T==null||v==null||B==null||y==null)return;const D=Math.round(T*d),E=Math.round(B*m),N=Math.round(v*d),S=Math.round(y*m),W=a.context;W.save(),W.beginPath(),W.strokeStyle=s.color,W.lineWidth=s.lineWidth*m,W.setLineDash([]),W.moveTo(D,E),W.lineTo(N,S),W.stroke(),W.beginPath(),W.fillStyle=s.color,W.arc(D,E,3*m,0,Math.PI*2),W.fill(),W.beginPath(),W.arc(N,S,3*m,0,Math.PI*2),W.fill();const{priceDiff:$,pricePct:j,bars:V,days:X,angle:ce}=s.info,ae=$>=0?"+":"",de=[`${ae}${$.toFixed(5)} (${ae}${j.toFixed(2)}%)`,`${V} bars (${X} days)`,`∠ ${ce.toFixed(1)}°`],J=Math.round(11*m);W.font=`${J}px sans-serif`;const ie=J*1.6,pe=8*m,Ce=Math.max(...de.map(et=>W.measureText(et).width))+pe*2,Ue=de.length*ie+pe*2,xe=N+10*d,He=S-Ue-4*m,Le=a.bitmapSize.width,Fe=a.bitmapSize.height,we=Math.min(Math.max(0,xe),Le-Ce-4*d),ye=Math.min(Math.max(4*m,He),Fe-Ue-4*m),De=4*m;W.beginPath(),W.moveTo(we+De,ye),W.lineTo(we+Ce-De,ye),W.quadraticCurveTo(we+Ce,ye,we+Ce,ye+De),W.lineTo(we+Ce,ye+Ue-De),W.quadraticCurveTo(we+Ce,ye+Ue,we+Ce-De,ye+Ue),W.lineTo(we+De,ye+Ue),W.quadraticCurveTo(we,ye+Ue,we,ye+Ue-De),W.lineTo(we,ye+De),W.quadraticCurveTo(we,ye,we+De,ye),W.closePath(),W.fillStyle="rgba(30, 41, 59, 0.92)",W.fill(),W.strokeStyle=s.color,W.lineWidth=1*m,W.stroke(),W.fillStyle="#e2e8f0",W.textAlign="left",de.forEach((et,Ye)=>{W.fillText(et,we+pe,ye+pe+J+Ye*ie)}),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class vd{constructor(e,t,A){this.p1=e,this.p2=t,this.info=A,this.visible=!0,this._chart=null,this._series=null;const i=t.price>=e.price;this.color=i?"#3b82f6":"#ef5350",this.fillColor=i?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||T==null||v==null||B==null)return;const y=Math.round(m*h),D=Math.round(v*d),E=Math.round(T*h),N=Math.round(B*d),S=o.context;S.save(),S.fillStyle=n.fillColor,S.fillRect(Math.min(y,E),Math.min(D,N),Math.abs(E-y),Math.abs(N-D)),S.strokeStyle=n.color,S.lineWidth=1*d,S.setLineDash([]),S.strokeRect(Math.min(y,E),Math.min(D,N),Math.abs(E-y),Math.abs(N-D)),S.beginPath(),S.strokeStyle=n.color,S.lineWidth=2*d,S.moveTo(y,D),S.lineTo(E,N),S.stroke(),S.fillStyle=n.color,S.beginPath(),S.arc(y,D,3*d,0,Math.PI*2),S.fill(),S.beginPath(),S.arc(E,N,3*d,0,Math.PI*2),S.fill();const{priceDiff:W,pricePct:$,bars:j,days:V}=n.info,X=W>=0?"+":"",ce=[`${X}${W.toFixed(5)} (${X}${$.toFixed(2)}%)`,`${j} bars (${V} days)`],ae=Math.round(11*d);S.font=`${ae}px sans-serif`;const de=ae*1.6,J=8*d,ie=Math.max(...ce.map(ye=>S.measureText(ye).width))+J*2,pe=ce.length*de+J*2,Ce=o.bitmapSize.width,Ue=o.bitmapSize.height,xe=E+10*h,He=N-pe-4*d,Le=Math.min(Math.max(0,xe),Ce-ie-4*h),Fe=Math.min(Math.max(4*d,He),Ue-pe-4*d),we=4*d;S.beginPath(),S.moveTo(Le+we,Fe),S.lineTo(Le+ie-we,Fe),S.quadraticCurveTo(Le+ie,Fe,Le+ie,Fe+we),S.lineTo(Le+ie,Fe+pe-we),S.quadraticCurveTo(Le+ie,Fe+pe,Le+ie-we,Fe+pe),S.lineTo(Le+we,Fe+pe),S.quadraticCurveTo(Le,Fe+pe,Le,Fe+pe-we),S.lineTo(Le,Fe+we),S.quadraticCurveTo(Le,Fe,Le+we,Fe),S.closePath(),S.fillStyle="rgba(30, 41, 59, 0.92)",S.fill(),S.strokeStyle=n.color,S.lineWidth=1*d,S.stroke(),S.fillStyle="#e2e8f0",S.textAlign="left",ce.forEach((ye,De)=>{S.fillText(ye,Le+J,Fe+J+ae+De*de)}),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ay{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=o.timeScale().timeToCoordinate(i.p2.rawTime),T=a.priceToCoordinate(i.p1.price),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||T==null||v==null)return;const B=Math.min(d,m)*c,y=Math.max(d,m)*c,D=Math.min(T,v)*h,E=Math.max(T,v)*h,N=y-B,S=E-D;if(N<.5||S<.5)return;const W=s.context;W.save(),W.fillStyle=i.fillColor,W.fillRect(B,D,N,S),W.strokeStyle=i.strokeColor,W.lineWidth=i.lineWidth*h,W.setLineDash([]),W.strokeRect(B,D,N,S),W.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class ly{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=a.priceToCoordinate(i.p1.price),T=o.timeScale().timeToCoordinate(i.p2.rawTime),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||T==null||v==null)return;const B=d*c,y=m*h,D=T*c,E=v*h,N=Math.hypot(D-B,E-y);if(N<.5)return;const S=s.context;S.save(),S.strokeStyle=i.strokeColor,S.lineWidth=i.lineWidth*h,S.setLineDash([]),S.beginPath(),S.arc(B,y,N,0,Math.PI*2),S.stroke(),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class cy{constructor(e,t,A,i={}){this.p1=e,this.p2=t,this.p3=A,this.visible=!0,this.strokeColor=i.strokeColor??"#7aa6ae",this.fillColor=i.fillColor??"rgba(148, 163, 184, 0.18)",this.lineWidth=i.lineWidth??1,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=c.priceToCoordinate(n.p1.price),v=a.timeScale().timeToCoordinate(n.p2.rawTime),B=c.priceToCoordinate(n.p2.price),y=a.timeScale().timeToCoordinate(n.p3.rawTime),D=c.priceToCoordinate(n.p3.price);if(m==null||T==null||v==null||B==null||y==null||D==null)return;const E=m*h,N=T*d,S=v*h,W=B*d,$=y*h,j=D*d,V=o.context;V.save(),V.beginPath(),V.moveTo(E,N),V.lineTo(S,W),V.lineTo($,j),V.closePath(),V.fillStyle=n.fillColor,V.fill(),V.strokeStyle=n.strokeColor,V.lineWidth=n.lineWidth*d,V.setLineDash([]),V.stroke(),V.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class hy{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.p1.rawTime),m=a.priceToCoordinate(i.p1.price),T=o.timeScale().timeToCoordinate(i.p2.rawTime),v=a.priceToCoordinate(i.p2.price);if(d==null||m==null||T==null||v==null)return;const B=d*c,y=m*h,D=T*c,E=v*h,N=D-B,S=E-y,W=Math.hypot(N,S);if(W<.5)return;const $=s.context;if($.save(),$.strokeStyle=i.strokeColor,$.lineWidth=i.lineWidth*h,$.setLineDash([]),i.previewAsLine)$.beginPath(),$.moveTo(B,y),$.lineTo(D,E),$.stroke();else{const j=(B+D)/2,V=(y+E)/2,X=Math.atan2(S,N),ce=W/2,ae=Math.max(1,ce*Math.max(.05,i.minorRatio));$.beginPath(),$.ellipse(j,V,ce,ae,X,0,Math.PI*2),$.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 yd{constructor(e,t,A="#f59e0b",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||T==null||v==null||B==null)return;const y=Math.round(m*h),D=Math.round(v*d),E=Math.round(T*h),N=Math.round(B*d),S=o.context;S.save(),S.beginPath(),S.strokeStyle=n.color,S.lineWidth=n.lineWidth*d,S.setLineDash([]),S.moveTo(y,D),S.lineTo(E,N),S.stroke();const W=Math.atan2(N-D,E-y),$=11*d,j=Math.PI/7,V=E-$*Math.cos(W-j),X=N-$*Math.sin(W-j),ce=E-$*Math.cos(W+j),ae=N-$*Math.sin(W+j);S.beginPath(),S.fillStyle=n.color,S.moveTo(E,N),S.lineTo(V,X),S.lineTo(ce,ae),S.closePath(),S.fill(),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class uy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||T==null||v==null||B==null)return;const y=m*h,D=v*d;let E=T-m,N=B-v;E<0&&(E=-E,N=-N),Math.abs(E)<1e-4&&(E=1e-4);const S=N*d/(E*h),W=Math.max(0,y),$=D+S*(W-y),j=o.bitmapSize.width,V=D+S*(j-y),X=o.context;X.save(),X.beginPath(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.moveTo(W,$),X.lineTo(j,V),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class dy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||T==null||v==null||B==null)return;const y=m*h,D=v*d;let E=T-m,N=B-v;Math.abs(E)<1e-4&&(E=1e-4);const S=N*d/(E*h),W=0,$=D+S*(W-y),j=o.bitmapSize.width,V=D+S*(j-y),X=o.context;X.save(),X.beginPath(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.moveTo(W,$),X.lineTo(j,V),X.stroke(),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class py{constructor(e,t="#7aa6ae",A=2){this.center=e,this.color=t,this.lineWidth=A,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=o.timeScale().timeToCoordinate(i.center.rawTime),m=a.priceToCoordinate(i.center.price);if(d==null||m==null)return;const T=Math.round(d*c),v=Math.round(m*h),B=s.bitmapSize.width,y=s.bitmapSize.height,D=s.context;D.save(),D.strokeStyle=i.color,D.lineWidth=i.lineWidth*h,D.setLineDash([]),D.beginPath(),D.moveTo(0,v),D.lineTo(B,v),D.stroke(),D.beginPath(),D.moveTo(T,0),D.lineTo(T,y),D.stroke(),D.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class fy{constructor(e,t,A="#7aa6ae",i=2){this.p1=e,this.p2=t,this.color=A,this.lineWidth=i,this.visible=!0,this._chart=null,this._series=null;const n=this;this._paneView={renderer(){return{draw(s){s.useBitmapCoordinateSpace(o=>{if(!n.visible)return;const a=n._chart,c=n._series;if(!a||!c)return;const h=o.horizontalPixelRatio,d=o.verticalPixelRatio,m=a.timeScale().timeToCoordinate(n.p1.rawTime),T=a.timeScale().timeToCoordinate(n.p2.rawTime),v=c.priceToCoordinate(n.p1.price),B=c.priceToCoordinate(n.p2.price);if(m==null||T==null||v==null||B==null)return;const y=m*h,D=v*d,E=T*h,N=B*d,S=y-E,W=D-N;if(Math.hypot(S,W)<1e-4)return;const j=Math.atan2(W,S),V=Math.round(Math.abs(j*180/Math.PI)),X=o.context;X.save(),X.strokeStyle=n.color,X.lineWidth=n.lineWidth*d,X.setLineDash([]),X.beginPath(),X.moveTo(y,D),X.lineTo(E,N),X.stroke();const ce=28*d;X.beginPath(),X.lineWidth=1*d,X.strokeStyle="rgba(122,166,174,0.55)",X.moveTo(E,N),X.lineTo(E+ce,N),X.stroke(),X.beginPath(),X.strokeStyle="rgba(122,166,174,0.45)",X.arc(E,N,ce,0,j,j<0),X.stroke(),X.fillStyle="#4b7c86",X.font=`${Math.round(10*d)}px sans-serif`,X.textAlign="left",X.textBaseline="middle";const ae=E+(ce+10*d)*Math.cos(j/2),de=N+(ce+10*d)*Math.sin(j/2);X.fillText(`${V}°`,ae,de),X.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class my{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),T=a.priceToCoordinate(i.p1.price),v=o.timeScale().timeToCoordinate(i.p2.rawTime),B=a.priceToCoordinate(i.p2.price),y=o.timeScale().timeToCoordinate(i.p3.rawTime),D=a.priceToCoordinate(i.p3.price);if(m==null||T==null||v==null||B==null||y==null||D==null)return;const E=m*c,N=T*h,S=v*c,W=B*h,$=y*c,j=D*h,V=(S+$)/2,X=(W+j)/2;let ce=V-E,ae=X-N;Math.abs(ce)<1e-4&&(ce=1e-4);const de=ae/ce,J=s.bitmapSize.width,ie=(S-$)/2,pe=(W-j)/2,Ce=ye=>({x:V+ie*ye,y:X+pe*ye}),Ue=(ye,De)=>({x:J,y:De+de*(J-ye)}),xe=Ce(1),He=Ce(-1),Le=Ue(xe.x,xe.y),Fe=Ue(He.x,He.y);d.save(),d.beginPath(),d.moveTo(xe.x,xe.y),d.lineTo(Le.x,Le.y),d.lineTo(Fe.x,Fe.y),d.lineTo(He.x,He.y),d.closePath(),d.fillStyle="rgba(148, 163, 184, 0.2)",d.fill(),d.beginPath(),d.strokeStyle="rgba(148, 163, 184, 0.9)",d.lineWidth=1*h,d.moveTo(S,W),d.lineTo($,j),d.stroke(),i._levels.forEach(ye=>{const De=Ce(ye.k),et=Ue(De.x,De.y);d.beginPath(),d.strokeStyle=ye.color,d.lineWidth=ye.width*h,d.moveTo(De.x,De.y),d.lineTo(et.x,et.y),d.stroke()});const we=Ue(E,N);d.beginPath(),d.strokeStyle="rgba(161, 98, 7, 0.9)",d.lineWidth=1.1*h,d.moveTo(E,N),d.lineTo(we.x,we.y),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class gy{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(i){i.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const a=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,d=s.timeScale().timeToCoordinate(A.p1.rawTime),m=o.priceToCoordinate(A.p1.price),T=s.timeScale().timeToCoordinate(A.p2.rawTime),v=o.priceToCoordinate(A.p2.price);if(d==null||m==null||T==null||v==null)return;const B=d*a,y=m*c,D=T*a,E=v*c,N=n.bitmapSize.width,S=Math.abs(D-B)<1e-4?1:D-B,W=(E-y)/S,$=D>=B?1:-1,j=$>0?N:0,V=B+$*Math.min(220*a,Math.max(80*a,N*.35)),X=A._rays.map(ae=>{const de=W*ae.ratio;return{...ae,yEnd:y+de*(j-B),yLabel:y+de*(V-B)}});h.save();const ce=(ae,de,J)=>{!ae||!de||(h.beginPath(),h.moveTo(B,y),h.lineTo(j,ae.yEnd),h.lineTo(j,de.yEnd),h.closePath(),h.fillStyle=J,h.fill())};ce(X[0],X[3],"rgba(161, 98, 7, 0.10)"),ce(X[3],X[4],"rgba(5, 150, 105, 0.10)"),ce(X[4],X[5],"rgba(107, 114, 128, 0.12)"),X.forEach(ae=>{h.beginPath(),h.strokeStyle=ae.color,h.lineWidth=1*c,h.moveTo(B,y),h.lineTo(j,ae.yEnd),h.stroke()}),h.font=`${Math.max(10,Math.round(10*c))}px sans-serif`,h.textAlign=$>0?"left":"right",h.textBaseline="middle",X.forEach(ae=>{h.fillStyle=ae.color;const de=V+($>0?4*a:-4*a),J=ae.yLabel;J<-20||J>n.bitmapSize.height+20||h.fillText(ae.label,de,J)}),h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class wy{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=s.horizontalPixelRatio,h=s.verticalPixelRatio,d=s.context,m=o.timeScale().timeToCoordinate(i.p1.rawTime),T=a.priceToCoordinate(i.p1.price),v=o.timeScale().timeToCoordinate(i.p2.rawTime),B=a.priceToCoordinate(i.p2.price);if(m==null||T==null||v==null||B==null)return;const y=m*c,D=T*h,E=v*c,N=B*h,S=E-y,W=N-D,$=Math.hypot(S,W);if($<1e-4)return;const j=S/$,V=W/$,X=-V,ce=j,ae=E+X*$,de=N+ce*$,J=y+X*$,ie=D+ce*$,pe=(Ue,xe)=>({x:y+j*$*Ue+X*$*xe,y:D+V*$*Ue+ce*$*xe});d.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 Ue=0;Ue<i.divisions;Ue++){const xe=Ue/i.divisions,He=(Ue+1)/i.divisions,Le=pe(0,xe),Fe=pe(1,xe),we=pe(1,He),ye=pe(0,He);d.beginPath(),d.moveTo(Le.x,Le.y),d.lineTo(Fe.x,Fe.y),d.lineTo(we.x,we.y),d.lineTo(ye.x,ye.y),d.closePath(),d.fillStyle=Ce[Ue%Ce.length],d.fill()}d.lineWidth=1*h,d.strokeStyle="rgba(148, 163, 184, 0.55)";for(let Ue=0;Ue<=i.divisions;Ue++){const xe=Ue/i.divisions,He=pe(0,xe),Le=pe(1,xe),Fe=pe(xe,0),we=pe(xe,1);d.beginPath(),d.moveTo(He.x,He.y),d.lineTo(Le.x,Le.y),d.stroke(),d.beginPath(),d.moveTo(Fe.x,Fe.y),d.lineTo(we.x,we.y),d.stroke()}d.strokeStyle="rgba(100, 116, 139, 0.85)",d.lineWidth=1*h,d.beginPath(),d.moveTo(y,D),d.lineTo(ae,de),d.stroke(),d.beginPath(),d.moveTo(E,N),d.lineTo(J,ie),d.stroke(),d.strokeStyle="rgba(122, 166, 174, 0.95)",d.lineWidth=1.2*h,d.beginPath(),d.moveTo(y,D),d.lineTo(E,N),d.lineTo(ae,de),d.lineTo(J,ie),d.closePath(),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xa{constructor(e,t,A,i,n="#16a34a",s=2,o="rgba(22, 163, 74, 0.12)"){this.p1=e,this.p2=t,this.p3=A,this.p4=i,this.color=n,this.lineWidth=s,this.fillColor=o,this.visible=!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(h=>{if(!a.visible)return;const d=a._chart,m=a._series;if(!d||!m)return;const T=h.horizontalPixelRatio,v=h.verticalPixelRatio,B=[a.p1,a.p3,a.p4,a.p2].map(j=>{const V=d.timeScale().timeToCoordinate(j.rawTime),X=m.priceToCoordinate(j.price);return V==null||X==null?null:{x:V*T,y:X*v}}).filter(Boolean);if(B.length!==4)return;const[y,D,E,N]=B,S=h.context;S.save(),S.beginPath(),S.moveTo(y.x,y.y),S.lineTo(D.x,D.y),S.lineTo(E.x,E.y),S.lineTo(N.x,N.y),S.closePath(),S.fillStyle=a.fillColor,S.fill(),S.strokeStyle=a.color,S.lineWidth=a.lineWidth*v,S.setLineDash([]),S.beginPath(),S.moveTo(y.x,y.y),S.lineTo(D.x,D.y),S.moveTo(N.x,N.y),S.lineTo(E.x,E.y),S.moveTo(y.x,y.y),S.lineTo(N.x,N.y),S.moveTo(D.x,D.y),S.lineTo(E.x,E.y),S.stroke(),S.fillStyle="#ffffff",S.strokeStyle="#3b82f6",S.lineWidth=2*v,[y,D,E,N].forEach(j=>{S.beginPath(),S.arc(j.x,j.y,6*v,0,Math.PI*2),S.fill(),S.stroke()});const W=[a.p1,a.p3,a.p2,a.p4],$=[y,D,N,E];S.fillStyle=a.color,S.font=`${Math.round(10*v)}px sans-serif`,S.textAlign="left",S.textBaseline="middle",$.forEach((j,V)=>{const X=W[V]?.price;typeof X=="number"&&S.fillText(X.toFixed(5),j.x+8*T,j.y)}),S.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class bd extends xa{constructor(e,t,A,i,n="#3b82f6",s=2){super(e,t,A,i,n,s,"rgba(59, 130, 246, 0.12)")}}class Td{constructor(e,t,A,i,n,s={}){this.p1=e,this.p2=t,this.b1=A,this.b2=i,this.p3=n,this.visible=!0,this.strokeColor=s.strokeColor??"#8b5cf6",this.fillColor=s.fillColor??"rgba(148, 163, 184, 0.14)",this.lineWidth=s.lineWidth??1.25,this._chart=null,this._series=null;const o=this;this._paneView={renderer(){return{draw(a){a.useBitmapCoordinateSpace(c=>{if(!o.visible)return;const h=o._chart,d=o._series;if(!h||!d)return;const m=c.horizontalPixelRatio,T=c.verticalPixelRatio,v=c.context,B=S=>{const W=h.timeScale().timeToCoordinate(S.rawTime),$=d.priceToCoordinate(S.price);return W==null||$==null?null:{x:W*m,y:$*T}},y=B(o.p1),D=B(o.p2),E=B(o.b2),N=B(o.b1);!y||!D||!E||!N||(v.save(),v.beginPath(),v.moveTo(y.x,y.y),v.lineTo(D.x,D.y),v.lineTo(E.x,E.y),v.lineTo(N.x,N.y),v.closePath(),v.fillStyle=o.fillColor,v.fill(),v.strokeStyle=o.strokeColor,v.lineWidth=o.lineWidth*T,v.setLineDash([]),v.beginPath(),v.moveTo(y.x,y.y),v.lineTo(D.x,D.y),v.stroke(),v.beginPath(),v.moveTo(N.x,N.y),v.lineTo(E.x,E.y),v.stroke(),v.restore())})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class Qa{constructor(e,t,A,i,n,s,o={}){this.mid1=e,this.mid2=t,this.top1=A,this.top2=i,this.bot1=n,this.bot2=s,this.visible=!0,this.upperStrokeColor=o.upperStrokeColor??"rgba(99, 102, 241, 0.8)",this.centerStrokeColor=o.centerStrokeColor??"rgba(239, 68, 68, 0.65)",this.lowerStrokeColor=o.lowerStrokeColor??"rgba(99, 102, 241, 0.8)",this.upperFillColor=o.upperFillColor??"rgba(99, 102, 241, 0.18)",this.lowerFillColor=o.lowerFillColor??"rgba(239, 68, 68, 0.16)",this.lineWidth=o.lineWidth??1,this.labelColor=o.labelColor??"#1d4ed8",this.showDeviationLabel=o.showDeviationLabel??!0,this._chart=null,this._series=null;const a=this;this._paneView={renderer(){return{draw(c){c.useBitmapCoordinateSpace(h=>{if(!a.visible)return;const d=a._chart,m=a._series;if(!d||!m)return;const T=h.horizontalPixelRatio,v=h.verticalPixelRatio,B=h.context,y=V=>{const X=d.timeScale().timeToCoordinate(V.rawTime),ce=m.priceToCoordinate(V.price);return X==null||ce==null?null:{x:X*T,y:ce*v}},D=y(a.mid1),E=y(a.mid2),N=y(a.top1),S=y(a.top2),W=y(a.bot1),$=y(a.bot2);if(!D||!E||!N||!S||!W||!$)return;B.save(),B.beginPath(),B.moveTo(D.x,D.y),B.lineTo(E.x,E.y),B.lineTo(S.x,S.y),B.lineTo(N.x,N.y),B.closePath(),B.fillStyle=a.upperFillColor,B.fill(),B.beginPath(),B.moveTo(W.x,W.y),B.lineTo($.x,$.y),B.lineTo(E.x,E.y),B.lineTo(D.x,D.y),B.closePath(),B.fillStyle=a.lowerFillColor,B.fill();const j=(V,X,ce)=>{B.beginPath(),B.strokeStyle=ce,B.lineWidth=a.lineWidth*v,B.setLineDash([]),B.moveTo(V.x,V.y),B.lineTo(X.x,X.y),B.stroke()};if(j(N,S,a.upperStrokeColor),j(D,E,a.centerStrokeColor),j(W,$,a.lowerStrokeColor),a.showDeviationLabel){const V=Math.abs(a.top1.price-a.mid1.price),X=Number.isFinite(V)?V.toFixed(5):null;if(X){const ce=Math.max(10,Math.round(10*v));B.fillStyle=a.labelColor,B.font=`${ce}px sans-serif`,B.textAlign="left",B.textBaseline="top",B.fillText(X,W.x+2*T,W.y+10*v)}}B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class xd extends Qa{}class Qd{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(i){i.useBitmapCoordinateSpace(n=>{if(!A.visible)return;const s=A._chart,o=A._series;if(!s||!o)return;const a=n.horizontalPixelRatio,c=n.verticalPixelRatio,h=n.context,d=n.bitmapSize.width;n.bitmapSize.height;const m=A.p1.price,T=A.p2.price,v=m-T,B=V=>T+v*V,y=s.timeScale().timeToCoordinate(A.p1.rawTime),D=s.timeScale().timeToCoordinate(A.p2.rawTime),E=o.priceToCoordinate(m),N=o.priceToCoordinate(T),S=y!=null&&D!=null?Math.round(Math.min(y,D)*a):0,W=y!=null&&D!=null?Math.round(Math.max(y,D)*a):d,$=W-S;h.save(),A._zoneFills.forEach(({from:V,to:X,color:ce})=>{const ae=B(V),de=B(X),J=o.priceToCoordinate(ae),ie=o.priceToCoordinate(de);if(J==null||ie==null)return;const pe=Math.round(J*c),Ce=Math.round(ie*c);h.fillStyle=ce,h.fillRect(S,Math.min(pe,Ce),$,Math.abs(Ce-pe))}),A._levels.forEach(({ratio:V,label:X})=>{const ce=B(V),ae=o.priceToCoordinate(ce);if(ae==null)return;const de=Math.round(ae*c),J=A._levelColors[V]||"#888888";h.beginPath(),h.strokeStyle=J,h.lineWidth=V===0||V===1?1.5*c:1*c,V!==0&&V!==1&&V<1?h.setLineDash([4*a,4*a]):h.setLineDash([]),h.moveTo(S,de),h.lineTo(W,de),h.stroke(),h.setLineDash([])});const j=Math.round(11*c);if(h.font=`${j}px sans-serif`,h.textAlign="left",A._levels.forEach(({ratio:V,label:X})=>{const ce=B(V),ae=o.priceToCoordinate(ce);if(ae==null)return;const de=Math.round(ae*c),J=A._levelColors[V]||"#888888",ie=`${X} (${ce.toFixed(5)})`;h.fillStyle=J,h.textAlign="right",h.fillText(ie,S-4*a,de-4*c)}),y!=null&&D!=null&&E!=null&&N!=null){const V=Math.round(y*a),X=Math.round(E*c),ce=Math.round(D*a),ae=Math.round(N*c);h.beginPath(),h.strokeStyle="rgba(128, 128, 128, 0.6)",h.lineWidth=1*c,h.setLineDash([]),h.moveTo(V,X),h.lineTo(ce,ae),h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(V,X,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke(),h.beginPath(),h.fillStyle="#2962ff",h.arc(ce,ae,4*c,0,Math.PI*2),h.fill(),h.strokeStyle="#ffffff",h.lineWidth=1*c,h.stroke()}h.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}class By{constructor(e,t="#3b82f6",A=2){this.time=e,this.color=t,this.lineWidth=A,this.visible=!0,this._chart=null,this._series=null;const i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart;if(!o)return;const a=o.timeScale().timeToCoordinate(i.time);if(a==null)return;const c=Math.round(a*s.horizontalPixelRatio),h=s.bitmapSize.height,d=s.context;d.save(),d.beginPath(),d.strokeStyle=i.color,d.lineWidth=i.lineWidth*s.horizontalPixelRatio,d.setLineDash([]),d.moveTo(c,0),d.lineTo(c,h),d.stroke();const m=Math.round(h/2);i.midYCss=m/s.verticalPixelRatio,d.beginPath(),d.strokeStyle=i.color,d.lineWidth=1.5*s.horizontalPixelRatio;const T=5*s.horizontalPixelRatio;d.arc(c,m,T,0,Math.PI*2),d.stroke(),d.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}function Fd(r,e){const t=typeof r=="string"?r.trim():"",A=t.startsWith("#")?t.slice(1):t;if(!/^[0-9A-Fa-f]{6}$/.test(A))return`rgba(95, 143, 150, ${e})`;const i=parseInt(A.slice(0,2),16),n=parseInt(A.slice(2,4),16),s=parseInt(A.slice(4,6),16);return`rgba(${i}, ${n}, ${s}, ${e})`}function Cy(r,e,t){const A=`${r??""}`,i=Math.max(4,e*.58),s=Math.max(1,Math.floor(220/i)),o=[],a=c=>{if(!t||c.length<=s){o.push(c);return}let h=c;for(;h.length>s;){let d=h.lastIndexOf(" ",s);d<=0&&(d=s),o.push(h.slice(0,d)),h=h.slice(d).trimStart()}o.push(h)};return A.split(`
|
|
11
|
+
`).forEach(a),o.length===0&&o.push(""),o}function Ud(r,e,t){const A=r?.primitive??{},i=Number(A.fontSize)||12,n=!!A.textWrap,s=Cy(A.text??r?.text??"Text",i,n),o=s.reduce((v,B)=>Math.max(v,B.length),1),c=Math.max(20,o*i*.58)+16,h=i*1.2,d=s.length*h+10,m=e-c/2,T=t-d;return{left:m,right:m+c,top:T,bottom:T+d+12}}class vy{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 i=this;this._paneView={renderer(){return{draw(n){n.useBitmapCoordinateSpace(s=>{if(!i.visible)return;const o=i._chart,a=i._series;if(!o||!a)return;const c=o.timeScale().timeToCoordinate(i.rawTime),h=a.priceToCoordinate(i.price);if(c==null||h==null)return;const d=s.horizontalPixelRatio,m=s.verticalPixelRatio,T=Math.round(c*d),v=Math.round(h*m),B=s.context;B.save();const y=Math.round(i.fontSize*m);B.font=`${i.fontStyle} ${i.fontWeight} ${y}px sans-serif`;const D=`${i.text??""}`,E=220*d,N=[],S=xe=>{if(!i.textWrap||xe.length===0){N.push(xe);return}const He=xe.split(/\s+/);let Le="";for(const Fe of He){const we=Le?`${Le} ${Fe}`:Fe;B.measureText(we).width<=E||!Le?Le=we:(N.push(Le),Le=Fe)}N.push(Le)};D.split(`
|
|
12
|
+
`).forEach(S),N.length===0&&N.push("");const W=N.map(xe=>B.measureText(xe).width),$=Math.max(...W,20*d),j=8*d,V=5*m,X=$+j*2,ce=y*1.2,ae=ce*N.length+V*2,de=["left","center","right"].includes(i.textAlign)?i.textAlign:"center",J=T-X/2,ie=v-ae;i.bgEnabled&&(B.fillStyle=Fd(i.bgColor,Math.max(0,Math.min(1,i.bgOpacity??.1))),B.beginPath(),B.rect(J,ie,X,ae),B.fill()),i.borderEnabled&&(B.strokeStyle=Fd(i.borderColor,Math.max(0,Math.min(1,i.borderOpacity??.1))),B.lineWidth=Math.max(.5,(i.borderWidth??1)*m),B.beginPath(),B.rect(J,ie,X,ae),B.stroke()),B.fillStyle=i.color,B.textAlign=de,B.textBaseline="middle";const pe=de==="left"?J+j:de==="right"?J+X-j:J+X/2;for(let xe=0;xe<N.length;xe++)B.fillText(N[xe],pe,ie+V+ce*(xe+.5));const Ce=5*m,Ue=v+10*m;B.beginPath(),B.strokeStyle="#3b82f6",B.lineWidth=1.5*m,B.arc(T,Ue,Ce,0,Math.PI*2),B.stroke(),B.restore()})}}}}}attached({chart:e,series:t}){this._chart=e,this._series=t}detached(){this._chart=null,this._series=null}paneViews(){return[this._paneView]}}const yy={M1:3,M5:7,M15:14,M30:30,H1:90,H4:180,D1:1095,W1:1825,MN:3650};function Ed(r){if(!r)return 7;const e=String(r).toUpperCase();return yy[e]??7}function by(r,e){const t=String(r||"").toUpperCase(),A=e||Ed(r),i={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 i=="number"?i:96));return Math.min(Math.max(n,500),5e3)}const MA=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=r.map(A=>({...A,time:q(A.time)})).filter(A=>A.time!=null);e.sort((A,i)=>A.time-i.time);const t=new Map;for(const A of e)t.set(A.time,A);return Array.from(t.values()).sort((A,i)=>A.time-i.time)};function qe(r,e,t,A,i,n){const s=i-t,o=n-A,a=Math.sqrt(s*s+o*o);if(a===0)return Math.hypot(r-t,e-A);let c=((r-t)*s+(e-A)*o)/(a*a);c=Math.max(0,Math.min(1,c));const h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function Ty(r,e,t,A,i,n){const s=i-t,o=n-A,a=s*s+o*o;if(a===0)return Math.hypot(r-t,e-A);let c=((r-t)*s+(e-A)*o)/a;c<0&&(c=0);const h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function xy(r,e,t,A,i,n){const s=i-t,o=n-A,a=s*s+o*o;if(a===0)return Math.hypot(r-t,e-A);const c=((r-t)*s+(e-A)*o)/a,h=t+c*s,d=A+c*o;return Math.hypot(r-h,e-d)}function XA(r,e,t){let A=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){const s=t[i].x,o=t[i].y,a=t[n].x,c=t[n].y;o>e!=c>e&&r<(a-s)*(e-o)/(c-o+1e-7)+s&&(A=!A)}return A}function Sd(r,e,t){if(!r||!e||!t)return null;const A=r.normalizedTime??q(r.rawTime),i=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(A==null||i==null||n==null)return null;const s=i-A;if(Math.abs(s)<1e-9)return null;const o=(e.price-r.price)/s,a=t.price+o*(A-n),c=t.price+o*(i-n),h=q((A+i)/2),d=(a+c)/2;return h==null?null:{b1:{rawTime:r.rawTime,normalizedTime:A,price:a},b2:{rawTime:e.rawTime,normalizedTime:i,price:c},p3:{rawTime:t.rawTime,normalizedTime:n,price:t.price},bottomMid:{rawTime:h,normalizedTime:h,price:d}}}function as(r,e,t,A=1){if(!Array.isArray(r)||r.length<2||!e||!t)return null;const i=e.normalizedTime??q(e.rawTime),n=t.normalizedTime??q(t.rawTime);if(i==null||n==null)return null;const s=Math.min(i,n),o=Math.max(i,n),a=r.map(V=>({time:q(V.time),close:typeof V.close=="number"?V.close:parseFloat(V.close)})).filter(V=>V.time!=null&&Number.isFinite(V.close)&&V.time>=s&&V.time<=o).sort((V,X)=>V.time-X.time);if(a.length<2)return null;const c=a.length;let h=0,d=0,m=0,T=0;for(let V=0;V<c;V++){const X=V,ce=a[V].close;h+=X,d+=ce,m+=X*ce,T+=X*X}const v=c*T-h*h,B=Math.abs(v)<1e-12?0:(c*m-h*d)/v,y=(d-B*h)/c;let D=0;for(let V=0;V<c;V++){const X=y+B*V,ce=a[V].close-X;D+=ce*ce}const E=Math.sqrt(D/c),N=Math.max(E*A,1e-8),S=a[0].time,W=a[c-1].time,$=y,j=y+B*(c-1);return{slope:B,intercept:y,stdDev:E,offset:N,barCount:c,p1:{rawTime:S,normalizedTime:S,price:$},p2:{rawTime:W,normalizedTime:W,price:j},top1:{rawTime:S,normalizedTime:S,price:$+N},top2:{rawTime:W,normalizedTime:W,price:j+N},bot1:{rawTime:S,normalizedTime:S,price:$-N},bot2:{rawTime:W,normalizedTime:W,price:j-N}}}function Fa(r,e,t,A=1){return as(r,e,t,A)}const Qy={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}},Fy={gannline:"#7aa6ae",rectangle:"#3b82f6",circle:"#3b82f6",triangle:"#3b82f6",ellipse:"#3b82f6",infoline:"#3b82f6",rulerline:"#3b82f6",arrowedline:"#f59e0b",rayline:"#7aa6ae",extendedline:"#7aa6ae",crossline:"#7aa6ae",trendbyangle:"#7aa6ae",equidistantchannel:"#8b5cf6",regressionchannel:"#6366f1",stddevchannel:"#6366f1",gannfan:"#7aa6ae",ganngrid:"#7aa6ae",andrewspitchfork:"#7c3aed",disjointchannel:"#16a34a",flattopbottom:"#3b82f6"};function Uy(r,e){if(!r||!r.type)return!1;const t=Qy[r.type];return!t||e.length!==t.handleCount?!1:t.requiredKeys.every(A=>!!r[A])}function Ey(r){return r?Fy[r]??"#22c55e":"#22c55e"}const Sy=300,Hd=24,Hy=150,Ld=150;function Ua(r,e,t=Sy){if(!Array.isArray(r)||r.length===0)return[];const A=eA(e),i=Number.isFinite(A)&&A>0?A:60;let n=null;for(const o of r){const a=q(o?.time);a!=null&&(n==null||a>n)&&(n=a)}if(n==null)return[];const s=[];for(let o=1;o<=t;o++)s.push({time:n+i*o});return s}function Ly(r){if(!Array.isArray(r)||r.length===0)return null;let e=null;for(const t of r){const A=q(t?.time);A!=null&&(e==null||A>e)&&(e=A)}return e}function My(r,e){let t=0,A=r.length;for(;t<A;){const i=t+A>>1;r[i]<e?t=i+1:A=i}return t}function ls(r,e,t,A){const i=q(e),n=q(t),s=eA(A)||3600,o=Math.abs((n??0)-(i??0)),a=Math.max(1,Math.round(o/s));if(!Array.isArray(r)||r.length===0)return a;if(i==null||n==null)return 1;const c=m=>{const T=My(r,m);if(T<=0)return 0;if(T>=r.length)return r.length-1;const v=r[T-1],B=r[T];return Math.abs(m-v)<=Math.abs(B-m)?T-1:T},h=c(i),d=c(n);return Math.max(1,Math.abs(d-h)+1)}function Iy(r,e,t){if(!r)return!1;const A=r.timeScale();if(!A)return!1;const i=Ly(e);if(i==null)return!1;const n=A.timeToCoordinate(i);if(Number.isFinite(n)){const c=A.coordinateToLogical(n);if(Number.isFinite(c)){const h=A.getVisibleLogicalRange(),d=Number.isFinite(h?.from)&&Number.isFinite(h?.to)?h.to-h.from:null,m=Number.isFinite(d)&&d>20?d:120,T=Math.min(Ld,m/2),v=Math.max(20,m-T),B={from:c-v,to:c+T};try{return A.setVisibleLogicalRange(B),!0}catch{}}}const s=eA(t),o=Number.isFinite(s)&&s>0?s:60,a={from:i-Hy*o,to:i+Ld*o};try{return A.setVisibleRange(a),!0}catch{return!1}}const _y=Y.forwardRef(function({bidPrice:e="113.638",askPrice:t="113.649",showBuySellPanel:A=!0,onBuyClick:i,onSellClick:n},s){const o=Y.useRef(null),a=Y.useRef(null),c=Y.useRef(null),h=Y.useRef(null),d=Y.useRef(null),m=Y.useRef([]),T=Y.useRef(!1),v=Y.useRef(null),B=Y.useRef(null),y=Y.useRef(null),D=Y.useRef(null),E=Y.useRef([]),[N,S]=Y.useState(null),[W,$]=Y.useState(null),[j,V]=Y.useState([]),[X,ce]=Y.useState(null),[ae,de]=Y.useState([]),J=Y.useRef(null),ie=Y.useRef(null),pe=Y.useRef(null),Ce=Y.useRef(!1);Y.useEffect(()=>{pe.current=N},[N]);const Ue=Y.useRef(new Map),xe=Y.useRef(null),He=(b,w)=>`${b}_${w}`,Le=()=>{const b=He(Ge,Oe);return Ue.current.get(b)||null},Fe=b=>{if(!b)return;const w=He(Ge,Oe);Ue.current.set(w,b)},{activeTool:we,setActiveTool:ye,showGrid:De,snapToGrid:et,chartObjects:Ye,setChartObjects:be,orders:bt,selectedSymbol:Ge,selectedTimeframe:Oe,drawingsVisible:Ne,chartType:ke,chartLocked:Te,theme:_e,baseUrl:Tt,endpoints:tt,endpointParams:IA}=Qt(),Ke=Y.useRef([]),[Ie,oe]=Y.useState(!1),[ne,ge]=Y.useState(null),[he,ue]=Y.useState([]),[Me,At]=Y.useState(!0),[ht,Ct]=Y.useState(null),[Jt,Ha]=Y.useState(0),Lr=Y.useMemo(()=>{const b=he.map(w=>q(w?.time)).filter(w=>Number.isFinite(w));return b.sort((w,G)=>w-G),b},[he]),ZA=Y.useRef(null),xA=Y.useRef(new Map);Y.useRef(null);const Nt=Y.useRef(0);Y.useEffect(()=>{const b=h.current;b&&b.setData(Ua(he,Oe))},[he,Oe]),Y.useImperativeHandle(s,()=>({zoomIn:()=>{const b=a.current?.timeScale();if(!b)return;const w=b.getVisibleRange();if(!w||!w.from||!w.to)return;const G=w.to-w.from,Be=(w.from+w.to)/2,Q=G*.8;try{b.setVisibleRange({from:Be-Q/2,to:Be+Q/2}),Fe(b.getVisibleRange())}catch{}},zoomOut:()=>{const b=a.current?.timeScale();if(!b)return;const w=b.getVisibleRange();if(!w||!w.from||!w.to)return;const G=w.to-w.from,Be=(w.from+w.to)/2,Q=G*1.25;try{b.setVisibleRange({from:Be-Q/2,to:Be+Q/2}),Fe(b.getVisibleRange())}catch{}},downloadChartAsPNG:()=>{const b=o.current;if(!b){typeof window.notify=="function"&&window.notify("Chart not ready","error");return}const w=b.querySelectorAll("canvas"),G=_e==="light"?"#ffffff":"#12161d";let Be=null,Q=0;if(w.forEach(F=>{if(F.width>0&&F.height>0){const ee=F.width*F.height;ee>Q&&(Q=ee,Be=F)}}),Be)try{const F=document.createElement("canvas");F.width=Be.width,F.height=Be.height;const ee=F.getContext("2d");ee.fillStyle=G,ee.fillRect(0,0,F.width,F.height),ee.drawImage(Be,0,0);const M=document.createElement("a");M.download=`chart-${Ge}-${Oe}-${Date.now()}.png`,M.href=F.toDataURL("image/png"),M.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success");return}catch(F){console.warn("Canvas export failed, trying html2canvas",F)}ty(b,{useCORS:!0,allowTaint:!0,backgroundColor:G,scale:2,logging:!1}).then(F=>{const ee=document.createElement("a");ee.download=`chart-${Ge}-${Oe}-${Date.now()}.png`,ee.href=F.toDataURL("image/png"),ee.click(),typeof window.notify=="function"&&window.notify("Chart saved as PNG","success")}).catch(F=>{console.error("Chart screenshot failed",F),typeof window.notify=="function"&&window.notify("Screenshot failed. Try again.","error")})}}),[Ge,Oe,_e]);const dt=Y.useMemo(()=>he.length===0?[]:ke==="line"||ke==="area"?he.map(b=>({time:b.time,value:b.close})):he,[he,ke]),qt=b=>{i?i(b):(ge("BUY"),oe(!0))},Yt=b=>{n?n(b):(ge("SELL"),oe(!0))},tb=()=>{oe(!1),ge(null)},Ab=b=>{const w=W;if(!w||!b)return;const G=(F,ee)=>{if(typeof F!="string")return ee;const M=F.trim(),le=M.startsWith("#")?M:`#${M}`;return/^#[0-9A-Fa-f]{6}$/.test(le)?le.toLowerCase():ee},Be=(F,ee)=>{const M=Number(F);return Number.isFinite(M)?Math.max(0,Math.min(1,M)):ee};let Q={...w,visibleTimeframes:Array.isArray(b.visibleTimeframes)?[...b.visibleTimeframes]:w.visibleTimeframes};if(w.type==="text"){const F=Number.isFinite(Number(b.price))?Number(b.price):w.price,ee=w.primitive;ee&&(ee.text=typeof b.text=="string"?b.text:ee.text,ee.color=G(b.color,ee.color??"#5f8f96"),ee.fontSize=Number.isFinite(Number(b.fontSize))?Number(b.fontSize):ee.fontSize,ee.fontWeight=b.fontWeight==="bold"?"bold":"normal",ee.fontStyle=b.fontStyle==="italic"?"italic":"normal",ee.textAlign=["left","center","right"].includes(b.textAlign)?b.textAlign:ee.textAlign,ee.textWrap=!!b.textWrap,ee.borderEnabled=!!b.borderEnabled,ee.borderColor=G(b.borderColor,ee.borderColor??"#5f8f96"),ee.borderOpacity=Be(b.borderOpacity,ee.borderOpacity??.1),ee.borderWidth=Math.max(1,Math.min(5,Number.isFinite(Number(b.borderWidth))?Number(b.borderWidth):1)),ee.bgEnabled=!!b.bgEnabled,ee.bgColor=G(b.bgColor,ee.bgColor??"#5f8f96"),ee.bgOpacity=Be(b.bgOpacity,ee.bgOpacity??.1),ee.price=F),Q={...Q,price:F,text:typeof b.text=="string"?b.text:w.text}}be(F=>{const ee=F.map(M=>M===w?Q:M);return m.current=ee,ee}),pe.current===w&&(pe.current=Q),S(F=>F===w?Q:F),ce(F=>F===w?Q:F),$(Q);try{a.current?.applyOptions({})}catch{}};Y.useEffect(()=>{const b=o.current;if(!b)return;const w=b.getBoundingClientRect(),G=P=>{const Ae=Math.abs(Number(P));return Number.isFinite(Ae)?Ae>=1e3?Ae.toFixed(2):(Ae>=1,Ae.toFixed(5)):"0"},Be=_e==="light",Q=H0(b,{width:w.width||b.clientWidth,height:w.height||b.clientHeight,autoSize:!0,localization:{priceFormatter:G},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:De,color:De?Be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?Be?"rgba(100, 116, 139, 0.15)":"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}},rightPriceScale:{borderColor:Be?"#e5e7eb":"#21262d",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0,entireTextOnly:!1,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:we===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:we===1,horzLineVisible:we===1},handleScroll:{mouseWheel:!0,pressedMouseMove:we===null||we===1,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!1,price:!0},axisTouch:{time:!0,price:!0},mouseWheel:!0,pinch:!0}}),F=Q.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}),ee=Q.addLineSeries({lineVisible:!1,pointMarkersVisible:!1,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(0,0,0,0)"});a.current=Q,c.current=F,h.current=ee,ee.setData(Ua(he,Oe)),requestAnimationFrame(()=>{if(b&&Q){const P=b.getBoundingClientRect();P.width>0&&P.height>0&&Q.resize(P.width,P.height)}});const M=Q.timeScale(),le=()=>{if(Ce.current&&xA.current.size>0){const P=M.getVisibleRange();P&&Fe(P)}};M.subscribeVisibleTimeRangeChange(le);const _=new ResizeObserver(P=>{for(const Ae of P){const{width:te,height:g}=Ae.contentRect;if(te>0&&g>0&&Q){const C=M.getVisibleRange();Q.resize(te,g),C&&setTimeout(()=>{try{M.setVisibleRange(C)}catch{}},0)}}});return _.observe(b),()=>{M.unsubscribeVisibleTimeRangeChange(le),_.disconnect(),Q.remove(),a.current=null,c.current=null,h.current=null,d.current=null,m.current=[]}},[]),Y.useEffect(()=>{a.current&&a.current.applyOptions({grid:{vertLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0},horzLines:{visible:De,color:De?"rgba(110, 118, 129, 0.15)":"transparent",style:De?2:0}}})},[De]),Y.useEffect(()=>{const b=a.current;if(!b)return;const w=_e==="light";b.applyOptions({layout:{background:{color:w?"#FFFFFF":"#12161d"},textColor:w?"#020617":"#fff"},grid:{vertLines:{color:De?w?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"},horzLines:{color:De?w?"rgba(100, 116, 139, 0.25)":"rgba(148, 163, 184, 0.2)":"transparent"}},rightPriceScale:{borderColor:w?"#e5e7eb":"#1e293b"},timeScale:{borderColor:w?"#e5e7eb":"#1e293b"},crosshair:{vertLine:{color:w?"#3b82f6":"#58a6ff",labelBackgroundColor:w?"#eff6ff":"#161b22",width:1},horzLine:{color:w?"#3b82f6":"#58a6ff",labelBackgroundColor:w?"#eff6ff":"#161b22",width:1}}})},[_e,De]),Y.useEffect(()=>{if(!a.current)return;const w=!Te&&!(we!==null&&we!==1&&we!==0),G=!Te;a.current.applyOptions({crosshair:{mode:we===1?1:0,vertLine:{visible:we===1,width:1,color:_e==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:_e==="light"?"#e5e7eb":"#1e293b"},horzLine:{visible:we===1,width:1,color:_e==="light"?"#94a3b8":"#64748b",style:0,labelBackgroundColor:_e==="light"?"#e5e7eb":"#1e293b"}},handleScroll:{mouseWheel:G,pressedMouseMove:w,horzTouchDrag:w,vertTouchDrag:w},handleScale:{axisPressedMouseMove:{time:w,price:w},axisDoubleClickReset:{time:!1,price:G},axisTouch:{time:w,price:w},mouseWheel:G,pinch:G}})},[we,Te]);const Nd=(b,w=!1)=>{b&&m.current.forEach(G=>{if(G.primitive){try{b.detachPrimitive(G.primitive)}catch{}try{b.attachPrimitive(G.primitive)}catch{}}if(w&&G.type==="pricelevel"&&G.priceLine)try{const Be=G.priceLine.options?G.priceLine.options():{},Q=b.createPriceLine({price:G.price,color:Be.color||"#3b82f6",lineWidth:Be.lineWidth||2,lineStyle:Be.lineStyle??2,axisLabelVisible:Be.axisLabelVisible??!0,title:Be.title||(typeof G.price=="number"?G.price.toFixed(5):"")});G.priceLine=Q}catch{}})};Y.useEffect(()=>{(async()=>{if(!Ge||!Oe){ue([]),Ce.current=!1;return}try{if(At(!0),Ct(null),ue([]),Ce.current=!1,c.current)try{c.current.setData([])}catch{}const w=Ed(Oe),G=by(Oe,w),Be=Tt||ny?.VITE_BASE_URL||"http://localhost:5002",Q=tt?.candles||"/api/chart/candles",F=IA?.candles||{},ee={symbol:F.symbol||"symbol",timeframe:F.timeframe||"timeframe",limit:F.limit||"limit",daysBack:F.daysBack||"daysBack"},M={};M[ee.symbol]=Ge,M[ee.timeframe]=Oe,M[ee.limit]=G,F.daysBack!==!1&&(M[ee.daysBack]=w);const le=await nt.get(`${Be}${Q}`,{params:M,timeout:1e4});let _=[];if(Array.isArray(le.data)?_=le.data:le.data&&le.data.data&&Array.isArray(le.data.data)?_=le.data.data:le.data&&Array.isArray(le.data)&&(_=le.data),_&&_.length>0){const{candles:P,stats:Ae}=Oa(_,Ge,Oe);P.length>0?(ue(P),xA.current=new Map,P.forEach(te=>{xA.current.set(te.time,te)})):(console.warn(`⚠️ No valid candles after processing for ${Ge}`),ue([]))}else console.warn(`⚠️ No candle data returned for ${Ge}`),ue([])}catch(w){console.error(`❌ Error fetching ${Ge}:`,w.message);const G=w.code==="ECONNABORTED"||w.message&&w.message.includes("timeout");Ct(G?"Request timed out. No data available for this symbol.":w.message||"Failed to load candles."),ue([]),At(!1)}})()},[Ge,Oe,Jt]),Y.useEffect(()=>{ZA.current=hn.getSocket();const b=ZA.current,w=()=>{if(Ge&&Oe&&b.connected){const M={symbol:Ge,timeframe:Oe};b.emit("subscribeCandles",M)}},G=()=>{setTimeout(()=>{Ge&&Oe&&w()},200)},Be=M=>{},Q=M=>{};b.on("connect",G),b.on("disconnect",Be),b.on("connect_error",Q),b.on("subscription:confirmed",M=>{M.type});const F=M=>{if(!M||!M.candle||!M.symbol||M.symbol.toUpperCase()!==Ge?.toUpperCase())return;const{candle:le}=M,_=Na(le,Ge,Oe);if(!_)return;const P=Date.now();if(P-Nt.current<200)return;Nt.current=P;const Ae=a.current?.timeScale(),te=Ae?.getVisibleRange(),g=c.current,C=a.current;if(!(!g||!C||!Ce.current||g?.seriesType?.()!==(ke==="line"?"Line":ke==="area"?"Area":ke==="bars"?"Bar":"Candlestick")))try{const u=xA.current.get(_.time),H=!u,U=u?{time:_.time,open:u.open,high:Math.max(u.high,_.close),low:Math.min(u.low,_.close),close:_.close}:_;xA.current.set(_.time,U),H&&h.current&&h.current.setData(Ua(Array.from(xA.current.values()),Oe));try{ke==="line"||ke==="area"?g.update({time:U.time,value:U.close}):g.update(U),Ae&&te&&Fe(te)}catch(k){throw k}}catch{}};b.on("candleUpdate",F);const ee=()=>{b.connected&&Ge&&Oe&&w()};if(b.connected)ee();else{const M=()=>{setTimeout(ee,200)};b.once("connect",M),setTimeout(()=>{b.connected&&ee()},500)}return()=>{b.off("candleUpdate",F),b.off("connect",G),b.off("disconnect",Be),b.off("connect_error",Q),b.off("subscription:confirmed"),Ge&&Oe&&b.connected&&b.emit("unsubscribeCandles",{symbol:Ge,timeframe:Oe})}},[Ge,Oe,Tt]),Y.useEffect(()=>{const b=c.current,w=a.current;if(!b||!w){At(!1);return}if(!(he.length===0&&Ce.current)){if(he.length===0&&!Ce.current){if(Me)return;const G=w.timeScale();b.setData([]),G.fitContent(),requestAnimationFrame(()=>At(!1));return}if(!Ce.current){const G=w.timeScale(),Be=He(Ge,Oe);xe.current,xe.current=Be;const Q=[...he].sort((M,le)=>M.time-le.time);if(ke==="line"||ke==="area"){const M=Q?.map(le=>({time:le.time,value:le.close})).filter(le=>le.time!=null);M.length>0&&b.setData(M)}else Q?.length>0&&b.setData(Q);Nd(b);const F=eA(Oe)||60;if(m.current.forEach(M=>{if(M.type==="horizontalray"&&M.primitive){const g=M.rawOriginTime??M.primitive.originTime,C=$e(g,F);M.primitive.originTime=C,M.originTime=C;return}if(M.type==="verticalline"&&M.primitive){const g=M.rawTime??M.primitive.time,C=$e(g,F);M.primitive.time=C,M.time=q(C);return}if(M.type==="infoline"&&M.primitive&&M.p1&&M.p2){const g=M.rawP1Time??M.p1.rawTime,C=M.rawP2Time??M.p2.rawTime,x=Q.length>0?Q[0].time:null,f=Q.length>0?Q[Q.length-1].time:null,u=k=>{const L=$e(k,F);return x==null||f==null?L:Math.min(Math.max(L,x),f)},H=u(g),U=u(C);M.p1.rawTime=H,M.p1.normalizedTime=q(H),M.p2.rawTime=U,M.p2.normalizedTime=q(U),M.primitive.p1={rawTime:H,price:M.p1.price},M.primitive.p2={rawTime:U,price:M.p2.price};return}if(M.type==="rulerline"&&M.primitive&&M.p1&&M.p2){const g=M.rawP1Time??M.p1.rawTime,C=M.rawP2Time??M.p2.rawTime,x=Q.length>0?Q[0].time:null,f=Q.length>0?Q[Q.length-1].time:null,u=I=>{const O=$e(I,F);return x==null||f==null?O:Math.min(Math.max(O,x),f)},H=u(g),U=u(C);M.p1.rawTime=H,M.p2.rawTime=U,M.primitive.p1={rawTime:H,price:M.p1.price},M.primitive.p2={rawTime:U,price:M.p2.price};const k=q(H),L=q(U),p=Math.abs((L??0)-(k??0));M.primitive.info={priceDiff:M.p2.price-M.p1.price,pricePct:(M.p2.price-M.p1.price)/Math.abs(M.p1.price||1)*100,bars:ls(Lr,H,U,Oe),days:Math.max(1,Math.round(p/86400))};return}if(M.type==="arrowedline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,x=$e(g,F),f=$e(C,F);M.p1.rawTime=x,M.p1.normalizedTime=q(x),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:x,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="rayline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,x=$e(g,F),f=$e(C,F);M.p1.rawTime=x,M.p1.normalizedTime=q(x),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:x,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="extendedline"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,x=$e(g,F),f=$e(C,F);M.p1.rawTime=x,M.p1.normalizedTime=q(x),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:x,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="trendbyangle"&&M.primitive&&M.p1&&M.p2){const g=M.p1.rawTime,C=M.p2.rawTime,x=$e(g,F),f=$e(C,F);M.p1.rawTime=x,M.p1.normalizedTime=q(x),M.p2.rawTime=f,M.p2.normalizedTime=q(f),M.primitive.p1={rawTime:x,price:M.p1.price},M.primitive.p2={rawTime:f,price:M.p2.price};return}if(M.type==="disjointchannel"&&M.primitive&&M.p1&&M.p2&&M.p3&&M.p4){const g=C=>{const x=$e(C.rawTime,F);C.rawTime=x,C.normalizedTime=q(x)};g(M.p1),g(M.p2),g(M.p3),g(M.p4),M.primitive.p1={rawTime:M.p1.rawTime,price:M.p1.price},M.primitive.p2={rawTime:M.p2.rawTime,price:M.p2.price},M.primitive.p3={rawTime:M.p3.rawTime,price:M.p3.price},M.primitive.p4={rawTime:M.p4.rawTime,price:M.p4.price};return}if(M.type==="flattopbottom"&&M.primitive&&M.p1&&M.p2&&M.p3&&M.p4){const g=C=>{const x=$e(C.rawTime,F);C.rawTime=x,C.normalizedTime=q(x)};g(M.p1),g(M.p2),g(M.p3),g(M.p4),M.primitive.p1={rawTime:M.p1.rawTime,price:M.p1.price},M.primitive.p2={rawTime:M.p2.rawTime,price:M.p2.price},M.primitive.p3={rawTime:M.p3.rawTime,price:M.p3.price},M.primitive.p4={rawTime:M.p4.rawTime,price:M.p4.price};return}if(M.type!=="trendline"&&M.type!=="gannline"||!M.series||!M.point1||!M.point2)return;const le=M.point1.rawTime??M.point1.time,_=M.point2.rawTime??M.point2.time,P=$e(le,F),Ae=$e(_,F);M.point1.time=P,M.point2.time=Ae;const te=MA([{time:P,value:M.point1.price},{time:Ae,value:M.point2.price}]);try{te.length>0&&M.series.setData(te)}catch{}}),Q?.length>0){const M=Q[Q?.length-1].time,le=eA(Oe)||60,P=M-(Oe==="M1"?150:Oe==="M5"?120:100)*le;try{G.setVisibleRange({from:P,to:M+le*Hd})}catch{G.fitContent()}}else G.fitContent();try{w.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Ce.current=!0;const ee=G.getVisibleRange();Fe(ee),requestAnimationFrame(()=>At(!1))}}},[he.length,ke,Ge,Oe]),Y.useEffect(()=>{const b=a.current;if(!b||!Ce.current||he.length===0)return;const w=b.timeScale(),G=w.getVisibleRange()||Le();if(c.current)try{b.removeSeries(c.current)}catch{}if(d.current)try{b.removeSeries(d.current),d.current=null}catch{}let Be;if(ke==="bars"){const F=_e==="light";Be=b.addBarSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",scaleMargins:{top:.1,bottom:.1}});const ee=[...he].sort((M,le)=>M.time-le.time);ee?.length>0&&Be.setData(ee)}else if(ke==="line"){Be=b.addLineSeries({color:"#38bdf8",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const F=MA(dt);F.length>0&&Be.setData(F)}else if(ke==="area"){Be=b.addAreaSeries({lineColor:"#38bdf8",topColor:"rgba(56,189,248,0.4)",bottomColor:"rgba(56,189,248,0.0)",lineWidth:2,priceLineVisible:!1,lastValueVisible:!0,scaleMargins:{top:.1,bottom:.1}});const F=MA(dt);F.length>0&&Be.setData(F)}else if(ke==="volume ticks"||ke==="volume"){const F=_e==="light";Be=b.addCandlestickSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",wickUpColor:F?"#089981":"#26A69A",wickDownColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",borderVisible:!0,priceScaleId:"right"});const ee=[...he].sort((_,P)=>_.time-P.time);ee?.length>0&&Be.setData(ee);const M=b.addHistogramSeries({priceFormat:{type:"volume"},priceScaleId:"vol",base:0,priceLineVisible:!1,lastValueVisible:!1,color:"rgba(38,166,154,0.15)"});b.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.3}}),b.priceScale("vol").applyOptions({scaleMargins:{top:.75,bottom:0},visible:!1});const le=ee?.map(_=>({time:_.time,value:_.volume||0,color:_.close>=_.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));le.length>0&&M.setData(le),d.current=M}else{const F=_e==="light";Be=b.addCandlestickSeries({upColor:F?"#089981":"#26A69A",downColor:F?"#f23645":"#EF5350",wickUpColor:F?"#089981":"#26A69A",wickDownColor:F?"#f23645":"#EF5350",borderUpColor:F?"#089981":"#26A69A",borderDownColor:F?"#f23645":"#EF5350",borderVisible:!0,scaleMargins:{top:.1,bottom:.1}});const ee=[...he].sort((M,le)=>M.time-le.time);ee?.length>0&&Be.setData(ee)}c.current=Be,Nd(Be,!0);const Q=eA(Oe)||60;if(m.current.forEach(F=>{if(F.type==="horizontalray"&&F.primitive){const g=F.rawOriginTime??F.primitive.originTime,C=$e(g,Q);F.primitive.originTime=C,F.originTime=C;return}if(F.type==="verticalline"&&F.primitive){const g=F.rawTime??F.primitive.time,C=$e(g,Q);F.primitive.time=C,F.time=q(C);return}if(F.type==="infoline"&&F.primitive&&F.p1&&F.p2){const g=F.rawP1Time??F.p1.rawTime,C=F.rawP2Time??F.p2.rawTime,x=[...he].sort((L,p)=>L.time-p.time),f=x.length>0?x[0].time:null,u=x.length>0?x[x.length-1].time:null,H=L=>{const p=$e(L,Q);return f==null||u==null?p:Math.min(Math.max(p,f),u)},U=H(g),k=H(C);F.p1.rawTime=U,F.p1.normalizedTime=q(U),F.p2.rawTime=k,F.p2.normalizedTime=q(k),F.primitive.p1={rawTime:U,price:F.p1.price},F.primitive.p2={rawTime:k,price:F.p2.price};return}if(F.type==="rulerline"&&F.primitive&&F.p1&&F.p2){const g=F.rawP1Time??F.p1.rawTime,C=F.rawP2Time??F.p2.rawTime,x=[...he].sort((O,K)=>O.time-K.time),f=x.length>0?x[0].time:null,u=x.length>0?x[x.length-1].time:null,H=O=>{const K=$e(O,Q);return f==null||u==null?K:Math.min(Math.max(K,f),u)},U=H(g),k=H(C);F.p1.rawTime=U,F.p2.rawTime=k,F.primitive.p1={rawTime:U,price:F.p1.price},F.primitive.p2={rawTime:k,price:F.p2.price};const L=q(U),p=q(k),I=Math.abs((p??0)-(L??0));F.primitive.info={priceDiff:F.p2.price-F.p1.price,pricePct:(F.p2.price-F.p1.price)/Math.abs(F.p1.price||1)*100,bars:ls(Lr,U,k,Oe),days:Math.max(1,Math.round(I/86400))};return}if(F.type==="arrowedline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,x=$e(g,Q),f=$e(C,Q);F.p1.rawTime=x,F.p1.normalizedTime=q(x),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:x,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="rayline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,x=$e(g,Q),f=$e(C,Q);F.p1.rawTime=x,F.p1.normalizedTime=q(x),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:x,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="extendedline"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,x=$e(g,Q),f=$e(C,Q);F.p1.rawTime=x,F.p1.normalizedTime=q(x),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:x,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="trendbyangle"&&F.primitive&&F.p1&&F.p2){const g=F.p1.rawTime,C=F.p2.rawTime,x=$e(g,Q),f=$e(C,Q);F.p1.rawTime=x,F.p1.normalizedTime=q(x),F.p2.rawTime=f,F.p2.normalizedTime=q(f),F.primitive.p1={rawTime:x,price:F.p1.price},F.primitive.p2={rawTime:f,price:F.p2.price};return}if(F.type==="disjointchannel"&&F.primitive&&F.p1&&F.p2&&F.p3&&F.p4){const g=C=>{const x=$e(C.rawTime,Q);C.rawTime=x,C.normalizedTime=q(x)};g(F.p1),g(F.p2),g(F.p3),g(F.p4),F.primitive.p1={rawTime:F.p1.rawTime,price:F.p1.price},F.primitive.p2={rawTime:F.p2.rawTime,price:F.p2.price},F.primitive.p3={rawTime:F.p3.rawTime,price:F.p3.price},F.primitive.p4={rawTime:F.p4.rawTime,price:F.p4.price};return}if(F.type==="flattopbottom"&&F.primitive&&F.p1&&F.p2&&F.p3&&F.p4){const g=C=>{const x=$e(C.rawTime,Q);C.rawTime=x,C.normalizedTime=q(x)};g(F.p1),g(F.p2),g(F.p3),g(F.p4),F.primitive.p1={rawTime:F.p1.rawTime,price:F.p1.price},F.primitive.p2={rawTime:F.p2.rawTime,price:F.p2.price},F.primitive.p3={rawTime:F.p3.rawTime,price:F.p3.price},F.primitive.p4={rawTime:F.p4.rawTime,price:F.p4.price};return}if(F.type!=="trendline"&&F.type!=="gannline"||!F.series||!F.point1||!F.point2)return;const ee=F.type==="gannline"?"#7aa6ae":"#22c55e";try{b.removeSeries(F.series)}catch{}const M=b.addLineSeries({color:ee,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1}),le=F.point1.rawTime??F.point1.time,_=F.point2.rawTime??F.point2.time,P=$e(le,Q),Ae=$e(_,Q);F.point1.time=P,F.point2.time=Ae;const te=MA([{time:P,value:F.point1.price},{time:Ae,value:F.point2.price}]);try{te.length>0&&M.setData(te)}catch{}F.series=M}),G&&Ce.current)setTimeout(()=>{try{w.setVisibleRange(G),Fe(G)}catch{if(he.length>0)try{const ee=he[he.length-1].time,M=eA(Oe)||60,le=ee-100*M;w.setVisibleRange({from:le,to:ee+M*Hd}),Fe(w.getVisibleRange())}catch{w.fitContent(),Fe(w.getVisibleRange())}}try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}},0);else if(!Ce.current){w.fitContent();try{b.priceScale("right").applyOptions({borderColor:"#1e293b",autoScale:!0,scaleMargins:{top:.1,bottom:.1},ticksVisible:!0,ensureEdgeTickMarksVisible:!0})}catch{}Ce.current=!0,Fe(w.getVisibleRange())}},[ke,he.length,dt.length]),Y.useEffect(()=>{const b=a.current,w=d.current;if(!b||!w||!Ce.current||he.length===0||ke!=="volume"&&ke!=="volume ticks")return;const Be=[...he].sort((Q,F)=>Q.time-F.time)?.map(Q=>({time:Q.time,value:Q.volume||0,color:Q.close>=Q.open?"rgba(38,166,154,0.25)":"rgba(239,83,80,0.25)"}));Be.length>0&&w.setData(Be)},[he,ke]),Y.useEffect(()=>{const b=a.current,w=c.current,G=o.current;if(!b||!w||!G)return;const Q=we!==null?[null,null,"trendline","parallellines","fibonacci","rectangle","text",null,null,null,null,null,null,null,null,null,null,null,null,null,"pricelevel","horizontalray","verticalline","infoline","rulerline","arrowedline","rayline","extendedline","crossline","trendbyangle","disjointchannel","flattopbottom",null,null,null,null,null,null,null,null,"regressionchannel","stddevchannel","andrewspitchfork","gannline","gannfan","ganngrid","circle","triangle","ellipse"][we]:null,F=(_,P)=>{const Ae=Math.min(_.time,P.time),te=Math.max(_.time,P.time),g=_.time<=P.time?_.rawTime:P.rawTime,C=_.time<=P.time?P.rawTime:_.rawTime,x=Math.max(_.price,P.price),f=Math.min(_.price,P.price),u=q(Math.round((Ae+te)/2));return u==null?null:{p1:{rawTime:u,normalizedTime:u,price:x},p2:{rawTime:g,normalizedTime:Ae,price:f},p3:{rawTime:C,normalizedTime:te,price:f}}};if(!Q){if(T.current=!1,v.current=null,B.current=null,D.current=null,y.current?.series)try{b.removeSeries(y.current.series)}catch{}if(y.current?.primitive)try{w.detachPrimitive(y.current.primitive)}catch{}y.current=null;return}if(Q==="pricelevel"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const u={type:"pricelevel",priceLine:w.createPriceLine({price:x,color:"#3b82f6",lineWidth:2,lineStyle:2,axisLabelVisible:!0,title:x.toFixed(5)}),price:x};be(H=>[...H,u]),m.current.push(u),ye(null)};return G.addEventListener("click",_),()=>{G.removeEventListener("click",_)}}if(Q==="horizontalray"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=new sy(x,C);w.attachPrimitive(f);const u=q(C),H={type:"horizontalray",primitive:f,price:x,originTime:u,rawOriginTime:C};be(U=>[...U,H]),m.current.push(H),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="verticalline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=b.timeScale().coordinateToTime(te);if(g==null)return;const C=new By(g);w.attachPrimitive(C);const x=q(g),f={type:"verticalline",primitive:C,time:x,rawTime:g};be(u=>[...u,f]),m.current.push(f),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="text"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=new vy(C,x);w.attachPrimitive(f);const u={type:"text",primitive:f,rawTime:C,price:x,text:"Text"};be(H=>[...H,u]),m.current.push(u),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="infoline"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(u==null||H==null)return;P||(P=b.addLineSeries({color:"#3b82f6",lineWidth:2,crosshairMarkerVisible:!1,priceLineVisible:!1,lastValueVisible:!1}));const U=_.normalizedTime,k=q(u);if(U==null||k==null||U===k)return;const L=U<=k?[{time:U,value:_.price},{time:k,value:H}]:[{time:k,value:H},{time:U,value:_.price}];try{P.setData(L)}catch{}},te=g=>{const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u),x,y:f};return}if(P){try{b.removeSeries(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null)return;const L=H-_.price,p=L/Math.abs(_.price)*100,I=eA(Oe)||3600,O=Math.abs(k-U),K=Math.max(1,Math.round(O/I)),z=Math.max(1,Math.round(O/86400)),R=_.x,Z=_.y,se=x,ve=Math.atan2(-(f-Z),se-R)*(180/Math.PI),Se={priceDiff:L,pricePct:p,bars:K,days:z,angle:ve},Pe=new oy({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H},Se);w.attachPrimitive(Pe);const We={type:"infoline",primitive:Pe,rawP1Time:_.rawTime,rawP2Time:u,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(Re=>[...Re,We]),m.current.push(We),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{b.removeSeries(P)}catch{}}}if(Q==="rulerline"){let _=null,P=null;const Ae=(C,x,f,u)=>{const H=q(C),U=q(f),k=u-x,L=k/Math.abs(x)*100,p=ls(Lr,C,f,Oe),I=Math.abs((U??0)-(H??0)),O=Math.max(1,Math.round(I/86400));return{priceDiff:k,pricePct:L,bars:p,days:O}},te=C=>{if(!_)return;const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null||k===_.normalizedTime)return;const L=Ae(_.rawTime,_.price,H,U);if(!P)P=new vd({rawTime:_.rawTime,price:_.price},{rawTime:H,price:U},L),w.attachPrimitive(P);else{P.p2={rawTime:H,price:U},P.info=L;const p=U>=_.price;P.color=p?"#3b82f6":"#ef5350",P.fillColor=p?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}},g=C=>{const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;if(!_){_={rawTime:H,price:U,normalizedTime:q(H)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const k=_.normalizedTime,L=q(H);if(k==null||L==null)return;const p=Ae(_.rawTime,_.price,H,U),I=new vd({rawTime:_.rawTime,price:_.price},{rawTime:H,price:U},p);w.attachPrimitive(I);const O={type:"rulerline",primitive:I,rawP1Time:_.rawTime,rawP2Time:H,p1:{rawTime:_.rawTime,normalizedTime:k,price:_.price},p2:{rawTime:H,normalizedTime:L,price:U}};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="arrowedline"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(u==null||H==null)return;const U=q(u);if(!(U==null||U===_.normalizedTime))if(!P)P=new yd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H}),w.attachPrimitive(P);else{P.p2={rawTime:u,price:H};try{a.current?.applyOptions({})}catch{}}},te=g=>{const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null||U===k)return;const L=new yd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H});w.attachPrimitive(L);const p={type:"arrowedline",primitive:L,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(I=>[...I,p]),m.current.push(p),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="rayline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new uy({rawTime:C,price:x},{rawTime:u,price:x});w.attachPrimitive(k);const L={type:"rayline",primitive:k,p1:{rawTime:C,normalizedTime:H,price:x},p2:{rawTime:u,normalizedTime:U,price:x}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="extendedline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new dy({rawTime:C,price:x},{rawTime:u,price:x});w.attachPrimitive(k);const L={type:"extendedline",primitive:k,p1:{rawTime:C,normalizedTime:H,price:x},p2:{rawTime:u,normalizedTime:U,price:x}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="crossline"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=q(C);if(f==null)return;const u=new py({rawTime:C,price:x});w.attachPrimitive(u);const H={type:"crossline",primitive:u,p:{rawTime:C,normalizedTime:f,price:x}};be(U=>[...U,H]),m.current.push(H),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="trendbyangle"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=te+140,u=b.timeScale().coordinateToTime(f);if(u==null)return;const H=q(C),U=q(u);if(H==null||U==null)return;const k=new fy({rawTime:C,price:x},{rawTime:u,price:x});w.attachPrimitive(k);const L={type:"trendbyangle",primitive:k,p1:{rawTime:C,normalizedTime:H,price:x},p2:{rawTime:u,normalizedTime:U,price:x}};be(p=>[...p,L]),m.current.push(L),ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="disjointchannel"){let _=null,P=null,Ae=null,te=null,g=0,C=null;const x=(H,U,k,L)=>{if(!C)C=new xa(H,U,k,L),w.attachPrimitive(C);else{C.p1=H,C.p2=U,C.p3=k,C.p4=L;try{a.current?.applyOptions({})}catch{}}},f=H=>{if(g===0||!_)return;const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top;if(g===1){const p=w.coordinateToPrice(L);if(p==null)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:p},x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===2&&P){const p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O==null)return;const K=(_.price+P.price)/2;I>=K?(Ae={rawTime:p,normalizedTime:O,price:I},te={rawTime:p,normalizedTime:O,price:2*K-I}):(te={rawTime:p,normalizedTime:O,price:I},Ae={rawTime:p,normalizedTime:O,price:2*K-I}),x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:Ae.rawTime,price:Ae.price},{rawTime:te.rawTime,price:te.price})}},u=H=>{const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top,p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O!=null){if(g===0){_={rawTime:p,normalizedTime:O,price:I},P={rawTime:p,normalizedTime:O,price:I},g=1,x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===1){const K=w.coordinateToPrice(L);if(K==null||Math.abs(K-_.price)<1e-7)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:K},g=2;return}if(g===2&&C){try{w.detachPrimitive(C)}catch{}const K=new xa(C.p1,C.p2,C.p3,C.p4);w.attachPrimitive(K);const z={type:"disjointchannel",primitive:K,p1:_,p2:P,p3:{rawTime:C.p3.rawTime,normalizedTime:q(C.p3.rawTime),price:C.p3.price},p4:{rawTime:C.p4.rawTime,normalizedTime:q(C.p4.rawTime),price:C.p4.price}};be(R=>[...R,z]),m.current.push(z),ye(null)}}};return G.addEventListener("mousemove",f),G.addEventListener("click",u),()=>{if(G.removeEventListener("mousemove",f),G.removeEventListener("click",u),C)try{w.detachPrimitive(C)}catch{}}}if(Q==="flattopbottom"){let _=null,P=null,Ae=null,te=null,g=0,C=null;const x=(H,U,k,L)=>{if(!C)C=new bd(H,U,k,L),w.attachPrimitive(C);else{C.p1=H,C.p2=U,C.p3=k,C.p4=L;try{a.current?.applyOptions({})}catch{}}},f=H=>{if(g===0||!_)return;const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top;if(g===1){const p=w.coordinateToPrice(L);if(p==null)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:p},x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===2&&P){const p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O==null)return;Ae={rawTime:p,normalizedTime:O,price:I},te={rawTime:p,normalizedTime:O,price:P.price},x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:Ae.rawTime,price:Ae.price},{rawTime:te.rawTime,price:te.price})}},u=H=>{const U=G.getBoundingClientRect(),k=H.clientX-U.left,L=H.clientY-U.top,p=b.timeScale().coordinateToTime(k),I=w.coordinateToPrice(L);if(p==null||I==null)return;const O=q(p);if(O!=null){if(g===0){_={rawTime:p,normalizedTime:O,price:I},P={rawTime:p,normalizedTime:O,price:I},g=1,x({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price});return}if(g===1){const K=w.coordinateToPrice(L);if(K==null||Math.abs(K-_.price)<1e-7)return;P={rawTime:_.rawTime,normalizedTime:_.normalizedTime,price:K},g=2;return}if(g===2&&C){try{w.detachPrimitive(C)}catch{}const K=new bd(C.p1,C.p2,C.p3,C.p4);w.attachPrimitive(K);const z={type:"flattopbottom",primitive:K,p1:_,p2:P,p3:{rawTime:C.p3.rawTime,normalizedTime:q(C.p3.rawTime),price:C.p3.price},p4:{rawTime:C.p4.rawTime,normalizedTime:q(C.p4.rawTime),price:C.p4.price}};be(R=>[...R,z]),m.current.push(z),ye(null)}}};return G.addEventListener("mousemove",f),G.addEventListener("click",u),()=>{if(G.removeEventListener("mousemove",f),G.removeEventListener("click",u),C)try{w.detachPrimitive(C)}catch{}}}if(Q==="regressionchannel"){let _=null,P=null;const Ae=(C,x)=>{C.mid1={rawTime:x.p1.rawTime,price:x.p1.price},C.mid2={rawTime:x.p2.rawTime,price:x.p2.price},C.top1={rawTime:x.top1.rawTime,price:x.top1.price},C.top2={rawTime:x.top2.rawTime,price:x.top2.price},C.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},C.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price}},te=C=>{if(!_)return;const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;const p=as(he,_,{rawTime:H,normalizedTime:k},1);if(p)if(!P)P=new Qa({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price}),w.attachPrimitive(P);else{Ae(P,p);try{b.applyOptions({})}catch{}}},g=C=>{const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;if(!_){_={rawTime:H,normalizedTime:k,price:U};return}const p=as(he,_,{rawTime:H,normalizedTime:k},1);if(!p)return;if(P){try{w.detachPrimitive(P)}catch{}P=null}const I=new Qa({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price});w.attachPrimitive(I);const O={type:"regressionchannel",primitive:I,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,stdMultiplier:1};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="stddevchannel"){let _=null,P=null;const Ae=(C,x)=>{C.mid1={rawTime:x.p1.rawTime,price:x.p1.price},C.mid2={rawTime:x.p2.rawTime,price:x.p2.price},C.top1={rawTime:x.top1.rawTime,price:x.top1.price},C.top2={rawTime:x.top2.rawTime,price:x.top2.price},C.bot1={rawTime:x.bot1.rawTime,price:x.bot1.price},C.bot2={rawTime:x.bot2.rawTime,price:x.bot2.price}},te=C=>{if(!_)return;const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;const p=Fa(he,_,{rawTime:H,normalizedTime:k},1);if(p)if(!P)P=new xd({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price}),w.attachPrimitive(P);else{Ae(P,p);try{b.applyOptions({})}catch{}}},g=C=>{const x=G.getBoundingClientRect(),f=C.clientX-x.left,u=C.clientY-x.top,H=b.timeScale().coordinateToTime(f),U=w.coordinateToPrice(u);if(H==null||U==null)return;const k=q(H);if(k==null)return;if(!_){_={rawTime:H,normalizedTime:k,price:U};return}const p=Fa(he,_,{rawTime:H,normalizedTime:k},1);if(!p)return;if(P){try{w.detachPrimitive(P)}catch{}P=null}const I=new xd({rawTime:p.p1.rawTime,price:p.p1.price},{rawTime:p.p2.rawTime,price:p.p2.price},{rawTime:p.top1.rawTime,price:p.top1.price},{rawTime:p.top2.rawTime,price:p.top2.price},{rawTime:p.bot1.rawTime,price:p.bot1.price},{rawTime:p.bot2.rawTime,price:p.bot2.price});w.attachPrimitive(I);const O={type:"stddevchannel",primitive:I,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,stdMultiplier:1};be(K=>[...K,O]),m.current.push(O),_=null,ye(null)};return G.addEventListener("mousemove",te),G.addEventListener("click",g),()=>{if(G.removeEventListener("mousemove",te),G.removeEventListener("click",g),P)try{w.detachPrimitive(P)}catch{}}}if(Q==="andrewspitchfork"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=q(C);if(f==null)return;const u=te+140,H=b.timeScale().coordinateToTime(u);if(H==null)return;const U=q(H);if(U==null)return;const k={rawTime:C,normalizedTime:f,price:x},L={rawTime:H,normalizedTime:U,price:x},p={rawTime:C,normalizedTime:f,price:x},I=new my({rawTime:k.rawTime,price:k.price},{rawTime:L.rawTime,price:L.price},{rawTime:p.rawTime,price:p.price});w.attachPrimitive(I);const O={type:"andrewspitchfork",primitive:I,p1:k,p2:L,p3:p};be(K=>[...K,O]),m.current.push(O),S(O),pe.current=O,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="gannfan"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=q(C);if(f==null)return;const u={rawTime:C,normalizedTime:f,price:x},H={rawTime:C,normalizedTime:f,price:x},U=new gy({rawTime:u.rawTime,price:u.price},{rawTime:H.rawTime,price:H.price});w.attachPrimitive(U);const k={type:"gannfan",primitive:U,p1:u,p2:H};be(L=>[...L,k]),m.current.push(k),S(k),pe.current=k,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="ganngrid"){const _=P=>{const Ae=G.getBoundingClientRect(),te=P.clientX-Ae.left,g=P.clientY-Ae.top,C=b.timeScale().coordinateToTime(te),x=w.coordinateToPrice(g);if(C==null||x==null)return;const f=q(C);if(f==null)return;const u={rawTime:C,normalizedTime:f,price:x},H={rawTime:C,normalizedTime:f,price:x},U=new wy({rawTime:u.rawTime,price:u.price},{rawTime:H.rawTime,price:H.price});w.attachPrimitive(U);const k={type:"ganngrid",primitive:U,p1:u,p2:H};be(L=>[...L,k]),m.current.push(k),S(k),pe.current=k,ye(null)};return G.addEventListener("click",_),()=>G.removeEventListener("click",_)}if(Q==="trendline"||Q==="gannline"){const _=Q,P=_==="gannline"?"#7aa6ae":"#22c55e",Ae=x=>{x.preventDefault(),x.stopPropagation(),x.stopImmediatePropagation();const f=G.getBoundingClientRect(),u=x.clientX-f.left,H=x.clientY-f.top;let U=b.timeScale().coordinateToTime(u);const k=w.coordinateToPrice(H);if(!(U==null||k==null)&&(U=q(U),U!=null))if(D.current===null){D.current={time:U,price:k};const L=b.addLineSeries({color:P,lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});y.current={type:_,series:L},L.setData([{time:U,value:k}])}else{const L=D.current,p={time:U,price:k},I=1,O=1e-5,K=Math.abs(p.time-L.time),z=Math.abs(p.price-L.price);if(K<I&&z<O){try{b.removeSeries(y.current.series)}catch{}D.current=null,y.current=null;return}const R={time:L.time,rawTime:L.time,price:L.price},Z={time:p.time,rawTime:p.time,price:p.price},se=MA([{time:R.time,value:R.price},{time:Z.time,value:Z.price}]);if(se.length>0){y.current.series.setData(se);const fe={type:_,series:y.current.series,point1:R,point2:Z};be(ve=>[...ve,fe]),m.current.push(fe)}ye(null),D.current=null,y.current=null}},te=x=>{if(D.current===null||y.current?.type!=="trendline"&&y.current?.type!=="gannline")return;x.preventDefault(),x.stopPropagation();const f=G.getBoundingClientRect(),u=x.clientX-f.left,H=x.clientY-f.top;let U=b.timeScale().coordinateToTime(u);const k=w.coordinateToPrice(H);if(U==null||k==null||(U=q(U),U==null))return;const L=D.current,p=MA([{time:L.time,value:L.price},{time:U,value:k}]);p.length>0&&y.current.series.setData(p)},g=x=>{x.stopPropagation()},C={capture:!0,passive:!1};return G.addEventListener("click",Ae,C),G.addEventListener("mousemove",te,C),G.addEventListener("mousemove",g,C),()=>{if(D.current=null,(y.current?.type==="trendline"||y.current?.type==="gannline")&&y.current?.series){try{b.removeSeries(y.current.series)}catch{}y.current=null}G.removeEventListener("click",Ae,C),G.removeEventListener("mousemove",te,C),G.removeEventListener("mousemove",g,C)}}if(Q==="parallellines"){let _=null,P=null,Ae=null,te=0,g=null;const C=(k,L,p,I)=>{k.p1={rawTime:L.rawTime,price:L.price},k.p2={rawTime:p.rawTime,price:p.price},k.b1={rawTime:I.b1.rawTime,price:I.b1.price},k.b2={rawTime:I.b2.rawTime,price:I.b2.price},k.p3={rawTime:I.bottomMid.rawTime,price:I.bottomMid.price}},x=(k,L,p)=>{const I=Sd(k,L,p);if(!I)return null;if(!g)g=new Td({rawTime:k.rawTime,price:k.price},{rawTime:L.rawTime,price:L.price},{rawTime:I.b1.rawTime,price:I.b1.price},{rawTime:I.b2.rawTime,price:I.b2.price},{rawTime:I.bottomMid.rawTime,price:I.bottomMid.price}),w.attachPrimitive(g);else{C(g,k,L,I);try{b.applyOptions({})}catch{}}return I},f=k=>{k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation();const L=G.getBoundingClientRect(),p=k.clientX-L.left,I=k.clientY-L.top,O=b.timeScale().coordinateToTime(p),K=w.coordinateToPrice(I);if(O==null||K==null)return;const z=q(O);if(z!=null){if(te===0){_={rawTime:O,normalizedTime:z,price:K},te=1;return}if(te===1){if(P={rawTime:O,normalizedTime:z,price:K},Math.abs(P.normalizedTime-_.normalizedTime)<1)return;const R=q((_.normalizedTime+P.normalizedTime)/2);if(R==null)return;const Z=(_.price+P.price)/2;Ae={rawTime:R,normalizedTime:R,price:Z},x(_,P,Ae),te=2;return}if(te===2&&_&&P){Ae={rawTime:O,normalizedTime:z,price:K};const R=x(_,P,Ae);if(!R||!g)return;try{w.detachPrimitive(g)}catch{}const Z=new Td({rawTime:_.rawTime,price:_.price},{rawTime:P.rawTime,price:P.price},{rawTime:R.b1.rawTime,price:R.b1.price},{rawTime:R.b2.rawTime,price:R.b2.price},{rawTime:R.bottomMid.rawTime,price:R.bottomMid.price});w.attachPrimitive(Z);const se={type:"equidistantchannel",primitive:Z,p1:_,p2:P,p3:R.bottomMid,b1:R.b1,b2:R.b2,bottomMid:R.bottomMid};be(fe=>[...fe,se]),m.current.push(se),ye(null),te=0,_=null,P=null,Ae=null,g=null}}},u=k=>{if(te===0||!_)return;const L=G.getBoundingClientRect(),p=k.clientX-L.left,I=k.clientY-L.top,O=b.timeScale().coordinateToTime(p),K=w.coordinateToPrice(I);if(O==null||K==null)return;const z=q(O);if(z!=null){if(te===1){const R={rawTime:O,normalizedTime:z,price:K},Z=q((_.normalizedTime+R.normalizedTime)/2);if(Z==null)return;const se=(_.price+R.price)/2;x(_,R,{rawTime:Z,normalizedTime:Z,price:se});return}te===2&&P&&x(_,P,{rawTime:O,normalizedTime:z,price:K})}},H=k=>{k.stopPropagation()},U={capture:!0,passive:!1};return G.addEventListener("click",f,U),G.addEventListener("mousemove",u,U),G.addEventListener("mousemove",H,U),()=>{if(te=0,_=null,P=null,Ae=null,E.current=[],g)try{w.detachPrimitive(g)}catch{}g=null,G.removeEventListener("click",f,U),G.removeEventListener("mousemove",u,U),G.removeEventListener("mousemove",H,U)}}if(Q==="fibonacci"){let _=null,P=null;const Ae=g=>{if(!_)return;const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(!(u==null||H==null))if(!P)P=new Qd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H}),w.attachPrimitive(P);else{P.p2={rawTime:u,price:H};try{b.applyOptions({})}catch{}}},te=g=>{const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=b.timeScale().coordinateToTime(x),H=w.coordinateToPrice(f);if(u==null||H==null)return;if(!_){_={rawTime:u,price:H,normalizedTime:q(u)};return}if(P){try{w.detachPrimitive(P)}catch{}P=null}const U=_.normalizedTime,k=q(u);if(U==null||k==null)return;if(Math.abs(H-_.price)<1e-5){_=null;return}const L=new Qd({rawTime:_.rawTime,price:_.price},{rawTime:u,price:H});w.attachPrimitive(L);const p={type:"fibonacci",primitive:L,p1:{rawTime:_.rawTime,normalizedTime:U,price:_.price},p2:{rawTime:u,normalizedTime:k,price:H}};be(I=>[...I,p]),m.current.push(p),_=null,ye(null)};return G.addEventListener("mousemove",Ae),G.addEventListener("click",te),()=>{if(G.removeEventListener("mousemove",Ae),G.removeEventListener("click",te),P)try{w.detachPrimitive(P)}catch{}}}if(D.current=null,(y.current?.type==="trendline"||y.current?.type==="gannline")&&y.current?.series){try{b.removeSeries(y.current.series)}catch{}y.current=null}const ee=_=>{if(_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),Q==="trendline"||Q==="gannline"||Q==="parallellines"||Q==="fibonacci"||Q!=="rectangle"&&Q!=="circle"&&Q!=="triangle"&&Q!=="ellipse")return;const P=G.getBoundingClientRect(),Ae=_.clientX-P.left,te=_.clientY-P.top;let g=b.timeScale().coordinateToTime(Ae);const C=w.coordinateToPrice(te);if(g==null||C==null)return;const x=g;if(g=q(g),g!=null){if(T.current=!0,v.current={time:g,normalizedTime:g,rawTime:x,price:C},B.current=null,Q==="rectangle"){const f=new ay({rawTime:x,price:C},{rawTime:x,price:C},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});w.attachPrimitive(f),y.current={type:"rectangle",primitive:f}}if(Q==="circle"){const f=new ly({rawTime:x,price:C},{rawTime:x,price:C},{strokeColor:"#7aa6ae",lineWidth:1});w.attachPrimitive(f),y.current={type:"circle",primitive:f}}if(Q==="triangle"){const f=new cy({rawTime:x,price:C},{rawTime:x,price:C},{rawTime:x,price:C},{strokeColor:"#7aa6ae",fillColor:"rgba(148, 163, 184, 0.18)",lineWidth:1});w.attachPrimitive(f),y.current={type:"triangle",primitive:f}}if(Q==="ellipse"){const f=new hy({rawTime:x,price:C},{rawTime:x,price:C},{strokeColor:"#7aa6ae",lineWidth:1,minorRatio:.45,previewAsLine:!0});w.attachPrimitive(f),y.current={type:"ellipse",primitive:f}}if(Q==="parallellines"){const f=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});y.current={type:"parallellines",series:f,firstLine:null,secondLine:null}}}},M=_=>{if(!T.current||!v.current||!y.current)return;_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation();const P=G.getBoundingClientRect(),Ae=_.clientX-P.left,te=_.clientY-P.top;let g=b.timeScale().coordinateToTime(Ae);const C=w.coordinateToPrice(te);if(g==null||C==null)return;const x=g;if(g=q(g),g==null)return;B.current={time:g,normalizedTime:g,rawTime:x,price:C};const f=v.current;if(y.current.type==="rectangle"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:x,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="circle"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:x,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="triangle"){const u=y.current.primitive,H=F(f,{time:g,rawTime:x,price:C});if(!H)return;u.p1={rawTime:H.p1.rawTime,price:H.p1.price},u.p2={rawTime:H.p2.rawTime,price:H.p2.price},u.p3={rawTime:H.p3.rawTime,price:H.p3.price};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="ellipse"){const u=y.current.primitive;u.p1={rawTime:f.rawTime,price:f.price},u.p2={rawTime:x,price:C};try{a.current?.applyOptions({})}catch{}}if(y.current.type==="parallellines")if(y.current.firstLine){const u=y.current.firstLine;u.endTime-u.startTime;const H=u.endPrice-u.startPrice,U=C,k=U+H;if(y.current.secondLine)y.current.secondLine.setData([{time:f.time,value:U},{time:g,value:k}]);else{const L=b.addLineSeries({color:"#8b5cf6",lineWidth:2,priceLineVisible:!1,lastValueVisible:!1});L.setData([{time:f.time,value:U},{time:g,value:k}]),y.current.secondLine=L}}else y.current.series.setData([{time:f.time,value:f.price},{time:g,value:C}])},le=_=>{if(_&&(_.preventDefault(),_.stopPropagation()),!T.current||!y.current||!v.current)return;const P=v.current,Ae=B.current||P;if(y.current.type==="parallellines")if(y.current.firstLine){const te={type:"parallellines",firstLine:y.current.series,secondLine:y.current.secondLine,firstLineData:y.current.firstLine};be(g=>[...g,te]),m.current.push(te),ye(null),y.current=null,T.current=!1,v.current=null,B.current=null;return}else{y.current.firstLine={startTime:P.time,startPrice:P.price,endTime:Ae.time,endPrice:Ae.price},T.current=!1,v.current=null,B.current=null;return}if(y.current.type==="rectangle"){const te=v.current,g=B.current||te,C=Math.max(te.price,g.price),x=Math.min(te.price,g.price),f=q(Math.min(te.time,g.time)),u=q(Math.max(te.time,g.time));if(f!=null&&u!=null&&Math.abs(u-f)>=1&&Math.abs(C-x)>=1e-5){const H=y.current.primitive,U=te.time<=g.time?te.rawTime:g.rawTime,k=te.time<=g.time?g.rawTime:te.rawTime,L={rawTime:U,normalizedTime:f,price:C},p={rawTime:k,normalizedTime:u,price:x};H.p1={rawTime:L.rawTime,price:L.price},H.p2={rawTime:p.rawTime,price:p.price};const I={type:"rectangle",primitive:H,p1:L,p2:p};be(O=>[...O,I]),m.current.push(I),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="circle"){const te=y.current.primitive,g={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},C={rawTime:Ae.rawTime,normalizedTime:Ae.time,price:Ae.price},x=b.timeScale().timeToCoordinate(g.rawTime),f=w.priceToCoordinate(g.price),u=b.timeScale().timeToCoordinate(C.rawTime),H=w.priceToCoordinate(C.price);if((x!=null&&f!=null&&u!=null&&H!=null?Math.hypot(u-x,H-f):0)>=3){te.p1={rawTime:g.rawTime,price:g.price},te.p2={rawTime:C.rawTime,price:C.price};const k={type:"circle",primitive:te,p1:g,p2:C};be(L=>[...L,k]),m.current.push(k),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="triangle"){const te=y.current.primitive,g=F(P,Ae);if(g){const C=Math.abs(g.p3.normalizedTime-g.p2.normalizedTime),x=Math.abs(g.p1.price-g.p2.price);if(C>=1&&x>=1e-5){te.p1={rawTime:g.p1.rawTime,price:g.p1.price},te.p2={rawTime:g.p2.rawTime,price:g.p2.price},te.p3={rawTime:g.p3.rawTime,price:g.p3.price};const f={type:"triangle",primitive:te,p1:g.p1,p2:g.p2,p3:g.p3};be(u=>[...u,f]),m.current.push(f),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}else try{w.detachPrimitive(y.current.primitive)}catch{}}if(y.current.type==="ellipse"){const te=y.current.primitive,g={rawTime:P.rawTime,normalizedTime:P.time,price:P.price},C={rawTime:Ae.rawTime,normalizedTime:Ae.time,price:Ae.price},x=b.timeScale().timeToCoordinate(g.rawTime),f=w.priceToCoordinate(g.price),u=b.timeScale().timeToCoordinate(C.rawTime),H=w.priceToCoordinate(C.price);if((x!=null&&f!=null&&u!=null&&H!=null?Math.hypot(u-x,H-f):0)>=4){te.p1={rawTime:g.rawTime,price:g.price},te.p2={rawTime:C.rawTime,price:C.price},te.previewAsLine=!1,te.minorRatio=.45;const k={type:"ellipse",primitive:te,p1:g,p2:C,minorRatio:.45};be(L=>[...L,k]),m.current.push(k),ye(null)}else try{w.detachPrimitive(y.current.primitive)}catch{}}T.current=!1,v.current=null,B.current=null,y.current=null};if(Q==="rectangle"||Q==="circle"||Q==="triangle"||Q==="ellipse"){const _={capture:!0,passive:!1},P=Ae=>{T.current||Ae.stopPropagation()};return G.addEventListener("mousedown",ee,_),G.addEventListener("mousemove",M,_),G.addEventListener("mousemove",P,_),G.addEventListener("mouseup",le,_),()=>{if((y.current?.type==="rectangle"||y.current?.type==="circle"||y.current?.type==="triangle"||y.current?.type==="ellipse")&&y.current?.primitive)try{w.detachPrimitive(y.current.primitive)}catch{}y.current=null,T.current=!1,v.current=null,B.current=null,G.removeEventListener("mousedown",ee,_),G.removeEventListener("mousemove",M,_),G.removeEventListener("mousemove",P,_),G.removeEventListener("mouseup",le,_)}}},[we,he,be,ye]),Y.useEffect(()=>{const b=a.current,w=c.current,G=o.current,Be=we===null||we===1;if(!Be||!b||!w||!G){Be||(S(null),V([]),ce(null),de([]));return}const Q=10,F=8;function ee(g){if(!g)return[];if(g.type==="trendline"&&g.point1&&g.point2){const C=b.timeScale().timeToCoordinate(g.point1.time),x=w.priceToCoordinate(g.point1.price),f=b.timeScale().timeToCoordinate(g.point2.time),u=w.priceToCoordinate(g.point2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="gannline"&&g.point1&&g.point2){const C=b.timeScale().timeToCoordinate(g.point1.time),x=w.priceToCoordinate(g.point1.price),f=b.timeScale().timeToCoordinate(g.point2.time),u=w.priceToCoordinate(g.point2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:(C+f)/2,y:(x+u)/2},{x:f,y:u}]}if(g.type==="rectangle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);if(C==null||x==null||f==null||u==null)return[];const H=Math.min(C,f),U=Math.max(C,f),k=Math.min(x,u),L=Math.max(x,u),p=(H+U)/2,I=(k+L)/2;return[{x:H,y:k},{x:p,y:k},{x:U,y:k},{x:H,y:I},{x:U,y:I},{x:H,y:L},{x:p,y:L},{x:U,y:L}]}if(g.type==="circle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="triangle"&&g.p1&&g.p2&&g.p3){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price);return C==null||x==null||f==null||u==null||H==null||U==null?[]:[{x:C,y:x},{x:f,y:u},{x:H,y:U}]}if(g.type==="ellipse"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);if(C==null||x==null||f==null||u==null)return[];const H=(C+f)/2,U=(x+u)/2,k=f-C,L=u-x,p=Math.hypot(k,L);if(p<.001)return[];const I=k/p,O=L/p,K=-O,z=I,R=p/2,Z=R*Math.max(.05,g.minorRatio??.45);return[{x:H-I*R,y:U-O*R},{x:H+K*Z,y:U+z*Z},{x:H+I*R,y:U+O*R},{x:H-K*Z,y:U-z*Z}]}if(g.type==="gannfan"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="ganngrid"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="arrowedline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="rayline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="extendedline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="crossline"&&g.p){const C=b.timeScale().timeToCoordinate(g.p.rawTime),x=w.priceToCoordinate(g.p.price);return C==null||x==null?[]:[{x:C,y:x}]}if(g.type==="text"&&g.rawTime!=null&&g.price!=null){const C=b.timeScale().timeToCoordinate(g.rawTime),x=w.priceToCoordinate(g.price);return C==null||x==null?[]:[{x:C,y:x}]}if(g.type==="trendbyangle"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="andrewspitchfork"&&g.p1&&g.p2&&g.p3){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price);return C==null||x==null||f==null||u==null||H==null||U==null?[]:[{x:C,y:x},{x:f,y:u},{x:H,y:U}]}if(g.type==="equidistantchannel"&&g.p1&&g.p2&&g.b1&&g.b2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.b1.rawTime),U=w.priceToCoordinate(g.b1.price),k=b.timeScale().timeToCoordinate(g.b2.rawTime),L=w.priceToCoordinate(g.b2.price);return C==null||x==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:x},{x:f,y:u},{x:(H+k)/2,y:(U+L)/2}]}if(g.type==="regressionchannel"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="stddevchannel"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="disjointchannel"&&g.p1&&g.p2&&g.p3&&g.p4){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price),k=b.timeScale().timeToCoordinate(g.p4.rawTime),L=w.priceToCoordinate(g.p4.price);return C==null||x==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:x},{x:f,y:u},{x:H,y:U},{x:k,y:L}]}if(g.type==="flattopbottom"&&g.p1&&g.p2&&g.p3&&g.p4){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price),H=b.timeScale().timeToCoordinate(g.p3.rawTime),U=w.priceToCoordinate(g.p3.price),k=b.timeScale().timeToCoordinate(g.p4.rawTime),L=w.priceToCoordinate(g.p4.price);return C==null||x==null||f==null||u==null||H==null||U==null||k==null||L==null?[]:[{x:C,y:x},{x:f,y:u},{x:H,y:U},{x:k,y:L}]}if(g.type==="infoline"&&g.p1&&g.p2){const C=g.p1.rawTime??g.p1.time,x=g.p2.rawTime??g.p2.time,f=b.timeScale().timeToCoordinate(C),u=w.priceToCoordinate(g.p1.price),H=b.timeScale().timeToCoordinate(x),U=w.priceToCoordinate(g.p2.price);return f==null||u==null||H==null||U==null?[]:[{x:f,y:u},{x:H,y:U}]}if(g.type==="rulerline"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:(C+f)/2,y:(x+u)/2},{x:f,y:u}]}if(g.type==="fibonacci"&&g.p1&&g.p2){const C=b.timeScale().timeToCoordinate(g.p1.rawTime),x=w.priceToCoordinate(g.p1.price),f=b.timeScale().timeToCoordinate(g.p2.rawTime),u=w.priceToCoordinate(g.p2.price);return C==null||x==null||f==null||u==null?[]:[{x:C,y:x},{x:f,y:u}]}if(g.type==="horizontalray"&&g.primitive){const C=g.primitive,x=b.timeScale().timeToCoordinate(C.originTime),f=w.priceToCoordinate(C.price);return x==null||f==null?[]:[{x,y:f}]}if(g.type==="verticalline"&&g.primitive){const C=g.primitive,x=b.timeScale().timeToCoordinate(C.time);if(x==null)return[];const f=C.midYCss??200;return[{x,y:f}]}return[]}function M(g,C){for(let x=Ye.length-1;x>=0;x--){const f=Ye[x];if(f.type==="trendline"&&f.point1&&f.point2){const u=b.timeScale().timeToCoordinate(f.point1.time),H=w.priceToCoordinate(f.point1.price),U=b.timeScale().timeToCoordinate(f.point2.time),k=w.priceToCoordinate(f.point2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="gannline"&&f.point1&&f.point2){const u=b.timeScale().timeToCoordinate(f.point1.time),H=w.priceToCoordinate(f.point1.price),U=b.timeScale().timeToCoordinate(f.point2.time),k=w.priceToCoordinate(f.point2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"line"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="rectangle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.min(u,U),p=Math.max(u,U),I=Math.min(H,k),O=Math.max(H,k),K=(L+p)/2,z=(I+O)/2,R=[{x:L,y:I,mode:"handle1"},{x:K,y:I,mode:"handle2"},{x:p,y:I,mode:"handle3"},{x:L,y:z,mode:"handle4"},{x:p,y:z,mode:"handle5"},{x:L,y:O,mode:"handle6"},{x:K,y:O,mode:"handle7"},{x:p,y:O,mode:"handle8"}];for(const Se of R)if(Math.hypot(g-Se.x,C-Se.y)<Q)return{object:f,mode:Se.mode};const Z=qe(g,C,L,I,p,I),se=qe(g,C,L,O,p,O),fe=qe(g,C,L,I,L,O),ve=qe(g,C,p,I,p,O);if(Z<F||se<F||fe<F||ve<F||XA(g,C,[{x:L,y:I},{x:p,y:I},{x:p,y:O},{x:L,y:O}]))return{object:f,mode:"line"}}if(f.type==="circle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(U-u,k-H);if(L<2)continue;const p=Math.hypot(g-u,C-H),I=Math.hypot(g-U,C-k);if(p<Q)return{object:f,mode:"handle1"};if(I<Q)return{object:f,mode:"handle2"};if(Math.abs(p-L)<F||p<L)return{object:f,mode:"line"}}if(f.type==="triangle"&&f.p1&&f.p2&&f.p3){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price);if(u==null||H==null||U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"handle3"};const z=qe(g,C,u,H,U,k),R=qe(g,C,U,k,L,p),Z=qe(g,C,L,p,u,H);if(z<F||R<F||Z<F||XA(g,C,[{x:u,y:H},{x:U,y:k},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="ellipse"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=U-u,O=k-H,K=Math.hypot(I,O);if(K<2)continue;const z=I/K,R=O/K,Z=-R,se=z,fe=K/2,ve=fe*Math.max(.05,f.minorRatio??.45);if(fe<2||ve<2)continue;const Se=L-z*fe,Pe=p-R*fe,We=L+Z*ve,Re=p+se*ve,at=L+z*fe,it=p+R*fe,gt=L-Z*ve,Et=p-se*ve,jt=Math.hypot(g-Se,C-Pe),Kt=Math.hypot(g-We,C-Re),$t=Math.hypot(g-at,C-it),QA=Math.hypot(g-gt,C-Et);if(jt<Q)return{object:f,mode:"handle1"};if(Kt<Q)return{object:f,mode:"handle2"};if($t<Q)return{object:f,mode:"handle3"};if(QA<Q)return{object:f,mode:"handle4"};const cr=(g-L)*z+(C-p)*R,hs=(g-L)*Z+(C-p)*se,Vd=cr/fe,zd=hs/ve,Wd=Vd*Vd+zd*zd;if(Math.abs(Wd-1)<.2||Wd<1)return{object:f,mode:"line"}}if(f.type==="gannfan"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-U,C-k),p=Math.hypot(g-u,C-H);if(L<Q)return{object:f,mode:"handle2"};if(p<Q)return{object:f,mode:"handle1"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="ganngrid"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-U,C-k),p=Math.hypot(g-u,C-H);if(L<Q)return{object:f,mode:"handle2"};if(p<Q)return{object:f,mode:"handle1"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="arrowedline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="rayline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(Ty(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="extendedline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(xy(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="crossline"&&f.p){const u=b.timeScale().timeToCoordinate(f.p.rawTime),H=w.priceToCoordinate(f.p.price);if(u==null||H==null)continue;if(Math.hypot(g-u,C-H)<Q)return{object:f,mode:"handle1"};const k=Math.abs(C-H),L=Math.abs(g-u);if(k<F||L<F)return{object:f,mode:"line"}}if(f.type==="text"&&f.rawTime!=null&&f.price!=null){const u=b.timeScale().timeToCoordinate(f.rawTime),H=w.priceToCoordinate(f.price);if(u==null||H==null)continue;const U=Ud(f,u,H);if(g>=U.left&&g<=U.right&&C>=U.top&&C<=U.bottom)return{object:f,mode:"line"}}if(f.type==="trendbyangle"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="equidistantchannel"&&f.p1&&f.p2&&f.b1&&f.b2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.b1.rawTime),p=w.priceToCoordinate(f.b1.price),I=b.timeScale().timeToCoordinate(f.b2.rawTime),O=w.priceToCoordinate(f.b2.price),K=L!=null&&I!=null?(L+I)/2:null,z=p!=null&&O!=null?(p+O)/2:null;if(u==null||H==null||U==null||k==null||K==null||z==null||L==null||p==null||I==null||O==null)continue;const R=Math.hypot(g-u,C-H),Z=Math.hypot(g-U,C-k),se=Math.hypot(g-K,C-z),fe=Math.hypot(u-K,H-z)<Q*1.5;if(fe&&Math.min(R,se)<Q*1.5)return{object:f,mode:"handle3"};if(se<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle2"};if(fe)continue;if(R<Q)return{object:f,mode:"handle1"};const ve=qe(g,C,u,H,U,k),Se=qe(g,C,L,p,I,O);if(ve<F||Se<F||XA(g,C,[{x:u,y:H},{x:U,y:k},{x:I,y:O},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="regressionchannel"&&f.p1&&f.p2&&f.top1&&f.top2&&f.bot1&&f.bot2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.top1.rawTime),p=w.priceToCoordinate(f.top1.price),I=b.timeScale().timeToCoordinate(f.top2.rawTime),O=w.priceToCoordinate(f.top2.price),K=b.timeScale().timeToCoordinate(f.bot1.rawTime),z=w.priceToCoordinate(f.bot1.price),R=b.timeScale().timeToCoordinate(f.bot2.rawTime),Z=w.priceToCoordinate(f.bot2.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null||K==null||z==null||R==null||Z==null)continue;const se=Math.hypot(g-u,C-H),fe=Math.hypot(g-U,C-k);if(se<Q)return{object:f,mode:"handle1"};if(fe<Q)return{object:f,mode:"handle2"};const ve=qe(g,C,u,H,U,k),Se=qe(g,C,L,p,I,O),Pe=qe(g,C,K,z,R,Z);if(ve<F||Se<F||Pe<F||XA(g,C,[{x:L,y:p},{x:I,y:O},{x:R,y:Z},{x:K,y:z}]))return{object:f,mode:"line"}}if(f.type==="stddevchannel"&&f.p1&&f.p2&&f.top1&&f.top2&&f.bot1&&f.bot2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.top1.rawTime),p=w.priceToCoordinate(f.top1.price),I=b.timeScale().timeToCoordinate(f.top2.rawTime),O=w.priceToCoordinate(f.top2.price),K=b.timeScale().timeToCoordinate(f.bot1.rawTime),z=w.priceToCoordinate(f.bot1.price),R=b.timeScale().timeToCoordinate(f.bot2.rawTime),Z=w.priceToCoordinate(f.bot2.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null||K==null||z==null||R==null||Z==null)continue;const se=Math.hypot(g-u,C-H),fe=Math.hypot(g-U,C-k);if(se<Q)return{object:f,mode:"handle1"};if(fe<Q)return{object:f,mode:"handle2"};const ve=qe(g,C,u,H,U,k),Se=qe(g,C,L,p,I,O),Pe=qe(g,C,K,z,R,Z);if(ve<F||Se<F||Pe<F||XA(g,C,[{x:L,y:p},{x:I,y:O},{x:R,y:Z},{x:K,y:z}]))return{object:f,mode:"line"}}if(f.type==="andrewspitchfork"&&f.p1&&f.p2&&f.p3){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price);if(u==null||H==null||U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"handle3"};const z=(U+L)/2,R=(k+p)/2;let Z=z-u,se=R-H;Math.abs(Z)<1e-4&&(Z=1e-4);const fe=se/Z,ve=G.clientWidth,Se=k+fe*(ve-U),Pe=p+fe*(ve-L),We=qe(g,C,U,k,ve,Se),Re=qe(g,C,L,p,ve,Pe);if(We<F||Re<F||XA(g,C,[{x:U,y:k},{x:ve,y:Se},{x:ve,y:Pe},{x:L,y:p}]))return{object:f,mode:"line"}}if(f.type==="disjointchannel"&&f.p1&&f.p2&&f.p3&&f.p4){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price),I=b.timeScale().timeToCoordinate(f.p4.rawTime),O=w.priceToCoordinate(f.p4.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null)continue;const K=Math.hypot(g-u,C-H),z=Math.hypot(g-U,C-k),R=Math.hypot(g-L,C-p),Z=Math.hypot(g-I,C-O);if(K<Q)return{object:f,mode:"handle1"};if(z<Q)return{object:f,mode:"handle2"};if(R<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle4"};const se=qe(g,C,u,H,L,p),fe=qe(g,C,U,k,I,O),ve=qe(g,C,u,H,U,k),Se=qe(g,C,L,p,I,O);if(se<F||fe<F||ve<F||Se<F||XA(g,C,[{x:u,y:H},{x:L,y:p},{x:I,y:O},{x:U,y:k}]))return{object:f,mode:"line"}}if(f.type==="flattopbottom"&&f.p1&&f.p2&&f.p3&&f.p4){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price),L=b.timeScale().timeToCoordinate(f.p3.rawTime),p=w.priceToCoordinate(f.p3.price),I=b.timeScale().timeToCoordinate(f.p4.rawTime),O=w.priceToCoordinate(f.p4.price);if(u==null||H==null||U==null||k==null||L==null||p==null||I==null||O==null)continue;const K=Math.hypot(g-u,C-H),z=Math.hypot(g-U,C-k),R=Math.hypot(g-L,C-p),Z=Math.hypot(g-I,C-O);if(K<Q)return{object:f,mode:"handle1"};if(z<Q)return{object:f,mode:"handle2"};if(R<Q)return{object:f,mode:"handle3"};if(Z<Q)return{object:f,mode:"handle4"};const se=qe(g,C,u,H,L,p),fe=qe(g,C,U,k,I,O),ve=qe(g,C,u,H,U,k),Se=qe(g,C,L,p,I,O);if(se<F||fe<F||ve<F||Se<F||XA(g,C,[{x:u,y:H},{x:L,y:p},{x:I,y:O},{x:U,y:k}]))return{object:f,mode:"line"}}if(f.type==="rulerline"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=(u+U)/2,p=(H+k)/2,I=Math.hypot(g-u,C-H),O=Math.hypot(g-U,C-k),K=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(K<Q)return{object:f,mode:"line"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="infoline"&&f.p1&&f.p2){const u=f.p1.rawTime??f.p1.time,H=f.p2.rawTime??f.p2.time,U=b.timeScale().timeToCoordinate(u),k=w.priceToCoordinate(f.p1.price),L=b.timeScale().timeToCoordinate(H),p=w.priceToCoordinate(f.p2.price);if(U==null||k==null||L==null||p==null)continue;const I=Math.hypot(g-U,C-k),O=Math.hypot(g-L,C-p);if(I<Q)return{object:f,mode:"handle1"};if(O<Q)return{object:f,mode:"handle2"};if(qe(g,C,U,k,L,p)<F)return{object:f,mode:"line"}}if(f.type==="fibonacci"&&f.p1&&f.p2){const u=b.timeScale().timeToCoordinate(f.p1.rawTime),H=w.priceToCoordinate(f.p1.price),U=b.timeScale().timeToCoordinate(f.p2.rawTime),k=w.priceToCoordinate(f.p2.price);if(u==null||H==null||U==null||k==null)continue;const L=Math.hypot(g-u,C-H),p=Math.hypot(g-U,C-k);if(L<Q)return{object:f,mode:"handle1"};if(p<Q)return{object:f,mode:"handle2"};if(qe(g,C,u,H,U,k)<F)return{object:f,mode:"line"}}if(f.type==="horizontalray"&&f.primitive){const u=f.primitive,H=b.timeScale().timeToCoordinate(u.originTime),U=w.priceToCoordinate(u.price);if(U==null)continue;if(H!=null&&Math.hypot(g-H,C-U)<Q)return{object:f,mode:"handle1"};const k=H==null?0:Math.max(0,H);if(g>=k&&Math.abs(C-U)<F)return{object:f,mode:"line"}}if(f.type==="verticalline"&&f.primitive){const u=f.primitive,H=b.timeScale().timeToCoordinate(u.time);if(H==null)continue;const U=u.midYCss??200;if(Math.hypot(g-H,C-U)<Q)return{object:f,mode:"handle1"};if(Math.abs(g-H)<F)return{object:f,mode:"line"}}}return null}const le=g=>{const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top,u=M(x,f);if(u){if(g.preventDefault(),g.stopPropagation(),g.detail>=2){$(u.object),J.current=null,ie.current=null;return}S(u.object),ce(null),de([]),J.current=u.mode,u.object.type==="rayline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="extendedline"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="crossline"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x,y:f,p:{...u.object.p}}),u.object.type==="text"&&u.mode==="line"&&(ie.current={x,y:f,rawTime:u.object.rawTime,price:u.object.price}),u.object.type==="trendbyangle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="equidistantchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="andrewspitchfork"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="regressionchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="stddevchannel"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="disjointchannel"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="flattopbottom"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}),u.object.type==="fibonacci"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="gannfan"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="ganngrid"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="rectangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4"||u.mode==="handle5"||u.mode==="handle6"||u.mode==="handle7"||u.mode==="handle8")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="circle"&&(u.mode==="handle1"||u.mode==="handle2")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}),u.object.type==="triangle"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}),u.object.type==="ellipse"&&(u.mode==="handle1"||u.mode==="handle2"||u.mode==="handle3"||u.mode==="handle4")&&(ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}),u.object.type==="horizontalray"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x,y:f,price:u.object.primitive.price,originTime:u.object.primitive.originTime}),u.object.type==="verticalline"&&(u.mode==="handle1"||u.mode==="line")&&(ie.current={x,y:f,time:u.object.primitive.time}),u.mode==="line"&&(u.object.type==="rulerline"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="infoline"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="arrowedline"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rayline"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="extendedline"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="crossline"?ie.current={x,y:f,p:{...u.object.p}}:u.object.type==="text"?ie.current={x,y:f,rawTime:u.object.rawTime,price:u.object.price}:u.object.type==="trendbyangle"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="equidistantchannel"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="andrewspitchfork"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="regressionchannel"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="stddevchannel"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="disjointchannel"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="flattopbottom"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3},p4:{...u.object.p4}}:u.object.type==="fibonacci"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="gannfan"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="rectangle"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="circle"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="triangle"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},p3:{...u.object.p3}}:u.object.type==="ellipse"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2},minorRatio:u.object.minorRatio??.45}:u.object.type==="ganngrid"?ie.current={x,y:f,p1:{...u.object.p1},p2:{...u.object.p2}}:u.object.type==="horizontalray"?ie.current={x,y:f,price:u.object.primitive.price,originTime:u.object.primitive.originTime}:u.object.type==="verticalline"?ie.current={x,y:f,time:u.object.primitive.time}:ie.current={x,y:f,point1:{...u.object.point1},point2:{...u.object.point2}})}else S(null),J.current=null,V([]),ce(null),de([])},_=g=>{const C=G.getBoundingClientRect(),x=g.clientX-C.left,f=g.clientY-C.top;if(!J.current){const L=M(x,f);if(L?.object&&!pe.current){const p=ee(L.object);ce(I=>I===L.object?I:L.object),de(I=>I.length===p.length&&I.every((O,K)=>O.x===p[K].x&&O.y===p[K].y)?I:p)}else ce(p=>p==null?p:null),de(p=>p.length===0?p:[]);return}const u=pe.current;if(!u)return;const H=b.timeScale().coordinateToTime(x),U=w.coordinateToPrice(f);if(H==null||U==null)return;let k=q(H);if(k!=null){if(u.type==="infoline"&&u.p1&&u.p2){const L=K=>{const z=K.rawTime??K.time,R=K.normalizedTime??q(z);return{rawTime:z,normalizedTime:R,price:K.price}},p=(K,z)=>{const R=K.normalizedTime??q(K.rawTime),Z=z.normalizedTime??q(z.rawTime);if(R==null||Z==null)return;const se=z.price-K.price,fe=se/Math.abs(K.price)*100,ve=eA(Oe)||3600,Se=Math.abs(Z-R),Pe=Math.max(1,Math.round(Se/ve)),We=Math.max(1,Math.round(Se/86400)),Re=b.timeScale().timeToCoordinate(K.rawTime),at=w.priceToCoordinate(K.price),it=b.timeScale().timeToCoordinate(z.rawTime),gt=w.priceToCoordinate(z.price),Et=Re!=null&&at!=null&&it!=null&>!=null?Math.atan2(-(gt-at),it-Re)*(180/Math.PI):u.primitive?.info?.angle??0,jt={priceDiff:se,pricePct:fe,bars:Pe,days:We,angle:Et},Kt=u.primitive;if(Kt){Kt.p1={rawTime:K.rawTime,price:K.price},Kt.p2={rawTime:z.rawTime,price:z.price},Kt.info=jt;try{a.current?.applyOptions({})}catch{}}const $t={...u,rawP1Time:K.rawTime,rawP2Time:z.rawTime,p1:{rawTime:K.rawTime,normalizedTime:R,price:K.price},p2:{rawTime:z.rawTime,normalizedTime:Z,price:z.price}};be(QA=>{const cr=QA.map(hs=>hs===u?$t:hs);return m.current=cr,cr}),S($t),pe.current=$t},I=L(u.p1),O=L(u.p2);if(I.rawTime==null||I.normalizedTime==null||O.rawTime==null||O.normalizedTime==null)return;if(J.current==="handle1"){const K=b.timeScale().coordinateToTime(x)??H;p({rawTime:K,normalizedTime:k,price:U},O)}else if(J.current==="handle2"){const K=b.timeScale().coordinateToTime(x)??H;p(I,{rawTime:K,normalizedTime:k,price:U})}else if(J.current==="line"){const K=ie.current;if(!K)return;const z=L(K.p1),R=L(K.p2);if(z.rawTime==null||z.normalizedTime==null||R.rawTime==null||R.normalizedTime==null)return;const Z=b.timeScale().coordinateToTime(K.x)??z.rawTime,se=w.coordinateToPrice(K.y);if(Z==null||se==null)return;const fe=q(Z)??z.normalizedTime;if(fe==null)return;const ve=k-fe,Se=U-se,Pe=q(z.normalizedTime+ve),We=q(R.normalizedTime+ve);if(Pe==null||We==null)return;const Re=H-Z;p({rawTime:z.rawTime+Re,normalizedTime:Pe,price:z.price+Se},{rawTime:R.rawTime+Re,normalizedTime:We,price:R.price+Se})}return}if(u.type==="rulerline"&&u.p1&&u.p2){const L=(p,I)=>{const O=p.normalizedTime??p.rawTime,K=I.normalizedTime??I.rawTime,z=I.price-p.price,R=z/Math.abs(p.price)*100,Z=ls(Lr,p.rawTime,I.rawTime,Oe),se=Math.abs(K-O),fe=Math.max(1,Math.round(se/86400)),ve={priceDiff:z,pricePct:R,bars:Z,days:fe},Se=u.primitive;if(Se){Se.p1={rawTime:p.rawTime,price:p.price},Se.p2={rawTime:I.rawTime,price:I.price},Se.info=ve;const We=I.price>=p.price;Se.color=We?"#3b82f6":"#ef5350",Se.fillColor=We?"rgba(59,130,246,0.1)":"rgba(239,83,80,0.1)";try{a.current?.applyOptions({})}catch{}}const Pe={...u,rawP1Time:p.rawTime,rawP2Time:I.rawTime,p1:p,p2:I};be(We=>{const Re=We.map(at=>at===u?Pe:at);return m.current=Re,Re}),S(Pe),pe.current=Pe};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="arrowedline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="rayline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;const I=q(p);if(I==null)return;L(u.p1,{rawTime:p,normalizedTime:I,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="extendedline"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="crossline"&&u.p){const L=I=>{const O=u.primitive;if(O){O.center={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K},p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U});return}if(u.type==="text"){const L=b.timeScale().coordinateToTime(x);if(L==null)return;const p=u.primitive;if(p){p.rawTime=L,p.price=U;try{a.current?.applyOptions({})}catch{}}const I={...u,rawTime:L,price:U};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I;return}if(u.type==="trendbyangle"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"||J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="equidistantchannel"&&u.p1&&u.p2&&u.p3){const L=(p,I,O)=>{const K=Sd(p,I,O);if(!K)return;const z=u.primitive;if(z){z.p1={rawTime:p.rawTime,price:p.price},z.p2={rawTime:I.rawTime,price:I.price},z.b1={rawTime:K.b1.rawTime,price:K.b1.price},z.b2={rawTime:K.b2.rawTime,price:K.b2.price},z.p3={rawTime:K.bottomMid.rawTime,price:K.bottomMid.price};try{a.current?.applyOptions({})}catch{}}const R={...u,p1:p,p2:I,p3:K.bottomMid,b1:K.b1,b2:K.b2,bottomMid:K.bottomMid};be(Z=>{const se=Z.map(fe=>fe===u?R:fe);return m.current=se,se}),S(R),pe.current=R};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2,u.p3);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U},u.p3);return}if(J.current==="handle3"){L(u.p1,u.p2,{rawTime:u.p3.rawTime,normalizedTime:u.p3.normalizedTime??q(u.p3.rawTime),price:U});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K),se=q(p.p3.normalizedTime+K);if(R==null||Z==null||se==null)return;const fe=H-I;L({rawTime:p.p1.rawTime+fe,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+fe,normalizedTime:Z,price:p.p2.price+z},{rawTime:p.p3.rawTime+fe,normalizedTime:se,price:p.p3.price+z});return}}if(u.type==="regressionchannel"&&u.p1&&u.p2){const L=(p,I)=>{const O=as(he,p,I,u.stdMultiplier??1);if(!O)return;const K=u.primitive;if(K){K.mid1={rawTime:O.p1.rawTime,price:O.p1.price},K.mid2={rawTime:O.p2.rawTime,price:O.p2.price},K.top1={rawTime:O.top1.rawTime,price:O.top1.price},K.top2={rawTime:O.top2.rawTime,price:O.top2.price},K.bot1={rawTime:O.bot1.rawTime,price:O.bot1.price},K.bot2={rawTime:O.bot2.rawTime,price:O.bot2.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:O.p1,p2:O.p2,top1:O.top1,top2:O.top2,bot1:O.bot1,bot2:O.bot2,slope:O.slope,intercept:O.intercept,stdDev:O.stdDev,offset:O.offset,barCount:O.barCount};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k},u.p2);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z});return}}if(u.type==="stddevchannel"&&u.p1&&u.p2){const L=(p,I)=>{const O=Fa(he,p,I,u.stdMultiplier??1);if(!O)return;const K=u.primitive;if(K){K.mid1={rawTime:O.p1.rawTime,price:O.p1.price},K.mid2={rawTime:O.p2.rawTime,price:O.p2.price},K.top1={rawTime:O.top1.rawTime,price:O.top1.price},K.top2={rawTime:O.top2.rawTime,price:O.top2.price},K.bot1={rawTime:O.bot1.rawTime,price:O.bot1.price},K.bot2={rawTime:O.bot2.rawTime,price:O.bot2.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:O.p1,p2:O.p2,top1:O.top1,top2:O.top2,bot1:O.bot1,bot2:O.bot2,slope:O.slope,stdDev:O.stdDev,offset:O.offset,barCount:O.barCount};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k},u.p2);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z});return}}if(u.type==="andrewspitchfork"&&u.p1&&u.p2&&u.p3){const L=(p,I,O)=>{const K=u.primitive;if(K){K.p1={rawTime:p.rawTime,price:p.price},K.p2={rawTime:I.rawTime,price:I.price},K.p3={rawTime:O.rawTime,price:O.price};try{a.current?.applyOptions({})}catch{}}const z={...u,p1:p,p2:I,p3:O};be(R=>{const Z=R.map(se=>se===u?z:se);return m.current=Z,Z}),S(z),pe.current=z};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2,u.p3);return}if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U},u.p3);return}if(J.current==="handle3"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,u.p2,{rawTime:p,normalizedTime:k,price:U});return}if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K),se=q(p.p3.normalizedTime+K);if(R==null||Z==null||se==null)return;const fe=H-I;L({rawTime:p.p1.rawTime+fe,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+fe,normalizedTime:Z,price:p.p2.price+z},{rawTime:p.p3.rawTime+fe,normalizedTime:se,price:p.p3.price+z});return}}if(u.type==="disjointchannel"&&u.p1&&u.p2&&u.p3&&u.p4){const L=(z,R,Z,se)=>{const fe=u.primitive;if(fe){fe.p1={rawTime:z.rawTime,price:z.price},fe.p2={rawTime:R.rawTime,price:R.price},fe.p3={rawTime:Z.rawTime,price:Z.price},fe.p4={rawTime:se.rawTime,price:se.price};try{a.current?.applyOptions({})}catch{}}const ve={...u,p1:z,p2:R,p3:Z,p4:se};be(Se=>{const Pe=Se.map(We=>We===u?ve:We);return m.current=Pe,Pe}),S(ve),pe.current=ve},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(x);if(I==null)return;const O=q(I);if(O==null)return;const K=(z,R,Z,se)=>{const fe=z.normalizedTime??q(z.rawTime);if(fe==null)return null;const ve=q(fe+Z);return ve==null?null:{rawTime:z.rawTime+R,normalizedTime:ve,price:z.price+se}};if(J.current==="line"){const z=b.timeScale().coordinateToTime(p.x),R=w.coordinateToPrice(p.y);if(z==null||R==null)return;const Z=q(z);if(Z==null)return;const se=I-z,fe=O-Z,ve=U-R,Se=K(p.p1,se,fe,ve),Pe=K(p.p2,se,fe,ve),We=K(p.p3,se,fe,ve),Re=K(p.p4,se,fe,ve);if(!Se||!Pe||!We||!Re)return;L(Se,Pe,We,Re);return}if(J.current==="handle1"){const z=(p.p1.price+p.p2.price)/2,R={rawTime:I,normalizedTime:O,price:U},Z={rawTime:I,normalizedTime:O,price:2*z-U};L(R,Z,p.p3,p.p4);return}if(J.current==="handle3"){const z=(p.p3.price+p.p4.price)/2,R={rawTime:I,normalizedTime:O,price:U},Z={rawTime:I,normalizedTime:O,price:2*z-U};L(p.p1,p.p2,R,Z);return}if(J.current==="handle2"){const z=(p.p1.price+p.p2.price)/2,R={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:U};if(R.normalizedTime==null)return;const Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:2*z-U};if(Z.normalizedTime==null)return;L(Z,R,p.p3,p.p4);return}if(J.current==="handle4"){const z=U-p.p4.price,R={rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??q(p.p3.rawTime),price:p.p4.price+z};if(R.normalizedTime==null)return;const Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:p.p2.price+z};if(Z.normalizedTime==null)return;L(p.p1,Z,p.p3,R);return}}if(u.type==="flattopbottom"&&u.p1&&u.p2&&u.p3&&u.p4){const L=(z,R,Z,se)=>{const fe=u.primitive;if(fe){fe.p1={rawTime:z.rawTime,price:z.price},fe.p2={rawTime:R.rawTime,price:R.price},fe.p3={rawTime:Z.rawTime,price:Z.price},fe.p4={rawTime:se.rawTime,price:se.price};try{a.current?.applyOptions({})}catch{}}const ve={...u,p1:z,p2:R,p3:Z,p4:se};be(Se=>{const Pe=Se.map(We=>We===u?ve:We);return m.current=Pe,Pe}),S(ve),pe.current=ve},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(x);if(I==null)return;const O=q(I);if(O==null)return;const K=(z,R,Z,se)=>{const fe=z.normalizedTime??q(z.rawTime);if(fe==null)return null;const ve=q(fe+Z);return ve==null?null:{rawTime:z.rawTime+R,normalizedTime:ve,price:z.price+se}};if(J.current==="line"){const z=b.timeScale().coordinateToTime(p.x),R=w.coordinateToPrice(p.y);if(z==null||R==null)return;const Z=q(z);if(Z==null)return;const se=I-z,fe=O-Z,ve=U-R,Se=K(p.p1,se,fe,ve),Pe=K(p.p2,se,fe,ve),We=K(p.p3,se,fe,ve),Re=K(p.p4,se,fe,ve);if(!Se||!Pe||!We||!Re)return;L(Se,Pe,We,Re);return}if(J.current==="handle1"){const z={rawTime:I,normalizedTime:O,price:U},R={rawTime:I,normalizedTime:O,price:p.p2.price};L(z,R,p.p3,p.p4);return}if(J.current==="handle3"){const z={rawTime:I,normalizedTime:O,price:U},R={rawTime:I,normalizedTime:O,price:p.p4.price};L(p.p1,p.p2,z,R);return}if(J.current==="handle2"||J.current==="handle4"){const z=J.current==="handle2"?p.p2:p.p4,R=U-z.price,Z={rawTime:p.p1.rawTime,normalizedTime:p.p1.normalizedTime??q(p.p1.rawTime),price:p.p2.price+R},se={rawTime:p.p3.rawTime,normalizedTime:p.p3.normalizedTime??q(p.p3.rawTime),price:p.p4.price+R};if(Z.normalizedTime==null||se.normalizedTime==null)return;L(p.p1,Z,p.p3,se);return}}if(u.type==="fibonacci"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="rectangle"&&u.p1&&u.p2){const L=(it,gt)=>{const Et=u.primitive;if(Et){Et.p1={rawTime:it.rawTime,price:it.price},Et.p2={rawTime:gt.rawTime,price:gt.price};try{a.current?.applyOptions({})}catch{}}const jt={...u,p1:it,p2:gt};be(Kt=>{const $t=Kt.map(QA=>QA===u?jt:QA);return m.current=$t,$t}),S(jt),pe.current=jt},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(x);if(I==null)return;const O=q(I);if(O==null)return;if(J.current==="line"){const it=b.timeScale().coordinateToTime(p.x),gt=w.coordinateToPrice(p.y);if(it==null||gt==null)return;const Et=q(it);if(Et==null)return;const jt=O-Et,Kt=U-gt,$t=q(p.p1.normalizedTime+jt),QA=q(p.p2.normalizedTime+jt);if($t==null||QA==null)return;const cr=H-it;L({rawTime:p.p1.rawTime+cr,normalizedTime:$t,price:p.p1.price+Kt},{rawTime:p.p2.rawTime+cr,normalizedTime:QA,price:p.p2.price+Kt});return}const K=Math.min(p.p1.normalizedTime,p.p2.normalizedTime),z=Math.max(p.p1.normalizedTime,p.p2.normalizedTime),R=Math.max(p.p1.price,p.p2.price),Z=Math.min(p.p1.price,p.p2.price),se=p.p1.normalizedTime<=p.p2.normalizedTime?p.p1.rawTime:p.p2.rawTime,fe=p.p1.normalizedTime<=p.p2.normalizedTime?p.p2.rawTime:p.p1.rawTime;let ve=K,Se=z,Pe=R,We=Z,Re=se,at=fe;if((J.current==="handle1"||J.current==="handle4"||J.current==="handle6")&&(ve=O,Re=I),(J.current==="handle3"||J.current==="handle5"||J.current==="handle8")&&(Se=O,at=I),(J.current==="handle1"||J.current==="handle2"||J.current==="handle3")&&(Pe=U),(J.current==="handle6"||J.current==="handle7"||J.current==="handle8")&&(We=U),ve>Se){const it=ve,gt=Re;ve=Se,Re=at,Se=it,at=gt}if(Pe<We){const it=Pe;Pe=We,We=it}L({rawTime:Re,normalizedTime:ve,price:Pe},{rawTime:at,normalizedTime:Se,price:We});return}if(u.type==="circle"&&u.p1&&u.p2){const L=(Pe,We)=>{const Re=u.primitive;if(Re){Re.p1={rawTime:Pe.rawTime,price:Pe.price},Re.p2={rawTime:We.rawTime,price:We.price};try{a.current?.applyOptions({})}catch{}}const at={...u,p1:Pe,p2:We};be(it=>{const gt=it.map(Et=>Et===u?at:Et);return m.current=gt,gt}),S(at),pe.current=at},p=b.timeScale().coordinateToTime(x);if(p==null)return;const I=q(p);if(I==null)return;if(J.current==="handle2"){L(u.p1,{rawTime:p,normalizedTime:I,price:U});return}const O=ie.current;if(!O)return;const K=b.timeScale().coordinateToTime(O.x),z=w.coordinateToPrice(O.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=I-R,se=U-z,fe=q(O.p1.normalizedTime+Z),ve=q(O.p2.normalizedTime+Z);if(fe==null||ve==null)return;const Se=H-K;L({rawTime:O.p1.rawTime+Se,normalizedTime:fe,price:O.p1.price+se},{rawTime:O.p2.rawTime+Se,normalizedTime:ve,price:O.p2.price+se});return}if(u.type==="triangle"&&u.p1&&u.p2&&u.p3){const L=(Re,at,it)=>{const gt=u.primitive;if(gt){gt.p1={rawTime:Re.rawTime,price:Re.price},gt.p2={rawTime:at.rawTime,price:at.price},gt.p3={rawTime:it.rawTime,price:it.price};try{a.current?.applyOptions({})}catch{}}const Et={...u,p1:Re,p2:at,p3:it};be(jt=>{const Kt=jt.map($t=>$t===u?Et:$t);return m.current=Kt,Kt}),S(Et),pe.current=Et},p=b.timeScale().coordinateToTime(x);if(p==null)return;const I=q(p);if(I==null)return;if(J.current==="handle1"){L({rawTime:p,normalizedTime:I,price:U},u.p2,u.p3);return}if(J.current==="handle2"){L(u.p1,{rawTime:p,normalizedTime:I,price:U},u.p3);return}if(J.current==="handle3"){L(u.p1,u.p2,{rawTime:p,normalizedTime:I,price:U});return}const O=ie.current;if(!O)return;const K=b.timeScale().coordinateToTime(O.x),z=w.coordinateToPrice(O.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=I-R,se=U-z,fe=H-K,ve=Re=>{const at=Re.normalizedTime??q(Re.rawTime);if(at==null)return null;const it=q(at+Z);return it==null?null:{rawTime:Re.rawTime+fe,normalizedTime:it,price:Re.price+se}},Se=ve(O.p1),Pe=ve(O.p2),We=ve(O.p3);if(!Se||!Pe||!We)return;L(Se,Pe,We);return}if(u.type==="ellipse"&&u.p1&&u.p2){const L=(K,z,R=u.minorRatio??.45)=>{const Z=u.primitive;if(Z){Z.p1={rawTime:K.rawTime,price:K.price},Z.p2={rawTime:z.rawTime,price:z.price},Z.minorRatio=Math.max(.05,R);try{a.current?.applyOptions({})}catch{}}const se={...u,p1:K,p2:z,minorRatio:Math.max(.05,R)};be(fe=>{const ve=fe.map(Se=>Se===u?se:Se);return m.current=ve,ve}),S(se),pe.current=se},p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(x);if(I==null)return;const O=q(I);if(O==null)return;if(J.current==="line"){const K=b.timeScale().coordinateToTime(p.x),z=w.coordinateToPrice(p.y);if(K==null||z==null)return;const R=q(K);if(R==null)return;const Z=O-R,se=U-z,fe=q(p.p1.normalizedTime+Z),ve=q(p.p2.normalizedTime+Z);if(fe==null||ve==null)return;const Se=H-K;L({rawTime:p.p1.rawTime+Se,normalizedTime:fe,price:p.p1.price+se},{rawTime:p.p2.rawTime+Se,normalizedTime:ve,price:p.p2.price+se},p.minorRatio??u.minorRatio??.45);return}if(J.current==="handle1"){L({rawTime:I,normalizedTime:O,price:U},u.p2,u.minorRatio??.45);return}if(J.current==="handle3"){L(u.p1,{rawTime:I,normalizedTime:O,price:U},u.minorRatio??.45);return}if(J.current==="handle2"||J.current==="handle4"){const K=b.timeScale().timeToCoordinate(u.p1.rawTime),z=w.priceToCoordinate(u.p1.price),R=b.timeScale().timeToCoordinate(u.p2.rawTime),Z=w.priceToCoordinate(u.p2.price);if(K==null||z==null||R==null||Z==null)return;const se=(K+R)/2,fe=(z+Z)/2,ve=R-K,Se=Z-z,Pe=Math.hypot(ve,Se);if(Pe<.001)return;const We=-Se/Pe,Re=ve/Pe,at=Math.abs((x-se)*We+(f-fe)*Re),it=Math.max(.05,at*2/Pe);L(u.p1,u.p2,it);return}return}if(u.type==="gannfan"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="ganngrid"&&u.p1&&u.p2){const L=(p,I)=>{const O=u.primitive;if(O){O.p1={rawTime:p.rawTime,price:p.price},O.p2={rawTime:I.rawTime,price:I.price};try{a.current?.applyOptions({})}catch{}}const K={...u,p1:p,p2:I};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K};if(J.current==="handle1"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L({rawTime:p,normalizedTime:k,price:U},u.p2)}else if(J.current==="handle2"){const p=b.timeScale().coordinateToTime(x);if(p==null)return;L(u.p1,{rawTime:p,normalizedTime:k,price:U})}else if(J.current==="line"){const p=ie.current;if(!p)return;const I=b.timeScale().coordinateToTime(p.x),O=w.coordinateToPrice(p.y);if(I==null||O==null)return;const K=k-q(I),z=U-O,R=q(p.p1.normalizedTime+K),Z=q(p.p2.normalizedTime+K);if(R==null||Z==null)return;const se=H-I;L({rawTime:p.p1.rawTime+se,normalizedTime:R,price:p.p1.price+z},{rawTime:p.p2.rawTime+se,normalizedTime:Z,price:p.p2.price+z})}return}if(u.type==="verticalline"&&u.primitive){const L=u.primitive;L.time=H;const p={...u,time:q(H),rawTime:H};be(I=>{const O=I.map(K=>K===u?p:K);return m.current=O,O}),S(p),pe.current=p,a.current?.applyOptions({});return}if(u.type==="horizontalray"&&u.primitive){const L=u.primitive,p=ie.current;if(!p)return;if(J.current==="handle1"){L.price=U,L.originTime=H;const I={...u,price:L.price,originTime:L.originTime,rawOriginTime:H};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I,a.current?.applyOptions({})}else if(J.current==="line"){const I=w.coordinateToPrice(p.y);if(I==null)return;const O=U-I;L.price=p.price+O;const K={...u,price:L.price};be(z=>{const R=z.map(Z=>Z===u?K:Z);return m.current=R,R}),S(K),pe.current=K,a.current?.applyOptions({})}return}if(!(u.type!=="trendline"&&u.type!=="gannline")&&!(!u.point1||!u.point2)){if(J.current==="handle1"){const L={time:k,price:U},p=MA([{time:L.time,value:L.price},{time:u.point2.time,value:u.point2.price}]);p.length>0&&u.series.setData(p);const I={...u,point1:L};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I}else if(J.current==="handle2"){const L={time:k,price:U},p=MA([{time:u.point1.time,value:u.point1.price},{time:L.time,value:L.price}]);p.length>0&&u.series.setData(p);const I={...u,point2:L};be(O=>{const K=O.map(z=>z===u?I:z);return m.current=K,K}),S(I),pe.current=I}else if(J.current==="line"){const L=ie.current;if(!L)return;const p=b.timeScale().coordinateToTime(L.x),I=w.coordinateToPrice(L.y);if(p==null||I==null)return;const O=k-p,K=U-I,z={time:q(L.point1.time+O),price:L.point1.price+K},R={time:q(L.point2.time+O),price:L.point2.price+K},Z=MA([{time:z.time,value:z.price},{time:R.time,value:R.price}]);Z.length>0&&u.series.setData(Z);const se={...u,point1:z,point2:R};be(fe=>{const ve=fe.map(Se=>Se===u?se:Se);return m.current=ve,ve}),S(se),pe.current=se}}}},P=()=>{J.current=null,ie.current=null},Ae=()=>{J.current||pe.current||(ce(null),de([]))},te={capture:!0,passive:!1};return G.addEventListener("mousedown",le,te),G.addEventListener("mousemove",_,te),G.addEventListener("mouseup",P,te),G.addEventListener("mouseleave",Ae,te),()=>{G.removeEventListener("mousedown",le,te),G.removeEventListener("mousemove",_,te),G.removeEventListener("mouseup",P,te),G.removeEventListener("mouseleave",Ae,te)}},[we,he,Ye,be]),Y.useEffect(()=>{const b=a.current,w=c.current;if(!b||!w)return;const G=()=>{const Q=N;if(!Q){V([]);return}const F=b.timeScale();if(Q.type==="infoline"&&Q.p1&&Q.p2){const ee=Q.p1.rawTime??Q.p1.time,M=Q.p2.rawTime??Q.p2.time,le=F.timeToCoordinate(ee),_=w.priceToCoordinate(Q.p1.price),P=F.timeToCoordinate(M),Ae=w.priceToCoordinate(Q.p2.price);le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="rulerline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:(ee+le)/2,y:(M+_)/2},{x:le,y:_}]):V([]);return}if(Q.type==="arrowedline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="rayline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="extendedline"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="crossline"&&Q.p){const ee=F.timeToCoordinate(Q.p.rawTime),M=w.priceToCoordinate(Q.p.price);ee!=null&&M!=null?V([{x:ee,y:M}]):V([]);return}if(Q.type==="text"&&Q.rawTime!=null&&Q.price!=null){const ee=F.timeToCoordinate(Q.rawTime),M=w.priceToCoordinate(Q.price);ee!=null&&M!=null?V([{x:ee,y:M}]):V([]);return}if(Q.type==="trendbyangle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="equidistantchannel"&&Q.p1&&Q.p2&&Q.b1&&Q.b2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.b1.rawTime),Ae=w.priceToCoordinate(Q.b1.price),te=F.timeToCoordinate(Q.b2.rawTime),g=w.priceToCoordinate(Q.b2.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:(P+te)/2,y:(Ae+g)/2}]):V([]);return}if(Q.type==="regressionchannel"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="stddevchannel"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="andrewspitchfork"&&Q.p1&&Q.p2&&Q.p3){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="disjointchannel"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price),te=F.timeToCoordinate(Q.p4.rawTime),g=w.priceToCoordinate(Q.p4.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae},{x:te,y:g}]):V([]);return}if(Q.type==="flattopbottom"&&Q.p1&&Q.p2&&Q.p3&&Q.p4){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price),te=F.timeToCoordinate(Q.p4.rawTime),g=w.priceToCoordinate(Q.p4.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null&&te!=null&&g!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae},{x:te,y:g}]):V([]);return}if(Q.type==="fibonacci"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="trendline"&&Q.point1&&Q.point2){const ee=F.timeToCoordinate(Q.point1.time),M=w.priceToCoordinate(Q.point1.price),le=F.timeToCoordinate(Q.point2.time),_=w.priceToCoordinate(Q.point2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="gannline"&&Q.point1&&Q.point2){const ee=F.timeToCoordinate(Q.point1.time),M=w.priceToCoordinate(Q.point1.price),le=F.timeToCoordinate(Q.point2.time),_=w.priceToCoordinate(Q.point2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:(ee+le)/2,y:(M+_)/2},{x:le,y:_}]):V([]);return}if(Q.type==="rectangle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);if(ee!=null&&M!=null&&le!=null&&_!=null){const P=Math.min(ee,le),Ae=Math.max(ee,le),te=Math.min(M,_),g=Math.max(M,_),C=(P+Ae)/2,x=(te+g)/2;V([{x:P,y:te},{x:C,y:te},{x:Ae,y:te},{x:P,y:x},{x:Ae,y:x},{x:P,y:g},{x:C,y:g},{x:Ae,y:g}])}else V([]);return}if(Q.type==="circle"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="triangle"&&Q.p1&&Q.p2&&Q.p3){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price),P=F.timeToCoordinate(Q.p3.rawTime),Ae=w.priceToCoordinate(Q.p3.price);ee!=null&&M!=null&&le!=null&&_!=null&&P!=null&&Ae!=null?V([{x:ee,y:M},{x:le,y:_},{x:P,y:Ae}]):V([]);return}if(Q.type==="ellipse"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);if(ee!=null&&M!=null&&le!=null&&_!=null){const P=(ee+le)/2,Ae=(M+_)/2,te=le-ee,g=_-M,C=Math.hypot(te,g);if(C<.001){V([]);return}const x=te/C,f=g/C,u=-f,H=x,U=C/2,k=U*Math.max(.05,Q.minorRatio??.45);V([{x:P-x*U,y:Ae-f*U},{x:P+u*k,y:Ae+H*k},{x:P+x*U,y:Ae+f*U},{x:P-u*k,y:Ae-H*k}])}else V([]);return}if(Q.type==="gannfan"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="ganngrid"&&Q.p1&&Q.p2){const ee=F.timeToCoordinate(Q.p1.rawTime),M=w.priceToCoordinate(Q.p1.price),le=F.timeToCoordinate(Q.p2.rawTime),_=w.priceToCoordinate(Q.p2.price);ee!=null&&M!=null&&le!=null&&_!=null?V([{x:ee,y:M},{x:le,y:_}]):V([]);return}if(Q.type==="horizontalray"&&Q.primitive){const ee=Q.primitive,M=F.timeToCoordinate(ee.originTime),le=w.priceToCoordinate(ee.price);M!=null&&le!=null?V([{x:M,y:le}]):V([]);return}if(Q.type==="verticalline"&&Q.primitive){const ee=Q.primitive,M=F.timeToCoordinate(ee.time);if(M!=null){const le=ee.midYCss??200;V([{x:M,y:le}])}else V([]);return}V([])};G();const Be=b.timeScale();return Be.subscribeVisibleTimeRangeChange(G),()=>{Be.unsubscribeVisibleTimeRangeChange(G)}},[N]),Y.useEffect(()=>{!a.current||!c.current||m.current.forEach(b=>{if(b.series&&b.series.applyOptions({visible:Ne}),b.priceLine&&b.priceLine.applyOptions(Ne?{color:"#3b82f6",axisLabelVisible:!0,title:typeof b.price=="number"?b.price.toFixed(5):""}:{color:"rgba(0,0,0,0)",axisLabelVisible:!1,title:""}),b.type==="fibonacci"&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}if(b.type==="rectangle"&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}if(b.type==="parallellines"&&(b.baseLine&&b.baseLine.applyOptions({visible:Ne}),b.parallelLine&&b.parallelLine.applyOptions({visible:Ne}),b.firstLine&&b.firstLine.applyOptions({visible:Ne}),b.secondLine&&b.secondLine.applyOptions({visible:Ne})),(b.type==="horizontalray"||b.type==="verticalline"||b.type==="infoline"||b.type==="rulerline"||b.type==="arrowedline"||b.type==="rayline"||b.type==="extendedline"||b.type==="crossline"||b.type==="trendbyangle"||b.type==="equidistantchannel"||b.type==="regressionchannel"||b.type==="stddevchannel"||b.type==="gannfan"||b.type==="ganngrid"||b.type==="andrewspitchfork"||b.type==="disjointchannel"||b.type==="flattopbottom"||b.type==="circle"||b.type==="triangle"||b.type==="ellipse"||b.type==="text")&&b.primitive){b.primitive.visible=Ne;try{a.current?.applyOptions({})}catch{}}})},[Ne,Ye]),Y.useEffect(()=>{!Ne&&N&&(S(null),V([]))},[Ne,N]),Y.useEffect(()=>{if(m.current.length>Ye.length){const b=m.current.filter((w,G)=>!Ye.includes(w));N&&b.some(w=>w===N)&&(S(null),V([])),b.forEach(w=>{if(w.series&&a.current?.removeSeries(w.series),w.priceLine&&c.current?.removePriceLine(w.priceLine),w.type==="horizontalray"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="verticalline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="infoline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rulerline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="arrowedline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rayline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="extendedline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="crossline"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="trendbyangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="equidistantchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="regressionchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="stddevchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="gannfan"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="ganngrid"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="andrewspitchfork"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="disjointchannel"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="flattopbottom"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="fibonacci"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="rectangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="circle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="triangle"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="ellipse"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="text"&&w.primitive)try{c.current?.detachPrimitive(w.primitive)}catch{}if(w.type==="parallellines")try{w.baseLine&&a.current?.removeSeries(w.baseLine),w.parallelLine&&a.current?.removeSeries(w.parallelLine),w.firstLine&&a.current?.removeSeries(w.firstLine),w.secondLine&&a.current?.removeSeries(w.secondLine)}catch{}}),m.current=Ye}},[Ye,N]),Y.useEffect(()=>{const b=c.current;return b?(Ke.current.forEach(G=>{try{b.removePriceLine(G)}catch{}}),Ke.current=[],bt.filter(G=>G.symbol===Ge).forEach(G=>{const Be=parseFloat(G.price);if(isNaN(Be))return;const F=G.type==="BUY"?"#26A69A":"#EF5350",ee=b.createPriceLine({price:Be,color:F,lineWidth:2,lineStyle:0,axisLabelVisible:!0,title:`${G.type} ${G.volume} @ ${G.price}`,textColor:F});Ke.current.push(ee)}),()=>{Ke.current.forEach(G=>{try{b.removePriceLine(G)}catch{}}),Ke.current=[]}):void 0},[bt,Ge]),Y.useEffect(()=>{const b=o.current;if(!b)return;const w=G=>{if(T.current||!a.current)return;const Be=a.current,Q=c.current;if(Be&&Q&&m.current.length>0){const F=b.getBoundingClientRect(),ee=G.clientX-F.left,M=G.clientY-F.top,le=15;for(let _=m.current.length-1;_>=0;_--){const P=m.current[_];let Ae=!1;if(P.type==="text"&&P.rawTime!=null&&P.price!=null){const te=Be.timeScale().timeToCoordinate(P.rawTime),g=Q.priceToCoordinate(P.price);if(te!=null&&g!=null){const C=Ud(P,te,g);ee>=C.left&&ee<=C.right&&M>=C.top&&M<=C.bottom&&(Ae=!0)}}else if(P.point1&&P.point2){const te=Be.timeScale().timeToCoordinate(P.point1.time??P.point1.rawTime),g=Q.priceToCoordinate(P.point1.price),C=Be.timeScale().timeToCoordinate(P.point2.time??P.point2.rawTime),x=Q.priceToCoordinate(P.point2.price);if(te!=null&&g!=null&&C!=null&&x!=null){const f=Math.hypot(ee-te,M-g),u=Math.hypot(ee-C,M-x),H=(te+C)/2,U=(g+x)/2,k=Math.hypot(ee-H,M-U);(f<le||u<le||k<le)&&(Ae=!0)}}else if(P.p1&&P.p2){const te=Be.timeScale().timeToCoordinate(P.p1.rawTime),g=Q.priceToCoordinate(P.p1.price),C=Be.timeScale().timeToCoordinate(P.p2.rawTime),x=Q.priceToCoordinate(P.p2.price);if(te!=null&&g!=null&&C!=null&&x!=null){const f=Math.min(te,C),u=Math.max(te,C),H=Math.min(g,x),U=Math.max(g,x);ee>=f-5&&ee<=u+5&&M>=H-5&&M<=U+5&&(Ae=!0)}}else if(P.p){const te=Be.timeScale().timeToCoordinate(P.p.rawTime),g=Q.priceToCoordinate(P.p.price);te!=null&&g!=null&&Math.hypot(ee-te,M-g)<le&&(Ae=!0)}if(Ae){G.preventDefault(),G.stopPropagation(),typeof G.stopImmediatePropagation=="function"&&G.stopImmediatePropagation(),$(P);return}}}G.preventDefault(),G.stopPropagation(),typeof G.stopImmediatePropagation=="function"&&G.stopImmediatePropagation(),setTimeout(()=>{if(!a.current)return;Iy(a.current,he,Oe)||a.current.timeScale().fitContent();const ee=a.current.timeScale().getVisibleRange();Fe(ee)},80)};return b.addEventListener("dblclick",w,!0),()=>{b.removeEventListener("dblclick",w,!0)}},[he,Oe]);const Kd=N??X,Pd=N?j:ae,rb=Ne&&Uy(Kd,Pd),ib=Ey(Kd?.type);return l.jsx("div",{className:`flex min-w-0 flex-1 flex-col overflow-hidden ${_e==="light"?"bg-white":"bg-[#12161d]"}`,children:l.jsxs("div",{ref:o,className:"relative h-full w-full flex-1",style:{cursor:we===1||we!==null?"crosshair":"default",minHeight:0,minWidth:0},children:[(()=>{const b=typeof Ge=="object"?Ge?.symbol:Ge,w=ht&&(ht.toLowerCase().includes("network")||ht.toLowerCase().includes("failed to fetch")),G=Me?"loading":w?"reconnecting":ht||he.length===0?"noData":"idle",Be=()=>{Ct(null),Ha(Q=>Q+1)};return l.jsx(iy,{state:G,symbol:b,onRetry:G!=="loading"?Be:void 0,theme:_e})})(),A&&l.jsx("div",{className:"absolute top-3 left-3 z-50",children:l.jsx(ph,{bidPrice:e,askPrice:t,onBuyClick:qt,onSellClick:Yt})}),l.jsx(fh,{isOpen:Ie,onClose:tb,orderType:ne,bidPrice:e,askPrice:t}),l.jsx(wh,{isOpen:W!==null,onClose:()=>$(null),chartObject:W,onUpdate:Ab}),Me&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center",style:{backgroundColor:_e==="light"?"#ffffff":"#12161d"},children:l.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-transparent",style:{borderTopColor:_e==="light"?"#64748b":"#475569"}})}),rb&&l.jsx("div",{className:"pointer-events-none absolute inset-0 z-20","aria-hidden":!0,children:Pd.map((b,w)=>l.jsx("div",{className:"absolute h-[10px] w-[10px] rounded-full border-2 border-white shadow",style:{left:b.x-5,top:b.y-5,backgroundColor:ib}},w))})]})})}),ct={container:{position:"relative",display:"inline-block",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},button:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"6px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,cursor:"pointer",minWidth:"120px",justifyContent:"space-between",transition:"all 0.15s ease"},buttonHover:{borderColor:"#3b82f6",backgroundColor:"#1e3a5f"},arrow:{fontSize:"10px",color:"#94a3b8",transition:"transform 0.2s ease"},arrowOpen:{transform:"rotate(180deg)"},dropdown:{position:"absolute",top:"100%",left:0,marginTop:"4px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0,0,0,0.4)",zIndex:1e3,minWidth:"220px",maxHeight:"320px",overflow:"hidden",display:"flex",flexDirection:"column"},searchContainer:{padding:"8px",borderBottom:"1px solid #334155"},searchInput:{width:"100%",padding:"6px 10px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"12px",outline:"none",boxSizing:"border-box"},list:{overflowY:"auto",maxHeight:"260px",padding:"4px 0"},item:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#cbd5e1",transition:"background-color 0.1s ease"},itemSelected:{backgroundColor:"#1e3a5f",color:"#60a5fa"},symbolName:{fontWeight:600},symbolPrice:{fontSize:"11px",color:"#94a3b8"},priceUp:{color:"#26A69A"},priceDown:{color:"#EF5350"},categoryLabel:{padding:"6px 12px 4px",fontSize:"10px",fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:"0.05em"},empty:{padding:"16px",textAlign:"center",color:"#64748b",fontSize:"12px"}};function Md({style:r,className:e}){const{selectedSymbol:t,setSelectedSymbol:A,symbols:i,symbolsLoading:n}=Qt(),[s,o]=Y.useState(!1),[a,c]=Y.useState(""),[h,d]=Y.useState(-1),m=Y.useRef(null),T=Y.useRef(null);Y.useEffect(()=>{const E=N=>{m.current&&!m.current.contains(N.target)&&(o(!1),c(""))};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]),Y.useEffect(()=>{s&&T.current&&T.current.focus()},[s]);const v=i.filter(E=>E.symbol.toLowerCase().includes(a.toLowerCase())),B=v.filter(E=>!E.symbol.endsWith("USDT")),y=v.filter(E=>E.symbol.endsWith("USDT")),D=E=>{A(E),o(!1),c("")};return i.find(E=>E.symbol===t),l.jsxs("div",{ref:m,style:{...ct.container,...r},className:e,children:[l.jsxs("button",{style:ct.button,onClick:()=>o(!s),onMouseEnter:E=>Object.assign(E.currentTarget.style,ct.buttonHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:[l.jsx("span",{children:n?"Loading...":t||"Select Coin"}),l.jsx("span",{style:{...ct.arrow,...s?ct.arrowOpen:{}},children:"▼"})]}),s&&l.jsxs("div",{style:ct.dropdown,children:[l.jsx("div",{style:ct.searchContainer,children:l.jsx("input",{ref:T,style:ct.searchInput,type:"text",placeholder:"Search symbol...",value:a,onChange:E=>c(E.target.value)})}),l.jsx("div",{style:ct.list,children:v.length===0?l.jsx("div",{style:ct.empty,children:"No symbols found"}):l.jsxs(l.Fragment,{children:[B.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{style:ct.categoryLabel,children:"Forex & Metals"}),B.map(E=>l.jsxs("div",{style:{...ct.item,...E.symbol===t?ct.itemSelected:{}},onClick:()=>D(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[l.jsx("span",{style:ct.symbolName,children:E.symbol}),E.bid&&l.jsx("span",{style:{...ct.symbolPrice,...parseFloat(E.change)>=0?ct.priceUp:ct.priceDown},children:parseFloat(E.bid).toFixed(5)})]},E.symbol))]}),y.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{style:ct.categoryLabel,children:"Crypto"}),y.map(E=>l.jsxs("div",{style:{...ct.item,...E.symbol===t?ct.itemSelected:{}},onClick:()=>D(E.symbol),onMouseEnter:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="#334155")},onMouseLeave:N=>{E.symbol!==t&&(N.currentTarget.style.backgroundColor="transparent")},children:[l.jsx("span",{style:ct.symbolName,children:E.symbol}),E.bid&&l.jsx("span",{style:{...ct.symbolPrice,...parseFloat(E.change)>=0?ct.priceUp:ct.priceDown},children:parseFloat(E.bid).toFixed(2)})]},E.symbol))]})]})})]})]})}const bA={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"}},Dy=[.01,.05,.1,.5,1];function Id({value:r,onChange:e,min:t=.01,max:A=100,step:i=.01,presets:n=Dy,showPresets:s=!0,showLabel:o=!0,label:a="Vol",style:c,className:h}){const[d,m]=Y.useState(.1),T=r!==void 0?r:d,v=Y.useCallback(E=>{const N=Math.max(t,Math.min(A,parseFloat(E)||t)),S=Math.round(N/i)*i,W=parseFloat(S.toFixed(8));r!==void 0||m(W),e?.(W)},[t,A,i,r,e]),B=()=>v(T+i),y=()=>v(T-i),D=(T>=1,T.toFixed(2));return l.jsxs("div",{style:{...bA.container,...c},className:h,children:[o&&l.jsx("span",{style:bA.label,children:a}),l.jsx("button",{style:bA.btn,onClick:y,onMouseEnter:E=>Object.assign(E.currentTarget.style,bA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"−"}),l.jsx("input",{style:bA.input,type:"text",value:D,onChange:E=>{const N=E.target.value;if(N===""||N==="."||N==="0.")return;const S=parseFloat(N);isNaN(S)||v(S)},onBlur:()=>v(T)}),l.jsx("button",{style:bA.btn,onClick:B,onMouseEnter:E=>Object.assign(E.currentTarget.style,bA.btnHover),onMouseLeave:E=>{E.currentTarget.style.borderColor="#334155",E.currentTarget.style.backgroundColor="#1e293b"},children:"+"}),s&&n&&n.length>0&&l.jsx("div",{style:bA.presets,children:n.map(E=>l.jsx("button",{style:{...bA.preset,...Math.abs(T-E)<1e-4?bA.presetActive:{}},onClick:()=>v(E),onMouseEnter:N=>{Math.abs(T-E)>=1e-4&&Object.assign(N.currentTarget.style,{borderColor:"#3b82f6"})},onMouseLeave:N=>{Math.abs(T-E)>=1e-4&&(N.currentTarget.style.borderColor="#334155")},children:E},E))})]})}const Gt={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 _d({value:r,onChange:e,enabled:t,onEnabledChange:A,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:c="SL",style:h,className:d}){const{currentSymbolData:m}=Qt(),[T,v]=Y.useState(""),[B,y]=Y.useState(!1),[D,E]=Y.useState("price"),N=r!==void 0?r:T,S=t!==void 0?t:B,W=i!==void 0?i:D,$=Y.useCallback(ae=>{t!==void 0||y(ae),A?.(ae)},[t,A]),j=Y.useCallback(ae=>{i!==void 0||E(ae),n?.(ae)},[i,n]),V=Y.useCallback(ae=>{r!==void 0||v(ae),e?.(ae)},[r,e]),X=ae=>{const de=ae.target.value;if(de===""||de==="."||de==="0."){V(de);return}const J=parseFloat(de);isNaN(J)||V(de)},ce=W==="price"?m?.bid?parseFloat(m.bid).toFixed(5):"0.00000":"50";return l.jsxs("div",{style:{...Gt.container,...h},className:d,children:[a&&l.jsx("span",{style:Gt.label,children:c}),s&&l.jsx("button",{style:{...Gt.toggle,...S?Gt.toggleOn:Gt.toggleOff},onClick:()=>$(!S),children:l.jsx("div",{style:{...Gt.toggleKnob,...S?Gt.knobOn:Gt.knobOff}})}),(S||!s)&&l.jsxs("div",{style:Gt.inputGroup,children:[l.jsx("input",{style:Gt.input,type:"text",value:N,onChange:X,placeholder:ce,onFocus:ae=>ae.currentTarget.style.borderColor="#EF5350",onBlur:ae=>ae.currentTarget.style.borderColor="#334155"}),o&&l.jsxs(l.Fragment,{children:[l.jsx("button",{style:{...Gt.modeBtn,...W==="price"?Gt.modeBtnActive:{}},onClick:()=>j("price"),children:"Price"}),l.jsx("button",{style:{...Gt.modeBtn,...W==="pips"?Gt.modeBtnActive:{}},onClick:()=>j("pips"),children:"Pips"})]})]})]})}const Rt={container:{display:"inline-flex",alignItems:"center",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},label:{fontSize:"11px",fontWeight:700,color:"#26A69A",textTransform:"uppercase",letterSpacing:"0.03em",whiteSpace:"nowrap"},toggle:{position:"relative",width:"32px",height:"18px",borderRadius:"9px",cursor:"pointer",transition:"background-color 0.2s ease",border:"none",padding:0},toggleOff:{backgroundColor:"#334155"},toggleOn:{backgroundColor:"#26A69A"},toggleKnob:{position:"absolute",top:"2px",width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",transition:"left 0.2s ease"},knobOff:{left:"2px"},knobOn:{left:"16px"},inputGroup:{display:"inline-flex",alignItems:"center",gap:"4px"},input:{width:"90px",padding:"4px 8px",backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"4px",color:"#e2e8f0",fontSize:"13px",fontWeight:600,textAlign:"right",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s ease"},modeBtn:{padding:"3px 8px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:"4px",color:"#94a3b8",fontSize:"10px",cursor:"pointer",transition:"all 0.15s ease",whiteSpace:"nowrap"},modeBtnActive:{backgroundColor:"#0d2e2a",borderColor:"#26A69A",color:"#26A69A"}};function Dd({value:r,onChange:e,enabled:t,onEnabledChange:A,mode:i,onModeChange:n,showToggle:s=!0,showModeSwitch:o=!0,showLabel:a=!0,label:c="TP",style:h,className:d}){const{currentSymbolData:m}=Qt(),[T,v]=Y.useState(""),[B,y]=Y.useState(!1),[D,E]=Y.useState("price"),N=r!==void 0?r:T,S=t!==void 0?t:B,W=i!==void 0?i:D,$=Y.useCallback(ae=>{t!==void 0||y(ae),A?.(ae)},[t,A]),j=Y.useCallback(ae=>{i!==void 0||E(ae),n?.(ae)},[i,n]),V=Y.useCallback(ae=>{r!==void 0||v(ae),e?.(ae)},[r,e]),X=ae=>{const de=ae.target.value;if(de===""||de==="."||de==="0."){V(de);return}const J=parseFloat(de);isNaN(J)||V(de)},ce=W==="price"?m?.ask?parseFloat(m.ask).toFixed(5):"0.00000":"50";return l.jsxs("div",{style:{...Rt.container,...h},className:d,children:[a&&l.jsx("span",{style:Rt.label,children:c}),s&&l.jsx("button",{style:{...Rt.toggle,...S?Rt.toggleOn:Rt.toggleOff},onClick:()=>$(!S),children:l.jsx("div",{style:{...Rt.toggleKnob,...S?Rt.knobOn:Rt.knobOff}})}),(S||!s)&&l.jsxs("div",{style:Rt.inputGroup,children:[l.jsx("input",{style:Rt.input,type:"text",value:N,onChange:X,placeholder:ce,onFocus:ae=>ae.currentTarget.style.borderColor="#26A69A",onBlur:ae=>ae.currentTarget.style.borderColor="#334155"}),o&&l.jsxs(l.Fragment,{children:[l.jsx("button",{style:{...Rt.modeBtn,...W==="price"?Rt.modeBtnActive:{}},onClick:()=>j("price"),children:"Price"}),l.jsx("button",{style:{...Rt.modeBtn,...W==="pips"?Rt.modeBtnActive:{}},onClick:()=>j("pips"),children:"Pips"})]})]})]})}const ky=[{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:"─"}],TA={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 kd({showLabel:r=!0,showDelete:e=!0,showVisibility:t=!0,tools:A,label:i="Draw",style:n,className:s}){const{activeTool:o,setActiveTool:a,drawingsVisible:c,setDrawingsVisible:h,chartObjects:d,setChartObjects:m}=Qt(),[T,v]=Y.useState(null),B=A||ky,y=N=>{a(o===N?null:N)},D=()=>{m([]),a(null)},E=()=>{h(!c)};return l.jsxs("div",{style:{...TA.container,...n},className:s,children:[r&&l.jsx("span",{style:TA.label,children:i}),B.map(N=>l.jsxs("button",{style:{...TA.btn,...o===N.id?TA.btnActive:{}},onClick:()=>y(N.id),onMouseEnter:S=>{v(N.id),o!==N.id&&Object.assign(S.currentTarget.style,TA.btnHover)},onMouseLeave:S=>{v(null),o!==N.id&&(S.currentTarget.style.borderColor="#334155",S.currentTarget.style.backgroundColor="#1e293b",S.currentTarget.style.color="#94a3b8")},title:N.name,children:[N.icon,T===N.id&&l.jsx("div",{style:TA.tooltip,children:N.name})]},N.id)),(e||t)&&l.jsx("div",{style:TA.divider}),t&&l.jsx("button",{style:{...TA.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&&l.jsx("button",{style:TA.deleteBtn,onClick:D,onMouseEnter:N=>Object.assign(N.currentTarget.style,TA.deleteBtnHover),onMouseLeave:N=>{N.currentTarget.style.borderColor="#334155",N.currentTarget.style.backgroundColor="#1e293b",N.currentTarget.style.color="#94a3b8"},title:"Delete All Drawings",children:"🗑"})]})}const Od={toolbar:{display:"flex",alignItems:"center",gap:"12px",padding:"6px 12px",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",flexWrap:"wrap",minHeight:"42px"},divider:{width:"1px",height:"24px",backgroundColor:"#1e293b",flexShrink:0}};function Oy({showCoinSelector:r=!0,showVolumeControl:e=!0,showStopLoss:t=!0,showTakeProfit:A=!0,showDrawingTools:i=!0,showDividers:n=!0,volume:s,onVolumeChange:o,stopLoss:a,onStopLossChange:c,stopLossEnabled:h,onStopLossEnabledChange:d,takeProfit:m,onTakeProfitChange:T,takeProfitEnabled:v,onTakeProfitEnabledChange:B,coinSelectorProps:y={},volumeControlProps:D={},stopLossProps:E={},takeProfitProps:N={},drawingToolsProps:S={},style:W,className:$}){const j=[];r&&j.push(l.jsx(Md,{...y},"coin")),e&&j.push(l.jsx(Id,{value:s,onChange:o,...D},"volume")),t&&j.push(l.jsx(_d,{value:a,onChange:c,enabled:h,onEnabledChange:d,...E},"sl")),A&&j.push(l.jsx(Dd,{value:m,onChange:T,enabled:v,onEnabledChange:B,...N},"tp")),i&&j.push(l.jsx(kd,{...S},"draw"));const V=[];return j.forEach((X,ce)=>{V.push(X),n&&ce<j.length-1&&V.push(l.jsx("div",{style:Od.divider},`div-${ce}`))}),l.jsx("div",{style:{...Od.toolbar,...W},className:$,children:V})}const Ny=[{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"}],Ea={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 Ky({style:r,className:e}){const{selectedTimeframe:t,setSelectedTimeframe:A}=Qt();return l.jsx("div",{style:{...Ea.container,...r},className:e,children:Ny.map(i=>l.jsx("button",{style:{...Ea.btn,...t===i.value?Ea.btnActive:{}},onClick:()=>A(i.value),onMouseEnter:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#334155")},children:i.label},i.value))})}const Py=[{label:"Candles",value:"candles",icon:"📊"},{label:"Line",value:"line",icon:"📈"},{label:"Area",value:"area",icon:"▤"},{label:"Bars",value:"bars",icon:"▥"}],Sa={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 Vy({style:r,className:e}){const{chartType:t,setChartType:A}=Qt();return l.jsx("div",{style:{...Sa.container,...r},className:e,children:Py.map(i=>l.jsxs("button",{style:{...Sa.btn,...t===i.value?Sa.btnActive:{}},onClick:()=>A(i.value),onMouseEnter:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#3b82f6")},onMouseLeave:n=>{t!==i.value&&(n.currentTarget.style.borderColor="#334155")},title:i.label,children:[l.jsx("span",{children:i.icon}),l.jsx("span",{children:i.label})]},i.value))})}const Ot={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 zy({volume:r=.1,stopLoss:e,takeProfit:t,onTradeExecuted:A,style:i,className:n}){const{selectedSymbol:s,currentSymbolData:o,setOrders:a,setUserBalance:c}=Qt(),[h,d]=Y.useState(null),m=parseFloat(o?.bid||0),T=parseFloat(o?.ask||0),v=T>0&&m>0?Math.abs(T-m):0,B=E=>!E||E===0?"-.-----":E>=1e3?E.toFixed(2):E>=1?E.toFixed(4):E.toFixed(5),y=E=>E===0?"-":E>=1?E.toFixed(1):E>=.01?E.toFixed(3):(E*1e4).toFixed(1)+"p",D=Y.useCallback(E=>{if(!s)return;const N=E==="BUY"?T:m;if(!N||N<=0){d({type:"error",message:"No price available"});return}const S={id:Date.now().toString(),ticket:Math.floor(Math.random()*9e5)+1e5,symbol:s,type:E,volume:r,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()};a($=>[...$,S]);const W=r*N*.01;c($=>$-W),d({type:"success",message:`${E} executed`}),A?.(S),setTimeout(()=>d(null),3e3)},[s,T,m,r,e,t,a,c,A]);return l.jsxs("div",{style:{...Ot.container,...i},className:n,children:[l.jsx("button",{style:Ot.sellBtn,onClick:()=>D("SELL"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Ot.sellBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d",E.currentTarget.style.borderColor="#991b1b"},children:"Sell"}),l.jsxs("div",{style:Ot.priceBox,children:[l.jsx("span",{style:Ot.priceLabel,children:"Bid"}),l.jsx("span",{style:{...Ot.priceValue,color:"#EF5350"},children:B(m)})]}),l.jsxs("div",{style:Ot.spread,children:[l.jsx("span",{style:Ot.spreadLabel,children:"Spread"}),l.jsx("span",{style:Ot.spreadValue,children:y(v)})]}),l.jsxs("div",{style:Ot.priceBox,children:[l.jsx("span",{style:Ot.priceLabel,children:"Ask"}),l.jsx("span",{style:{...Ot.priceValue,color:"#26A69A"},children:B(T)})]}),l.jsx("button",{style:Ot.buyBtn,onClick:()=>D("BUY"),onMouseEnter:E=>{Object.assign(E.currentTarget.style,Ot.buyBtnHover)},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#14532d",E.currentTarget.style.borderColor="#166534"},children:"Buy"}),h&&l.jsx("span",{style:{...Ot.status,backgroundColor:h.type==="success"?"#14532d":"#7f1d1d",color:h.type==="success"?"#86efac":"#fca5a5",border:`1px solid ${h.type==="success"?"#166534":"#991b1b"}`},children:h.message})]})}const Xe={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 Wy({style:r,className:e,maxHeight:t=200}){const{orders:A,setOrders:i,symbols:n,accountSummary:s,setUserBalance:o}=Qt(),[a,c]=Y.useState(null),h=A.filter(B=>B.status==="OPEN"||!B.closeAt),d=Y.useCallback((B,y)=>{const D=n.find(E=>E.symbol===B);return D?parseFloat(y==="BUY"?D.bid||0:D.ask||0):0},[n]),m=Y.useCallback(B=>{if(a)return;c(B.id);const y=d(B.symbol,B.type),E=(B.type==="BUY"?y-B.price:B.price-y)*B.volume,N=B.volume*B.price*.01;i(S=>S.filter(W=>W.id!==B.id)),o(S=>S+N+E),c(null)},[a,d,i,o]),T=B=>{const y=parseFloat(B);return!y||isNaN(y)?"-":y>=1e3?y.toFixed(2):y>=1?y.toFixed(4):y.toFixed(5)},v=B=>{const y=parseFloat(B);return isNaN(y)?"-":(y>=0?"+":"")+y.toFixed(2)};return l.jsxs("div",{style:{...Xe.container,...r},className:e,children:[l.jsxs("div",{style:Xe.header,children:[l.jsxs("span",{style:Xe.headerTitle,children:["Positions (",h.length,")"]}),l.jsxs("div",{style:Xe.summary,children:[l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Balance:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:"#e2e8f0"},children:["$",s?.balance?.toFixed(2)||"0.00"]})]}),l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Equity:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:(s?.equity||0)>=(s?.balance||0)?"#26A69A":"#EF5350"},children:["$",s?.equity?.toFixed(2)||"0.00"]})]}),l.jsxs("div",{style:Xe.summaryItem,children:[l.jsx("span",{style:Xe.summaryLabel,children:"Free:"}),l.jsxs("span",{style:{...Xe.summaryValue,color:"#94a3b8"},children:["$",s?.freeMargin?.toFixed(2)||"0.00"]})]})]})]}),l.jsx("div",{style:{...Xe.scrollArea,maxHeight:t},children:l.jsxs("table",{style:Xe.table,children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Xe.th,children:"Symbol"}),l.jsx("th",{style:Xe.th,children:"Type"}),l.jsx("th",{style:Xe.th,children:"Volume"}),l.jsx("th",{style:Xe.th,children:"Open Price"}),l.jsx("th",{style:Xe.th,children:"Current"}),l.jsx("th",{style:Xe.th,children:"SL"}),l.jsx("th",{style:Xe.th,children:"TP"}),l.jsx("th",{style:Xe.th,children:"Profit"}),l.jsx("th",{style:Xe.th,children:"Action"})]})}),l.jsx("tbody",{children:h.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:9,style:Xe.emptyRow,children:"No open positions"})}):h.map(B=>{const y=d(B.symbol,B.type),D=B.profit||0;return l.jsxs("tr",{children:[l.jsx("td",{style:{...Xe.td,fontWeight:700,color:"#e2e8f0"},children:B.symbol}),l.jsx("td",{style:{...Xe.td,...B.type==="BUY"?Xe.typeBuy:Xe.typeSell},children:B.type}),l.jsx("td",{style:Xe.td,children:B.volume}),l.jsx("td",{style:Xe.td,children:T(B.price)}),l.jsx("td",{style:Xe.td,children:T(y)}),l.jsx("td",{style:Xe.td,children:B.stopLoss?T(B.stopLoss):"-"}),l.jsx("td",{style:Xe.td,children:B.takeProfit?T(B.takeProfit):"-"}),l.jsx("td",{style:{...Xe.td,color:D>=0?"#26A69A":"#EF5350",fontWeight:700},children:v(D)}),l.jsx("td",{style:Xe.td,children:l.jsx("button",{style:{...Xe.closeBtn,...a===B.id?{opacity:.5,cursor:"not-allowed"}:{}},onClick:()=>m(B),disabled:a===B.id,onMouseEnter:E=>{a!==B.id&&(E.currentTarget.style.backgroundColor="#991b1b")},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#7f1d1d"},children:a===B.id?"...":"Close"})})]},B.id)})})]})})]})}function Gy(r){return Dt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"},child:[]}]})(r)}function Ry(r){return Dt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M19 13H5v-2h14v2z"},child:[]}]})(r)}function $y(r){return Dt({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:[]}]})(r)}function Xy(r){return Dt({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:[]}]})(r)}const Zy=({selectedSymbol:r,selectedTimeframe:e,onTimeframeChange:t,chartType:A="candles",onChartTypeChange:i,onNewOrder:n,onZoomIn:s,onZoomOut:o,onToggleBuySell:a,onDownloadChartPNG:c,onToggleFullscreen:h,marketWatchOpen:d=!0,onToggleMarketWatch:m,buySellPanelOpen:T,onMove:v})=>{const{theme:B}=Qt(),y=B==="light",D=["M1","M5","M15","M30","H1","H4","D1","W1","MN"],E={bars:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",fill:"currentColor"})}),area:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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"}),l.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:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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":l.jsxs("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.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 l.jsxs("div",{className:`flex items-center justify-between px-4 py-1 border-b ${y?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("div",{className:`flex items-center gap-1 border-r pr-3 ${y?"border-slate-200":"border-slate-700"}`,children:["bars","candles","line","area"].map(N=>l.jsx("button",{onClick:()=>i(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
13
13
|
${A===N?y?"text-sky-600":"text-sky-400":y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}
|
|
14
14
|
`,title:N,children:E[N]},N))}),l.jsx("div",{className:`flex items-center gap-1 border-r ${y?"border-slate-200":"border-slate-700"} pr-1`,children:["volume ticks","volume"].map(N=>l.jsx("button",{onClick:()=>i(N),className:`px-1 py-1.5 text-[11px] font-medium rounded transition-colors capitalize flex items-center gap-1.5
|
|
15
15
|
${A===N?y?"text-sky-600":"text-sky-400":y?"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))}),l.jsxs("div",{className:"flex items-center gap-2",children:[D.map(N=>l.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?y?"text-sky-600":"text-sky-400":y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),l.jsx("div",{className:`border-r h-6 mx-1 ${y?"border-slate-200":"border-slate-700"}`}),l.jsx("button",{onClick:()=>a?.(),title:x?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${x?y?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":y?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.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"}),l.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"}),l.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"})]})})}),l.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 ${y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[l.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.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"}),l.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"}),l.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),l.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:s,className:`p-1 ${y?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:l.jsx(zy,{className:"w-5 h-5"})}),l.jsx("button",{onClick:o,className:`p-2 ${y?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:l.jsx(Wy,{className:"w-5 h-5"})}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsx("button",{onClick:v,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:l.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"})})}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsx("button",{type:"button",onClick:()=>m?.(),title:d?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${d?y?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":y?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[l.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),l.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"})]})})]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${y?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:l.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"})})}),l.jsx("button",{type:"button",onClick:()=>h?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${y?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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"})})})]})]})},bi=[{label:"Trendline",toolId:2,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),l.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[l.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),l.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),l.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),l.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),l.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),l.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),l.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Ti=[{label:"Regression Channel",toolId:40,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],xi=[{label:"Gann Line",toolId:43,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],Qi=[{label:"Rectangle",toolId:5,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.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"}),l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],cs=({children:r,top:e,panelRef:t,isLight:A})=>l.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:l.jsx("div",{className:"py-1",children:r})}),Ry=({AccountId:r,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:i,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:a,chartObjects:c,setChartObjects:h,drawingsVisible:d,setDrawingsVisible:m,chartLocked:x,setChartLocked:v,theme:B,setTheme:y,setIsShow:D}=Qt(),[E,N]=Y.useState(!1),[S,W]=Y.useState(null),[$,j]=Y.useState(null),[V,X]=Y.useState(0),[ce,ae]=Y.useState(!1),[de,J]=Y.useState(0),[ie,pe]=Y.useState(!1),[Be,Ue]=Y.useState(0),[xe,Le]=Y.useState(!1),[Me,Fe]=Y.useState(0),[we,ye]=Y.useState(!1),[De,et]=Y.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ye=Y.useRef(null),be=Y.useRef(null),bt=Y.useRef(null),ze=Y.useRef(null),Oe=Y.useRef(null),Ne=Y.useRef(null);Y.useEffect(()=>{const _e=oe=>{const ne=Ye.current;E&&ne&&!ne.contains(oe.target)&&(N(!1),W(null));const ge=be.current;$==="line"&&ge&&!ge.contains(oe.target)&&j(null);const he=bt.current;$==="channel"&&he&&!he.contains(oe.target)&&j(null);const ue=ze.current;$==="gann"&&ue&&!ue.contains(oe.target)&&j(null);const Ee=Oe.current;$==="shape"&&Ee&&!Ee.contains(oe.target)&&j(null)};return window.addEventListener("mousedown",_e),()=>window.removeEventListener("mousedown",_e)},[E,$]),Y.useEffect(()=>{const _e=oe=>{oe.key==="Escape"&&(N(!1),W(null),j(null))};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[]);const ke=Y.useMemo(()=>[{icon:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:l.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:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),Te=_e=>{const oe=ke[_e].label;if(oe==="Menu"){N(ne=>!ne),W(null);return}if(oe==="Grid"){s(!n);return}if(oe==="Magnet"){a(!o),i(o?null:_e);return}if(oe==="Delete"){if(c.length>0){const ne=[...c];ne.pop(),h(ne)}return}if(oe==="Eye"){m(!d);return}if(oe==="Lock"){v(!x);return}if(oe==="Light Theme"||oe==="Dark Theme"){y(B==="light"?"dark":"light"),N(!1),W(null);return}if(oe==="History"){D(!0);return}i(A===_e?null:_e)};ke.slice(0,12);const Ie=ke.slice(12),Tt=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],tt=[{key:"accounts",label:"Trading accounts",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Open Demo account",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),l.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{clipPath:"url(#a)",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),l.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),l.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),l.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),l.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),l.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),l.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),l.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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"}),l.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:B==="light"?"Dark Theme":"Light Theme",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),l.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),l.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:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],MA=({item:_e})=>{const oe=!!_e.submenu?.length;return l.jsxs("div",{className:"relative",onMouseEnter:()=>{Ne.current&&(clearTimeout(Ne.current),Ne.current=null),oe&&W(_e.key)},onMouseLeave:()=>{oe&&(Ne.current=setTimeout(()=>W(null),120))},children:[l.jsxs("button",{type:"button",onClick:()=>{oe?W(ne=>ne===_e.key?null:_e.key):(_e.key==="theme"&&y(ne=>ne==="light"?"dark":"light"),N(!1),W(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:_e.icon}),l.jsx("span",{className:"flex-1 text-[15px]",children:_e.label}),_e.rightText&&l.jsx("span",{className:`text-xs ${Ke?"text-slate-500":"text-slate-400"}`,children:_e.rightText}),oe&&l.jsx("svg",{className:`w-4 h-4 ${Ke?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),oe&&S===_e.key&&l.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Ke?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:l.jsx("div",{className:"py-1",children:_e.submenu.map((ne,ge)=>{const he=De[_e.key]===ne.label||ne.selected&&De[_e.key]==null;return l.jsxs("button",{type:"button",onClick:()=>{et(ue=>({...ue,[_e.key]:ne.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:ne.icon||null}),l.jsx("span",{className:"flex-1 min-w-0",children:ne.label}),he&&l.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ge)})})})]})},Ke=B==="light";return l.jsxs("div",{className:"relative h-full",children:[l.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${Ke?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsx("div",{className:"flex flex-col items-center gap-2",children:Tt.map((_e,oe)=>{const ne=_e==="gann",ge=ne?null:ke[_e],he=ne?-1:_e;return l.jsxs(Y.Fragment,{children:[he===2?l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>{const ue=bi[V].toolId;i(A===ue?null:ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
-
${A===bi[V].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:bi[V].label,children:bi[V].icon}),l.jsx("span",{onMouseEnter:()=>ae(!0),onMouseLeave:()=>ae(!1),onMouseDown:ue=>{ue.stopPropagation(),j(
|
|
18
|
-
${A===Ti[de].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Ti[de].label,children:Ti[de].icon}),l.jsx("span",{onMouseEnter:()=>pe(!0),onMouseLeave:()=>pe(!1),onMouseDown:ue=>{ue.stopPropagation(),j(
|
|
19
|
-
${A===xi[
|
|
20
|
-
${A===Qi[
|
|
21
|
-
${ge.label==="Grid"&&n||ge.label==="Eye"&&!d||ge.label==="Lock"&&
|
|
22
|
-
${
|
|
16
|
+
`,title:N,children:E[N]},N))}),l.jsxs("div",{className:"flex items-center gap-2",children:[D.map(N=>l.jsx("button",{onClick:()=>t(N),className:`px-1.5 py-2 text-sm font-medium rounded transition-colors ${e===N?y?"text-sky-600":"text-sky-400":y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:text-slate-200 hover:bg-slate-800"}`,children:N},N)),l.jsx("div",{className:`border-r h-6 mx-1 ${y?"border-slate-200":"border-slate-700"}`}),l.jsx("button",{onClick:()=>a?.(),title:T?"Hide Buy/Sell on Chart":"Show Buy/Sell on Chart",className:`px-2 py-2 flex justify-center items-center rounded transition-colors ${T?y?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":y?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.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"}),l.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"}),l.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"})]})})}),l.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 ${y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-white hover:bg-[#25303C]"}`,children:[l.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24 ",xmlns:"http://www.w3.org/2000/svg",children:l.jsxs("g",{fill:"none",fillRule:"evenodd",children:[l.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"}),l.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"}),l.jsx("path",{fill:"#B0BEC5",d:"M13 8v4.186l2.657 2.657-1.414 1.414L11 13V8z"})]})}),l.jsx("span",{className:"button-text svelte-1iwf8ix",children:"New Order"})]}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:s,className:`p-1 ${y?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom In",children:l.jsx(Gy,{className:"w-5 h-5"})}),l.jsx("button",{onClick:o,className:`p-2 ${y?"text-slate-700 hover:bg-[#E5F4FF]":"text-white hover:bg-slate-800"} rounded transition-colors`,title:"Zoom Out",children:l.jsx(Ry,{className:"w-5 h-5"})}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsx("button",{onClick:v,className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${y?"text-slate-700 hover:text-slate-900 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsx("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:l.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"})})}),l.jsx("div",{className:`border-r ${y?"border-slate-200":"border-slate-700"} h-6 mx-1`}),l.jsx("button",{type:"button",onClick:()=>m?.(),title:d?"Close Market Watch":"Open Market Watch",className:`px-2 py-2 flex justify-center items-center gap-1 cursor-pointer text-xs font-medium rounded transition-colors ${d?y?"text-sky-600 bg-sky-50 hover:bg-[#E5F4FF]":"text-sky-400 bg-slate-700 hover:bg-[#25303C]":y?"text-slate-600 hover:text-sky-600 hover:bg-[#E5F4FF]":"text-slate-200 hover:bg-[#25303C]"}`,children:l.jsxs("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[l.jsx("path",{d:"M15 7H7v2h8V7ZM7 15h5v2H7v-2ZM17 11H7v2h10v-2Z"}),l.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"})]})})]})]})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("button",{type:"button",onClick:()=>c?.(),title:"Download chart as PNG",className:`p-2 rounded transition-colors ${y?"text-slate-500 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",className:"inline-block",fill:"currentColor",children:l.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"})})}),l.jsx("button",{type:"button",onClick:()=>h?.(),title:"Full screen (F11)",className:`p-2 rounded transition-colors ${y?"text-slate-600 hover:text-slate-800 hover:bg-slate-100":"text-slate-300 hover:text-white hover:bg-slate-800"}`,children:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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"})})})]})]})},bi=[{label:"Trendline",toolId:2,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"20",cy:"12",r:"1.5",fill:"currentColor"})]})},{label:"Horizontal Ray",toolId:21,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M12 4v16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"12",cy:"4",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})},{label:"Info Line",toolId:23,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.jsx("rect",{x:"10",y:"5",width:"7",height:"5",rx:"1",fill:"currentColor",opacity:"0.5"}),l.jsx("text",{x:"11",y:"9",fontSize:"4",fill:"white",fontWeight:"bold",children:"i"})]})},{label:"Ruler Line",toolId:24,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",children:[l.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l.jsx("rect",{x:"7",y:"7",width:"10",height:"5",rx:"1",transform:"rotate(-45 12 12)",stroke:"currentColor",strokeWidth:"1.3",fill:"none"}),l.jsx("line",{x1:"10.5",y1:"13.5",x2:"12",y2:"12",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),l.jsx("line",{x1:"12.5",y1:"11.5",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"}),l.jsx("circle",{cx:"4.5",cy:"19.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),l.jsx("circle",{cx:"19.5",cy:"4.5",r:"1.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]})},{label:"Arrowed Line",toolId:25,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.jsx("path",{d:"M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M14 6h4v4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Ray",toolId:26,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("circle",{cx:"5",cy:"19",r:"2",fill:"currentColor"}),l.jsx("path",{d:"M6.4 17.6L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M16 5h3v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})},{label:"Extended Line",toolId:27,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M2 19L22 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"3 0 3"}),l.jsx("circle",{cx:"8",cy:"15",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"16",cy:"9",r:"1.5",fill:"currentColor"})]})},{label:"Cross Line",toolId:28,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M12 4v16M4 12h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor"})]})},{label:"Trend By Angle",toolId:29,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M5 19L19 5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M5 19h6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),l.jsx("path",{d:"M5 13a6 6 0 0 1 0 6",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})},{label:"Disjoint Channel",toolId:30,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M3 17L9 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M9 17L15 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M15 17L21 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M3 14L21 14",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"2 2"})]})},{label:"Flat Top/Bottom",toolId:31,icon:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.jsx("path",{d:"M4 8h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M4 16h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M8 8v8M16 8v8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 2"})]})}],Ti=[{label:"Regression Channel",toolId:40,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],xi=[{label:"Gann Line",toolId:43,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],Qi=[{label:"Rectangle",toolId:5,icon:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:[l.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"}),l.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"}),l.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:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",children:l.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"})})}],cs=({children:r,top:e,panelRef:t,isLight:A})=>l.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:l.jsx("div",{className:"py-1",children:r})}),Jy=({AccountId:r,UserName:e,UserId:t})=>{const{activeTool:A,setActiveTool:i,showGrid:n,setShowGrid:s,snapToGrid:o,setSnapToGrid:a,chartObjects:c,setChartObjects:h,drawingsVisible:d,setDrawingsVisible:m,chartLocked:T,setChartLocked:v,theme:B,setTheme:y,setIsShow:D}=Qt(),[E,N]=Y.useState(!1),[S,W]=Y.useState(null),[$,j]=Y.useState(null),[V,X]=Y.useState(0),[ce,ae]=Y.useState(!1),[de,J]=Y.useState(0),[ie,pe]=Y.useState(!1),[Ce,Ue]=Y.useState(0),[xe,He]=Y.useState(!1),[Le,Fe]=Y.useState(0),[we,ye]=Y.useState(!1),[De,et]=Y.useState({chart:"Grid",colors:"Green & Red",lang:"English"}),Ye=Y.useRef(null),be=Y.useRef(null),bt=Y.useRef(null),Ge=Y.useRef(null),Oe=Y.useRef(null),Ne=Y.useRef(null);Y.useEffect(()=>{const Ie=oe=>{const ne=Ye.current;E&&ne&&!ne.contains(oe.target)&&(N(!1),W(null));const ge=be.current;$==="line"&&ge&&!ge.contains(oe.target)&&j(null);const he=bt.current;$==="channel"&&he&&!he.contains(oe.target)&&j(null);const ue=Ge.current;$==="gann"&&ue&&!ue.contains(oe.target)&&j(null);const Me=Oe.current;$==="shape"&&Me&&!Me.contains(oe.target)&&j(null)};return window.addEventListener("mousedown",Ie),()=>window.removeEventListener("mousedown",Ie)},[E,$]),Y.useEffect(()=>{const Ie=oe=>{oe.key==="Escape"&&(N(!1),W(null),j(null))};return window.addEventListener("keydown",Ie),()=>window.removeEventListener("keydown",Ie)},[]);const ke=Y.useMemo(()=>[{icon:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.jsx("path",{d:"M3 18H21V16H3V18ZM3 13H21V11H3V13ZM3 6V8H21V6H3Z",fill:"currentColor"})]})}),label:"Menu",description:"Opens/closes navigation menu"},{icon:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",children:[l.jsx("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 4V8H18V6H13V18H16V20H8V18H11V6H6V8H4V4H20Z",fill:"currentColor"})})}),label:"Text",description:"Add text label on chart"},{icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)",cursor:"pointer"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:l.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:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:l.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:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[l.jsx("rect",{x:"3",y:"3",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"13",y:"3",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"3",y:"13",width:"8",height:"8",strokeWidth:2}),l.jsx("rect",{x:"13",y:"13",width:"8",height:"8",strokeWidth:2})]}),label:"Layout",description:"Manage chart layouts and panel arrangements"}],[]),Te=Ie=>{const oe=ke[Ie].label;if(oe==="Menu"){N(ne=>!ne),W(null);return}if(oe==="Grid"){s(!n);return}if(oe==="Magnet"){a(!o),i(o?null:Ie);return}if(oe==="Delete"){if(c.length>0){const ne=[...c];ne.pop(),h(ne)}return}if(oe==="Eye"){m(!d);return}if(oe==="Lock"){v(!T);return}if(oe==="Light Theme"||oe==="Dark Theme"){y(B==="light"?"dark":"light"),N(!1),W(null);return}if(oe==="History"){D(!0);return}i(A===Ie?null:Ie)};ke.slice(0,12);const _e=ke.slice(12),Tt=[0,1,2,3,"gann",5,4,6,7,8,9,10,11],tt=[{key:"accounts",label:"Trading accounts",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",children:l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Open Demo account",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"M14.5 13.103c1.836 0 3.667.723 5.5 2.14V19l-10.5.5-.5-4.257c1.833-1.417 3.664-2.14 5.5-2.14Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M9.53 15.469 9.5 19l10-.477v-3.032c-1.703-1.27-3.365-1.888-5-1.888-1.626 0-3.277.611-4.97 1.866Zm-.836-.622c1.895-1.465 3.83-2.244 5.806-2.244 1.975 0 3.91.78 5.806 2.244l.194.15v4.48l-12.03.545V15.02l.224-.173Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#CDFDDA",fillRule:"evenodd",d:"m7.736 13.701-.734 2.345L7.001 20H4.5a1 1 0 0 1-1-1v-4c1.412-.669 2.824-1.102 4.236-1.299Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"m7.913 13.678-.475 1.086c-.988.111-1.87.308-2.646.59l-.29.11v3.529H7L7.002 20H4.5a1 1 0 0 1-1-1v-4c1.471-.697 2.942-1.138 4.413-1.322Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#CDFDDA",d:"M14.5 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"}),l.jsx("path",{fill:"#00AC00",fillRule:"evenodd",d:"M14.5 4a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z","clip-rule":"evenodd"}),l.jsx("path",{fill:"#00AC00",d:"M11.471 11.979A4.992 4.992 0 0 1 9.5 8c0-.67.131-1.308.37-1.891a3.5 3.5 0 1 0 1.601 5.87Z"}),l.jsx("path",{fill:"#CDFDDA",d:"M9.586 7.07a2.5 2.5 0 1 0 1.153 4.226A4.981 4.981 0 0 1 9.5 8c0-.318.03-.63.086-.93Z"})]})})})}]},{key:"chart",label:"Chart settings",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 3V9H11V18H9V21H7V18H5V9H7V3H9ZM17 3V6H19V16H17V19H15V16H13V6H15V3H17ZM17 8H15V14H17V8Z",stroke:"currentColor"})})})}),submenu:[{label:"Grid",icon:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("g",{clipPath:"url(#a)",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M4 9H20V10H4V9Z",fill:"#3183FF"}),l.jsx("path",{d:"M4 17H20V18H4V17Z",fill:"#EA4C4C"}),l.jsx("react",{x:"4",y:"14",width:"5",height:"2",fill:"#EA4C4C"}),l.jsx("react",{x:"4",y:"6",width:"5",height:"2",fill:"#3183FF"})]})})})},{label:"Trade Position",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M16 10L12 5H20L16 10Z",fill:"#D95852"}),l.jsx("path",{d:"M16 10H20V11H4V10H16Z",fill:"#D95852"}),l.jsx("path",{d:"M20 13H4V14H8L4 19H12L8 14H20V13Z",fill:"#4682F7"})]})})})},{label:"Trade History",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M4 19L8 14L12 19H4Z",fill:"#3183FF"}),l.jsx("path",{d:"M7 16L17.5 8",stroke:"#3183FF",strokeDasharray:"2 2"}),l.jsx("path",{d:"M13 5L17 10L21 5H13Z",fill:"#EA4C4C"})]})})})},{label:"SL/TP Levels",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.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"}),l.jsx("path",{d:"M6.914 10V5.18h1.902v-.903H4.078v.903h1.82V10h1.016ZM20 11H4v1h16v-1Z",fill:"#3183FF"})]})})})},{label:"Ask Price",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M0 0h24v24H0z",fill:"none"}),l.jsx("path",{d:"M10 10L20 14L18 16L20 18L18 20L16 18L14 20L10 10Z",fill:"currentColor"}),l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Crosshair cursor",icon:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0-6 0",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 2v4M12 18v4M2 12h4M18 12h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})},{label:"Show OHLC",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M7 17V7M12 17v-6M17 17v-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}]},{key:"oneclick",label:"One Click Trading",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:l.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:B==="light"?"Dark Theme":"Light Theme",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("circle",{cx:"12",cy:"12",r:"5",fill:"#FED05A"})]})})})},{key:"colors",label:"Color Templates",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("circle",{cx:"8.5",cy:"12.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"9.5",cy:"8.5",r:"1.5",fill:"currentColor"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"1.5",fill:"currentColor"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ef5350"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#ff574d"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#7a7a7a"}),l.jsx("path",{d:"M9.19522 7.08376V3.15234H7.22951V7.08376H5.26379V15.9295H7.22951V20.8438H9.19522V15.9295H11.1609V7.08376H9.19522Z",fill:"#ffffff"})]})})})},{label:"Neutral",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M17.0579 5.11914V7.08486H19.0236V17.8963H17.0579V20.8449H15.0922V17.8963H13.1265V7.08486H15.0922V5.11914H17.0579Z",fill:"#c86a6a"}),l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),l.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:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),l.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:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Simplified",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Chinese Traditional",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Czech",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Dutch",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})},{label:"Urdu",icon:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"})})}]},{key:"shortcuts",label:"Shortcuts",icon:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsx(l.Fragment,{children:l.jsx("div",{className:"icon svelte-1qoe9jm",style:{width:"calc(var(--indent-half) * 6)",height:"calc(var(--indent-half) * 6)"},children:l.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.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:l.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20Z",stroke:"currentColor",strokeWidth:"2"}),l.jsx("path",{d:"M12 10v7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),l.jsx("path",{d:"M12 7h.01",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}],IA=({item:Ie})=>{const oe=!!Ie.submenu?.length;return l.jsxs("div",{className:"relative",onMouseEnter:()=>{Ne.current&&(clearTimeout(Ne.current),Ne.current=null),oe&&W(Ie.key)},onMouseLeave:()=>{oe&&(Ne.current=setTimeout(()=>W(null),120))},children:[l.jsxs("button",{type:"button",onClick:()=>{oe?W(ne=>ne===Ie.key?null:Ie.key):(Ie.key==="theme"&&y(ne=>ne==="light"?"dark":"light"),N(!1),W(null))},className:`w-full flex items-center gap-3 px-4 py-2.5 text-left text-[13px] ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),l.jsx("span",{className:"flex-1 text-[15px]",children:Ie.label}),Ie.rightText&&l.jsx("span",{className:`text-xs ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.rightText}),oe&&l.jsx("svg",{className:`w-4 h-4 ${Ke?"text-slate-500":"text-slate-400"}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),oe&&S===Ie.key&&l.jsx("div",{className:`absolute top-0 left-full ml-0 w-52 min-w-44 rounded-md shadow-2xl overflow-hidden z-100 border ${Ke?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:l.jsx("div",{className:"py-1",children:Ie.submenu.map((ne,ge)=>{const he=De[Ie.key]===ne.label||ne.selected&&De[Ie.key]==null;return l.jsxs("button",{type:"button",onClick:()=>{et(ue=>({...ue,[Ie.key]:ne.label}))},className:`w-full flex items-center gap-3 pl-3 pr-3 py-2 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:ne.icon||null}),l.jsx("span",{className:"flex-1 min-w-0",children:ne.label}),he&&l.jsx("span",{className:"w-5 h-5 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},ge)})})})]})},Ke=B==="light";return l.jsxs("div",{className:"relative h-full",children:[l.jsxs("div",{className:`w-12 flex flex-col items-center py-3 h-full border-r ${Ke?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsx("div",{className:"flex flex-col items-center gap-2",children:Tt.map((Ie,oe)=>{const ne=Ie==="gann",ge=ne?null:ke[Ie],he=ne?-1:Ie;return l.jsxs(Y.Fragment,{children:[he===2?l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>{const ue=bi[V].toolId;i(A===ue?null:ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
17
|
+
${A===bi[V].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:bi[V].label,children:bi[V].icon}),l.jsx("span",{onMouseEnter:()=>ae(!0),onMouseLeave:()=>ae(!1),onMouseDown:ue=>{ue.stopPropagation(),j(Me=>Me==="line"?null:"line")},style:{position:"absolute",bottom:1,right:1,width:ce?10:7,height:ce?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More line tools",children:l.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("polygon",{points:"10,10 0,10 10,0",fill:Ke?"#64748b":"#94a3b8"})})})]}):he===3?l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>{const ue=Ti[de].toolId;i(A===ue?null:ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
18
|
+
${A===Ti[de].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Ti[de].label,children:Ti[de].icon}),l.jsx("span",{onMouseEnter:()=>pe(!0),onMouseLeave:()=>pe(!1),onMouseDown:ue=>{ue.stopPropagation(),j(Me=>Me==="channel"?null:"channel")},style:{position:"absolute",bottom:1,right:1,width:ie?10:7,height:ie?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More channel tools",children:l.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("polygon",{points:"10,10 0,10 10,0",fill:Ke?"#64748b":"#94a3b8"})})})]}):ne?l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>{const ue=xi[Ce].toolId;i(A===ue?null:ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
19
|
+
${A===xi[Ce].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:xi[Ce].label,children:xi[Ce].icon}),l.jsx("span",{onMouseEnter:()=>He(!0),onMouseLeave:()=>He(!1),onMouseDown:ue=>{ue.stopPropagation(),j(Me=>Me==="gann"?null:"gann")},style:{position:"absolute",bottom:1,right:1,width:xe?10:7,height:xe?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More Gann tools",children:l.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("polygon",{points:"10,10 0,10 10,0",fill:Ke?"#64748b":"#94a3b8"})})})]}):he===5?l.jsxs("div",{className:"relative",children:[l.jsx("button",{onClick:()=>{const ue=Qi[Le].toolId;i(A===ue?null:ue)},className:`relative w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
20
|
+
${A===Qi[Le].toolId?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:Qi[Le].label,children:Qi[Le].icon}),l.jsx("span",{onMouseEnter:()=>ye(!0),onMouseLeave:()=>ye(!1),onMouseDown:ue=>{ue.stopPropagation(),j(Me=>Me==="shape"?null:"shape")},style:{position:"absolute",bottom:1,right:1,width:we?10:7,height:we?10:7,cursor:"pointer",transition:"width 0.12s, height 0.12s",display:"flex",alignItems:"center",justifyContent:"center"},title:"More shape tools",children:l.jsx("svg",{viewBox:"0 0 10 10",width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("polygon",{points:"10,10 0,10 10,0",fill:Ke?"#64748b":"#94a3b8"})})})]}):l.jsx("button",{onClick:()=>Te(he),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
21
|
+
${ge.label==="Grid"&&n||ge.label==="Eye"&&!d||ge.label==="Lock"&&T||A===he?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${ge.label}: ${ge.description}`,children:ge.icon}),!ne&&ge.label==="Text"&&l.jsx("div",{className:`w-8 border-t my-1 ${Ke?"border-slate-200":"border-slate-700"}`})]},ne?"gann-slot":`${ge.label}-${Ie}`)})}),l.jsx("div",{className:"flex-1"}),l.jsx("div",{className:"flex flex-col items-center gap-2 pb-1",children:_e.map((Ie,oe)=>{const ne=12+oe;return l.jsx("button",{onClick:()=>Te(ne),className:`w-10 h-10 flex items-center justify-center transition-colors duration-150
|
|
22
|
+
${Ie.label==="Grid"&&n||Ie.label==="Eye"&&!d||Ie.label==="Lock"&&T||A===ne?Ke?"text-sky-600 hover:bg-sky-100":"text-sky-300 hover:bg-slate-700":Ke?"text-slate-600 hover:bg-sky-100":"text-slate-400 hover:bg-slate-700"}`,title:`${Ie.label}: ${Ie.description}`,children:Ie.icon},Ie.label)})})]}),$==="line"&&l.jsx(cs,{top:84,panelRef:be,isLight:Ke,children:bi.map((Ie,oe)=>{const ne=V===oe;return l.jsxs("button",{type:"button",onMouseDown:ge=>{ge.stopPropagation(),X(oe),i(Ie.toolId),j(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),l.jsx("span",{className:"flex-1",children:Ie.label}),ne&&l.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Ie.toolId)})}),$==="channel"&&l.jsx(cs,{top:128,panelRef:bt,isLight:Ke,children:Ti.map((Ie,oe)=>{const ne=de===oe;return l.jsxs("button",{type:"button",onMouseDown:ge=>{ge.stopPropagation(),J(oe),i(Ie.toolId),j(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),l.jsx("span",{className:"flex-1",children:Ie.label}),ne&&l.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Ie.toolId)})}),$==="gann"&&l.jsx(cs,{top:210,panelRef:Ge,isLight:Ke,children:xi.map((Ie,oe)=>{const ne=Ce===oe;return l.jsxs("button",{type:"button",onMouseDown:ge=>{ge.stopPropagation(),Ue(oe),i(Ie.toolId),j(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),l.jsx("span",{className:"flex-1",children:Ie.label}),ne&&l.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Ie.toolId)})}),$==="shape"&&l.jsx(cs,{top:250,panelRef:Oe,isLight:Ke,children:Qi.map((Ie,oe)=>{const ne=Le===oe;return l.jsxs("button",{type:"button",onMouseDown:ge=>{ge.stopPropagation(),Fe(oe),i(Ie.toolId),j(null)},className:`w-full flex items-center gap-3 px-4 py-2.5 text-[13px] text-left ${Ke?"text-slate-700 hover:bg-slate-100":"text-slate-200 hover:bg-[#202933]"}`,children:[l.jsx("span",{className:`w-5 h-5 flex shrink-0 items-center justify-center ${Ke?"text-slate-500":"text-slate-400"}`,children:Ie.icon}),l.jsx("span",{className:"flex-1",children:Ie.label}),ne&&l.jsx("span",{className:"w-4 h-4 flex shrink-0 items-center justify-center text-emerald-400",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},Ie.toolId)})}),E&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20",onClick:()=>{N(!1),W(null)},"aria-hidden":"true"}),l.jsxs("div",{ref:Ye,className:`absolute left-12 top-2 z-[999] w-68 border shadow-2xl overflow-visible ${Ke?"bg-white border-slate-200":"bg-[#262F3F] border-white/10"}`,children:[l.jsxs("div",{className:`relative px-4 py-3 border-b overflow-hidden ${Ke?"bg-white border-slate-200":"border-white/10 bg-[#262F3F]"}`,children:[l.jsx("div",{className:`z-[999]text-[16px] font-medium pr-12 ${Ke?"text-slate-800":"text-slate-100"}`,children:e||"MT5 Account"}),l.jsx("div",{className:`text-[12px] mt-0.5 ${Ke?"text-slate-500":"text-slate-400"}`,children:r})]}),l.jsx("div",{className:"py-2",children:tt.map(Ie=>l.jsx(IA,{item:Ie},Ie.key))})]})]})]})};function qy(r){return Dt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M337.509 305.372h-17.501l-6.571-5.486c20.791-25.232 33.922-57.054 33.922-93.257C347.358 127.632 283.896 64 205.135 64 127.452 64 64 127.632 64 206.629s63.452 142.628 142.225 142.628c35.011 0 67.831-13.167 92.991-34.008l6.561 5.487v17.551L415.18 448 448 415.086 337.509 305.372zm-131.284 0c-54.702 0-98.463-43.887-98.463-98.743 0-54.858 43.761-98.742 98.463-98.742 54.7 0 98.462 43.884 98.462 98.742 0 54.856-43.762 98.743-98.462 98.743z"},child:[]}]})(r)}const Yy=({width:r=256,symbols:e=[],selectedSymbol:t,onSymbolSelect:A,symbolsLoading:i=!1,isOpen:n})=>{const{theme:s}=Qt(),o=s==="light",[a,c]=Y.useState(""),h=e.filter(T=>T.symbol.toLowerCase().includes(a.toLowerCase())),d=h.filter(T=>!T.symbol.toUpperCase().endsWith("USDT")),m=h.filter(T=>T.symbol.toUpperCase().endsWith("USDT"));return l.jsxs(l.Fragment,{children:[l.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
|
-
`}),l.jsxs("div",{style:{width:`${r}px`,minWidth:"550px",maxWidth:"1900px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[l.jsx($y,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),l.jsx("input",{type:"text",placeholder:"Search symbol",value:a,onChange:x=>c(x.target.value),className:`w-full px-3 py-1.5 rounded text-md focus:outline-none focus:border-sky-500 ${o?"bg-white border border-slate-200 text-slate-800 placeholder:text-slate-400":"bg-slate-800 border border-slate-600 text-slate-100 placeholder:text-slate-400"}`})]}),l.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:i?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.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."})}):l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:l.jsxs("tr",{children:[l.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change"})]})}),l.jsxs("tbody",{children:[d.length>0&&l.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:l.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-sky-600":"text-sky-400"}`,children:"FOREX"})}),d.map(x=>l.jsxs("tr",{onClick:()=>A(x.symbol),className:`cursor-pointer transition-colors ${t===x.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[l.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:x.symbol}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.bid).toFixed(5)}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(x.ask).toFixed(5)}),l.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.symbol)),m.length>0&&l.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:l.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-emerald-600":"text-emerald-400"}`,children:"CRYPTO"})}),m.map(x=>l.jsxs("tr",{onClick:()=>A(x.symbol),className:`cursor-pointer transition-colors ${t===x.symbol?o?"bg-sky-50 border-l-2 border-sky-500":"bg-slate-800 border-l-2 border-sky-500":o?"hover:bg-slate-50":"hover:bg-slate-800"}`,children:[l.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:x.symbol}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:x.bid.toFixed(5)}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${x.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:x.ask.toFixed(5)}),l.jsxs("td",{className:`px-3 py-2 text-right font-medium ${x.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[x.change>=0?"+":"",x.change,"%"]})]},x.symbol))]})]})})]})]})},Zy=({accountSummary:r,orders:e,onClose:t,onModify:A,height:i})=>{const{accountSummary:n,orders:s,theme:o,isShow:a,setIsShow:c,historyOrders:h,fetchHistoryOrders:d}=Qt(),m=r||n,x=e||s,v=h||[],B=o==="light",y=a?"history":"trade";Y.useEffect(()=>{a&&d&&d()},[a,d]);const D="#26A69A",E="#EF5350",N=B?"#f8fafc":"#12161D",S=B?"#e2e8f0":"#1e293b",W=B?"#f1f5f9":"#12161D",$=B?"#F0F5F9":"#2B3543",j=B?"#f8fafc":"#131c2e",V=B?"#12161D":"#fff",X=B?"#64748b":"#fff",ce=(x||[]).filter(Te=>Te.status==="OPEN"||!Te.closeAt),ae=m?.balance||0,de=m?.equity??ae,J=m?.margin||0,ie=m?.freeMargin??de-J,pe=J>0?de/J*100:0,Be=ce.reduce((Te,Ie)=>Te+(Ie.livePnL??Ie.profit??0),0),Ue=Te=>{const Ie=parseFloat(Te);return Number.isFinite(Ie)?Ie.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},xe=Te=>{const Ie=parseFloat(Te);return!Ie||isNaN(Ie)?"—":Ie>=1e4?Ie.toFixed(2):Ie>=10?Ie.toFixed(4):Ie.toFixed(5)},Le=Te=>{const Ie=parseFloat(Te);return isNaN(Ie)?"—":(Ie>=0?"+":"")+Ie.toFixed(2)},Me=Te=>{const Ie=parseFloat(Te);return isNaN(Ie)?"—":Ie.toFixed(2)},Fe=Te=>{if(!Te)return"—";const Ie=new Date(Te);return isNaN(Ie.getTime())?String(Te):`${Ie.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${Ie.toTimeString().slice(0,8)}`},we=Y.useCallback((Te,Ie)=>{Te.stopPropagation(),t&&t(Ie.id)},[t]),ye=Y.useCallback((Te,Ie)=>{Te.stopPropagation(),A&&A(Ie)},[A]),De={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:N,borderTop:`1px solid ${S}`,display:"flex",flexDirection:"column",height:i?`${i}px`:"auto",overflow:"hidden",fontSize:"11px",color:V},et={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:$,borderBottom:`1px solid ${S}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ye={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${S}`,whiteSpace:"nowrap"},be={color:X,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},bt={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},ze={display:"flex",borderBottom:`1px solid ${S}`,flexShrink:0,backgroundColor:W},Oe=Te=>({padding:"5px 14px",fontSize:"11px",fontWeight:Te?700:500,color:Te?B?"#0ea5e9":"#38bdf8":X,borderBottom:Te?`2px solid ${B?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Ne={padding:"4px 8px",textAlign:"left",color:X,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${S}`,whiteSpace:"nowrap",backgroundColor:W,position:"sticky",top:0,zIndex:1},ke={padding:"3px 8px",borderBottom:`1px solid ${S}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:V};return l.jsxs("div",{style:De,children:[l.jsxs("div",{style:et,children:[l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Balance:"}),l.jsxs("span",{style:{...bt,color:V},children:["$",Ue(ae)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Equity:"}),l.jsxs("span",{style:{...bt,color:de>=ae?D:E},children:["$",Ue(de)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Margin:"}),l.jsxs("span",{style:{...bt,color:V},children:["$",Ue(J)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Free Margin:"}),l.jsxs("span",{style:{...bt,color:ie>=0?V:E},children:["$",Ue(ie)]})]}),l.jsxs("div",{style:{...Ye,borderRight:"none",marginRight:0,paddingRight:0},children:[l.jsx("span",{style:be,children:"Margin Level:"}),l.jsx("span",{style:{...bt,color:pe>=100?D:E},children:J>0?pe.toFixed(2)+"%":"—"})]}),ce.length>0&&l.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx("span",{style:be,children:"Float P/L:"}),l.jsxs("span",{style:{...bt,color:Be>=0?D:E,fontWeight:700},children:[Be>=0?"+":"",Ue(Be)]})]})]}),l.jsxs("div",{style:ze,children:[l.jsx("button",{style:Oe(y==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),l.jsx("button",{style:Oe(y==="history"),onClick:()=>c&&c(!0),children:"History"})]}),y==="trade"&&l.jsx("div",{style:{overflowY:"auto",flex:1},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Ne,children:"Symbol"}),l.jsx("th",{style:Ne,children:"Ticket"}),l.jsx("th",{style:Ne,children:"Time"}),l.jsx("th",{style:Ne,children:"Type"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Price"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Current"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"}),l.jsx("th",{style:{...Ne,textAlign:"center"},children:"Action"}),l.jsx("th",{style:{...Ne,textAlign:"center"},children:"Close"})]})}),l.jsx("tbody",{children:ce.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:12,style:{...ke,textAlign:"center",padding:"16px",color:X},children:"No open positions"})}):ce.map(Te=>{const Ie=Te.livePnL??Te.profit??0,Tt=Ie>=0?D:E;return l.jsxs("tr",{style:{cursor:"default"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor=j,onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="transparent",children:[l.jsx("td",{style:{...ke,fontWeight:700,color:V,letterSpacing:"0.02em"},children:Te.symbol}),l.jsx("td",{style:{...ke,color:X,fontSize:"10px"},children:String(Te.id||"").slice(0,8).toUpperCase()}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.openAt||Te.time)}),l.jsx("td",{style:{...ke,fontWeight:700,color:Te.type==="BUY"?D:E},children:Te.type}),l.jsx("td",{style:{...ke,textAlign:"right"},children:Me(Te.volume)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.price??Te.openPrice)}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.stopLoss?E:X},children:Te.stopLoss?xe(Te.stopLoss):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.takeProfit?D:X},children:Te.takeProfit?xe(Te.takeProfit):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:X},children:Te.currentPrice?xe(Te.currentPrice):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:Le(Ie)}),l.jsx("td",{style:{...ke,textAlign:"center"},children:l.jsx("button",{onClick:tt=>ye(tt,Te),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:X,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:tt=>tt.currentTarget.style.color="#f59e0b",onMouseLeave:tt=>tt.currentTarget.style.color=X,children:"✎"})}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:l.jsx("button",{onClick:tt=>we(tt,Te),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},Te.id)})})]})}),y==="history"&&l.jsx("div",{style:{overflowY:"auto",flex:1},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Ne,children:"Symbol"}),l.jsx("th",{style:Ne,children:"Ticket"}),l.jsx("th",{style:Ne,children:"Open Time"}),l.jsx("th",{style:Ne,children:"Type"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Open Price"}),l.jsx("th",{style:Ne,children:"Close Time"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Close Price"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"})]})}),l.jsx("tbody",{children:v.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:11,style:{...ke,textAlign:"center",padding:"16px",color:X},children:"No trade history"})}):v.map(Te=>{const Ie=Te.profit??0,Tt=Ie>=0?D:E;return l.jsxs("tr",{style:{cursor:"default"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor=j,onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="transparent",children:[l.jsx("td",{style:{...ke,fontWeight:700,color:V,letterSpacing:"0.02em"},children:Te.symbol}),l.jsx("td",{style:{...ke,color:X,fontSize:"10px"},children:String(Te.id||"").slice(0,8).toUpperCase()}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.openAt)}),l.jsx("td",{style:{...ke,fontWeight:700,color:Te.type==="BUY"?D:E},children:Te.type}),l.jsx("td",{style:{...ke,textAlign:"right"},children:Me(Te.volume)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.openPrice)}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.closeAt)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.closePrice)}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.stopLoss?E:X},children:Te.stopLoss?xe(Te.stopLoss):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.takeProfit?D:X},children:Te.takeProfit?xe(Te.takeProfit):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:Le(Ie)})]},Te.id)})})]})})]})},Jy="2.3.2";We.AccountPanel=Zy,We.BuySellPanel=ph,We.Chart=My,We.ChartTypeSelector=Ky,We.CoinSelector=Md,We.DrawingTools=kd,We.LeftSidebar=Ry,We.MarketExecutionModal=fh,We.MarketWatch=Xy,We.PositionsPanel=Vy,We.SYMBOL_CONFIG=La,We.StopLoss=_d,We.TakeProfit=Dd,We.TimeframeSelector=Oy,We.ToolCustomizationModal=wh,We.TopBar=Gy,We.TradePanel=Py,We.TradingProvider=jm,We.TradingToolbar=Dy,We.VolumeControl=Id,We.alignToTimeframe=$e,We.detectGaps=Jd,We.getSymbolConfig=Mr,We.is24x7Symbol=Zd,We.isCryptoSymbol=Xd,We.isForexSymbol=$d,We.isWithinTradingSession=qd,We.normalizeCandleTimes=Ia,We.normalizeTime=q,We.processCandles=Oa,We.processSingleCandle=Na,We.setSocketBaseUrl=oh,We.timeframeToSeconds=jt,We.useTrading=Qt,We.validateTimeOrdering=Yd,We.version=Jy,Object.defineProperty(We,Symbol.toStringTag,{value:"Module"})}));
|
|
49
|
+
`}),l.jsxs("div",{style:{width:`${r}px`,minWidth:"450px",maxWidth:"1500px"},className:`border-l flex flex-col h-full shrink-0 ${o?"bg-white border-slate-200":"bg-[#12161d] border-slate-700"}`,children:[l.jsxs("div",{className:`p-3 border-b flex justify-center items-center gap-2 ${o?"border-slate-200":"border-slate-700"}`,children:[l.jsx(qy,{className:o?"text-2xl text-slate-500":"text-2xl text-slate-400"}),l.jsx("input",{type:"text",placeholder:"Search symbol",value:a,onChange:T=>c(T.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"}`})]}),l.jsx("div",{className:`flex-1 overflow-y-auto ${o?"scrollbar-light":"scrollbar-dark"}`,style:{scrollbarWidth:"thin",scrollbarColor:o?"#cbd5e1 #ffffff":"#1e293b #12161d"},children:i?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:`text-sm ${o?"text-slate-700":"text-slate-200"}`,children:"Loading symbols..."})}):h.length===0?l.jsx("div",{className:"flex items-center justify-center h-full",children:l.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."})}):l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{className:`sticky top-0 z-10 ${o?"bg-white border-b border-slate-200":"bg-[#12161d] border-b border-slate-700"}`,children:l.jsxs("tr",{children:[l.jsx("th",{className:`px-3 py-2 text-left text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Symbol"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Bid"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Ask"}),l.jsx("th",{className:`px-3 py-2 text-right text-md ${o?"text-slate-700":"text-slate-300"}`,children:"Change"})]})}),l.jsxs("tbody",{children:[d.length>0&&l.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:l.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-sky-600":"text-sky-400"}`,children:"FOREX"})}),d.map(T=>l.jsxs("tr",{onClick:()=>A(T.symbol),className:`cursor-pointer transition-colors ${t===T.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:[l.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:[T.change>0?l.jsx("span",{className:"w-6 flex items-center justify-center",children:l.jsx(Xy,{className:"text-2xl text-emerald-500"})}):T.change<0?l.jsx("span",{className:"w-6 flex items-center justify-center",children:l.jsx($y,{className:"text-2xl text-red-500"})}):l.jsx("span",{className:"w-6 flex items-center justify-center",children:l.jsx(ug,{className:`text-[8px] ${o?"text-sky-600":"text-gray-300"}`})}),l.jsx("span",{children:T.symbol})]}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${T.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(T.bid).toFixed(5)}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${T.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:Number(T.ask).toFixed(5)}),l.jsxs("td",{className:`px-3 py-2 text-right font-medium ${T.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[T.change>=0?"+":"",T.change,"%"]})]},T.symbol)),m.length>0&&l.jsx("tr",{className:o?"bg-slate-50":"bg-slate-900",children:l.jsx("td",{colSpan:4,className:`px-3 py-2 text-xs font-semibold ${o?"text-emerald-600":"text-emerald-400"}`,children:"CRYPTO"})}),m.map(T=>l.jsxs("tr",{onClick:()=>A(T.symbol),className:`cursor-pointer transition-colors ${t===T.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:[l.jsx("td",{className:`px-3 py-2 text-md font-medium ${o?"text-slate-800":"text-slate-100"}`,children:T.symbol}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${T.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:T.bid.toFixed(5)}),l.jsx("td",{className:`px-3 py-2 text-right text-md ${T.change>=0?o?"text-blue-600":"text-sky-400":o?"text-rose-600":"text-rose-400"}`,children:T.ask.toFixed(5)}),l.jsxs("td",{className:`px-3 py-2 text-right font-medium ${T.change>=0?o?"text-emerald-600":"text-emerald-400":o?"text-rose-600":"text-rose-400"}`,children:[T.change>=0?"+":"",T.change,"%"]})]},T.symbol))]})]})})]})]})},jy=({accountSummary:r,orders:e,onClose:t,onModify:A,height:i})=>{const{accountSummary:n,orders:s,theme:o,isShow:a,setIsShow:c,historyOrders:h,fetchHistoryOrders:d}=Qt(),m=r||n,T=e||s,v=h||[],B=o==="light",y=a?"history":"trade";Y.useEffect(()=>{a&&d&&d()},[a,d]);const D="#26A69A",E="#EF5350",N=B?"#f8fafc":"#12161D",S=B?"#e2e8f0":"#1e293b",W=B?"#f1f5f9":"#12161D",$=B?"#F0F5F9":"#2B3543",j=B?"#f8fafc":"#131c2e",V=B?"#12161D":"#fff",X=B?"#64748b":"#fff",ce=(T||[]).filter(Te=>Te.status==="OPEN"||!Te.closeAt),ae=m?.balance||0,de=m?.equity??ae,J=m?.margin||0,ie=m?.freeMargin??de-J,pe=J>0?de/J*100:0,Ce=ce.reduce((Te,_e)=>Te+(_e.livePnL??_e.profit??0),0),Ue=Te=>{const _e=parseFloat(Te);return Number.isFinite(_e)?_e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"0.00"},xe=Te=>{const _e=parseFloat(Te);return!_e||isNaN(_e)?"—":_e>=1e4?_e.toFixed(2):_e>=10?_e.toFixed(4):_e.toFixed(5)},He=Te=>{const _e=parseFloat(Te);return isNaN(_e)?"—":(_e>=0?"+":"")+_e.toFixed(2)},Le=Te=>{const _e=parseFloat(Te);return isNaN(_e)?"—":_e.toFixed(2)},Fe=Te=>{if(!Te)return"—";const _e=new Date(Te);return isNaN(_e.getTime())?String(Te):`${_e.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"2-digit"})} ${_e.toTimeString().slice(0,8)}`},we=Y.useCallback((Te,_e)=>{Te.stopPropagation(),t&&t(_e.id)},[t]),ye=Y.useCallback((Te,_e)=>{Te.stopPropagation(),A&&A(_e)},[A]),De={fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace",backgroundColor:N,borderTop:`1px solid ${S}`,display:"flex",flexDirection:"column",height:i?`${i}px`:"auto",overflow:"hidden",fontSize:"11px",color:V},et={display:"flex",alignItems:"center",gap:"0",padding:"5px 10px",backgroundColor:$,borderBottom:`1px solid ${S}`,flexShrink:0,flexWrap:"wrap",rowGap:"2px"},Ye={display:"flex",alignItems:"center",gap:"4px",paddingRight:"14px",marginRight:"14px",borderRight:`1px solid ${S}`,whiteSpace:"nowrap"},be={color:X,fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em"},bt={fontFamily:"monospace",fontWeight:700,fontSize:"11px"},Ge={display:"flex",borderBottom:`1px solid ${S}`,flexShrink:0,backgroundColor:W},Oe=Te=>({padding:"5px 14px",fontSize:"11px",fontWeight:Te?700:500,color:Te?B?"#0ea5e9":"#38bdf8":X,borderBottom:Te?`2px solid ${B?"#0ea5e9":"#38bdf8"}`:"2px solid transparent",background:"none",border:"none",cursor:"pointer",transition:"color 0.15s",outline:"none"}),Ne={padding:"4px 8px",textAlign:"left",color:X,fontWeight:700,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.05em",borderBottom:`1px solid ${S}`,whiteSpace:"nowrap",backgroundColor:W,position:"sticky",top:0,zIndex:1},ke={padding:"3px 8px",borderBottom:`1px solid ${S}`,whiteSpace:"nowrap",fontFamily:"monospace",fontSize:"11px",color:V};return l.jsxs("div",{style:De,children:[l.jsxs("div",{style:et,children:[l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Balance:"}),l.jsxs("span",{style:{...bt,color:V},children:["$",Ue(ae)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Equity:"}),l.jsxs("span",{style:{...bt,color:de>=ae?D:E},children:["$",Ue(de)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Margin:"}),l.jsxs("span",{style:{...bt,color:V},children:["$",Ue(J)]})]}),l.jsxs("div",{style:Ye,children:[l.jsx("span",{style:be,children:"Free Margin:"}),l.jsxs("span",{style:{...bt,color:ie>=0?V:E},children:["$",Ue(ie)]})]}),l.jsxs("div",{style:{...Ye,borderRight:"none",marginRight:0,paddingRight:0},children:[l.jsx("span",{style:be,children:"Margin Level:"}),l.jsx("span",{style:{...bt,color:pe>=100?D:E},children:J>0?pe.toFixed(2)+"%":"—"})]}),ce.length>0&&l.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx("span",{style:be,children:"Float P/L:"}),l.jsxs("span",{style:{...bt,color:Ce>=0?D:E,fontWeight:700},children:[Ce>=0?"+":"",Ue(Ce)]})]})]}),l.jsxs("div",{style:Ge,children:[l.jsx("button",{style:Oe(y==="trade"),onClick:()=>c&&c(!1),children:"Trade"}),l.jsx("button",{style:Oe(y==="history"),onClick:()=>c&&c(!0),children:"History"})]}),y==="trade"&&l.jsx("div",{style:{overflowY:"auto",flex:1},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"800px"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Ne,children:"Symbol"}),l.jsx("th",{style:Ne,children:"Ticket"}),l.jsx("th",{style:Ne,children:"Time"}),l.jsx("th",{style:Ne,children:"Type"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Price"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Current"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"}),l.jsx("th",{style:{...Ne,textAlign:"center"},children:"Action"}),l.jsx("th",{style:{...Ne,textAlign:"center"},children:"Close"})]})}),l.jsx("tbody",{children:ce.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:12,style:{...ke,textAlign:"center",padding:"16px",color:X},children:"No open positions"})}):ce.map(Te=>{const _e=Te.livePnL??Te.profit??0,Tt=_e>=0?D:E;return l.jsxs("tr",{style:{cursor:"default"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor=j,onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="transparent",children:[l.jsx("td",{style:{...ke,fontWeight:700,color:V,letterSpacing:"0.02em"},children:Te.symbol}),l.jsx("td",{style:{...ke,color:X,fontSize:"10px"},children:String(Te.id||"").slice(0,8).toUpperCase()}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.openAt||Te.time)}),l.jsx("td",{style:{...ke,fontWeight:700,color:Te.type==="BUY"?D:E},children:Te.type}),l.jsx("td",{style:{...ke,textAlign:"right"},children:Le(Te.volume)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.price??Te.openPrice)}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.stopLoss?E:X},children:Te.stopLoss?xe(Te.stopLoss):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.takeProfit?D:X},children:Te.takeProfit?xe(Te.takeProfit):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:X},children:Te.currentPrice?xe(Te.currentPrice):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:He(_e)}),l.jsx("td",{style:{...ke,textAlign:"center"},children:l.jsx("button",{onClick:tt=>ye(tt,Te),title:"Modify TP/SL",style:{background:"none",border:"none",cursor:"pointer",color:X,padding:"2px 4px",borderRadius:"3px",fontSize:"11px",lineHeight:1},onMouseEnter:tt=>tt.currentTarget.style.color="#f59e0b",onMouseLeave:tt=>tt.currentTarget.style.color=X,children:"✎"})}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:l.jsx("button",{onClick:tt=>we(tt,Te),title:"Close position",style:{padding:"2px 8px",backgroundColor:"#7f1d1d",border:"1px solid #991b1b",borderRadius:"3px",color:"#fca5a5",fontSize:"10px",fontWeight:700,cursor:"pointer"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor="#991b1b",onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="#7f1d1d",children:"Close"})})]},Te.id)})})]})}),y==="history"&&l.jsx("div",{style:{overflowY:"auto",flex:1},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",minWidth:"900px"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{style:Ne,children:"Symbol"}),l.jsx("th",{style:Ne,children:"Ticket"}),l.jsx("th",{style:Ne,children:"Open Time"}),l.jsx("th",{style:Ne,children:"Type"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Volume"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Open Price"}),l.jsx("th",{style:Ne,children:"Close Time"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Close Price"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"S/L"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"T/P"}),l.jsx("th",{style:{...Ne,textAlign:"right"},children:"Profit"})]})}),l.jsx("tbody",{children:v.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:11,style:{...ke,textAlign:"center",padding:"16px",color:X},children:"No trade history"})}):v.map(Te=>{const _e=Te.profit??0,Tt=_e>=0?D:E;return l.jsxs("tr",{style:{cursor:"default"},onMouseEnter:tt=>tt.currentTarget.style.backgroundColor=j,onMouseLeave:tt=>tt.currentTarget.style.backgroundColor="transparent",children:[l.jsx("td",{style:{...ke,fontWeight:700,color:V,letterSpacing:"0.02em"},children:Te.symbol}),l.jsx("td",{style:{...ke,color:X,fontSize:"10px"},children:String(Te.id||"").slice(0,8).toUpperCase()}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.openAt)}),l.jsx("td",{style:{...ke,fontWeight:700,color:Te.type==="BUY"?D:E},children:Te.type}),l.jsx("td",{style:{...ke,textAlign:"right"},children:Le(Te.volume)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.openPrice)}),l.jsx("td",{style:{...ke,color:X},children:Fe(Te.closeAt)}),l.jsx("td",{style:{...ke,textAlign:"right"},children:xe(Te.closePrice)}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.stopLoss?E:X},children:Te.stopLoss?xe(Te.stopLoss):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",color:Te.takeProfit?D:X},children:Te.takeProfit?xe(Te.takeProfit):"—"}),l.jsx("td",{style:{...ke,textAlign:"right",fontWeight:700,color:Tt},children:He(_e)})]},Te.id)})})]})})]})},eb="2.3.2";ze.AccountPanel=jy,ze.BuySellPanel=ph,ze.Chart=_y,ze.ChartTypeSelector=Vy,ze.CoinSelector=Md,ze.DrawingTools=kd,ze.LeftSidebar=Jy,ze.MarketExecutionModal=fh,ze.MarketWatch=Yy,ze.PositionsPanel=Wy,ze.SYMBOL_CONFIG=La,ze.StopLoss=_d,ze.TakeProfit=Dd,ze.TimeframeSelector=Ky,ze.ToolCustomizationModal=wh,ze.TopBar=Zy,ze.TradePanel=zy,ze.TradingProvider=jm,ze.TradingToolbar=Oy,ze.VolumeControl=Id,ze.alignToTimeframe=$e,ze.detectGaps=Jd,ze.getSymbolConfig=Mr,ze.is24x7Symbol=Zd,ze.isCryptoSymbol=Xd,ze.isForexSymbol=$d,ze.isWithinTradingSession=qd,ze.normalizeCandleTimes=Ia,ze.normalizeTime=q,ze.processCandles=Oa,ze.processSingleCandle=Na,ze.setSocketBaseUrl=oh,ze.timeframeToSeconds=eA,ze.useTrading=Qt,ze.validateTimeOrdering=Yd,ze.version=eb,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})}));
|