@backtest-kit/ui 12.0.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/modules/frontend/build/assets/{Article-Cep1zZez.js → Article-Doa7LgJz.js} +1 -1
- package/build/modules/frontend/build/assets/{Background-DI4TR0l_.js → Background-DChJlq4Y.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-BV2g32_b.js → IconPhoto-BlmzHaTm.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-uHSkdvcT.js → KeyboardArrowLeft-DWuLOL4a.js} +1 -1
- package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-DWr8-Wu_.js → PictureAsPdfOutlined-kC2Vpwnz.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-DDS1Dl8a.js → Refresh-bPeQBhCL.js} +1 -1
- package/build/modules/frontend/build/assets/emitters-DSM8Kmyp.js +1 -0
- package/build/modules/frontend/build/assets/{hasRouteMatch-DTIimlwJ.js → hasRouteMatch-COcX1hTR.js} +1 -1
- package/build/modules/frontend/build/assets/{html2canvas-jxBuh7xH.js → html2canvas-8QaXH3hX.js} +1 -1
- package/build/modules/frontend/build/assets/index-BQE-pWyA.js +1 -0
- package/build/modules/frontend/build/assets/{index-D9wmaFsM.js → index-BYeYy5rP.js} +1 -1
- package/build/modules/frontend/build/assets/{index-BV8dzBt8.js → index-BZuTUdHt.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CAZyhcV6.js → index-CELcSINJ.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CjbnzV4W.js → index-CNDXRrst.js} +1 -1
- package/build/modules/frontend/build/assets/{index-FTZ3DZOP.js → index-Cxk9BV--.js} +1 -1
- package/build/modules/frontend/build/assets/{index-DkEgiru5.js → index-Cyg5Mqxr.js} +1 -1
- package/build/modules/frontend/build/assets/{index-ZVDIT3wc.js → index-DOlobFOj.js} +1 -1
- package/build/modules/frontend/build/assets/{index-DMjmH2fE.js → index-DSNG-Nhb.js} +5 -5
- package/build/modules/frontend/build/assets/{index-DFqeL1wo.js → index-DzKi5R3K.js} +1 -1
- package/build/modules/frontend/build/assets/{index-uZ6nksDu.js → index-QrnIrM_Z.js} +1 -1
- package/build/modules/frontend/build/assets/{index-_NbOxv95.js → index-kZWrY1-_.js} +1 -1
- package/build/modules/frontend/build/assets/{index-Cgi9Q7Z8.js → index-lJH4fbnI.js} +1 -1
- package/build/modules/frontend/build/assets/{index.es-R8OIqeA_.js → index.es-BxPdoW9B.js} +1 -1
- package/build/modules/frontend/build/assets/{markdownit-3n_Nebne.js → markdownit-Dgsgan9Z.js} +1 -1
- package/build/modules/frontend/build/index.html +1 -1
- package/package.json +3 -3
- package/build/modules/frontend/build/assets/emitters-D_sqmu3L.js +0 -1
- package/build/modules/frontend/build/assets/index-DjRBVBQG.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as v,aq as x,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as z,at as $,F as D,au as j,av as C}from"./index-
|
|
1
|
+
import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as v,aq as x,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as z,at as $,F as D,au as j,av as C}from"./index-DSNG-Nhb.js";import{R as O,C as T}from"./Refresh-bPeQBhCL.js";import{K as W}from"./KeyboardArrowLeft-DWuLOL4a.js";import{I as F}from"./IconPhoto-BlmzHaTm.js";import{B}from"./Background-DChJlq4Y.js";const A=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),V=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),E=new o,H=[{type:t.Link,action:"back-action",label:a(W,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"}],I=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:A,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const N=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:j}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),C=d(i),O=d(e);p(()=>E.subscribe(e=>{if("update-now"===e&&j(),"download-action"===e){const e=new Blob([JSON.stringify(C.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),W=e=>{const o=T[e]||[];return o.length?a(D,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:P("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(t.priceOpen),"$",t.originalPriceOpen!==t.priceOpen&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(t.priceTakeProfit),"$",t.originalPriceTakeProfit!==t.priceTakeProfit&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(t.priceStopLoss),"$",t.originalPriceStopLoss!==t.priceStopLoss&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",R(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(z,{disableRipple:!0,children:a($,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(F,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:W(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=C(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:N,isActive:e=>J(["/backtest"],e)},{id:"live",element:N,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(B,{})]})};export{X as OverviewPage,X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as t,x as a,i as e,f as o,O as i,R as n,p as s,a2 as r,Z as c,T as l,b2 as d,W as p,B as u,F as b,a3 as m,E as y,A as h,a5 as g,l as f,n as S,a4 as v,a6 as w,ai as L,b3 as k,b4 as x,w as A,X as C,a8 as N,b5 as j,D as R,b6 as $,aj as F}from"./index-
|
|
1
|
+
import{Q as t,x as a,i as e,f as o,O as i,R as n,p as s,a2 as r,Z as c,T as l,b2 as d,W as p,B as u,F as b,a3 as m,E as y,A as h,a5 as g,l as f,n as S,a4 as v,a6 as w,ai as L,b3 as k,b4 as x,w as A,X as C,a8 as N,b5 as j,D as R,b6 as $,aj as F}from"./index-DSNG-Nhb.js";import{h as B}from"./hasRouteMatch-COcX1hTR.js";import{I as E}from"./IconPhoto-BlmzHaTm.js";import{C as H,R as M}from"./Refresh-bPeQBhCL.js";import{K as _}from"./KeyboardArrowLeft-DWuLOL4a.js";import{B as G}from"./Background-DChJlq4Y.js";const O="backtest-kit__groupHeader",V="backtest-kit__groupRoot",I="backtest-kit__symbolImage",P=s()({root:{[`& .${V}:hover .${O}`]:{opacity:"1 !important"}}});function z(t){return w(t,"#000000")>w(t,"#FFFFFF")}const D=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"}],T=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:M,color:"#4caf50"})}],U=(t,a)=>({type:r.Group,className:V,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:O,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(h,{direction:"row",children:[o(m,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:a.map(({symbol:t,label:a,to:i,color:n})=>((t,a,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(v,{component:g,onClick:()=>{e.routerService.push(`/status/${a}`)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${I}`]:{transition:"filter 500ms"},"&:hover":{background:()=>z(n)?f(n,.33):S(n,.33),[`& .${I}`]:{transition:"filter 500ms",filter:z(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(E,{className:I,symbol:t}),children:o(u,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:i})})}))(t,i,a,n))}]}),W=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"},{type:n.Link,action:"back-action",compute:t=>t?`${String(t.symbol).toUpperCase()} (${t.strategyName})`:"Live"},{type:n.Button,action:"print-action",label:"Print",icon:j}],K=[{action:"print-action",label:"Print",icon:()=>o(c,{icon:j,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>o(c,{icon:R,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:M,color:"#4caf50"})}],J=new N,Q=[{id:"status",element:({params:t})=>{const[n]=a(async()=>{const a=await e.statusViewService.getStatusMap();return L.get(a,t.id,null)},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[t.id]}),[s,{loading:r,execute:c}]=a(async()=>await e.statusViewService.getStatusOne(t.id),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[t.id]}),m=k(async()=>{if(!s)return;const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=URL.createObjectURL(t);e.layoutService.downloadFile(a,`status_${Date.now()}.json`)}),y=k(async()=>{if(!s)return;const t=e.markdownHelperService.buildMarkdownFromFields(x,s);await A(t)});C(()=>J.subscribe(c));return o(H,{children:[o(i,{items:W,actions:K,payload:n,onAction:async t=>{"back-action"===t&&((async()=>{1!==(await e.statusViewService.getStatusList()).length?e.routerService.push("/status"):e.routerService.push("/")})(),e.routerService.push("/")),"update-now"===t&&await J.next(),"download-action"===t&&await m(),"print-action"===t&&await y()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):s?o(b,{children:[o(p,{handler:s,fields:$}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(G,{})]})},isActive:t=>B(["/status/:id"],t)},{id:"main",element:()=>{const{classes:n}=P(),{reloadTrigger:s,doReload:c}=t();a(async()=>{const t=await e.statusViewService.getStatusList();if(1===t.length){const[{id:a}]=t;e.routerService.push(`/status/${a}`)}},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});const[m,{loading:y}]=a(async()=>await(async()=>{const[t,a]=await Promise.all([e.symbolGlobalService.getSymbolMap(),e.statusViewService.getStatusList()]);if(!a||0===a.length)return[{type:r.Typography,typoVariant:"h6",placeholder:"Listening for a pending signal...",sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};a.forEach(a=>{const e=t[a.symbol],i=a.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:a.symbol,label:(null==e?void 0:e.displayName)||a.symbol,color:(null==e?void 0:e.color)||"#ccc",to:a.id})});const i=Object.entries(o).sort(([,t],[,a])=>a.length-t.length),n=[],s=[],c=[];return i.forEach(([t,a],e)=>{const o=U(t,a);e%2==0?n.push(o):s.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:s},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});return o(H,{children:[o(i,{items:D,actions:T,onAction:t=>{"back-action"===t&&e.routerService.push("/"),"update-now"===t&&c()}}),y||!m?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):m.length?o(b,{children:[o(p,{className:n.root,fields:m},s),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:t=>B(["/status"],t)}],X=({id:t})=>o(F,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:Q,params:{id:t}});export{X as StatusPage,X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,f as a,r as t,bf as i,bg as o,x as r,i as s,bh as n,bi as c,bj as l,I as d,ad as p,b1 as h,bk as b,p as m,ah as u,bl as f,a1 as y,T as g,b2 as x,an as v,a5 as w,bm as L,ao as S,bn as k,aZ as A,Y as j,X as C,a8 as N,O as z,R,b7 as E,B as H,Z as T,aj as I}from"./index-
|
|
1
|
+
import{b as e,f as a,r as t,bf as i,bg as o,x as r,i as s,bh as n,bi as c,bj as l,I as d,ad as p,b1 as h,bk as b,p as m,ah as u,bl as f,a1 as y,T as g,b2 as x,an as v,a5 as w,bm as L,ao as S,bn as k,aZ as A,Y as j,X as C,a8 as N,O as z,R,b7 as E,B as H,Z as T,aj as I}from"./index-DSNG-Nhb.js";import{h as M}from"./hasRouteMatch-COcX1hTR.js";import{B as V}from"./Background-DChJlq4Y.js";import{A as B}from"./Article-Doa7LgJz.js";import{C as D,R as F}from"./Refresh-bPeQBhCL.js";import{K}from"./KeyboardArrowLeft-DWuLOL4a.js";const O=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"),P=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"),W="65px",X=e=>e.mimeType.startsWith("image/")?a(O,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(j,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(B,{sx:{color:"#1976d2",fontSize:20}}):a(P,{sx:{color:"#546e7a",fontSize:20}}),Z=m()(e=>({root:{position:"relative",height:"100%",width:"100%",background:"#eee",overflow:"clip"},header:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"8px",paddingRight:"4px",height:W},input:{height:W,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:W,left:0,right:0,bottom:0,height:`calc(100% - ${W})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:u("#00c3ff",.05)}})),Y=({outlinePaper:e,className:m,style:u,sx:j,nodes:C,initialSearch:N=""})=>{const{classes:z,cx:R}=Z(),[E,H]=t.useState(N),T=i(E),[I,{flush:M}]=o(E,2500),[V,{loading:B}]=r(async()=>await(async(e,a)=>{const t=e.trim().toLowerCase(),i=[];let o=0;for(const r of s.explorerHelperService.deepFlat(a))if("file"!==r.type||t&&!r.path.toLowerCase().includes(t)||i.push(r),++o%1e4==0&&await f(0),i.length>25e3)break;return i})(I,C),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[I,C]}),{execute:D}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(b,{outlinePaper:e,className:R(z.root,m),style:u,sx:j,children:[a("div",{className:z.header,children:a(c,{disabled:B,className:z.input,endAdornment:a(l,{position:"end",children:a(d,{disabled:B||!E,onClick:()=>{T.once(async()=>{await f(500),M()}),H("")},edge:"end",children:a(E?p:h,{})})}),placeholder:"Search",value:E,onBlur:()=>M(),onChange:({target:e})=>H(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:z.container,children:a("div",{className:z.content,children:V?V.length?a(A,{withScrollbar:!0,children:V.map((e,t)=>a(v,{className:R({[z.accent]:t%2==1}),component:w,onClick:()=>(async e=>{await D(e)})(e.id),children:[a(L,{children:X(e)}),a(S,{primary:e.label,secondary:e.path}),a(k,{content:e.path,label:"Copy path"})]},e.id))}):a(x,{sx:{height:"100%",width:"100%"},children:a(g,{variant:"h6",sx:{opacity:.5},children:"Not found"})}):a(y,{className:z.loader})})})]})},$=[{type:R.Link,action:"back-action",label:a(K,{sx:{display:"block"}})},{type:R.Link,action:"back-action",label:"Main"},{type:R.Link,action:"back-action",label:"Dump Explorer"}],q=[{action:"update-now",label:"Refresh",icon:()=>a(T,{icon:F,color:"#4caf50"})}],G=new N,J=({params:e})=>{const[t,{loading:i,execute:o}]=r(async()=>await s.explorerViewService.getFolderTree(),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});C(()=>G.subscribe(o));return a(D,{children:[a(z,{items:$,actions:q,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),G.next())}}),a(E,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(H,{pr:2,pl:2,children:i||!t?a(x,{children:a(g,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a(Y,{nodes:t,initialSearch:e.search})})}),a(V,{})]})},Q=[{id:"search",element:J,isActive:e=>M(["/dump/:search"],e)},{id:"main",element:J,isActive:e=>M(["/dump"],e)}],U=({search:e=""})=>a(I,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:Q,params:{search:e}});export{U as DumpPage,U as default};
|