import{x as g,O as u,D as m,j as e,b as j,z as b,c as _,a as y,w as N,r as w}from"./index-fb4a4614.js";import{w as C,T as L}from"./bootstrap-5.esm-54b60f6b.js";import{_ as E}from"./_baseSet-411f0b9b.js";var S=u,x=/[\\^$.*+?()[\]{}|]/g,F=RegExp(x.source);function R(s){return s=S(s),s&&F.test(s)?s.replace(x,"\\$&"):s}var T=R;const D=g(T);var $=E;function K(s,t,a){return s==null?s:$(s,t,a)}var P=K;const z=g(P),O={"hide-description":"_hide-description_19xm6_1"},k=C(L);function A(s){const{schema:t={},schemaKey:a="",config:l={},configKey:r="",onChange:o}=s,c=m(l,r,{}),n=m(t,a,{}),v=f=>{const d={};z(d,r,f.formData),o(d)};return e.jsx(k,{schema:n,className:O["hide-description"],formData:c,onChange:v,children:e.jsx("div",{})})}const i="all",h=({text:s})=>e.jsx(e.Fragment,{children:s}),H=({text:s="",highlight:t=""})=>{if(!t.trim())return e.jsx(h,{text:s});const a=new RegExp(`(${D(t)})`,"gi"),l=s.split(a);return e.jsx(e.Fragment,{children:l.filter(r=>r).map((r,o)=>a.test(r)?e.jsx("mark",{children:r},o):e.jsx(h,{text:r},o))})};function p(s){const{logLevel:t,log:a,search:l}=s,r=t===i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{width:"60px"},className:j("badge",{"bg-danger":a.level==="error","bg-warning":a.level==="warning","bg-info":a.level==="info","bg-secondary":!["error","warning","info"].includes(a.level)},"text-capitalize"),children:a.level})," "]});return e.jsxs("div",{children:[r,e.jsx("small",{className:"pe-1",children:b(a.timestamp)}),e.jsx("code",{children:e.jsx(H,{text:a.message,highlight:l})})]})}const I=[i,"debug","info","warning","error"];class B extends w.Component{constructor(){super(...arguments),this.state={search:"",logLevel:i}}renderSearch(){const{clearLogs:t,bridgeInfo:{config_schema:a,config:l},updateBridgeConfig:r,t:o}=this.props,{search:c}=this.state;return e.jsx("div",{className:"card",children:e.jsx("div",{className:"card-body",children:e.jsxs("div",{className:"row row-cols-lg-auto g-3 align-items-center",children:[e.jsxs("div",{className:"col-12 col-sm-4 col-xxl-4",children:[e.jsx("label",{htmlFor:"log-level",className:"form-label",children:o("show_only")}),e.jsx("select",{id:"log-level",className:"form-select",onChange:n=>this.setState({logLevel:n.target.value}),children:I.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsxs("div",{className:"col-12 col-sm-4 col-xxl-4",children:[e.jsx("label",{htmlFor:"search-filter",className:"form-label",children:o("filter_by_text")}),e.jsx("input",{id:"search-filter",className:"form-control col-10",placeholder:o("common:enter_search_criteria"),value:c,onChange:n=>this.setState({search:n.target.value}),type:"text"})]}),e.jsx("div",{className:"col-12 col-sm-4 col-xxl-4",children:e.jsx(A,{schema:a,schemaKey:"properties.advanced.properties.log_level",config:l,configKey:"advanced.log_level",onChange:r})}),e.jsxs("div",{className:"col-12",children:[e.jsx("label",{htmlFor:"reset",children:" "}),e.jsx("input",{id:"reset",type:"button",onClick:t,className:"btn btn-primary form-control",value:o("common:clear")})]})]})})})}render(){let{logs:t}=this.props;const{t:a}=this.props,{search:l,logLevel:r}=this.state;return t=t.filter(o=>(r===i||o.level===r)&&(!l||o.message.toLowerCase().includes(l.toLowerCase()))).sort(),e.jsxs(e.Fragment,{children:[this.renderSearch(),e.jsx("div",{className:"card",children:e.jsxs("div",{className:"card-body",children:[t.length==0?e.jsx("h1",{children:a("empty_logs_message")}):null,e.jsx("div",{className:"overflow-auto",children:t.map((o,c)=>e.jsx(p,{log:o,search:l,logLevel:r},c))})]})})]})}}const M=["logs","bridgeInfo"],W=_(M,y)(N(["logs","common"])(B)),Q=Object.freeze(Object.defineProperty({__proto__:null,ConnectedLogsPage:W,LogRow:p},Symbol.toStringTag,{value:"Module"}));export{i as A,p as L,Q as i};
