@backtest-kit/ui 6.12.2 → 6.12.3

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.
Files changed (28) hide show
  1. package/build/modules/frontend/build/assets/{Article-8KNWLEdt.js → Article-9TDQbS0T.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-Cg_pRnA2.js → Background-nO-4foIa.js} +1 -1
  3. package/build/modules/frontend/build/assets/{Container-B3L78b74.js → Container-BGTlo02r.js} +1 -1
  4. package/build/modules/frontend/build/assets/{IconPhoto-BdOC0CVV.js → IconPhoto-5_2d-bBc.js} +1 -1
  5. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-CRSPaoDv.js → KeyboardArrowLeft-DUJytPqw.js} +1 -1
  6. package/build/modules/frontend/build/assets/{Refresh-pgeEdZyY.js → Refresh-BFyPvfwJ.js} +1 -1
  7. package/build/modules/frontend/build/assets/emitters-DpvJRxnx.js +1 -0
  8. package/build/modules/frontend/build/assets/{hasRouteMatch-DUJkFZih.js → hasRouteMatch-CVsEvBzR.js} +1 -1
  9. package/build/modules/frontend/build/assets/{html2canvas-BOxZT7Pg.js → html2canvas-0TVGdzy3.js} +1 -1
  10. package/build/modules/frontend/build/assets/index-B832nwyB.js +1 -0
  11. package/build/modules/frontend/build/assets/{index-DfvxJO7G.js → index-B_EC3qcg.js} +1 -1
  12. package/build/modules/frontend/build/assets/index-C260rnVv.js +1 -0
  13. package/build/modules/frontend/build/assets/{index-B0xWR_Ua.js → index-CAR4R7tN.js} +9 -9
  14. package/build/modules/frontend/build/assets/{index-B9MVhnMv.js → index-CHqy_81y.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-BsxQ4WtY.js → index-Ch6-BXU_.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-CdDMwS35.js → index-CrYHDP_r.js} +2 -2
  17. package/build/modules/frontend/build/assets/{index-BFlDvmEL.js → index-DG54IUO9.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-DRPJ-jbK.js → index-DTGZXaOC.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-08mSy1TS.js → index-L0Z2R9_6.js} +1 -1
  20. package/build/modules/frontend/build/assets/index-YhS1hA0O.js +1 -0
  21. package/build/modules/frontend/build/assets/{index.es-qc4_IWw_.js → index.es-dnQ04S4k.js} +1 -1
  22. package/build/modules/frontend/build/index.html +1 -1
  23. package/package.json +1 -1
  24. package/build/modules/frontend/build/assets/emitters-UJbT6Stq.js +0 -1
  25. package/build/modules/frontend/build/assets/index-Bb2L44EK.js +0 -1
  26. package/build/modules/frontend/build/assets/index-d3YCdp1b.js +0 -1
  27. package/build/modules/frontend/build/assets/index-sghtggRw.js +0 -1
  28. package/build/modules/frontend/build/assets/markdownit-BJecoBnP.js +0 -1
