import{r as d,R as S,p as _,u as L,d as r,j as i,g as W,Y as O,Z as I,F as z,_ as E,C as A,$,s as H,Q as F,A as M,a0 as D,a1 as Y,i as Q,a2 as V,x as Z}from"./index-41a412db.js";import{r as q,s as G,f as J,T as K}from"./logs-64179499.js";import{d as U}from"./debounce-c1ba2006.js";import{u as X}from"./useRemainingViewPortHeight-deac19eb.js";import{F as ee,p as te}from"./Fab-cfe32548.js";import{P as re,a as oe}from"./play-f9a14481.js";function b(){return b=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},b.apply(this,arguments)}function ne(e,a){if(e==null)return{};var t=ae(e,a),n,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],!(a.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function ae(e,a){if(e==null)return{};var t={},n=Object.keys(e),o,s;for(s=0;s<n.length;s++)o=n[s],!(a.indexOf(o)>=0)&&(t[o]=e[o]);return t}var C=d.forwardRef(function(e,a){var t=e.color,n=t===void 0?"currentColor":t,o=e.size,s=o===void 0?24:o,h=ne(e,["color","size"]);return S.createElement("svg",b({ref:a,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},h),S.createElement("circle",{cx:"11",cy:"11",r:"8"}),S.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))});C.propTypes={color:_.string,size:_.oneOfType([_.string,_.number])};C.displayName="Search";const se=C,ce="_RuleSearch_6n2et_1",le="_RuleSearchContainer_6n2et_10",ie="_inputWrapper_6n2et_20",pe="_input_6n2et_20",he="_iconWrapper_6n2et_45",u={RuleSearch:ce,RuleSearchContainer:le,inputWrapper:ie,input:pe,iconWrapper:he};function ge({dispatch:e,searchText:a,updateSearchText:t,className:n}){const{t:o}=L(),[s,h]=d.useState(a),g=d.useCallback(l=>{e(t(l))},[e,t]),T=d.useMemo(()=>U(g,300),[g]),f=l=>{h(l.target.value),T(l.target.value)};return r("div",{className:n||u.RuleSearch,children:i("div",{className:u.RuleSearchContainer,children:[r("div",{className:u.inputWrapper,children:r("input",{type:"text",value:s,onChange:f,className:u.input,placeholder:o("Search")})}),r("div",{className:u.iconWrapper,children:r(se,{size:20})})]})})}const ue=e=>({searchText:O(e),updateSearchText:I}),de=W(ue)(ge),fe="_headerControls_1frkh_1",me="_searchWrapper_1frkh_13",_e="_clearBtn_1frkh_17",ve="_logLine_1frkh_34",Te="_logMeta_1frkh_51",ye="_logTime_1frkh_64",xe="_logType_1frkh_70",ke="_logText_1frkh_96",Se="_logsWrapper_1frkh_102",be="_scrollToBottomBtn_1frkh_125",Ce="_logPlaceholder_1frkh_152",Re="_logPlaceholderIcon_1frkh_165",c={headerControls:fe,searchWrapper:me,clearBtn:_e,logLine:ve,logMeta:Te,logTime:ye,logType:xe,logText:ke,logsWrapper:Se,scrollToBottomBtn:be,logPlaceholder:Ce,logPlaceholderIcon:Re},{useCallback:v,useEffect:R,useRef:Le,useState:We}=Z,Be={debug:"debug",info:"info",warning:"warn",error:"error"};function Ne({time:e,payload:a,type:t}){return i("div",{className:c.logLine,children:[i("div",{className:c.logMeta,children:[r("span",{className:c.logTime,children:e}),r("span",{className:c.logType,"data-type":t,children:Be[t]})]}),r("div",{className:c.logText,children:a})]})}function Pe({dispatch:e,logLevel:a,apiConfig:t,logs:n,logStreamingPaused:o}){const s=z(),h=v(()=>{o?q({...t,logLevel:a}):G(),s.app.updateAppConfig("logStreamingPaused",!o)},[t,a,o,s.app]),g=v(p=>e(E(p)),[e]);R(()=>{J({...t,logLevel:a},g)},[t,a,g]);const[T,f]=X(),{t:l}=L(),m=Le(null),[y,B]=We(!0),x=v(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[]);R(()=>{y&&x()},[n,y,x]);const N=v(p=>{const{scrollTop:k,scrollHeight:P,clientHeight:w}=p.currentTarget,j=P-k-w<50;B(j)},[]);return i("div",{children:[i(A,{children:[r("div",{style:{flex:1}}),i("div",{className:c.headerControls,children:[r(de,{className:c.searchWrapper}),r("button",{className:c.clearBtn,onClick:()=>e($()),title:l("Clear"),children:r(K,{size:18})})]})]}),r("div",{ref:T,style:{position:"relative"},children:n.length===0?i("div",{className:c.logPlaceholder,style:{height:f*.9},children:[r("div",{className:c.logPlaceholderIcon,children:r(H,{width:200,height:200})}),r("div",{children:l("no_logs")})]}):i(F,{children:[r("div",{className:c.logsWrapper,style:{height:f*.8},ref:m,onScroll:N,children:n.map((p,k)=>d.createElement(Ne,{...p,key:p.id||k}))}),!y&&r("button",{className:c.scrollToBottomBtn,onClick:x,children:r(M,{size:16})}),r(ee,{icon:o?r(re,{size:16}):r(oe,{size:16}),mainButtonStyles:o?{background:"#e74c3c"}:{},style:te,text:l(o?"Resume Refresh":"Pause Refresh"),onClick:h})]})})]})}const we=e=>({logs:D(e),logLevel:Y(e),apiConfig:Q(e),logStreamingPaused:V(e)}),$e=W(we)(Pe);export{$e as default};
