adonisjs-server-stats 1.6.13 → 1.8.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.
Files changed (61) hide show
  1. package/README.md +24 -8
  2. package/dist/core/index.js +248 -245
  3. package/dist/react/{CacheSection-DGxMDlWK.js → CacheSection-D5J5moz7.js} +1 -1
  4. package/dist/react/{CacheTab-CnVW5PLs.js → CacheTab-F1MkWSZl.js} +1 -1
  5. package/dist/react/{ConfigSection-DPcrfqXY.js → ConfigSection-DerLBu4o.js} +1 -1
  6. package/dist/react/{ConfigTab-BSWq_o2p.js → ConfigTab-Bsj7v9JW.js} +1 -1
  7. package/dist/react/{CustomPaneTab-xjkYwTvH.js → CustomPaneTab-gzdtDEvz.js} +1 -1
  8. package/dist/react/{EmailsSection-CSyTg1aX.js → EmailsSection-ndH3cvJk.js} +1 -1
  9. package/dist/react/{EmailsTab-Dh2YSa_f.js → EmailsTab-DVPHRx0L.js} +44 -22
  10. package/dist/react/{EventsSection-C1pbJDfW.js → EventsSection-ClIByDSk.js} +1 -1
  11. package/dist/react/{EventsTab-eCh02cdd.js → EventsTab-CCzWEKrk.js} +1 -1
  12. package/dist/react/{JobsSection-CLAin5vU.js → JobsSection-CVMyAs7O.js} +1 -1
  13. package/dist/react/{JobsTab-Dl5nrj2z.js → JobsTab-CATUyb9V.js} +1 -1
  14. package/dist/react/{LogsSection-C1p81fXO.js → LogsSection-hAsLaKOC.js} +1 -1
  15. package/dist/react/{LogsTab-D-kR7PjX.js → LogsTab-QouH4NPQ.js} +1 -1
  16. package/dist/react/{OverviewSection-nm3xdACz.js → OverviewSection-ae5AO2RG.js} +1 -1
  17. package/dist/react/{QueriesSection-DB12HMfQ.js → QueriesSection-DFFr9Tbb.js} +1 -1
  18. package/dist/react/{QueriesTab-fyBB1u_Y.js → QueriesTab-GrHRAREt.js} +1 -1
  19. package/dist/react/{RequestsSection-DTqB81ac.js → RequestsSection-DtwnJOnM.js} +1 -1
  20. package/dist/react/{RoutesSection-DJWa4NPV.js → RoutesSection-F7nANhF0.js} +1 -1
  21. package/dist/react/{RoutesTab-D3l8TOpu.js → RoutesTab-rugjhCPH.js} +1 -1
  22. package/dist/react/{TimelineSection-C4d-jRX1.js → TimelineSection-F5ThmTdy.js} +1 -1
  23. package/dist/react/{TimelineTab-C5TFaSmQ.js → TimelineTab-Dvpf-I5C.js} +1 -1
  24. package/dist/react/{index-UdTfSvtO.js → index-DDzo1bZk.js} +2 -2
  25. package/dist/react/index.js +1 -1
  26. package/dist/react/style.css +1 -1
  27. package/dist/src/controller/debug_controller.js +10 -9
  28. package/dist/src/dashboard/dashboard_store.js +10 -6
  29. package/dist/src/data/data_access.js +14 -2
  30. package/dist/src/debug/email_collector.d.ts +11 -1
  31. package/dist/src/debug/email_collector.js +32 -2
  32. package/dist/src/debug/event_collector.js +1 -1
  33. package/dist/src/debug/query_collector.js +1 -1
  34. package/dist/src/debug/trace_collector.js +1 -1
  35. package/dist/src/debug/types.d.ts +1 -1
  36. package/dist/src/edge/client/dashboard.js +2 -2
  37. package/dist/src/edge/client/debug-panel-deferred.js +1 -1
  38. package/dist/src/edge/client-vue/dashboard.js +4 -4
  39. package/dist/src/edge/client-vue/debug-panel-deferred.js +3 -3
  40. package/dist/src/provider/server_stats_provider.d.ts +31 -0
  41. package/dist/src/provider/server_stats_provider.js +244 -5
  42. package/dist/src/routes/register_routes.js +2 -2
  43. package/dist/src/styles/components.css +3 -0
  44. package/dist/vue/{CacheSection-C788Yfai.js → CacheSection-DDvJ7bs2.js} +1 -1
  45. package/dist/vue/{ConfigSection-CRzYxqW2.js → ConfigSection-GTCrvsPr.js} +1 -1
  46. package/dist/vue/{EmailsSection-C8JFMtW7.js → EmailsSection-Ct5vsLCc.js} +1 -1
  47. package/dist/vue/EmailsTab-CNyEODVB.js +177 -0
  48. package/dist/vue/{EventsSection-C4wXUgxG.js → EventsSection-CRVhtagq.js} +1 -1
  49. package/dist/vue/{JobsSection-CsKWTjgN.js → JobsSection-B_wH2Co7.js} +1 -1
  50. package/dist/vue/{LogsSection-BFVjSZ24.js → LogsSection-C4NRFOpA.js} +1 -1
  51. package/dist/vue/{OverviewSection-CbMdAido.js → OverviewSection-BqSwuMKH.js} +1 -1
  52. package/dist/vue/{QueriesSection-BPiv7u3r.js → QueriesSection-D4Fs0YH6.js} +1 -1
  53. package/dist/vue/{RequestsSection-LtImH4rD.js → RequestsSection-B0A5SKcM.js} +1 -1
  54. package/dist/vue/{RoutesSection-CrxOxmzx.js → RoutesSection-Ys5dTzvF.js} +1 -1
  55. package/dist/vue/{TimelineSection-DLxMW2J_.js → TimelineSection-D38iHB08.js} +1 -1
  56. package/dist/vue/components/DebugPanel/tabs/EmailsTab.vue.d.ts +2 -0
  57. package/dist/vue/{index-qCQpBftQ.js → index-Bj6pm5g3.js} +56 -54
  58. package/dist/vue/index.js +1 -1
  59. package/dist/vue/style.css +1 -1
  60. package/package.json +1 -1
  61. package/dist/vue/EmailsTab-DhFhoNmU.js +0 -157
