summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteh_coderer <me@tehcoderer.com>2023-05-03 17:10:52 -0400
committerteh_coderer <me@tehcoderer.com>2023-05-03 17:10:52 -0400
commit62ee6d6b4b356bd31342ce81dc5192669879b97b (patch)
treea0869a4ca82f58cb89b447cd5f2cb6a3a52ca65a
parent6a81b0baee0000566ebadd2835b55d36edda0701 (diff)
update
-rw-r--r--frontend-components/plotly/src/index.css48
-rw-r--r--frontend-components/plotly/src/utils/utils.ts8
-rw-r--r--openbb_terminal/core/plots/plotly.html4
3 files changed, 39 insertions, 21 deletions
diff --git a/frontend-components/plotly/src/index.css b/frontend-components/plotly/src/index.css
index de932d6d8d1..d65491ec632 100644
--- a/frontend-components/plotly/src/index.css
+++ b/frontend-components/plotly/src/index.css
@@ -54,15 +54,13 @@
._header {
background: #062d48;
- background: linear-gradient(
- 90deg,
- #062d48,
- #0b3054 15%,
- #0e386c 45%,
- #0b203d 64%,
- #06101a 82%,
- #060709
- );
+ background: linear-gradient(90deg,
+ #062d48,
+ #0b3054 15%,
+ #0e386c 45%,
+ #0b203d 64%,
+ #06101a 82%,
+ #060709);
}
/* custom scrollbar */
@@ -89,9 +87,10 @@
background: rgba(0, 0, 0, 0);
}
-body, html {
+body,
+html {
height: 100%;
- overflow:hidden;
+ overflow: hidden;
background: #000;
}
@@ -187,7 +186,10 @@ code {
margin-left: 45px;
}
-._modal {font-size: 0.65rem !important; animation: popup 0.3s ease-in-out;}
+._modal {
+ font-size: 0.65rem !important;
+ animation: popup 0.3s ease-in-out;
+}
#changecolor {
position: absolute;
@@ -317,7 +319,12 @@ code {
}
@media screen and (max-width: 900px) {
- ._modal {font-size: 0.65rem !important; animation: popup 0.3s ease-in-out; height: 70% !important; overflow: auto !important;}
+ ._modal {
+ font-size: 0.65rem !important;
+ animation: popup 0.3s ease-in-out;
+ height: 70% !important;
+ overflow: auto !important;
+ }
}
.modebar-group {
@@ -481,3 +488,18 @@ code {
background-color: #1f1f1f !important;
border-radius: 8px;
}
+
+
+@media screen and (max-height: 1000px) and (max-width: 1100px) {
+ ._header strong {
+ font-size: 0.8rem !important;
+ }
+
+ ._header p {
+ font-size: 0.7rem !important;
+ }
+
+ ._header span {
+ font-size: 0.5rem !important;
+ }
+}
diff --git a/frontend-components/plotly/src/utils/utils.ts b/frontend-components/plotly/src/utils/utils.ts
index 8e26317005a..9b87340a5a8 100644
--- a/frontend-components/plotly/src/utils/utils.ts
+++ b/frontend-components/plotly/src/utils/utils.ts
@@ -179,12 +179,8 @@ export async function downloadData(columns: any, data: any) {
let fileHandle = await getNewFileHandle({
filename: filename,
});
- let ext: string = "png";
- if (fileHandle !== null) {
- // @ts-ignore
- ext = fileHandle.name.split(".").pop();
- }
- await loadingOverlay(`Saving ${ext.toUpperCase()}`);
+
+ await loadingOverlay("Saving CSV");
await new Promise((resolve) => setTimeout(resolve, 1500));
non_blocking(async function () {
// @ts-ignore
diff --git a/openbb_terminal/core/plots/plotly.html b/openbb_terminal/core/plots/plotly.html
index 2737432c60a..6a4650e1711 100644
--- a/openbb_terminal/core/plots/plotly.html
+++ b/openbb_terminal/core/plots/plotly.html
@@ -3698,11 +3698,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
`).map(N=>N.replace(/\r/g,""));const C=A[0].split(","),L=C.map(N=>N.trim().toLowerCase());let P={};for(let N=0;N<c.length;N++)L.includes(c[N])?P[c[N]]=C[L.indexOf(c[N])]:c[N]=="x"&&L.includes("date")&&(P[c[N]]=C[L.indexOf("date")]);["open","high","low","close"].every(N=>L.includes(N))&&E("candlestick"),L.includes("close")&&(v({...d,y:C[L.indexOf("close")]}),P.y=C[L.indexOf("close")]);let U=[];for(let N=1;N<A.length;N++){let j={},V=A[N].split(",");for(let H=0;H<C.length;H++)j[C[H]]=V[H];U.push(j)}let B=y.target.files[0].name.split(".")[0];try{if(B.includes("_")){let N=B.split("_"),j=new RegExp("^[0-9]{8}$");N.length>2&&(j.test(N[0])?N.splice(0,2):j.test(N[N.length-2])&&N.splice(N.length-2,2),B=N.join("_").replace(/openbb_/g,""))}}catch(N){console.log(N)}l(B),v(P),n(C),i(U)},Fb.readAsText(y.target.files[0])},type:"file",id:"csv_file",accept:".csv",style:{marginLeft:10}})]}),ri("div",{style:{marginTop:15},children:[Ar("label",{htmlFor:"csv_trace_type",children:Ar("b",{children:"Display data type:"})}),ri("select",{onChange:y=>{E(y.target.value)},id:"csv_trace_type",style:Rw,defaultValue:b[D],children:[D&&Ar("option",{value:D,children:b[D]},D),Object.keys(b).map(y=>D!==y&&Ar("option",{value:y,children:b[y]},y))]})]}),ri("div",{style:{marginTop:12},children:[Ar("label",{htmlFor:"csv_name",children:Ar("b",{children:"Trace Name:"})}),Ar("textarea",{id:"csv_name",value:f,onChange:y=>{l(y.target.value)},style:{padding:"5px 2px 2px 5px",width:"100%",maxWidth:"100%",maxHeight:200,marginTop:2},rows:2,cols:20,placeholder:"Enter a name to give this trace"})]}),r.length>0&&ri(eg,{children:[["scatter","bar"].includes(D)&&Ar("div",{style:{marginTop:15,marginBottom:10},id:"csv_columns",className:"csv_column_container",children:["x","y"].map(y=>ri("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[ri("label",{htmlFor:`csv_${y}`,style:{width:"100px"},children:[y.toUpperCase()," Axis"]}),ri("select",{onChange:k=>{a({...o,[y]:k.target.value}),v({...d,[y]:k.target.value})},id:`csv_${y}`,style:{width:"100%"},defaultValue:d[y],children:[d[y]&&Ar("option",{value:d[y],children:d[y]},y),r.map(k=>Ar("option",{value:k,children:k},k))]})]},y))}),D==="candlestick"&&Ar("div",{id:"csv_columns",className:"csv_column_container",style:{marginTop:15},children:["x","open","high","low","close"].map(y=>ri("div",{style:{marginTop:10,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Ar("label",{htmlFor:`csv_${y}`,style:{width:"100px"},children:y.charAt(0).toUpperCase()+y.slice(1)}),ri("select",{onChange:k=>{a({...o,[y]:k.target.value}),v({...d,[y]:k.target.value})},id:`csv_${y}`,style:{width:"100%"},children:[d[y]&&Ar("option",{value:d[y],children:d[y]},y),r.map(k=>k!=d[k]&&Ar("option",{value:k,children:k},k))]})]},y))}),ri("div",{style:{marginTop:20},id:"csv_colors",children:[["scatter","bar"].includes(D)&&ri("div",{children:[Ar("label",{htmlFor:"csv_color",children:`${D.charAt(0).toUpperCase()}${D.slice(1)} color`}),Ar("input",{type:"color",id:"csv_color",defaultValue:"#FFDD00",style:{margin:"2px 2px 2px 10px"},onChange:y=>{console.log(y.target.value),_(y.target.value)}})]}),D==="candlestick"&&ri(eg,{children:[Ar("label",{htmlFor:"csv_increasing",children:"Increasing color"}),Ar("input",{type:"color",id:"csv_increasing",defaultValue:"#00ACFF",style:{margin:"2px 0px 2px 10px"},onChange:y=>{s(y.target.value)}}),Ar("label",{htmlFor:"csv_decreasing",style:{marginLeft:15},children:"Decreasing color"}),Ar("input",{style:{margin:"2px 0px 2px 10px"},type:"color",id:"csv_decreasing",defaultValue:"#FF0000",onChange:y=>{m(y.target.value)}})]})]}),ri("div",{style:{marginTop:20},id:"csv_plot_yaxis_options",children:[D!=="candlestick"&&ri(eg,{children:[Ar("input",{type:"checkbox",id:"csv_percent_change",name:"csv_plot_yaxis_check",style:{marginBottom:2},onChange:y=>{p({...u,percentChange:y.target.checked,sameYaxis:!1})},checked:!u.sameYaxis&&u.percentChange}),Ar("label",{htmlFor:"csv_percent_change",style:{marginLeft:5},children:"Plot as percent change from first value"}),Ar("br",{})]}),Ar("input",{style:{marginTop:2},type:"checkbox",id:"csv_same_yaxis",name:"csv_plot_yaxis_check",onChange:y=>{p({...u,sameYaxis:y.target.checked,percentChange:!1})},checked:!u.percentChange&&u.sameYaxis}),Ar("label",{htmlFor:"csv_same_yaxis",style:{marginLeft:5},children:"Share Y-axis"}),D==="bar"&&ri("div",{style:{marginTop:2},id:"csv_bar_orientation",children:[Ar("input",{type:"checkbox",id:"csv_bar_horizontal",onChange:y=>{v({...d,orientation:y.target.checked?"h":"v"})}}),Ar("label",{htmlFor:"csv_bar_horizontal",style:{marginLeft:5},children:"Plot horizontally"})]})]})]}),Ar("br",{}),ri("div",{style:{float:"right",marginTop:20},children:[Ar("button",{className:"_btn-tertiary",id:"csv_cancel",onClick:x,children:"Cancel"}),Ar("button",{className:"_btn",id:"csv_submit",onClick:g,children:"Submit"})]})]})})}function F7({csvData:O,plotlyData:F,yaxisOptions:J,traceType:fe,traceColor:Pe,traceName:D,options:E,increasingColor:e,decreasingColor:_}){let T=F.data[0];T.xaxis==null&&(T.xaxis="x"),T.yaxis==null&&(T.yaxis="y");let s=T.yaxis,w,f=Object.keys(F.layout).filter(r=>r.startsWith("yaxis")).map(r=>F.layout[r]).filter(r=>r.side=="left"&&(r.overlaying=="y"||r.fixedrange!=null&&r.fixedrange==!0)).length>0?" ":"";if(J.sameYaxis!==!0){const r=Object.keys(F.layout).filter(n=>n.startsWith("yaxis")).map(n=>F.layout[n]);w=`y${r.length+1}`,s=`yaxis${r.length+1}`,console.log(`yaxis: ${w} ${s}`),F.layout[s]={...z7,title:{text:D,font:{size:14},standoff:0},ticksuffix:f,layer:"below traces"}}else w=T.yaxis.replace("yaxis","y");const l={type:fe,name:D,showlegend:!0,yaxis:w};let t={};if(["scatter","bar"].includes(fe)){const r=O.findIndex(n=>n[E.y]!=null&&n[E.y]!=0);t={...l,x:O.map(n=>n[E.x]),y:O.map(function(n){return J.percentChange&&fe==="scatter"?(n[E.y]-O[r][E.y])/O[r][E.y]:n[E.y]}),customdata:O.map(n=>n[E.y]),hovertemplate:"%{customdata:.2f}<extra></extra>",connectgaps:!0,marker:{color:Pe}},fe==="bar"&&(t.orientation=E.orientation,t.marker.opacity=.7,delete t.connectgaps,delete t.hovertemplate,delete t.customdata)}else fe==="candlestick"&&(t={...l,x:O.map(r=>r[E.x]),open:O.map(r=>r[E.open]),high:O.map(r=>r[E.high]),low:O.map(r=>r[E.low]),close:O.map(r=>r[E.close]),increasing:{line:{color:e}},decreasing:{line:{color:_}}});return{...F,data:[...F.data,t]}}function B7({plotlyData:O,open:F,close:J,defaultTitle:fe,updateTitle:Pe,updateAxesTitles:D}){const[E,e]=Un.useState(fe),_=Object.keys(O.layout||{}).filter(m=>m.startsWith("yaxis")&&O.layout[m].range!=null),T=Object.keys(O.layout||{}).filter(m=>{var f;return m.startsWith("xaxis")&&O.layout[m].showticklabels!=null&&((f=O.layout[m])==null?void 0:f.anchor)}),[s,w]=Un.useState({});return Ar(ey,{title:"Chart Titles",description:"Change the titles on the chart.",open:F,close:J,children:ri("div",{id:"popup_title",className:"popup_content",children:[ri("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[ri("div",{children:[Ar("label",{htmlFor:"title_text",children:Ar("b",{children:"Title:"})}),Ar("textarea",{id:"title_text",style:{...Rw,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px",marginLeft:"0px"},rows:2,cols:20,value:E,onChange:m=>e(m.target.value)})]}),Ar("div",{id:"xaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:-5},children:T.map((m,f)=>{var l,t;return ri("div",{style:{marginTop:5,marginBottom:5},children:[Ar("label",{htmlFor:`title_${m}`,children:f===0?Ar("b",{children:"X axis:"}):ri("b",{children:["X axis ",f+1,":"]})}),Ar("input",{id:`title_${m}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=O==null?void 0:O.layout[m])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{w({...s,[m]:i.target.value})}})]},m)})}),Ar("div",{id:"yaxis_div",className:"csv_column_container",style:{marginTop:5,marginBottom:5},children:_.map((m,f)=>{var l,t;return ri("div",{style:{marginTop:10},children:[Ar("label",{htmlFor:`title_${m}`,children:f===0?Ar("b",{children:"Y axis:"}):ri("b",{children:["Y axis ",f+1,":"]})}),Ar("input",{id:`title_${m}`,style:{marginLeft:"0px",padding:"5px 2px 2px 5px"},type:"text",defaultValue:((t=(l=O==null?void 0:O.layout[m])==null?void 0:l.title)==null?void 0:t.text)||"",onChange:i=>{w({...s,[m]:i.target.value})}})]},m)})})]}),ri("div",{style:{float:"right",marginTop:20},children:[Ar("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:J,children:"Cancel"}),Ar("button",{className:"_btn ph-capture",id:"title_submit",onClick:()=>{Pe(E),D(s),J()},children:"Submit"})]})]})})}const Bb={padding:"5px 2px 2px 5px",margin:"2px 0"};function N7({open:O,close:F,addAnnotation:J,deleteAnnotation:fe,popupData:Pe}){var l,t,i,r,n;const D={text:"",color:"#0088CC",size:18,bordercolor:"#822661",yanchor:"above"},[E,e]=Un.useState(D),[_,T]=Un.useState(D);Pe&&Pe!==E&&Pe.annotation&&(Pe.annotation=(Pe==null?void 0:Pe.annotation)||{},e(Pe),T(Pe));function s(){console.log("closing"),e(D),T(D),F()}function w(o){console.log(o.target.id.replace("addtext_",""),o.target.value);const a=o.target.id.replace("addtext_",""),u=o.target.value;T({..._,[a]:u})}function m(){console.log("submitting",_),_.text!==""?(E!=null&&E.annotation&&T({..._,annotation:E.annotation}),J(_),F()):(document.getElementById("popup_textarea_warning").style.display="block",document.getElementById("addtext_text").style.border="1px solid red")}function f(){fe(E),s()}return Ar(ey,{title:"Add Text to Chart",description:"Change the titles on the chart.",open:O,close:s,children:ri("div",{id:"popup_title",className:"popup_content",children:[ri("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[ri("div",{style:{marginBottom:20},children:[ri("label",{htmlFor:"popup_text",children:[Ar("b",{children:"Text:"}),Ar("div",{id:"popup_textarea_warning",className:"popup_warning",children:"Text is required"})]}),Ar("textarea",{id:"addtext_text",style:{...Bb,width:"100%",maxWidth:"100%",maxHeight:"200px",marginTop:"8px"},rows:4,cols:50,placeholder:"Enter text here",onChange:w,defaultValue:((l=E==null?void 0:E.annotation)==null?void 0:l.text)||(_==null?void 0:_.text)})]}),ri("div",{style:{display:"flex",gap:15,alignItems:"center",flexWrap:"wrap",columnCount:2,justifyContent:"space-between",marginBottom:20},children:[Ar("label",{htmlFor:"addtext_color",children:Ar("b",{children:"Font color"})}),Ar("input",{type:"color",id:"addtext_color",style:{margin:"2px 2px 2px 15px"},defaultValue:((t=E==null?void 0:E.annotation)==null?void 0:t.color)||(_==null?void 0:_.color),onChange:w}),Ar("label",{htmlFor:"addtext_bordercolor",style:{marginLeft:20},children:Ar("b",{children:"Border color"})}),Ar("input",{type:"color",id:"addtext_bordercolor",style:{margin:"2px 2px 10px 15px"},defaultValue:((i=E==null?void 0:E.annotation)==null?void 0:i.bordercolor)||(_==null?void 0:_.bordercolor),onChange:w}),Ar("label",{htmlFor:"addtext_size",children:Ar("b",{children:"Font size"})}),Ar("input",{style:{...Bb,width:"52px",margin:"0px 0px 0px 2px"},type:"number",id:"addtext_size",onChange:w,defaultValue:((r=E==null?void 0:E.annotation)==null?void 0:r.size)||(_==null?void 0:_.size)}),ri("div",{children:[Ar("label",{htmlFor:"addtext_yanchor",style:{marginRight:31},children:Ar("b",{children:"Position"})}),ri("select",{id:"addtext_yanchor",name:"yanchor",style:{width:"100px"},defaultValue:((n=E==null?void 0:E.annotation)==null?void 0:n.yanchor)||(_==null?void 0:_.yanchor),onChange:w,children:[Ar("option",{value:"above",children:"Above"}),Ar("option",{value:"below",children:"Below"})]})]})]})]}),ri("div",{style:{float:"right",marginTop:20},children:[Ar("button",{className:"_btn-tertiary ph-capture",id:"title_cancel",onClick:s,children:"Cancel"}),Ar("button",{className:"_btn ph-capture",id:"title_delete",onClick:f,children:"Delete"}),Ar("button",{className:"_btn ph-capture",id:"title_submit",onClick:m,children:"Submit"})]})]})})}function j7({plotData:O,popup_data:F,current_text:J}){var _;let fe=F.x,Pe=F.y,D=F.yref,E=((_=O==null?void 0:O.layout)==null?void 0:_.annotations)||[],e=-1;for(let T=0;T<E.length;T++)if(E[T].x==fe&&E[T].y==Pe&&E[T].text==J){e=T;break}if(F.high!=null&&(Pe=F.yanchor=="above"?F.high:F.low),e==-1){let T={x:fe,y:Pe,xref:"x",yref:D,xanchor:"center",text:F.text,showarrow:!0,arrowhead:2,arrowsize:1,arrowwidth:2,ax:fe,ay:Pe+F.yshift,ayref:D,axref:"x",bordercolor:F.bordercolor,bgcolor:"#000000",borderwidth:2,borderpad:4,opacity:.8,font:{color:F.color,size:F.size},clicktoshow:"onoff",captureevents:!0,high:F.high||void 0,low:F.low||void 0};E.push(T)}else E[e].y=Pe,E[e].text=F.text,E[e].font.color=F.color,E[e].font.size=F.size,E[e].ay=Pe+F.yshift,E[e].bordercolor=F.bordercolor,E[e].high=F.high||void 0,E[e].low=F.low||void 0;return{annotations:E,annotation:E[e]}}function Nb({plotData:O,popup_data:F,current_text:J}){console.log("plot_text: current_text",J);let fe,Pe=F.yref.replace("y","yaxis"),D=O.layout[Pe].range,E=(D[1]-D[0])*.2;F.yanchor=="below"&&(E=-E),F.yshift=E,fe=j7({plotData:O,popup_data:F,current_text:J});let e={annotations:fe.annotations,dragmode:"pan"};return e[Pe+".type"]="linear",{update:e,annotation:fe.annotation}}function U7({plotData:O,popupData:F,setPlotData:J,setModal:fe,setOnAnnotationClick:Pe,setAnnotations:D,onAnnotationClick:E,ohlcAnnotation:e,setOhlcAnnotation:_,annotations:T,plotDiv:s}){if(F.text!=null&&F.text!=""){let w=function(l){var u,p,c,b,d,v;console.log("plotly_click",l);let t=l.points[0].x,i=l.points[0].fullData.yaxis,r=0,n,o;l.points[0].y!=null?r=l.points[0].y:l.points[0].low!=null&&(n=l.points[0].high,o=l.points[0].low,(m==null?void 0:m.yanchor)=="below"?r=l.points[0].low:r=l.points[0].high),m={x:((u=E==null?void 0:E.annotation)==null?void 0:u.x)??t,y:((p=E==null?void 0:E.annotation)==null?void 0:p.y)??r,yref:((c=E==null?void 0:E.annotation)==null?void 0:c.yref)??i,high:((b=E==null?void 0:E.annotation)==null?void 0:b.high)??n,low:((d=E==null?void 0:E.annotation)==null?void 0:d.low)??o,...F},n!=null&&(e.push(m),_(e),console.log("ohlcAnnotation",e));let a=Nb({plotData:O,popup_data:m,current_text:(v=E==null?void 0:E.annotation)==null?void 0:v.text});D([...T,a.annotation].filter(x=>x!=null)),O.layout.dragmode="pan",J({...O,...a.update}),s.removeAllListeners("plotly_click")};F.text=F.text.replace(/\n/g,"<br>");let m,f=!1;if(F.annotation){console.log("data",F),m={x:F.annotation.x,y:F.annotation.y,yref:F.annotation.yref,yanchor:F.annotation.y<F.annotation.ay?"above":"below",...F},F.annotation.high!=null&&(f=!0),console.log("popup_data",m);let l=Nb({plotData:O,popup_data:m,current_text:F.annotation.text});if(f){let t=e.findIndex(i=>i.x==F.annotation.x&&i.y==F.annotation.y&&i.yref==F.annotation.yref);console.log("ohlcAnnotationIndex",t),t==-1?_([...e,l.annotation]):(e[t]=l.annotation,_(e))}D([...T,l.annotation].filter(t=>t!=null)),O.layout.dragmode="pan",J({...O,...l.update}),Pe({});return}s.on("plotly_clickannotation",l=>{console.log("plotly_clickannotation",l);let t=l.annotation;if(t.text==null){console.log("annotation.text is undefined");return}console.log("annotation.text",t.text),t.text=t.text.replace(/<br>/g,`
`);let i={x:t.x,y:t.y,high:(t==null?void 0:t.high)??void 0,low:(t==null?void 0:t.low)??void 0,yanchor:t.y<t.ay?"above":"below",text:t.text,color:t.font.color,size:t.font.size,bordercolor:t.bordercolor,annotation:t};console.log("popup_data_clickannotation",i),Pe(i),fe({name:"textDialog",data:i}),Pe({})}),O.layout.dragmode="select",J({...O}),s.on("plotly_click",w)}}function Gv(){return Gv=Object.assign?Object.assign.bind():function(O){for(var F=1;F<arguments.length;F++){var J=arguments[F];for(var fe in J)Object.prototype.hasOwnProperty.call(J,fe)&&(O[fe]=J[fe])}return O},Gv.apply(this,arguments)}var zw=["shift","alt","meta","mod","ctrl"],V7={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function sc(O){return(V7[O]||O).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function H7(O){return zw.includes(O)}function Fg(O,F){return F===void 0&&(F=","),O.split(F)}function Bg(O,F,J){F===void 0&&(F="+");var fe=O.toLocaleLowerCase().split(F).map(function(E){return sc(E)}),Pe={alt:fe.includes("alt"),ctrl:fe.includes("ctrl")||fe.includes("control"),shift:fe.includes("shift"),meta:fe.includes("meta"),mod:fe.includes("mod")},D=fe.filter(function(E){return!zw.includes(E)});return Gv({},Pe,{keys:D,description:J})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(O){O.key!==void 0&&Dw([sc(O.key),sc(O.code)])}),document.addEventListener("keyup",function(O){O.key!==void 0&&Fw([sc(O.key),sc(O.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){lc.clear()})})();var lc=new Set;function q7(O,F){F===void 0&&(F=",");var J=Array.isArray(O)?O:O.split(F);return J.every(function(fe){return lc.has(fe.trim().toLowerCase())})}function Dw(O){var F=Array.isArray(O)?O:[O];lc.has("meta")&&lc.forEach(function(J){return!H7(J)&&lc.delete(J.toLowerCase())}),F.forEach(function(J){return lc.add(J.toLowerCase())})}function Fw(O){var F=Array.isArray(O)?O:[O];O==="meta"?lc.clear():F.forEach(function(J){return lc.delete(J.toLowerCase())})}function G7(O,F,J){(typeof J=="function"&&J(O,F)||J===!0)&&O.preventDefault()}function W7(O,F,J){return typeof J=="function"?J(O,F):J===!0||J===void 0}function Z7(O){return Bw(O,["input","textarea","select"])}function Bw(O,F){var J=O.target;F===void 0&&(F=!1);var fe=J&&J.tagName;return F instanceof Array?!!(fe&&F&&F.some(function(Pe){return Pe.toLowerCase()===fe.toLowerCase()})):!!(fe&&F&&F===!0)}function Y7(O,F){return O.length===0&&F?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):F?O.some(function(J){return F.includes(J)})||O.includes("*"):!0}var X7=function(F,J,fe){fe===void 0&&(fe=!1);var Pe=J.alt,D=J.meta,E=J.mod,e=J.shift,_=J.ctrl,T=J.keys,s=F.key,w=F.code,m=F.ctrlKey,f=F.metaKey,l=F.shiftKey,t=F.altKey,i=sc(w),r=s.toLowerCase();if(!fe){if(Pe===!t&&r!=="alt"||e===!l&&r!=="shift")return!1;if(E){if(!f&&!m)return!1}else if(D===!f&&r!=="meta"&&r!=="os"||_===!m&&r!=="ctrl"&&r!=="control")return!1}return T&&T.length===1&&(T.includes(r)||T.includes(i))?!0:T?q7(T):!T},$7=Un.createContext(void 0),J7=function(){return Un.useContext($7)};function Nw(O,F){return O&&F&&typeof O=="object"&&typeof F=="object"?Object.keys(O).length===Object.keys(F).length&&Object.keys(O).reduce(function(J,fe){return J&&Nw(O[fe],F[fe])},!0):O===F}var K7=Un.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Q7=function(){return Un.useContext(K7)};function e9(O){var F=Un.useRef(void 0);return Nw(F.current,O)||(F.current=O),F.current}var jb=function(F){F.stopPropagation(),F.preventDefault(),F.stopImmediatePropagation()},t9=typeof window<"u"?Un.useLayoutEffect:Un.useEffect;function Ku(O,F,J,fe){var Pe=Un.useRef(null),D=Un.useRef(!1),E=J instanceof Array?fe instanceof Array?void 0:fe:J,e=O instanceof Array?O.join(E==null?void 0:E.splitKey):O,_=J instanceof Array?J:fe instanceof Array?fe:void 0,T=Un.useCallback(F,_??[]),s=Un.useRef(T);_?s.current=T:s.current=F;var w=e9(E),m=Q7(),f=m.enabledScopes,l=J7();return t9(function(){if(!((w==null?void 0:w.enabled)===!1||!Y7(f,w==null?void 0:w.scopes))){var t=function(a,u){var p;if(u===void 0&&(u=!1),!(Z7(a)&&!Bw(a,w==null?void 0:w.enableOnFormTags))&&!(w!=null&&w.ignoreEventWhen!=null&&w.ignoreEventWhen(a))){if(Pe.current!==null&&document.activeElement!==Pe.current&&!Pe.current.contains(document.activeElement)){jb(a);return}(p=a.target)!=null&&p.isContentEditable&&!(w!=null&&w.enableOnContentEditable)||Fg(e,w==null?void 0:w.splitKey).forEach(function(c){var b,d=Bg(c,w==null?void 0:w.combinationKey);if(X7(a,d,w==null?void 0:w.ignoreModifiers)||(b=d.keys)!=null&&b.includes("*")){if(u&&D.current)return;if(G7(a,d,w==null?void 0:w.preventDefault),!W7(a,d,w==null?void 0:w.enabled)){jb(a);return}s.current(a,d),u||(D.current=!0)}})}},i=function(a){a.key!==void 0&&(Dw(sc(a.code)),((w==null?void 0:w.keydown)===void 0&&(w==null?void 0:w.keyup)!==!0||w!=null&&w.keydown)&&t(a))},r=function(a){a.key!==void 0&&(Fw(sc(a.code)),D.current=!1,w!=null&&w.keyup&&t(a,!0))},n=Pe.current||(E==null?void 0:E.document)||document;return n.addEventListener("keyup",r),n.addEventListener("keydown",i),l&&Fg(e,w==null?void 0:w.splitKey).forEach(function(o){return l.addHotkey(Bg(o,w==null?void 0:w.combinationKey,w==null?void 0:w.description))}),function(){n.removeEventListener("keyup",r),n.removeEventListener("keydown",i),l&&Fg(e,w==null?void 0:w.splitKey).forEach(function(o){return l.removeHotkey(Bg(o,w==null?void 0:w.combinationKey,w==null?void 0:w.description))})}}},[e,w,f]),Pe}var jw={exports:{}};(function(O){(function(F){var J=o(),fe=a(),Pe=u(),D=p(),E={imagePlaceholder:void 0,cacheBust:!1},e={toSvg:_,toPng:s,toJpeg:w,toBlob:m,toPixelData:T,impl:{fontFaces:Pe,images:D,util:J,inliner:fe,options:{}}};O.exports=e;function _(c,b){return b=b||{},f(b),Promise.resolve(c).then(function(v){return t(v,b.filter,!0)}).then(i).then(r).then(d).then(function(v){return n(v,b.width||J.width(c),b.height||J.height(c))});function d(v){return b.bgcolor&&(v.style.backgroundColor=b.bgcolor),b.width&&(v.style.width=b.width+"px"),b.height&&(v.style.height=b.height+"px"),b.style&&Object.keys(b.style).forEach(function(x){v.style[x]=b.style[x]}),v}}function T(c,b){return l(c,b||{}).then(function(d){return d.getContext("2d").getImageData(0,0,J.width(c),J.height(c)).data})}function s(c,b){return l(c,b||{}).then(function(d){return d.toDataURL()})}function w(c,b){return b=b||{},l(c,b).then(function(d){return d.toDataURL("image/jpeg",b.quality||1)})}function m(c,b){return l(c,b||{}).then(J.canvasToBlob)}function f(c){typeof c.imagePlaceholder>"u"?e.impl.options.imagePlaceholder=E.imagePlaceholder:e.impl.options.imagePlaceholder=c.imagePlaceholder,typeof c.cacheBust>"u"?e.impl.options.cacheBust=E.cacheBust:e.impl.options.cacheBust=c.cacheBust}function l(c,b){return _(c,b).then(J.makeImage).then(J.delay(100)).then(function(v){var x=d(c);return x.getContext("2d").drawImage(v,0,0),x});function d(v){var x=document.createElement("canvas");if(x.width=b.width||J.width(v),x.height=b.height||J.height(v),b.bgcolor){var g=x.getContext("2d");g.fillStyle=b.bgcolor,g.fillRect(0,0,x.width,x.height)}return x}}function t(c,b,d){if(!d&&b&&!b(c))return Promise.resolve();return Promise.resolve(c).then(v).then(function(y){return x(c,y,b)}).then(function(y){return g(c,y)});function v(y){return y instanceof HTMLCanvasElement?J.makeImage(y.toDataURL()):y.cloneNode(!1)}function x(y,k,h){var M=y.childNodes;if(M.length===0)return Promise.resolve(k);return A(k,J.asArray(M),h).then(function(){return k});function A(C,L,P){var I=Promise.resolve();return L.forEach(function(R){I=I.then(function(){return t(R,P)}).then(function(U){U&&C.appendChild(U)})}),I}}function g(y,k){if(!(k instanceof Element))return k;return Promise.resolve().then(h).then(M).then(A).then(C).then(function(){return k});function h(){L(window.getComputedStyle(y),k.style);function L(P,I){P.cssText?I.cssText=P.cssText:R(P,I);function R(U,B){J.asArray(U).forEach(function(G){B.setProperty(G,U.getPropertyValue(G),U.getPropertyPriority(G))})}}}function M(){[":before",":after"].forEach(function(P){L(P)});function L(P){var I=window.getComputedStyle(y,P),R=I.getPropertyValue("content");if(R===""||R==="none")return;var U=J.uid();k.className=k.className+" "+U;var B=document.createElement("style");B.appendChild(G(U,P,I)),k.appendChild(B);function G(N,j,V){var H="."+N+":"+j,ee=V.cssText?Q(V):X(V);return document.createTextNode(H+"{"+ee+"}");function Q(Y){var K=Y.getPropertyValue("content");return Y.cssText+" content: "+K+";"}function X(Y){return J.asArray(Y).map(K).join("; ")+";";function K(te){return te+": "+Y.getPropertyValue(te)+(Y.getPropertyPriority(te)?" !important":"")}}}}}function A(){y instanceof HTMLTextAreaElement&&(k.innerHTML=y.value),y instanceof HTMLInputElement&&k.setAttribute("value",y.value)}function C(){k instanceof SVGElement&&(k.setAttribute("xmlns","http://www.w3.org/2000/svg"),k instanceof SVGRectElement&&["width","height"].forEach(function(L){var P=k.getAttribute(L);P&&k.style.setProperty(L,P)}))}}}function i(c){return Pe.resolveAll().then(function(b){var d=document.createElement("style");return c.appendChild(d),d.appendChild(document.createTextNode(b)),c})}function r(c){return D.inlineAll(c).then(function(){return c})}function n(c,b,d){return Promise.resolve(c).then(function(v){return v.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(v)}).then(J.escapeXhtml).then(function(v){return'<foreignObject x="0" y="0" width="100%" height="100%">'+v+"</foreignObject>"}).then(function(v){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+b+'" height="'+d+'">'+v+"</svg>"}).then(function(v){return"data:image/svg+xml;charset=utf-8,"+v})}function o(){return{escape:C,parseExtension:b,mimeType:d,dataAsUrl:A,isDataUrl:v,canvasToBlob:g,resolveUrl:y,getAndEncode:M,uid:k(),delay:L,asArray:P,escapeXhtml:I,makeImage:h,width:R,height:U};function c(){var G="application/font-woff",N="image/jpeg";return{woff:G,woff2:G,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:N,jpeg:N,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function b(G){var N=/\.([^\.\/]*?)$/g.exec(G);return N?N[1]:""}function d(G){var N=b(G).toLowerCase();return c()[N]||""}function v(G){return G.search(/^(data:)/)!==-1}function x(G){return new Promise(function(N){for(var j=window.atob(G.toDataURL().split(",")[1]),V=j.length,H=new Uint8Array(V),ee=0;ee<V;ee++)H[ee]=j.charCodeAt(ee);N(new Blob([H],{type:"image/png"}))})}function g(G){return G.toBlob?new Promise(function(N){G.toBlob(N)}):x(G)}function y(G,N){var j=document.implementation.createHTMLDocument(),V=j.createElement("base");j.head.appendChild(V);var H=j.createElement("a");return j.body.appendChild(H),V.href=N,H.href=G,H.href}function k(){var G=0;return function(){return"u"+N()+G++;function N(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}}function h(G){return new Promise(function(N,j){var V=new Image;V.onload=function(){N(V)},V.onerror=j,V.src=G})}function M(G){var N=3e4;return e.impl.options.cacheBust&&(G+=(/\?/.test(G)?"&":"?")+new Date().getTime()),new Promise(function(j){var V=new XMLHttpRequest;V.onreadystatechange=Q,V.ontimeout=X,V.responseType="blob",V.timeout=N,V.open("GET",G,!0),V.send();var H;if(e.impl.options.imagePlaceholder){var ee=e.impl.options.imagePlaceholder.split(/,/);ee&&ee[1]&&(H=ee[1])}function Q(){if(V.readyState===4){if(V.status!==200){H?j(H):Y("cannot fetch resource: "+G+", status: "+V.status);return}var K=new FileReader;K.onloadend=function(){var te=K.result.split(/,/)[1];j(te)},K.readAsDataURL(V.response)}}function X(){H?j(H):Y("timeout of "+N+"ms occured while fetching resource: "+G)}function Y(K){console.error(K),j("")}})}function A(G,N){return"data:"+N+";base64,"+G}function C(G){return G.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")}function L(G){return function(N){return new Promise(function(j){setTimeout(function(){j(N)},G)})}}function P(G){for(var N=[],j=G.length,V=0;V<j;V++)N.push(G[V]);return N}function I(G){return G.replace(/#/g,"%23").replace(/\n/g,"%0A")}function R(G){var N=B(G,"border-left-width"),j=B(G,"border-right-width");return G.scrollWidth+N+j}function U(G){var N=B(G,"border-top-width"),j=B(G,"border-bottom-width");return G.scrollHeight+N+j}function B(G,N){var j=window.getComputedStyle(G).getPropertyValue(N);return parseFloat(j.replace("px",""))}}function a(){var c=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:x,shouldProcess:b,impl:{readUrls:d,inline:v}};function b(g){return g.search(c)!==-1}function d(g){for(var y=[],k;(k=c.exec(g))!==null;)y.push(k[1]);return y.filter(function(h){return!J.isDataUrl(h)})}function v(g,y,k,h){return Promise.resolve(y).then(function(A){return k?J.resolveUrl(A,k):A}).then(h||J.getAndEncode).then(function(A){return J.dataAsUrl(A,J.mimeType(y))}).then(function(A){return g.replace(M(y),"$1"+A+"$3")});function M(A){return new RegExp(`(url\\(['"]?)(`+J.escape(A)+`)(['"]?\\))`,"g")}}function x(g,y,k){if(h())return Promise.resolve(g);return Promise.resolve(g).then(d).then(function(M){var A=Promise.resolve(g);return M.forEach(function(C){A=A.then(function(L){return v(L,C,y,k)})}),A});function h(){return!b(g)}}}function u(){return{resolveAll:c,impl:{readAll:b}};function c(){return b().then(function(d){return Promise.all(d.map(function(v){return v.resolve()}))}).then(function(d){return d.join(`
`)})}function b(){return Promise.resolve(J.asArray(document.styleSheets)).then(v).then(d).then(function(g){return g.map(x)});function d(g){return g.filter(function(y){return y.type===CSSRule.FONT_FACE_RULE}).filter(function(y){return fe.shouldProcess(y.style.getPropertyValue("src"))})}function v(g){var y=[];return g.forEach(function(k){try{J.asArray(k.cssRules||[]).forEach(y.push.bind(y))}catch(h){console.log("Error while reading CSS rules from "+k.href,h.toString())}}),y}function x(g){return{resolve:function(){var k=(g.parentStyleSheet||{}).href;return fe.inlineAll(g.cssText,k)},src:function(){return g.style.getPropertyValue("src")}}}}}function p(){return{inlineAll:b,impl:{newImage:c}};function c(d){return{inline:v};function v(x){return J.isDataUrl(d.src)?Promise.resolve():Promise.resolve(d.src).then(x||J.getAndEncode).then(function(g){return J.dataAsUrl(g,J.mimeType(d.src))}).then(function(g){return new Promise(function(y,k){d.onload=y,d.onerror=k,d.src=g})})}}function b(d){if(!(d instanceof Element))return Promise.resolve(d);return v(d).then(function(){return d instanceof HTMLImageElement?c(d).inline():Promise.all(J.asArray(d.childNodes).map(function(x){return b(x)}))});function v(x){var g=x.style.getPropertyValue("background");return g?fe.inlineAll(g).then(function(y){x.style.setProperty("background",y,x.style.getPropertyPriority("background"))}).then(function(){return x}):Promise.resolve(x)}}}})()})(jw);var n9=jw.exports;const Uw=jp(n9),r9=async({fileHandle:O,blob:F})=>{if(O)return i9({fileHandle:O,blob:F})},i9=async({fileHandle:O,blob:F})=>{const J=await O.createWritable();await J.write(F),await J.close()},a9=[{description:"PNG Image",accept:{"image/png":[".png"]}},{description:"JPEG Image",accept:{"image/jpeg":[".jpeg"]}},{description:"SVG Image",accept:{"image/svg+xml":[".svg"]}}],Vw=({filename:O,is_image:F})=>{if("showSaveFilePicker"in window){const J={suggestedName:O,types:F?a9:[{description:"CSV File",accept:{"image/csv":[".csv"]}}],excludeAcceptAllOption:!0};return showSaveFilePicker(J)}return new Promise(J=>{J(null)})},ty=(O,F,J)=>{try{if(J===null)throw new Error("Cannot access filesystem");return r9({fileHandle:J,blob:O})}catch(fe){console.error("oops, something went wrong!",fe);const Pe=URL.createObjectURL(O),D=document.createElement("a");D.setAttribute("href",Pe),D.setAttribute("download",F),D.style.visibility="hidden",document.body.appendChild(D),D.click(),document.body.removeChild(D)}return new Promise(fe=>{fe(!0)})};async function Ub(O){let F=O.data,J=[],fe=[],Pe="title"in O.layout.xaxis&&O.layout.xaxis.title.text!=null?O.layout.xaxis.title.text:"x",D="title"in O.layout.yaxis&&O.layout.yaxis.title.text!=null?O.layout.yaxis.title.text:"y";return F.forEach(function(E){E.type=="candlestick"&&(J.length==0&&(J=["Date","Open","High","Low","Close"]),E.x.forEach(function(e,_){fe.push([e,E.open[_],E.high[_],E.low[_],E.close[_]])})),E.type=="scatter"&&(J.length==0&&J.push(Pe),J.push(E.name!=null?E.name:D),E.x.forEach(function(e,_){fe[_]==null&&(fe[_]=[e]),fe[_].push(E.y[_])}))}),await o9(J,fe)}async function o9(O,F){const J=O,fe=F.map(_=>_.map(T=>T==null?"":typeof T=="object"?JSON.stringify(T):T.toString().replace(/"/g,'""'))),D=[J,...fe].map(_=>_.join(",")).join(`
-`),E=new Blob([D],{type:"text/csv;charset=utf-8;"}),e=`${window.title}.csv`;try{let _=await Vw({filename:e}),T="png";_!==null&&(T=_.name.split(".").pop()),await Bp(`Saving ${T.toUpperCase()}`),Np(async function(){ty(E,e,_).then(async function(){await Bp("",!0)})},2)()}catch(_){console.error(_)}}function Bp(O,F){const J=window.document.getElementById("loading"),fe=window.document.getElementById("loading_text");return new Promise(Pe=>{F?J.classList.remove("show"):(fe.innerHTML=O,J.classList.add("show"));let D=setInterval(function(){(F?!J.classList.contains("show"):J.classList.contains("show"))&&(clearInterval(D),Pe(!0))},.1)})}const Np=(O,F)=>{let J;return function(){const fe=this,Pe=arguments;clearTimeout(J),J=setTimeout(()=>O.apply(fe,Pe),F)}},s9={yref:"paper",xref:"paper",x:1,y:0,text:"OpenBB Terminal",font_size:17,font_color:"gray",opacity:.5,xanchor:"right",yanchor:"bottom",yshift:-80,xshift:40};async function Vb(O,F,J=!1){const fe=document.getElementById("plotlyChart");J&&(fe.layout.annotations.push(s9),fe.globals.cmd_idx!=null&&fe.globals.cmd_src!=null&&(fe.layout.annotations[fe.globals.cmd_idx].text=fe.globals.cmd_src),Gs.relayout(fe,{"title.text":fe.globals.title,margin:fe.globals.old_margin})),J||(fe.globals.cmd_idx!=null&&fe.globals.cmd_src!=null&&(fe.layout.annotations[fe.globals.cmd_idx].text=""),fe.layout.annotations.splice(F,1),Gs.relayout(fe,{"title.text":"",margin:O}))}async function Hw(O,F,J){const fe=document.getElementById(O);if(["svg","pdf"].includes(J)){const Pe=document.getElementById("plotlyChart"),D=Pe.layout.margin,E=Pe.layout.annotations.length;await Vb(D,E,!0),Gs.downloadImage(Pe,{format:"svg",height:Pe.clientHeight,width:Pe.clientWidth,filename:window.title}),await Vb(D,E,!1),await Bp("",!0);return}Np(async function(){Uw.toBlob(fe).then(function(Pe){ty(Pe,F,null)})},2)()}async function Hb(O,F,J){const fe=document.getElementById(O),Pe=`${window.title}.png`;try{J(!0);let D=await Vw({filename:Pe,is_image:!0}),E="png";if(D!==null&&(E=D.name.split(".").pop()),await Bp(`Saving ${E.toUpperCase()}`),["svg","pdf"].includes(E)){await Hw(O,Pe,E),F(!1),J(!1);return}Np(async function(){Uw.toBlob(fe).then(function(e){ty(e,Pe,D).then(async function(){await Bp("",!0),F(!1),J(!1)})})},2)()}catch(D){console.error(D),F(!1),J(!1)}}function rc(O=!0){return new Promise(F=>{window.MODEBAR||(window.MODEBAR=window.document.getElementsByClassName("modebar-container")[0],window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`),window.MODEBAR&&(window.MODEBAR.style.cssText.includes("display: none")&&!O?window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:flex;`:window.MODEBAR.style.cssText=`${window.MODEBAR.style.cssText}; display:none;`,F(!0))})}function l9({setModal:O,changeTheme:F,autoScaling:J,Loading:fe,changeColor:Pe}){return Ku("ctrl+shift+t",()=>{O({name:"titleDialog"})},{preventDefault:!0}),Ku("ctrl+t",()=>{O({name:"textDialog"})},{preventDefault:!0}),Ku("ctrl+o",()=>{O({name:"overlayChart"})},{preventDefault:!0}),Ku("ctrl+shift+h",()=>{rc()},{preventDefault:!0}),Ku("ctrl+e",()=>{Pe(!0)},{preventDefault:!0}),Ku("ctrl+shift+s",async()=>{O({name:"downloadCsv"}),await Ub(document.getElementById("plotlyChart"))},{preventDefault:!0}),Ku("ctrl+s",async()=>{rc(),Hb("MainChart",rc,fe)},{preventDefault:!0}),Ku("ctrl+w",()=>{window.close()},{preventDefault:!0}),{plotGlPixelRatio:1,scrollZoom:!0,responsive:!0,displaylogo:!1,displayModeBar:!0,modeBarButtonsToRemove:["lasso2d","select2d","downloadImage"],modeBarButtons:[[{name:"Download CSV (Ctrl+Shift+S)",icon:Pu.downloadCsv,click:async function(E){await Ub(E)}},{name:"Download Chart as Image (Ctrl+S)",icon:Pu.downloadImage,click:async function(){rc(),await Hb("MainChart",rc,fe)}}],[{name:"Edit Color (Ctrl+E)",icon:Pu.changeColor,click:function(){Pe(!0)}},"drawline","drawopenpath","drawcircle","drawrect","eraseshape"],[{name:"Overlay chart from CSV (Ctrl+O)",icon:Pu.plotCsv,click:function(){O({name:"overlayChart"})}},{name:"Add Text (Ctrl+T)",icon:Pu.addText,click:function(){O({name:"textDialog",data:{text:""}})}},{name:"Change Titles (Ctrl+Shift+T)",icon:Pu.changeTitle,click:function(){O({name:"titleDialog"})}},{name:"Change Theme",icon:Pu.sunIcon,click:function(){F(!0)}}],["hoverClosestCartesian","hoverCompareCartesian","toggleSpikelines"],[{name:"Auto Scale (Ctrl+Shift+A)",icon:Gs.Icons.autoscale,click:function(){J(!0)}},"zoomIn2d","zoomOut2d","autoScale2d","zoom2d","pan2d"]]}}async function u9(O,F){try{if(O["xaxis.range[0]"]!=null){const J=O["xaxis.range[0]"],fe=O["xaxis.range[1]"];let Pe={},D,E;const e=F.data.filter(s=>s.yaxis!=null),_=[...new Set(e.map(s=>s.yaxis||s.y!=null||s.type=="candlestick"))],T=s=>F.data.filter(w=>w.yaxis==s&&(w.y||w.type=="candlestick"));return _.forEach(s=>{if(typeof s!="string")return;let w="yaxis"+s.replace("y",""),m=[],f=[],l=F.layout[w].type=="log";T(s).forEach(r=>{let n=r.x;l=F.layout[w].type=="log";let o=r.y!=null?r.y:[],a=r.type=="candlestick"?r.low:[],u=r.type=="candlestick"?r.high:[];l&&(o=o.map(Math.log10),r.type=="candlestick"&&(a=r.low.map(Math.log10),u=r.high.map(Math.log10)));let p=n.map((c,b)=>{let d=null;return c>=J&&c<=fe&&(r.y!=null&&(console.log(r.name,r.type,r.yaxis),d=o[b]),r.type=="candlestick"&&(m.push(a[b]),m.push(u[b]))),d});f=f.concat(p)}),f=f.filter(r=>r!=null&&r!=null),D=Math.min(...f),E=Math.max(...f),m.length>0&&(m=m.filter(r=>r!=null&&r!=null),D=Math.min(...m),E=Math.max(...m));let t=E,i=F.layout[w].fixedrange!=null&&F.layout[w].fixedrange==!0;if(D!=null&&E!=null){let r=E-D,n=.15;if(m.length>0&&(n=.3),D-=r*n,E+=r*n,i){if(F.layout[w].tickvals!=null){let a=t,u=-3,p=Math.round(a*.2,u),c=[2,5,6,7,8,9,10],b=[1,4,5,6,7,8,9];for(let x=0;x<c.length;x++)String(a).length>c[x]&&(u=-b[x],p=Math.round(a*.2,u));let d=[Math.floor(p),Math.floor(p*2),Math.floor(p*3),Math.floor(p*4)],v=[0,Math.floor(a*7)];Pe[w+".tickvals"]=d,Pe[w+".range"]=v,Pe[w+".tickformat"]=".2s";return}D=0,E=F.layout[w].range[1]}Pe[w+".range"]=[D,E]}}),Pe}}catch(J){console.log(`Error in AutoScaling: ${J}`)}return{}}async function c9({plotData:O,volumeBars:F,setMaximizePlot:J}){const fe=Object.keys(O.layout).filter(s=>s.startsWith("xaxis")).filter(s=>O.layout[s].showticklabels),Pe=O.data.filter(s=>{var w;return(w=s==null?void 0:s.name)==null?void 0:w.startsWith("Volume")});let D={},E=F||{old_nticks:{}};const e=window.innerWidth,_=window.innerHeight;let T=_>420&&e<920?8:_>420&&e<500?9:7;return e<750?(Pe.forEach(s=>{s.type=="bar"&&(s.opacity=1,s.marker.line.width=.09,F.yaxis==null&&(E.yaxis="yaxis"+s.yaxis.replace("y",""),D[E.yaxis+".tickfont.size"]=T,E.tickfont=O.layout[E.yaxis].tickfont||{},O.layout.margin.l-=40))}),fe.forEach(s=>{var w;((w=E.old_nticks)==null?void 0:w[s])==null&&(D[s+".nticks"]=6,E.old_nticks[s]=O.layout[s].nticks||10)}),J(!0),await rc()):window.MODEBAR.style.cssText.includes("display: none")&&(await rc(!1),J(!1),F.old_nticks!=null&&fe.forEach(s=>{E.old_nticks[s]!=null&&(D[s+".nticks"]=E.old_nticks[s],E.old_nticks[s]=void 0)}),F.yaxis!=null&&Pe.forEach(s=>{s.type=="bar"&&(s.opacity=.5,s.marker.line.width=.2,D[E.yaxis+".tickfont.size"]=E.tickfont.size+3,O.layout.margin.l+=40,E.yaxis=void 0)})),{volume_update:E,layout_update:D,plotData:O}}function f9({open:O,onColorChange:F}){const[J,fe]=Un.useState(!1);function Pe(D){F(D)}return O&&!J&&fe(!0),!O&&J&&fe(!1),Un.useEffect(()=>{if(J){let D=function(e){let _=0,T=0,s=0,w=0;document.getElementById(e.id+"_header")?document.getElementById(e.id+"_header").onmousedown=m:e.onmousedown=m;function m(t){t=t||window.event,t.preventDefault(),s=t.clientX,w=t.clientY,document.onmouseup=l,document.onmousemove=f}function f(t){t=t||window.event,t.preventDefault(),_=s-t.clientX,T=w-t.clientY,s=t.clientX,w=t.clientY,e.style.t