@@ -1 +1 @@
1
- import{c,f as v}from"./index-B0xWR_Ua.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
1
+ import{c,f as v}from"./index-CAR4R7tN.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
@@ -1 +1 @@
1
- import{f as n,b6 as o}from"./index-B0xWR_Ua.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
1
+ import{f as n,b7 as o}from"./index-CAR4R7tN.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
@@ -1 +1 @@
1
- import{bf as e,b as t,r as a,_ as s,f as i,bg as n,e as o,bh as r,h as d,bi as m,g as u,u as p,s as x}from"./index-B0xWR_Ua.js";const b=e(),h=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),c=b("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),f=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const g=function(e={}){const{createStyledComponent:r=c,useThemeProps:m=f,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:b,component:l="div",disableGutters:c=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,h),k=t({},r,{component:l,disableGutters:c,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:l,ownerState:k,className:n(S.root,b),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})});export{g as C};
1
+ import{bg as e,b as t,r as a,_ as s,f as i,bh as n,e as o,bi as r,h as d,bj as m,g as u,u as p,s as x}from"./index-CAR4R7tN.js";const b=e(),h=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),c=b("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),f=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const g=function(e={}){const{createStyledComponent:r=c,useThemeProps:m=f,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:b,component:l="div",disableGutters:c=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,h),k=t({},r,{component:l,disableGutters:c,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:l,ownerState:k,className:n(S.root,b),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})});export{g as C};
@@ -1 +1 @@
1
- import{f as e,w as t,B as r,J as s}from"./index-B0xWR_Ua.js";const o=({className:o,symbol:a,style:i,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[a],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:i,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:a,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:i,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
1
+ import{f as e,w as t,B as r,J as s}from"./index-CAR4R7tN.js";const o=({className:o,symbol:a,style:i,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[a],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:i,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:a,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:i,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
@@ -1 +1 @@
1
- import{c as o,f as r}from"./index-B0xWR_Ua.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
1
+ import{c as o,f as r}from"./index-CAR4R7tN.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
@@ -1 +1 @@
1
- import{c as s,f as c}from"./index-B0xWR_Ua.js";const a=s(c("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{a as R};
1
+ import{c as s,f as c}from"./index-CAR4R7tN.js";const a=s(c("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{a as R};
@@ -0,0 +1 @@
1
+ import{V as o}from"./index-CAR4R7tN.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{w as a,bj as e,bk as t}from"./index-B0xWR_Ua.js";const o=(o,r=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>o.includes(a)),r);export{o as h};
1
+ import{w as a,bk as e,bl as t}from"./index-CAR4R7tN.js";const o=(o,r=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>o.includes(a)),r);export{o as h};
@@ -1 +1 @@
1
- import{m as e,bm as t}from"./index-B0xWR_Ua.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
1
+ import{m as e,bm as t}from"./index-CAR4R7tN.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
@@ -0,0 +1 @@
1
+ import{r as e,f as a,P as i,B as r,S as n,ay as t,T as o,ac as l,K as s,al as c,F as d,az as p,M as m,aA as u,aB as b,aC as v,aD as y,at as g,aE as h,aF as k,aG as $,aH as f,aI as x,aJ as S,aK as _,w as C,ao as P,V as w,ap as L,t as A,v as z,aL as E,aM as O,z as F}from"./index-CAR4R7tN.js";import{C as j}from"./Container-BGTlo02r.js";import{R as T}from"./Refresh-BFyPvfwJ.js";import{K as B}from"./KeyboardArrowLeft-DUJytPqw.js";const R=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(S,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(g,{sx:i});case"signal.scheduled":return a(_,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(h,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(f,{sx:i});case"breakeven.available":case"breakeven.commit":return a(x,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(k,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(y,{sx:i});case"error.info":case"error.validation":return a(v,{sx:i});case"error.critical":return a(b,{sx:i});default:return a(u,{sx:i})}},D=e=>{switch(e.type){case"signal.opened":return`${c("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${c("Closed")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"signal.scheduled":return`${c("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${c("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${c("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${c("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${c("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${c("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${c("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${c("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${c("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${c("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${c("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${c("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${c("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${c("Sync Close")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"cancel_scheduled.commit":return`${c("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${c("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${c("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${c("Error")}: ${e.message}`;case"error.validation":return`${c("Validation")}: ${e.message}`;case"error.critical":return`${c("Critical")}: ${e.message}`;default:return c("Unknown")}},I=e=>{switch(e.type){case"signal.opened":return c("Signal Opened");case"signal.closed":return c("Signal Closed");case"signal.scheduled":return c("Signal Scheduled");case"signal.cancelled":return c("Signal Cancelled");case"partial_profit.available":return c("Partial Profit Available");case"partial_profit.commit":return c("Partial Profit Commit");case"partial_loss.available":return c("Partial Loss Available");case"partial_loss.commit":return c("Partial Loss Commit");case"breakeven.available":return c("Breakeven Available");case"breakeven.commit":return c("Breakeven Commit");case"activate_scheduled.commit":return c("Activated Scheduled");case"average_buy.commit":return c("Average Buy");case"trailing_stop.commit":return c("Trailing Stop");case"trailing_take.commit":return c("Trailing Take");case"signal_sync.open":return c("Signal Sync Open");case"signal_sync.close":return c("Signal Sync Close");case"cancel_scheduled.commit":return c("Cancel Scheduled");case"close_pending.commit":return c("Close Pending");case"risk.rejection":return c("Risk Rejection");case"error.info":return c("Info Error");case"error.validation":return c("Validation Error");case"error.critical":return c("Critical Error");default:return c("Unknown")}},U=e=>"symbol"in e,M=e=>"position"in e,W=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,N=e=>"pnlPercentage"in e,H=e=>"level"in e,K=e=>"percentToClose"in e,V=e=>"currentPrice"in e,Y=e=>"duration"in e,q=e=>"closeReason"in e,G=e=>"cancelReason"in e,J=e=>"priceClose"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),Z=e=>"message"in e,ee=e=>"rejectionNote"in e,ae=e=>"activePositionCount"in e,ie=e=>"effectivePriceOpen"in e,re=e=>"totalEntries"in e&&e.totalEntries>1,ne=e=>"originalPriceOpen"in e&&"priceOpen"in e&&e.originalPriceOpen!==e.priceOpen,te=e=>"totalPartials"in e&&e.totalPartials>0,oe=e=>"cost"in e,le=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,se=e.forwardRef(({item:e,className:u,style:b,sx:v},y)=>{const g=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F"}})(e),h=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:u,style:b,ref:y,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":C.layoutService.pickRisk(e.id);break;case"signal.opened":C.layoutService.pickSignalOpened(e.id);break;case"signal.closed":C.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":C.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":C.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":C.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":C.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":C.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":C.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":C.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":C.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":C.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":C.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":C.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":C.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":C.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":C.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":C.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":C.layoutService.pickClosePending(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...v},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:g},children:R(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:D(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:l(h).format("HH:mm DD/MM/YYYY")})]}),a(n,{direction:"row",spacing:1,flexWrap:"wrap",children:[a(s,{size:"small",label:I(e),sx:{background:g,color:"white",fontWeight:500}}),U(e)&&a(s,{size:"small",label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),N(e)&&a(s,{size:"small",label:`PnL: ${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),H(e)&&a(s,{size:"small",label:`${c("Level")}: ${e.level}%`,variant:"outlined"}),K(e)&&a(s,{size:"small",label:`${c("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Y(e)&&a(s,{size:"small",label:`${c("Duration")}: ${e.duration} ${c("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",label:e.closeReason,variant:"outlined",color:"info"}),G(e)&&a(s,{size:"small",label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",label:`${c("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ae(e)&&a(s,{size:"small",label:`${c("Active")}: ${e.activePositionCount}`,variant:"outlined"}),re(e)&&a(s,{size:"small",label:`${c("Entries")}: ${e.totalEntries}`,variant:"outlined"}),te(e)&&a(s,{size:"small",label:`${c("Partials")}: ${e.totalPartials}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",label:`${c("Cost")}: ${e.cost.toFixed(2)}$`,variant:"outlined"}),ie(e)&&a(s,{size:"small",label:`${c("Avg entry")}: ${e.effectivePriceOpen}`,variant:"outlined",color:"warning"}),ne(e)&&a(s,{size:"small",label:`${c("Orig entry")}: ${e.originalPriceOpen}`,variant:"outlined"})]}),W(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Entry"),":"," "]}),e.priceOpen]}),J(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Close"),":"," "]}),e.priceClose]}),V(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Current"),":"," "]}),e.currentPrice]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Take Profit"),":"," "]}),e.priceTakeProfit]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Stop Loss"),":"," "]}),e.priceStopLoss]})]})]}),le(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("PnL Entry"),":"," "]}),e.pnlPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("PnL Exit"),":"," "]}),e.pnlPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:[e.pnlCost>=0?"+":"",e.pnlCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[c("Invested"),":"," "]}),e.pnlEntries.toFixed(2),"$"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(m,{content:e.note})})]}),ee(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),Z(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:g}})]})})})}),ce=[{action:"update-now",label:"Refresh manually",icon:()=>a(F,{icon:T,color:"#4caf50"})}],de=[{type:z.Link,action:"back-action",label:a(B,{sx:{display:"block"}})},{type:z.Link,action:"back-action",label:"Main"},{type:z.Link,action:"back-action",label:"Notifications"}],pe=new w,me=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=P({handler:async(e,a)=>{const i=await C.notificationViewService.getList(),r=L(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>C.layoutService.setAppbarLoader(!0),onLoadEnd:()=>C.layoutService.setAppbarLoader(!1),reloadSubject:pe});return a(j,{children:[a(A,{items:de,actions:ce,onAction:async e=>{"back-action"===e&&C.routerService.push("/"),"update-now"===e&&await pe.next()}}),a(E,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:O,hasMore:i,children:e.map(e=>a(se,{item:e,sx:{mb:1}},e.id))})]})};export{me as NotificationPage,me as default};
@@ -1 +1 @@
1
- import{f as e,aW as t,M as a,B as i,aX as r,aY as o,w as n,aZ as l,a_ as s,aT as c,a$ as d,y as w,z as p,A as h,E as m,aO as k,b0 as g,aq as b,b1 as v,aa as y,b2 as u,b3 as f,at as S,S as x,b4 as _,ad as D,q as V,aQ as N,X as O,t as R,v as L,o as B,H as A,T as P,aR as C,x as $,F as M,K as J,L as j,O as X,i as G,l as F,N as H,R as E,aV as I}from"./index-B0xWR_Ua.js";import{h as z}from"./hasRouteMatch-DUJkFZih.js";import{I as T}from"./IconPhoto-BdOC0CVV.js";import{C as U}from"./Container-B3L78b74.js";import{R as q}from"./Refresh-pgeEdZyY.js";import{K}from"./KeyboardArrowLeft-CRSPaoDv.js";const W=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Q=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Y=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Z=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Z,onAction:s})},te=y(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},y=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:W,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Y,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:y,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(K,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:q,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${j.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:X,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(o)?G(o,.33):F(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(M,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(I,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
1
+ import{f as e,aW as t,M as a,B as i,aX as r,aY as o,w as n,aZ as l,a_ as s,aT as c,a$ as d,y as w,z as p,A as h,E as m,aO as k,b0 as g,aq as b,b1 as v,aa as y,b2 as u,b3 as f,at as S,S as x,b4 as _,ad as D,q as V,aQ as N,X as O,t as R,v as L,o as B,H as A,T as P,aR as C,x as $,F as M,K as J,L as j,O as X,i as G,l as F,N as H,R as E,aV as I}from"./index-CAR4R7tN.js";import{h as z}from"./hasRouteMatch-CVsEvBzR.js";import{I as T}from"./IconPhoto-5_2d-bBc.js";import{C as U}from"./Container-BGTlo02r.js";import{R as q}from"./Refresh-BFyPvfwJ.js";import{K}from"./KeyboardArrowLeft-DUJytPqw.js";const W=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Q=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Y=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Z=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Z,onAction:s})},te=y(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},y=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:W,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Y,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:y,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(K,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:q,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${j.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:X,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(o)?G(o,.33):F(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(M,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(I,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
@@ -0,0 +1 @@
1
+ import{c as e,f as a,r as t,o as n,y as r,F as l,a0 as i,a5 as o,b5 as s,a1 as c,n as d,a4 as h,B as p,T as m,aP as u,b6 as f,I as g,at as x,P as v,aO as b,X as S,w as y,Z as z,V as k,t as L,v as w,aW as C,z as M,aR as N,aV as j}from"./index-CAR4R7tN.js";import{h as H}from"./hasRouteMatch-CVsEvBzR.js";import{B as I}from"./Background-nO-4foIa.js";import{A as F}from"./Article-9TDQbS0T.js";import{R as A}from"./Refresh-BFyPvfwJ.js";import{K as O}from"./KeyboardArrowLeft-DUJytPqw.js";const R=e(a("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight"),V=e(a("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}),"Code"),E=e(a("path",{d:"M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"}),"Folder"),P=e(a("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"}),"FolderOpen"),T=e(a("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}),"Image"),q=e(a("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"}),"InsertDriveFile"),B=e(a("path",{d:"m20.41 8.41-4.83-4.83c-.37-.37-.88-.58-1.41-.58H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.42zM7 7h7v2H7V7zm10 10H7v-2h10v2zm0-4H7v-2h10v2z"}),"TextSnippet");function $(e,a){var t;return!a||(!!e.name.toLowerCase().includes(a.toLowerCase())||((null==(t=e.children)?void 0:t.some(e=>$(e,a)))??!1))}function D(e,a){return e.reduce((e,t)=>$(t,a)?(t.folder?e.push({...t,children:D(t.children??[],a)}):e.push(t),e):e,[])}function W(e){return e.flatMap(e=>e.folder?[e.id,...W(e.children??[])]:[])}function K(e){return e.reduce((e,a)=>e+(a.folder?K(a.children??[]):1),0)}function Q(e,a=[],n){const[r,l]=t.useState(n??""),i=void 0!==n?n:r,o=void 0!==n?()=>{}:l,[s,c]=t.useState(null),[d,h]=t.useState(a),p=t.useMemo(()=>i?D(e,i):e,[i,e]),m=t.useMemo(()=>i?W(p):d,[i,p,d]),u=t.useMemo(()=>K(e),[e]),f=t.useMemo(()=>K(p),[p]);return{query:i,setQuery:o,selected:s,setSelected:c,expanded:m,setExpanded:h,filtered:p,totalFiles:u,visibleFiles:f}}const X=n()(e=>({root:{width:"100%",height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},toolbar:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderBottom:`0.5px solid ${e.palette.divider}`,flexShrink:0},title:{fontSize:13,fontWeight:500},badge:{fontSize:11,background:e.palette.action.hover,border:`0.5px solid ${e.palette.divider}`,borderRadius:10,padding:"2px 8px",color:e.palette.text.secondary},searchRow:{display:"flex",alignItems:"center",gap:4,padding:"5px 8px",borderBottom:`0.5px solid ${e.palette.divider}`,flexShrink:0},searchIcon:{color:e.palette.action.active,fontSize:18,flexShrink:0},searchInput:{flex:1,fontSize:13},treeRoot:{flex:1,overflowY:"auto",padding:0},emptyState:{padding:"24px",textAlign:"center",color:e.palette.text.disabled,fontSize:13},itemIcon:{minWidth:52,display:"flex",alignItems:"center",gap:4},chevron:{fontSize:18,color:e.palette.action.active,transition:"transform 0.15s ease",flexShrink:0},chevronOpen:{transform:"rotate(90deg)"},chevronHidden:{visibility:"hidden"},highlightMark:{background:"#FAC775",color:"#412402",borderRadius:2,padding:"0 1px",fontStyle:"normal"},nestedList:{padding:0}}));function Y(e){switch(e){case"tsx":case"ts":case"js":case"jsx":return a(V,{fontSize:"small",color:"primary"});case"json":return a(r,{fontSize:"small",color:"secondary"});case"md":return a(F,{fontSize:"small",color:"action"});case"css":case"scss":case"html":return a(B,{fontSize:"small",color:"action"});case"png":case"jpg":case"jpeg":case"svg":case"gif":case"ico":return a(T,{fontSize:"small",color:"action"});default:return a(q,{fontSize:"small",color:"action"})}}function Z(e,t,n){if(!t)return e;const r=e.toLowerCase().indexOf(t.toLowerCase());return-1===r?e:a(l,{children:[e.slice(0,r),a("mark",{className:n,children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}const G=({node:e,depth:t,expanded:n,selected:r,query:p,onToggle:m,onSelect:u})=>{const{classes:f,cx:g}=X();if(e.folder){const x=n.includes(e.id);return a(l,{children:[a(i,{dense:!0,disablePadding:!0,children:a(o,{sx:{pl:2*t+1},onClick:()=>{m(e.id),u(e.id,!1)},children:[a(s,{className:f.itemIcon,children:[a(R,{className:g(f.chevron,x&&f.chevronOpen)}),x?a(P,{fontSize:"small",color:"primary"}):a(E,{fontSize:"small",color:"action"})]}),a(c,{primary:Z(e.name,p,f.highlightMark)})]})}),a(d,{in:x,children:a(h,{className:f.nestedList,disablePadding:!0,children:(e.children??[]).map(e=>a(G,{node:e,depth:t+1,expanded:n,selected:r,query:p,onToggle:m,onSelect:u},e.id))})})]})}return a(i,{dense:!0,disablePadding:!0,children:a(o,{sx:{pl:2*t+1},selected:r===e.id,onClick:()=>u(e.id,!0),children:[a(s,{className:f.itemIcon,children:[a(R,{className:g(f.chevron,f.chevronHidden)}),Y(e.ext)]}),a(c,{primary:Z(e.name,p,f.highlightMark)})]})})},J=({nodes:e,onFileOpen:n,initialExpanded:r=[],search:l,onSearchChanged:i})=>{const{classes:o}=X(),{query:s,setQuery:c,selected:d,setSelected:b,expanded:S,setExpanded:y,filtered:z,totalFiles:k,visibleFiles:L}=Q(e,r,l),w=t.useCallback(e=>{c(e),null==i||i(e)},[c,i]),C=t.useCallback(e=>{s||y(S.includes(e)?S.filter(a=>a!==e):[...S,e])},[S,s,y]),M=t.useCallback((e,a)=>{b(e),a&&n&&n(e)},[b,n]);return a(v,{className:o.root,children:[a(p,{className:o.toolbar,children:[a(m,{className:o.title,children:"File Explorer"}),a(m,{className:o.badge,children:[s?`${L} / ${k}`:k," files"]})]}),a(p,{className:o.searchRow,children:[a(u,{className:o.searchIcon}),a(f,{className:o.searchInput,placeholder:"Search files…",value:s,onChange:e=>w(e.target.value),autoComplete:"off"}),s&&a(g,{size:"small",onClick:()=>w(""),"aria-label":"Clear",children:a(x,{fontSize:"small"})})]}),0===z.length?a(p,{className:o.emptyState,children:["No files matching “",s,"”"]}):a(h,{className:o.treeRoot,disablePadding:!0,children:z.map(e=>a(G,{node:e,depth:0,expanded:S,selected:d,query:s,onToggle:C,onSelect:M},e.id))})]})},U=[{type:w.Link,action:"back-action",label:a(O,{sx:{display:"block"}})},{type:w.Link,action:"back-action",label:"Main"},{type:w.Link,action:"back-action",label:"Dump Explorer"}],_=[{action:"update-now",label:"Refresh",icon:()=>a(M,{icon:A,color:"#4caf50"})}];function ee(e){const a=e.lastIndexOf(".");return-1!==a?e.slice(a+1):void 0}function ae(e){return"directory"===e.type?{id:e.id,name:e.label,folder:!0,children:e.nodes.map(ae)}:{id:e.id,name:e.label,ext:ee(e.label)}}const te=new k,ne=({params:e})=>{const[t,n]=b(e.search),[r,{loading:i,execute:o}]=S(async()=>{const{map:e}=await y.explorerViewService.getFolderTree(),a=Object.values(e).filter(a=>"directory"===a.type&&!Object.values(e).some(e=>"directory"===e.type&&e.nodes.some(e=>e.id===a.id)));return a.length?a.map(ae):Object.values(e).map(ae)},{onLoadStart:()=>y.layoutService.setAppbarLoader(!0),onLoadEnd:()=>y.layoutService.setAppbarLoader(!1)});z(()=>te.subscribe(o));return a(l,{children:[a(L,{items:U,actions:_,onAction:e=>{"back-action"===e&&y.routerService.push("/"),"update-now"===e&&(y.explorerViewService.clear(),te.next())}}),a(C,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(p,{pr:2,pl:2,children:i||!r?a(N,{children:a(m,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a(v,{sx:{height:"calc(100vh - 180px)"},children:a(J,{nodes:r,search:t.current,onSearchChanged:e=>n(e),onFileOpen:e=>y.layoutService.pickDumpContent(e)})})})}),a(I,{})]})},re=[{id:"search",element:ne,isActive:e=>H(["/dump/:search"],e)},{id:"main",element:ne,isActive:e=>H(["/dump"],e)}],le=({search:e=""})=>a(j,{history:y.routerService,onLoadStart:()=>y.layoutService.setAppbarLoader(!0),onLoadEnd:()=>y.layoutService.setAppbarLoader(!1),routes:re,params:{search:e}});export{le as DumpPage,le as default};