@@ -1,2 +1,2 @@
1
- (function(){"use strict";var ve,A,Ze,le,et,tt,st,nt,qe,Re,De,ye={},ge=[],ys=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,he=Array.isArray;function Z(e,s){for(var n in s)e[n]=s[n];return e}function Oe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function be(e,s,n){var r,o,a,l={};for(a in s)a=="key"?r=s[a]:a=="ref"?o=s[a]:l[a]=s[a];if(arguments.length>2&&(l.children=arguments.length>3?ve.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return we(e,l,r,o,null)}function we(e,s,n,r,o){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Ze,__i:-1,__u:0};return o==null&&A.vnode!=null&&A.vnode(a),a}function D(e){return e.children}function ee(e,s){this.props=e,this.context=s}function ce(e,s){if(s==null)return e.__?ce(e.__,e.__i+1):null;for(var n;s<e.__k.length;s++)if((n=e.__k[s])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ce(e):null}function gs(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],o=[],a=Z({},s);a.__v=s.__v+1,A.vnode&&A.vnode(a),Fe(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??ce(s),!!(32&s.__u),o),a.__v=s.__v,a.__.__k[a.__i]=a,dt(r,a,o),s.__e=s.__=null,a.__e!=n&&rt(a)}}function rt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(s){if(s!=null&&s.__e!=null)return e.__e=e.__c.base=s.__e}),rt(e)}function at(e){(!e.__d&&(e.__d=!0)&&le.push(e)&&!Ne.__r++||et!=A.debounceRendering)&&((et=A.debounceRendering)||tt)(Ne)}function Ne(){for(var e,s=1;le.length;)le.length>s&&le.sort(st),e=le.shift(),s=le.length,gs(e);Ne.__r=0}function lt(e,s,n,r,o,a,l,i,c,d,p){var h,y,f,_,g,S,x,w=r&&r.__k||ge,u=s.length;for(c=bs(n,s,w,c,u),h=0;h<u;h++)(f=n.__k[h])!=null&&(y=f.__i!=-1&&w[f.__i]||ye,f.__i=h,S=Fe(e,f,y,o,a,l,i,c,d,p),_=f.__e,f.ref&&y.ref!=f.ref&&(y.ref&&Ie(y.ref,null,f),p.push(f.ref,f.__c||_,f)),g==null&&_!=null&&(g=_),(x=!!(4&f.__u))||y.__k===f.__k?c=it(f,c,e,x):typeof f.type=="function"&&S!==void 0?c=S:_&&(c=_.nextSibling),f.__u&=-7);return n.__e=g,c}function bs(e,s,n,r,o){var a,l,i,c,d,p=n.length,h=p,y=0;for(e.__k=new Array(o),a=0;a<o;a++)(l=s[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=we(null,l,null,null,null):he(l)?l=e.__k[a]=we(D,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=we(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,c=a+y,l.__=e,l.__b=e.__b+1,i=null,(d=l.__i=ws(l,n,c,h))!=-1&&(h--,(i=n[d])&&(i.__u|=2)),i==null||i.__v==null?(d==-1&&(o>p?y--:o<p&&y++),typeof l.type!="function"&&(l.__u|=4)):d!=c&&(d==c-1?y--:d==c+1?y++:(d>c?y--:y++,l.__u|=4))):e.__k[a]=null;if(h)for(a=0;a<p;a++)(i=n[a])!=null&&(2&i.__u)==0&&(i.__e==r&&(r=ce(i)),ut(i,i));return r}function it(e,s,n,r){var o,a;if(typeof e.type=="function"){for(o=e.__k,a=0;o&&a<o.length;a++)o[a]&&(o[a].__=e,s=it(o[a],s,n,r));return s}e.__e!=s&&(r&&(s&&e.type&&!s.parentNode&&(s=ce(e)),n.insertBefore(e.__e,s||null)),s=e.__e);do s=s&&s.nextSibling;while(s!=null&&s.nodeType==8);return s}function xe(e,s){return s=s||[],e==null||typeof e=="boolean"||(he(e)?e.some(function(n){xe(n,s)}):s.push(e)),s}function ws(e,s,n,r){var o,a,l,i=e.key,c=e.type,d=s[n],p=d!=null&&(2&d.__u)==0;if(d===null&&i==null||p&&i==d.key&&c==d.type)return n;if(r>(p?1:0)){for(o=n-1,a=n+1;o>=0||a<s.length;)if((d=s[l=o>=0?o--:a++])!=null&&(2&d.__u)==0&&i==d.key&&c==d.type)return l}return-1}function ot(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||ys.test(s)?n:n+"px"}function ke(e,s,n,r,o){var a,l;e:if(s=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(s in r)n&&s in n||ot(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ot(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(nt,"$1")),l=s.toLowerCase(),s=l in e||s=="onFocusOut"||s=="onFocusIn"?l.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=qe,e.addEventListener(s,a?De:Re,a)):e.removeEventListener(s,a?De:Re,a);else{if(o=="http://www.w3.org/2000/svg")s=s.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(s!="width"&&s!="height"&&s!="href"&&s!="list"&&s!="form"&&s!="tabIndex"&&s!="download"&&s!="rowSpan"&&s!="colSpan"&&s!="role"&&s!="popover"&&s in e)try{e[s]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&s[4]!="-"?e.removeAttribute(s):e.setAttribute(s,s=="popover"&&n==1?"":n))}}function ct(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=qe++;else if(s.t<n.u)return;return n(A.event?A.event(s):s)}}}function Fe(e,s,n,r,o,a,l,i,c,d){var p,h,y,f,_,g,S,x,w,u,N,b,L,M,q,O=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[i=s.__e=n.__e]),(p=A.__b)&&p(s);e:if(typeof O=="function")try{if(x=s.props,w="prototype"in O&&O.prototype.render,u=(p=O.contextType)&&r[p.__c],N=p?u?u.props.value:p.__:r,n.__c?S=(h=s.__c=n.__c).__=h.__E:(w?s.__c=h=new O(x,N):(s.__c=h=new ee(x,N),h.constructor=O,h.render=xs),u&&u.sub(h),h.state||(h.state={}),h.__n=r,y=h.__d=!0,h.__h=[],h._sb=[]),w&&h.__s==null&&(h.__s=h.state),w&&O.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Z({},h.__s)),Z(h.__s,O.getDerivedStateFromProps(x,h.__s))),f=h.props,_=h.state,h.__v=s,y)w&&O.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),w&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(w&&O.getDerivedStateFromProps==null&&x!==f&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(x,N),s.__v==n.__v||!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(x,h.__s,N)===!1){s.__v!=n.__v&&(h.props=x,h.state=h.__s,h.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(U){U&&(U.__=s)}),ge.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&l.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(x,h.__s,N),w&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(f,_,g)})}if(h.context=N,h.props=x,h.__P=e,h.__e=!1,b=A.__r,L=0,w)h.state=h.__s,h.__d=!1,b&&b(s),p=h.render(h.props,h.state,h.context),ge.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,b&&b(s),p=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++L<25);h.state=h.__s,h.getChildContext!=null&&(r=Z(Z({},r),h.getChildContext())),w&&!y&&h.getSnapshotBeforeUpdate!=null&&(g=h.getSnapshotBeforeUpdate(f,_)),M=p!=null&&p.type===D&&p.key==null?ht(p.props.children):p,i=lt(e,he(M)?M:[M],s,n,r,o,a,l,i,c,d),h.base=s.__e,s.__u&=-161,h.__h.length&&l.push(h),S&&(h.__E=h.__=null)}catch(U){if(s.__v=null,c||a!=null)if(U.then){for(s.__u|=c?160:128;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;a[a.indexOf(i)]=null,s.__e=i}else{for(q=a.length;q--;)Oe(a[q]);je(s)}else s.__e=n.__e,s.__k=n.__k,U.then||je(s);A.__e(U,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):i=s.__e=Ns(n.__e,s,n,r,o,a,l,c,d);return(p=A.diffed)&&p(s),128&s.__u?void 0:i}function je(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(je))}function dt(e,s,n){for(var r=0;r<n.length;r++)Ie(n[r],n[++r],n[++r]);A.__c&&A.__c(s,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){A.__e(a,o.__v)}})}function ht(e){return typeof e!="object"||e==null||e.__b>0?e:he(e)?e.map(ht):Z({},e)}function Ns(e,s,n,r,o,a,l,i,c){var d,p,h,y,f,_,g,S=n.props||ye,x=s.props,w=s.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!w&&(w?f.localName==w:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(w==null)return document.createTextNode(x);e=document.createElementNS(o,w,x.is&&x),i&&(A.__m&&A.__m(s,a),i=!1),a=null}if(w==null)S===x||i&&e.data==x||(e.data=x);else{if(a=a&&ve.call(e.childNodes),!i&&a!=null)for(S={},d=0;d<e.attributes.length;d++)S[(f=e.attributes[d]).name]=f.value;for(d in S)f=S[d],d=="dangerouslySetInnerHTML"?h=f:d=="children"||d in x||d=="value"&&"defaultValue"in x||d=="checked"&&"defaultChecked"in x||ke(e,d,null,f,o);for(d in x)f=x[d],d=="children"?y=f:d=="dangerouslySetInnerHTML"?p=f:d=="value"?_=f:d=="checked"?g=f:i&&typeof f!="function"||S[d]===f||ke(e,d,f,S[d],o);if(p)i||h&&(p.__html==h.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),s.__k=[];else if(h&&(e.innerHTML=""),lt(s.type=="template"?e.content:e,he(y)?y:[y],s,n,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,l,a?a[0]:n.__k&&ce(n,0),i,c),a!=null)for(d=a.length;d--;)Oe(a[d]);i||(d="value",w=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[d]||w=="progress"&&!_||w=="option"&&_!=S[d])&&ke(e,d,_,S[d],o),d="checked",g!=null&&g!=e[d]&&ke(e,d,g,S[d],o))}return e}function Ie(e,s,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&s==null||(e.__u=e(s))}else e.current=s}catch(o){A.__e(o,n)}}function ut(e,s,n){var r,o;if(A.unmount&&A.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ie(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){A.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&ut(r[o],s,n||typeof e.type!="function");n||Oe(e.__e),e.__c=e.__=e.__e=void 0}function xs(e,s,n){return this.constructor(e,n)}function ks(e,s,n){var r,o,a,l;s==document&&(s=document.documentElement),A.__&&A.__(e,s),o=(r=!1)?null:s.__k,a=[],l=[],Fe(s,e=s.__k=be(D,null,[e]),o||ye,ye,s.namespaceURI,o?null:s.firstChild?ve.call(s.childNodes):null,a,o?o.__e:s.firstChild,r,l),dt(a,e,l)}ve=ge.slice,A={__e:function(e,s,n,r){for(var o,a,l;s=s.__;)if((o=s.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=o.__d),l)return o.__E=o}catch(i){e=i}throw e}},Ze=0,ee.prototype.setState=function(e,s){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(s&&this._sb.push(s),at(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),at(this))},ee.prototype.render=D,le=[],tt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,st=function(e,s){return e.__v.__b-s.__v.__b},Ne.__r=0,nt=/(PointerCapture)$|Capture$/i,qe=0,Re=ct(!1),De=ct(!0);var Ss=0;function t(e,s,n,r,o,a){s||(s={});var l,i,c=s;if("ref"in c)for(i in c={},s)i=="ref"?l=s[i]:c[i]=s[i];var d={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ss,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(i in l)c[i]===void 0&&(c[i]=l[i]);return A.vnode&&A.vnode(d),d}var ue,I,Be,pt,pe=0,ft=[],B=A,mt=B.__b,_t=B.__r,vt=B.diffed,yt=B.__c,gt=B.unmount,bt=B.__;function Ue(e,s){B.__h&&B.__h(I,e,pe||s),pe=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return pe=1,$s(xt,e)}function $s(e,s,n){var r=Ue(ue++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):xt(void 0,s),function(i){var c=r.__N?r.__N[0]:r.__[0],d=r.t(c,i);c!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.__f)){var o=function(i,c,d){if(!r.__c.__H)return!0;var p=r.__c.__H.__.filter(function(y){return y.__c});if(p.every(function(y){return!y.__N}))return!a||a.call(this,i,c,d);var h=r.__c.props!==i;return p.some(function(y){if(y.__N){var f=y.__[0];y.__=y.__N,y.__N=void 0,f!==y.__[0]&&(h=!0)}}),a&&a.call(this,i,c,d)||h};I.__f=!0;var a=I.shouldComponentUpdate,l=I.componentWillUpdate;I.componentWillUpdate=function(i,c,d){if(this.__e){var p=a;a=void 0,o(i,c,d),a=p}l&&l.call(this,i,c,d)},I.shouldComponentUpdate=o}return r.__N||r.__}function H(e,s){var n=Ue(ue++,3);!B.__s&&Nt(n.__H,s)&&(n.__=e,n.u=s,I.__H.__h.push(n))}function V(e){return pe=5,z(function(){return{current:e}},[])}function z(e,s){var n=Ue(ue++,7);return Nt(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function P(e,s){return pe=8,z(function(){return e},s)}function Cs(){for(var e;e=ft.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some(Se),s.__h.some(ze),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){I=null,mt&&mt(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),bt&&bt(e,s)},B.__r=function(e){_t&&_t(e),ue=0;var s=(I=e.__c).__H;s&&(Be===I?(s.__h=[],I.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some(Se),s.__h.some(ze),s.__h=[],ue=0)),Be=I},B.diffed=function(e){vt&&vt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(ft.push(s)!==1&&pt===B.requestAnimationFrame||((pt=B.requestAnimationFrame)||Ts)(Cs)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Be=I=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some(Se),n.__h=n.__h.filter(function(r){return!r.__||ze(r)})}catch(r){s.some(function(o){o.__h&&(o.__h=[])}),s=[],B.__e(r,n.__v)}}),yt&&yt(e,s)},B.unmount=function(e){gt&&gt(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Se(r)}catch(o){s=o}}),n.__H=void 0,s&&B.__e(s,n.__v))};var wt=typeof requestAnimationFrame=="function";function Ts(e){var s,n=function(){clearTimeout(r),wt&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);wt&&(s=requestAnimationFrame(n))}function Se(e){var s=I,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),I=s}function ze(e){var s=I;e.__c=e.__(),I=s}function Nt(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function xt(e,s){return typeof s=="function"?s(e):s}function Ls(e,s){for(var n in s)e[n]=s[n];return e}function kt(e,s){for(var n in e)if(n!=="__source"&&!(n in s))return!0;for(var r in s)if(r!=="__source"&&e[r]!==s[r])return!0;return!1}function St(e,s){this.props=e,this.context=s}(St.prototype=new ee).isPureReactComponent=!0,St.prototype.shouldComponentUpdate=function(e,s){return kt(this.props,e)||kt(this.state,s)};var $t=A.__b;A.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$t&&$t(e)};var Es=A.__e;A.__e=function(e,s,n,r){if(e.then){for(var o,a=s;a=a.__;)if((o=a.__c)&&o.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),o.__c(e,s)}Es(e,s,n,r)};var Ct=A.unmount;function Tt(e,s,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Ls({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=s),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Tt(r,s,n)})),e}function Lt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Lt(r,s,n)}),e.__c&&e.__c.__P===s&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $e(){this.__u=0,this.o=null,this.__b=null}function Et(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function Q(e){var s,n,r,o=null;function a(l){if(s||(s=e()).then(function(i){i&&(o=i.default||i),r=!0},function(i){n=i,r=!0}),n)throw n;if(!r)throw s;return o?be(o,l):null}return a.displayName="Lazy",a.__f=!0,a}function Ce(){this.i=null,this.l=null}A.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Ct&&Ct(e)},($e.prototype=new ee).__c=function(e,s){var n=s.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var o=Et(r.__v),a=!1,l=function(){a||r.__z||(a=!0,n.__R=null,o?o(c):c())};n.__R=l;var i=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Lt(d,d.__c.__P,d.__c.__O)}var p;for(r.setState({__a:r.__b=null});p=r.o.pop();)p.__P=i,p.forceUpdate()}};r.__u++||32&s.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(l,l)},$e.prototype.componentWillUnmount=function(){this.o=[]},$e.prototype.render=function(e,s){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Tt(this.__b,n,r.__O=r.__P)}this.__b=null}var o=s.__a&&be(D,null,e.fallback);return o&&(o.__u&=-33),[be(D,null,s.__a?null:e.children),o]};var At=function(e,s,n){if(++n[1]===n[0]&&e.l.delete(s),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ce.prototype=new ee).__a=function(e){var s=this,n=Et(s.__v),r=s.l.get(e);return r[0]++,function(o){var a=function(){s.props.revealOrder?(r.push(o),At(s,e,r)):o()};n?n(a):a()}},Ce.prototype.render=function(e){this.i=null,this.l=new Map;var s=xe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&s.reverse();for(var n=s.length;n--;)this.l.set(s[n],this.i=[1,0,this.i]);return e.children},Ce.prototype.componentDidUpdate=Ce.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){At(e,n,s)})};var As=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ps=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ms=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,qs=/[A-Z0-9]/g,Rs=typeof document<"u",Ds=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};ee.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ee.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})});var Pt=A.event;function Os(){}function Fs(){return this.cancelBubble}function js(){return this.defaultPrevented}A.event=function(e){return Pt&&(e=Pt(e)),e.persist=Os,e.isPropagationStopped=Fs,e.isDefaultPrevented=js,e.nativeEvent=e};var Is={enumerable:!1,configurable:!0,get:function(){return this.class}},Mt=A.vnode;A.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,o={},a=r.indexOf("-")===-1;for(var l in n){var i=n[l];if(!(l==="value"&&"defaultValue"in n&&i==null||Rs&&l==="children"&&r==="noscript"||l==="class"||l==="className")){var c=l.toLowerCase();l==="defaultValue"&&"value"in n&&n.value==null?l="value":l==="download"&&i===!0?i="":c==="translate"&&i==="no"?i=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?l="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||Ds(n.type)?c==="onfocus"?l="onfocusin":c==="onblur"?l="onfocusout":Ms.test(l)&&(l=c):c=l="oninput":a&&Ps.test(l)?l=l.replace(qs,"-$&").toLowerCase():i===null&&(i=void 0),c==="oninput"&&o[l=c]&&(l="oninputCapture"),o[l]=i}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=xe(n.children).forEach(function(d){d.props.selected=o.value.indexOf(d.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=xe(n.children).forEach(function(d){d.props.selected=o.multiple?o.defaultValue.indexOf(d.props.value)!=-1:o.defaultValue==d.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",Is)):n.className&&(o.class=o.className=n.className),s.props=o})(e),e.$$typeof=As,Mt&&Mt(e)};var qt=A.__r;A.__r=function(e){qt&&qt(e),e.__c};var Rt=A.diffed;A.diffed=function(e){Rt&&Rt(e);var s=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in s&&s.value!==n.value&&(n.value=s.value==null?"":s.value)};var Bs={Fragment:D};const F={queries:{viewBox:"0 0 24 24",elements:['<ellipse cx="12" cy="5" rx="9" ry="3"/>','<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>','<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>']},events:{viewBox:"0 0 24 24",elements:['<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>']},emails:{viewBox:"0 0 24 24",elements:['<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>','<polyline points="22,6 12,13 2,6"/>']},routes:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<line x1="2" y1="12" x2="22" y2="12"/>','<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>']},logs:{viewBox:"0 0 24 24",elements:['<line x1="8" y1="6" x2="21" y2="6"/>','<line x1="8" y1="12" x2="21" y2="12"/>','<line x1="8" y1="18" x2="21" y2="18"/>','<line x1="3" y1="6" x2="3.01" y2="6"/>','<line x1="3" y1="12" x2="3.01" y2="12"/>','<line x1="3" y1="18" x2="3.01" y2="18"/>']},timeline:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},cache:{viewBox:"0 0 24 24",elements:['<rect x="2" y="2" width="20" height="8" rx="2" ry="2"/>','<rect x="2" y="14" width="20" height="8" rx="2" ry="2"/>','<line x1="6" y1="6" x2="6.01" y2="6"/>','<line x1="6" y1="18" x2="6.01" y2="18"/>']},jobs:{viewBox:"0 0 24 24",elements:['<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/>','<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>']},config:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="3"/>','<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>']},internals:{viewBox:"0 0 24 24",elements:['<rect x="4" y="4" width="16" height="16" rx="2"/>','<rect x="9" y="9" width="6" height="6"/>','<line x1="9" y1="1" x2="9" y2="4"/>','<line x1="15" y1="1" x2="15" y2="4"/>','<line x1="9" y1="20" x2="9" y2="23"/>','<line x1="15" y1="20" x2="15" y2="23"/>','<line x1="20" y1="9" x2="23" y2="9"/>','<line x1="20" y1="14" x2="23" y2="14"/>','<line x1="1" y1="9" x2="4" y2="9"/>','<line x1="1" y1="14" x2="4" y2="14"/>']},overview:{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="7" height="7"/>','<rect x="14" y="3" width="7" height="7"/>','<rect x="14" y="14" width="7" height="7"/>','<rect x="3" y="14" width="7" height="7"/>']},requests:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},"dashboard-timeline":{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<polyline points="12 6 12 12 16 14"/>']},"custom-pane":{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="18" height="18" rx="2"/>','<path d="M9 3v18"/>']},wrench:{viewBox:"0 0 24 24",elements:['<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>']},"external-link":{viewBox:"0 0 24 24",elements:['<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>','<polyline points="15 3 21 3 21 9"/>','<line x1="10" y1="14" x2="21" y2="3"/>']},sun:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="5"/>','<line x1="12" y1="1" x2="12" y2="3"/>','<line x1="12" y1="21" x2="12" y2="23"/>','<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>','<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>','<line x1="1" y1="12" x2="3" y2="12"/>','<line x1="21" y1="12" x2="23" y2="12"/>','<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>','<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>']},moon:{viewBox:"0 0 24 24",elements:['<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>']},search:{viewBox:"0 0 24 24",elements:['<circle cx="11" cy="11" r="8"/>','<line x1="21" y1="21" x2="16.65" y2="16.65"/>']},eye:{viewBox:"0 0 24 24",elements:['<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>','<circle cx="12" cy="12" r="3"/>']},"eye-off":{viewBox:"0 0 24 24",elements:['<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"/>','<path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"/>','<line x1="1" y1="1" x2="23" y2="23"/>','<path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/>']},"chevron-right":{viewBox:"0 0 24 24",elements:['<path d="M9 18l6-6-6-6"/>']},"chevron-left":{viewBox:"0 0 24 24",elements:['<path d="M15 18l-6-6 6-6"/>']},"open-external":{viewBox:"0 0 16 16",elements:['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']}};async function Us(){if(typeof window<"u"&&window.Transmit&&typeof window.Transmit=="function")return window.Transmit;try{const e=await import("@adonisjs/transmit-client");return e.Transmit??e.default??null}catch{return null}}function zs(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const l=await Us();if(!l)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new l({baseUrl:e.baseUrl||window.location.origin,...e.authToken?{beforeSubscribe(i){return{headers:{Authorization:`Bearer ${e.authToken}`}}},beforeUnsubscribe(i){return{headers:{Authorization:`Bearer ${e.authToken}`}}}}:{}}),n=s.subscription(e.channelName),n.onMessage(i=>{r||e.onMessage(i)}),await n.create()}catch(l){e.onError&&e.onError(l)}},unsubscribe:async()=>{r=!0;try{n&&(await n.delete(),n=null),s&&(s=null)}catch{}}}}function Hs(e){let s=!1;const n=zs({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{s=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{s||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class He extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class Vs extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Ve{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const o={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:o,credentials:this.authToken?"omit":"include"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new He(a.status);if(!a.ok){const l=await a.text().catch(()=>"");throw new Vs(a.status,l)}return a.json()}async get(s,n){const r=n?`${s}?${n}`:s;return this.fetch(r)}async post(s,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(s,r)}async delete(s){return this.fetch(s,{method:"DELETE"})}}const Ws=5e3,Dt=1e4,Ot=100,Ks=500,Js={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function Qs(e){return Js[e]||`/${e}`}class Gs{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const o=Qs(s),a=n?`${this.basePath}${o}?${n}`:`${this.basePath}${o}`;return this.client.fetch(a,r)}async fetchChart(s){return this.client.fetch(`${this.basePath}/overview/chart?range=${s}`)}async fetchGroupedQueries(){return this.client.fetch(`${this.basePath}/queries/grouped`)}async explainQuery(s){return this.client.fetch(`${this.basePath}/queries/${s}/explain`)}async retryJob(s){return this.client.fetch(`${this.basePath}/jobs/${s}/retry`,{method:"POST"})}async fetchCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s){return this.client.fetch(`${this.basePath}/emails/${s}/preview`)}}function Ys(e){const s=new URLSearchParams;if(e.page!==null&&e.page!==void 0&&s.set("page",String(e.page)),e.perPage!==null&&e.perPage!==void 0&&s.set("perPage",String(e.perPage)),e.search&&s.set("search",e.search),e.sort&&s.set("sort",e.sort),e.sortDir&&s.set("direction",e.sortDir),e.timeRange&&s.set("range",e.timeRange),e.filters)for(const[n,r]of Object.entries(e.filters))r&&s.set(n,r);return s.toString()}function Xs(e,s,n=2){if(s<=1)return[1];const r=[],o=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),o>2&&r.push("...");for(let l=o;l<=a;l++)r.push(l);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class Zs{client;api;callbacks;endpoint;perPage;section;page=1;search;sort;sortDir;filters;timeRange;timer=null;fetchId=0;explicitFetchPending=!1;hasFetched=!1;stopped=!1;abortController=null;constructor(s){this.client=new Ve({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new Gs(this.client,s.endpoint),this.endpoint=s.endpoint,this.section=s.section,this.perPage=s.perPage,this.callbacks=s.callbacks}start(){this.stopped=!1,this.fetch(!1),this.startRefreshTimer()}stop(){this.stopped=!0,this.stopRefreshTimer(),this.abortController?.abort(),this.abortController=null}async fetch(s=!0){if(s&&this.explicitFetchPending)return;this.abortController?.abort();const n=new AbortController;this.abortController=n;const r=++this.fetchId,o=this.section;if(!o)return;const a=this.filters,l=this.sort?this.sort.replace(/[A-Z]/g,c=>"_"+c.toLowerCase()):void 0,i=Ys({page:this.page,perPage:this.perPage,search:this.search,sort:l,sortDir:this.sort?this.sortDir:void 0,filters:a&&Object.keys(a).length>0?a:void 0,timeRange:o.startsWith("overview")?this.timeRange:void 0});s||(this.callbacks.onLoading(!0),this.explicitFetchPending=!0);try{const c=await this.api.fetchSection(o,i||void 0,{signal:n.signal});if(r!==this.fetchId||this.stopped)return;if(c&&typeof c=="object"&&c.data!==void 0&&c.meta!==void 0){const d=c;this.callbacks.onData(d.data),this.callbacks.onPagination(d.meta)}else this.callbacks.onData(c),this.callbacks.onPagination(null);this.callbacks.onError(null),this.callbacks.onLoading(!1),this.hasFetched=!0}catch(c){if(c instanceof DOMException&&c.name==="AbortError"||n.signal.aborted||r!==this.fetchId||this.stopped)return;if(c instanceof He){this.callbacks.onError(c),this.callbacks.onLoading(!1),this.stopRefreshTimer(),this.callbacks.onUnauthorized();return}s||(this.callbacks.onError(c instanceof Error?c:new Error(String(c))),this.callbacks.onLoading(!1))}finally{s||(this.explicitFetchPending=!1)}}setSection(s){this.section!==s&&(this.section=s,this.page=1,this.search=void 0,this.sort=void 0,this.sortDir=void 0,this.filters=void 0,this.hasFetched=!1,this.callbacks.onData(null),this.callbacks.onPagination(null),this.callbacks.onLoading(!0),this.callbacks.onError(null),this.fetch(!1),this.startRefreshTimer())}setPage(s){this.page=s,this.fetch(!1)}setSearch(s){this.search=s||void 0,this.page=1,this.fetch(!1)}setFilter(s,n){this.filters||(this.filters={}),this.filters[s]=String(n),this.page=1,this.fetch(!1)}setSort(s,n){this.sort===s&&!n?this.sortDir=this.sortDir==="asc"?"desc":"asc":(this.sort=s,this.sortDir=n||"desc"),this.fetch(!1)}setTimeRange(s){this.timeRange=s,this.fetch(!1)}async mutate(s,n="post",r){const o=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(o,r):await this.client.delete(o);return await this.fetch(!0),a}catch(a){throw a instanceof Error?a:new Error(String(a))}}configure(s){s.page!==void 0&&(this.page=s.page),s.perPage!==void 0&&(this.perPage=s.perPage),this.search=s.search,this.sort=s.sort,this.sortDir=s.sortDir,this.filters=s.filters,this.timeRange=s.timeRange}hasData(){return this.hasFetched}handleRefreshSignal(){this.hasFetched&&this.fetch(!0)}getApi(){return this.api}getClient(){return this.client}startRefreshTimer(){this.stopRefreshTimer();const s=this.section==="overview"?Ws:Dt;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function J(e,s={}){const{baseUrl:n="",dashboardEndpoint:r="/__stats/api",authToken:o,page:a=1,perPage:l=50,search:i,sort:c,sortDir:d,filters:p,timeRange:h,refreshKey:y}=s,[f,_]=k(null),[g,S]=k(null),[x,w]=k(!0),[u,N]=k(null),b=V(null),L=V(e),M=V(!1);b.current||(b.current=new Zs({baseUrl:n,endpoint:r,authToken:o,section:e,perPage:l,callbacks:{onData:E=>_(E),onPagination:E=>S(E),onLoading:E=>w(E),onError:E=>N(E),onUnauthorized:()=>{}}})),H(()=>{const E=b.current,$=L.current!==e;return L.current=e,E.configure({page:a,perPage:l,search:i,sort:c,sortDir:d,filters:p,timeRange:h}),$||!M.current?($?E.setSection(e):E.start(),M.current=!0):E.fetch(!0),()=>{E.stop()}},[e,a,l,i,c,d,p,h,y]);const q=P(()=>{b.current?.fetch(!0)},[]),O=P(async(E,$="post",R)=>b.current.mutate(E,$,R),[]),U=P(()=>b.current.getApi(),[]);return{data:f,meta:g,isLoading:x,error:u,refresh:q,mutate:O,getApi:U}}const Ft="/admin/api/debug",jt={tracing:!1,process:!1,system:!1,http:!1,db:!1,redis:!1,queues:!1,cache:!1,app:!1,log:!1,emails:!1,dashboard:!1,customPanes:[]};function en(e){return{tracing:e.features?.tracing??!1,process:e.features?.process??!1,system:e.features?.system??!1,http:e.features?.http??!1,db:e.features?.db??!1,redis:e.features?.redis??!1,queues:e.features?.queues??!1,cache:e.features?.cache??!1,app:e.features?.app??!1,log:e.features?.log??!1,emails:e.features?.emails??!1,dashboard:e.features?.dashboard??!1,customPanes:e.customPanes??[]}}async function tn(e,s=Ft){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function sn(e){const{baseUrl:s="",debugEndpoint:n=Ft,authToken:r}=e,o=new Ve({baseUrl:s,authToken:r});try{const a=await tn(o,n);return en(a)}catch{return jt}}function nn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[o,a]=k(jt),[l,i]=k(!0),[c,d]=k(null),p=V(!1);return H(()=>{if(p.current)return;p.current=!0;let h=!1;return(async()=>{try{const f=await sn({baseUrl:s,debugEndpoint:n,authToken:r});h||(a(f),i(!1))}catch(f){h||(d(f instanceof Error?f:new Error(String(f))),i(!1))}})(),()=>{h=!0}},[s,n,r]),{features:o,isLoading:l,error:c}}const Te="ss-dash-theme",We="ss-theme-change";function Le(){if(typeof window>"u")return"light";const e=localStorage.getItem(Te);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function rn(e){typeof window>"u"||(localStorage.setItem(Te,e),window.dispatchEvent(new CustomEvent(We,{detail:e})))}function an(){const s=Le()==="dark"?"light":"dark";return rn(s),s}function It(e){if(typeof window>"u")return()=>{};const s=a=>{const l=a.detail;(l==="dark"||l==="light")&&e(l)},n=a=>{if(a.key===Te){const l=a.newValue;e(l==="dark"||l==="light"?l:Le())}},r=window.matchMedia("(prefers-color-scheme: dark)"),o=a=>{localStorage.getItem(Te)||e(a.matches?"dark":"light")};return window.addEventListener(We,s),window.addEventListener("storage",n),r.addEventListener("change",o),()=>{window.removeEventListener(We,s),window.removeEventListener("storage",n),r.removeEventListener("change",o)}}function ln(){const[e,s]=k(()=>Le());H(()=>It(o=>{s(o)}),[]);const n=P(()=>{const r=an();return s(r),r},[]);return{theme:e,toggleTheme:n}}function on({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const o=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:o?"Switch to light theme":"Switch to dark theme","aria-label":o?"Switch to light theme":"Switch to dark theme",children:o?t("svg",{width:"16",height:"16",viewBox:F.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:F.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.moon.elements.join("")}})})}const cn=["overview","requests","queries","events","routes","logs","emails","timeline","cache","jobs","config","internals"],dn=Q(()=>Promise.resolve().then(()=>Fn)),hn=Q(()=>Promise.resolve().then(()=>Vn)),un=Q(()=>Promise.resolve().then(()=>Jn)),pn=Q(()=>Promise.resolve().then(()=>Qn)),fn=Q(()=>Promise.resolve().then(()=>Gn)),mn=Q(()=>Promise.resolve().then(()=>nr)),_n=Q(()=>Promise.resolve().then(()=>rr)),vn=Q(()=>Promise.resolve().then(()=>ar)),yn=Q(()=>Promise.resolve().then(()=>lr)),gn=Q(()=>Promise.resolve().then(()=>hr)),bn=Q(()=>Promise.resolve().then(()=>gr)),wn=Q(()=>Promise.resolve().then(()=>Pr));function Bt(e){return e==="timeline"?"dashboard-timeline":e}function Nn(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:o,backUrl:a="/",channelName:l="server-stats/dashboard"}=e,{features:i}=nn({baseUrl:s,debugEndpoint:r,authToken:o}),{theme:c,toggleTheme:d}=ln(),[p,h]=k("overview"),[y,f]=k(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[_,g]=k(!1),[S,x]=k(0),w=V(0);H(()=>{if(!l)return;const $=Hs({baseUrl:s,channelName:l,authToken:o,onMessage:()=>{w.current+=1,x(w.current)},onConnect:()=>g(!0),onDisconnect:()=>g(!1),onError:()=>g(!1)});return()=>$.unsubscribe()},[s,l,o]);const u=i.customPanes||[],N=P($=>{const R=$.replace("#","").split("?")[0];return R&&[...cn,...u.map(m=>m.id)].includes(R)?R:"overview"},[u]);H(()=>{if(typeof window>"u")return;const $=N(window.location.hash);($!=="overview"||window.location.hash)&&h($)},[N]),H(()=>{const $=()=>{const R=N(window.location.hash);R!==p&&h(R)};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[p,N]),H(()=>{typeof window>"u"||(window.location.hash=p)},[p]);const b=P(()=>{f($=>{const R=!$;return localStorage.setItem("ss-dash-sidebar",R?"collapsed":"expanded"),R})},[]),L=z(()=>[{id:"overview",label:"Overview",visible:!0},{id:"requests",label:"Requests",visible:!0},{id:"queries",label:"Queries",visible:!0},{id:"events",label:"Events",visible:!0},{id:"routes",label:"Routes",visible:!0},{id:"logs",label:"Logs",visible:!0},{id:"emails",label:"Emails",visible:!0},{id:"timeline",label:"Timeline",visible:i.tracing},{id:"cache",label:"Cache",visible:i.cache},{id:"jobs",label:"Jobs",visible:i.queues},{id:"config",label:"Config",visible:!0},{id:"internals",label:"Internals",visible:!0}],[i]),M=z(()=>L.filter($=>$.visible),[L]),q=z(()=>({baseUrl:s,dashboardEndpoint:n,authToken:o,refreshKey:S}),[s,n,o,S]),{data:O}=J("overview",q),U=z(()=>{if(!O)return{};const $={};if(O.totalRequests>0&&($.requests={count:O.totalRequests}),O.queryStats?.total>0&&($.queries={count:O.queryStats.total}),O.logLevelBreakdown){const R=O.logLevelBreakdown,ne=R.error+R.warn+R.info+R.debug;ne>0&&($.logs={count:ne})}return $},[O]),E=P(()=>{const $={overview:t(dn,{options:q}),requests:t(hn,{options:q}),queries:t(un,{options:q}),events:t(pn,{options:q}),routes:t(fn,{options:q}),logs:t(mn,{options:q}),emails:t(_n,{options:q}),timeline:t(vn,{options:q}),cache:t(yn,{options:q}),jobs:t(gn,{options:q}),config:t(bn,{options:q}),internals:t(wn,{options:q,debugEndpoint:r})};return t("div",{className:"ss-dash-pane ss-dash-active",id:`ss-dash-pane-${p}`,children:t("div",{className:"ss-dash-pane-inner",children:t($e,{fallback:t("div",{className:"ss-dash-empty",children:"Loading..."}),children:$[p]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})},[p,q]);return t("div",{className:"ss-dash","data-theme":c,id:"ss-dash",children:[t("div",{className:"ss-dash-header",children:[t("div",{className:"ss-dash-header-left",children:[t("span",{className:"ss-dash-logo",children:"Server Stats"}),t("span",{className:"ss-dash-logo-sub",children:"Dashboard"})]}),t("div",{className:"ss-dash-header-center",children:[t("span",{className:`ss-dash-live-dot ${_?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${_?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:_?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(on,{theme:c,onToggle:d}),a&&t("a",{href:a,className:"ss-dash-back-link",title:"Back to app",children:"← App"})]})]}),t("div",{className:"ss-dash-body",children:[t("div",{className:`ss-dash-sidebar ${y?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",children:[M.map($=>{const R=U[$.id];return t("button",{type:"button",className:`ss-dash-nav-item ${p===$.id?"ss-dash-active":""}`,"data-ss-section":$.id,onClick:()=>{$.id!==p&&h($.id)},title:y?$.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(F[Bt($.id)]||F.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(F[Bt($.id)]||F.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:$.label}),R&&R.count>0&&t("span",{className:`ss-dash-nav-badge${R.variant?" "+R.variant:""}`,children:R.count})]},$.id)}),u.length>0&&t("div",{className:"ss-dash-nav-sep"}),u.map($=>t("button",{type:"button",className:`ss-dash-nav-item ${p===$.id?"ss-dash-active":""}`,onClick:()=>h($.id),title:y?$.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:F["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:$.label})]},$.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:b,title:y?"Expand sidebar":"Collapse sidebar",children:y?t("svg",{width:"16",height:"16",viewBox:F["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:F["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:F["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:F["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:E()})]})]})}function xn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function kn(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Le()),It(e)}const de=xn("ss-dash-config");kn();const Ut=document.getElementById("ss-dash");Ut&&ks(t(Nn,{baseUrl:de.baseUrl,dashboardEndpoint:de.dashboardEndpoint,debugEndpoint:de.debugEndpoint,authToken:de.authToken,backUrl:de.backUrl,channelName:de.channelName}),Ut);function Sn(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),o=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${o}m`:o>0?`${o}m ${s%60}s`:`${s}s`}function re(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:e>=1?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`}function ae(e){if(!e)return"-";const s=typeof e=="string"?new Date(e):new Date(e);return Number.isNaN(s.getTime())?"-":s.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+String(s.getMilliseconds()).padStart(3,"0")}function X(e){if(!e)return"-";const s=typeof e=="string"?new Date(e).getTime():e,n=Math.floor((Date.now()-s)/1e3);return n<0?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function Y(e){return e>Ks?"very-slow":e>Ot?"slow":"normal"}function Ke(e,s=100){if(e===null)return"null";if(e===void 0)return"-";if(typeof e=="string")return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"';if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){if(e.length===0)return"[]";const r="["+e.slice(0,3).map(o=>Ke(o,30)).join(", ")+(e.length>3?", ..."+e.length+" items":"")+"]";return r.length>s?"["+e.length+" items]":r}if(typeof e=="object"){const n=Object.keys(e);if(n.length===0)return"{}";const r=[];for(let a=0;a<Math.min(n.length,4);a++)r.push(n[a]+": "+Ke(e[n[a]],30));const o="{ "+r.join(", ")+(n.length>4?", ...+"+(n.length-4):"")+" }";return o.length>s?"{ "+n.slice(0,6).join(", ")+(n.length>6?", ...":"")+" }":o}return String(e)}function $n(e){return e<0?"no expiry":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Cn(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}const Tn={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function Ln(e){return{...Tn,...e}}let En=0;function An(){return`ss-grad-${En++}`}function Pn(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let o=1;o<e.length;o++){const a=e[o];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function Mn(e,s){if(e.length<2)return null;const n=Ln(s),r=Pn(e),o=r.max-r.min||1,a=n.width-n.padding*2,l=n.height-n.padding*2,i=n.padding,c=e.length,d=Array.from({length:c});for(let g=0;g<c;g++){const S=i+g/(c-1)*a,x=i+l-(e[g]-r.min)/o*l;d[g]=`${S.toFixed(1)},${x.toFixed(1)}`}const p=d.join(" "),h=(i+a).toFixed(1),y=(i+l).toFixed(1),f=i.toFixed(1),_=`M${d[0]} `+d.slice(1).map(g=>`L${g}`).join(" ")+` L${h},${y} L${f},${y} Z`;return{points:p,areaPath:_,gradientId:An(),options:n,stats:r}}function Ee({data:e,color:s="#34d399",width:n=120,height:r=32,className:o=""}){const a=z(()=>Mn(e,{width:n,height:r}),[e,n,r]),l=z(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),i={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${o}`,style:i,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:t("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const c=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${o}`,style:i,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:c,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:c,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${l})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const qn=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"30m",label:"30m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"}];function Rn({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:qn.map(r=>t("button",{type:"button",className:`ss-dash-btn ${e===r.value?"ss-dash-active":""}`,onClick:()=>s(r.value),children:r.label},r.value))})}function Dn(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;let a;o<=1?a=r:o<=2?a=2*r:o<=5?a=5*r:a=10*r;const l=[];for(let i=a;i<=e+a*.5;i+=a)l.push(Math.round(i));return l.length===0&&l.push(Math.ceil(e)),l}function zt(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function Ht(e){if(e.length===0)return"";if(e.length===1)return`M${e[0].x},${e[0].y}`;let s=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=0;n<e.length-1;n++){const r=e[n],o=e[n+1],a=(r.x+o.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${o.y.toFixed(1)} ${o.x.toFixed(1)},${o.y.toFixed(1)}`}return s}function Vt(e){const s=Y(e);return s==="very-slow"?"ss-dash-very-slow":s==="slow"?"ss-dash-slow":""}function On({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=V(null),[o,a]=k(0);H(()=>{const C=r.current;if(!C)return;a(C.clientWidth);const T=new ResizeObserver(j=>{for(const G of j)a(G.contentRect.width)});return T.observe(C),()=>T.disconnect()},[]);const l=o||600,i=l-s.left-s.right,c=n-s.top-s.bottom,d=s.top+c,p=e.map(C=>{const T=C;return(C.requestCount??0)+(Number(T.request_count)||0)||C.total||0}),h=e.map(C=>{const T=C;return(C.errorCount??0)+(Number(T.error_count)||0)}),y=Math.max(...p,1),f=Math.ceil(y*1.1),_=h.some(C=>C>0),g=Dn(f,4),S=g.length>0?g[g.length-1]:f,x=C=>s.left+C/Math.max(e.length-1,1)*i,w=C=>s.top+c-C/(S||1)*c,u=e.map((C,T)=>({x:x(T),y:w(p[T])})),N=e.map((C,T)=>({x:x(T),y:w(h[T])})),b=Ht(u),L=_?Ht(N):"",M=u.length>1?`${b} L${u[u.length-1].x.toFixed(1)},${d} L${u[0].x.toFixed(1)},${d} Z`:"",q=_&&N.length>1?`${L} L${N[N.length-1].x.toFixed(1)},${d} L${N[0].x.toFixed(1)},${d} Z`:"",O=Math.min(10,e.length),U=Math.max(1,Math.ceil(e.length/O)),[E,$]=k({visible:!1,x:0,idx:-1}),R=P(C=>{const T=u[C].x;$({visible:!0,x:T,idx:C})},[u]),ne=P(()=>{$({visible:!1,x:0,idx:-1})},[]),m=120,v=E.visible?Math.max(m/2,Math.min(E.x,l-m/2)):0;return t("div",{ref:r,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${l} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:"ss-cg-total",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-accent)",stopOpacity:.3}),t("stop",{offset:"100%",stopColor:"var(--ss-accent)",stopOpacity:.02})]}),t("linearGradient",{id:"ss-cg-error",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-red-fg)",stopOpacity:.35}),t("stop",{offset:"100%",stopColor:"var(--ss-red-fg)",stopOpacity:.02})]})]}),g.map(C=>{const T=w(C);return t("g",{children:[t("line",{x1:s.left,y1:T,x2:l-s.right,y2:T,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:T,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:C})]},`ytick-${C}`)}),M&&t("path",{d:M,fill:"url(#ss-cg-total)"}),b&&t("path",{d:b,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),q&&t("path",{d:q,fill:"url(#ss-cg-error)"}),L&&t("path",{d:L,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((C,T)=>{const j=p[T],G=h[T],K=u[T].x,oe=u[T].y,ms=i/(e.length||1),_s=E.visible&&E.idx===T,vs=E.visible&&E.idx!==T;return t("g",{children:[t("rect",{x:K-ms/2,y:s.top,width:ms,height:c,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":T,onMouseEnter:()=>R(T),onMouseLeave:ne}),j>0&&t("circle",{cx:K,cy:oe,r:_s?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":T,opacity:vs?.3:1}),G>0&&t("circle",{cx:K,cy:N[T].y,r:_s?3.5:2,fill:"var(--ss-red-fg)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot ss-dash-chart-dot-err","data-idx":T,opacity:vs?.3:1})]},T)}),e.map((C,T)=>{if(T%U!==0&&T!==e.length-1)return null;const j=zt(C.bucket);return j?t("text",{x:x(T),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:j},`xlabel-${T}`):null})]}),E.visible&&E.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:v,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:zt(e[E.idx].bucket)}),t("div",{children:["Requests: ",p[E.idx]]}),h[E.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",h[E.idx]]})]})]})}function Wt({options:e={}}){const[s,n]=k("1h"),{data:r,isLoading:o}=J("overview",e),{data:a}=J("overview/chart",{...e,timeRange:s});if(o&&!r)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const l=r||{avgResponseTime:0,p95ResponseTime:0,requestsPerMinute:0,errorRate:0,totalRequests:0,slowestEndpoints:[],queryStats:{total:0,avgDuration:0,perRequest:0},recentErrors:[],topEvents:[],emailActivity:{sent:0,queued:0,failed:0},logLevelBreakdown:{error:0,warn:0,info:0,debug:0},cacheStats:null,jobQueueStatus:null,statusDistribution:{"2xx":0,"3xx":0,"4xx":0,"5xx":0},slowestQueries:[]},i=l,c=l.avgResponseTime||Number(i.avg_response_time)||0,d=l.p95ResponseTime||Number(i.p95_response_time)||0,p=l.requestsPerMinute||Number(i.requests_per_minute)||0,h=l.errorRate||Number(i.error_rate)||0,f=(l.totalRequests||Number(i.total_requests)||0)>0,_=a?.buckets||[],g=l.sparklines?.avgResponseTime??_.map(u=>u.avgDuration??0),S=l.sparklines?.p95ResponseTime??_.map(u=>u.p95Duration??0),x=l.sparklines?.requestsPerMinute??_.map(u=>u.requestCount??0),w=l.sparklines?.errorRate??_.map(u=>u.errorCount??0);return t("div",{className:"ss-dash-overview",children:[t("div",{className:"ss-dash-cards",children:[t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Avg Response Time"}),t("div",{className:`ss-dash-card-value ${f?c>500?"ss-dash-red":c>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?re(c):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:g,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"P95 Response Time"}),t("div",{className:`ss-dash-card-value ${f?d>500?"ss-dash-red":d>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?re(d):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:S,color:"#60a5fa",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Requests / min"}),t("div",{className:`ss-dash-card-value ${f?"ss-dash-accent":"ss-dash-dim"}`,children:f?p.toFixed(1):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:x,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Error Rate"}),t("div",{className:`ss-dash-card-value ${f?h>5?"ss-dash-red":h>1?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?`${h.toFixed(1)}%`:"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:w,color:"#f87171",width:160,height:40})})]})]}),t("div",{className:"ss-dash-chart-container",children:[t("div",{className:"ss-dash-chart-header",children:[t("span",{className:"ss-dash-chart-title",children:"Request Volume"}),t(Rn,{value:s,onChange:n})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:_.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(On,{chartPoints:_})}),t("div",{className:"ss-dash-chart-legend",id:"ss-dash-chart-legend",children:[t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-accent)"}}),"Requests"]}),_.some(u=>(u.errorCount??0)>0)&&t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-red-fg)"}}),"Errors"]})]})]}),t("div",{className:"ss-dash-secondary-cards",children:[t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Slowest Endpoints"})}),l.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestEndpoints.slice(0,5).map((u,N)=>{const b=u.url||u.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:b,children:b}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${Vt(u.avgDuration)}`,children:re(u.avgDuration)})]})},N)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Query Stats"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:[t("span",{children:"Total Queries"}),t("span",{className:"ss-dash-secondary-list-value",children:l.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:re(l.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:l.queryStats.perRequest.toFixed(1)})]})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-link",children:"Recent Errors"})}),l.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:l.recentErrors.map((u,N)=>t("li",{children:t("a",{href:`#logs?id=${u.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:u.message,children:u.message}),u.timestamp&&t("span",{className:"ss-dash-secondary-list-value",style:{color:"var(--ss-dim)"},title:ae(u.timestamp),children:X(u.timestamp)})]})},N))})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#events",className:"ss-dash-widget-link",children:"Top Events"})}),l.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.topEvents.slice(0,5).map((u,N)=>{const b=u.name||u.eventName||u.event_name||u.event||"";return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:b}),t("span",{className:"ss-dash-secondary-list-value",children:u.count})]})},N)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#emails",className:"ss-dash-widget-link",children:"Email Activity"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#emails?status=sent",className:"ss-dash-widget-row-link",children:[t("span",{children:"Sent"}),t("span",{className:"ss-dash-secondary-list-value",children:l.emailActivity.sent})]})}),t("li",{children:t("a",{href:"#emails?status=queued",className:"ss-dash-widget-row-link",children:[t("span",{children:"Queued"}),t("span",{className:"ss-dash-secondary-list-value",children:l.emailActivity.queued})]})}),t("li",{children:t("a",{href:"#emails?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:l.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.emailActivity.failed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs",className:"ss-dash-widget-link",children:"Log Levels"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"Error"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.error})]})}),t("li",{children:t("a",{href:"#logs?level=warn",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"Warn"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.warn})]})}),t("li",{children:t("a",{href:"#logs?level=info",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"Info"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.info})]})}),t("li",{children:t("a",{href:"#logs?level=debug",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-dim)"},children:"Debug"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.debug})]})})]})]}),l.cacheStats&&l.cacheStats.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#cache",className:"ss-dash-widget-link",children:"Cache"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Keys"}),t("span",{className:"ss-dash-secondary-list-value",children:l.cacheStats.totalKeys})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Hit Rate"}),t("span",{className:"ss-dash-secondary-list-value",children:[l.cacheStats.hitRate.toFixed(1),"%"]})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Memory"}),t("span",{className:"ss-dash-secondary-list-value",children:l.cacheStats.memoryUsedHuman})]})})]})]}),l.jobQueueStatus&&l.jobQueueStatus.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#jobs",className:"ss-dash-widget-link",children:"Job Queue"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#jobs?status=active",className:"ss-dash-widget-row-link",children:[t("span",{children:"Active"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.active})]})}),t("li",{children:t("a",{href:"#jobs?status=waiting",className:"ss-dash-widget-row-link",children:[t("span",{children:"Waiting"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.waiting})]})}),t("li",{children:t("a",{href:"#jobs?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:l.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.jobQueueStatus.failed})]})}),t("li",{children:t("a",{href:"#jobs?status=completed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Completed"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.completed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Response Status"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#requests?status=2xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"2xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["2xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=3xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-blue-fg)"},children:"3xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["3xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=4xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"4xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["4xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=5xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"5xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["5xx"]})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Slowest Queries"})}),l.slowestQueries.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No query data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestQueries.slice(0,5).map((u,N)=>{const b=u.sqlNormalized||u.normalizedSql||u.sql_normalized||u.sql||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:b,children:b}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${Vt(u.avgDuration)}`,children:re(u.avgDuration)})]})},N)})})]})]})]})}const Fn=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:Wt,default:Wt},Symbol.toStringTag,{value:"Module"}));function jn(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function In(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Je(e,s,n,r=0){return e[s]??e[n]??r}function Kt(e){return{method:e.method||"",url:e.url||"",statusCode:Je(e,"status_code","statusCode"),totalDuration:Je(e,"total_duration","totalDuration")||e.duration||0,spanCount:Je(e,"span_count","spanCount"),spans:jn(e.spans),warnings:In(e.warnings)}}function Qe(e="",s){const n=V(null);return P(()=>(n.current||(n.current=new Ve({baseUrl:e,authToken:s})),n.current),[e,s])}function Bn({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function fe({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function Ae({code:e,className:s="",classPrefix:n="ss-dash"}){let r=`${n}-status-2xx`;return e>=500?r=`${n}-status-5xx`:e>=400?r=`${n}-status-4xx`:e>=300&&(r=`${n}-status-3xx`),t("span",{className:`${n}-status ${r} ${s}`,children:e})}const Un="ss-col-resize",Jt="ss-resizing";function Qt(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function o(){if(!r){r=!0;for(const a of s)a.style.width=a.offsetWidth+"px";e.style.tableLayout="fixed"}}for(const a of s){let l=function(c){c.preventDefault(),c.stopPropagation(),o();const d=c.clientX,p=a.offsetWidth;i.classList.add(Jt),i.setPointerCapture(c.pointerId);function h(f){const _=f.clientX-d,g=Math.max(30,p+_);a.style.width=g+"px"}function y(){i.classList.remove(Jt),i.removeEventListener("pointermove",h),i.removeEventListener("pointerup",y)}i.addEventListener("pointermove",h),i.addEventListener("pointerup",y)};if(!a.textContent?.trim())continue;const i=document.createElement("div");i.className=Un,a.appendChild(i),i.addEventListener("pointerdown",l),n.push(()=>{i.removeEventListener("pointerdown",l),i.remove()})}return()=>{for(const a of n)a()}}function zn(e=[]){const s=V(null),n=V(null);return H(()=>(s.current&&(n.current?.(),n.current=Qt(s.current)),()=>{n.current?.(),n.current=null}),e),P(o=>{n.current?.(),n.current=null,s.current=o,o&&(n.current=Qt(o))},[])}function te({columns:e,data:s,keyField:n="id",sort:r,sortDir:o,onSort:a,onRowClick:l,rowClassName:i,emptyMessage:c="No data",className:d="",renderAfterRow:p}){const h=P(f=>{a&&a(f)},[a]),y=zn([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:c}):t("table",{ref:y,className:`ss-dash-table ${d}`,children:[t("colgroup",{children:e.map(f=>t("col",{style:f.width?{width:f.width}:void 0},f.key))}),t("thead",{children:t("tr",{children:e.map(f=>t("th",{onClick:f.sortable?()=>h(f.key):void 0,className:f.sortable?"ss-dash-sortable":"",children:[f.label,r===f.key&&t("span",{className:"ss-dash-sort-arrow",children:o==="asc"?" ▲":" ▼"})]},f.key))})}),t("tbody",{children:s.map((f,_)=>{const g=i?typeof i=="function"?i(f):i:"",S=l?"ss-dash-clickable":"";return t(Bs.Fragment,{children:[t("tr",{onClick:l?()=>l(f):void 0,className:`${S} ${g}`.trim(),children:e.map(x=>t("td",{children:x.render?x.render(f[x.key],f):f[x.key]??"-"},x.key))}),p?p(f,_):null]},f[n]??_)})})]})}function se({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:o,className:a=""}){const l=P(()=>{s("")},[s]);return t("div",{className:`ss-dash-filter-bar ${a}`,children:[r!=null&&t("span",{className:"ss-dash-summary",children:r}),t("div",{className:"ss-dash-search-wrapper",children:[t("svg",{className:"ss-dash-search-icon",width:"14",height:"14",viewBox:F.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.search.elements.join("")}}),t("input",{type:"text",className:"ss-dash-search",placeholder:n,value:e,onChange:i=>s(i.target.value)}),e&&t("button",{type:"button",className:"ss-dash-search-clear",onClick:l,children:"×"})]}),o&&t("div",{className:"ss-dash-filter-controls",children:o})]})}function ie({page:e,lastPage:s,total:n,onPageChange:r,className:o=""}){const a=z(()=>Xs(e,s),[e,s]),l=P(()=>{e>1&&r(e-1)},[e,r]),i=P(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${o}`,children:[t("span",{className:"ss-dash-page-info",children:["Page ",e," of ",s," (",n," total)"]}),t("div",{className:"ss-dash-pagination-controls",children:[t("button",{type:"button",className:"ss-dash-page-btn",onClick:l,disabled:e<=1,children:"« Prev"}),a.map((c,d)=>c==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${d}`):t("button",{type:"button",className:`ss-dash-page-btn ${c===e?"ss-dash-active":""}`,onClick:()=>r(c),children:c},c)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:i,disabled:e>=s,children:"Next »"})]})]})}const Gt={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},Hn={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function Yt({spans:e,totalDuration:s,className:n="",warnings:r}){const o=e||[],a=z(()=>[...o].sort((i,c)=>i.startOffset-c.startOffset),[o]),l=z(()=>{const i={};for(const c of a)i[c.id]=c.parentId?(i[c.parentId]||0)+1:0;return i},[a]);return o.length===0?t("div",{className:"ss-dash-empty",children:"No spans recorded"}):t("div",{className:`ss-dash-tl-waterfall ${n}`,children:[t("div",{className:"ss-dash-tl-legend",children:Object.entries(Hn).map(([i,c])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:Gt[i]||Gt.custom}}),t("span",{children:c})]},i))}),a.map(i=>{const c=s>0?i.startOffset/s*100:0,d=s>0?Math.max(i.duration/s*100,.5):1,p=l[i.id]||0,h=i.label.length>50?i.label.slice(0,50)+"...":i.label,y=i.category==="db"?"DB":i.category,f=i.category==="db"?"purple":i.category==="mail"?"green":i.category==="event"?"amber":i.category==="view"?"blue":"muted",_=i.metadata?Object.entries(i.metadata).filter(([,S])=>S!=null).map(([S,x])=>`${S}=${x}`).join(", "):"",g=_?`${i.label} (${i.duration.toFixed(2)}ms)
2
- ${_}`:`${i.label} (${i.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:g,style:{paddingLeft:8+p*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${f}`,style:{fontSize:"9px",marginRight:"4px"},children:y}),h]}),t("div",{className:"ss-dash-tl-track",children:t("div",{className:`ss-dash-tl-bar ss-dash-tl-bar-${i.category||"custom"}`,style:{left:`${c}%`,width:`${d}%`},title:g})}),t("span",{className:"ss-dash-tl-dur",children:[i.duration.toFixed(2),"ms"]})]},i.id)}),r&&r.length>0&&t("div",{className:"ss-dash-tl-warnings",children:[t("div",{className:"ss-dash-tl-warnings-title",children:["Warnings (",r.length,")"]}),r.map((i,c)=>t("div",{className:"ss-dash-tl-warning",children:i},c))]})]})}function Xt({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("createdAt"),[i,c]=k("desc"),[d,p]=k(null),[h,y]=k(!1);H(()=>n(1),[r]);const{data:f,meta:_,isLoading:g,error:S}=J("requests",{...e,page:s,search:r,sort:a,sortDir:i}),x=Qe(e.baseUrl||"",e.authToken),w=P(b=>{const L=b.id;y(!0);const M=e.dashboardEndpoint||"/__stats/api";x().fetch(`${M}/requests/${L}`).then(q=>{p(q),y(!1)}).catch(()=>{y(!1)})},[x,e.dashboardEndpoint]),u=P(b=>{a===b?c(L=>L==="asc"?"desc":"asc"):(l(b),c("desc"))},[a]),N=f||[];if(d){const b=Kt(d);return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:()=>p(null),children:"← Back to Requests"}),t(fe,{method:b.method}),t("span",{style:{color:"var(--ss-text)"},children:b.url}),t(Ae,{code:b.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[b.totalDuration.toFixed(1),"ms · ",b.spanCount," spans"]})]}),t(Yt,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings})]})}return h?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>y(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter requests...",summary:`${_?.total??0} requests`}),S&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),g&&!f?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:b=>t("span",{style:{color:"var(--ss-dim)"},children:b})},{key:"method",label:"Method",width:"70px",sortable:!0,render:b=>t(fe,{method:b})},{key:"url",label:"URL",sortable:!0,render:b=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(b,L)=>{const M=L.status_code||L.statusCode||L.statusCode;return t(Ae,{code:M})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(b,L)=>{const M=L.total_duration||L.totalDuration||L.duration||0;return t("span",{className:`ss-dash-duration ${Y(M)==="very-slow"?"ss-dash-very-slow":Y(M)==="slow"?"ss-dash-slow":""}`,children:[M.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(b,L)=>{const M=L.span_count||L.spanCount||0;return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:M})}},{key:"warningCount",label:"⚠",width:"40px",render:(b,L)=>{const M=L.warning_count||L.warningCount||0;return M>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:M}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(b,L)=>{const M=L.createdAt||L.created_at||L.timestamp||"";return t("span",{className:"ss-dash-event-time",title:ae(M),children:X(M)})}}],data:N,sort:a,sortDir:i,onSort:u,onRowClick:w,emptyMessage:"No requests recorded yet"})}),_&&t(ie,{page:_.page,lastPage:_.lastPage,total:_.total,onPageChange:n})]})]})}const Vn=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:Xt,default:Xt},Symbol.toStringTag,{value:"Module"}));function Zt({node:e,depth:s=0}){if(!e)return null;const n=s*20,r=e["Node Type"]||"Unknown",o=e["Relation Name"]?t(D,{children:[" on ",t("strong",{children:e["Relation Name"]})]}):null,a=e.Alias&&e.Alias!==e["Relation Name"]?` (${e.Alias})`:"",l=e["Index Name"]?t(D,{children:[" using ",t("em",{children:e["Index Name"]})]}):null,i=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&i.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&i.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&i.push(`width=${e["Plan Width"]}`),e.Filter&&i.push(`filter: ${e.Filter}`),e["Index Cond"]&&i.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&i.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&i.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const d=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];i.push(`sort: ${d}`)}const c=e.Plans||[];return t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${n}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r}),o,a,l]}),i.length>0&&t("div",{className:"ss-dash-explain-metrics",children:i.join(" · ")}),c.map((d,p)=>t(Zt,{node:d,depth:s+1},p))]})}function Wn({plan:e}){if(!e||!Array.isArray(e)||e.length===0)return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"});const s=e[0];if(s&&s.Plan)return t("div",{className:"ss-dash-explain-result",children:t(Zt,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Object.keys(s);return t("div",{className:"ss-dash-explain-result",children:t("table",{children:[t("thead",{children:t("tr",{children:n.map(r=>t("th",{children:r},r))})}),t("tbody",{children:e.map((r,o)=>{const a=r;return t("tr",{children:n.map(l=>t("td",{children:a[l]!==null&&a[l]!==void 0?String(a[l]):"-"},l))},o)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const Kn=8;function es({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("createdAt"),[i,c]=k("desc"),[d,p]=k("list"),[h,y]=k(null),[f,_]=k(null),[g,S]=k(null),x=P(m=>{m!==d&&(p(m),n(1),l(m==="list"?"createdAt":"count"),c("desc"),y(null),_(null),S(null))},[d]);H(()=>n(1),[r]);const w=d==="grouped"?"queries/grouped":"queries",{data:u,meta:N,isLoading:b,mutate:L}=J(w,{...e,page:s,search:r,sort:a,sortDir:i}),M=P(m=>{a===m?c(v=>v==="asc"?"desc":"asc"):(l(m),c("desc"))},[a]),q=P(async m=>{if(f&&f.queryId===m){_(null);return}S(m);try{const v=await L(`queries/${m}/explain`);v&&v.error?_({queryId:m,plan:[],error:v.error,message:v.message}):_({queryId:m,plan:v?.plan||v?.rows||[]})}catch(v){console.warn("[ss] Query explain failed:",v),_({queryId:m,plan:[],error:v instanceof Error?v.message:String(v)})}finally{S(null)}},[L,f]),O=P(m=>{const v=m.id;return!f||f.queryId!==v?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:Kn,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:f.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",f.error,f.message&&t(D,{children:[t("br",{}),f.message]})]}):t(Wn,{plan:f.plan})}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>_(null),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})},[f]),U=d==="grouped"?u?.groups||[]:u||[],E=z(()=>d!=="grouped"?U:U.map(m=>{const v={...m};return(v.sqlNormalized===null||v.sqlNormalized===void 0)&&(m.sql_normalized||m.pattern)&&(v.sqlNormalized=m.sql_normalized||m.pattern||""),(v.count===null||v.count===void 0)&&m.total_count!==null&&m.total_count!==void 0&&(v.count=m.total_count),(v.avgDuration===null||v.avgDuration===void 0)&&m.avg_duration!==null&&m.avg_duration!==void 0&&(v.avgDuration=m.avg_duration),(v.maxDuration===null||v.maxDuration===void 0)&&m.max_duration!==null&&m.max_duration!==void 0&&(v.maxDuration=m.max_duration),(v.minDuration===null||v.minDuration===void 0)&&m.min_duration!==null&&m.min_duration!==void 0&&(v.minDuration=m.min_duration),(v.totalDuration===null||v.totalDuration===void 0)&&m.total_duration!==null&&m.total_duration!==void 0&&(v.totalDuration=m.total_duration),(v.percentOfTotal===null||v.percentOfTotal===void 0)&&m.pct_time!==null&&m.pct_time!==void 0&&(v.percentOfTotal=m.pct_time),v}),[U,d]),$=z(()=>{const m=N?.total??E.length;let v=0,C=0,T=0,j=0;for(const K of E){const oe=K.duration||0;T+=oe,j++,oe>Ot&&v++}const G=new Map;for(const K of E){const oe=K.sqlNormalized||K.sql||K.sql_text||"";G.set(oe,(G.get(oe)||0)+1)}for(const K of G.values())K>1&&(C+=K);return{total:m,slow:v,duplicates:C,avgDuration:j>0?T/j:0}},[E,N]),R=z(()=>{const m=new Map;for(const v of E){const C=v.sqlNormalized||v.sql||v.sql_text||"";m.set(C,(m.get(C)||0)+1)}return m},[E]),ne=z(()=>{if(d==="grouped")return`${E.length} query patterns`;const m=[`${$.total} queries`];return $.slow>0&&m.push(`${$.slow} slow`),$.duplicates>0&&m.push(`${$.duplicates} dup`),m.push(`avg ${($.avgDuration||0).toFixed(1)}ms`),m.join(", ")},[d,E.length,$]);return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter queries...",summary:ne,children:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${d==="list"?"ss-dash-active":""}`,onClick:()=>x("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${d==="grouped"?"ss-dash-active":""}`,onClick:()=>x("grouped"),children:"Grouped"})]})}),b&&!u?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):d==="grouped"?t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"sqlNormalized",label:"Pattern",render:(m,v)=>{const C=m||"",T=(v.count||0)>=3;return t(D,{children:[t("span",{className:`ss-dash-sql ${h===C?"ss-dash-expanded":""}`,title:"Click to expand",onClick:j=>{j.stopPropagation(),y(h===C?null:C)},role:"button",tabIndex:0,onKeyDown:j=>j.key==="Enter"&&y(h===C?null:C),children:C}),T&&t(D,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})}},{key:"count",label:"Count",width:"60px",sortable:!0,render:m=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:m||0})},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"minDuration",label:"Min",width:"70px",render:m=>t("span",{className:"ss-dash-duration",children:(m||0).toFixed(2)+"ms"})},{key:"maxDuration",label:"Max",width:"70px",render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,render:m=>t("span",{className:"ss-dash-duration",children:(m||0).toFixed(1)+"ms"})},{key:"percentOfTotal",label:"% Time",width:"60px",render:m=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(m||0).toFixed(1)+"%"})}],data:E,keyField:"sqlNormalized",sort:a,sortDir:i,onSort:M,emptyMessage:"No queries recorded"})})}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:m=>t("span",{style:{color:"var(--ss-dim)"},children:m})},{key:"sql",label:"SQL",render:(m,v)=>{const C=v.sql||v.sql_text||"";return t("div",{children:[t("span",{className:`ss-dash-sql ${h===v.id?"ss-dash-expanded":""}`,title:"Click to expand",onClick:T=>{T.stopPropagation(),y(h===v.id?null:v.id)},role:"button",tabIndex:0,onKeyDown:T=>T.key==="Enter"&&y(h===v.id?null:v.id),children:C}),(R.get((v.sqlNormalized||v.sql||v.sql_text)??"")??0)>1&&t("span",{className:"ss-dash-dup",children:["×",R.get((v.sqlNormalized||v.sql||v.sql_text)??"")]})]})}},{key:"duration",label:"Duration",width:"70px",sortable:!0,render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"method",label:"Method",width:"60px",render:(m,v)=>{const C=v.method||v.sql_method||"";return t("span",{className:`ss-dash-method ss-dash-method-${C.toLowerCase()}`,children:C})}},{key:"model",label:"Model",width:"90px",render:m=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m||"-"})},{key:"connection",label:"Connection",width:"80px",render:m=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m||"-"})},{key:"createdAt",label:"Time",width:"90px",sortable:!0,render:(m,v)=>{const C=m||v.created_at||v.timestamp||"";return t("span",{className:"ss-dash-event-time",title:ae(C),children:X(C)})}},{key:"id",label:"",width:"70px",render:(m,v)=>{if((v.method||v.sql_method||"")!=="select")return null;const T=f?.queryId===v.id&&!f?.error;return t("button",{type:"button",className:`ss-dash-explain-btn${T?" ss-dash-explain-btn-active":""}`,onClick:j=>{j.stopPropagation(),q(v.id)},disabled:g===v.id,children:g===v.id?"...":"EXPLAIN"})}}],data:E,sort:a,sortDir:i,onSort:M,emptyMessage:"No queries recorded",renderAfterRow:O})}),N&&t(ie,{page:N.page,lastPage:N.lastPage,total:N.total,onPageChange:n})]})]})}const Jn=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:es,default:es},Symbol.toStringTag,{value:"Module"}));function Ge({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash"}){const[o,a]=k(!1),l=z(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),i=z(()=>typeof l=="object"&&l!==null?Ke(l,s):String(l??"-"),[l,s]),c=z(()=>typeof l=="object"&&l!==null?JSON.stringify(l,null,2):String(l),[l]),d=P(()=>{a(h=>!h)},[]),p=P(async()=>{try{await navigator.clipboard.writeText(c)}catch{}},[c]);return!e&&e!==0&&e!==!1?t("span",{className:`ss-dim ${r}-c-dim`,children:"-"}):t("div",{className:`${r}-data-cell ${n}`,children:[t("span",{className:`${r}-data-preview`,onClick:d,role:"button",tabIndex:0,onKeyDown:h=>h.key==="Enter"&&d(),children:i}),o&&t("div",{className:`${r}-data-full`,onClick:d,children:[t("button",{className:`${r}-copy-btn`,onClick:h=>{h.stopPropagation(),p()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:c})]})]})}function ts({options:e={}}){const[s,n]=k(1),[r,o]=k(""),{data:a,meta:l,isLoading:i}=J("events",{...e,page:s,search:r}),c=a||[];return H(()=>n(1),[r]),t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter events...",summary:`${l?.total??0} events`}),i&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:d=>t("span",{style:{color:"var(--ss-dim)"},children:d})},{key:"eventName",label:"Event",render:(d,p)=>{const h=p.event_name||p.eventName||p.event||"";return t("span",{className:"ss-dash-event-name",title:h,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:h})}},{key:"data",label:"Data",render:d=>t(Ge,{data:d,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(d,p)=>{const h=p.createdAt||p.created_at||p.timestamp;return t("span",{className:"ss-dash-event-time",title:ae(h),children:X(h)})}}],data:c,emptyMessage:"No events recorded yet"})}),l&&t(ie,{page:l.page,lastPage:l.lastPage,total:l.total,onPageChange:n})]})]})}const Qn=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:ts,default:ts},Symbol.toStringTag,{value:"Module"}));function ss({options:e={}}){const[s,n]=k(""),{data:r,isLoading:o,error:a}=J("routes",{...e,search:s}),l=r,i=Array.isArray(l)?l:l&&Array.isArray(l.routes)?l.routes:l&&Array.isArray(l.data)?l.data:[],c={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(se,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${i.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):o&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"method",label:"Method",width:"70px",render:d=>t(fe,{method:d})},{key:"pattern",label:"Pattern",render:d=>t("span",{style:{color:"var(--ss-text)",...c},title:d,children:d})},{key:"name",label:"Name",width:"120px",render:d=>t("span",{style:{color:"var(--ss-muted)",...c},title:d||"-",children:d||"-"})},{key:"handler",label:"Handler",render:d=>t("span",{style:{color:"var(--ss-sql-color)",...c},title:d,children:d})},{key:"middleware",label:"Middleware",render:d=>{const p=d?.length?d.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...c},title:p,children:p})}}],data:i,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const Gn=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:ss,default:ss},Symbol.toStringTag,{value:"Module"})),Yn=["all","error","warn","info","debug"];function Xn(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function Zn(e){return e.msg||e.message||JSON.stringify(e)}function er(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function tr(e){const s=e.data||{};return e.requestId||e.request_id||e["x-request-id"]||s.requestId||s.request_id||s["x-request-id"]||""}function sr(e,s="ss-dbg-log-level"){switch(e){case"error":case"fatal":return`${s}-error`;case"warn":return`${s}-warn`;case"info":return`${s}-info`;case"debug":return`${s}-debug`;case"trace":return`${s}-trace`;default:return`${s}-info`}}function ns({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("all"),[i,c]=k(""),[d,p]=k(""),[h,y]=k([]),[f,_]=k("level"),[g,S]=k("equals"),[x,w]=k(""),u={};a!=="all"&&(u.level=a),i&&(u.request_id=i),h.forEach((m,v)=>{u[`filter_field_${v}`]=m.field,u[`filter_op_${v}`]=m.operator,u[`filter_value_${v}`]=m.value});const{data:N,meta:b,isLoading:L}=J("logs",{...e,page:s,search:r,filters:u}),M=N||[],q=P(m=>{c(m),p(m),n(1)},[]),O=P(()=>{const m=d.trim();c(m),n(1)},[d]),U=P(()=>{c(""),p(""),n(1)},[]),E=P(()=>{l("all"),n(1)},[]),$=P(()=>{const m=x.trim();m&&(y(v=>[...v,{field:f,operator:g,value:m}]),w(""))},[f,g,x]),R=P(m=>{y(v=>v.filter((C,T)=>T!==m))},[]),ne=a!=="all"||i!==""||h.length>0;return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Search logs...",summary:`${b?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[Yn.map(m=>t("button",{type:"button",className:`ss-dash-log-filter ${a===m?"ss-dash-active":""}`,onClick:()=>{l(m),n(1)},children:m},m)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:d,onChange:m=>p(m.target.value),onKeyDown:m=>m.key==="Enter"&&O()}),(d||i)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{U()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:f,onChange:m=>_(m.target.value),children:[t("option",{value:"level",children:"level"}),t("option",{value:"message",children:"message"}),t("option",{value:"request_id",children:"request_id"}),t("option",{value:"userId",children:"userId"}),t("option",{value:"email",children:"email"}),t("option",{value:"path",children:"path"})]}),t("select",{className:"ss-dash-filter-select",value:g,onChange:m=>S(m.target.value),children:[t("option",{value:"equals",children:"equals"}),t("option",{value:"contains",children:"contains"}),t("option",{value:"starts_with",children:"starts with"})]}),t("input",{className:"ss-dash-filter-input",placeholder:"Value...",value:x,onChange:m=>w(m.target.value),onKeyDown:m=>m.key==="Enter"&&$()}),t("button",{type:"button",className:"ss-dash-btn",onClick:$,children:"Add"})]}),ne&&t("div",{className:"ss-dash-filter-chips",children:[a!=="all"&&t("span",{className:"ss-dash-filter-chip",children:["level: ",a,t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:E,children:"×"})]}),i&&t("span",{className:"ss-dash-filter-chip",children:["requestId: ",i.slice(0,8),"...",t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:U,children:"×"})]}),h.map((m,v)=>t("span",{className:"ss-dash-filter-chip",children:[m.field," ",m.operator,' "',m.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>R(v),children:"×"})]},v))]}),L&&!N?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):M.length===0?t("div",{className:"ss-dash-empty",children:["No log entries",i?` matching request ${i}`:a!=="all"?` for ${a}`:""]}):t("div",{className:"ss-dash-log-entries",children:M.map((m,v)=>{const C=Xn(m),T=Zn(m),j=tr(m),G=er(m);return t("div",{className:"ss-dash-log-entry",children:[t("span",{className:`ss-dash-log-level ${sr(C,"ss-dash-log-level")}`,children:C.toUpperCase()}),t("span",{className:"ss-dash-log-time",title:G?ae(G):"",children:G?X(G):"-"}),j?t("span",{className:"ss-dash-log-reqid",title:j,onClick:()=>q(j),role:"button",tabIndex:0,onKeyDown:K=>K.key==="Enter"&&q(j),children:j.slice(0,8)}):t("span",{className:"ss-dash-log-reqid-empty",children:"--"}),t("span",{className:"ss-dash-log-msg",children:T})]},m.id||v)})}),b&&t(ie,{page:b.page,lastPage:b.lastPage,total:b.total,onPageChange:n})]})}const nr=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:ns,default:ns},Symbol.toStringTag,{value:"Module"}));function rs({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k(null),[i,c]=k(null),{data:d,meta:p,isLoading:h}=J("emails",{...e,page:s,search:r}),y=d||[];H(()=>n(1),[r]);const f=P(async _=>{if(_.html){l(_.id),c(_.html);return}try{const{baseUrl:g="",dashboardEndpoint:S="/__stats/api",authToken:x}=e,w=`${g}${S}/emails/${_.id}/preview`,u={Accept:"text/html"};x&&(u.Authorization=`Bearer ${x}`);const b=await(await fetch(w,{headers:u,credentials:"same-origin"})).text();l(_.id),c(b)}catch{}},[e]);if(a&&i){const _=y.find(g=>g.id===a);return t("div",{className:"ss-dash-email-preview",id:"ss-dash-email-preview",children:[t("div",{className:"ss-dash-email-preview-header",children:[t("div",{className:"ss-dash-email-preview-meta",id:"ss-dash-email-preview-meta",children:_&&t(D,{children:[t("strong",{children:"Subject:"})," ",_.subject,"  |  ",t("strong",{children:"From:"})," ",_.from_addr||_.from,"  |  ",t("strong",{children:"To:"})," ",_.to_addr||_.to,(_.cc||_.cc_addr)&&t(D,{children:["  |  ",t("strong",{children:"CC:"})," ",_.cc||_.cc_addr]}),"  |  ",t("strong",{children:"Status:"})," ",t("span",{className:`ss-dash-badge ss-dash-email-status-${_.status}`,children:_.status}),_.mailer&&t(D,{children:["  |  ",t("strong",{children:"Mailer:"})," ",_.mailer]})]})}),t("button",{type:"button",className:"ss-dash-btn",id:"ss-dash-email-preview-close",onClick:()=>{l(null),c(null)},children:"Close"})]}),t("iframe",{className:"ss-dash-email-iframe",id:"ss-dash-email-iframe",srcDoc:i,title:"Email preview",sandbox:""})]})}return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter emails...",summary:`${p?.total??0} emails`}),h&&!d?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:_=>t("span",{style:{color:"var(--ss-dim)"},children:_})},{key:"from",label:"From",width:"150px",render:(_,g)=>{const S=g.from_addr||g.from||"";return t("span",{title:S,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:S})}},{key:"to",label:"To",width:"150px",render:(_,g)=>{const S=g.to_addr||g.to||"";return t("span",{title:S,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:S})}},{key:"subject",label:"Subject",render:_=>{const g=_||"";return t("span",{title:g,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:g})}},{key:"status",label:"Status",width:"80px",render:_=>{const g=_||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${g}`,children:g})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(_,g)=>{const S=g.attachment_count||g.attachmentCount||0;return S>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:S}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:_=>{const g=_||"";return t("span",{title:g,style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:g})}},{key:"createdAt",label:"Time",width:"80px",render:(_,g)=>{const S=g.createdAt||g.created_at||g.timestamp;return t("span",{className:"ss-dash-event-time",style:{whiteSpace:"nowrap"},title:ae(S),children:X(S)})}}],data:y,onRowClick:f,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),p&&t(ie,{page:p.page,lastPage:p.lastPage,total:p.total,onPageChange:n})]})]})}const rr=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:rs,default:rs},Symbol.toStringTag,{value:"Module"}));function as({options:e={},tracingEnabled:s=!0}){const[n,r]=k(1),[o,a]=k(""),[l,i]=k(null),[c,d]=k(null),[p,h]=k(!1),{data:y,meta:f,isLoading:_,error:g}=J("traces",{...e,page:n,search:o}),S=y||[],x=Qe(e.baseUrl||"",e.authToken);H(()=>{if(!l){d(null);return}let u=!1;h(!0);const N=e.dashboardEndpoint||"/__stats/api";return x().fetch(`${N}/traces/${l}`).then(b=>{u||(d(b),h(!1))}).catch(()=>{u||h(!1)}),()=>{u=!0}},[l,x,e.dashboardEndpoint]);const w=P(()=>i(null),[]);if(!s)return t("div",{className:"ss-dash-empty",children:"Tracing is not enabled. Enable tracing in your server-stats config to use the timeline."});if(l&&c){const u=Kt(c);return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:w,children:"← Back"}),t(fe,{method:u.method}),t("span",{style:{color:"var(--ss-text)"},children:u.url}),t(Ae,{code:u.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[u.totalDuration.toFixed(1),"ms · ",u.spanCount," spans"]})]}),t(Yt,{spans:u.spans,totalDuration:u.totalDuration,warnings:u.warnings})]})}return l&&p?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:w,children:"← Back"})}),t("div",{className:"ss-dash-empty",children:"Loading trace detail..."})]}):t("div",{children:[t(se,{search:o,onSearchChange:a,placeholder:"Filter traces...",summary:`${f?.total??0} traces`}),g&&t("div",{className:"ss-dash-empty",children:"Failed to load traces"}),_&&!y?t("div",{className:"ss-dash-empty",children:"Loading traces..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:u=>t("span",{style:{color:"var(--ss-dim)"},children:u})},{key:"method",label:"Method",width:"70px",render:u=>t(fe,{method:u})},{key:"url",label:"URL",render:u=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u,children:u})},{key:"statusCode",label:"Status",width:"60px",render:u=>t(Ae,{code:u})},{key:"totalDuration",label:"Duration",width:"80px",render:u=>t("span",{className:`ss-dash-duration ${Y(u)==="very-slow"?"ss-dash-very-slow":Y(u)==="slow"?"ss-dash-slow":""}`,children:[u.toFixed(1),"ms"]})},{key:"spanCount",label:"Spans",width:"50px",render:u=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:u})},{key:"createdAt",label:"Time",width:"80px",render:u=>t("span",{className:"ss-dash-event-time",title:ae(u),children:X(u)})}],data:S,onRowClick:u=>i(u.id),emptyMessage:"No traces recorded"})}),f&&t(ie,{page:f.page,lastPage:f.lastPage,total:f.total,onPageChange:r})]})]})}const ar=Object.freeze(Object.defineProperty({__proto__:null,TimelineSection:as,default:as},Symbol.toStringTag,{value:"Module"}));function ls({options:e={}}){const[s,n]=k(""),[r,o]=k(null),[a,l]=k(null),[i,c]=k(!1),[d,p]=k(null),{data:h,isLoading:y,mutate:f,getApi:_}=J("cache",{...e,search:s}),g=h,S=P(async w=>{if(confirm(`Delete cache key "${w}"?`))try{await f(`cache/${encodeURIComponent(w)}`,"delete"),r===w&&(o(null),l(null),p(null))}catch{}},[f,r]),x=P(async w=>{if(r===w){o(null),l(null),p(null);return}o(w),l(null),p(null),c(!0);try{const N=await _().fetchCacheKey(w);l(N.value!==void 0?N.value:N.data!==void 0?N.data:N),p(null)}catch{l(null),p("Failed to fetch key value")}finally{c(!1)}},[r,_]);return t("div",{children:[g?.available&&g?.stats&&t("div",{className:"ss-dash-cache-stats",children:[t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Hit Rate:"}),t("span",{className:"ss-dash-cache-stat-value",children:[(g.stats.hitRate??0).toFixed(1),"%"]})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Hits:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.hits??0})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Misses:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.misses??0})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Keys:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.totalKeys||g.stats.keyCount||g.keys?.length||0})]})]}),t(se,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(g?.keys||g?.data||[]).length} keys`}),y&&!h?t("div",{className:"ss-dash-empty",children:"Loading cache..."}):!g||!g.available?t("div",{className:"ss-dash-empty",children:"Cache inspector not available"}):t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"key",label:"Key",render:w=>t("span",{title:w,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:w})},{key:"type",label:"Type",width:"70px",render:w=>t("span",{style:{color:"var(--ss-muted)"},children:w})},{key:"size",label:"Size",width:"60px",render:w=>w!=null&&w>0?Cn(w):"-"},{key:"ttl",label:"TTL",width:"70px",render:w=>w>0?$n(w):"-"},{key:"_actions",label:"",width:"60px",render:(w,u)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:N=>{N.stopPropagation(),S(u.key)},children:"Delete"})}],data:g.keys||g.data||[],keyField:"key",onRowClick:w=>x(w.key),emptyMessage:"No cache keys found"})}),r&&t("div",{className:"ss-dash-cache-detail",children:[t("h4",{children:["Key: ",r]}),i?t("div",{className:"ss-dash-empty",children:"Loading value..."}):d?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:d}):t(Ge,{data:a})]})]})}const lr=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:ls,default:ls},Symbol.toStringTag,{value:"Module"})),ir=["all","active","waiting","delayed","completed","failed"];function or(e){switch(e){case"active":return"blue";case"waiting":return"amber";case"delayed":return"purple";case"completed":return"green";case"failed":return"red";default:return"muted"}}function cr(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function dr(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function is({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("all"),[i,c]=k({}),d={};a!=="all"&&(d.status=a);const{data:p,meta:h,isLoading:y,error:f,refresh:_,mutate:g}=J("jobs",{...e,page:s,search:r,filters:d}),S=cr(p),x=dr(p),w=P(async u=>{c(N=>({...N,[u]:"pending"}));try{await g(`jobs/${u}/retry`),c(N=>({...N,[u]:"success"})),setTimeout(()=>{c(N=>{const b={...N};return delete b[u],b}),_()},1e3)}catch{c(N=>{const b={...N};return delete b[u],b})}},[g,_]);return t("div",{children:[x&&t("div",{className:"ss-dash-job-stats",children:[t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Active:"}),t("span",{className:"ss-dash-job-stat-value",children:x.active??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Waiting:"}),t("span",{className:"ss-dash-job-stat-value",children:x.waiting??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Delayed:"}),t("span",{className:"ss-dash-job-stat-value",children:x.delayed??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Completed:"}),t("span",{className:"ss-dash-job-stat-value",children:x.completed??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Failed:"}),t("span",{className:"ss-dash-job-stat-value",style:{color:"var(--ss-red-fg)"},children:x.failed??0})]})]}),t(se,{search:r,onSearchChange:o,placeholder:"Filter jobs...",summary:`${h?.total??S.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:ir.map(u=>t("button",{type:"button",className:`ss-dash-btn ${a===u?"ss-dash-active":""}`,onClick:()=>{l(u),n(1)},children:u.charAt(0).toUpperCase()+u.slice(1)},u))})}),y&&!p?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):f?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"ID",width:"40px",render:u=>t("span",{style:{color:"var(--ss-dim)"},children:u})},{key:"name",label:"Name",render:u=>t("span",{style:{color:"var(--ss-text)"},title:u,children:u})},{key:"status",label:"Status",width:"90px",render:u=>t(Bn,{color:or(u),children:u})},{key:"payload",label:"Payload",render:(u,N)=>t(Ge,{data:u||N?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(u,N)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:u||N.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:u=>t("span",{className:"ss-dash-duration",children:u!==null?re(u):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(u,N)=>{const b=u||N?.createdAt||N?.processedAt||N?.created_at;return t("span",{className:"ss-dash-event-time",style:{whiteSpace:"nowrap"},title:ae(b),children:X(b)})}},{key:"_actions",label:"",width:"50px",render:(u,N)=>{const b=N.id,L=i[b];return N.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:L==="pending"||L==="success",onClick:M=>{M.stopPropagation(),w(b)},children:L==="pending"?"...":L==="success"?"OK":"Retry"})}}],data:S,emptyMessage:"No jobs found"})}),h&&t(ie,{page:h.page,lastPage:h.lastPage,total:h.total,onPageChange:n})]})]})}const hr=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:is,default:is},Symbol.toStringTag,{value:"Module"}));function W(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.__redacted===!0}function Ye(e,s=""){if(typeof e!="object"||e===null||e===void 0)return[{path:s,value:e}];if(Array.isArray(e)||W(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const o=s?`${s}.${r}`:r,a=e[r];typeof a=="object"&&a!==null&&!Array.isArray(a)&&!W(a)?n.push(...Ye(a,o)):n.push({path:o,value:a})}return n}function Xe(e){return e==null?{text:"null",color:"var(--ss-dim)"}:typeof e=="boolean"?{text:String(e),color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"}:typeof e=="number"?{text:String(e),color:"var(--ss-amber-fg)"}:Array.isArray(e)?{text:`[${e.map(n=>n==null?"null":typeof n=="object"?JSON.stringify(n):String(n)).join(", ")}]`,color:"var(--ss-purple-fg)"}:typeof e=="object"?{text:JSON.stringify(e),color:"var(--ss-dim)"}:{text:String(e)}}function os(e){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return 1;let s=0;for(const n of Object.keys(e))s+=os(e[n]);return s}function ur(e){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return[];const s=[];for(const n of Object.keys(e)){const r=e[n];r!==null&&typeof r=="object"&&!Array.isArray(r)&&!W(r)&&s.push(n)}return s}function Pe(e,s,n){s&&navigator.clipboard.writeText(e).then(()=>{const r=s.textContent;s.textContent="✓",s.classList.add(`${n}-copy-row-ok`),setTimeout(()=>{s.textContent=r,s.classList.remove(`${n}-copy-row-ok`)},1200)}).catch(()=>{})}function Me({redacted:e,p:s}){const[n,r]=k(!1);return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[t("span",{children:n?e.value:e.display}),t("button",{type:"button",className:`${s}-btn`,title:n?"Hide":"Reveal",style:{padding:"0 4px",fontSize:"0.85em",lineHeight:1,minWidth:"auto"},onClick:o=>{o.stopPropagation(),r(a=>!a)},children:n?t("svg",{width:"14",height:"14",viewBox:F["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["eye-off"].elements.join("")}}):t("svg",{width:"14",height:"14",viewBox:F.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.eye.elements.join("")}})})]})}function pr({env:e,search:s,p:n}){const r=V(new Map),o=s.toLowerCase(),a=Object.entries(e).filter(([l,i])=>{if(!o)return!0;const c=W(i)?i.display:i==null?"":String(i);return l.toLowerCase().includes(o)||c.toLowerCase().includes(o)});return t("div",{className:`${n}-config-table-wrap`,children:t("table",{className:`${n}-table ${n}-config-env-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Variable"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[a.map(([l,i])=>{const c=W(i),d=c?i.display:i==null?"null":String(i),p=`${l}=${d}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{className:`${n}-env-val`,children:c?t(Me,{redacted:i,p:n}):t("span",{className:`${n}-config-val`,children:d})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(l,h)},onClick:h=>{h.stopPropagation(),Pe(p,r.current.get(l)??null,n)},children:"⎘"})})]},l)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function fr({source:e,search:s,p:n}){const r=V(new Map),o=s.toLowerCase(),a=Ye(e,""),l=a.filter(i=>{const c=W(i.value)?i.value.display:i.value===null||i.value===void 0?"":String(i.value);return i.path.toLowerCase().includes(o)||c.toLowerCase().includes(o)});return t("div",{className:`${n}-config-table-wrap`,children:[t("table",{className:`${n}-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Path"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[l.map(i=>{const c=W(i.value),d=c?null:Xe(i.value),p=c?i.value.display:d.text,h=`${i.path}: ${p}`;return t("tr",{children:[t("td",{children:t("span",{className:`${n}-config-key`,style:{whiteSpace:"nowrap"},children:i.path})}),t("td",{children:c?t(Me,{redacted:i.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:d.color},children:d.text})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:y=>{r.current.set(i.path,y)},onClick:y=>{y.stopPropagation(),Pe(h,r.current.get(i.path)??null,n)},children:"⎘"})})]},i.path)}),l.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching entries"})})]})]}),t("div",{style:{padding:"4px 16px",fontSize:"10px",color:"var(--ss-muted)"},children:[l.length," of ",a.length," entries"]})]})}function mr({obj:e,prefix:s,p:n}){const r=V(new Map),o=Ye(e,s);return t("table",{className:`${n}-table ${n}-config-inner-table`,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"35%"},children:"Key"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:o.map(a=>{const l=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,i=W(a.value),c=i?null:Xe(a.value),d=i?a.value.display:c.text,p=`${a.path}: ${d}`;return t("tr",{children:[t("td",{title:l,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{title:d,children:i?t(Me,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:c.color},children:c.text})}),t("td",{children:!i&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(a.path,h)},onClick:h=>{h.stopPropagation(),Pe(p,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function _r({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(W(e))return t(Me,{redacted:e,p:s});if(typeof e=="boolean")return t("span",{className:`${s}-config-val`,style:{color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"},children:String(e)});if(typeof e=="number")return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-amber-fg)"},children:String(e)});if(Array.isArray(e)){const n=e.map(r=>r==null?"null":typeof r=="object"?JSON.stringify(r):String(r));return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-purple-fg)"},children:["[",n.join(", "),"]"]})}return typeof e=="object"?t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:JSON.stringify(e)}):t("span",{className:`${s}-config-val`,children:String(e)})}function vr({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return null;const o=Object.keys(e),a=V(new Map);return t("div",{className:`${r}-config-sections`,children:o.map(l=>{const i=e[l],c=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!W(i),d=s.has(l),p=W(i);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${c?"":` ${r}-config-leaf`}`,onClick:c?()=>n(l):void 0,style:{cursor:c?"pointer":"default"},children:[c?t("span",{className:`${r}-config-toggle`,children:d?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:l}),c?t("span",{className:`${r}-config-count`,children:[os(i)," entries"]}):t(D,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(_r,{value:i,p:r})}),!p&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:h=>{a.current.set(l,h)},onClick:h=>{h.stopPropagation();const y=Xe(i);Pe(`${l}: ${y.text}`,a.current.get(l)??null,r)},children:"⎘"})]})]}),c&&d&&t("div",{className:`${r}-config-section-body`,children:t(mr,{obj:i,prefix:l,p:r})})]},l)})})}function yr({data:e,isLoading:s,classPrefix:n}){const r=n,[o,a]=k(""),[l,i]=k(""),[c,d]=k("app"),[p,h]=k(new Set),[y,f]=k("Copy JSON");H(()=>{const u=setTimeout(()=>i(o),200);return()=>clearTimeout(u)},[o]);const _=e,g=P(u=>{h(N=>{const b=new Set(N);return b.has(u)?b.delete(u):b.add(u),b})},[]),S=P(()=>{if(!_)return;const u=c==="app"?_.app:_.env;if(!u)return;const N=ur(u);h(new Set(N))},[_,c]),x=P(()=>{h(new Set)},[]),w=P(async()=>{if(_)try{const u=c==="app"?_.app:_.env;await navigator.clipboard.writeText(JSON.stringify(u,null,2)),f("Copied!"),setTimeout(()=>f("Copy JSON"),1500)}catch{}},[_,c]);return t("div",{children:[t("div",{className:`${r}-config-toolbar`,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px"},children:[t("button",{type:"button",className:`${r}-config-tab${c==="app"?` ${r}-active`:""}`,onClick:()=>d("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${c==="env"?` ${r}-active`:""}`,onClick:()=>d("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:o,onChange:u=>a(u.target.value),style:{width:"100%"}}),o&&t("button",{type:"button",onClick:()=>a(""),style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"var(--ss-dim)",padding:"0 2px",lineHeight:1},children:"×"})]}),c==="app"&&!l&&t(D,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:S,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:x,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:w,children:y})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):_?c==="env"?t(pr,{env:_.env??{},search:l,p:r}):l?t(fr,{source:_.app??{},search:l,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(vr,{obj:_.app,expandedPaths:p,onToggle:g,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function cs({options:e={}}){const{data:s,isLoading:n}=J("config",e);return t(yr,{data:s,isLoading:n,classPrefix:"ss-dash"})}const gr=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:cs,default:cs},Symbol.toStringTag,{value:"Module"})),br=["password","secret","token","key","credential","auth"];function ds(e){const s=e.toLowerCase();return br.some(n=>s.includes(n))}function hs(e){if(e==null)return"-";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.join(", ")||"-";try{return JSON.stringify(e)}catch{return String(e)}}const wr={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function Nr(e){return wr[e]||e}const xr={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function kr(e){return xr[e]||e}const Sr=["healthy","active","connected","available","ready"],$r=["errored","unavailable"];function Cr(e){return Sr.includes(e)?"ok":$r.includes(e)?"err":""}function me({status:e,prefix:s}){const n=Cr(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const us=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:F.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.eye.elements.join("")}}),ps=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:F["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["eye-off"].elements.join("")}});function Tr({value:e}){const[s,n]=k(!1);return t("span",{children:[s?e:"••••••••"," ",t("button",{type:"button",onClick:()=>n(r=>!r),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:s?t(ps,{}):t(us,{})})]})}function Lr({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,o=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${o?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${o?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function Er({config:e,prefix:s}){const n=Object.entries(e);return n.length===0?t("span",{className:`${s}-c-dim`,children:"-"}):t("span",{className:`${s}-c-muted`,children:n.map(([r,o],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",ds(r)&&typeof o=="string"?t(Tr,{value:o}):t("span",{children:hs(o)})]},r))})}function _e({label:e,value:s,prefix:n}){return t("div",{className:`${n}-info-card`,children:[t("span",{className:`${n}-info-card-label`,children:e}),t("span",{className:`${n}-info-card-value`,children:s})]})}function Ar({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[o,a]=k(new Set),l=P(c=>{a(d=>{const p=new Set(d);return p.has(c)?p.delete(c):p.add(c),p})},[]),i=P((c,d)=>{if(d==null)return t("span",{className:`${r}-c-dim`,children:"null"});if(typeof d=="boolean")return t("span",{className:d?`${r}-c-green`:`${r}-c-red`,children:String(d)});if(Array.isArray(d))return t("span",{children:d.join(", ")||"-"});const p=hs(d);if(ds(c)){const h=o.has(c);return t("span",{children:[h?p:"••••••••"," ",t("button",{type:"button",onClick:()=>l(c),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:h?t(ps,{}):t(us,{})})]})}return t("span",{children:p})},[o,l,r]);return t("div",{children:[t("h3",{className:`${r}-internals-title`,children:"Package Info"}),t("div",{className:`${r}-info-cards`,children:[t(_e,{label:"Version",value:e.package.version||"-",prefix:r}),t(_e,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(_e,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(_e,{label:"Uptime",value:Sn(e.package.uptime),prefix:r}),t(_e,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(D,{children:[t("h3",{className:`${r}-internals-title`,children:"Collectors"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Collector"}),t("th",{children:"Status"}),t("th",{children:"Last Error"}),t("th",{children:"Config"})]})}),t("tbody",{children:e.collectors.map(c=>t("tr",{children:[t("td",{children:[t("code",{children:c.name}),c.label&&c.label!==c.name&&t("span",{className:`${r}-c-dim`,children:[" ",c.label]})]}),t("td",{children:[t(me,{status:c.status,prefix:r}),c.status]}),t("td",{className:c.lastError?`${r}-c-red`:`${r}-c-dim`,children:c.lastError?t(D,{children:[c.lastError,c.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:X(c.lastErrorAt)})]}):"-"}),t("td",{children:t(Er,{config:c.config,prefix:r})})]},c.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Buffers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Buffer"}),t("th",{children:"Usage"}),t("th",{children:"Fill %"})]})}),t("tbody",{children:Object.entries(e.buffers).map(([c,d])=>t("tr",{children:[t("td",{style:{textTransform:"capitalize"},children:c}),t("td",{children:[d.current.toLocaleString()," / ",d.max.toLocaleString()]}),t("td",{children:t(Lr,{current:d.current,max:d.max,prefix:r})})]},c))})]}),t("h3",{className:`${r}-internals-title`,children:"Timers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Timer"}),t("th",{children:"Status"}),t("th",{children:"Interval"})]})}),t("tbody",{children:Object.entries(e.timers).map(([c,d])=>t("tr",{children:[t("td",{children:Nr(c)}),t("td",{children:[t(me,{status:d.active?"active":"inactive",prefix:r}),t("span",{className:d.active?`${r}-c-green`:`${r}-c-dim`,children:d.active?"active":"inactive"})]}),t("td",{children:d.active?d.intervalMs?re(d.intervalMs):d.debounceMs?`${re(d.debounceMs)} (debounce)`:"-":t("span",{className:`${r}-c-dim`,children:"—"})})]},c))})]}),t("h3",{className:`${r}-internals-title`,children:"Integrations"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Integration"}),t("th",{children:"Status"}),t("th",{children:"Details"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Transmit (SSE)"}),t("td",{children:[t(me,{status:e.transmit.available?"connected":"inactive",prefix:r}),e.transmit.available?"connected":"unavailable"]}),t("td",{style:{fontSize:"11px"},children:e.transmit.channels.length>0?`Channels: ${e.transmit.channels.join(", ")}`:"-"})]}),Object.entries(e.integrations).map(([c,d])=>{const p=d.active??d.available??!1,h=d.active?"active":d.available?"available":"unavailable";let y=d.mode?`Mode: ${d.mode}`:"-";return c==="edgePlugin"&&d.active?y="@serverStats() tag registered":c==="cacheInspector"&&d.available?y="Redis dependency detected":c==="queueInspector"&&d.available&&(y="Queue dependency detected"),t("tr",{children:[t("td",{children:kr(c)}),t("td",{children:[t(me,{status:p?"active":"inactive",prefix:r}),h]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:y})]},c)})]})]}),e.storage&&t(D,{children:[t("h3",{className:`${r}-internals-title`,children:"Storage (SQLite)"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Metric"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Status"}),t("td",{children:[t(me,{status:e.storage.ready?"ready":"inactive",prefix:r}),e.storage.ready?"ready":"not ready"]})]}),t("tr",{children:[t("td",{children:"DB Path"}),t("td",{children:t("code",{children:e.storage.dbPath})})]}),t("tr",{children:[t("td",{children:"File Size"}),t("td",{children:[e.storage.fileSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"WAL Size"}),t("td",{children:[e.storage.walSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"Retention"}),t("td",{children:[e.storage.retentionDays," days"]})]}),t("tr",{children:[t("td",{children:"Last Cleanup"}),t("td",{children:e.storage.lastCleanupAt?X(e.storage.lastCleanupAt):"-"})]})]})]}),e.storage.tables.length>0&&t("table",{className:s,style:{marginTop:8},children:[t("thead",{children:t("tr",{children:[t("th",{children:"Table"}),t("th",{children:"Rows"})]})}),t("tbody",{children:e.storage.tables.map(c=>t("tr",{children:[t("td",{children:t("code",{children:c.name})}),t("td",{children:c.rowCount.toLocaleString()})]},c.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Resolved Config"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"intervalMs"}),t("td",{children:e.config.intervalMs})]}),t("tr",{children:[t("td",{children:"transport"}),t("td",{children:e.config.transport})]}),t("tr",{children:[t("td",{children:"channelName"}),t("td",{children:e.config.channelName})]}),t("tr",{children:[t("td",{children:"endpoint"}),t("td",{children:e.config.endpoint===!1?"false":e.config.endpoint})]}),t("tr",{children:[t("td",{children:"skipInTest"}),t("td",{children:i("skipInTest",e.config.skipInTest)})]}),t("tr",{children:[t("td",{children:"onStats callback"}),t("td",{children:e.config.hasOnStatsCallback?"defined":"not defined"})]}),t("tr",{children:[t("td",{children:"shouldShow callback"}),t("td",{children:e.config.hasShouldShowCallback?"defined":"not defined"})]})]})]}),t("h4",{className:`${r}-internals-title`,children:"DevToolbar"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:Object.entries(e.devToolbar).map(([c,d])=>t("tr",{children:[t("td",{children:c==="customPaneCount"?"customPanes":c}),t("td",{children:c==="customPaneCount"?`${d} registered`:i(c,d)})]},c))})]})]})}function fs({options:e={},debugEndpoint:s="/admin/api/debug"}){const{baseUrl:n="",authToken:r}=e,[o,a]=k(null),[l,i]=k(!0),[c,d]=k(null),p=V(null),h=Qe(n,r),y=P(async()=>{try{const _=await h().get(`${s}/diagnostics`);a(_),d(null),i(!1)}catch(f){if(f instanceof He){d(f),i(!1),p.current&&(clearInterval(p.current),p.current=null);return}d(f instanceof Error?f:new Error(String(f))),i(!1)}},[s,h]);return H(()=>(i(!0),d(null),y(),p.current=setInterval(y,Dt),()=>{p.current&&(clearInterval(p.current),p.current=null)}),[y]),l&&!o?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):c?t("div",{className:"ss-dash-empty",children:["Error: ",c.message]}):o?t(Ar,{data:o,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const Pr=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:fs,default:fs},Symbol.toStringTag,{value:"Module"}))})();
1
+ (function(){"use strict";var ve,A,Xe,le,et,tt,st,nt,qe,Re,De,ye={},ge=[],gs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,he=Array.isArray;function X(e,s){for(var n in s)e[n]=s[n];return e}function Oe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function be(e,s,n){var r,o,a,l={};for(a in s)a=="key"?r=s[a]:a=="ref"?o=s[a]:l[a]=s[a];if(arguments.length>2&&(l.children=arguments.length>3?ve.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)l[a]===void 0&&(l[a]=e.defaultProps[a]);return we(e,l,r,o,null)}function we(e,s,n,r,o){var a={type:e,props:s,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Xe,__i:-1,__u:0};return o==null&&A.vnode!=null&&A.vnode(a),a}function D(e){return e.children}function ee(e,s){this.props=e,this.context=s}function ce(e,s){if(s==null)return e.__?ce(e.__,e.__i+1):null;for(var n;s<e.__k.length;s++)if((n=e.__k[s])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ce(e):null}function bs(e){if(e.__P&&e.__d){var s=e.__v,n=s.__e,r=[],o=[],a=X({},s);a.__v=s.__v+1,A.vnode&&A.vnode(a),Fe(e.__P,a,s,e.__n,e.__P.namespaceURI,32&s.__u?[n]:null,r,n??ce(s),!!(32&s.__u),o),a.__v=s.__v,a.__.__k[a.__i]=a,dt(r,a,o),s.__e=s.__=null,a.__e!=n&&rt(a)}}function rt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(s){if(s!=null&&s.__e!=null)return e.__e=e.__c.base=s.__e}),rt(e)}function at(e){(!e.__d&&(e.__d=!0)&&le.push(e)&&!Ne.__r++||et!=A.debounceRendering)&&((et=A.debounceRendering)||tt)(Ne)}function Ne(){for(var e,s=1;le.length;)le.length>s&&le.sort(st),e=le.shift(),s=le.length,bs(e);Ne.__r=0}function lt(e,s,n,r,o,a,l,i,c,d,p){var h,y,f,_,g,S,x,w=r&&r.__k||ge,u=s.length;for(c=ws(n,s,w,c,u),h=0;h<u;h++)(f=n.__k[h])!=null&&(y=f.__i!=-1&&w[f.__i]||ye,f.__i=h,S=Fe(e,f,y,o,a,l,i,c,d,p),_=f.__e,f.ref&&y.ref!=f.ref&&(y.ref&&Ie(y.ref,null,f),p.push(f.ref,f.__c||_,f)),g==null&&_!=null&&(g=_),(x=!!(4&f.__u))||y.__k===f.__k?c=it(f,c,e,x):typeof f.type=="function"&&S!==void 0?c=S:_&&(c=_.nextSibling),f.__u&=-7);return n.__e=g,c}function ws(e,s,n,r,o){var a,l,i,c,d,p=n.length,h=p,y=0;for(e.__k=new Array(o),a=0;a<o;a++)(l=s[a])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[a]=we(null,l,null,null,null):he(l)?l=e.__k[a]=we(D,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[a]=we(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[a]=l,c=a+y,l.__=e,l.__b=e.__b+1,i=null,(d=l.__i=Ns(l,n,c,h))!=-1&&(h--,(i=n[d])&&(i.__u|=2)),i==null||i.__v==null?(d==-1&&(o>p?y--:o<p&&y++),typeof l.type!="function"&&(l.__u|=4)):d!=c&&(d==c-1?y--:d==c+1?y++:(d>c?y--:y++,l.__u|=4))):e.__k[a]=null;if(h)for(a=0;a<p;a++)(i=n[a])!=null&&(2&i.__u)==0&&(i.__e==r&&(r=ce(i)),ut(i,i));return r}function it(e,s,n,r){var o,a;if(typeof e.type=="function"){for(o=e.__k,a=0;o&&a<o.length;a++)o[a]&&(o[a].__=e,s=it(o[a],s,n,r));return s}e.__e!=s&&(r&&(s&&e.type&&!s.parentNode&&(s=ce(e)),n.insertBefore(e.__e,s||null)),s=e.__e);do s=s&&s.nextSibling;while(s!=null&&s.nodeType==8);return s}function xe(e,s){return s=s||[],e==null||typeof e=="boolean"||(he(e)?e.some(function(n){xe(n,s)}):s.push(e)),s}function Ns(e,s,n,r){var o,a,l,i=e.key,c=e.type,d=s[n],p=d!=null&&(2&d.__u)==0;if(d===null&&i==null||p&&i==d.key&&c==d.type)return n;if(r>(p?1:0)){for(o=n-1,a=n+1;o>=0||a<s.length;)if((d=s[l=o>=0?o--:a++])!=null&&(2&d.__u)==0&&i==d.key&&c==d.type)return l}return-1}function ot(e,s,n){s[0]=="-"?e.setProperty(s,n??""):e[s]=n==null?"":typeof n!="number"||gs.test(s)?n:n+"px"}function ke(e,s,n,r,o){var a,l;e:if(s=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(s in r)n&&s in n||ot(e.style,s,"");if(n)for(s in n)r&&n[s]==r[s]||ot(e.style,s,n[s])}else if(s[0]=="o"&&s[1]=="n")a=s!=(s=s.replace(nt,"$1")),l=s.toLowerCase(),s=l in e||s=="onFocusOut"||s=="onFocusIn"?l.slice(2):s.slice(2),e.l||(e.l={}),e.l[s+a]=n,n?r?n.u=r.u:(n.u=qe,e.addEventListener(s,a?De:Re,a)):e.removeEventListener(s,a?De:Re,a);else{if(o=="http://www.w3.org/2000/svg")s=s.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(s!="width"&&s!="height"&&s!="href"&&s!="list"&&s!="form"&&s!="tabIndex"&&s!="download"&&s!="rowSpan"&&s!="colSpan"&&s!="role"&&s!="popover"&&s in e)try{e[s]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&s[4]!="-"?e.removeAttribute(s):e.setAttribute(s,s=="popover"&&n==1?"":n))}}function ct(e){return function(s){if(this.l){var n=this.l[s.type+e];if(s.t==null)s.t=qe++;else if(s.t<n.u)return;return n(A.event?A.event(s):s)}}}function Fe(e,s,n,r,o,a,l,i,c,d){var p,h,y,f,_,g,S,x,w,u,N,b,L,M,q,O=s.type;if(s.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[i=s.__e=n.__e]),(p=A.__b)&&p(s);e:if(typeof O=="function")try{if(x=s.props,w="prototype"in O&&O.prototype.render,u=(p=O.contextType)&&r[p.__c],N=p?u?u.props.value:p.__:r,n.__c?S=(h=s.__c=n.__c).__=h.__E:(w?s.__c=h=new O(x,N):(s.__c=h=new ee(x,N),h.constructor=O,h.render=ks),u&&u.sub(h),h.state||(h.state={}),h.__n=r,y=h.__d=!0,h.__h=[],h._sb=[]),w&&h.__s==null&&(h.__s=h.state),w&&O.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=X({},h.__s)),X(h.__s,O.getDerivedStateFromProps(x,h.__s))),f=h.props,_=h.state,h.__v=s,y)w&&O.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),w&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(w&&O.getDerivedStateFromProps==null&&x!==f&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(x,N),s.__v==n.__v||!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(x,h.__s,N)===!1){s.__v!=n.__v&&(h.props=x,h.state=h.__s,h.__d=!1),s.__e=n.__e,s.__k=n.__k,s.__k.some(function(U){U&&(U.__=s)}),ge.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&l.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(x,h.__s,N),w&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(f,_,g)})}if(h.context=N,h.props=x,h.__P=e,h.__e=!1,b=A.__r,L=0,w)h.state=h.__s,h.__d=!1,b&&b(s),p=h.render(h.props,h.state,h.context),ge.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,b&&b(s),p=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++L<25);h.state=h.__s,h.getChildContext!=null&&(r=X(X({},r),h.getChildContext())),w&&!y&&h.getSnapshotBeforeUpdate!=null&&(g=h.getSnapshotBeforeUpdate(f,_)),M=p!=null&&p.type===D&&p.key==null?ht(p.props.children):p,i=lt(e,he(M)?M:[M],s,n,r,o,a,l,i,c,d),h.base=s.__e,s.__u&=-161,h.__h.length&&l.push(h),S&&(h.__E=h.__=null)}catch(U){if(s.__v=null,c||a!=null)if(U.then){for(s.__u|=c?160:128;i&&i.nodeType==8&&i.nextSibling;)i=i.nextSibling;a[a.indexOf(i)]=null,s.__e=i}else{for(q=a.length;q--;)Oe(a[q]);je(s)}else s.__e=n.__e,s.__k=n.__k,U.then||je(s);A.__e(U,s,n)}else a==null&&s.__v==n.__v?(s.__k=n.__k,s.__e=n.__e):i=s.__e=xs(n.__e,s,n,r,o,a,l,c,d);return(p=A.diffed)&&p(s),128&s.__u?void 0:i}function je(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(je))}function dt(e,s,n){for(var r=0;r<n.length;r++)Ie(n[r],n[++r],n[++r]);A.__c&&A.__c(s,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){A.__e(a,o.__v)}})}function ht(e){return typeof e!="object"||e==null||e.__b>0?e:he(e)?e.map(ht):X({},e)}function xs(e,s,n,r,o,a,l,i,c){var d,p,h,y,f,_,g,S=n.props||ye,x=s.props,w=s.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((f=a[d])&&"setAttribute"in f==!!w&&(w?f.localName==w:f.nodeType==3)){e=f,a[d]=null;break}}if(e==null){if(w==null)return document.createTextNode(x);e=document.createElementNS(o,w,x.is&&x),i&&(A.__m&&A.__m(s,a),i=!1),a=null}if(w==null)S===x||i&&e.data==x||(e.data=x);else{if(a=a&&ve.call(e.childNodes),!i&&a!=null)for(S={},d=0;d<e.attributes.length;d++)S[(f=e.attributes[d]).name]=f.value;for(d in S)f=S[d],d=="dangerouslySetInnerHTML"?h=f:d=="children"||d in x||d=="value"&&"defaultValue"in x||d=="checked"&&"defaultChecked"in x||ke(e,d,null,f,o);for(d in x)f=x[d],d=="children"?y=f:d=="dangerouslySetInnerHTML"?p=f:d=="value"?_=f:d=="checked"?g=f:i&&typeof f!="function"||S[d]===f||ke(e,d,f,S[d],o);if(p)i||h&&(p.__html==h.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),s.__k=[];else if(h&&(e.innerHTML=""),lt(s.type=="template"?e.content:e,he(y)?y:[y],s,n,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,l,a?a[0]:n.__k&&ce(n,0),i,c),a!=null)for(d=a.length;d--;)Oe(a[d]);i||(d="value",w=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[d]||w=="progress"&&!_||w=="option"&&_!=S[d])&&ke(e,d,_,S[d],o),d="checked",g!=null&&g!=e[d]&&ke(e,d,g,S[d],o))}return e}function Ie(e,s,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&s==null||(e.__u=e(s))}else e.current=s}catch(o){A.__e(o,n)}}function ut(e,s,n){var r,o;if(A.unmount&&A.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ie(r,null,s)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){A.__e(a,s)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&ut(r[o],s,n||typeof e.type!="function");n||Oe(e.__e),e.__c=e.__=e.__e=void 0}function ks(e,s,n){return this.constructor(e,n)}function Ss(e,s,n){var r,o,a,l;s==document&&(s=document.documentElement),A.__&&A.__(e,s),o=(r=!1)?null:s.__k,a=[],l=[],Fe(s,e=s.__k=be(D,null,[e]),o||ye,ye,s.namespaceURI,o?null:s.firstChild?ve.call(s.childNodes):null,a,o?o.__e:s.firstChild,r,l),dt(a,e,l)}ve=ge.slice,A={__e:function(e,s,n,r){for(var o,a,l;s=s.__;)if((o=s.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),l=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=o.__d),l)return o.__E=o}catch(i){e=i}throw e}},Xe=0,ee.prototype.setState=function(e,s){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=X({},this.state),typeof e=="function"&&(e=e(X({},n),this.props)),e&&X(n,e),e!=null&&this.__v&&(s&&this._sb.push(s),at(this))},ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),at(this))},ee.prototype.render=D,le=[],tt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,st=function(e,s){return e.__v.__b-s.__v.__b},Ne.__r=0,nt=/(PointerCapture)$|Capture$/i,qe=0,Re=ct(!1),De=ct(!0);var $s=0;function t(e,s,n,r,o,a){s||(s={});var l,i,c=s;if("ref"in c)for(i in c={},s)i=="ref"?l=s[i]:c[i]=s[i];var d={type:e,props:c,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--$s,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(l=e.defaultProps))for(i in l)c[i]===void 0&&(c[i]=l[i]);return A.vnode&&A.vnode(d),d}var ue,I,Be,pt,pe=0,ft=[],B=A,mt=B.__b,_t=B.__r,vt=B.diffed,yt=B.__c,gt=B.unmount,bt=B.__;function Ue(e,s){B.__h&&B.__h(I,e,pe||s),pe=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return pe=1,Cs(xt,e)}function Cs(e,s,n){var r=Ue(ue++,2);if(r.t=e,!r.__c&&(r.__=[n?n(s):xt(void 0,s),function(i){var c=r.__N?r.__N[0]:r.__[0],d=r.t(c,i);c!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.__f)){var o=function(i,c,d){if(!r.__c.__H)return!0;var p=r.__c.__H.__.filter(function(y){return y.__c});if(p.every(function(y){return!y.__N}))return!a||a.call(this,i,c,d);var h=r.__c.props!==i;return p.some(function(y){if(y.__N){var f=y.__[0];y.__=y.__N,y.__N=void 0,f!==y.__[0]&&(h=!0)}}),a&&a.call(this,i,c,d)||h};I.__f=!0;var a=I.shouldComponentUpdate,l=I.componentWillUpdate;I.componentWillUpdate=function(i,c,d){if(this.__e){var p=a;a=void 0,o(i,c,d),a=p}l&&l.call(this,i,c,d)},I.shouldComponentUpdate=o}return r.__N||r.__}function H(e,s){var n=Ue(ue++,3);!B.__s&&Nt(n.__H,s)&&(n.__=e,n.u=s,I.__H.__h.push(n))}function V(e){return pe=5,z(function(){return{current:e}},[])}function z(e,s){var n=Ue(ue++,7);return Nt(n.__H,s)&&(n.__=e(),n.__H=s,n.__h=e),n.__}function P(e,s){return pe=8,z(function(){return e},s)}function Ts(){for(var e;e=ft.shift();){var s=e.__H;if(e.__P&&s)try{s.__h.some(Se),s.__h.some(ze),s.__h=[]}catch(n){s.__h=[],B.__e(n,e.__v)}}}B.__b=function(e){I=null,mt&&mt(e)},B.__=function(e,s){e&&s.__k&&s.__k.__m&&(e.__m=s.__k.__m),bt&&bt(e,s)},B.__r=function(e){_t&&_t(e),ue=0;var s=(I=e.__c).__H;s&&(Be===I?(s.__h=[],I.__h=[],s.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(s.__h.some(Se),s.__h.some(ze),s.__h=[],ue=0)),Be=I},B.diffed=function(e){vt&&vt(e);var s=e.__c;s&&s.__H&&(s.__H.__h.length&&(ft.push(s)!==1&&pt===B.requestAnimationFrame||((pt=B.requestAnimationFrame)||Ls)(Ts)),s.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Be=I=null},B.__c=function(e,s){s.some(function(n){try{n.__h.some(Se),n.__h=n.__h.filter(function(r){return!r.__||ze(r)})}catch(r){s.some(function(o){o.__h&&(o.__h=[])}),s=[],B.__e(r,n.__v)}}),yt&&yt(e,s)},B.unmount=function(e){gt&&gt(e);var s,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Se(r)}catch(o){s=o}}),n.__H=void 0,s&&B.__e(s,n.__v))};var wt=typeof requestAnimationFrame=="function";function Ls(e){var s,n=function(){clearTimeout(r),wt&&cancelAnimationFrame(s),setTimeout(e)},r=setTimeout(n,35);wt&&(s=requestAnimationFrame(n))}function Se(e){var s=I,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),I=s}function ze(e){var s=I;e.__c=e.__(),I=s}function Nt(e,s){return!e||e.length!==s.length||s.some(function(n,r){return n!==e[r]})}function xt(e,s){return typeof s=="function"?s(e):s}function Es(e,s){for(var n in s)e[n]=s[n];return e}function kt(e,s){for(var n in e)if(n!=="__source"&&!(n in s))return!0;for(var r in s)if(r!=="__source"&&e[r]!==s[r])return!0;return!1}function St(e,s){this.props=e,this.context=s}(St.prototype=new ee).isPureReactComponent=!0,St.prototype.shouldComponentUpdate=function(e,s){return kt(this.props,e)||kt(this.state,s)};var $t=A.__b;A.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$t&&$t(e)};var As=A.__e;A.__e=function(e,s,n,r){if(e.then){for(var o,a=s;a=a.__;)if((o=a.__c)&&o.__c)return s.__e==null&&(s.__e=n.__e,s.__k=n.__k),o.__c(e,s)}As(e,s,n,r)};var Ct=A.unmount;function Tt(e,s,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Es({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=s),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Tt(r,s,n)})),e}function Lt(e,s,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Lt(r,s,n)}),e.__c&&e.__c.__P===s&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function $e(){this.__u=0,this.o=null,this.__b=null}function Et(e){if(!e.__)return null;var s=e.__.__c;return s&&s.__a&&s.__a(e)}function Q(e){var s,n,r,o=null;function a(l){if(s||(s=e()).then(function(i){i&&(o=i.default||i),r=!0},function(i){n=i,r=!0}),n)throw n;if(!r)throw s;return o?be(o,l):null}return a.displayName="Lazy",a.__f=!0,a}function Ce(){this.i=null,this.l=null}A.unmount=function(e){var s=e.__c;s&&(s.__z=!0),s&&s.__R&&s.__R(),s&&32&e.__u&&(e.type=null),Ct&&Ct(e)},($e.prototype=new ee).__c=function(e,s){var n=s.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var o=Et(r.__v),a=!1,l=function(){a||r.__z||(a=!0,n.__R=null,o?o(c):c())};n.__R=l;var i=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var d=r.state.__a;r.__v.__k[0]=Lt(d,d.__c.__P,d.__c.__O)}var p;for(r.setState({__a:r.__b=null});p=r.o.pop();)p.__P=i,p.forceUpdate()}};r.__u++||32&s.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(l,l)},$e.prototype.componentWillUnmount=function(){this.o=[]},$e.prototype.render=function(e,s){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Tt(this.__b,n,r.__O=r.__P)}this.__b=null}var o=s.__a&&be(D,null,e.fallback);return o&&(o.__u&=-33),[be(D,null,s.__a?null:e.children),o]};var At=function(e,s,n){if(++n[1]===n[0]&&e.l.delete(s),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Ce.prototype=new ee).__a=function(e){var s=this,n=Et(s.__v),r=s.l.get(e);return r[0]++,function(o){var a=function(){s.props.revealOrder?(r.push(o),At(s,e,r)):o()};n?n(a):a()}},Ce.prototype.render=function(e){this.i=null,this.l=new Map;var s=xe(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&s.reverse();for(var n=s.length;n--;)this.l.set(s[n],this.i=[1,0,this.i]);return e.children},Ce.prototype.componentDidUpdate=Ce.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(s,n){At(e,n,s)})};var Ps=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ms=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,qs=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Rs=/[A-Z0-9]/g,Ds=typeof document<"u",Os=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};ee.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(ee.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(s){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:s})}})});var Pt=A.event;function Fs(){}function js(){return this.cancelBubble}function Is(){return this.defaultPrevented}A.event=function(e){return Pt&&(e=Pt(e)),e.persist=Fs,e.isPropagationStopped=js,e.isDefaultPrevented=Is,e.nativeEvent=e};var Bs={enumerable:!1,configurable:!0,get:function(){return this.class}},Mt=A.vnode;A.vnode=function(e){typeof e.type=="string"&&(function(s){var n=s.props,r=s.type,o={},a=r.indexOf("-")===-1;for(var l in n){var i=n[l];if(!(l==="value"&&"defaultValue"in n&&i==null||Ds&&l==="children"&&r==="noscript"||l==="class"||l==="className")){var c=l.toLowerCase();l==="defaultValue"&&"value"in n&&n.value==null?l="value":l==="download"&&i===!0?i="":c==="translate"&&i==="no"?i=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?l="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||Os(n.type)?c==="onfocus"?l="onfocusin":c==="onblur"?l="onfocusout":qs.test(l)&&(l=c):c=l="oninput":a&&Ms.test(l)?l=l.replace(Rs,"-$&").toLowerCase():i===null&&(i=void 0),c==="oninput"&&o[l=c]&&(l="oninputCapture"),o[l]=i}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=xe(n.children).forEach(function(d){d.props.selected=o.value.indexOf(d.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=xe(n.children).forEach(function(d){d.props.selected=o.multiple?o.defaultValue.indexOf(d.props.value)!=-1:o.defaultValue==d.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",Bs)):n.className&&(o.class=o.className=n.className),s.props=o})(e),e.$$typeof=Ps,Mt&&Mt(e)};var qt=A.__r;A.__r=function(e){qt&&qt(e),e.__c};var Rt=A.diffed;A.diffed=function(e){Rt&&Rt(e);var s=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in s&&s.value!==n.value&&(n.value=s.value==null?"":s.value)};var Us={Fragment:D};const F={queries:{viewBox:"0 0 24 24",elements:['<ellipse cx="12" cy="5" rx="9" ry="3"/>','<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>','<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>']},events:{viewBox:"0 0 24 24",elements:['<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/>']},emails:{viewBox:"0 0 24 24",elements:['<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>','<polyline points="22,6 12,13 2,6"/>']},routes:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<line x1="2" y1="12" x2="22" y2="12"/>','<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>']},logs:{viewBox:"0 0 24 24",elements:['<line x1="8" y1="6" x2="21" y2="6"/>','<line x1="8" y1="12" x2="21" y2="12"/>','<line x1="8" y1="18" x2="21" y2="18"/>','<line x1="3" y1="6" x2="3.01" y2="6"/>','<line x1="3" y1="12" x2="3.01" y2="12"/>','<line x1="3" y1="18" x2="3.01" y2="18"/>']},timeline:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},cache:{viewBox:"0 0 24 24",elements:['<rect x="2" y="2" width="20" height="8" rx="2" ry="2"/>','<rect x="2" y="14" width="20" height="8" rx="2" ry="2"/>','<line x1="6" y1="6" x2="6.01" y2="6"/>','<line x1="6" y1="18" x2="6.01" y2="18"/>']},jobs:{viewBox:"0 0 24 24",elements:['<rect x="2" y="7" width="20" height="14" rx="2" ry="2"/>','<path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/>']},config:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="3"/>','<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>']},internals:{viewBox:"0 0 24 24",elements:['<rect x="4" y="4" width="16" height="16" rx="2"/>','<rect x="9" y="9" width="6" height="6"/>','<line x1="9" y1="1" x2="9" y2="4"/>','<line x1="15" y1="1" x2="15" y2="4"/>','<line x1="9" y1="20" x2="9" y2="23"/>','<line x1="15" y1="20" x2="15" y2="23"/>','<line x1="20" y1="9" x2="23" y2="9"/>','<line x1="20" y1="14" x2="23" y2="14"/>','<line x1="1" y1="9" x2="4" y2="9"/>','<line x1="1" y1="14" x2="4" y2="14"/>']},overview:{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="7" height="7"/>','<rect x="14" y="3" width="7" height="7"/>','<rect x="14" y="14" width="7" height="7"/>','<rect x="3" y="14" width="7" height="7"/>']},requests:{viewBox:"0 0 24 24",elements:['<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/>']},"dashboard-timeline":{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="10"/>','<polyline points="12 6 12 12 16 14"/>']},"custom-pane":{viewBox:"0 0 24 24",elements:['<rect x="3" y="3" width="18" height="18" rx="2"/>','<path d="M9 3v18"/>']},wrench:{viewBox:"0 0 24 24",elements:['<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>']},"external-link":{viewBox:"0 0 24 24",elements:['<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>','<polyline points="15 3 21 3 21 9"/>','<line x1="10" y1="14" x2="21" y2="3"/>']},sun:{viewBox:"0 0 24 24",elements:['<circle cx="12" cy="12" r="5"/>','<line x1="12" y1="1" x2="12" y2="3"/>','<line x1="12" y1="21" x2="12" y2="23"/>','<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>','<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>','<line x1="1" y1="12" x2="3" y2="12"/>','<line x1="21" y1="12" x2="23" y2="12"/>','<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>','<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>']},moon:{viewBox:"0 0 24 24",elements:['<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>']},search:{viewBox:"0 0 24 24",elements:['<circle cx="11" cy="11" r="8"/>','<line x1="21" y1="21" x2="16.65" y2="16.65"/>']},eye:{viewBox:"0 0 24 24",elements:['<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/>','<circle cx="12" cy="12" r="3"/>']},"eye-off":{viewBox:"0 0 24 24",elements:['<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"/>','<path d="M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"/>','<line x1="1" y1="1" x2="23" y2="23"/>','<path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/>']},"chevron-right":{viewBox:"0 0 24 24",elements:['<path d="M9 18l6-6-6-6"/>']},"chevron-left":{viewBox:"0 0 24 24",elements:['<path d="M15 18l-6-6 6-6"/>']},"open-external":{viewBox:"0 0 16 16",elements:['<path d="M6 3H3v10h10v-3M9 1h6v6M7 9L15 1"/>']}};async function zs(){if(typeof window<"u"&&window.Transmit&&typeof window.Transmit=="function")return window.Transmit;try{const e=await import("@adonisjs/transmit-client");return e.Transmit??e.default??null}catch{return null}}function Hs(e){let s=null,n=null,r=!1;return{subscribe:async()=>{try{const l=await zs();if(!l)throw new Error("Transmit client not available (neither window.Transmit nor @adonisjs/transmit-client)");if(r)return;s=new l({baseUrl:e.baseUrl||window.location.origin,...e.authToken?{beforeSubscribe(i){return{headers:{Authorization:`Bearer ${e.authToken}`}}},beforeUnsubscribe(i){return{headers:{Authorization:`Bearer ${e.authToken}`}}}}:{}}),n=s.subscription(e.channelName),n.onMessage(i=>{r||e.onMessage(i)}),await n.create()}catch(l){e.onError&&e.onError(l)}},unsubscribe:async()=>{r=!0;try{n&&(await n.delete(),n=null),s&&(s=null)}catch{}}}}function Vs(e){let s=!1;const n=Hs({baseUrl:e.baseUrl,channelName:e.channelName,authToken:e.authToken,onMessage:e.onMessage,onError:r=>{s=!0,e.onError?.(r),e.onDisconnect?.()}});return n.subscribe().then(()=>{s||e.onConnect?.()}).catch(r=>{e.onError?.(r),e.onDisconnect?.()}),{unsubscribe:()=>{n.unsubscribe().catch(()=>{})}}}class He extends Error{status;constructor(s=403){super(`Unauthorized (HTTP ${s})`),this.name="UnauthorizedError",this.status=s}}class Ws extends Error{status;body;constructor(s,n){super(`API error (HTTP ${s})`),this.name="ApiError",this.status=s,this.body=n}}class Ve{baseUrl;authToken;constructor(s){this.baseUrl=s.baseUrl.replace(/\/+$/,""),this.authToken=s.authToken}async fetch(s,n){const o={...{Accept:"application/json",...this.authToken?{Authorization:`Bearer ${this.authToken}`}:{}},...n?.headers},a=await globalThis.fetch(`${this.baseUrl}${s}`,{...n,headers:o,credentials:this.authToken?"omit":"include"});if(n?.signal?.aborted)throw new DOMException("The operation was aborted.","AbortError");if(a.status===401||a.status===403)throw new He(a.status);if(!a.ok){const l=await a.text().catch(()=>"");throw new Ws(a.status,l)}return a.json()}async get(s,n){const r=n?`${s}?${n}`:s;return this.fetch(r)}async post(s,n){const r={method:"POST",...n!==void 0?{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}:{}};return this.fetch(s,r)}async delete(s){return this.fetch(s,{method:"DELETE"})}}const Ks=5e3,Dt=1e4,Ot=100,Js=500,Qs={overview:"/overview",requests:"/requests",queries:"/queries",events:"/events",routes:"/routes",logs:"/logs",emails:"/emails",timeline:"/traces",cache:"/cache",jobs:"/jobs",config:"/config"};function Gs(e){return Qs[e]||`/${e}`}class Ys{constructor(s,n){this.client=s,this.basePath=n}async fetchSection(s,n,r){const o=Gs(s),a=n?`${this.basePath}${o}?${n}`:`${this.basePath}${o}`;return this.client.fetch(a,r)}async fetchChart(s){return this.client.fetch(`${this.basePath}/overview/chart?range=${s}`)}async fetchGroupedQueries(){return this.client.fetch(`${this.basePath}/queries/grouped`)}async explainQuery(s){return this.client.fetch(`${this.basePath}/queries/${s}/explain`)}async retryJob(s){return this.client.fetch(`${this.basePath}/jobs/${s}/retry`,{method:"POST"})}async fetchCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`)}async deleteCacheKey(s){return this.client.fetch(`${this.basePath}/cache/${encodeURIComponent(s)}`,{method:"DELETE"})}async fetchEmailPreview(s){return this.client.fetch(`${this.basePath}/emails/${s}/preview`)}}function Zs(e){const s=new URLSearchParams;if(e.page!==null&&e.page!==void 0&&s.set("page",String(e.page)),e.perPage!==null&&e.perPage!==void 0&&s.set("perPage",String(e.perPage)),e.search&&s.set("search",e.search),e.sort&&s.set("sort",e.sort),e.sortDir&&s.set("direction",e.sortDir),e.timeRange&&s.set("range",e.timeRange),e.filters)for(const[n,r]of Object.entries(e.filters))r&&s.set(n,r);return s.toString()}function Xs(e,s,n=2){if(s<=1)return[1];const r=[],o=Math.max(2,e-n),a=Math.min(s-1,e+n);r.push(1),o>2&&r.push("...");for(let l=o;l<=a;l++)r.push(l);return a<s-1&&r.push("..."),s>1&&r.push(s),r}class en{client;api;callbacks;endpoint;perPage;section;page=1;search;sort;sortDir;filters;timeRange;timer=null;fetchId=0;explicitFetchPending=!1;hasFetched=!1;stopped=!1;abortController=null;constructor(s){this.client=new Ve({baseUrl:s.baseUrl,authToken:s.authToken}),this.api=new Ys(this.client,s.endpoint),this.endpoint=s.endpoint,this.section=s.section,this.perPage=s.perPage,this.callbacks=s.callbacks}start(){this.stopped=!1,this.fetch(!1),this.startRefreshTimer()}stop(){this.stopped=!0,this.stopRefreshTimer(),this.abortController?.abort(),this.abortController=null}async fetch(s=!0){if(s&&this.explicitFetchPending)return;this.abortController?.abort();const n=new AbortController;this.abortController=n;const r=++this.fetchId,o=this.section;if(!o)return;const a=this.filters,l=this.sort?this.sort.replace(/[A-Z]/g,c=>"_"+c.toLowerCase()):void 0,i=Zs({page:this.page,perPage:this.perPage,search:this.search,sort:l,sortDir:this.sort?this.sortDir:void 0,filters:a&&Object.keys(a).length>0?a:void 0,timeRange:o.startsWith("overview")?this.timeRange:void 0});s||(this.callbacks.onLoading(!0),this.explicitFetchPending=!0);try{const c=await this.api.fetchSection(o,i||void 0,{signal:n.signal});if(r!==this.fetchId||this.stopped)return;if(c&&typeof c=="object"&&c.data!==void 0&&c.meta!==void 0){const d=c;this.callbacks.onData(d.data),this.callbacks.onPagination(d.meta)}else this.callbacks.onData(c),this.callbacks.onPagination(null);this.callbacks.onError(null),this.callbacks.onLoading(!1),this.hasFetched=!0}catch(c){if(c instanceof DOMException&&c.name==="AbortError"||n.signal.aborted||r!==this.fetchId||this.stopped)return;if(c instanceof He){this.callbacks.onError(c),this.callbacks.onLoading(!1),this.stopRefreshTimer(),this.callbacks.onUnauthorized();return}s||(this.callbacks.onError(c instanceof Error?c:new Error(String(c))),this.callbacks.onLoading(!1))}finally{s||(this.explicitFetchPending=!1)}}setSection(s){this.section!==s&&(this.section=s,this.page=1,this.search=void 0,this.sort=void 0,this.sortDir=void 0,this.filters=void 0,this.hasFetched=!1,this.callbacks.onData(null),this.callbacks.onPagination(null),this.callbacks.onLoading(!0),this.callbacks.onError(null),this.fetch(!1),this.startRefreshTimer())}setPage(s){this.page=s,this.fetch(!1)}setSearch(s){this.search=s||void 0,this.page=1,this.fetch(!1)}setFilter(s,n){this.filters||(this.filters={}),this.filters[s]=String(n),this.page=1,this.fetch(!1)}setSort(s,n){this.sort===s&&!n?this.sortDir=this.sortDir==="asc"?"desc":"asc":(this.sort=s,this.sortDir=n||"desc"),this.fetch(!1)}setTimeRange(s){this.timeRange=s,this.fetch(!1)}async mutate(s,n="post",r){const o=`${this.endpoint}/${s}`;try{const a=n==="post"?await this.client.post(o,r):await this.client.delete(o);return await this.fetch(!0),a}catch(a){throw a instanceof Error?a:new Error(String(a))}}configure(s){s.page!==void 0&&(this.page=s.page),s.perPage!==void 0&&(this.perPage=s.perPage),this.search=s.search,this.sort=s.sort,this.sortDir=s.sortDir,this.filters=s.filters,this.timeRange=s.timeRange}hasData(){return this.hasFetched}handleRefreshSignal(){this.hasFetched&&this.fetch(!0)}getApi(){return this.api}getClient(){return this.client}startRefreshTimer(){this.stopRefreshTimer();const s=this.section==="overview"?Ks:Dt;this.timer=setInterval(()=>this.fetch(!0),s)}stopRefreshTimer(){this.timer&&(clearInterval(this.timer),this.timer=null)}}function J(e,s={}){const{baseUrl:n="",dashboardEndpoint:r="/__stats/api",authToken:o,page:a=1,perPage:l=50,search:i,sort:c,sortDir:d,filters:p,timeRange:h,refreshKey:y}=s,[f,_]=k(null),[g,S]=k(null),[x,w]=k(!0),[u,N]=k(null),b=V(null),L=V(e),M=V(!1);b.current||(b.current=new en({baseUrl:n,endpoint:r,authToken:o,section:e,perPage:l,callbacks:{onData:E=>_(E),onPagination:E=>S(E),onLoading:E=>w(E),onError:E=>N(E),onUnauthorized:()=>{}}})),H(()=>{const E=b.current,$=L.current!==e;return L.current=e,E.configure({page:a,perPage:l,search:i,sort:c,sortDir:d,filters:p,timeRange:h}),$||!M.current?($?E.setSection(e):E.start(),M.current=!0):E.fetch(!0),()=>{E.stop()}},[e,a,l,i,c,d,p,h,y]);const q=P(()=>{b.current?.fetch(!0)},[]),O=P(async(E,$="post",R)=>b.current.mutate(E,$,R),[]),U=P(()=>b.current.getApi(),[]);return{data:f,meta:g,isLoading:x,error:u,refresh:q,mutate:O,getApi:U}}const Ft="/admin/api/debug",jt={tracing:!1,process:!1,system:!1,http:!1,db:!1,redis:!1,queues:!1,cache:!1,app:!1,log:!1,emails:!1,dashboard:!1,customPanes:[]};function tn(e){return{tracing:e.features?.tracing??!1,process:e.features?.process??!1,system:e.features?.system??!1,http:e.features?.http??!1,db:e.features?.db??!1,redis:e.features?.redis??!1,queues:e.features?.queues??!1,cache:e.features?.cache??!1,app:e.features?.app??!1,log:e.features?.log??!1,emails:e.features?.emails??!1,dashboard:e.features?.dashboard??!1,customPanes:e.customPanes??[]}}async function sn(e,s=Ft){const n=`${s.replace(/\/+$/,"")}/config`;return e.fetch(n)}async function nn(e){const{baseUrl:s="",debugEndpoint:n=Ft,authToken:r}=e,o=new Ve({baseUrl:s,authToken:r});try{const a=await sn(o,n);return tn(a)}catch{return jt}}function rn(e={}){const{baseUrl:s="",debugEndpoint:n="/admin/api/debug",authToken:r}=e,[o,a]=k(jt),[l,i]=k(!0),[c,d]=k(null),p=V(!1);return H(()=>{if(p.current)return;p.current=!0;let h=!1;return(async()=>{try{const f=await nn({baseUrl:s,debugEndpoint:n,authToken:r});h||(a(f),i(!1))}catch(f){h||(d(f instanceof Error?f:new Error(String(f))),i(!1))}})(),()=>{h=!0}},[s,n,r]),{features:o,isLoading:l,error:c}}const Te="ss-dash-theme",We="ss-theme-change";function Le(){if(typeof window>"u")return"light";const e=localStorage.getItem(Te);return e==="dark"||e==="light"?e:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function an(e){typeof window>"u"||(localStorage.setItem(Te,e),window.dispatchEvent(new CustomEvent(We,{detail:e})))}function ln(){const s=Le()==="dark"?"light":"dark";return an(s),s}function It(e){if(typeof window>"u")return()=>{};const s=a=>{const l=a.detail;(l==="dark"||l==="light")&&e(l)},n=a=>{if(a.key===Te){const l=a.newValue;e(l==="dark"||l==="light"?l:Le())}},r=window.matchMedia("(prefers-color-scheme: dark)"),o=a=>{localStorage.getItem(Te)||e(a.matches?"dark":"light")};return window.addEventListener(We,s),window.addEventListener("storage",n),r.addEventListener("change",o),()=>{window.removeEventListener(We,s),window.removeEventListener("storage",n),r.removeEventListener("change",o)}}function on(){const[e,s]=k(()=>Le());H(()=>It(o=>{s(o)}),[]);const n=P(()=>{const r=ln();return s(r),r},[]);return{theme:e,toggleTheme:n}}function cn({theme:e,onToggle:s,className:n="",classPrefix:r="ss-dash"}){const o=e==="dark";return t("button",{type:"button",className:`${r==="ss-dbg"?"ss-dbg-theme-toggle":"ss-dash-theme-btn"} ${n}`,onClick:s,title:o?"Switch to light theme":"Switch to dark theme","aria-label":o?"Switch to light theme":"Switch to dark theme",children:o?t("svg",{width:"16",height:"16",viewBox:F.sun.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.sun.elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:F.moon.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.moon.elements.join("")}})})}const dn=["overview","requests","queries","events","routes","logs","emails","timeline","cache","jobs","config","internals"],hn=Q(()=>Promise.resolve().then(()=>jn)),un=Q(()=>Promise.resolve().then(()=>Wn)),pn=Q(()=>Promise.resolve().then(()=>Qn)),fn=Q(()=>Promise.resolve().then(()=>Gn)),mn=Q(()=>Promise.resolve().then(()=>Yn)),_n=Q(()=>Promise.resolve().then(()=>rr)),vn=Q(()=>Promise.resolve().then(()=>ar)),yn=Q(()=>Promise.resolve().then(()=>lr)),gn=Q(()=>Promise.resolve().then(()=>ir)),bn=Q(()=>Promise.resolve().then(()=>ur)),wn=Q(()=>Promise.resolve().then(()=>br)),Nn=Q(()=>Promise.resolve().then(()=>Mr));function Bt(e){return e==="timeline"?"dashboard-timeline":e}function xn(e){const{baseUrl:s="",dashboardEndpoint:n="/__stats/api",debugEndpoint:r,authToken:o,backUrl:a="/",channelName:l="server-stats/dashboard"}=e,{features:i}=rn({baseUrl:s,debugEndpoint:r,authToken:o}),{theme:c,toggleTheme:d}=on(),[p,h]=k("overview"),[y,f]=k(()=>typeof window>"u"?!1:localStorage.getItem("ss-dash-sidebar")==="collapsed"),[_,g]=k(!1),[S,x]=k(0),w=V(0);H(()=>{if(!l)return;const $=Vs({baseUrl:s,channelName:l,authToken:o,onMessage:()=>{w.current+=1,x(w.current)},onConnect:()=>g(!0),onDisconnect:()=>g(!1),onError:()=>g(!1)});return()=>$.unsubscribe()},[s,l,o]);const u=i.customPanes||[],N=P($=>{const R=$.replace("#","").split("?")[0];return R&&[...dn,...u.map(m=>m.id)].includes(R)?R:"overview"},[u]);H(()=>{if(typeof window>"u")return;const $=N(window.location.hash);($!=="overview"||window.location.hash)&&h($)},[N]),H(()=>{const $=()=>{const R=N(window.location.hash);R!==p&&h(R)};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[p,N]),H(()=>{typeof window>"u"||(window.location.hash=p)},[p]);const b=P(()=>{f($=>{const R=!$;return localStorage.setItem("ss-dash-sidebar",R?"collapsed":"expanded"),R})},[]),L=z(()=>[{id:"overview",label:"Overview",visible:!0},{id:"requests",label:"Requests",visible:!0},{id:"queries",label:"Queries",visible:!0},{id:"events",label:"Events",visible:!0},{id:"routes",label:"Routes",visible:!0},{id:"logs",label:"Logs",visible:!0},{id:"emails",label:"Emails",visible:!0},{id:"timeline",label:"Timeline",visible:i.tracing},{id:"cache",label:"Cache",visible:i.cache},{id:"jobs",label:"Jobs",visible:i.queues},{id:"config",label:"Config",visible:!0},{id:"internals",label:"Internals",visible:!0}],[i]),M=z(()=>L.filter($=>$.visible),[L]),q=z(()=>({baseUrl:s,dashboardEndpoint:n,authToken:o,refreshKey:S}),[s,n,o,S]),{data:O}=J("overview",q),U=z(()=>{if(!O)return{};const $={};if(O.totalRequests>0&&($.requests={count:O.totalRequests}),O.queryStats?.total>0&&($.queries={count:O.queryStats.total}),O.logLevelBreakdown){const R=O.logLevelBreakdown,ne=R.error+R.warn+R.info+R.debug;ne>0&&($.logs={count:ne})}return $},[O]),E=P(()=>{const $={overview:t(hn,{options:q}),requests:t(un,{options:q}),queries:t(pn,{options:q}),events:t(fn,{options:q}),routes:t(mn,{options:q}),logs:t(_n,{options:q}),emails:t(vn,{options:q}),timeline:t(yn,{options:q}),cache:t(gn,{options:q}),jobs:t(bn,{options:q}),config:t(wn,{options:q}),internals:t(Nn,{options:q,debugEndpoint:r})};return t("div",{className:"ss-dash-pane ss-dash-active",id:`ss-dash-pane-${p}`,children:t("div",{className:"ss-dash-pane-inner",children:t($e,{fallback:t("div",{className:"ss-dash-empty",children:"Loading..."}),children:$[p]||t("div",{className:"ss-dash-empty",children:"Unknown section"})})})})},[p,q]);return t("div",{className:"ss-dash","data-theme":c,id:"ss-dash",children:[t("div",{className:"ss-dash-header",children:[t("div",{className:"ss-dash-header-left",children:[t("span",{className:"ss-dash-logo",children:"Server Stats"}),t("span",{className:"ss-dash-logo-sub",children:"Dashboard"})]}),t("div",{className:"ss-dash-header-center",children:[t("span",{className:`ss-dash-live-dot ${_?"ss-dash-connected":""}`,id:"ss-dash-live-dot"}),t("span",{className:`ss-dash-live-label ${_?"ss-dash-connected":""}`,id:"ss-dash-live-label",children:_?"Live":"Polling"})]}),t("div",{className:"ss-dash-header-right",children:[t(cn,{theme:c,onToggle:d}),a&&t("a",{href:a,className:"ss-dash-back-link",title:"Back to app",children:"← App"})]})]}),t("div",{className:"ss-dash-body",children:[t("div",{className:`ss-dash-sidebar ${y?"ss-dash-collapsed":""}`,id:"ss-dash-sidebar",children:[t("nav",{className:"ss-dash-nav",children:[M.map($=>{const R=U[$.id];return t("button",{type:"button",className:`ss-dash-nav-item ${p===$.id?"ss-dash-active":""}`,"data-ss-section":$.id,onClick:()=>{$.id!==p&&h($.id)},title:y?$.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:(F[Bt($.id)]||F.config).viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:(F[Bt($.id)]||F.config).elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:$.label}),R&&R.count>0&&t("span",{className:`ss-dash-nav-badge${R.variant?" "+R.variant:""}`,children:R.count})]},$.id)}),u.length>0&&t("div",{className:"ss-dash-nav-sep"}),u.map($=>t("button",{type:"button",className:`ss-dash-nav-item ${p===$.id?"ss-dash-active":""}`,onClick:()=>h($.id),title:y?$.label:void 0,children:[t("span",{className:"ss-dash-nav-icon",children:t("svg",{width:"20",height:"20",viewBox:F["custom-pane"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["custom-pane"].elements.join("")}})}),t("span",{className:"ss-dash-nav-label",children:$.label})]},$.id))]}),t("button",{type:"button",className:"ss-dash-sidebar-toggle",id:"ss-dash-sidebar-toggle",onClick:b,title:y?"Expand sidebar":"Collapse sidebar",children:y?t("svg",{width:"16",height:"16",viewBox:F["chevron-right"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:F["chevron-right"].elements.join("")}}):t("svg",{width:"16",height:"16",viewBox:F["chevron-left"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"1.5",dangerouslySetInnerHTML:{__html:F["chevron-left"].elements.join("")}})})]}),t("div",{className:"ss-dash-main",children:E()})]})]})}function kn(e){const s=document.getElementById(e);return s?JSON.parse(s.textContent||"{}"):{}}function Sn(){function e(s){document.documentElement.setAttribute("data-theme",s)}e(Le()),It(e)}const de=kn("ss-dash-config");Sn();const Ut=document.getElementById("ss-dash");Ut&&Ss(t(xn,{baseUrl:de.baseUrl,dashboardEndpoint:de.dashboardEndpoint,debugEndpoint:de.debugEndpoint,authToken:de.authToken,backUrl:de.backUrl,channelName:de.channelName}),Ut);function $n(e){if(!e&&e!==0)return"-";const s=Math.floor(e),n=Math.floor(s/86400),r=Math.floor(s%86400/3600),o=Math.floor(s%3600/60);return n>0?`${n}d ${r}h`:r>0?`${r}h ${o}m`:o>0?`${o}m ${s%60}s`:`${s}s`}function re(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:e>=1?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`}function zt(e){return/([+-]\d{2}:?\d{2}|Z)\s*$/.test(e)?e:e+"Z"}function ae(e){if(!e)return"-";const s=typeof e=="string"?new Date(zt(e)):new Date(e);return Number.isNaN(s.getTime())?"-":s.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})+"."+String(s.getMilliseconds()).padStart(3,"0")}function Z(e){if(!e)return"-";const s=typeof e=="string"?new Date(zt(e)).getTime():e,n=Math.floor((Date.now()-s)/1e3);return n<0?"just now":n<60?`${n}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}function Y(e){return e>Js?"very-slow":e>Ot?"slow":"normal"}function Ke(e,s=100){if(e===null)return"null";if(e===void 0)return"-";if(typeof e=="string")return'"'+(e.length>40?e.slice(0,40)+"...":e)+'"';if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){if(e.length===0)return"[]";const r="["+e.slice(0,3).map(o=>Ke(o,30)).join(", ")+(e.length>3?", ..."+e.length+" items":"")+"]";return r.length>s?"["+e.length+" items]":r}if(typeof e=="object"){const n=Object.keys(e);if(n.length===0)return"{}";const r=[];for(let a=0;a<Math.min(n.length,4);a++)r.push(n[a]+": "+Ke(e[n[a]],30));const o="{ "+r.join(", ")+(n.length>4?", ...+"+(n.length-4):"")+" }";return o.length>s?"{ "+n.slice(0,6).join(", ")+(n.length>6?", ...":"")+" }":o}return String(e)}function Cn(e){return e<0?"no expiry":e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Tn(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}const Ln={color:"#34d399",fillOpacityTop:.25,fillOpacityBottom:.02,strokeWidth:1.5,width:120,height:32,padding:2};function En(e){return{...Ln,...e}}let An=0;function Pn(){return`ss-grad-${An++}`}function Mn(e){if(e.length===0)return null;let s=e[0],n=e[0],r=e[0];for(let o=1;o<e.length;o++){const a=e[o];a<s&&(s=a),a>n&&(n=a),r+=a}return{min:s,max:n,avg:r/e.length}}function qn(e,s){if(e.length<2)return null;const n=En(s),r=Mn(e),o=r.max-r.min||1,a=n.width-n.padding*2,l=n.height-n.padding*2,i=n.padding,c=e.length,d=Array.from({length:c});for(let g=0;g<c;g++){const S=i+g/(c-1)*a,x=i+l-(e[g]-r.min)/o*l;d[g]=`${S.toFixed(1)},${x.toFixed(1)}`}const p=d.join(" "),h=(i+a).toFixed(1),y=(i+l).toFixed(1),f=i.toFixed(1),_=`M${d[0]} `+d.slice(1).map(g=>`L${g}`).join(" ")+` L${h},${y} L${f},${y} Z`;return{points:p,areaPath:_,gradientId:Pn(),options:n,stats:r}}function Ee({data:e,color:s="#34d399",width:n=120,height:r=32,className:o=""}){const a=z(()=>qn(e,{width:n,height:r}),[e,n,r]),l=z(()=>"ss-grad-"+Math.random().toString(36).slice(2,8),[]),i={"--ss-accent":s};if(!a)return t("div",{className:`ss-dash-sparkline ${o}`,style:i,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:t("text",{x:n/2,y:r/2+3,textAnchor:"middle",fill:"#737373",fontSize:"9",children:["collecting","…"]})})});const c=s||"var(--ss-accent)";return t("div",{className:`ss-dash-sparkline ${o}`,style:i,children:t("svg",{width:n,height:r,viewBox:`0 0 ${n} ${r}`,style:{display:"block"},children:[t("defs",{children:t("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:c,stopOpacity:"0.25"}),t("stop",{offset:"100%",stopColor:c,stopOpacity:"0.02"})]})}),t("path",{d:a.areaPath,fill:`url(#${l})`}),t("path",{className:"ss-dash-sparkline-line",d:"M"+a.points.replace(/ /g," L"),fill:"none",stroke:c,strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})]})})}const Rn=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"30m",label:"30m"},{value:"1h",label:"1h"},{value:"6h",label:"6h"},{value:"24h",label:"24h"},{value:"7d",label:"7d"}];function Dn({value:e,onChange:s,className:n=""}){return t("div",{className:`ss-dash-btn-group ${n}`,children:Rn.map(r=>t("button",{type:"button",className:`ss-dash-btn ${e===r.value?"ss-dash-active":""}`,onClick:()=>s(r.value),children:r.label},r.value))})}function On(e,s){if(e<=0)return[0];const n=e/s,r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;let a;o<=1?a=r:o<=2?a=2*r:o<=5?a=5*r:a=10*r;const l=[];for(let i=a;i<=e+a*.5;i+=a)l.push(Math.round(i));return l.length===0&&l.push(Math.ceil(e)),l}function Ht(e){try{return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})}catch{return""}}function Vt(e){if(e.length===0)return"";if(e.length===1)return`M${e[0].x},${e[0].y}`;let s=`M${e[0].x.toFixed(1)},${e[0].y.toFixed(1)}`;for(let n=0;n<e.length-1;n++){const r=e[n],o=e[n+1],a=(r.x+o.x)/2;s+=` C${a.toFixed(1)},${r.y.toFixed(1)} ${a.toFixed(1)},${o.y.toFixed(1)} ${o.x.toFixed(1)},${o.y.toFixed(1)}`}return s}function Wt(e){const s=Y(e);return s==="very-slow"?"ss-dash-very-slow":s==="slow"?"ss-dash-slow":""}function Fn({chartPoints:e}){const s={top:12,right:12,bottom:28,left:38},n=220,r=V(null),[o,a]=k(0);H(()=>{const C=r.current;if(!C)return;a(C.clientWidth);const T=new ResizeObserver(j=>{for(const G of j)a(G.contentRect.width)});return T.observe(C),()=>T.disconnect()},[]);const l=o||600,i=l-s.left-s.right,c=n-s.top-s.bottom,d=s.top+c,p=e.map(C=>{const T=C;return(C.requestCount??0)+(Number(T.request_count)||0)||C.total||0}),h=e.map(C=>{const T=C;return(C.errorCount??0)+(Number(T.error_count)||0)}),y=Math.max(...p,1),f=Math.ceil(y*1.1),_=h.some(C=>C>0),g=On(f,4),S=g.length>0?g[g.length-1]:f,x=C=>s.left+C/Math.max(e.length-1,1)*i,w=C=>s.top+c-C/(S||1)*c,u=e.map((C,T)=>({x:x(T),y:w(p[T])})),N=e.map((C,T)=>({x:x(T),y:w(h[T])})),b=Vt(u),L=_?Vt(N):"",M=u.length>1?`${b} L${u[u.length-1].x.toFixed(1)},${d} L${u[0].x.toFixed(1)},${d} Z`:"",q=_&&N.length>1?`${L} L${N[N.length-1].x.toFixed(1)},${d} L${N[0].x.toFixed(1)},${d} Z`:"",O=Math.min(10,e.length),U=Math.max(1,Math.ceil(e.length/O)),[E,$]=k({visible:!1,x:0,idx:-1}),R=P(C=>{const T=u[C].x;$({visible:!0,x:T,idx:C})},[u]),ne=P(()=>{$({visible:!1,x:0,idx:-1})},[]),m=120,v=E.visible?Math.max(m/2,Math.min(E.x,l-m/2)):0;return t("div",{ref:r,style:{position:"relative"},children:[t("svg",{viewBox:`0 0 ${l} ${n}`,className:"ss-dash-chart-svg",children:[t("defs",{children:[t("linearGradient",{id:"ss-cg-total",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-accent)",stopOpacity:.3}),t("stop",{offset:"100%",stopColor:"var(--ss-accent)",stopOpacity:.02})]}),t("linearGradient",{id:"ss-cg-error",x1:"0",y1:"0",x2:"0",y2:"1",children:[t("stop",{offset:"0%",stopColor:"var(--ss-red-fg)",stopOpacity:.35}),t("stop",{offset:"100%",stopColor:"var(--ss-red-fg)",stopOpacity:.02})]})]}),g.map(C=>{const T=w(C);return t("g",{children:[t("line",{x1:s.left,y1:T,x2:l-s.right,y2:T,stroke:"var(--ss-border-faint)",strokeWidth:.5,strokeDasharray:"3,3"}),t("text",{x:s.left-6,y:T,textAnchor:"end",fill:"var(--ss-dim)",fontSize:9,dominantBaseline:"middle",children:C})]},`ytick-${C}`)}),M&&t("path",{d:M,fill:"url(#ss-cg-total)"}),b&&t("path",{d:b,fill:"none",stroke:"var(--ss-accent)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),q&&t("path",{d:q,fill:"url(#ss-cg-error)"}),L&&t("path",{d:L,fill:"none",stroke:"var(--ss-red-fg)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:"4,2"}),e.map((C,T)=>{const j=p[T],G=h[T],K=u[T].x,oe=u[T].y,_s=i/(e.length||1),vs=E.visible&&E.idx===T,ys=E.visible&&E.idx!==T;return t("g",{children:[t("rect",{x:K-_s/2,y:s.top,width:_s,height:c,fill:"transparent",className:"ss-dash-chart-hover-zone","data-idx":T,onMouseEnter:()=>R(T),onMouseLeave:ne}),j>0&&t("circle",{cx:K,cy:oe,r:vs?4:2.5,fill:"var(--ss-accent)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot","data-idx":T,opacity:ys?.3:1}),G>0&&t("circle",{cx:K,cy:N[T].y,r:vs?3.5:2,fill:"var(--ss-red-fg)",stroke:"var(--ss-surface)",strokeWidth:1,className:"ss-dash-chart-dot ss-dash-chart-dot-err","data-idx":T,opacity:ys?.3:1})]},T)}),e.map((C,T)=>{if(T%U!==0&&T!==e.length-1)return null;const j=Ht(C.bucket);return j?t("text",{x:x(T),y:n-6,textAnchor:"middle",fill:"var(--ss-dim)",fontSize:9,children:j},`xlabel-${T}`):null})]}),E.visible&&E.idx>=0&&t("div",{className:"ss-dash-chart-tooltip",style:{left:v,top:s.top-4,transform:"translate(-50%, -100%)"},children:[t("div",{children:Ht(e[E.idx].bucket)}),t("div",{children:["Requests: ",p[E.idx]]}),h[E.idx]>0&&t("div",{style:{color:"var(--ss-red-fg)"},children:["Errors: ",h[E.idx]]})]})]})}function Kt({options:e={}}){const[s,n]=k("1h"),{data:r,isLoading:o}=J("overview",e),{data:a}=J("overview/chart",{...e,timeRange:s});if(o&&!r)return t("div",{className:"ss-dash-empty",children:"Loading overview..."});const l=r||{avgResponseTime:0,p95ResponseTime:0,requestsPerMinute:0,errorRate:0,totalRequests:0,slowestEndpoints:[],queryStats:{total:0,avgDuration:0,perRequest:0},recentErrors:[],topEvents:[],emailActivity:{sent:0,queued:0,failed:0},logLevelBreakdown:{error:0,warn:0,info:0,debug:0},cacheStats:null,jobQueueStatus:null,statusDistribution:{"2xx":0,"3xx":0,"4xx":0,"5xx":0},slowestQueries:[]},i=l,c=l.avgResponseTime||Number(i.avg_response_time)||0,d=l.p95ResponseTime||Number(i.p95_response_time)||0,p=l.requestsPerMinute||Number(i.requests_per_minute)||0,h=l.errorRate||Number(i.error_rate)||0,f=(l.totalRequests||Number(i.total_requests)||0)>0,_=a?.buckets||[],g=l.sparklines?.avgResponseTime??_.map(u=>u.avgDuration??0),S=l.sparklines?.p95ResponseTime??_.map(u=>u.p95Duration??0),x=l.sparklines?.requestsPerMinute??_.map(u=>u.requestCount??0),w=l.sparklines?.errorRate??_.map(u=>u.errorCount??0);return t("div",{className:"ss-dash-overview",children:[t("div",{className:"ss-dash-cards",children:[t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Avg Response Time"}),t("div",{className:`ss-dash-card-value ${f?c>500?"ss-dash-red":c>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?re(c):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:g,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"P95 Response Time"}),t("div",{className:`ss-dash-card-value ${f?d>500?"ss-dash-red":d>200?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?re(d):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:S,color:"#60a5fa",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Requests / min"}),t("div",{className:`ss-dash-card-value ${f?"ss-dash-accent":"ss-dash-dim"}`,children:f?p.toFixed(1):"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:x,color:"#34d399",width:160,height:40})})]}),t("div",{className:"ss-dash-card",children:[t("div",{className:"ss-dash-card-title",children:"Error Rate"}),t("div",{className:`ss-dash-card-value ${f?h>5?"ss-dash-red":h>1?"ss-dash-amber":"ss-dash-accent":"ss-dash-dim"}`,children:f?`${h.toFixed(1)}%`:"-"}),t("div",{className:"ss-dash-sparkline",children:t(Ee,{data:w,color:"#f87171",width:160,height:40})})]})]}),t("div",{className:"ss-dash-chart-container",children:[t("div",{className:"ss-dash-chart-header",children:[t("span",{className:"ss-dash-chart-title",children:"Request Volume"}),t(Dn,{value:s,onChange:n})]}),t("div",{className:"ss-dash-chart",id:"ss-dash-chart-area",children:_.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"120px"},children:"No data for this range"}):t(Fn,{chartPoints:_})}),t("div",{className:"ss-dash-chart-legend",id:"ss-dash-chart-legend",children:[t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-accent)"}}),"Requests"]}),_.some(u=>(u.errorCount??0)>0)&&t("span",{className:"ss-dash-chart-legend-item",children:[t("span",{className:"ss-dash-legend-dot",style:{background:"var(--ss-red-fg)"}}),"Errors"]})]})]}),t("div",{className:"ss-dash-secondary-cards",children:[t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Slowest Endpoints"})}),l.slowestEndpoints.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestEndpoints.slice(0,5).map((u,N)=>{const b=u.url||u.pattern||"-";return t("li",{children:t("a",{href:`#requests?url=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:b,children:b}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${Wt(u.avgDuration)}`,children:re(u.avgDuration)})]})},N)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Query Stats"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:[t("span",{children:"Total Queries"}),t("span",{className:"ss-dash-secondary-list-value",children:l.queryStats.total})]}),t("li",{children:[t("span",{children:"Avg Duration"}),t("span",{className:"ss-dash-secondary-list-value",children:re(l.queryStats.avgDuration)})]}),t("li",{children:[t("span",{children:"Queries / Request"}),t("span",{className:"ss-dash-secondary-list-value",children:l.queryStats.perRequest.toFixed(1)})]})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-link",children:"Recent Errors"})}),l.recentErrors.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No recent errors"}):t("ul",{className:"ss-dash-secondary-list",children:l.recentErrors.map((u,N)=>t("li",{children:t("a",{href:`#logs?id=${u.id??""}`,className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},title:u.message,children:u.message}),u.timestamp&&t("span",{className:"ss-dash-secondary-list-value",style:{color:"var(--ss-dim)"},title:ae(u.timestamp),children:Z(u.timestamp)})]})},N))})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#events",className:"ss-dash-widget-link",children:"Top Events"})}),l.topEvents.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No events yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.topEvents.slice(0,5).map((u,N)=>{const b=u.name||u.eventName||u.event_name||u.event||"";return t("li",{children:t("a",{href:`#events?event_name=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{children:b}),t("span",{className:"ss-dash-secondary-list-value",children:u.count})]})},N)})})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#emails",className:"ss-dash-widget-link",children:"Email Activity"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#emails?status=sent",className:"ss-dash-widget-row-link",children:[t("span",{children:"Sent"}),t("span",{className:"ss-dash-secondary-list-value",children:l.emailActivity.sent})]})}),t("li",{children:t("a",{href:"#emails?status=queued",className:"ss-dash-widget-row-link",children:[t("span",{children:"Queued"}),t("span",{className:"ss-dash-secondary-list-value",children:l.emailActivity.queued})]})}),t("li",{children:t("a",{href:"#emails?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:l.emailActivity.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.emailActivity.failed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#logs",className:"ss-dash-widget-link",children:"Log Levels"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#logs?level=error",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"Error"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.error})]})}),t("li",{children:t("a",{href:"#logs?level=warn",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"Warn"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.warn})]})}),t("li",{children:t("a",{href:"#logs?level=info",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"Info"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.info})]})}),t("li",{children:t("a",{href:"#logs?level=debug",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-dim)"},children:"Debug"}),t("span",{className:"ss-dash-secondary-list-value",children:l.logLevelBreakdown.debug})]})})]})]}),l.cacheStats&&l.cacheStats.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#cache",className:"ss-dash-widget-link",children:"Cache"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Keys"}),t("span",{className:"ss-dash-secondary-list-value",children:l.cacheStats.totalKeys})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Hit Rate"}),t("span",{className:"ss-dash-secondary-list-value",children:[l.cacheStats.hitRate.toFixed(1),"%"]})]})}),t("li",{children:t("a",{href:"#cache",className:"ss-dash-widget-row-link",children:[t("span",{children:"Memory"}),t("span",{className:"ss-dash-secondary-list-value",children:l.cacheStats.memoryUsedHuman})]})})]})]}),l.jobQueueStatus&&l.jobQueueStatus.available&&t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#jobs",className:"ss-dash-widget-link",children:"Job Queue"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#jobs?status=active",className:"ss-dash-widget-row-link",children:[t("span",{children:"Active"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.active})]})}),t("li",{children:t("a",{href:"#jobs?status=waiting",className:"ss-dash-widget-row-link",children:[t("span",{children:"Waiting"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.waiting})]})}),t("li",{children:t("a",{href:"#jobs?status=failed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Failed"}),t("span",{className:"ss-dash-secondary-list-value",style:l.jobQueueStatus.failed>0?{color:"var(--ss-red-fg)"}:void 0,children:l.jobQueueStatus.failed})]})}),t("li",{children:t("a",{href:"#jobs?status=completed",className:"ss-dash-widget-row-link",children:[t("span",{children:"Completed"}),t("span",{className:"ss-dash-secondary-list-value",children:l.jobQueueStatus.completed})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#requests",className:"ss-dash-widget-link",children:"Response Status"})}),t("ul",{className:"ss-dash-secondary-list",children:[t("li",{children:t("a",{href:"#requests?status=2xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-green-fg)"},children:"2xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["2xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=3xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-blue-fg)"},children:"3xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["3xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=4xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-amber-fg)"},children:"4xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["4xx"]})]})}),t("li",{children:t("a",{href:"#requests?status=5xx",className:"ss-dash-widget-row-link",children:[t("span",{style:{color:"var(--ss-red-fg)"},children:"5xx"}),t("span",{className:"ss-dash-secondary-list-value",children:l.statusDistribution["5xx"]})]})})]})]}),t("div",{className:"ss-dash-secondary-card",children:[t("div",{className:"ss-dash-secondary-card-title",children:t("a",{href:"#queries",className:"ss-dash-widget-link",children:"Slowest Queries"})}),l.slowestQueries.length===0?t("div",{className:"ss-dash-empty",style:{minHeight:"60px"},children:"No query data yet"}):t("ul",{className:"ss-dash-secondary-list",children:l.slowestQueries.slice(0,5).map((u,N)=>{const b=u.sqlNormalized||u.normalizedSql||u.sql_normalized||u.sql||"-";return t("li",{children:t("a",{href:`#queries?pattern=${encodeURIComponent(b)}`,className:"ss-dash-widget-row-link",children:[t("span",{title:b,children:b}),t("span",{className:`ss-dash-secondary-list-value ss-dash-duration ${Wt(u.avgDuration)}`,children:re(u.avgDuration)})]})},N)})})]})]})]})}const jn=Object.freeze(Object.defineProperty({__proto__:null,OverviewSection:Kt,default:Kt},Symbol.toStringTag,{value:"Module"}));function In(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Bn(e){if(!e)return[];if(typeof e=="string")try{return JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:[]}function Je(e,s,n,r=0){return e[s]??e[n]??r}function Jt(e){return{method:e.method||"",url:e.url||"",statusCode:Je(e,"status_code","statusCode"),totalDuration:Je(e,"total_duration","totalDuration")||e.duration||0,spanCount:Je(e,"span_count","spanCount"),spans:In(e.spans),warnings:Bn(e.warnings)}}function Qe(e="",s){const n=V(null);return P(()=>(n.current||(n.current=new Ve({baseUrl:e,authToken:s})),n.current),[e,s])}function Un({color:e="muted",children:s,className:n="",classPrefix:r="ss-dash"}){return t("span",{className:`${r}-badge ${r}-badge-${e} ${n}`,children:s})}function fe({method:e,className:s="",classPrefix:n="ss-dash"}){return t("span",{className:`${n}-method ${n}-method-${e.toLowerCase()} ${s}`,children:e})}function Ae({code:e,className:s="",classPrefix:n="ss-dash"}){let r=`${n}-status-2xx`;return e>=500?r=`${n}-status-5xx`:e>=400?r=`${n}-status-4xx`:e>=300&&(r=`${n}-status-3xx`),t("span",{className:`${n}-status ${r} ${s}`,children:e})}const zn="ss-col-resize",Qt="ss-resizing";function Gt(e){const s=Array.from(e.querySelectorAll("thead th"));if(s.length===0)return()=>{};const n=[];let r=!1;function o(){if(!r){r=!0;for(const a of s)a.style.width=a.offsetWidth+"px";e.style.tableLayout="fixed"}}for(const a of s){let l=function(c){c.preventDefault(),c.stopPropagation(),o();const d=c.clientX,p=a.offsetWidth;i.classList.add(Qt),i.setPointerCapture(c.pointerId);function h(f){const _=f.clientX-d,g=Math.max(30,p+_);a.style.width=g+"px"}function y(){i.classList.remove(Qt),i.removeEventListener("pointermove",h),i.removeEventListener("pointerup",y)}i.addEventListener("pointermove",h),i.addEventListener("pointerup",y)};if(!a.textContent?.trim())continue;const i=document.createElement("div");i.className=zn,a.appendChild(i),i.addEventListener("pointerdown",l),n.push(()=>{i.removeEventListener("pointerdown",l),i.remove()})}return()=>{for(const a of n)a()}}function Hn(e=[]){const s=V(null),n=V(null);return H(()=>(s.current&&(n.current?.(),n.current=Gt(s.current)),()=>{n.current?.(),n.current=null}),e),P(o=>{n.current?.(),n.current=null,s.current=o,o&&(n.current=Gt(o))},[])}function te({columns:e,data:s,keyField:n="id",sort:r,sortDir:o,onSort:a,onRowClick:l,rowClassName:i,emptyMessage:c="No data",className:d="",renderAfterRow:p}){const h=P(f=>{a&&a(f)},[a]),y=Hn([s,e]);return s.length===0?t("div",{className:"ss-dash-empty",children:c}):t("table",{ref:y,className:`ss-dash-table ${d}`,children:[t("colgroup",{children:e.map(f=>t("col",{style:f.width?{width:f.width}:void 0},f.key))}),t("thead",{children:t("tr",{children:e.map(f=>t("th",{onClick:f.sortable?()=>h(f.key):void 0,className:f.sortable?"ss-dash-sortable":"",children:[f.label,r===f.key&&t("span",{className:"ss-dash-sort-arrow",children:o==="asc"?" ▲":" ▼"})]},f.key))})}),t("tbody",{children:s.map((f,_)=>{const g=i?typeof i=="function"?i(f):i:"",S=l?"ss-dash-clickable":"";return t(Us.Fragment,{children:[t("tr",{onClick:l?()=>l(f):void 0,className:`${S} ${g}`.trim(),children:e.map(x=>t("td",{children:x.render?x.render(f[x.key],f):f[x.key]??"-"},x.key))}),p?p(f,_):null]},f[n]??_)})})]})}function se({search:e,onSearchChange:s,placeholder:n="Search...",summary:r,children:o,className:a=""}){const l=P(()=>{s("")},[s]);return t("div",{className:`ss-dash-filter-bar ${a}`,children:[r!=null&&t("span",{className:"ss-dash-summary",children:r}),t("div",{className:"ss-dash-search-wrapper",children:[t("svg",{className:"ss-dash-search-icon",width:"14",height:"14",viewBox:F.search.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.search.elements.join("")}}),t("input",{type:"text",className:"ss-dash-search",placeholder:n,value:e,onChange:i=>s(i.target.value)}),e&&t("button",{type:"button",className:"ss-dash-search-clear",onClick:l,children:"×"})]}),o&&t("div",{className:"ss-dash-filter-controls",children:o})]})}function ie({page:e,lastPage:s,total:n,onPageChange:r,className:o=""}){const a=z(()=>Xs(e,s),[e,s]),l=P(()=>{e>1&&r(e-1)},[e,r]),i=P(()=>{e<s&&r(e+1)},[e,s,r]);return s<=1?null:t("div",{className:`ss-dash-pagination ${o}`,children:[t("span",{className:"ss-dash-page-info",children:["Page ",e," of ",s," (",n," total)"]}),t("div",{className:"ss-dash-pagination-controls",children:[t("button",{type:"button",className:"ss-dash-page-btn",onClick:l,disabled:e<=1,children:"« Prev"}),a.map((c,d)=>c==="..."?t("span",{className:"ss-dash-page-ellipsis",children:"..."},`ellipsis-${d}`):t("button",{type:"button",className:`ss-dash-page-btn ${c===e?"ss-dash-active":""}`,onClick:()=>r(c),children:c},c)),t("button",{type:"button",className:"ss-dash-page-btn",onClick:i,disabled:e>=s,children:"Next »"})]})]})}const Yt={request:"#1e3a5f",middleware:"rgba(30, 58, 95, 0.7)",db:"#6d28d9",view:"#0e7490",mail:"#059669",event:"#b45309",custom:"var(--ss-dim)"},Vn={request:"Request",middleware:"Middleware",db:"DB",mail:"Mail",event:"Event",view:"View",custom:"Custom"};function Zt({spans:e,totalDuration:s,className:n="",warnings:r}){const o=e||[],a=z(()=>[...o].sort((i,c)=>i.startOffset-c.startOffset),[o]),l=z(()=>{const i={};for(const c of a)i[c.id]=c.parentId?(i[c.parentId]||0)+1:0;return i},[a]);return o.length===0?t("div",{className:"ss-dash-empty",children:"No spans recorded"}):t("div",{className:`ss-dash-tl-waterfall ${n}`,children:[t("div",{className:"ss-dash-tl-legend",children:Object.entries(Vn).map(([i,c])=>t("div",{className:"ss-dash-tl-legend-item",children:[t("span",{className:"ss-dash-tl-legend-dot",style:{background:Yt[i]||Yt.custom}}),t("span",{children:c})]},i))}),a.map(i=>{const c=s>0?i.startOffset/s*100:0,d=s>0?Math.max(i.duration/s*100,.5):1,p=l[i.id]||0,h=i.label.length>50?i.label.slice(0,50)+"...":i.label,y=i.category==="db"?"DB":i.category,f=i.category==="db"?"purple":i.category==="mail"?"green":i.category==="event"?"amber":i.category==="view"?"blue":"muted",_=i.metadata?Object.entries(i.metadata).filter(([,S])=>S!=null).map(([S,x])=>`${S}=${x}`).join(", "):"",g=_?`${i.label} (${i.duration.toFixed(2)}ms)
2
+ ${_}`:`${i.label} (${i.duration.toFixed(2)}ms)`;return t("div",{className:"ss-dash-tl-row",children:[t("div",{className:"ss-dash-tl-label",title:g,style:{paddingLeft:8+p*16+"px"},children:[t("span",{className:`ss-dash-badge ss-dash-badge-${f}`,style:{fontSize:"9px",marginRight:"4px"},children:y}),h]}),t("div",{className:"ss-dash-tl-track",children:t("div",{className:`ss-dash-tl-bar ss-dash-tl-bar-${i.category||"custom"}`,style:{left:`${c}%`,width:`${d}%`},title:g})}),t("span",{className:"ss-dash-tl-dur",children:[i.duration.toFixed(2),"ms"]})]},i.id)}),r&&r.length>0&&t("div",{className:"ss-dash-tl-warnings",children:[t("div",{className:"ss-dash-tl-warnings-title",children:["Warnings (",r.length,")"]}),r.map((i,c)=>t("div",{className:"ss-dash-tl-warning",children:i},c))]})]})}function Xt({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("createdAt"),[i,c]=k("desc"),[d,p]=k(null),[h,y]=k(!1);H(()=>n(1),[r]);const{data:f,meta:_,isLoading:g,error:S}=J("requests",{...e,page:s,search:r,sort:a,sortDir:i}),x=Qe(e.baseUrl||"",e.authToken),w=P(b=>{const L=b.id;y(!0);const M=e.dashboardEndpoint||"/__stats/api";x().fetch(`${M}/requests/${L}`).then(q=>{p(q),y(!1)}).catch(()=>{y(!1)})},[x,e.dashboardEndpoint]),u=P(b=>{a===b?c(L=>L==="asc"?"desc":"asc"):(l(b),c("desc"))},[a]),N=f||[];if(d){const b=Jt(d);return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:()=>p(null),children:"← Back to Requests"}),t(fe,{method:b.method}),t("span",{style:{color:"var(--ss-text)"},children:b.url}),t(Ae,{code:b.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[b.totalDuration.toFixed(1),"ms · ",b.spanCount," spans"]})]}),t(Zt,{spans:b.spans,totalDuration:b.totalDuration,warnings:b.warnings})]})}return h?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:()=>y(!1),children:"← Back to Requests"})}),t("div",{className:"ss-dash-empty",children:"Loading request detail..."})]}):t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter requests...",summary:`${_?.total??0} requests`}),S&&t("div",{className:"ss-dash-empty",children:"Failed to load requests"}),g&&!f?t("div",{className:"ss-dash-empty",children:"Loading requests..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:b=>t("span",{style:{color:"var(--ss-dim)"},children:b})},{key:"method",label:"Method",width:"70px",sortable:!0,render:b=>t(fe,{method:b})},{key:"url",label:"URL",sortable:!0,render:b=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:b,children:b})},{key:"statusCode",label:"Status",width:"60px",sortable:!0,render:(b,L)=>{const M=L.status_code||L.statusCode||L.statusCode;return t(Ae,{code:M})}},{key:"duration",label:"Duration",width:"80px",sortable:!0,render:(b,L)=>{const M=L.total_duration||L.totalDuration||L.duration||0;return t("span",{className:`ss-dash-duration ${Y(M)==="very-slow"?"ss-dash-very-slow":Y(M)==="slow"?"ss-dash-slow":""}`,children:[M.toFixed(1),"ms"]})}},{key:"spanCount",label:"Spans",width:"50px",render:(b,L)=>{const M=L.span_count||L.spanCount||0;return t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:M})}},{key:"warningCount",label:"⚠",width:"40px",render:(b,L)=>{const M=L.warning_count||L.warningCount||0;return M>0?t("span",{style:{color:"var(--ss-amber-fg)",textAlign:"center",display:"block"},children:M}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"createdAt",label:"Time",width:"80px",sortable:!0,render:(b,L)=>{const M=L.createdAt||L.created_at||L.timestamp||"";return t("span",{className:"ss-dash-event-time",title:ae(M),children:Z(M)})}}],data:N,sort:a,sortDir:i,onSort:u,onRowClick:w,emptyMessage:"No requests recorded yet"})}),_&&t(ie,{page:_.page,lastPage:_.lastPage,total:_.total,onPageChange:n})]})]})}const Wn=Object.freeze(Object.defineProperty({__proto__:null,RequestsSection:Xt,default:Xt},Symbol.toStringTag,{value:"Module"}));function es({node:e,depth:s=0}){if(!e)return null;const n=s*20,r=e["Node Type"]||"Unknown",o=e["Relation Name"]?t(D,{children:[" on ",t("strong",{children:e["Relation Name"]})]}):null,a=e.Alias&&e.Alias!==e["Relation Name"]?` (${e.Alias})`:"",l=e["Index Name"]?t(D,{children:[" using ",t("em",{children:e["Index Name"]})]}):null,i=[];if(e["Startup Cost"]!==null&&e["Startup Cost"]!==void 0&&i.push(`cost=${e["Startup Cost"]}..${e["Total Cost"]}`),e["Plan Rows"]!==null&&e["Plan Rows"]!==void 0&&i.push(`rows=${e["Plan Rows"]}`),e["Plan Width"]!==null&&e["Plan Width"]!==void 0&&i.push(`width=${e["Plan Width"]}`),e.Filter&&i.push(`filter: ${e.Filter}`),e["Index Cond"]&&i.push(`cond: ${e["Index Cond"]}`),e["Hash Cond"]&&i.push(`hash: ${e["Hash Cond"]}`),e["Join Type"]&&i.push(`join: ${e["Join Type"]}`),e["Sort Key"]){const d=Array.isArray(e["Sort Key"])?e["Sort Key"].join(", "):e["Sort Key"];i.push(`sort: ${d}`)}const c=e.Plans||[];return t("div",{className:"ss-dash-explain-node",style:{marginLeft:`${n}px`},children:[t("div",{className:"ss-dash-explain-node-header",children:[t("span",{className:"ss-dash-explain-node-type",children:r}),o,a,l]}),i.length>0&&t("div",{className:"ss-dash-explain-metrics",children:i.join(" · ")}),c.map((d,p)=>t(es,{node:d,depth:s+1},p))]})}function Kn({plan:e}){if(!e||!Array.isArray(e)||e.length===0)return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"});const s=e[0];if(s&&s.Plan)return t("div",{className:"ss-dash-explain-result",children:t(es,{node:s.Plan,depth:0})});if(typeof s=="object"&&s!==null){const n=Object.keys(s);return t("div",{className:"ss-dash-explain-result",children:t("table",{children:[t("thead",{children:t("tr",{children:n.map(r=>t("th",{children:r},r))})}),t("tbody",{children:e.map((r,o)=>{const a=r;return t("tr",{children:n.map(l=>t("td",{children:a[l]!==null&&a[l]!==void 0?String(a[l]):"-"},l))},o)})})]})})}return t("div",{className:"ss-dash-explain-result",children:"No plan data returned"})}const Jn=8;function ts({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("createdAt"),[i,c]=k("desc"),[d,p]=k("list"),[h,y]=k(null),[f,_]=k(null),[g,S]=k(null),x=P(m=>{m!==d&&(p(m),n(1),l(m==="list"?"createdAt":"count"),c("desc"),y(null),_(null),S(null))},[d]);H(()=>n(1),[r]);const w=d==="grouped"?"queries/grouped":"queries",{data:u,meta:N,isLoading:b,mutate:L}=J(w,{...e,page:s,search:r,sort:a,sortDir:i}),M=P(m=>{a===m?c(v=>v==="asc"?"desc":"asc"):(l(m),c("desc"))},[a]),q=P(async m=>{if(f&&f.queryId===m){_(null);return}S(m);try{const v=await L(`queries/${m}/explain`);v&&v.error?_({queryId:m,plan:[],error:v.error,message:v.message}):_({queryId:m,plan:v?.plan||v?.rows||[]})}catch(v){console.warn("[ss] Query explain failed:",v),_({queryId:m,plan:[],error:v instanceof Error?v.message:String(v)})}finally{S(null)}},[L,f]),O=P(m=>{const v=m.id;return!f||f.queryId!==v?null:t("tr",{className:"ss-dash-explain-row",children:t("td",{colSpan:Jn,className:"ss-dash-explain",children:t("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"start"},children:[t("div",{style:{flex:1},children:f.error?t("div",{className:"ss-dash-explain-result ss-dash-explain-error",children:[t("strong",{children:"Error:"})," ",f.error,f.message&&t(D,{children:[t("br",{}),f.message]})]}):t(Kn,{plan:f.plan})}),t("button",{type:"button",className:"ss-dash-explain-btn",onClick:()=>_(null),style:{marginLeft:"8px",flexShrink:0},children:"Close"})]})})})},[f]),U=d==="grouped"?u?.groups||[]:u||[],E=z(()=>d!=="grouped"?U:U.map(m=>{const v={...m};return(v.sqlNormalized===null||v.sqlNormalized===void 0)&&(m.sql_normalized||m.pattern)&&(v.sqlNormalized=m.sql_normalized||m.pattern||""),(v.count===null||v.count===void 0)&&m.total_count!==null&&m.total_count!==void 0&&(v.count=m.total_count),(v.avgDuration===null||v.avgDuration===void 0)&&m.avg_duration!==null&&m.avg_duration!==void 0&&(v.avgDuration=m.avg_duration),(v.maxDuration===null||v.maxDuration===void 0)&&m.max_duration!==null&&m.max_duration!==void 0&&(v.maxDuration=m.max_duration),(v.minDuration===null||v.minDuration===void 0)&&m.min_duration!==null&&m.min_duration!==void 0&&(v.minDuration=m.min_duration),(v.totalDuration===null||v.totalDuration===void 0)&&m.total_duration!==null&&m.total_duration!==void 0&&(v.totalDuration=m.total_duration),(v.percentOfTotal===null||v.percentOfTotal===void 0)&&m.pct_time!==null&&m.pct_time!==void 0&&(v.percentOfTotal=m.pct_time),v}),[U,d]),$=z(()=>{const m=N?.total??E.length;let v=0,C=0,T=0,j=0;for(const K of E){const oe=K.duration||0;T+=oe,j++,oe>Ot&&v++}const G=new Map;for(const K of E){const oe=K.sqlNormalized||K.sql||K.sql_text||"";G.set(oe,(G.get(oe)||0)+1)}for(const K of G.values())K>1&&(C+=K);return{total:m,slow:v,duplicates:C,avgDuration:j>0?T/j:0}},[E,N]),R=z(()=>{const m=new Map;for(const v of E){const C=v.sqlNormalized||v.sql||v.sql_text||"";m.set(C,(m.get(C)||0)+1)}return m},[E]),ne=z(()=>{if(d==="grouped")return`${E.length} query patterns`;const m=[`${$.total} queries`];return $.slow>0&&m.push(`${$.slow} slow`),$.duplicates>0&&m.push(`${$.duplicates} dup`),m.push(`avg ${($.avgDuration||0).toFixed(1)}ms`),m.join(", ")},[d,E.length,$]);return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter queries...",summary:ne,children:t("div",{className:"ss-dash-btn-group",children:[t("button",{type:"button",className:`ss-dash-btn ${d==="list"?"ss-dash-active":""}`,onClick:()=>x("list"),children:"List"}),t("button",{type:"button",className:`ss-dash-btn ${d==="grouped"?"ss-dash-active":""}`,onClick:()=>x("grouped"),children:"Grouped"})]})}),b&&!u?t("div",{className:"ss-dash-empty",children:"Loading queries..."}):d==="grouped"?t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"sqlNormalized",label:"Pattern",render:(m,v)=>{const C=m||"",T=(v.count||0)>=3;return t(D,{children:[t("span",{className:`ss-dash-sql ${h===C?"ss-dash-expanded":""}`,title:"Click to expand",onClick:j=>{j.stopPropagation(),y(h===C?null:C)},role:"button",tabIndex:0,onKeyDown:j=>j.key==="Enter"&&y(h===C?null:C),children:C}),T&&t(D,{children:[" ",t("span",{className:"ss-dash-dup",children:"DUP"})]})]})}},{key:"count",label:"Count",width:"60px",sortable:!0,render:m=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:m||0})},{key:"avgDuration",label:"Avg",width:"70px",sortable:!0,render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"minDuration",label:"Min",width:"70px",render:m=>t("span",{className:"ss-dash-duration",children:(m||0).toFixed(2)+"ms"})},{key:"maxDuration",label:"Max",width:"70px",render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"totalDuration",label:"Total",width:"70px",sortable:!0,render:m=>t("span",{className:"ss-dash-duration",children:(m||0).toFixed(1)+"ms"})},{key:"percentOfTotal",label:"% Time",width:"60px",render:m=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:(m||0).toFixed(1)+"%"})}],data:E,keyField:"sqlNormalized",sort:a,sortDir:i,onSort:M,emptyMessage:"No queries recorded"})})}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:m=>t("span",{style:{color:"var(--ss-dim)"},children:m})},{key:"sql",label:"SQL",render:(m,v)=>{const C=v.sql||v.sql_text||"";return t("div",{children:[t("span",{className:`ss-dash-sql ${h===v.id?"ss-dash-expanded":""}`,title:"Click to expand",onClick:T=>{T.stopPropagation(),y(h===v.id?null:v.id)},role:"button",tabIndex:0,onKeyDown:T=>T.key==="Enter"&&y(h===v.id?null:v.id),children:C}),(R.get((v.sqlNormalized||v.sql||v.sql_text)??"")??0)>1&&t("span",{className:"ss-dash-dup",children:["×",R.get((v.sqlNormalized||v.sql||v.sql_text)??"")]})]})}},{key:"duration",label:"Duration",width:"70px",sortable:!0,render:m=>{const v=m||0;return t("span",{className:`ss-dash-duration ${Y(v)==="very-slow"?"ss-dash-very-slow":Y(v)==="slow"?"ss-dash-slow":""}`,children:v.toFixed(2)+"ms"})}},{key:"method",label:"Method",width:"60px",render:(m,v)=>{const C=v.method||v.sql_method||"";return t("span",{className:`ss-dash-method ss-dash-method-${C.toLowerCase()}`,children:C})}},{key:"model",label:"Model",width:"90px",render:m=>t("span",{style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:m,children:m||"-"})},{key:"connection",label:"Connection",width:"80px",render:m=>t("span",{style:{color:"var(--ss-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m||"-"})},{key:"createdAt",label:"Time",width:"90px",sortable:!0,render:(m,v)=>{const C=m||v.created_at||v.timestamp||"";return t("span",{className:"ss-dash-event-time",title:ae(C),children:Z(C)})}},{key:"id",label:"",width:"70px",render:(m,v)=>{if((v.method||v.sql_method||"")!=="select")return null;const T=f?.queryId===v.id&&!f?.error;return t("button",{type:"button",className:`ss-dash-explain-btn${T?" ss-dash-explain-btn-active":""}`,onClick:j=>{j.stopPropagation(),q(v.id)},disabled:g===v.id,children:g===v.id?"...":"EXPLAIN"})}}],data:E,sort:a,sortDir:i,onSort:M,emptyMessage:"No queries recorded",renderAfterRow:O})}),N&&t(ie,{page:N.page,lastPage:N.lastPage,total:N.total,onPageChange:n})]})]})}const Qn=Object.freeze(Object.defineProperty({__proto__:null,QueriesSection:ts,default:ts},Symbol.toStringTag,{value:"Module"}));function Ge({data:e,maxPreviewLength:s=100,className:n="",classPrefix:r="ss-dash"}){const[o,a]=k(!1),l=z(()=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},[e]),i=z(()=>typeof l=="object"&&l!==null?Ke(l,s):String(l??"-"),[l,s]),c=z(()=>typeof l=="object"&&l!==null?JSON.stringify(l,null,2):String(l),[l]),d=P(()=>{a(h=>!h)},[]),p=P(async()=>{try{await navigator.clipboard.writeText(c)}catch{}},[c]);return!e&&e!==0&&e!==!1?t("span",{className:`ss-dim ${r}-c-dim`,children:"-"}):t("div",{className:`${r}-data-cell ${n}`,children:[t("span",{className:`${r}-data-preview`,onClick:d,role:"button",tabIndex:0,onKeyDown:h=>h.key==="Enter"&&d(),children:i}),o&&t("div",{className:`${r}-data-full`,onClick:d,children:[t("button",{className:`${r}-copy-btn`,onClick:h=>{h.stopPropagation(),p()},title:"Copy to clipboard",type:"button",children:"Copy"}),t("pre",{children:c})]})]})}function ss({options:e={}}){const[s,n]=k(1),[r,o]=k(""),{data:a,meta:l,isLoading:i}=J("events",{...e,page:s,search:r}),c=a||[];return H(()=>n(1),[r]),t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter events...",summary:`${l?.total??0} events`}),i&&!a?t("div",{className:"ss-dash-empty",children:"Loading events..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:d=>t("span",{style:{color:"var(--ss-dim)"},children:d})},{key:"eventName",label:"Event",render:(d,p)=>{const h=p.event_name||p.eventName||p.event||"";return t("span",{className:"ss-dash-event-name",title:h,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:h})}},{key:"data",label:"Data",render:d=>t(Ge,{data:d,maxPreviewLength:80,className:"ss-dash-event-data"})},{key:"createdAt",label:"Time",width:"80px",render:(d,p)=>{const h=p.createdAt||p.created_at||p.timestamp;return t("span",{className:"ss-dash-event-time",title:ae(h),children:Z(h)})}}],data:c,emptyMessage:"No events recorded yet"})}),l&&t(ie,{page:l.page,lastPage:l.lastPage,total:l.total,onPageChange:n})]})]})}const Gn=Object.freeze(Object.defineProperty({__proto__:null,EventsSection:ss,default:ss},Symbol.toStringTag,{value:"Module"}));function ns({options:e={}}){const[s,n]=k(""),{data:r,isLoading:o,error:a}=J("routes",{...e,search:s}),l=r,i=Array.isArray(l)?l:l&&Array.isArray(l.routes)?l.routes:l&&Array.isArray(l.data)?l.data:[],c={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return t("div",{children:[t(se,{search:s,onSearchChange:n,placeholder:"Filter routes...",summary:`${i.length} routes`}),a?t("div",{className:"ss-dash-empty",children:"Failed to load routes"}):o&&!r?t("div",{className:"ss-dash-empty",children:"Loading routes..."}):t(D,{children:t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"method",label:"Method",width:"70px",render:d=>t(fe,{method:d})},{key:"pattern",label:"Pattern",render:d=>t("span",{style:{color:"var(--ss-text)",...c},title:d,children:d})},{key:"name",label:"Name",width:"120px",render:d=>t("span",{style:{color:"var(--ss-muted)",...c},title:d||"-",children:d||"-"})},{key:"handler",label:"Handler",render:d=>t("span",{style:{color:"var(--ss-sql-color)",...c},title:d,children:d})},{key:"middleware",label:"Middleware",render:d=>{const p=d?.length?d.join(", "):"-";return t("span",{style:{color:"var(--ss-dim)",fontSize:"10px",...c},title:p,children:p})}}],data:i,keyField:"pattern",emptyMessage:"No routes available"})})})]})}const Yn=Object.freeze(Object.defineProperty({__proto__:null,RoutesSection:ns,default:ns},Symbol.toStringTag,{value:"Module"})),Zn=["all","error","warn","info","debug"];function Xn(e){return(e.levelName||e.level_name||(typeof e.level=="string"?e.level:"")||"info").toLowerCase()}function er(e){return e.msg||e.message||JSON.stringify(e)}function tr(e){return e.createdAt||e.created_at||e.time||e.timestamp||0}function sr(e){const s=e.data||{};return e.requestId||e.request_id||e["x-request-id"]||s.requestId||s.request_id||s["x-request-id"]||""}function nr(e,s="ss-dbg-log-level"){switch(e){case"error":case"fatal":return`${s}-error`;case"warn":return`${s}-warn`;case"info":return`${s}-info`;case"debug":return`${s}-debug`;case"trace":return`${s}-trace`;default:return`${s}-info`}}function rs({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("all"),[i,c]=k(""),[d,p]=k(""),[h,y]=k([]),[f,_]=k("level"),[g,S]=k("equals"),[x,w]=k(""),u={};a!=="all"&&(u.level=a),i&&(u.request_id=i),h.forEach((m,v)=>{u[`filter_field_${v}`]=m.field,u[`filter_op_${v}`]=m.operator,u[`filter_value_${v}`]=m.value});const{data:N,meta:b,isLoading:L}=J("logs",{...e,page:s,search:r,filters:u}),M=N||[],q=P(m=>{c(m),p(m),n(1)},[]),O=P(()=>{const m=d.trim();c(m),n(1)},[d]),U=P(()=>{c(""),p(""),n(1)},[]),E=P(()=>{l("all"),n(1)},[]),$=P(()=>{const m=x.trim();m&&(y(v=>[...v,{field:f,operator:g,value:m}]),w(""))},[f,g,x]),R=P(m=>{y(v=>v.filter((C,T)=>T!==m))},[]),ne=a!=="all"||i!==""||h.length>0;return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Search logs...",summary:`${b?.total??0} logs`,children:t("div",{className:"ss-dash-log-filters",children:[Zn.map(m=>t("button",{type:"button",className:`ss-dash-log-filter ${a===m?"ss-dash-active":""}`,onClick:()=>{l(m),n(1)},children:m},m)),t("input",{type:"text",className:"ss-dash-filter-input ss-dash-reqid-input",placeholder:"Filter by request ID...",value:d,onChange:m=>p(m.target.value),onKeyDown:m=>m.key==="Enter"&&O()}),(d||i)&&t("button",{type:"button",className:"ss-dash-btn ss-dash-reqid-clear",onClick:()=>{U()},children:"Clear"})]})}),t("div",{className:"ss-dash-structured-search",children:[t("select",{className:"ss-dash-filter-select",value:f,onChange:m=>_(m.target.value),children:[t("option",{value:"level",children:"level"}),t("option",{value:"message",children:"message"}),t("option",{value:"request_id",children:"request_id"}),t("option",{value:"userId",children:"userId"}),t("option",{value:"email",children:"email"}),t("option",{value:"path",children:"path"})]}),t("select",{className:"ss-dash-filter-select",value:g,onChange:m=>S(m.target.value),children:[t("option",{value:"equals",children:"equals"}),t("option",{value:"contains",children:"contains"}),t("option",{value:"starts_with",children:"starts with"})]}),t("input",{className:"ss-dash-filter-input",placeholder:"Value...",value:x,onChange:m=>w(m.target.value),onKeyDown:m=>m.key==="Enter"&&$()}),t("button",{type:"button",className:"ss-dash-btn",onClick:$,children:"Add"})]}),ne&&t("div",{className:"ss-dash-filter-chips",children:[a!=="all"&&t("span",{className:"ss-dash-filter-chip",children:["level: ",a,t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:E,children:"×"})]}),i&&t("span",{className:"ss-dash-filter-chip",children:["requestId: ",i.slice(0,8),"...",t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:U,children:"×"})]}),h.map((m,v)=>t("span",{className:"ss-dash-filter-chip",children:[m.field," ",m.operator,' "',m.value,'"',t("button",{type:"button",className:"ss-dash-filter-chip-remove",onClick:()=>R(v),children:"×"})]},v))]}),L&&!N?t("div",{className:"ss-dash-empty",children:"Loading logs..."}):M.length===0?t("div",{className:"ss-dash-empty",children:["No log entries",i?` matching request ${i}`:a!=="all"?` for ${a}`:""]}):t("div",{className:"ss-dash-log-entries",children:M.map((m,v)=>{const C=Xn(m),T=er(m),j=sr(m),G=tr(m);return t("div",{className:"ss-dash-log-entry",children:[t("span",{className:`ss-dash-log-level ${nr(C,"ss-dash-log-level")}`,children:C.toUpperCase()}),t("span",{className:"ss-dash-log-time",title:G?ae(G):"",children:G?Z(G):"-"}),j?t("span",{className:"ss-dash-log-reqid",title:j,onClick:()=>q(j),role:"button",tabIndex:0,onKeyDown:K=>K.key==="Enter"&&q(j),children:j.slice(0,8)}):t("span",{className:"ss-dash-log-reqid-empty",children:"--"}),t("span",{className:"ss-dash-log-msg",children:T})]},m.id||v)})}),b&&t(ie,{page:b.page,lastPage:b.lastPage,total:b.total,onPageChange:n})]})}const rr=Object.freeze(Object.defineProperty({__proto__:null,LogsSection:rs,default:rs},Symbol.toStringTag,{value:"Module"}));function as({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k(null),[i,c]=k(null),{data:d,meta:p,isLoading:h}=J("emails",{...e,page:s,search:r}),y=d||[];H(()=>n(1),[r]);const f=P(async _=>{if(_.html){l(_.id),c(_.html);return}try{const{baseUrl:g="",dashboardEndpoint:S="/__stats/api",authToken:x}=e,w=`${g}${S}/emails/${_.id}/preview`,u={Accept:"text/html"};x&&(u.Authorization=`Bearer ${x}`);const b=await(await fetch(w,{headers:u,credentials:"same-origin"})).text();l(_.id),c(b)}catch{}},[e]);if(a&&i){const _=y.find(g=>g.id===a);return t("div",{className:"ss-dash-email-preview",id:"ss-dash-email-preview",children:[t("div",{className:"ss-dash-email-preview-header",children:[t("div",{className:"ss-dash-email-preview-meta",id:"ss-dash-email-preview-meta",children:_&&t(D,{children:[t("strong",{children:"Subject:"})," ",_.subject,"  |  ",t("strong",{children:"From:"})," ",_.from_addr||_.from,"  |  ",t("strong",{children:"To:"})," ",_.to_addr||_.to,(_.cc||_.cc_addr)&&t(D,{children:["  |  ",t("strong",{children:"CC:"})," ",_.cc||_.cc_addr]}),"  |  ",t("strong",{children:"Status:"})," ",t("span",{className:`ss-dash-badge ss-dash-email-status-${_.status}`,children:_.status}),_.mailer&&t(D,{children:["  |  ",t("strong",{children:"Mailer:"})," ",_.mailer]})]})}),t("button",{type:"button",className:"ss-dash-btn",id:"ss-dash-email-preview-close",onClick:()=>{l(null),c(null)},children:"Close"})]}),t("iframe",{className:"ss-dash-email-iframe",id:"ss-dash-email-iframe",srcDoc:i,title:"Email preview",sandbox:""})]})}return t("div",{children:[t(se,{search:r,onSearchChange:o,placeholder:"Filter emails...",summary:`${p?.total??0} emails`}),h&&!d?t("div",{className:"ss-dash-empty",children:"Loading emails..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:_=>t("span",{style:{color:"var(--ss-dim)"},children:_})},{key:"from",label:"From",width:"150px",render:(_,g)=>{const S=g.from_addr||g.from||"";return t("span",{title:S,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:S})}},{key:"to",label:"To",width:"150px",render:(_,g)=>{const S=g.to_addr||g.to||"";return t("span",{title:S,style:{color:"var(--ss-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:S})}},{key:"subject",label:"Subject",render:_=>{const g=_||"";return t("span",{title:g,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:g})}},{key:"status",label:"Status",width:"80px",render:_=>{const g=_||"";return t("span",{className:`ss-dash-badge ss-dash-email-status-${g}`,children:g})}},{key:"attachmentCount",label:"ATT",width:"40px",render:(_,g)=>{const S=g.attachment_count||g.attachmentCount||0;return S>0?t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:S}):t("span",{style:{color:"var(--ss-dim)",textAlign:"center",display:"block"},children:"-"})}},{key:"mailer",label:"Mailer",width:"70px",render:_=>{const g=_||"";return t("span",{title:g,style:{color:"var(--ss-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:g})}},{key:"createdAt",label:"Time",width:"80px",render:(_,g)=>{const S=g.createdAt||g.created_at||g.timestamp;return t("span",{className:"ss-dash-event-time",style:{whiteSpace:"nowrap"},title:ae(S),children:Z(S)})}}],data:y,onRowClick:f,rowClassName:"ss-dash-email-row",emptyMessage:"No emails captured yet"})}),p&&t(ie,{page:p.page,lastPage:p.lastPage,total:p.total,onPageChange:n})]})]})}const ar=Object.freeze(Object.defineProperty({__proto__:null,EmailsSection:as,default:as},Symbol.toStringTag,{value:"Module"}));function ls({options:e={},tracingEnabled:s=!0}){const[n,r]=k(1),[o,a]=k(""),[l,i]=k(null),[c,d]=k(null),[p,h]=k(!1),{data:y,meta:f,isLoading:_,error:g}=J("traces",{...e,page:n,search:o}),S=y||[],x=Qe(e.baseUrl||"",e.authToken);H(()=>{if(!l){d(null);return}let u=!1;h(!0);const N=e.dashboardEndpoint||"/__stats/api";return x().fetch(`${N}/traces/${l}`).then(b=>{u||(d(b),h(!1))}).catch(()=>{u||h(!1)}),()=>{u=!0}},[l,x,e.dashboardEndpoint]);const w=P(()=>i(null),[]);if(!s)return t("div",{className:"ss-dash-empty",children:"Tracing is not enabled. Enable tracing in your server-stats config to use the timeline."});if(l&&c){const u=Jt(c);return t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:[t("button",{type:"button",className:"ss-dash-btn",onClick:w,children:"← Back"}),t(fe,{method:u.method}),t("span",{style:{color:"var(--ss-text)"},children:u.url}),t(Ae,{code:u.statusCode}),t("span",{className:"ss-dash-tl-meta",children:[u.totalDuration.toFixed(1),"ms · ",u.spanCount," spans"]})]}),t(Zt,{spans:u.spans,totalDuration:u.totalDuration,warnings:u.warnings})]})}return l&&p?t("div",{children:[t("div",{className:"ss-dash-tl-detail-header",children:t("button",{type:"button",className:"ss-dash-btn",onClick:w,children:"← Back"})}),t("div",{className:"ss-dash-empty",children:"Loading trace detail..."})]}):t("div",{children:[t(se,{search:o,onSearchChange:a,placeholder:"Filter traces...",summary:`${f?.total??0} traces`}),g&&t("div",{className:"ss-dash-empty",children:"Failed to load traces"}),_&&!y?t("div",{className:"ss-dash-empty",children:"Loading traces..."}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"#",width:"40px",render:u=>t("span",{style:{color:"var(--ss-dim)"},children:u})},{key:"method",label:"Method",width:"70px",render:u=>t(fe,{method:u})},{key:"url",label:"URL",render:u=>t("span",{style:{color:"var(--ss-text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:u,children:u})},{key:"statusCode",label:"Status",width:"60px",render:u=>t(Ae,{code:u})},{key:"totalDuration",label:"Duration",width:"80px",render:u=>t("span",{className:`ss-dash-duration ${Y(u)==="very-slow"?"ss-dash-very-slow":Y(u)==="slow"?"ss-dash-slow":""}`,children:[u.toFixed(1),"ms"]})},{key:"spanCount",label:"Spans",width:"50px",render:u=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center"},children:u})},{key:"createdAt",label:"Time",width:"80px",render:u=>t("span",{className:"ss-dash-event-time",title:ae(u),children:Z(u)})}],data:S,onRowClick:u=>i(u.id),emptyMessage:"No traces recorded"})}),f&&t(ie,{page:f.page,lastPage:f.lastPage,total:f.total,onPageChange:r})]})]})}const lr=Object.freeze(Object.defineProperty({__proto__:null,TimelineSection:ls,default:ls},Symbol.toStringTag,{value:"Module"}));function is({options:e={}}){const[s,n]=k(""),[r,o]=k(null),[a,l]=k(null),[i,c]=k(!1),[d,p]=k(null),{data:h,isLoading:y,mutate:f,getApi:_}=J("cache",{...e,search:s}),g=h,S=P(async w=>{if(confirm(`Delete cache key "${w}"?`))try{await f(`cache/${encodeURIComponent(w)}`,"delete"),r===w&&(o(null),l(null),p(null))}catch{}},[f,r]),x=P(async w=>{if(r===w){o(null),l(null),p(null);return}o(w),l(null),p(null),c(!0);try{const N=await _().fetchCacheKey(w);l(N.value!==void 0?N.value:N.data!==void 0?N.data:N),p(null)}catch{l(null),p("Failed to fetch key value")}finally{c(!1)}},[r,_]);return t("div",{children:[g?.available&&g?.stats&&t("div",{className:"ss-dash-cache-stats",children:[t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Hit Rate:"}),t("span",{className:"ss-dash-cache-stat-value",children:[(g.stats.hitRate??0).toFixed(1),"%"]})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Hits:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.hits??0})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Misses:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.misses??0})]}),t("div",{className:"ss-dash-cache-stat",children:[t("span",{className:"ss-dash-cache-stat-label",children:"Keys:"}),t("span",{className:"ss-dash-cache-stat-value",children:g.stats.totalKeys||g.stats.keyCount||g.keys?.length||0})]})]}),t(se,{search:s,onSearchChange:n,placeholder:"Filter cache keys...",summary:`${(g?.keys||g?.data||[]).length} keys`}),y&&!h?t("div",{className:"ss-dash-empty",children:"Loading cache..."}):!g||!g.available?t("div",{className:"ss-dash-empty",children:"Cache inspector not available"}):t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"key",label:"Key",render:w=>t("span",{title:w,style:{color:"var(--ss-sql-color)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:w})},{key:"type",label:"Type",width:"70px",render:w=>t("span",{style:{color:"var(--ss-muted)"},children:w})},{key:"size",label:"Size",width:"60px",render:w=>w!=null&&w>0?Tn(w):"-"},{key:"ttl",label:"TTL",width:"70px",render:w=>w>0?Cn(w):"-"},{key:"_actions",label:"",width:"60px",render:(w,u)=>t("button",{type:"button",className:"ss-dash-retry-btn",onClick:N=>{N.stopPropagation(),S(u.key)},children:"Delete"})}],data:g.keys||g.data||[],keyField:"key",onRowClick:w=>x(w.key),emptyMessage:"No cache keys found"})}),r&&t("div",{className:"ss-dash-cache-detail",children:[t("h4",{children:["Key: ",r]}),i?t("div",{className:"ss-dash-empty",children:"Loading value..."}):d?t("div",{className:"ss-dash-empty",style:{color:"var(--ss-red-fg)"},children:d}):t(Ge,{data:a})]})]})}const ir=Object.freeze(Object.defineProperty({__proto__:null,CacheSection:is,default:is},Symbol.toStringTag,{value:"Module"})),or=["all","active","waiting","delayed","completed","failed"];function cr(e){switch(e){case"active":return"blue";case"waiting":return"amber";case"delayed":return"purple";case"completed":return"green";case"failed":return"red";default:return"muted"}}function dr(e){if(!e)return[];if(Array.isArray(e))return e;const s=e;return s.jobs||s.data||[]}function hr(e){if(!e||Array.isArray(e))return null;const s=e;return s.stats||s.overview||null}function os({options:e={}}){const[s,n]=k(1),[r,o]=k(""),[a,l]=k("all"),[i,c]=k({}),d={};a!=="all"&&(d.status=a);const{data:p,meta:h,isLoading:y,error:f,refresh:_,mutate:g}=J("jobs",{...e,page:s,search:r,filters:d}),S=dr(p),x=hr(p),w=P(async u=>{c(N=>({...N,[u]:"pending"}));try{await g(`jobs/${u}/retry`),c(N=>({...N,[u]:"success"})),setTimeout(()=>{c(N=>{const b={...N};return delete b[u],b}),_()},1e3)}catch{c(N=>{const b={...N};return delete b[u],b})}},[g,_]);return t("div",{children:[x&&t("div",{className:"ss-dash-job-stats",children:[t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Active:"}),t("span",{className:"ss-dash-job-stat-value",children:x.active??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Waiting:"}),t("span",{className:"ss-dash-job-stat-value",children:x.waiting??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Delayed:"}),t("span",{className:"ss-dash-job-stat-value",children:x.delayed??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Completed:"}),t("span",{className:"ss-dash-job-stat-value",children:x.completed??0})]}),t("div",{className:"ss-dash-job-stat",children:[t("span",{className:"ss-dash-job-stat-label",children:"Failed:"}),t("span",{className:"ss-dash-job-stat-value",style:{color:"var(--ss-red-fg)"},children:x.failed??0})]})]}),t(se,{search:r,onSearchChange:o,placeholder:"Filter jobs...",summary:`${h?.total??S.length} jobs`,children:t("div",{className:"ss-dash-btn-group",children:or.map(u=>t("button",{type:"button",className:`ss-dash-btn ${a===u?"ss-dash-active":""}`,onClick:()=>{l(u),n(1)},children:u.charAt(0).toUpperCase()+u.slice(1)},u))})}),y&&!p?t("div",{className:"ss-dash-empty",children:"Loading jobs..."}):f?t("div",{className:"ss-dash-empty",children:"Jobs/Queue not available"}):t(D,{children:[t("div",{className:"ss-dash-table-wrap",children:t(te,{columns:[{key:"id",label:"ID",width:"40px",render:u=>t("span",{style:{color:"var(--ss-dim)"},children:u})},{key:"name",label:"Name",render:u=>t("span",{style:{color:"var(--ss-text)"},title:u,children:u})},{key:"status",label:"Status",width:"90px",render:u=>t(Un,{color:cr(u),children:u})},{key:"payload",label:"Payload",render:(u,N)=>t(Ge,{data:u||N?.data,maxPreviewLength:60})},{key:"attempts",label:"Tries",width:"50px",render:(u,N)=>t("span",{style:{color:"var(--ss-muted)",textAlign:"center",display:"block"},children:u||N.attemptsMade||0})},{key:"duration",label:"Duration",width:"75px",render:u=>t("span",{className:"ss-dash-duration",children:u!==null?re(u):"-"})},{key:"timestamp",label:"Time",width:"70px",render:(u,N)=>{const b=u||N?.createdAt||N?.processedAt||N?.created_at;return t("span",{className:"ss-dash-event-time",style:{whiteSpace:"nowrap"},title:ae(b),children:Z(b)})}},{key:"_actions",label:"",width:"50px",render:(u,N)=>{const b=N.id,L=i[b];return N.status!=="failed"?null:t("button",{type:"button",className:"ss-dash-retry-btn",disabled:L==="pending"||L==="success",onClick:M=>{M.stopPropagation(),w(b)},children:L==="pending"?"...":L==="success"?"OK":"Retry"})}}],data:S,emptyMessage:"No jobs found"})}),h&&t(ie,{page:h.page,lastPage:h.lastPage,total:h.total,onPageChange:n})]})]})}const ur=Object.freeze(Object.defineProperty({__proto__:null,JobsSection:os,default:os},Symbol.toStringTag,{value:"Module"}));function W(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.__redacted===!0}function Ye(e,s=""){if(typeof e!="object"||e===null||e===void 0)return[{path:s,value:e}];if(Array.isArray(e)||W(e))return[{path:s,value:e}];const n=[];for(const r of Object.keys(e)){const o=s?`${s}.${r}`:r,a=e[r];typeof a=="object"&&a!==null&&!Array.isArray(a)&&!W(a)?n.push(...Ye(a,o)):n.push({path:o,value:a})}return n}function Ze(e){return e==null?{text:"null",color:"var(--ss-dim)"}:typeof e=="boolean"?{text:String(e),color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"}:typeof e=="number"?{text:String(e),color:"var(--ss-amber-fg)"}:Array.isArray(e)?{text:`[${e.map(n=>n==null?"null":typeof n=="object"?JSON.stringify(n):String(n)).join(", ")}]`,color:"var(--ss-purple-fg)"}:typeof e=="object"?{text:JSON.stringify(e),color:"var(--ss-dim)"}:{text:String(e)}}function cs(e){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return 1;let s=0;for(const n of Object.keys(e))s+=cs(e[n]);return s}function pr(e){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return[];const s=[];for(const n of Object.keys(e)){const r=e[n];r!==null&&typeof r=="object"&&!Array.isArray(r)&&!W(r)&&s.push(n)}return s}function Pe(e,s,n){s&&navigator.clipboard.writeText(e).then(()=>{const r=s.textContent;s.textContent="✓",s.classList.add(`${n}-copy-row-ok`),setTimeout(()=>{s.textContent=r,s.classList.remove(`${n}-copy-row-ok`)},1200)}).catch(()=>{})}function Me({redacted:e,p:s}){const[n,r]=k(!1);return t("span",{className:`${s}-config-redacted`,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[t("span",{children:n?e.value:e.display}),t("button",{type:"button",className:`${s}-btn`,title:n?"Hide":"Reveal",style:{padding:"0 4px",fontSize:"0.85em",lineHeight:1,minWidth:"auto"},onClick:o=>{o.stopPropagation(),r(a=>!a)},children:n?t("svg",{width:"14",height:"14",viewBox:F["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["eye-off"].elements.join("")}}):t("svg",{width:"14",height:"14",viewBox:F.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.eye.elements.join("")}})})]})}function fr({env:e,search:s,p:n}){const r=V(new Map),o=s.toLowerCase(),a=Object.entries(e).filter(([l,i])=>{if(!o)return!0;const c=W(i)?i.display:i==null?"":String(i);return l.toLowerCase().includes(o)||c.toLowerCase().includes(o)});return t("div",{className:`${n}-config-table-wrap`,children:t("table",{className:`${n}-table ${n}-config-env-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Variable"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[a.map(([l,i])=>{const c=W(i),d=c?i.display:i==null?"null":String(i),p=`${l}=${d}`;return t("tr",{children:[t("td",{className:`${n}-env-key`,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{className:`${n}-env-val`,children:c?t(Me,{redacted:i,p:n}):t("span",{className:`${n}-config-val`,children:d})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(l,h)},onClick:h=>{h.stopPropagation(),Pe(p,r.current.get(l)??null,n)},children:"⎘"})})]},l)}),a.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching variables"})})]})]})})}function mr({source:e,search:s,p:n}){const r=V(new Map),o=s.toLowerCase(),a=Ye(e,""),l=a.filter(i=>{const c=W(i.value)?i.value.display:i.value===null||i.value===void 0?"":String(i.value);return i.path.toLowerCase().includes(o)||c.toLowerCase().includes(o)});return t("div",{className:`${n}-config-table-wrap`,children:[t("table",{className:`${n}-table`,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Path"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:[l.map(i=>{const c=W(i.value),d=c?null:Ze(i.value),p=c?i.value.display:d.text,h=`${i.path}: ${p}`;return t("tr",{children:[t("td",{children:t("span",{className:`${n}-config-key`,style:{whiteSpace:"nowrap"},children:i.path})}),t("td",{children:c?t(Me,{redacted:i.value,p:n}):t("span",{className:`${n}-config-val`,style:{wordBreak:"break-all",color:d.color},children:d.text})}),t("td",{children:!c&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:y=>{r.current.set(i.path,y)},onClick:y=>{y.stopPropagation(),Pe(h,r.current.get(i.path)??null,n)},children:"⎘"})})]},i.path)}),l.length===0&&t("tr",{children:t("td",{colSpan:3,style:{textAlign:"center",color:"var(--ss-dim)"},children:"No matching entries"})})]})]}),t("div",{style:{padding:"4px 16px",fontSize:"10px",color:"var(--ss-muted)"},children:[l.length," of ",a.length," entries"]})]})}function _r({obj:e,prefix:s,p:n}){const r=V(new Map),o=Ye(e,s);return t("table",{className:`${n}-table ${n}-config-inner-table`,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"35%"},children:"Key"}),t("th",{children:"Value"}),t("th",{style:{width:36}})]})}),t("tbody",{children:o.map(a=>{const l=a.path.indexOf(s+".")===0?a.path.slice(s.length+1):a.path,i=W(a.value),c=i?null:Ze(a.value),d=i?a.value.display:c.text,p=`${a.path}: ${d}`;return t("tr",{children:[t("td",{title:l,children:t("span",{className:`${n}-config-key`,children:l})}),t("td",{title:d,children:i?t(Me,{redacted:a.value,p:n}):t("span",{className:`${n}-config-val`,style:{color:c.color},children:c.text})}),t("td",{children:!i&&t("button",{type:"button",className:`${n}-copy-row-btn`,title:"Copy",ref:h=>{r.current.set(a.path,h)},onClick:h=>{h.stopPropagation(),Pe(p,r.current.get(a.path)??null,n)},children:"⎘"})})]},a.path)})})]})}function vr({value:e,p:s}){if(e==null)return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:"null"});if(W(e))return t(Me,{redacted:e,p:s});if(typeof e=="boolean")return t("span",{className:`${s}-config-val`,style:{color:e?"var(--ss-green-fg)":"var(--ss-red-fg)"},children:String(e)});if(typeof e=="number")return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-amber-fg)"},children:String(e)});if(Array.isArray(e)){const n=e.map(r=>r==null?"null":typeof r=="object"?JSON.stringify(r):String(r));return t("span",{className:`${s}-config-val`,style:{color:"var(--ss-purple-fg)"},children:["[",n.join(", "),"]"]})}return typeof e=="object"?t("span",{className:`${s}-config-val`,style:{color:"var(--ss-dim)"},children:JSON.stringify(e)}):t("span",{className:`${s}-config-val`,children:String(e)})}function yr({obj:e,expandedPaths:s,onToggle:n,p:r}){if(e==null||typeof e!="object"||Array.isArray(e)||W(e))return null;const o=Object.keys(e),a=V(new Map);return t("div",{className:`${r}-config-sections`,children:o.map(l=>{const i=e[l],c=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!W(i),d=s.has(l),p=W(i);return t("div",{className:`${r}-config-section`,children:[t("div",{className:`${r}-config-section-header${c?"":` ${r}-config-leaf`}`,onClick:c?()=>n(l):void 0,style:{cursor:c?"pointer":"default"},children:[c?t("span",{className:`${r}-config-toggle`,children:d?"▼":"▶"}):t("span",{className:`${r}-config-toggle`,style:{visibility:"hidden"},children:"•"}),t("span",{className:`${r}-config-key`,children:l}),c?t("span",{className:`${r}-config-count`,children:[cs(i)," entries"]}):t(D,{children:[t("span",{className:`${r}-config-val`,style:{marginLeft:"8px"},children:t(vr,{value:i,p:r})}),!p&&t("button",{type:"button",className:`${r}-copy-row-btn`,style:{marginLeft:"4px"},title:"Copy",ref:h=>{a.current.set(l,h)},onClick:h=>{h.stopPropagation();const y=Ze(i);Pe(`${l}: ${y.text}`,a.current.get(l)??null,r)},children:"⎘"})]})]}),c&&d&&t("div",{className:`${r}-config-section-body`,children:t(_r,{obj:i,prefix:l,p:r})})]},l)})})}function gr({data:e,isLoading:s,classPrefix:n}){const r=n,[o,a]=k(""),[l,i]=k(""),[c,d]=k("app"),[p,h]=k(new Set),[y,f]=k("Copy JSON");H(()=>{const u=setTimeout(()=>i(o),200);return()=>clearTimeout(u)},[o]);const _=e,g=P(u=>{h(N=>{const b=new Set(N);return b.has(u)?b.delete(u):b.add(u),b})},[]),S=P(()=>{if(!_)return;const u=c==="app"?_.app:_.env;if(!u)return;const N=pr(u);h(new Set(N))},[_,c]),x=P(()=>{h(new Set)},[]),w=P(async()=>{if(_)try{const u=c==="app"?_.app:_.env;await navigator.clipboard.writeText(JSON.stringify(u,null,2)),f("Copied!"),setTimeout(()=>f("Copy JSON"),1500)}catch{}},[_,c]);return t("div",{children:[t("div",{className:`${r}-config-toolbar`,style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px"},children:[t("button",{type:"button",className:`${r}-config-tab${c==="app"?` ${r}-active`:""}`,onClick:()=>d("app"),children:"App Config"}),t("button",{type:"button",className:`${r}-config-tab${c==="env"?` ${r}-active`:""}`,onClick:()=>d("env"),children:"Env"}),t("div",{style:{position:"relative",flex:1},children:[t("input",{type:"text",className:`${r}-search`,placeholder:"Search keys and values...",value:o,onChange:u=>a(u.target.value),style:{width:"100%"}}),o&&t("button",{type:"button",onClick:()=>a(""),style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"var(--ss-dim)",padding:"0 2px",lineHeight:1},children:"×"})]}),c==="app"&&!l&&t(D,{children:[t("button",{type:"button",className:`${r}-btn`,onClick:S,children:"Expand All"}),t("button",{type:"button",className:`${r}-btn`,onClick:x,children:"Collapse All"})]}),t("button",{type:"button",className:`${r}-btn`,onClick:w,children:y})]}),s&&!e?t("div",{className:`${r}-empty`,children:"Loading config..."}):_?c==="env"?t(fr,{env:_.env??{},search:l,p:r}):l?t(mr,{source:_.app??{},search:l,p:r}):t("div",{className:`${r}-config-table-wrap`,children:t(yr,{obj:_.app,expandedPaths:p,onToggle:g,p:r})}):t("div",{className:`${r}-empty`,children:"Config not available"})]})}function ds({options:e={}}){const{data:s,isLoading:n}=J("config",e);return t(gr,{data:s,isLoading:n,classPrefix:"ss-dash"})}const br=Object.freeze(Object.defineProperty({__proto__:null,ConfigSection:ds,default:ds},Symbol.toStringTag,{value:"Module"})),wr=["password","secret","token","key","credential","auth"];function hs(e){const s=e.toLowerCase();return wr.some(n=>s.includes(n))}function us(e){if(e==null)return"-";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.join(", ")||"-";try{return JSON.stringify(e)}catch{return String(e)}}const Nr={collectionInterval:"Stats Collection",dashboardBroadcast:"Dashboard Broadcast",debugBroadcast:"Debug Broadcast",persistFlush:"Persist Flush",retentionCleanup:"Retention Cleanup"};function xr(e){return Nr[e]||e}const kr={prometheus:"Prometheus",pinoHook:"Pino Log Hook",edgePlugin:"Edge Plugin",cacheInspector:"Cache Inspector",queueInspector:"Queue Inspector"};function Sr(e){return kr[e]||e}const $r=["healthy","active","connected","available","ready"],Cr=["errored","unavailable"];function Tr(e){return $r.includes(e)?"ok":Cr.includes(e)?"err":""}function me({status:e,prefix:s}){const n=Tr(e);let r=`${s}-dot`;return n==="ok"?r+=` ${s}-dot-ok`:n==="err"&&(r+=` ${s}-dot-err`),t("span",{className:r})}const ps=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:F.eye.viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F.eye.elements.join("")}}),fs=()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:F["eye-off"].viewBox,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",dangerouslySetInnerHTML:{__html:F["eye-off"].elements.join("")}});function Lr({value:e}){const[s,n]=k(!1);return t("span",{children:[s?e:"••••••••"," ",t("button",{type:"button",onClick:()=>n(r=>!r),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:s?t(fs,{}):t(ps,{})})]})}function Er({current:e,max:s,prefix:n}){const r=s>0?Math.min(100,Math.round(e/s*100)):0,o=r>=100;return t("div",{className:`${n}-bar`,children:[t("div",{className:`${n}-bar-track`,children:t("div",{className:`${n}-bar-fill${o?` ${n}-bar-fill-warn`:""}`,style:{width:`${r}%`}})}),t("span",{className:`${n}-bar-pct${o?` ${n}-bar-pct-warn`:""}`,children:[r,"%"]})]})}function Ar({config:e,prefix:s}){const n=Object.entries(e);return n.length===0?t("span",{className:`${s}-c-dim`,children:"-"}):t("span",{className:`${s}-c-muted`,children:n.map(([r,o],a)=>t("span",{children:[a>0&&", ",t("span",{className:`${s}-c-dim`,children:r}),"=",hs(r)&&typeof o=="string"?t(Lr,{value:o}):t("span",{children:us(o)})]},r))})}function _e({label:e,value:s,prefix:n}){return t("div",{className:`${n}-info-card`,children:[t("span",{className:`${n}-info-card-label`,children:e}),t("span",{className:`${n}-info-card-value`,children:s})]})}function Pr({data:e,tableClassName:s,classPrefix:n}){const r=n||"ss-dash",[o,a]=k(new Set),l=P(c=>{a(d=>{const p=new Set(d);return p.has(c)?p.delete(c):p.add(c),p})},[]),i=P((c,d)=>{if(d==null)return t("span",{className:`${r}-c-dim`,children:"null"});if(typeof d=="boolean")return t("span",{className:d?`${r}-c-green`:`${r}-c-red`,children:String(d)});if(Array.isArray(d))return t("span",{children:d.join(", ")||"-"});const p=us(d);if(hs(c)){const h=o.has(c);return t("span",{children:[h?p:"••••••••"," ",t("button",{type:"button",onClick:()=>l(c),style:{background:"none",border:"1px solid var(--ss-border)",borderRadius:3,padding:"0 4px",fontSize:"10px",color:"var(--ss-dim)",cursor:"pointer",verticalAlign:"middle"},children:h?t(fs,{}):t(ps,{})})]})}return t("span",{children:p})},[o,l,r]);return t("div",{children:[t("h3",{className:`${r}-internals-title`,children:"Package Info"}),t("div",{className:`${r}-info-cards`,children:[t(_e,{label:"Version",value:e.package.version||"-",prefix:r}),t(_e,{label:"Node.js",value:e.package.nodeVersion||"-",prefix:r}),t(_e,{label:"AdonisJS",value:e.package.adonisVersion||"-",prefix:r}),t(_e,{label:"Uptime",value:$n(e.package.uptime),prefix:r}),t(_e,{label:"Renderer",value:e.devToolbar?.renderer||"preact",prefix:r})]}),e.collectors.length>0&&t(D,{children:[t("h3",{className:`${r}-internals-title`,children:"Collectors"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Collector"}),t("th",{children:"Status"}),t("th",{children:"Last Error"}),t("th",{children:"Config"})]})}),t("tbody",{children:e.collectors.map(c=>t("tr",{children:[t("td",{children:[t("code",{children:c.name}),c.label&&c.label!==c.name&&t("span",{className:`${r}-c-dim`,children:[" ",c.label]})]}),t("td",{children:[t(me,{status:c.status,prefix:r}),c.status]}),t("td",{className:c.lastError?`${r}-c-red`:`${r}-c-dim`,children:c.lastError?t(D,{children:[c.lastError,c.lastErrorAt&&t("span",{className:`${r}-c-dim`,style:{fontSize:"10px"},children:Z(c.lastErrorAt)})]}):"-"}),t("td",{children:t(Ar,{config:c.config,prefix:r})})]},c.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Buffers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Buffer"}),t("th",{children:"Usage"}),t("th",{children:"Fill %"})]})}),t("tbody",{children:Object.entries(e.buffers).map(([c,d])=>t("tr",{children:[t("td",{style:{textTransform:"capitalize"},children:c}),t("td",{children:[d.current.toLocaleString()," / ",d.max.toLocaleString()]}),t("td",{children:t(Er,{current:d.current,max:d.max,prefix:r})})]},c))})]}),t("h3",{className:`${r}-internals-title`,children:"Timers"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Timer"}),t("th",{children:"Status"}),t("th",{children:"Interval"})]})}),t("tbody",{children:Object.entries(e.timers).map(([c,d])=>t("tr",{children:[t("td",{children:xr(c)}),t("td",{children:[t(me,{status:d.active?"active":"inactive",prefix:r}),t("span",{className:d.active?`${r}-c-green`:`${r}-c-dim`,children:d.active?"active":"inactive"})]}),t("td",{children:d.active?d.intervalMs?re(d.intervalMs):d.debounceMs?`${re(d.debounceMs)} (debounce)`:"-":t("span",{className:`${r}-c-dim`,children:"—"})})]},c))})]}),t("h3",{className:`${r}-internals-title`,children:"Integrations"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{children:"Integration"}),t("th",{children:"Status"}),t("th",{children:"Details"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Transmit (SSE)"}),t("td",{children:[t(me,{status:e.transmit.available?"connected":"inactive",prefix:r}),e.transmit.available?"connected":"unavailable"]}),t("td",{style:{fontSize:"11px"},children:e.transmit.channels.length>0?`Channels: ${e.transmit.channels.join(", ")}`:"-"})]}),Object.entries(e.integrations).map(([c,d])=>{const p=d.active??d.available??!1,h=d.active?"active":d.available?"available":"unavailable";let y=d.mode?`Mode: ${d.mode}`:"-";return c==="edgePlugin"&&d.active?y="@serverStats() tag registered":c==="cacheInspector"&&d.available?y="Redis dependency detected":c==="queueInspector"&&d.available&&(y="Queue dependency detected"),t("tr",{children:[t("td",{children:Sr(c)}),t("td",{children:[t(me,{status:p?"active":"inactive",prefix:r}),h]}),t("td",{className:`${r}-c-dim`,style:{fontSize:"11px"},children:y})]},c)})]})]}),e.storage&&t(D,{children:[t("h3",{className:`${r}-internals-title`,children:"Storage (SQLite)"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Metric"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Status"}),t("td",{children:[t(me,{status:e.storage.ready?"ready":"inactive",prefix:r}),e.storage.ready?"ready":"not ready"]})]}),t("tr",{children:[t("td",{children:"DB Path"}),t("td",{children:t("code",{children:e.storage.dbPath})})]}),t("tr",{children:[t("td",{children:"File Size"}),t("td",{children:[e.storage.fileSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"WAL Size"}),t("td",{children:[e.storage.walSizeMb.toFixed(1)," MB"]})]}),t("tr",{children:[t("td",{children:"Retention"}),t("td",{children:[e.storage.retentionDays," days"]})]}),t("tr",{children:[t("td",{children:"Last Cleanup"}),t("td",{children:e.storage.lastCleanupAt?Z(e.storage.lastCleanupAt):"-"})]})]})]}),e.storage.tables.length>0&&t("table",{className:s,style:{marginTop:8},children:[t("thead",{children:t("tr",{children:[t("th",{children:"Table"}),t("th",{children:"Rows"})]})}),t("tbody",{children:e.storage.tables.map(c=>t("tr",{children:[t("td",{children:t("code",{children:c.name})}),t("td",{children:c.rowCount.toLocaleString()})]},c.name))})]})]}),t("h3",{className:`${r}-internals-title`,children:"Resolved Config"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"intervalMs"}),t("td",{children:e.config.intervalMs})]}),t("tr",{children:[t("td",{children:"transport"}),t("td",{children:e.config.transport})]}),t("tr",{children:[t("td",{children:"channelName"}),t("td",{children:e.config.channelName})]}),t("tr",{children:[t("td",{children:"endpoint"}),t("td",{children:e.config.endpoint===!1?"false":e.config.endpoint})]}),t("tr",{children:[t("td",{children:"skipInTest"}),t("td",{children:i("skipInTest",e.config.skipInTest)})]}),t("tr",{children:[t("td",{children:"onStats callback"}),t("td",{children:e.config.hasOnStatsCallback?"defined":"not defined"})]}),t("tr",{children:[t("td",{children:"shouldShow callback"}),t("td",{children:e.config.hasShouldShowCallback?"defined":"not defined"})]})]})]}),t("h4",{className:`${r}-internals-title`,children:"DevToolbar"}),t("table",{className:s,children:[t("thead",{children:t("tr",{children:[t("th",{style:{width:"200px"},children:"Setting"}),t("th",{children:"Value"})]})}),t("tbody",{children:Object.entries(e.devToolbar).map(([c,d])=>t("tr",{children:[t("td",{children:c==="customPaneCount"?"customPanes":c}),t("td",{children:c==="customPaneCount"?`${d} registered`:i(c,d)})]},c))})]})]})}function ms({options:e={},debugEndpoint:s="/admin/api/debug"}){const{baseUrl:n="",authToken:r}=e,[o,a]=k(null),[l,i]=k(!0),[c,d]=k(null),p=V(null),h=Qe(n,r),y=P(async()=>{try{const _=await h().get(`${s}/diagnostics`);a(_),d(null),i(!1)}catch(f){if(f instanceof He){d(f),i(!1),p.current&&(clearInterval(p.current),p.current=null);return}d(f instanceof Error?f:new Error(String(f))),i(!1)}},[s,h]);return H(()=>(i(!0),d(null),y(),p.current=setInterval(y,Dt),()=>{p.current&&(clearInterval(p.current),p.current=null)}),[y]),l&&!o?t("div",{className:"ss-dash-empty",children:"Loading diagnostics..."}):c?t("div",{className:"ss-dash-empty",children:["Error: ",c.message]}):o?t(Pr,{data:o,tableClassName:"ss-dash-table",classPrefix:"ss-dash"}):t("div",{className:"ss-dash-empty",children:"Diagnostics not available"})}const Mr=Object.freeze(Object.defineProperty({__proto__:null,InternalsSection:ms,default:ms},Symbol.toStringTag,{value:"Module"}))})();