@forinda/kickjs-devtools 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +38 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/public/spa/assets/index.js +4 -4
- package/public/spa/assets/style.css +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var W={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return dr(this.context.count)},getNextContextId(){return dr(this.context.count++)}};function dr(e){const t=String(e),r=t.length-1;return W.context.id+(r?String.fromCharCode(96+r):"")+t}function Ut(e){W.context=e}function jn(){return{...W.context,id:W.getNextContextId(),count:0}}var Nn=(e,t)=>e===t,Ur=Symbol("solid-track"),yt={equals:Nn},hr=null,Fr=Gr,be=1,et=2,Hr={owned:null,cleanups:null,context:null,owner:null},U=null,_=null,nt=null,ze=null,J=null,re=null,se=null,At=0;function Ve(e,t){const r=J,n=U,s=e.length===0,i=t===void 0?n:t,u=s?Hr:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=s?e:()=>e(()=>xe(()=>Ne(u)));U=u,J=null;try{return Le(a,!0)}finally{J=r,U=n}}function x(e,t){t=t?Object.assign({},yt,t):yt;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=s=>(typeof s=="function"&&(_&&_.running&&_.sources.has(r)?s=s(r.tValue):s=s(r.value)),Vr(r,s));return[zr.bind(r),n]}function w(e,t,r){const n=er(e,t,!1,be);nt&&_&&_.running?re.push(n):lt(n)}function Ce(e,t,r){Fr=Dn;const n=er(e,t,!1,be),s=Ft&&Pn(Ft);s&&(n.suspense=s),(!r||!r.render)&&(n.user=!0),se?se.push(n):lt(n)}function H(e,t,r){r=r?Object.assign({},yt,r):yt;const n=er(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,nt&&_&&_.running?(n.tState=be,re.push(n)):lt(n),zr.bind(n)}function xe(e){if(!ze&&J===null)return e();const t=J;J=null;try{return ze?ze.untrack(e):e()}finally{J=t}}function Je(e){Ce(()=>xe(e))}function $e(e){return U===null||(U.cleanups===null?U.cleanups=[e]:U.cleanups.push(e)),e}function In(e){if(_&&_.running)return e(),_.done;const t=J,r=U;return Promise.resolve().then(()=>{J=t,U=r;let n;return(nt||Ft)&&(n=_||(_={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),n.done||(n.done=new Promise(s=>n.resolve=s)),n.running=!0),Le(e,!1),J=U=null,n?n.done:void 0})}var[Qc,fr]=x(!1);function Pn(e){let t;return U&&U.context&&(t=U.context[e.id])!==void 0?t:e.defaultValue}var Ft;function zr(){const e=_&&_.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===be)lt(this);else{const t=re;re=null,Le(()=>_t(this),!1),re=t}if(J){const t=this.observers;if(!t||t[t.length-1]!==J){const r=t?t.length:0;J.sources?(J.sources.push(this),J.sourceSlots.push(r)):(J.sources=[this],J.sourceSlots=[r]),t?(t.push(J),this.observerSlots.push(J.sources.length-1)):(this.observers=[J],this.observerSlots=[J.sources.length-1])}}return e&&_.sources.has(this)?this.tValue:this.value}function Vr(e,t,r){let n=_&&_.running&&_.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(n,t)){if(_){const s=_.running;(s||!r&&_.sources.has(e))&&(_.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&Le(()=>{for(let s=0;s<e.observers.length;s+=1){const i=e.observers[s],u=_&&_.running;u&&_.disposed.has(i)||((u?!i.tState:!i.state)&&(i.pure?re.push(i):se.push(i),i.observers&&Jr(i)),u?i.tState=be:i.state=be)}if(re.length>1e6)throw re=[],new Error},!1)}return t}function lt(e){if(!e.fn)return;Ne(e);const t=At;gr(e,_&&_.running&&_.sources.has(e)?e.tValue:e.value,t),_&&!_.running&&_.sources.has(e)&&queueMicrotask(()=>{Le(()=>{_&&(_.running=!0),J=U=e,gr(e,e.tValue,t),J=U=null},!1)})}function gr(e,t,r){let n;const s=U,i=J;J=U=e;try{n=e.fn(t)}catch(u){return e.pure&&(_&&_.running?(e.tState=be,e.tOwned&&e.tOwned.forEach(Ne),e.tOwned=void 0):(e.state=be,e.owned&&e.owned.forEach(Ne),e.owned=null)),e.updatedAt=r+1,tr(u)}finally{J=i,U=s}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?Vr(e,n,!0):_&&_.running&&e.pure?(_.sources.has(e)||(e.value=n),_.sources.add(e),e.tValue=n):e.value=n,e.updatedAt=r)}function er(e,t,r,n=be,s){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:U,context:U?U.context:null,pure:r};if(_&&_.running&&(i.state=0,i.tState=n),U===null||U!==Hr&&(_&&_.running&&U.pure?U.tOwned?U.tOwned.push(i):U.tOwned=[i]:U.owned?U.owned.push(i):U.owned=[i]),ze&&i.fn){const u=i.fn,[a,c]=x(void 0,{equals:!1}),h=ze.factory(u,c);$e(()=>h.dispose());let d,f=!1;const v=()=>In(c).then(()=>{d&&(d.dispose(),d=void 0,f||c())});i.fn=p=>(a(),_&&_.running?(d||(d=ze.factory(u,v)),d.track(p)):(f=!0,h.track(p)))}return i}function tt(e){const t=_&&_.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===et)return _t(e);if(e.suspense&&xe(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<At);){if(t&&_.disposed.has(e))return;(t?e.tState:e.state)&&r.push(e)}for(let n=r.length-1;n>=0;n--){if(e=r[n],t){let s=e,i=r[n+1];for(;(s=s.owner)&&s!==i;)if(_.disposed.has(s))return}if((t?e.tState:e.state)===be)lt(e);else if((t?e.tState:e.state)===et){const s=re;re=null,Le(()=>_t(e,r[0]),!1),re=s}}}function Le(e,t){if(re)return e();let r=!1;t||(re=[]),se?r=!0:se=[],At++;try{const n=e();return Bn(r),n}catch(n){r||(se=null),re=null,tr(n)}}function Bn(e){if(re&&(nt&&_&&_.running?qn(re):Gr(re),re=null),e)return;let t;if(_){if(!_.promises.size&&!_.queue.size){const n=_.sources,s=_.disposed;se.push.apply(se,_.effects),t=_.resolve;for(const i of se)"tState"in i&&(i.state=i.tState),delete i.tState;_=null,Le(()=>{for(const i of s)Ne(i);for(const i of n){if(i.value=i.tValue,i.owned)for(let u=0,a=i.owned.length;u<a;u++)Ne(i.owned[u]);i.tOwned&&(i.owned=i.tOwned),delete i.tValue,delete i.tOwned,i.tState=0}fr(!1)},!1)}else if(_.running){_.running=!1,_.effects.push.apply(_.effects,se),se=null,fr(!0);return}}const r=se;se=null,r.length&&Le(()=>Fr(r),!1),t&&t()}function Gr(e){for(let t=0;t<e.length;t++)tt(e[t])}function qn(e){for(let t=0;t<e.length;t++){const r=e[t],n=_.queue;n.has(r)||(n.add(r),nt(()=>{n.delete(r),Le(()=>{_.running=!0,tt(r)},!1),_&&(_.running=!1)}))}}function Dn(e){let t,r=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[r++]=n:tt(n)}if(W.context){if(W.count){W.effects||(W.effects=[]),W.effects.push(...e.slice(0,r));return}Ut()}for(W.effects&&(W.done||!W.count)&&(e=[...W.effects,...e],r+=W.effects.length,delete W.effects),t=0;t<r;t++)tt(e[t])}function _t(e,t){const r=_&&_.running;r?e.tState=0:e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const i=r?s.tState:s.state;i===be?s!==t&&(!s.updatedAt||s.updatedAt<At)&&tt(s):i===et&&_t(s,t)}}}function Jr(e){const t=_&&_.running;for(let r=0;r<e.observers.length;r+=1){const n=e.observers[r];(t?!n.tState:!n.state)&&(t?n.tState=et:n.state=et,n.pure?re.push(n):se.push(n),n.observers&&Jr(n))}}function Ne(e){let t;if(e.sources)for(;e.sources.length;){const r=e.sources.pop(),n=e.sourceSlots.pop(),s=r.observers;if(s&&s.length){const i=s.pop(),u=r.observerSlots.pop();n<s.length&&(i.sourceSlots[u]=n,s[n]=i,r.observerSlots[n]=u)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ne(e.tOwned[t]);delete e.tOwned}if(_&&_.running&&e.pure)Kr(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ne(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}_&&_.running?e.tState=0:e.state=0}function Kr(e,t){if(t||(e.tState=0,_.disposed.add(e)),e.owned)for(let r=0;r<e.owned.length;r++)Kr(e.owned[r])}function Un(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function vr(e,t,r){try{for(const n of t)n(e)}catch(n){tr(n,r&&r.owner||null)}}function tr(e,t=U){const r=hr&&t&&t.context&&t.context[hr],n=Un(e);if(!r)throw n;se?se.push({fn(){vr(n,r,t)},state:be}):vr(n,r,t)}var Ht=Symbol("fallback");function wt(e){for(let t=0;t<e.length;t++)e[t]()}function Fn(e,t,r={}){let n=[],s=[],i=[],u=0,a=t.length>1?[]:null;return $e(()=>wt(i)),()=>{let c=e()||[],h=c.length,d,f;return c[Ur],xe(()=>{let p,m,k,S,y,$,L,A,O;if(h===0)u!==0&&(wt(i),i=[],n=[],s=[],u=0,a&&(a=[])),r.fallback&&(n=[Ht],s[0]=Ve(K=>(i[0]=K,r.fallback())),u=1);else if(u===0){for(s=new Array(h),f=0;f<h;f++)n[f]=c[f],s[f]=Ve(v);u=h}else{for(k=new Array(h),S=new Array(h),a&&(y=new Array(h)),$=0,L=Math.min(u,h);$<L&&n[$]===c[$];$++);for(L=u-1,A=h-1;L>=$&&A>=$&&n[L]===c[A];L--,A--)k[A]=s[L],S[A]=i[L],a&&(y[A]=a[L]);for(p=new Map,m=new Array(A+1),f=A;f>=$;f--)O=c[f],d=p.get(O),m[f]=d===void 0?-1:d,p.set(O,f);for(d=$;d<=L;d++)O=n[d],f=p.get(O),f!==void 0&&f!==-1?(k[f]=s[d],S[f]=i[d],a&&(y[f]=a[d]),f=m[f],p.set(O,f)):i[d]();for(f=$;f<h;f++)f in k?(s[f]=k[f],i[f]=S[f],a&&(a[f]=y[f],a[f](f))):s[f]=Ve(v);s=s.slice(0,u=h),n=c.slice(0)}return s});function v(p){if(i[f]=p,a){const[m,k]=x(f);return a[f]=k,t(c[f],m)}return t(c[f])}}}function Hn(e,t,r={}){let n=[],s=[],i=[],u=[],a=0,c;return $e(()=>wt(i)),()=>{const h=e()||[],d=h.length;return h[Ur],xe(()=>{if(d===0)return a!==0&&(wt(i),i=[],n=[],s=[],a=0,u=[]),r.fallback&&(n=[Ht],s[0]=Ve(v=>(i[0]=v,r.fallback())),a=1),s;for(n[0]===Ht&&(i[0](),i=[],n=[],s=[],a=0),c=0;c<d;c++)c<n.length&&n[c]!==h[c]?u[c](()=>h[c]):c>=n.length&&(s[c]=Ve(f));for(;c<n.length;c++)i[c]();return a=u.length=i.length=d,n=h.slice(0),s=s.slice(0,a)});function f(v){i[c]=v;const[p,m]=x(h[c]);return u[c]=m,t(p,c)}}}var zn=!1;function o(e,t){if(zn&&W.context){const r=W.context;Ut(jn());const n=xe(()=>e(t||{}));return Ut(r),n}return xe(()=>e(t||{}))}var Vn=e=>`Stale read from <${e}>.`;function N(e){const t="fallback"in e&&{fallback:()=>e.fallback};return H(Fn(()=>e.each,e.children,t||void 0))}function Wr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return H(Hn(()=>e.each,e.children,t||void 0))}function b(e){const t=e.keyed,r=H(()=>e.when,void 0,void 0),n=t?r:H(r,void 0,{equals:(s,i)=>!s==!i});return H(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?xe(()=>i(t?s:()=>{if(!xe(n))throw Vn("Show");return r()})):i}return e.fallback},void 0,void 0)}var fe=e=>H(()=>e());function Gn(e,t,r){let n=r.length,s=t.length,i=n,u=0,a=0,c=t[s-1].nextSibling,h=null;for(;u<s||a<i;){if(t[u]===r[a]){u++,a++;continue}for(;t[s-1]===r[i-1];)s--,i--;if(s===u){const d=i<n?a?r[a-1].nextSibling:r[i-a]:c;for(;a<i;)e.insertBefore(r[a++],d)}else if(i===a)for(;u<s;)(!h||!h.has(t[u]))&&t[u].remove(),u++;else if(t[u]===r[i-1]&&r[a]===t[s-1]){const d=t[--s].nextSibling;e.insertBefore(r[a++],t[u++].nextSibling),e.insertBefore(r[--i],d),t[s]=r[i]}else{if(!h){h=new Map;let f=a;for(;f<i;)h.set(r[f],f++)}const d=h.get(t[u]);if(d!=null)if(a<d&&d<i){let f=u,v=1,p;for(;++f<s&&f<i&&!((p=h.get(t[f]))==null||p!==d+v);)v++;if(v>d-a){const m=t[u];for(;a<d;)e.insertBefore(r[a++],m)}else e.replaceChild(r[a++],t[u++])}else u++;else t[u++].remove()}}}var pr="_$DX_DELEGATE";function Jn(e,t,r,n={}){let s;return Ve(i=>{s=i,t===document?e():l(t,e(),t.firstChild?null:void 0,r)},n.owner),()=>{s(),t.textContent=""}}function g(e,t,r,n){let s;const i=()=>{const a=n?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,r?a.content.firstChild.firstChild:n?a.firstChild:a.content.firstChild},u=t?()=>xe(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return u.cloneNode=u,u}function ie(e,t=window.document){const r=t[pr]||(t[pr]=new Set);for(let n=0,s=e.length;n<s;n++){const i=e[n];r.has(i)||(r.add(i),t.addEventListener(i,Wn))}}function z(e,t,r){nr(e)||(r==null?e.removeAttribute(t):e.setAttribute(t,r))}function R(e,t){nr(e)||(t==null?e.removeAttribute("class"):e.className=t)}function rr(e,t,r){if(!t)return r?z(e,"style"):t;const n=e.style;if(typeof t=="string")return n.cssText=t;typeof r=="string"&&(n.cssText=r=void 0),r||(r={}),t||(t={});let s,i;for(i in r)t[i]??n.removeProperty(i),delete r[i];for(i in t)s=t[i],s!==r[i]&&(n.setProperty(i,s),r[i]=s);return r}function Kn(e,t,r){return xe(()=>e(t,r))}function l(e,t,r,n){if(r!==void 0&&!n&&(n=[]),typeof t!="function")return St(e,t,n,r);w(s=>St(e,t(),s,r),n)}function nr(e){return!!W.context&&!W.done&&(!e||e.isConnected)}function Wn(e){if(W.registry&&W.events&&W.events.find(([c,h])=>h===e))return;let t=e.target;const r=`$$${e.type}`,n=e.target,s=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),u=()=>{const c=t[r];if(c&&!t.disabled){const h=t[`${r}Data`];if(h!==void 0?c.call(t,h,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},a=()=>{for(;u()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),W.registry&&!W.done&&(W.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let h=0;h<c.length-2&&(t=c[h],!!u());h++){if(t._$host){t=t._$host,a();break}if(t.parentNode===s)break}}else a();i(n)}function St(e,t,r,n,s){const i=nr(e);if(i){!r&&(r=[...e.childNodes]);let c=[];for(let h=0;h<r.length;h++){const d=r[h];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():c.push(d)}r=c}for(;typeof r=="function";)r=r();if(t===r)return r;const u=typeof t,a=n!==void 0;if(e=a&&r[0]&&r[0].parentNode||e,u==="string"||u==="number"){if(i||u==="number"&&(t=t.toString(),t===r))return r;if(a){let c=r[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),r=Ue(e,r,n,c)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||u==="boolean"){if(i)return r;r=Ue(e,r,n)}else{if(u==="function")return w(()=>{let c=t();for(;typeof c=="function";)c=c();r=St(e,c,r,n)}),()=>r;if(Array.isArray(t)){const c=[],h=r&&Array.isArray(r);if(zt(c,t,r,s))return w(()=>r=St(e,c,r,n,!0)),()=>r;if(i){if(!c.length)return r;if(n===void 0)return r=[...e.childNodes];let d=c[0];if(d.parentNode!==e)return r;const f=[d];for(;(d=d.nextSibling)!==n;)f.push(d);return r=f}if(c.length===0){if(r=Ue(e,r,n),a)return r}else h?r.length===0?mr(e,c,n):Gn(e,r,c):(r&&Ue(e),mr(e,c));r=c}else if(t.nodeType){if(i&&t.parentNode)return r=a?[t]:t;if(Array.isArray(r)){if(a)return r=Ue(e,r,n,t);Ue(e,r,null,t)}else r==null||r===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);r=t}}return r}function zt(e,t,r,n){let s=!1;for(let i=0,u=t.length;i<u;i++){let a=t[i],c=r&&r[e.length],h;if(!(a==null||a===!0||a===!1))if((h=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))s=zt(e,a,c)||s;else if(h==="function")if(n){for(;typeof a=="function";)a=a();s=zt(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||s}else e.push(a),s=!0;else{const d=String(a);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d))}}return s}function mr(e,t,r=null){for(let n=0,s=t.length;n<s;n++)e.insertBefore(t[n],r)}function Ue(e,t,r,n){if(r===void 0)return e.textContent="";const s=n||document.createTextNode("");if(t.length){let i=!1;for(let u=t.length-1;u>=0;u--){const a=t[u];if(s!==a){const c=a.parentNode===e;!i&&!u?c?e.replaceChild(s,a):e.insertBefore(s,r):c&&a.remove()}else i=!0}}else e.insertBefore(s,r);return[s]}var Yr="kickjs-devtools-theme";function Yn(){try{const e=localStorage.getItem(Yr);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Qn(){return typeof window>"u"||!window.matchMedia?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var[Qr,Xn]=x(Yn()),[Zn,el]=x(Qn());if(typeof window<"u"&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: light)"),t=r=>el(r.matches?"light":"dark");e.addEventListener("change",t)}var Ot=Qr;function Xr(){const e=Qr();return e==="system"?Zn():e}function tl(e){Xn(e);try{localStorage.setItem(Yr,e)}catch{}}function rl(){Ce(()=>{const e=Xr();document.documentElement.dataset.theme=e}),$e(()=>{delete document.documentElement.dataset.theme})}var Zr="kickjs-devtools-density";function nl(){try{const e=localStorage.getItem(Zr);if(e==="sm"||e==="md"||e==="lg")return e}catch{}return"sm"}var[en,ll]=x(nl()),br=en;function sl(e){ll(e);try{localStorage.setItem(Zr,e)}catch{}}function il(){Ce(()=>{document.documentElement.dataset.density=en()}),$e(()=>{delete document.documentElement.dataset.density})}var[al,ol]=x("connecting"),[cl,xr]=x(null),[ul,dl]=x(!1),[hl,fl]=x(null),[gl,vl]=x(null),[pl,ml]=x(null),[bl,xl]=x([]),[$l,yl]=x([]),[_l,wl]=x({enabled:!1,queues:[]}),[Sl,kl]=x({enabled:!1}),q={connectionStatus:al,lastUpdate:cl,authRequired:ul,authError:hl,health:gl,metrics:pl,routes:bl,container:$l,queues:_l,ws:Sl},X={setConnectionStatus:ol,setLastUpdate:xr,setAuthRequired:dl,setAuthError:fl,setHealth:vl,setMetrics:ml,setRoutes:xl,setContainer:yl,setQueues:wl,setWs:kl,touch(){xr(new Date)}};function he(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`}function Cl(e){if(e===0)return"0";const t=e*60;return Math.abs(t)<1048576?`${(t/1024).toFixed(1)} KiB/min`:`${(t/1024/1024).toFixed(1)} MiB/min`}function Me(e){return e<1?`${e.toFixed(2)} ms`:e<100?`${e.toFixed(1)} ms`:`${Math.round(e)} ms`}function lr(e){const t=Math.floor(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m ${t%60}s`}function kt(e){return`${Math.round(e*100)}%`}function Vt(e){const t=e.toUpperCase();return t==="GET"?"text-emerald-400":t==="POST"?"text-cyan-400":t==="PUT"||t==="PATCH"?"text-amber-400":t==="DELETE"?"text-red-400":"text-text-secondary"}var Tl=g('<span class=dt-tip tabindex=0><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none></path></svg><span role=tooltip>'),El=g('<button type=button class="dt-tip dt-tip-clickable"><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none>'),Al=g('<div class="fixed inset-0 z-50 bg-slate-950/80 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-6 max-w-lg w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><h2 class="text-lg font-semibold text-slate-200"></h2><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div class="text-sm text-slate-300 space-y-3">'),Gt={"heap.used":{short:"V8-allocated memory currently used by JavaScript objects.",detail:"Grows as your code allocates objects, shrinks after GC frees them. A consistently rising heap-used line on the sparkline is the textbook leak signature."},"heap.total":{short:"V8-allocated memory the JS heap is currently sized to use.",detail:"Larger than heap-used; V8 reserves headroom so allocations don't pause to grow the heap. Bumps up in 1-8 MiB jumps as the heap expands."},rss:{short:"Total memory resident in physical RAM for this Node process.",detail:'Includes the JS heap, native buffers, V8 internal structures, and code. Always larger than heap-used; the gap is "everything the OS sees" minus "JS objects".'},external:{short:"Memory used by C++ objects bound to JS (Buffers, native bindings)."},"array-buffers":{short:"Memory used by ArrayBuffer / SharedArrayBuffer instances."},"event-loop.p99":{short:"99% of event-loop ticks completed within this time.",detail:"Sustained values above ~50ms mean some synchronous operation is blocking the loop. Common culprits: large JSON.parse, sync crypto, blocking DB drivers."},gc:{short:"Garbage-collector activity since process start.",detail:"Total run count and cumulative pause time. Frequent GC with low reclaim ratio = leak; rare GC with healthy reclaim = good citizen."},"leak.risk":{short:"Heap-growth slope over the recent window — stable / warn / critical.",detail:"Bucketed from heap-growth in MB/min: <5 = ok, <20 = warn, ≥20 = critical. Critical sustained for >5 minutes is the moment to capture a heap snapshot."},"gc.reclaim":{short:"Average ratio of memory freed by each GC pass.",detail:"Trending toward zero means GC can't free anything — strong leak indicator. Healthy apps reclaim 20-60% on each major GC."},"heap.utilization":{short:"Fraction of V8's hard heap-size limit currently in use.",detail:"Approaching 1 means the process is close to OOM. Use --max-old-space-size to raise the limit if your workload is memory-bound."},requests:{short:"Total HTTP requests handled since process start."},"server-errors":{short:"5xx responses — server-side failures."},"client-errors":{short:"4xx responses — bad client input, missing routes, auth denials."},"error-rate":{short:"Server errors as a percentage of total requests.",detail:"Computed across the lifetime of the process. Spikes typically signal upstream dependency failures; sustained elevation = code bug."},uptime:{short:"How long this Node process has been running."},"latency.avg":{short:"Mean response time per route (sum of all calls / call count)."},"latency.p50":{short:"Median — half the requests complete faster than this."},"latency.p95":{short:"95% of requests complete within this time."},"latency.p99":{short:"99% of requests complete within this time. Outlier-sensitive."},"latency.max":{short:"Slowest single response observed since process start."},"resolve.count":{short:"Number of times this token was resolved from the DI container."},"resolve.duration":{short:"How long the container took to resolve this token (ms)."},"post-construct":{short:"@PostConstruct lifecycle status: done / failed / none.",detail:'A failed PostConstruct means the service registered but its async init threw. The token is left in a "registered" state; resolve() will throw the original error.'}},ve=e=>{const t=()=>e.text??Gt[e.metric??""]?.short??"",r=e.placement??"top";return(()=>{var n=Tl(),s=n.firstChild.nextSibling;return R(s,`dt-tip-pop dt-tip-pop-${r}`),l(s,t),w(()=>z(n,"aria-label",t())),n})()},Ml=e=>{const[t,r]=x(!1);return[(()=>{var n=El();return n.$$click=()=>r(!0),w(()=>z(n,"aria-label",`More info: ${e.title}`)),n})(),o(b,{get when(){return t()},get children(){return o(Ll,{get title(){return e.title},onClose:()=>r(!1),get children(){return e.children}})}})]},Ll=e=>(()=>{var t=Al(),r=t.firstChild.firstChild,n=r.firstChild,s=n.nextSibling,i=r.nextSibling;return t.$$click=u=>{u.target===u.currentTarget&&e.onClose()},l(n,()=>e.title),s.$$click=()=>e.onClose(),l(i,()=>e.children),t})();ie(["click"]);var Rl=g('<div class="grid grid-cols-1 md:grid-cols-3 gap-4">'),Ol=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Health'),tn=g('<p class="text-text-muted italic">Loading…'),jl=g("<span>"),Ge=g('<span class="font-semibold tabular-nums">'),rn=g("<div class=mt-1>"),Nl=g('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Adapters (<!>)'),Il=g('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm"></span><span>'),Pl=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">Metrics'),Bl=g('<span class="font-semibold tabular-nums text-red-400">'),ql=g('<span class="font-semibold tabular-nums text-amber-400">'),Dl=g('<span class="font-semibold text-sm">'),Ul=g('<span class="font-semibold tabular-nums text-emerald-400">'),Fl=g('<div class="border-t border-border mt-2 pt-2"><button type=button class="text-xs text-text-muted hover:text-text-strong flex items-center gap-1"><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg>Namespaces (<!>)'),Hl=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-3">WebSocket'),zl=g('<p class="text-text-muted italic">No WsAdapter detected'),Vl=g('<div class="flex items-center justify-between py-1"><span class="text-text-secondary text-sm font-mono"></span><span class=text-sm> conn / <!> handlers'),Gl=g('<div class="flex items-center justify-between mb-2"><span class=text-text-secondary>'),Jl=()=>(()=>{var e=Rl();return l(e,o(Kl,{}),null),l(e,o(Wl,{}),null),l(e,o(Yl,{}),null),e})(),Kl=()=>{const[e,t]=x(!0);return(()=>{var r=Ol();return r.firstChild,l(r,o(b,{get when(){return q.health()},get fallback(){return tn()},children:n=>[o(Te,{label:"Status",get children(){var s=jl();return l(s,()=>n().status),w(()=>R(s,`badge ${Ql(n().status)}`)),s}}),o(Te,{label:"Uptime",get children(){var s=Ge();return l(s,()=>lr(n().uptime)),s}}),o(Te,{label:"Error rate",get children(){var s=Ge();return l(s,()=>kt(n().errorRate),null),l(s,o(ve,{metric:"error-rate"}),null),s}}),o(b,{get when(){return Object.keys(n().adapters).length>0},get children(){var s=Nl(),i=s.firstChild,u=i.firstChild,a=u.nextSibling.nextSibling;return a.nextSibling,i.$$click=()=>t(c=>!c),l(i,()=>Object.keys(n().adapters).length,a),l(s,o(b,{get when(){return e()},get children(){var c=rn();return l(c,o(N,{get each(){return Object.entries(n().adapters)},children:([h,d])=>(()=>{var f=Il(),v=f.firstChild,p=v.nextSibling;return l(v,h),R(p,`badge ${d==="running"?"badge-ok":"badge-warn"}`),l(p,d),f})()})),c}}),null),w(()=>z(u,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),s}})]}),null),r})()},Wl=()=>(()=>{var e=Pl();return e.firstChild,l(e,o(b,{get when(){return q.metrics()},get fallback(){return tn()},children:t=>[o(Te,{label:"Total requests",get children(){var r=Ge();return l(r,()=>t().requests.toLocaleString()),r}}),o(Te,{label:"5xx errors",get children(){var r=Bl();return l(r,()=>t().serverErrors),r}}),o(Te,{label:"4xx errors",get children(){var r=ql();return l(r,()=>t().clientErrors),r}}),o(Te,{label:"Started",get children(){var r=Dl();return l(r,()=>new Date(t().startedAt).toLocaleTimeString()),r}})]}),null),e})(),Yl=()=>{const[e,t]=x(!1);return(()=>{var r=Hl();return r.firstChild,l(r,o(b,{get when(){return q.ws().enabled},get fallback(){return zl()},get children(){return[o(Te,{label:"Active",get children(){var n=Ul();return l(n,()=>q.ws().activeConnections??0),n}}),o(Te,{label:"Total",get children(){var n=Ge();return l(n,()=>q.ws().totalConnections??0),n}}),o(Te,{label:"Messages in",get children(){var n=Ge();return l(n,()=>q.ws().messagesReceived??0),n}}),o(Te,{label:"Messages out",get children(){var n=Ge();return l(n,()=>q.ws().messagesSent??0),n}}),o(b,{get when(){return fe(()=>!!q.ws().namespaces)()&&Object.keys(q.ws().namespaces??{}).length>0},get children(){var n=Fl(),s=n.firstChild,i=s.firstChild,u=i.nextSibling.nextSibling;return u.nextSibling,s.$$click=()=>t(a=>!a),l(s,()=>Object.keys(q.ws().namespaces??{}).length,u),l(n,o(b,{get when(){return e()},get children(){var a=rn();return l(a,o(N,{get each(){return Object.entries(q.ws().namespaces??{})},children:([c,h])=>(()=>{var d=Vl(),f=d.firstChild,v=f.nextSibling,p=v.firstChild,m=p.nextSibling;return m.nextSibling,l(f,c),l(v,()=>h.connections,p),l(v,()=>h.handlers,m),d})()})),a}}),null),w(()=>z(i,"class",`w-3 h-3 transition-transform ${e()?"rotate-90":""}`)),n}})]}}),null),r})()},Te=e=>(()=>{var t=Gl(),r=t.firstChild;return l(r,()=>e.label),l(t,()=>e.children,null),t})();function Ql(e){return e==="healthy"?"badge-ok":e==="degraded"?"badge-warn":"badge-critical"}ie(["click"]);var Xl=g("<svg class=sparkline preserveAspectRatio=none aria-hidden=true><path fill=none stroke-width=1.5 stroke-linejoin=round stroke-linecap=round>"),mt=e=>{const t=()=>e.width??200,n=H(()=>{const s=e.values;if(s.length<2)return"";const i=Math.min(...s),u=Math.max(...s)-i||1,a=t()/(s.length-1),c=d=>40-(d-i)/u*36-2;let h=`M0 ${c(s[0]).toFixed(2)}`;for(let d=1;d<s.length;d++)h+=` L${(d*a).toFixed(2)} ${c(s[d]).toFixed(2)}`;return h});return(()=>{var s=Xl(),i=s.firstChild;return w(u=>{var a=`0 0 ${t()} 40`,c=n(),h=e.stroke??"var(--color-accent)";return a!==u.e&&z(s,"viewBox",u.e=a),c!==u.t&&z(i,"d",u.t=c),h!==u.a&&z(i,"stroke",u.a=h),u},{e:void 0,t:void 0,a:void 0}),s})()};function Ie(){return document.body.dataset.base??"/_debug"}var sr="kickjs_devtools_token",Zl=30,bt=null;function De(){if(bt)return bt;const e=new URLSearchParams(location.search).get("token");if(e){Jt(e);const r=new URL(location.href);return r.searchParams.delete("token"),history.replaceState({},"",r.toString()),e}const t=document.cookie.match(new RegExp(`${sr}=([^;]+)`));return t?(Jt(decodeURIComponent(t[1])),bt):null}function Jt(e){bt=e,document.cookie=`${sr}=${encodeURIComponent(e)}; path=${Ie()}; max-age=${86400*Zl}; SameSite=Lax`,es()}function es(){Ie()!=="/"&&(document.cookie=`${sr}=; path=/; max-age=0; SameSite=Lax`)}function nn(e){const t=De();return t?`${e}${e.includes("?")?"&":"?"}token=${encodeURIComponent(t)}`:e}var ln=class extends Error{constructor(){super("AUTH_REQUIRED"),this.name="AuthRequiredError"}};async function Se(e){const t=nn(`${Ie()}${e}`),r=await fetch(t,{headers:ts()});if(r.status===401||r.status===403)throw new ln;if(!r.ok)throw new Error(`GET ${e} failed: ${r.status} ${r.statusText}`);return await r.json()}function ts(){const e=De();return e?{"x-devtools-token":e}:{}}var ge={runtime:()=>Se("/runtime"),topology:()=>Se("/topology"),metrics:()=>Se("/metrics"),routes:()=>Se("/metrics"),source:(e,t)=>Se(`/source?${new URLSearchParams({controller:e,handler:t})}`),routeRegistry:()=>Se("/routes"),container:()=>Se("/container"),health:()=>Se("/health"),queues:()=>Se("/queues"),ws:()=>Se("/ws"),tabs:()=>Se("/tabs")};function ir(e,t,r){const n=nn(`${Ie()}${e}`),s=new EventSource(n);return s.addEventListener("message",i=>{try{t(JSON.parse(i.data))}catch(u){console.warn("SSE parse failed",u)}}),r&&s.addEventListener("error",r),()=>s.close()}var rs=g("<div class=status><span><span></span></span><span> samples"),ns=g("<div class=proc-strip><span class=proc-label>These stats are for <strong>this Node process</strong> — the one running your KickJS app.</span><span class=proc-meta><span class=proc-pill>Node </span><span class=proc-pill>/</span><span class=proc-pill>pid "),ls=g("<span>engine: "),ss=g("<div class=empty>Loading runtime metrics…"),is=g("<div class=empty style=padding:0;text-align:left;font-size:11px>GC: <!> runs, <!> total"),$r=g("<div class=grid>"),as=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),os=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x([]),[u,a]=x([]),[c,h]=x([]),[d,f]=x(!1),v=p=>{t(p),i(m=>[...m,p.memory.heapUsed].slice(-60)),a(m=>[...m,p.memory.rss].slice(-60)),h(m=>[...m,p.eventLoop.p99].slice(-60))};return Je(()=>{ge.runtime().then(m=>{m.process&&n(m.process);for(const k of m.history)v(k);f(!0)}).catch(()=>f(!1));const p=ir("/runtime/stream",m=>{f(!0),v(m)},()=>f(!1));$e(p)}),[o(b,{get when(){return r()},children:p=>(()=>{var m=ns(),k=m.firstChild.nextSibling,S=k.firstChild;S.firstChild;var y=S.nextSibling,$=y.firstChild,L=y.nextSibling;return L.firstChild,l(k,o(b,{get when(){return p().runtime},children:A=>(()=>{var O=ls();return O.firstChild,l(O,()=>A().name,null),w(()=>R(O,`proc-pill rt-${A().name}`)),O})()}),S),l(S,()=>p().nodeVersion,null),l(y,()=>p().platform,$),l(y,()=>p().arch,null),l(L,()=>p().pid,null),m})()}),o(b,{get when(){return e()},get fallback(){return ss()},children:p=>[(()=>{var m=$r();return l(m,o(Oe,{title:"Heap used",metric:"heap.used",get value(){return he(p().memory.heapUsed)},get children(){return o(mt,{get values(){return s()}})}}),null),l(m,o(Oe,{title:"RSS",metric:"rss",get value(){return he(p().memory.rss)},get children(){return o(mt,{get values(){return u()}})}}),null),l(m,o(Oe,{title:"Event loop p99",metric:"event-loop.p99",get value(){return Me(p().eventLoop.p99)},get children(){return o(mt,{get values(){return c()}})}}),null),l(m,o(Oe,{title:"Uptime",metric:"uptime",get value(){return lr(p().uptimeSec)},get children(){var k=is(),S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling;return y.nextSibling,l(k,()=>p().gc.count,S),l(k,()=>Me(p().gc.totalPauseMs),y),k}}),null),m})(),(()=>{var m=$r();return l(m,o(Oe,{title:"External",metric:"external",get value(){return he(p().memory.external)}}),null),l(m,o(Oe,{title:"Array buffers",metric:"array-buffers",get value(){return he(p().memory.arrayBuffers)}}),null),l(m,o(Oe,{title:"Heap total",metric:"heap.total",get value(){return he(p().memory.heapTotal)}}),null),l(m,o(Oe,{title:"CPU (last sample)",get value(){return`${(p().cpu.userMicros/1e3).toFixed(1)} ms u / ${(p().cpu.systemMicros/1e3).toFixed(1)} ms s`}}),null),m})()]}),(()=>{var p=rs(),m=p.firstChild,k=m.firstChild,S=m.nextSibling,y=S.firstChild;return l(m,()=>d()?"streaming":"reconnecting…",null),l(S,()=>s().length,y),w(()=>R(k,`status-dot ${d()?"connected":"disconnected"}`)),p})()]},Oe=e=>(()=>{var t=as(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),l(t,()=>e.children,null),t})(),cs=g("<div class=status><span><span></span></span><span> samples"),us=g("<div class=empty>Loading memory metrics…"),yr=g("<p>"),ds=g("<p><strong>Severity buckets</strong> (heap-growth in MB/min):"),hs=g('<ul class="list-disc pl-5 space-y-1"><li><span class="badge badge-ok">ok</span> < 5 MB/min — typical operation.</li><li><span class="badge badge-warn">warn</span> < 20 MB/min — investigate if sustained > 5 minutes.</li><li><span class="badge badge-critical">critical</span> ≥ 20 MB/min — capture a heap snapshot now.'),fs=g("<div class=card><div class=card-header><div class=card-title>Leak risk</div><span></span></div><div style=display:flex;justify-content:space-between;align-items:baseline><div class=card-value> growth</div><div class=card-value style=font-size:13px;color:var(--text-dim)>GC reclaim<!> <!> • heap util<!> "),gs=g("<div class=grid>"),vs=g("<table><thead><tr><th>Type</th><th style=text-align:right>Count</th></tr></thead><tbody>"),ps=g("<div class=card><div class=card-header><div class=card-title>Active handles</div><div class=card-value>"),ms=g("<div class=empty>No handle inventory available on this runtime."),bs=g("<tr><td></td><td style=text-align:right>"),xs=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),$s=g('<div class=card><div class=card-header><div class=card-title>Heap snapshot</div><div class=card-value style=font-size:13px;color:var(--text-dim)>~<!> estimate</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Captures a V8 heap snapshot for retained-size analysis in Chrome DevTools (Memory tab, Load profile). Capture blocks the event loop for several seconds — avoid in production.</p><div style=display:flex;align-items:center;gap:12px><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),ys=g("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Last: <!> (<!>)"),sn=g('<p style="margin:8px 0 0;color:var(--critical);font-size:12px;font-family:var(--font-mono)">'),_s=g('<div class=card><div class=card-header><div class=card-title>Force GC</div></div><p style="margin:0 0 12px;color:var(--text-dim);font-size:12px">Triggers a synchronous V8 GC pass to confirm whether heap growth is real retention or just uncollected garbage. Requires <code>node --expose-gc</code>.</p><div style=display:flex;align-items:center;gap:12px;flex-wrap:wrap><button type=button class=tab style="border:1px solid var(--accent);border-radius:4px;padding:6px 14px;border-bottom-color:var(--accent);color:var(--accent)">'),ws=g("<span style=color:var(--text-dim);font-size:12px;font-family:var(--font-mono)>Reclaimed <!> (<!> → <!>) in <!>ms"),Ss=()=>{const[e,t]=x(null),[r,n]=x([]),[s,i]=x(!1),u=c=>{t(c),n(h=>[...h,c.snapshot.memory.heapUsed].slice(-60))};Je(()=>{ge.runtime().then(h=>{h.latest&&(u({snapshot:h.latest,health:h.health}),n(h.history.map(d=>d.memory.heapUsed).slice(-60))),i(!0)}).catch(()=>i(!1));const c=ir("/memory/stream",h=>{i(!0),u(h)},()=>i(!1));$e(c)});const a=H(()=>{const c=e();return c?Object.entries(c.health.handlesByType).toSorted((h,d)=>d[1]-h[1]):[]});return[o(b,{get when(){return e()},get fallback(){return us()},children:c=>[(()=>{var h=fs(),d=h.firstChild,f=d.firstChild;f.firstChild;var v=f.nextSibling,p=d.nextSibling.firstChild,m=p.firstChild,k=p.nextSibling,S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling,$=y.nextSibling.nextSibling;return $.nextSibling,l(f,o(Ml,{title:"What is leak risk?",get children(){return[(()=>{var L=yr();return l(L,()=>Gt["leak.risk"].short),L})(),(()=>{var L=yr();return l(L,()=>Gt["leak.risk"].detail),L})(),ds(),hs()]}}),null),l(v,()=>c().health.heapGrowthSeverity),l(p,()=>Cl(c().health.heapGrowthBytesPerSec),m),l(k,o(ve,{metric:"gc.reclaim"}),S),l(k,()=>kt(c().health.gcReclaimRatio),y),l(k,o(ve,{metric:"heap.utilization"}),$),l(k,()=>kt(c().health.heapUtilization),null),l(h,o(mt,{get values(){return r()}}),null),w(()=>R(v,`badge badge-${c().health.heapGrowthSeverity}`)),h})(),(()=>{var h=gs();return l(h,o(ot,{title:"Heap used",metric:"heap.used",get value(){return he(c().snapshot.memory.heapUsed)}}),null),l(h,o(ot,{title:"Heap total",metric:"heap.total",get value(){return he(c().snapshot.memory.heapTotal)}}),null),l(h,o(ot,{title:"RSS",metric:"rss",get value(){return he(c().snapshot.memory.rss)}}),null),l(h,o(ot,{title:"External",metric:"external",get value(){return he(c().snapshot.memory.external)}}),null),h})(),(()=>{var h=ps(),d=h.firstChild.firstChild.nextSibling;return l(d,()=>c().health.activeHandles),l(h,o(b,{get when(){return a().length>0},get fallback(){return ms()},get children(){var f=vs(),v=f.firstChild.nextSibling;return l(v,o(N,{get each(){return a()},children:([p,m])=>(()=>{var k=bs(),S=k.firstChild,y=S.nextSibling;return l(S,p),l(y,m),k})()})),f}}),null),h})(),o(ks,{get heapTotal(){return c().snapshot.memory.heapTotal}}),o(Es,{})]}),(()=>{var c=cs(),h=c.firstChild,d=h.firstChild,f=h.nextSibling,v=f.firstChild;return l(h,()=>s()?"streaming":"reconnecting…",null),l(f,()=>r().length,v),w(()=>R(d,`status-dot ${s()?"connected":"disconnected"}`)),c})()]},ot=e=>(()=>{var t=xs(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),ks=e=>{const[t,r]=x(!1),[n,s]=x(null),[i,u]=x(null),a=async()=>{r(!0),s(null);try{const c=De(),h=`${Ie()}/memory/snapshot${c?`?token=${encodeURIComponent(c)}`:""}`,d=await fetch(h,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});if(!d.ok){let p=`${d.status} ${d.statusText}`;try{const m=await d.json();m.error&&(p=m.error)}catch{}throw new Error(p)}const f=await d.blob(),v=Cs(d.headers.get("content-disposition"))??`kickjs-heap-${Date.now()}.heapsnapshot`;Ts(f,v),u({name:v,sizeBytes:f.size})}catch(c){s(c instanceof Error?c.message:String(c))}finally{r(!1)}};return(()=>{var c=$s(),h=c.firstChild,d=h.firstChild.nextSibling,f=d.firstChild.nextSibling;f.nextSibling;var v=h.nextSibling.nextSibling,p=v.firstChild;return l(d,()=>he(e.heapTotal),f),p.$$click=()=>{a()},l(p,()=>t()?"Capturing…":"Take snapshot"),l(v,o(b,{get when(){return i()},children:m=>(()=>{var k=ys(),S=k.firstChild.nextSibling,y=S.nextSibling.nextSibling;return y.nextSibling,l(k,()=>m().name,S),l(k,()=>he(m().sizeBytes),y),k})()}),null),l(c,o(b,{get when(){return n()},children:m=>(()=>{var k=sn();return l(k,m),k})()}),null),w(()=>p.disabled=t()),c})()};function Cs(e){if(!e)return null;const t=/filename="?([^";]+)"?/.exec(e);return t?t[1]:null}function Ts(e,t){const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}var Es=()=>{const[e,t]=x(!1),[r,n]=x(null),[s,i]=x(null),u=async()=>{t(!0),i(null);try{const a=De(),c=`${Ie()}/memory/gc${a?`?token=${encodeURIComponent(a)}`:""}`,h=await fetch(c,{method:"POST",headers:a?{"x-devtools-token":a}:void 0});if(!h.ok){let d=`${h.status} ${h.statusText}`;try{const f=await h.json();f.error&&(d=f.error)}catch{}throw new Error(d)}n(await h.json())}catch(a){i(a instanceof Error?a.message:String(a))}finally{t(!1)}};return(()=>{var a=_s(),c=a.firstChild.nextSibling.nextSibling,h=c.firstChild;return h.$$click=()=>{u()},l(h,()=>e()?"Collecting…":"Run GC"),l(c,o(b,{get when(){return r()},children:d=>(()=>{var f=ws(),v=f.firstChild.nextSibling,p=v.nextSibling.nextSibling,m=p.nextSibling.nextSibling,k=m.nextSibling.nextSibling;return k.nextSibling,l(f,()=>he(d().reclaimedBytes),v),l(f,()=>he(d().before),p),l(f,()=>he(d().after),m),l(f,()=>d().elapsedMs,k),f})()}),null),l(a,o(b,{get when(){return s()},children:d=>(()=>{var f=sn();return l(f,d),f})()}),null),w(()=>h.disabled=e()),a})()};ie(["click"]);var As=g('<div class="flex items-center justify-between mt-4 pt-3 border-t border-slate-800 text-xs text-slate-500"><div class="flex items-center gap-3"><span>Showing <!>–<!> of </span><label class="flex items-center gap-1"><span class=text-slate-600>Per page</span><select class="bg-slate-800 border border-slate-700 rounded px-1.5 py-0.5 text-slate-200"></select></label></div><div class="flex items-center gap-1"><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Prev</button><button type=button class="px-2.5 py-1 rounded border border-slate-700 bg-slate-800 hover:bg-slate-700 disabled:opacity-30">Next'),Ms=g("<option>"),Ls=g('<span class="px-1 text-slate-600">…'),Rs=g("<button type=button>"),Os=[5,10,15,20,25,50,100];function Pe(e,t={}){const r=t.pageSizeChoices??Os,n=t.pageSize??r[0]??5,[s,i]=x(n),[u,a]=x(1),c=H(()=>Math.max(1,Math.ceil(e().length/s()))),h=H(()=>Math.min(u(),c()));return{source:e,page:H(()=>{const d=(h()-1)*s();return e().slice(d,d+s())}),current:h,total:c,pageSize:s,pageSizeChoices:r,range:H(()=>{const d=e().length;return d===0?{start:0,end:0,total:0}:{start:(h()-1)*s()+1,end:Math.min(h()*s(),d),total:d}}),goto(d){a(Math.max(1,Math.min(d,c())))},next(){a(d=>Math.min(d+1,c()))},prev(){a(d=>Math.max(d-1,1))},setPageSize(d){i(d);const f=(h()-1)*s();a(Math.max(1,Math.floor(f/d)+1))}}}var Be=e=>{const t=H(()=>{const r=e.pager.total(),n=e.pager.current();if(r<=7)return Array.from({length:r},(a,c)=>c+1);const s=[1],i=Math.max(2,n-1),u=Math.min(r-1,n+1);i>2&&s.push("gap");for(let a=i;a<=u;a++)s.push(a);return u<r-1&&s.push("gap"),s.push(r),s});return o(b,{get when(){return e.pager.total()>1||e.pager.source().length>e.pager.pageSize()},get children(){var r=As(),n=r.firstChild,s=n.firstChild,i=s.firstChild.nextSibling,u=i.nextSibling.nextSibling;u.nextSibling;var a=s.nextSibling.firstChild.nextSibling,c=n.nextSibling,h=c.firstChild,d=h.nextSibling;return l(s,()=>e.pager.range().start,i),l(s,()=>e.pager.range().end,u),l(s,()=>e.pager.range().total,null),a.addEventListener("change",f=>e.pager.setPageSize(Number(f.currentTarget.value))),l(a,o(N,{get each(){return e.pager.pageSizeChoices},children:f=>(()=>{var v=Ms();return v.value=f,l(v,f),v})()})),h.$$click=()=>e.pager.prev(),l(c,o(N,{get each(){return t()},children:f=>o(b,{when:f==="gap",get fallback(){return(()=>{var v=Rs();return v.$$click=()=>e.pager.goto(f),l(v,f),w(()=>R(v,`px-2.5 py-1 rounded border ${f===e.pager.current()?"border-kick-500/30 bg-kick-500/20 text-kick-500":"border-slate-700 bg-slate-800 hover:bg-slate-700"}`)),v})()},get children(){return Ls()}})}),d),d.$$click=()=>e.pager.next(),w(f=>{var v=e.pager.current()===1,p=e.pager.current()===e.pager.total();return v!==f.e&&(h.disabled=f.e=v),p!==f.t&&(d.disabled=f.t=p),f},{e:void 0,t:void 0}),w(()=>a.value=e.pager.pageSize()),r}})};ie(["click"]);var js=g('<div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:12px><h2 style=margin:0;font-size:16px>Topology</h2><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:4px 12px;border-bottom-color:var(--border)">'),Ns=g("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Topology error</div><code>"),Is=g("<div class=empty>Loading topology…"),Ps=g('<div class=card style=border-color:var(--warn)><div class=card-title style=color:var(--warn)> introspect failure(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),Bs=g("<li>/<!>: "),qs=g("<table><thead><tr><th>Key</th><th>Source</th><th>Depends on</th></tr></thead><tbody>"),Ds=g("<div class=card><div class=card-header><div class=card-title>Contributors (<!>)"),Us=g("<div class=empty>No contributors registered"),Fs=g("<tr><td><span class=tree-key></span></td><td></td><td>"),Hs=g("<table><thead><tr><th>Token</th><th>Scope</th><th>Kind</th><th>Resolved</th></tr></thead><tbody>"),zs=g("<div class=card><div class=card-header><div class=card-title>DI tokens (<!>)"),Vs=g("<div class=empty>No DI tokens registered"),Gs=g("<tr><td><span class=tree-key></span></td><td></td><td></td><td>"),Js=g("<div class=card><div class=card-header><div class=card-title>"),Ks=g("<div class=empty>"),Ws=g("<span class=tree-meta>[<!>]"),Ys=g("<span class=tree-meta>v"),Qs=g("<span class=tree-meta>"),Xs=g("<div class=tree-meta>provides: "),Zs=g("<div class=tree-meta>requires: "),_r=g("<div class=tree-meta>"),ei=g("<div class=tree-node><span class=tree-key>"),wr=g("<span style=margin-right:12px>: <strong style=color:var(--text)>"),ti=()=>{const[e,t]=x(null),[r,n]=x(null),[s,i]=x(!1),u=async()=>{i(!0),n(null);try{t(await ge.topology())}catch(a){n(a instanceof Error?a.message:String(a))}finally{i(!1)}};return Je(()=>{u()}),[(()=>{var a=js(),c=a.firstChild.nextSibling;return c.$$click=()=>{u()},l(c,()=>s()?"Refreshing…":"Refresh"),w(()=>c.disabled=s()),a})(),o(b,{get when(){return r()},children:a=>(()=>{var c=Ns(),h=c.firstChild.nextSibling;return l(h,a),c})()}),o(b,{get when(){return e()},get fallback(){return Is()},children:a=>[o(b,{get when(){return a().errors.length>0},get children(){var c=Ps(),h=c.firstChild,d=h.firstChild,f=h.nextSibling;return l(h,()=>a().errors.length,d),l(f,o(N,{get each(){return a().errors},children:v=>(()=>{var p=Bs(),m=p.firstChild,k=m.nextSibling;return k.nextSibling,l(p,()=>v.kind,m),l(p,()=>v.name,k),l(p,()=>v.message,null),p})()})),c}}),o(Sr,{get title(){return`Plugins (${a().plugins.length})`},get items(){return a().plugins},empty:"No plugins registered"}),o(Sr,{get title(){return`Adapters (${a().adapters.length})`},get items(){return a().adapters},empty:"No adapters registered"}),o(ri,{get rows(){return a().contributors}}),o(ni,{get rows(){return a().diTokens}})]})]},ri=e=>{const t=H(()=>e.rows??[]),r=Pe(t);return(()=>{var n=Ds(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return Us()},get children(){return[(()=>{var u=qs(),a=u.firstChild.nextSibling;return l(a,o(N,{get each(){return r.page()},children:c=>(()=>{var h=Fs(),d=h.firstChild,f=d.firstChild,v=d.nextSibling,p=v.nextSibling;return l(f,()=>c.key),l(v,()=>c.source),l(p,()=>c.dependsOn.join(", ")||"—"),h})()})),u})(),o(Be,{pager:r})]}}),null),n})()},ni=e=>{const t=H(()=>e.rows??[]),r=Pe(t);return(()=>{var n=zs(),s=n.firstChild.firstChild,i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>t().length,i),l(n,o(b,{get when(){return t().length>0},get fallback(){return Vs()},get children(){return[(()=>{var u=Hs(),a=u.firstChild.nextSibling;return l(a,o(N,{get each(){return r.page()},children:c=>(()=>{var h=Gs(),d=h.firstChild,f=d.firstChild,v=d.nextSibling,p=v.nextSibling,m=p.nextSibling;return l(f,()=>c.token),l(v,()=>c.scope),l(p,()=>c.kind),l(m,()=>c.instantiated?"yes":"no"),h})()})),u})(),o(Be,{pager:r})]}}),null),n})()},Sr=e=>(()=>{var t=Js(),r=t.firstChild.firstChild;return l(r,()=>e.title),l(t,o(b,{get when(){return e.items.length>0},get fallback(){return(()=>{var n=Ks();return l(n,()=>e.empty),n})()},get children(){return o(N,{get each(){return e.items},children:n=>o(ii,{item:n})})}}),null),t})();function li(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(1)} GB`}function si(e){if(typeof e!="object"||e===null)return String(e);try{return JSON.stringify(e)}catch{return"[unserializable]"}}var ii=e=>(()=>{var t=ei(),r=t.firstChild;return l(r,()=>e.item.name),l(t,o(b,{get when(){return e.item.kind},get children(){var n=Ws(),s=n.firstChild.nextSibling;return s.nextSibling,l(n,()=>e.item.kind,s),n}}),null),l(t,o(b,{get when(){return e.item.version},get children(){var n=Ys();return n.firstChild,l(n,()=>e.item.version,null),n}}),null),l(t,o(b,{get when(){return typeof e.item.memoryBytes=="number"},get children(){var n=Qs();return l(n,()=>li(e.item.memoryBytes)),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.provides.length},get children(){var n=Xs();return n.firstChild,l(n,()=>e.item.tokens?.provides.join(", "),null),n}}),null),l(t,o(b,{get when(){return e.item.tokens?.requires.length},get children(){var n=Zs();return n.firstChild,l(n,()=>e.item.tokens?.requires.join(", "),null),n}}),null),l(t,o(b,{get when(){return fe(()=>!!e.item.state)()&&Object.keys(e.item.state).length>0},get children(){var n=_r();return l(n,o(N,{get each(){return Object.entries(e.item.state??{})},children:([s,i])=>(()=>{var u=wr(),a=u.firstChild,c=a.nextSibling;return l(u,s,a),l(c,()=>si(i)),u})()})),n}}),null),l(t,o(b,{get when(){return e.item.metrics},children:n=>(()=>{var s=_r();return l(s,o(N,{get each(){return Object.entries(n())},children:([i,u])=>(()=>{var a=wr(),c=a.firstChild,h=c.nextSibling;return l(a,i,c),l(h,u),a})()})),s})()}),null),t})();ie(["click"]);var ai={publicFlag:"auth.public",csrfCookie:"_csrf",csrfHeader:"x-csrf-token",openApiUrl:"/openapi.json",editorUrl:"vscode://file{file}:{line}"};function Kt(e){return(Array.isArray(e)?e:e.split(",")).map(t=>t.trim()).filter(Boolean)}function an(e,t){return Kt(t.publicFlag).some(r=>e.flags?.[r]!==void 0)}var oi=new Set(["POST","PUT","PATCH","DELETE"]),ci=new Set(["GET","HEAD","OPTIONS"]),ui=e=>["DELETE","PUT","PATCH"].includes(e.toUpperCase()),Wt=e=>oi.has(e.toUpperCase());function xt(e){const t=[...e.matchAll(/:([A-Za-z_$][\w$]*)/g)].map(r=>r[1]);return[...new Set(t)]}function on(e,t,r,n){const s=t.replace(/:([A-Za-z_$][\w$]*)/g,(a,c)=>r[c]?encodeURIComponent(r[c]):a),i=new URLSearchParams;for(const a of n)a.enabled&&a.key&&i.append(a.key,a.value);const u=i.toString();return`${e}${s}${u?`?${u}`:""}`}function di(e,t){for(const r of e.split(";")){const n=r.indexOf("=");if(!(n<0)&&r.slice(0,n).trim()===t)return decodeURIComponent(r.slice(n+1).trim())}}var cn=/\{\{\s*([\w.-]+)\s*\}\}/g;function hi(e,t){return e.replace(cn,(r,n)=>Object.prototype.hasOwnProperty.call(t,n)?t[n]:r)}function fi(e){const t={};for(const r of e)r.enabled&&r.key&&(t[r.key]=r.value);return t}function kr(e){const t=typeof e.body=="string"?e.body:"",r=(e.form??[]).flatMap(s=>[s.name,s.value??""]),n=[e.url,...Object.entries(e.headers).flat(),t,...r].join(`
|
|
2
|
-
`);return[...new Set([...
|
|
3
|
-
`)}function
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function r(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(l){if(l.ep)return;l.ep=!0;const a=r(l);fetch(l.href,a)}})();var xe={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Fr(this.context.count)},getNextContextId(){return Fr(this.context.count++)}};function Fr(e){const t=String(e),r=t.length-1;return xe.context.id+(r?String.fromCharCode(96+r):"")+t}function dr(e){xe.context=e}function xl(){return{...xe.context,id:xe.getNextContextId(),count:0}}var bl=(e,t)=>e===t,En=Symbol("solid-track"),It={equals:bl},Kr=null,Mn=Rn,Re=1,ft=2,Tn={owned:null,cleanups:null,context:null,owner:null},he=null,F=null,mt=null,Qe=null,ve=null,_e=null,Ee=null,Kt=0;function Xe(e,t){const r=ve,s=he,l=e.length===0,a=t===void 0?s:t,i=l?Tn:{owned:null,cleanups:null,context:a?a.context:null,owner:a},u=l?e:()=>e(()=>Ae(()=>Be(i)));he=i,ve=null;try{return Ue(u,!0)}finally{ve=r,he=s}}function R(e,t){t=t?Object.assign({},It,t):It;const r={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=l=>(typeof l=="function"&&(F&&F.running&&F.sources.has(r)?l=l(r.tValue):l=l(r.value)),Ln(r,l));return[An.bind(r),s]}function N(e,t,r){const s=Tr(e,t,!1,Re);mt&&F&&F.running?_e.push(s):vt(s)}function qe(e,t,r){Mn=Sl;const s=Tr(e,t,!1,Re),l=fr&&wl(fr);l&&(s.suspense=l),(!r||!r.render)&&(s.user=!0),Ee?Ee.push(s):vt(s)}function se(e,t,r){r=r?Object.assign({},It,r):It;const s=Tr(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=r.equals||void 0,mt&&F&&F.running?(s.tState=Re,_e.push(s)):vt(s),An.bind(s)}function Ae(e){if(!Qe&&ve===null)return e();const t=ve;ve=null;try{return Qe?Qe.untrack(e):e()}finally{ve=t}}function $l(e,t,r){const s=Array.isArray(e);let l,a=r&&r.defer;return i=>{let u;if(s){u=Array(e.length);for(let h=0;h<e.length;h++)u[h]=e[h]()}else u=e();if(a)return a=!1,i;const c=Ae(()=>t(u,l,i));return l=u,c}}function Ne(e){qe(()=>Ae(e))}function Se(e){return he===null||(he.cleanups===null?he.cleanups=[e]:he.cleanups.push(e)),e}function yl(e){if(F&&F.running)return e(),F.done;const t=ve,r=he;return Promise.resolve().then(()=>{ve=t,he=r;let s;return(mt||fr)&&(s=F||(F={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),s.done||(s.done=new Promise(l=>s.resolve=l)),s.running=!0),Ue(e,!1),ve=he=null,s?s.done:void 0})}var[qd,Jr]=R(!1);function wl(e){let t;return he&&he.context&&(t=he.context[e.id])!==void 0?t:e.defaultValue}var fr;function An(){const e=F&&F.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===Re)vt(this);else{const t=_e;_e=null,Ue(()=>Dt(this),!1),_e=t}if(ve){const t=this.observers;if(!t||t[t.length-1]!==ve){const r=t?t.length:0;ve.sources?(ve.sources.push(this),ve.sourceSlots.push(r)):(ve.sources=[this],ve.sourceSlots=[r]),t?(t.push(ve),this.observerSlots.push(ve.sources.length-1)):(this.observers=[ve],this.observerSlots=[ve.sources.length-1])}}return e&&F.sources.has(this)?this.tValue:this.value}function Ln(e,t,r){let s=F&&F.running&&F.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(s,t)){if(F){const l=F.running;(l||!r&&F.sources.has(e))&&(F.sources.add(e),e.tValue=t),l||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&Ue(()=>{for(let l=0;l<e.observers.length;l+=1){const a=e.observers[l],i=F&&F.running;i&&F.disposed.has(a)||((i?!a.tState:!a.state)&&(a.pure?_e.push(a):Ee.push(a),a.observers&&On(a)),i?a.tState=Re:a.state=Re)}if(_e.length>1e6)throw _e=[],new Error},!1)}return t}function vt(e){if(!e.fn)return;Be(e);const t=Kt;Vr(e,F&&F.running&&F.sources.has(e)?e.tValue:e.value,t),F&&!F.running&&F.sources.has(e)&&queueMicrotask(()=>{Ue(()=>{F&&(F.running=!0),ve=he=e,Vr(e,e.tValue,t),ve=he=null},!1)})}function Vr(e,t,r){let s;const l=he,a=ve;ve=he=e;try{s=e.fn(t)}catch(i){return e.pure&&(F&&F.running?(e.tState=Re,e.tOwned&&e.tOwned.forEach(Be),e.tOwned=void 0):(e.state=Re,e.owned&&e.owned.forEach(Be),e.owned=null)),e.updatedAt=r+1,Ar(i)}finally{ve=a,he=l}(!e.updatedAt||e.updatedAt<=r)&&(e.updatedAt!=null&&"observers"in e?Ln(e,s,!0):F&&F.running&&e.pure?(F.sources.has(e)||(e.value=s),F.sources.add(e),e.tValue=s):e.value=s,e.updatedAt=r)}function Tr(e,t,r,s=Re,l){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:he,context:he?he.context:null,pure:r};if(F&&F.running&&(a.state=0,a.tState=s),he===null||he!==Tn&&(F&&F.running&&he.pure?he.tOwned?he.tOwned.push(a):he.tOwned=[a]:he.owned?he.owned.push(a):he.owned=[a]),Qe&&a.fn){const i=a.fn,[u,c]=R(void 0,{equals:!1}),h=Qe.factory(i,c);Se(()=>h.dispose());let f,p=!1;const v=()=>yl(c).then(()=>{f&&(f.dispose(),f=void 0,p||c())});a.fn=x=>(u(),F&&F.running?(f||(f=Qe.factory(i,v)),f.track(x)):(p=!0,h.track(x)))}return a}function ht(e){const t=F&&F.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===ft)return Dt(e);if(e.suspense&&Ae(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Kt);){if(t&&F.disposed.has(e))return;(t?e.tState:e.state)&&r.push(e)}for(let s=r.length-1;s>=0;s--){if(e=r[s],t){let l=e,a=r[s+1];for(;(l=l.owner)&&l!==a;)if(F.disposed.has(l))return}if((t?e.tState:e.state)===Re)vt(e);else if((t?e.tState:e.state)===ft){const l=_e;_e=null,Ue(()=>Dt(e,r[0]),!1),_e=l}}}function Ue(e,t){if(_e)return e();let r=!1;t||(_e=[]),Ee?r=!0:Ee=[],Kt++;try{const s=e();return _l(r),s}catch(s){r||(Ee=null),_e=null,Ar(s)}}function _l(e){if(_e&&(mt&&F&&F.running?kl(_e):Rn(_e),_e=null),e)return;let t;if(F){if(!F.promises.size&&!F.queue.size){const s=F.sources,l=F.disposed;Ee.push.apply(Ee,F.effects),t=F.resolve;for(const a of Ee)"tState"in a&&(a.state=a.tState),delete a.tState;F=null,Ue(()=>{for(const a of l)Be(a);for(const a of s){if(a.value=a.tValue,a.owned)for(let i=0,u=a.owned.length;i<u;i++)Be(a.owned[i]);a.tOwned&&(a.owned=a.tOwned),delete a.tValue,delete a.tOwned,a.tState=0}Jr(!1)},!1)}else if(F.running){F.running=!1,F.effects.push.apply(F.effects,Ee),Ee=null,Jr(!0);return}}const r=Ee;Ee=null,r.length&&Ue(()=>Mn(r),!1),t&&t()}function Rn(e){for(let t=0;t<e.length;t++)ht(e[t])}function kl(e){for(let t=0;t<e.length;t++){const r=e[t],s=F.queue;s.has(r)||(s.add(r),mt(()=>{s.delete(r),Ue(()=>{F.running=!0,ht(r)},!1),F&&(F.running=!1)}))}}function Sl(e){let t,r=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[r++]=s:ht(s)}if(xe.context){if(xe.count){xe.effects||(xe.effects=[]),xe.effects.push(...e.slice(0,r));return}dr()}for(xe.effects&&(xe.done||!xe.count)&&(e=[...xe.effects,...e],r+=xe.effects.length,delete xe.effects),t=0;t<r;t++)ht(e[t])}function Dt(e,t){const r=F&&F.running;r?e.tState=0:e.state=0;for(let s=0;s<e.sources.length;s+=1){const l=e.sources[s];if(l.sources){const a=r?l.tState:l.state;a===Re?l!==t&&(!l.updatedAt||l.updatedAt<Kt)&&ht(l):a===ft&&Dt(l,t)}}}function On(e){const t=F&&F.running;for(let r=0;r<e.observers.length;r+=1){const s=e.observers[r];(t?!s.tState:!s.state)&&(t?s.tState=ft:s.state=ft,s.pure?_e.push(s):Ee.push(s),s.observers&&On(s))}}function Be(e){let t;if(e.sources)for(;e.sources.length;){const r=e.sources.pop(),s=e.sourceSlots.pop(),l=r.observers;if(l&&l.length){const a=l.pop(),i=r.observerSlots.pop();s<l.length&&(a.sourceSlots[i]=s,l[s]=a,r.observerSlots[s]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Be(e.tOwned[t]);delete e.tOwned}if(F&&F.running&&e.pure)qn(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Be(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}F&&F.running?e.tState=0:e.state=0}function qn(e,t){if(t||(e.tState=0,F.disposed.add(e)),e.owned)for(let r=0;r<e.owned.length;r++)qn(e.owned[r])}function Cl(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Gr(e,t,r){try{for(const s of t)s(e)}catch(s){Ar(s,r&&r.owner||null)}}function Ar(e,t=he){const r=Kr&&t&&t.context&&t.context[Kr],s=Cl(e);if(!r)throw s;Ee?Ee.push({fn(){Gr(s,r,t)},state:Re}):Gr(s,r,t)}var hr=Symbol("fallback");function Ut(e){for(let t=0;t<e.length;t++)e[t]()}function El(e,t,r={}){let s=[],l=[],a=[],i=0,u=t.length>1?[]:null;return Se(()=>Ut(a)),()=>{let c=e()||[],h=c.length,f,p;return c[En],Ae(()=>{let x,w,M,y,m,S,b,g,$;if(h===0)i!==0&&(Ut(a),a=[],s=[],l=[],i=0,u&&(u=[])),r.fallback&&(s=[hr],l[0]=Xe(C=>(a[0]=C,r.fallback())),i=1);else if(i===0){for(l=new Array(h),p=0;p<h;p++)s[p]=c[p],l[p]=Xe(v);i=h}else{for(M=new Array(h),y=new Array(h),u&&(m=new Array(h)),S=0,b=Math.min(i,h);S<b&&s[S]===c[S];S++);for(b=i-1,g=h-1;b>=S&&g>=S&&s[b]===c[g];b--,g--)M[g]=l[b],y[g]=a[b],u&&(m[g]=u[b]);for(x=new Map,w=new Array(g+1),p=g;p>=S;p--)$=c[p],f=x.get($),w[p]=f===void 0?-1:f,x.set($,p);for(f=S;f<=b;f++)$=s[f],p=x.get($),p!==void 0&&p!==-1?(M[p]=l[f],y[p]=a[f],u&&(m[p]=u[f]),p=w[p],x.set($,p)):a[f]();for(p=S;p<h;p++)p in M?(l[p]=M[p],a[p]=y[p],u&&(u[p]=m[p],u[p](p))):l[p]=Xe(v);l=l.slice(0,i=h),s=c.slice(0)}return l});function v(x){if(a[p]=x,u){const[w,M]=R(p);return u[p]=M,t(c[p],w)}return t(c[p])}}}function Ml(e,t,r={}){let s=[],l=[],a=[],i=[],u=0,c;return Se(()=>Ut(a)),()=>{const h=e()||[],f=h.length;return h[En],Ae(()=>{if(f===0)return u!==0&&(Ut(a),a=[],s=[],l=[],u=0,i=[]),r.fallback&&(s=[hr],l[0]=Xe(v=>(a[0]=v,r.fallback())),u=1),l;for(s[0]===hr&&(a[0](),a=[],s=[],l=[],u=0),c=0;c<f;c++)c<s.length&&s[c]!==h[c]?i[c](()=>h[c]):c>=s.length&&(l[c]=Xe(p));for(;c<s.length;c++)a[c]();return u=i.length=a.length=f,s=h.slice(0),l=l.slice(0,u)});function p(v){a[c]=v;const[x,w]=R(h[c]);return i[c]=w,t(x,c)}}}var Tl=!1;function o(e,t){if(Tl&&xe.context){const r=xe.context;dr(xl());const s=Ae(()=>e(t||{}));return dr(r),s}return Ae(()=>e(t||{}))}var Al=e=>`Stale read from <${e}>.`;function te(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se(El(()=>e.each,e.children,t||void 0))}function Nn(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se(Ml(()=>e.each,e.children,t||void 0))}function _(e){const t=e.keyed,r=se(()=>e.when,void 0,void 0),s=t?r:se(r,void 0,{equals:(l,a)=>!l==!a});return se(()=>{const l=s();if(l){const a=e.children;return typeof a=="function"&&a.length>0?Ae(()=>a(t?l:()=>{if(!Ae(s))throw Al("Show");return r()})):a}return e.fallback},void 0,void 0)}var le=e=>se(()=>e());function Ll(e,t,r){let s=r.length,l=t.length,a=s,i=0,u=0,c=t[l-1].nextSibling,h=null;for(;i<l||u<a;){if(t[i]===r[u]){i++,u++;continue}for(;t[l-1]===r[a-1];)l--,a--;if(l===i){const f=a<s?u?r[u-1].nextSibling:r[a-u]:c;for(;u<a;)e.insertBefore(r[u++],f)}else if(a===u)for(;i<l;)(!h||!h.has(t[i]))&&t[i].remove(),i++;else if(t[i]===r[a-1]&&r[u]===t[l-1]){const f=t[--l].nextSibling;e.insertBefore(r[u++],t[i++].nextSibling),e.insertBefore(r[--a],f),t[l]=r[a]}else{if(!h){h=new Map;let p=u;for(;p<a;)h.set(r[p],p++)}const f=h.get(t[i]);if(f!=null)if(u<f&&f<a){let p=i,v=1,x;for(;++p<l&&p<a&&!((x=h.get(t[p]))==null||x!==f+v);)v++;if(v>f-u){const w=t[i];for(;u<f;)e.insertBefore(r[u++],w)}else e.replaceChild(r[u++],t[i++])}else i++;else t[i++].remove()}}}var Yr="_$DX_DELEGATE";function Rl(e,t,r,s={}){let l;return Xe(a=>{l=a,t===document?e():n(t,e(),t.firstChild?null:void 0,r)},s.owner),()=>{l(),t.textContent=""}}function d(e,t,r,s){let l;const a=()=>{const u=s?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return u.innerHTML=e,r?u.content.firstChild.firstChild:s?u.firstChild:u.content.firstChild},i=t?()=>Ae(()=>document.importNode(l||(l=a()),!0)):()=>(l||(l=a())).cloneNode(!0);return i.cloneNode=i,i}function ye(e,t=window.document){const r=t[Yr]||(t[Yr]=new Set);for(let s=0,l=e.length;s<l;s++){const a=e[s];r.has(a)||(r.add(a),t.addEventListener(a,Ol))}}function X(e,t,r){Rr(e)||(r==null?e.removeAttribute(t):e.setAttribute(t,r))}function j(e,t){Rr(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Lr(e,t,r,s){if(s)Array.isArray(r)?(e[`$$${t}`]=r[0],e[`$$${t}Data`]=r[1]):e[`$$${t}`]=r;else if(Array.isArray(r)){const l=r[0];e.addEventListener(t,r[0]=a=>l.call(e,r[1],a))}else e.addEventListener(t,r,typeof r!="function"&&r)}function Pn(e,t,r){if(!t)return r?X(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof r=="string"&&(s.cssText=r=void 0),r||(r={}),t||(t={});let l,a;for(a in r)t[a]??s.removeProperty(a),delete r[a];for(a in t)l=t[a],l!==r[a]&&(s.setProperty(a,l),r[a]=l);return r}function Ie(e,t,r){r!=null?e.style.setProperty(t,r):e.style.removeProperty(t)}function tt(e,t,r){return Ae(()=>e(t,r))}function n(e,t,r,s){if(r!==void 0&&!s&&(s=[]),typeof t!="function")return jt(e,t,s,r);N(l=>jt(e,t(),l,r),s)}function Rr(e){return!!xe.context&&!xe.done&&(!e||e.isConnected)}function Ol(e){if(xe.registry&&xe.events&&xe.events.find(([c,h])=>h===e))return;let t=e.target;const r=`$$${e.type}`,s=e.target,l=e.currentTarget,a=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),i=()=>{const c=t[r];if(c&&!t.disabled){const h=t[`${r}Data`];if(h!==void 0?c.call(t,h,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},u=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),xe.registry&&!xe.done&&(xe.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();a(c[0]);for(let h=0;h<c.length-2&&(t=c[h],!!i());h++){if(t._$host){t=t._$host,u();break}if(t.parentNode===l)break}}else u();a(s)}function jt(e,t,r,s,l){const a=Rr(e);if(a){!r&&(r=[...e.childNodes]);let c=[];for(let h=0;h<r.length;h++){const f=r[h];f.nodeType===8&&f.data.slice(0,2)==="!$"?f.remove():c.push(f)}r=c}for(;typeof r=="function";)r=r();if(t===r)return r;const i=typeof t,u=s!==void 0;if(e=u&&r[0]&&r[0].parentNode||e,i==="string"||i==="number"){if(a||i==="number"&&(t=t.toString(),t===r))return r;if(u){let c=r[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),r=Ye(e,r,s,c)}else r!==""&&typeof r=="string"?r=e.firstChild.data=t:r=e.textContent=t}else if(t==null||i==="boolean"){if(a)return r;r=Ye(e,r,s)}else{if(i==="function")return N(()=>{let c=t();for(;typeof c=="function";)c=c();r=jt(e,c,r,s)}),()=>r;if(Array.isArray(t)){const c=[],h=r&&Array.isArray(r);if(gr(c,t,r,l))return N(()=>r=jt(e,c,r,s,!0)),()=>r;if(a){if(!c.length)return r;if(s===void 0)return r=[...e.childNodes];let f=c[0];if(f.parentNode!==e)return r;const p=[f];for(;(f=f.nextSibling)!==s;)p.push(f);return r=p}if(c.length===0){if(r=Ye(e,r,s),u)return r}else h?r.length===0?Wr(e,c,s):Ll(e,r,c):(r&&Ye(e),Wr(e,c));r=c}else if(t.nodeType){if(a&&t.parentNode)return r=u?[t]:t;if(Array.isArray(r)){if(u)return r=Ye(e,r,s,t);Ye(e,r,null,t)}else r==null||r===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);r=t}}return r}function gr(e,t,r,s){let l=!1;for(let a=0,i=t.length;a<i;a++){let u=t[a],c=r&&r[e.length],h;if(!(u==null||u===!0||u===!1))if((h=typeof u)=="object"&&u.nodeType)e.push(u);else if(Array.isArray(u))l=gr(e,u,c)||l;else if(h==="function")if(s){for(;typeof u=="function";)u=u();l=gr(e,Array.isArray(u)?u:[u],Array.isArray(c)?c:[c])||l}else e.push(u),l=!0;else{const f=String(u);c&&c.nodeType===3&&c.data===f?e.push(c):e.push(document.createTextNode(f))}}return l}function Wr(e,t,r=null){for(let s=0,l=t.length;s<l;s++)e.insertBefore(t[s],r)}function Ye(e,t,r,s){if(r===void 0)return e.textContent="";const l=s||document.createTextNode("");if(t.length){let a=!1;for(let i=t.length-1;i>=0;i--){const u=t[i];if(l!==u){const c=u.parentNode===e;!a&&!i?c?e.replaceChild(l,u):e.insertBefore(l,r):c&&u.remove()}else a=!0}}else e.insertBefore(l,r);return[l]}var In="kickjs-devtools-theme";function ql(){try{const e=localStorage.getItem(In);if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Nl(){return typeof window>"u"||!window.matchMedia?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}var[Dn,Pl]=R(ql()),[Il,Dl]=R(Nl());if(typeof window<"u"&&window.matchMedia){const e=window.matchMedia("(prefers-color-scheme: light)"),t=r=>Dl(r.matches?"light":"dark");e.addEventListener("change",t)}var Yt=Dn;function Or(){const e=Dn();return e==="system"?Il():e}function Un(e){Pl(e);try{localStorage.setItem(In,e)}catch{}}function Ul(){qe(()=>{const e=Or();document.documentElement.dataset.theme=e}),Se(()=>{delete document.documentElement.dataset.theme})}var jn="kickjs-devtools-density";function jl(){try{const e=localStorage.getItem(jn);if(e==="sm"||e==="md"||e==="lg")return e}catch{}return"sm"}var[Hn,Hl]=R(jl()),Qr=Hn;function Bn(e){Hl(e);try{localStorage.setItem(jn,e)}catch{}}function Bl(){qe(()=>{document.documentElement.dataset.density=Hn()}),Se(()=>{delete document.documentElement.dataset.density})}var[zl,Fl]=R("connecting"),[Kl,Xr]=R(null),[Jl,Vl]=R(!1),[Gl,Yl]=R(null),[Wl,Ql]=R(null),[Xl,Zl]=R(null),[es,ts]=R([]),[rs,ns]=R([]),[ls,ss]=R({enabled:!1,queues:[]}),[as,os]=R({enabled:!1}),ae={connectionStatus:zl,lastUpdate:Kl,authRequired:Jl,authError:Gl,health:Wl,metrics:Xl,routes:es,container:rs,queues:ls,ws:as},pe={setConnectionStatus:Fl,setLastUpdate:Xr,setAuthRequired:Vl,setAuthError:Yl,setHealth:Ql,setMetrics:Zl,setRoutes:ts,setContainer:ns,setQueues:ss,setWs:os,touch(){Xr(new Date)}};function Ke(){return document.body.dataset.base??"/_debug"}var qr="kickjs_devtools_token",is=30,Ot=null;function pt(){if(Ot)return Ot;const e=new URLSearchParams(location.search).get("token");if(e){mr(e);const r=new URL(location.href);return r.searchParams.delete("token"),history.replaceState({},"",r.toString()),e}const t=document.cookie.match(new RegExp(`${qr}=([^;]+)`));return t?(mr(decodeURIComponent(t[1])),Ot):null}function mr(e){Ot=e,document.cookie=`${qr}=${encodeURIComponent(e)}; path=${Ke()}; max-age=${86400*is}; SameSite=Lax`,cs()}function cs(){Ke()!=="/"&&(document.cookie=`${qr}=; path=/; max-age=0; SameSite=Lax`)}function Nr(e){const t=pt();return t?`${e}${e.includes("?")?"&":"?"}token=${encodeURIComponent(t)}`:e}var Pr=class extends Error{constructor(){super("AUTH_REQUIRED"),this.name="AuthRequiredError"}};async function Te(e){const t=Nr(`${Ke()}${e}`),r=await fetch(t,{headers:zn()});if(r.status===401||r.status===403)throw new Pr;if(!r.ok)throw new Error(`GET ${e} failed: ${r.status} ${r.statusText}`);return await r.json()}async function Ir(e){const t=await fetch(Nr(`${Ke()}${e}`),{method:"POST",headers:zn()});if(t.status===401||t.status===403)throw new Pr;if(!t.ok){const r=await t.json().catch(()=>null);throw new Error(r?.error??`${t.status} ${t.statusText}`)}return t}function zn(){const e=pt();return e?{"x-devtools-token":e}:{}}var Wt=e=>new URLSearchParams(Object.entries(e).flatMap(([t,r])=>r===void 0?[]:[[t,String(r)]])).toString(),we={jobs:()=>Te("/jobs"),jobList:e=>Te(`/jobs/list?${Wt(e)}`),job:e=>Te(`/jobs/job?${Wt(e)}`),jobAction:async e=>await(await Ir(`/jobs/action?${Wt(e)}`)).json(),requests:(e=0)=>Te(`/requests?since=${e}`),runtime:()=>Te("/runtime"),topology:()=>Te("/topology"),metrics:()=>Te("/metrics"),source:(e,t)=>Te(`/source?${new URLSearchParams({controller:e,handler:t})}`),routeRegistry:()=>Te("/routes"),container:()=>Te("/container"),health:()=>Te("/health"),queues:()=>Te("/queues"),ws:()=>Te("/ws"),tabs:()=>Te("/tabs")};function Fn(e,t,r){const s=Nr(`${Ke()}${e}`),l=new EventSource(s);return l.addEventListener("message",a=>{try{t(JSON.parse(a.data))}catch(i){console.warn("SSE parse failed",i)}}),r&&l.addEventListener("error",r),()=>l.close()}var[Zr,us]=R([]),[ds,fs]=R([]);function hs(){const e=setInterval(()=>{const t=ae.metrics();t&&(us(r=>[...r,t.requests].slice(-61)),fs(r=>[...r,t.serverErrors].slice(-61)))},1e3);return()=>clearInterval(e)}function Qt(e){const t=[];for(let r=1;r<e.length;r++)t.push(Math.max(0,e[r]-e[r-1]));return t}function vr(e,t){if(e.length===0)return;const r=e.toSorted((s,l)=>s-l);return r[Math.min(r.length-1,Math.max(0,Math.ceil(t/100*r.length)-1))]}var gs=d("<svg class=sparkline preserveAspectRatio=none aria-hidden=true><path fill=none stroke-width=1.5 stroke-linejoin=round stroke-linecap=round>"),ms=e=>{const t=()=>e.width??200,s=se(()=>{const l=e.values;if(l.length<2)return"";const a=Math.min(...l),i=Math.max(...l)-a||1,u=t()/(l.length-1),c=f=>40-(f-a)/i*36-2;let h=`M0 ${c(l[0]).toFixed(2)}`;for(let f=1;f<l.length;f++)h+=` L${(f*u).toFixed(2)} ${c(l[f]).toFixed(2)}`;return h});return(()=>{var l=gs(),a=l.firstChild;return N(i=>{var u=`0 0 ${t()} 40`,c=s(),h=e.stroke??"var(--color-accent)";return u!==i.e&&X(l,"viewBox",i.e=u),c!==i.t&&X(a,"d",i.t=c),h!==i.a&&X(a,"stroke",i.a=h),i},{e:void 0,t:void 0,a:void 0}),l})()};function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`}function $e(e){return e<1?`${e.toFixed(2)} ms`:e<100?`${e.toFixed(1)} ms`:`${Math.round(e)} ms`}function pr(e){const t=Math.floor(e);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m ${t%60}s`}function Ht(e){return`${Math.round(e*100)}%`}function He(e){const t=e.toUpperCase();return t==="GET"?"text-emerald-400":t==="POST"?"text-cyan-400":t==="PUT"||t==="PATCH"?"text-amber-400":t==="DELETE"?"text-red-400":"text-text-secondary"}function gt(e){return`dt-pill dt-pill-${e>=500?"err":e>=400?"warn":e>=300?"redir":"ok"}`}function Dr(e){return`dt-tone dt-tone-${e==="controller"?"violet":e==="service"?"blue":e==="repository"?"teal":"gray"}`}function et(e){return`dt-tone dt-tone-${{ok:"green",warn:"amber",err:"red",idle:"gray"}[e]}`}function ut(e,t=1){const r=e*t;return r>1e3?"text-red-500":r>500?"text-orange-500":r>200?"text-amber-500":""}function Ur(e,t=Date.now()){const r=Math.max(0,Math.round((t-e)/1e3));return r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function Xt(e){let t=0;for(const r of e)t=r.charCodeAt(0)+((t<<5)-t);return`hsl(${Math.abs(t)%12*30} 60% 50%)`}var vs=d('<span class=dt-tip tabindex=0><svg class=dt-tip-icon viewBox="0 0 24 24"aria-hidden=true><circle cx=12 cy=12 r=9 fill=none stroke=currentColor stroke-width=1.5></circle><path d="M12 8h.01M12 11v6"stroke=currentColor stroke-width=2 stroke-linecap=round fill=none></path></svg><span role=tooltip>'),ps={"heap.used":{short:"V8-allocated memory currently used by JavaScript objects.",detail:"Grows as your code allocates objects, shrinks after GC frees them. A consistently rising heap-used line on the sparkline is the textbook leak signature."},"heap.total":{short:"V8-allocated memory the JS heap is currently sized to use.",detail:"Larger than heap-used; V8 reserves headroom so allocations don't pause to grow the heap. Bumps up in 1-8 MiB jumps as the heap expands."},rss:{short:"Total memory resident in physical RAM for this Node process.",detail:'Includes the JS heap, native buffers, V8 internal structures, and code. Always larger than heap-used; the gap is "everything the OS sees" minus "JS objects".'},external:{short:"Memory used by C++ objects bound to JS (Buffers, native bindings)."},"array-buffers":{short:"Memory used by ArrayBuffer / SharedArrayBuffer instances."},"event-loop.p99":{short:"99% of event-loop ticks completed within this time.",detail:"Sustained values above ~50ms mean some synchronous operation is blocking the loop. Common culprits: large JSON.parse, sync crypto, blocking DB drivers."},gc:{short:"Garbage-collector activity since process start.",detail:"Total run count and cumulative pause time. Frequent GC with low reclaim ratio = leak; rare GC with healthy reclaim = good citizen."},"leak.risk":{short:"Heap-growth slope over the recent window — stable / warn / critical.",detail:"Bucketed from heap-growth in MB/min: <5 = ok, <20 = warn, ≥20 = critical. Critical sustained for >5 minutes is the moment to capture a heap snapshot."},"gc.reclaim":{short:"Average ratio of memory freed by each GC pass.",detail:"Trending toward zero means GC can't free anything — strong leak indicator. Healthy apps reclaim 20-60% on each major GC."},"heap.utilization":{short:"Fraction of V8's hard heap-size limit currently in use.",detail:"Approaching 1 means the process is close to OOM. Use --max-old-space-size to raise the limit if your workload is memory-bound."},requests:{short:"Total HTTP requests handled since process start."},"server-errors":{short:"5xx responses — server-side failures."},"client-errors":{short:"4xx responses — bad client input, missing routes, auth denials."},"error-rate":{short:"Server errors as a percentage of total requests.",detail:"Computed across the lifetime of the process. Spikes typically signal upstream dependency failures; sustained elevation = code bug."},uptime:{short:"How long this Node process has been running."},"latency.avg":{short:"Mean response time per route (sum of all calls / call count)."},"latency.p50":{short:"Median — half the requests complete faster than this."},"latency.p95":{short:"95% of requests complete within this time."},"latency.p99":{short:"99% of requests complete within this time. Outlier-sensitive."},"latency.max":{short:"Slowest single response observed since process start."},"resolve.count":{short:"Number of times this token was resolved from the DI container."},"resolve.duration":{short:"How long the container took to resolve this token (ms)."},"post-construct":{short:"@PostConstruct lifecycle status: done / failed / none.",detail:'A failed PostConstruct means the service registered but its async init threw. The token is left in a "registered" state; resolve() will throw the original error.'}},Pe=e=>{const t=()=>e.text??ps[e.metric??""]?.short??"",r=e.placement??"top";return(()=>{var s=vs(),l=s.firstChild.nextSibling;return j(l,`dt-tip-pop dt-tip-pop-${r}`),n(l,t),N(()=>X(s,"aria-label",t())),s})()};ye(["click"]);var Kn="kickjs-devtools-tab",xs={memory:"runtime"};function bs(){try{const e=localStorage.getItem(Kn)??"overview";return xs[e]??e}catch{return"overview"}}var[$s,ys]=R(bs());function rt(e){ys(e);try{localStorage.setItem(Kn,e)}catch{}}var ws={publicFlag:"auth.public",csrfCookie:"_csrf",csrfHeader:"x-csrf-token",openApiUrl:"/openapi.json",editorUrl:"vscode://file{file}:{line}"};function xr(e){return(Array.isArray(e)?e:e.split(",")).map(t=>t.trim()).filter(Boolean)}function Jn(e,t){return xr(t.publicFlag).some(r=>e.flags?.[r]!==void 0)}var _s=new Set(["POST","PUT","PATCH","DELETE"]),ks=new Set(["GET","HEAD","OPTIONS"]),Ss=e=>["DELETE","PUT","PATCH"].includes(e.toUpperCase()),br=e=>_s.has(e.toUpperCase());function qt(e){const t=[...e.matchAll(/:([A-Za-z_$][\w$]*)/g)].map(r=>r[1]);return[...new Set(t)]}function Cs(e,t){const r=[],s=e.split(/(:[A-Za-z_$][\w$]*)/).map(i=>i.startsWith(":")?(r.push(i.slice(1)),"([^/]+)"):i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(""),l=new RegExp(`^${s}/?$`).exec(t);if(!l)return{};const a=i=>{try{return decodeURIComponent(i)}catch{return i}};return Object.fromEntries(r.map((i,u)=>[i,a(l[u+1])]))}function Vn(e,t,r,s){const l=t.replace(/:([A-Za-z_$][\w$]*)/g,(u,c)=>r[c]?encodeURIComponent(r[c]):u),a=new URLSearchParams;for(const u of s)u.enabled&&u.key&&a.append(u.key,u.value);const i=a.toString();return`${e}${l}${i?`?${i}`:""}`}function Es(e,t){for(const r of e.split(";")){const s=r.indexOf("=");if(!(s<0)&&r.slice(0,s).trim()===t)return decodeURIComponent(r.slice(s+1).trim())}}var Gn=/\{\{\s*([\w.-]+)\s*\}\}/g;function Ms(e,t){return e.replace(Gn,(r,s)=>Object.prototype.hasOwnProperty.call(t,s)?t[s]:r)}function Ts(e){const t={};for(const r of e)r.enabled&&r.key&&(t[r.key]=r.value);return t}function en(e){const t=typeof e.body=="string"?e.body:"",r=(e.form??[]).flatMap(l=>[l.name,l.value??""]),s=[e.url,...Object.entries(e.headers).flat(),t,...r].join(`
|
|
2
|
+
`);return[...new Set([...s.matchAll(Gn)].map(l=>l[1]))]}function As(e,t){const r=t.match(/[^.[\]]+/g)??[];let s=e;for(const l of r){if(s===null||typeof s!="object")return;s=s[l]}if(s!==void 0)return typeof s=="string"?s:JSON.stringify(s)}function Ls(e){const{route:t,settings:r,origin:s,cookies:l}=e,a=e.variables??{},i=m=>Ms(m,a),u=m=>m.map(S=>({...S,key:i(S.key),value:i(S.value)})),c={params:Object.fromEntries(Object.entries(e.inputs.params).map(([m,S])=>[m,i(S)])),query:u(e.inputs.query),headers:u(e.inputs.headers),body:i(e.inputs.body),bodyMode:e.inputs.bodyMode,form:(e.inputs.form??[]).map(m=>({...m,key:i(m.key),value:i(m.value)}))},h=u(e.defaults),f=t.method.toUpperCase(),p=Jn(t,r),v={},x=(m,S)=>{for(const b of m)if(!(!b.enabled||!b.key)&&!(S&&b.key.toLowerCase()==="authorization")){for(const g of Object.keys(v))g.toLowerCase()===b.key.toLowerCase()&&delete v[g];v[b.key]=b.value}};x(h,p),x(c.headers,!1);const w=m=>Object.keys(v).some(S=>S.toLowerCase()===m);if(!ks.has(f)&&!w(r.csrfHeader.toLowerCase())){const m=Es(l,r.csrfCookie);m&&(v[r.csrfHeader]=m)}const M=Vn(s,t.path,c.params,c.query);if(br(f)&&c.bodyMode==="form"){const{body:m,form:S}=Rs(c.form??[]);for(const b of Object.keys(v))b.toLowerCase()==="content-type"&&delete v[b];return{method:f,url:M,headers:v,body:m,form:S}}const y=br(f)&&c.body.trim()?c.body:void 0;return y!==void 0&&!w("content-type")&&/^\s*[[{]/.test(y)&&(v["Content-Type"]="application/json"),{method:f,url:M,headers:v,...y!==void 0?{body:y}:{}}}function Rs(e){const t=new FormData,r=[];for(const s of e)if(!(!s.enabled||!s.key))if(s.type==="file")for(const l of s.files??[])t.append(s.key,l,l.name),r.push({name:s.key,fileName:l.name});else t.append(s.key,s.value),r.push({name:s.key,value:s.value});return{body:t,form:r}}var _t=e=>`'${e.replace(/'/g,"'\\''")}'`;function Os(e){const t=[`curl -X ${e.method} ${_t(e.url)}`];for(const[r,s]of Object.entries(e.headers))t.push(`-H ${_t(`${r}: ${s}`)}`);if(e.form)for(const r of e.form)t.push(`-F ${_t(r.fileName!==void 0?`${r.name}=@${r.fileName}`:`${r.name}=${r.value??""}`)}`);else typeof e.body=="string"&&t.push(`--data-raw ${_t(e.body)}`);return t.join(` \\
|
|
3
|
+
`)}function qs(e){const t={method:e.method};if(Object.keys(e.headers).length&&(t.headers=e.headers),e.form){const r=["const form = new FormData()"];for(const l of e.form)r.push(l.fileName!==void 0?`form.append(${JSON.stringify(l.name)}, fileInput.files[0]) // ${l.fileName}`:`form.append(${JSON.stringify(l.name)}, ${JSON.stringify(l.value??"")})`);const s=JSON.stringify(t,null,2).replace(/\n}$/,`,
|
|
4
4
|
"body": form
|
|
5
5
|
}`);return`${r.join(`
|
|
6
6
|
`)}
|
|
7
7
|
|
|
8
|
-
await fetch(${JSON.stringify(e.url)}, ${n})`}return typeof e.body=="string"&&(t.body=e.body),`await fetch(${JSON.stringify(e.url)}, ${JSON.stringify(t,null,2)})`}function xi(e,t){if(!t?.includes("json"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}var jt=e=>`kickjs-devtools:runner:${e.method.toUpperCase()} ${e.path}`,$i=e=>{const t=e.upload&&e.upload.mode!=="none"?e.upload:void 0;return{params:Object.fromEntries(xt(e.path).map(r=>[r,""])),query:[],headers:[],body:"",bodyMode:t?"form":"raw",form:t?[{key:t.fieldName??"file",value:"",enabled:!0,type:"file"}]:[]}};function un(e){return{...e,form:e.form?.map(({files:t,...r})=>r)}}function yi(e,t,r=30){return[{...t,inputs:un(t.inputs)},...e].slice(0,r)}var _i=e=>on("",e.path,e.inputs.params,e.inputs.query);function wi(e,t){for(const[r,n]of Object.entries(e?.paths??{}))if(r.replace(/\{([^}]+)\}/g,":$1")===t.path)return n?.[t.method.toLowerCase()]}function dn(e,t){const r=t?.$ref;if(typeof r!="string"||!r.startsWith("#/"))return t;let n=e;for(const s of r.slice(2).split("/"))n=n?.[s];return n}function Qe(e,t,r=0){const n=dn(e,t);if(!n||r>6)return null;if(n.example!==void 0)return n.example;if(n.default!==void 0)return n.default;if(Array.isArray(n.enum)&&n.enum.length)return n.enum[0];const s=n.oneOf?.[0]??n.anyOf?.[0];if(s)return Qe(e,s,r+1);if(n.allOf)return Object.assign({},...n.allOf.map(i=>Qe(e,i,r+1)));switch((Array.isArray(n.type)?n.type.find(i=>i!=="null"):n.type)??(n.properties?"object":void 0)){case"object":return Object.fromEntries(Object.entries(n.properties??{}).map(([i,u])=>[i,Qe(e,u,r+1)]));case"array":return n.items?[Qe(e,n.items,r+1)]:[];case"string":return"";case"integer":case"number":return 0;case"boolean":return!1;default:return null}}function Si(e,t){const r=wi(e,t);if(!r)return;const n={},s=[];for(const u of r.parameters??[]){const a=dn(e,u);a?.name&&(a.in==="path"&&a.description&&(n[a.name]=a.description),a.in==="query"&&s.push({name:a.name,required:!!a.required,description:a.description}))}const i=r.requestBody?.content?.["application/json"]?.schema;return{summary:r.summary??r.description,params:n,query:s,...i?{body:JSON.stringify(Qe(e,i),null,2)}:{}}}function Cr(e,t){const r=new Set(e.query.map(i=>i.key)),n=[...e.query,...t.query.filter(i=>!r.has(i.name)).map(i=>({key:i.name,value:"",enabled:i.required}))],s=e.body.trim()||!t.body?e.body:t.body;return{...e,query:n,body:s}}function ki(e,t,r){const n=t.replace(/\\/g,"/").replace(/^(?=[A-Za-z]:)/,"/");return e.replace("{file}",encodeURI(n)).replace("{line}",String(r))}var Ci=g('<p class="text-sm text-text-secondary mt-1">'),Ti=g('<p class="text-xs text-amber-400 mt-2">No value for <!> — add it under Environment → Variables.'),Ei=g('<label class="flex items-start gap-2 text-sm mb-3"><input type=checkbox class=mt-1><span>Remember on this browser<span class="block text-xs text-text-muted">'),Ai=g('<h3 class="text-xs font-semibold text-text-secondary mb-1">Default headers'),Mi=g('<p class="text-xs text-text-muted mb-2">Sent with every route. A default Authorization is skipped on routes carrying a public flag.'),Li=g('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Variables'),Ri=g('<p class="text-xs text-text-muted mb-2">Use <code>{{name}}</code> in any param, query, header or body value — e.g. a default header <code>Authorization: Bearer {{token}}</code>. Fill them by hand or with "Save to variable" on a response.'),Oi=g('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Settings'),ji=g('<div class="grid grid-cols-1 sm:grid-cols-2 gap-3"><label class="flex flex-col gap-1 text-xs text-text-muted">Public route flags (comma-separated)<input>'),Ni=g('<span class="text-xs text-text-muted"role=status>'),Ii=g('<div class="flex items-center gap-1 mb-2"><button type=button>Copy'),Pi=g('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all select-text">'),Bi=g('<div class="text-sm text-red-400 bg-red-500/10 border border-red-500/30 rounded-lg p-3">Request failed: '),qi=g('<ul class="flex flex-col gap-1">'),Di=g("<button type=button>Clear history"),Ui=g('<div class="fixed inset-0 z-50 bg-black/50"><aside role=dialog aria-modal=true class="absolute right-0 top-0 h-full w-full max-w-2xl bg-surface-1 border-l border-border-strong shadow-2xl flex flex-col"><header class="px-5 py-4 border-b border-border"><div class="flex items-start justify-between gap-4"><div class=min-w-0><div class="flex items-center gap-2"><span></span><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><p class="text-xs text-text-muted mt-1"><button type=button class="underline decoration-dotted hover:text-kick-500"title="Open in editor">.</button></p></div><button type=button class="text-text-muted hover:text-text-strong p-1 text-lg leading-none"aria-label=Close>✕</button></div><div class="font-mono text-xs bg-surface-2 border border-border rounded-lg px-3 py-2 mt-3 break-all text-text-secondary"></div></header><div class="flex-1 overflow-y-auto px-5 py-3 flex flex-col gap-2"></div><footer class="px-5 py-3 border-t border-border flex flex-wrap items-center gap-2"><button type=button>'),ar=g('<div class="flex flex-col gap-2">'),Fi=g('<ul class="text-xs text-text-muted mt-2 flex flex-col gap-0.5">'),Hi=g('<span class="text-xs text-text-muted ml-2">@FileUpload: field <code>'),zi=g('<div class="flex items-center gap-1 mb-2">'),Vi=g(`<p class="text-xs text-text-muted mt-2">Sent as multipart/form-data. Picked files aren't saved — pick them again after reopening.`),Gi=g('<label class="flex items-center gap-3 text-sm"><span class="font-mono text-text-secondary w-28 shrink-0">:</span><input>'),Ji=g("<li><code>"),Tr=g("<button type=button>"),Ki=g('<textarea placeholder="{ "name": "value" }">'),Wi=g("<button type=button>Fill empty inputs from OpenAPI"),Yi=g('<label class="flex flex-col gap-1 text-xs text-text-muted"><input>'),Qi=g('<details class="text-xs mb-2"><summary class="cursor-pointer text-text-secondary">Response headers (<!>)</summary><table class=mt-2><tbody>'),Xi=g('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto max-h-[50vh] whitespace-pre-wrap break-all">'),Zi=g('<div class="flex flex-col sm:flex-row sm:items-center gap-2 mt-3 text-xs"><span class="text-text-secondary font-semibold shrink-0">Save to variable</span><input placeholder="JSON path, e.g. data.accessToken"><input placeholder="variable, e.g. token"><button type=button>Save'),ea=g('<p class="text-xs text-text-muted mt-1"role=status>'),ta=g('<p class="mt-1 text-xs text-text-muted">Body truncated to <!> characters.'),ra=g('<span class="flex items-center gap-3">Response<span> </span><span class="text-text-muted text-xs font-normal"> ms'),na=g('<tr><td class="font-mono text-text-secondary pr-4"></td><td class="font-mono break-all">'),la=g('<p class="text-xs text-text-muted">Nothing sent yet.'),sa=g('<li><button type=button class="w-full flex items-center gap-2 text-xs text-left rounded px-2 py-1 hover:bg-surface-2"title="Open with these inputs"><span></span><span class="font-mono truncate flex-1"></span><span></span><span class="text-text-muted w-16 text-right"> ms</span><span class="text-text-muted w-16 text-right">'),ia=g('<span class="text-xs font-normal text-text-muted">(<!>)'),aa=g('<details class="border border-border rounded-lg bg-surface-1 group"><summary class="cursor-pointer select-none px-3 py-2 text-sm font-semibold text-text-body flex items-center gap-2"><span class="text-text-muted transition-transform group-open:rotate-90">▸</span></summary><div class="px-3 pb-3">'),oa=g("<label><input type=file class=sr-only>"),ca=g('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><select aria-label="Field type"><option value=text>Text</option><option value=file>File</option></select><input placeholder=name>'),ua=g("<input placeholder=value>"),da=g('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><input placeholder=name><input placeholder=value>'),Nt="kickjs-devtools:runner:defaults",It="kickjs-devtools:runner:variables",Er="kickjs-devtools:runner:settings",hn="kickjs-devtools:runner:remember",Ar="kickjs-devtools:runner:history",Pt=2e5,[ke,Yt]=x(null),We=0,ut=null,[fn,Mr]=x({});function ha(e){e in xe(fn)||(Mr(t=>({...t,[e]:void 0})),fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.json():null).catch(()=>null).then(t=>Mr(r=>({...r,[e]:t}))))}function fa(e){Yt(e)}function Lr(e,t,r){try{const n=e().getItem(t);return n?{...r,...JSON.parse(n)}:r}catch{return r}}function Rr(e,t){try{const r=JSON.parse(e().getItem(t)??"[]");return Array.isArray(r)?r:[]}catch{return[]}}function Or(e,t){try{e().removeItem(t)}catch{}}function ga(){try{return localStorage.getItem(hn)==="true"}catch{return!1}}function Fe(e,t,r){try{e().setItem(t,JSON.stringify(r))}catch{}}var dt=e=>e.filter(t=>t.enabled&&t.key).length,va=()=>{const[e,t]=x(null),[r,n]=x(ga()),s=()=>r()?localStorage:sessionStorage,i=()=>r()?sessionStorage:localStorage,[u,a]=x(Rr(s,Nt)),[c,h]=x(Rr(s,It)),[d,f]=x({path:"",name:""}),[v,p]=x(null),[m,k]=x(Lr(()=>localStorage,Er,ai)),[S,y]=x(!1),[$,L]=x(!1),[A,O]=x(null),[K,V]=x(null),[F,B]=x(null),[le,Y]=x("curl"),[Z,G]=x((()=>{try{const E=JSON.parse(localStorage.getItem(Ar)??"[]");return Array.isArray(E)?E:[]}catch{return[]}})()),[Q,ee]=x(null),[de,pe]=x(!1),ne=H(()=>{const E=ke(),j=fn()[m().openApiUrl];return E&&j?Si(j,E):void 0});Ce(()=>{const E=ke();if(We++,!E)return;let j=!1;try{j=localStorage.getItem(jt(E))===null}catch{}const oe=ut??Lr(()=>localStorage,jt(E),$i(E));ut=null;const ye=Object.fromEntries(xt(E.path).map(_e=>[_e,oe.params[_e]??""]));t({...oe,params:ye}),pe(j),ee(null),O(null),V(null),y(!1),L(!1)}),Ce(()=>{const E=ke(),j=e();E&&j&&Fe(()=>localStorage,jt(E),un(j))}),Ce(()=>{Fe(s,Nt,u()),Fe(s,It,c()),Or(i,Nt),Or(i,It),Fe(()=>localStorage,hn,r())}),Ce(()=>Fe(()=>localStorage,Er,m())),Ce(()=>Fe(()=>localStorage,Ar,Z())),Ce(()=>{ke()&&ha(m().openApiUrl)}),Ce(()=>{const E=ne();!E||!de()||(pe(!1),t(j=>j&&Cr(j,E)))}),Ce(()=>{if(!ke())return;const E=j=>{j.key==="Escape"&&Ee()};document.addEventListener("keydown",E),$e(()=>document.removeEventListener("keydown",E))});const ae=H(()=>{const E=ke(),j=e();return!E||!j?null:vi({route:E,inputs:j,defaults:u(),variables:fi(c()),settings:m(),origin:window.location.origin,cookies:document.cookie})}),Ee=()=>Yt(null),Re=E=>{y(!1),t(j=>j&&{...j,...E})};async function Sn(){const E=ae();if(!E)return;if(ui(E.method)&&!S()){y(!0);return}y(!1),L(!0),V(null);const j=performance.now(),oe=We,ye=ke(),_e=e(),we=te=>G(ce=>yi(ce,{at:Date.now(),method:ye.method.toUpperCase(),path:ye.path,inputs:_e,ms:Math.round(performance.now()-j),...te}));try{const te=await fetch(E.url,{method:E.method,headers:E.headers,body:E.body,credentials:"same-origin"}),ce=await te.text();if(we({status:te.status}),oe!==We)return;O({status:te.status,statusText:te.statusText,ms:Math.round(performance.now()-j),headers:[...te.headers.entries()],raw:ce,body:xi(ce.slice(0,Pt),te.headers.get("content-type")),truncated:ce.length>Pt})}catch(te){if(we({error:te instanceof Error?te.message:String(te)}),oe!==We)return;O(null),V(te instanceof Error?te.message:String(te))}finally{oe===We&&L(!1)}}const or=H(()=>{const E=ae();return E?le()==="curl"?mi(E):bi(E):""});async function kn(){try{await navigator.clipboard.writeText(or()),B("Copied")}catch{B("Copy failed — select the text instead")}setTimeout(()=>B(null),1500)}function Cn(){const E=A(),{path:j,name:oe}=d();if(!E||!j.trim()||!oe.trim())return;let ye;try{ye=JSON.parse(E.raw)}catch{p("The response is not JSON");return}const _e=gi(ye,j.trim());if(_e===void 0){p(`Nothing at "${j.trim()}"`);return}const we=oe.trim(),te=c();h(te.some(ce=>ce.key===we)?te.map(ce=>ce.key===we?{...ce,value:_e,enabled:!0}:ce):[...te,{key:we,value:_e,enabled:!0}]),p(`Saved {{${we}}}`)}function Tn(E){const j=q.routes().find(oe=>oe.method.toUpperCase()===E.method&&oe.path===E.path);j&&(ut=E.inputs,j===ke()?(ut=null,Re(E.inputs)):Yt(j))}async function En(){const E=ke();if(E){ee(null);try{const j=await ge.source(E.controller,E.handler);window.location.href=ki(m().editorUrl,j.file,j.line),ee(`${j.relative}:${j.line}`)}catch{ee("Source not found under src/")}}}const An=()=>{const E=ke();return E?an(E,m()):!1};return o(b,{get when(){return ke()},children:E=>(()=>{var j=Ui(),oe=j.firstChild,ye=oe.firstChild,_e=ye.firstChild,we=_e.firstChild,te=we.firstChild,ce=te.firstChild,Mn=ce.nextSibling,Lt=te.nextSibling,st=Lt.firstChild,Ln=st.firstChild,Rn=we.nextSibling,On=_e.nextSibling,qe=ye.nextSibling,it=qe.nextSibling.firstChild;return j.$$click=T=>{T.target===T.currentTarget&&Ee()},l(ce,()=>E().method.toUpperCase()),l(Mn,()=>E().path),st.$$click=En,l(st,()=>E().controller,Ln),l(st,()=>E().handler,null),l(Lt,o(b,{get when(){return Q()},get children(){return[" · ",fe(()=>Q())]}}),null),l(Lt,o(b,{get when(){return An()},children:" · public route — default Authorization not sent"}),null),l(we,o(b,{get when(){return ne()?.summary},get children(){var T=Ci();return l(T,()=>ne().summary),T}}),null),Rn.$$click=Ee,l(On,()=>ae()?.url),l(ye,o(b,{get when(){return fe(()=>!!ae())()&&kr(ae()).length>0},get children(){var T=Ti(),C=T.firstChild.nextSibling;return C.nextSibling,l(T,()=>kr(ae()).map(M=>`{{${M}}}`).join(", "),C),T}}),null),l(qe,o(b,{get when(){return e()},children:T=>[o(b,{get when(){return xt(E().path).length>0},get children(){return o(je,{title:"Path params",open:!0,get children(){var C=ar();return l(C,o(N,{get each(){return xt(E().path)},children:M=>(()=>{var P=Gi(),I=P.firstChild;I.firstChild;var D=I.nextSibling;return l(I,M,null),D.$$input=ue=>Re({params:{...T().params,[M]:ue.currentTarget.value}}),R(D,me),w(()=>z(D,"placeholder",ne()?.params[M])),w(()=>D.value=T().params[M]??""),P})()})),C}})}}),o(je,{title:"Query",get count(){return dt(T().query)},get children(){return[o(ht,{get rows(){return T().query},onChange:C=>Re({query:C})}),o(b,{get when(){return ne()?.query.length},get children(){var C=Fi();return l(C,o(N,{get each(){return ne().query},children:M=>(()=>{var P=Ji(),I=P.firstChild;return l(I,()=>M.name),l(P,()=>M.required?" (required)":"",null),l(P,(()=>{var D=fe(()=>!!M.description);return()=>D()?` — ${M.description}`:""})(),null),P})()})),C}})]}}),o(je,{title:"Headers",get count(){return dt(T().headers)},get children(){return o(ht,{get rows(){return T().headers},onChange:C=>Re({headers:C})})}}),o(b,{get when(){return Wt(E().method)},get children(){return o(je,{title:"Body",open:!0,get children(){return[(()=>{var C=zi();return l(C,o(N,{each:[["raw","Raw"],["form","Form data"]],children:([M,P])=>(()=>{var I=Tr();return I.$$click=()=>Re({bodyMode:M}),l(I,P),w(D=>{var ue=(T().bodyMode??"raw")===M,Ae=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${(T().bodyMode??"raw")===M?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return ue!==D.e&&z(I,"aria-pressed",D.e=ue),Ae!==D.t&&R(I,D.t=Ae),D},{e:void 0,t:void 0}),I})()}),null),l(C,o(b,{get when(){return fe(()=>!!E().upload)()&&E().upload.mode!=="none"},get children(){var M=Hi(),P=M.firstChild.nextSibling;return l(P,()=>E().upload.fieldName??"file"),l(M,(()=>{var I=fe(()=>E().upload.mode==="array");return()=>I()?`, up to ${E().upload.maxCount??10} files`:", one file"})(),null),M}}),null),C})(),o(b,{get when(){return T().bodyMode==="form"},get fallback(){return(()=>{var C=Ki();return C.$$input=M=>Re({body:M.currentTarget.value}),R(C,`${me} font-mono min-h-40`),w(()=>C.value=T().body),C})()},get children(){return[o(pa,{get rows(){return T().form??[]},get multiple(){return E().upload?.mode==="array"},onChange:C=>Re({form:C})}),Vi()]}})]}})}})]}),null),l(qe,o(je,{title:"Environment",get count(){return dt(u())+dt(c())},get children(){return[(()=>{var T=Ei(),C=T.firstChild,M=C.nextSibling.firstChild.nextSibling;return C.addEventListener("change",P=>n(P.currentTarget.checked)),l(M,()=>r()?"Default headers and variables are saved in localStorage and survive closing the tab. They may hold tokens — turn this off on a shared machine.":"Default headers and variables are kept for this browser tab only."),w(()=>C.checked=r()),T})(),Ai(),Mi(),o(ht,{get rows(){return u()},onChange:a}),Li(),Ri(),o(ht,{get rows(){return c()},onChange:h}),o(b,{get when(){return ne()},children:T=>(()=>{var C=Wi();return C.$$click=()=>Re(Cr(e(),T())),R(C,`${ft} mt-4`),C})()}),Oi(),(()=>{var T=ji(),C=T.firstChild.firstChild.nextSibling;return C.addEventListener("change",M=>k({...m(),publicFlag:Kt(M.currentTarget.value)})),R(C,me),l(T,o(N,{each:[["csrfCookie","CSRF cookie"],["csrfHeader","CSRF header"],["openApiUrl","OpenAPI spec URL"],["editorUrl","Editor link ({file}, {line})"]],children:([M,P])=>(()=>{var I=Yi(),D=I.firstChild;return l(I,P,D),D.$$input=ue=>k({...m(),[M]:ue.currentTarget.value}),R(D,me),w(()=>D.value=m()[M]),I})()}),null),w(()=>C.value=Kt(m().publicFlag).join(", ")),T})()]}}),null),l(qe,o(je,{title:"Code snippet",get children(){return[(()=>{var T=Ii(),C=T.firstChild;return l(T,o(N,{each:["curl","fetch"],children:M=>(()=>{var P=Tr();return P.$$click=()=>Y(M),l(P,M),w(I=>{var D=le()===M,ue=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${le()===M?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return D!==I.e&&z(P,"aria-pressed",I.e=D),ue!==I.t&&R(P,I.t=ue),I},{e:void 0,t:void 0}),P})()}),C),C.$$click=kn,R(C,`${ft} ml-auto`),l(T,o(b,{get when(){return F()},get children(){var M=Ni();return l(M,F),M}}),null),T})(),(()=>{var T=Pi();return l(T,or),T})()]}}),null),l(qe,o(b,{get when(){return K()},get children(){var T=Bi();return T.firstChild,l(T,K,null),T}}),null),l(qe,o(b,{get when(){return A()},children:T=>o(je,{open:!0,get title(){return(()=>{var C=ra(),M=C.firstChild.nextSibling,P=M.firstChild,I=M.nextSibling,D=I.firstChild;return l(M,()=>T().status,P),l(M,()=>T().statusText,null),l(I,()=>T().ms,D),w(()=>R(M,`font-bold ${jr(T().status)}`)),C})()},get children(){return[(()=>{var C=Qi(),M=C.firstChild,P=M.firstChild.nextSibling;P.nextSibling;var I=M.nextSibling.firstChild;return l(M,()=>T().headers.length,P),l(I,o(N,{get each(){return T().headers},children:([D,ue])=>(()=>{var Ae=na(),at=Ae.firstChild,Rt=at.nextSibling;return l(at,D),l(Rt,ue),Ae})()})),C})(),(()=>{var C=Xi();return l(C,()=>T().body||"(empty body)"),C})(),(()=>{var C=Zi(),M=C.firstChild.nextSibling,P=M.nextSibling,I=P.nextSibling;return M.$$input=D=>f({...d(),path:D.currentTarget.value}),R(M,me),P.$$input=D=>f({...d(),name:D.currentTarget.value}),R(P,me),I.$$click=Cn,R(I,ft),w(()=>M.value=d().path),w(()=>P.value=d().name),C})(),o(b,{get when(){return v()},get children(){var C=ea();return l(C,v),C}}),o(b,{get when(){return T().truncated},get children(){var C=ta(),M=C.firstChild.nextSibling;return M.nextSibling,l(C,()=>Pt.toLocaleString(),M),C}})]}})}),null),l(qe,o(je,{title:"History",get count(){return Z().length},get children(){return o(b,{get when(){return Z().length>0},get fallback(){return la()},get children(){return[(()=>{var T=qi();return l(T,o(N,{get each(){return Z()},children:C=>(()=>{var M=sa(),P=M.firstChild,I=P.firstChild,D=I.nextSibling,ue=D.nextSibling,Ae=ue.nextSibling,at=Ae.firstChild,Rt=Ae.nextSibling;return P.$$click=()=>Tn(C),l(I,()=>C.method),l(D,()=>_i(C)),l(ue,()=>C.status??"failed"),l(Ae,()=>C.ms,at),l(Rt,()=>new Date(C.at).toLocaleTimeString()),w(Ke=>{var cr=`font-bold w-14 shrink-0 ${Vt(C.method)}`,ur=C.status?jr(C.status):"text-red-400";return cr!==Ke.e&&R(I,Ke.e=cr),ur!==Ke.t&&R(ue,Ke.t=ur),Ke},{e:void 0,t:void 0}),M})()})),T})(),(()=>{var T=Di();return T.$$click=()=>G([]),R(T,`${ft} mt-2`),T})()]}})}}),null),it.$$click=Sn,l(it,(()=>{var T=fe(()=>!!$());return()=>T()?"Sending…":fe(()=>!!S())()?`Click again to send ${E().method.toUpperCase()}`:"Send"})()),w(T=>{var C=`Try ${E().method} ${E().path}`,M=`text-xs font-bold ${Vt(E().method)}`,P=$(),I=`px-4 py-2 text-sm font-semibold rounded-lg border transition-colors ${S()?"bg-red-500/20 text-red-400 border-red-500/40":"bg-kick-500/20 text-kick-500 border-kick-500/30 hover:bg-kick-500/30"}`;return C!==T.e&&z(oe,"aria-label",T.e=C),M!==T.t&&R(ce,T.t=M),P!==T.a&&(it.disabled=T.a=P),I!==T.o&&R(it,T.o=I),T},{e:void 0,t:void 0,a:void 0,o:void 0}),j})()})},je=e=>(()=>{var t=aa(),r=t.firstChild;r.firstChild;var n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.count},get children(){var s=ia(),i=s.firstChild.nextSibling;return i.nextSibling,l(s,()=>e.count,i),s}}),null),l(n,()=>e.children),w(()=>t.open=e.open),t})(),pa=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0,type:"text"}],r=(n,s)=>{const i=t().map((u,a)=>a===n?{...u,...s}:u);e.onChange(i.filter(u=>u.key||u.value||u.files?.length))};return(()=>{var n=ar();return l(n,o(Wr,{get each(){return t()},children:(s,i)=>(()=>{var u=ca(),a=u.firstChild,c=a.nextSibling,h=c.nextSibling;return a.addEventListener("change",d=>r(i,{enabled:d.currentTarget.checked})),c.addEventListener("change",d=>r(i,{type:d.currentTarget.value,value:"",files:[]})),R(c,`${me} w-24 shrink-0`),h.$$input=d=>r(i,{key:d.currentTarget.value}),R(h,me),l(u,o(b,{get when(){return s().type==="file"},get fallback(){return(()=>{var d=ua();return d.$$input=f=>r(i,{value:f.currentTarget.value}),R(d,me),w(()=>d.value=s().value),d})()},get children(){var d=oa(),f=d.firstChild;return R(d,`${me} cursor-pointer truncate`),f.addEventListener("change",v=>r(i,{files:[...v.currentTarget.files??[]]})),l(d,(()=>{var v=fe(()=>!!s().files?.length);return()=>v()?s().files.map(p=>p.name).join(", "):"Choose file…"})(),null),w(()=>f.multiple=e.multiple),d}}),null),w(()=>a.checked=s().enabled),w(()=>c.value=s().type),w(()=>h.value=s().key),u})()})),n})()},ht=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0}],r=(n,s)=>{const i=t().map((u,a)=>a===n?{...u,...s}:u);e.onChange(i.filter(u=>u.key||u.value))};return(()=>{var n=ar();return l(n,o(Wr,{get each(){return t()},children:(s,i)=>(()=>{var u=da(),a=u.firstChild,c=a.nextSibling,h=c.nextSibling;return a.addEventListener("change",d=>r(i,{enabled:d.currentTarget.checked})),c.$$input=d=>r(i,{key:d.currentTarget.value}),R(c,me),h.$$input=d=>r(i,{value:d.currentTarget.value}),R(h,me),w(()=>a.checked=s().enabled),w(()=>c.value=s().key),w(()=>h.value=s().value),u})()})),n})()},me="w-full min-w-0 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500",ft="px-3 py-2 text-xs font-semibold rounded-lg border bg-surface-2 text-text-secondary border-border-strong hover:text-text-body";function jr(e){return e>=500?"text-red-400":e>=400?"text-amber-400":e>=300?"text-cyan-400":"text-emerald-400"}ie(["click","input"]);var ma=g("<div class=overflow-x-auto><table><thead><tr><th>Method</th><th>Path</th><th>Controller</th><th>Handler</th><th>Middleware</th><th>Flags</th><th><span class=sr-only>Try</span></th></tr></thead><tbody>"),ba=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4"><div class="relative flex-1"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search routes (path, controller, handler)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex gap-1">'),xa=g("<button type=button>"),$a=g("<div class=empty>"),ya=g('<tr><td><span></span></td><td class="font-mono text-sm"></td><td></td><td class=text-text-secondary></td><td class="text-text-muted text-xs"></td><td class="text-text-muted text-xs"></td><td><button type=button class="px-2.5 py-1 text-xs font-semibold rounded-lg border bg-surface-2 text-text-secondary border-border-strong hover:text-kick-500 hover:border-kick-500/40">Try'),_a=["ALL","GET","POST","PUT","DELETE","PATCH"];function wa(e){const t=Object.entries(e??{});return t.length?t.map(([r,n])=>n===!0?r:`${r}=${JSON.stringify(n)}`).join(", "):"—"}var Sa=()=>{const[e,t]=x(""),[r,n]=x("ALL"),s=H(()=>{let u=q.routes();r()!=="ALL"&&(u=u.filter(c=>c.method.toUpperCase()===r()));const a=e().trim().toLowerCase();return a&&(u=u.filter(c=>c.path.toLowerCase().includes(a)||c.controller.toLowerCase().includes(a)||c.handler.toLowerCase().includes(a))),u}),i=Pe(()=>s());return(()=>{var u=ba(),a=u.firstChild.firstChild,c=a.firstChild.nextSibling,h=a.nextSibling;return c.$$input=d=>t(d.currentTarget.value),l(h,o(N,{each:_a,children:d=>(()=>{var f=xa();return f.$$click=()=>n(d),l(f,d),w(()=>R(f,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===d?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),f})()})),l(u,o(b,{get when(){return i.page().length>0},get fallback(){return(()=>{var d=$a();return l(d,()=>e()||r()!=="ALL"?"No routes match the current filter":"No routes registered"),d})()},get children(){return[(()=>{var d=ma(),f=d.firstChild.firstChild.nextSibling;return l(f,o(N,{get each(){return i.page()},children:v=>(()=>{var p=ya(),m=p.firstChild,k=m.firstChild,S=m.nextSibling,y=S.nextSibling,$=y.nextSibling,L=$.nextSibling,A=L.nextSibling,O=A.nextSibling.firstChild;return l(k,()=>v.method),l(S,()=>v.path),l(y,()=>v.controller),l($,()=>v.handler),l(L,(()=>{var K=fe(()=>!!v.middleware.length);return()=>K()?v.middleware.join(", "):"—"})()),l(A,()=>wa(v.flags)),O.$$click=()=>fa(v),w(()=>R(k,`text-xs font-bold ${Vt(v.method)}`)),p})()})),d})(),o(Be,{pager:i})]}}),null),w(()=>c.value=e()),u})()};ie(["input","click"]);var ka=g("<div class=card style=border-color:var(--critical)><div class=card-title style=color:var(--critical)>Failed to load metrics</div><code>"),Ca=g("<div class=empty>Loading route metrics…"),Ta=g("<div class=grid>"),Ea=g("<table><thead><tr><th>Route</th><th style=text-align:right>Calls</th><th style=text-align:right>Avg</th><th style=text-align:right>p50</th><th style=text-align:right>p95</th><th style=text-align:right>p99</th><th style=text-align:right>Max</th></tr></thead><tbody>"),Aa=g("<div class=card><div class=card-header><div class=card-title>Per-route latency"),Ma=g("<div class=empty>No requests recorded yet"),La=g("<tr><td></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right></td><td style=text-align:right>"),Ra=g("<div class=card><div class=card-header><div class=card-title></div><div class=card-value>"),Oa=()=>{const[e,t]=x(null),[r,n]=x(null),s=async()=>{try{t(await ge.routes()),n(null)}catch(u){n(u instanceof Error?u.message:String(u))}};Je(()=>{s();const u=setInterval(()=>{s()},2e3);return()=>clearInterval(u)});const i=H(()=>{const u=e();return u?Object.entries(u.routeLatency).map(([a,c])=>Object.assign({key:a},c,{avg:c.count>0?c.totalMs/c.count:0})).toSorted((a,c)=>c.count-a.count):[]});return[o(b,{get when(){return r()},children:u=>(()=>{var a=ka(),c=a.firstChild.nextSibling;return l(c,u),a})()}),o(b,{get when(){return e()},get fallback(){return Ca()},children:u=>[(()=>{var a=Ta();return l(a,o(Ye,{title:"Requests",metric:"requests",get value(){return u().requests.toString()}}),null),l(a,o(Ye,{title:"Server errors",metric:"server-errors",get value(){return u().serverErrors.toString()}}),null),l(a,o(Ye,{title:"Client errors",metric:"client-errors",get value(){return u().clientErrors.toString()}}),null),l(a,o(Ye,{title:"Error rate",metric:"error-rate",get value(){return kt(u().errorRate)}}),null),l(a,o(Ye,{title:"Uptime",metric:"uptime",get value(){return lr(u().uptimeSeconds)}}),null),a})(),(()=>{var a=Aa();return a.firstChild,l(a,o(b,{get when(){return i().length>0},get fallback(){return Ma()},get children(){var c=Ea(),h=c.firstChild,d=h.firstChild.firstChild.nextSibling.nextSibling;d.firstChild;var f=d.nextSibling;f.firstChild;var v=f.nextSibling;v.firstChild;var p=v.nextSibling;p.firstChild;var m=p.nextSibling;m.firstChild;var k=h.nextSibling;return l(d,o(ve,{metric:"latency.avg",placement:"bottom"}),null),l(f,o(ve,{metric:"latency.p50",placement:"bottom"}),null),l(v,o(ve,{metric:"latency.p95",placement:"bottom"}),null),l(p,o(ve,{metric:"latency.p99",placement:"bottom"}),null),l(m,o(ve,{metric:"latency.max",placement:"bottom"}),null),l(k,o(N,{get each(){return i()},children:S=>(()=>{var y=La(),$=y.firstChild,L=$.nextSibling,A=L.nextSibling,O=A.nextSibling,K=O.nextSibling,V=K.nextSibling,F=V.nextSibling;return l($,()=>S.key),l(L,()=>S.count),l(A,()=>Me(S.avg)),l(O,()=>Me(S.p50)),l(K,()=>Me(S.p95)),l(V,()=>Me(S.p99)),l(F,()=>Me(S.maxMs)),y})()})),c}}),null),a})()]})]},Ye=e=>(()=>{var t=Ra(),r=t.firstChild.firstChild,n=r.nextSibling;return l(r,()=>e.title,null),l(r,o(b,{get when(){return e.metric},children:s=>o(ve,{get metric(){return s()}})}),null),l(n,()=>e.value),t})(),ja=g('<button type=button class="text-text-muted hover:text-text-strong p-1"aria-label=Back><svg class="w-4 h-4"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M15 19l-7-7 7-7">'),Nr=g('<div class="flex flex-wrap gap-1">'),Na=g('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-3 space-y-2 text-sm">'),Ia=g("<span>"),Pa=g('<div class="fixed inset-0 z-50 bg-black/70 flex items-center justify-center p-4"><div class="bg-surface-1 border border-border-strong rounded-2xl p-6 max-w-2xl w-full shadow-2xl max-h-[90vh] overflow-y-auto"><div class="flex items-start justify-between mb-4"><div><div class="flex items-center gap-2 mb-1"><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><div class="flex flex-wrap gap-2 mt-2"><span></span><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span><span></span></div></div><button type=button class="text-slate-500 hover:text-slate-300 p-1"aria-label=Close><svg class="w-5 h-5"fill=none stroke=currentColor viewBox="0 0 24 24"><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M6 18L18 6M6 6l12 12">'),Ir=g('<span class="text-text-muted text-sm">None'),Ba=g('<button type=button class="bg-surface-2 text-kick-500 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),qa=g('<button type=button class="bg-surface-2 text-amber-400 hover:bg-border-strong px-2.5 py-1 rounded text-xs font-mono border border-border-strong transition-colors">'),Da=g('<div class=mb-4><h3 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">'),Ua=g('<div class="flex justify-between"><span class=text-text-secondary></span><span class=tabular-nums>'),[Qt,rt]=x(null),[Fa,Mt]=x([]);function Ct(e){Mt([]),rt(e)}function Pr(e){const t=Qt();t&&t!==e&&Mt(r=>[...r,t]),rt(e)}function Ha(){Mt(e=>{if(e.length===0)return rt(null),e;const t=e.slice(0,-1);return rt(e[e.length-1]),t})}function Br(){rt(null),Mt([])}var za=()=>{const e=H(()=>{const r=Qt();if(!r)return null;const n=q.container().find(s=>s.token===r);return n||{token:r,kind:void 0,scope:void 0,dependencies:[]}}),t=H(()=>{const r=Qt();return r?q.container().filter(n=>n.dependencies?.includes(r)).map(n=>n.token):[]});return o(b,{get when(){return e()},children:r=>(()=>{var n=Pa(),s=n.firstChild,i=s.firstChild.firstChild,u=i.firstChild,a=u.firstChild,c=u.nextSibling.firstChild,h=c.nextSibling,d=h.nextSibling,f=i.nextSibling;return n.$$click=v=>{v.target===v.currentTarget&&Br()},l(u,o(b,{get when(){return Fa().length>0},get children(){var v=ja();return v.$$click=Ha,v}}),a),l(a,()=>r().token),l(c,()=>r().kind??"unknown"),l(h,()=>r().scope??"singleton"),l(d,()=>Ja(r())),f.$$click=Br,l(s,o(gt,{title:"Dependencies",get children(){return o(b,{get when(){return(r().dependencies?.length??0)>0},get fallback(){return Ir()},get children(){var v=Nr();return l(v,o(N,{get each(){return r().dependencies},children:p=>(()=>{var m=Ba();return m.$$click=()=>Pr(p),l(m,p),m})()})),v}})}}),null),l(s,o(gt,{title:"Dependents",get children(){return o(b,{get when(){return t().length>0},get fallback(){return Ir()},get children(){var v=Nr();return l(v,o(N,{get each(){return t()},children:p=>(()=>{var m=qa();return m.$$click=()=>Pr(p),l(m,p),m})()})),v}})}}),null),l(s,o(gt,{title:"Resolve stats",get children(){var v=Na();return l(v,o(vt,{label:"Resolve count",get value(){return String(r().resolveCount??0)}}),null),l(v,o(b,{get when(){return r().firstResolved},children:p=>o(vt,{label:"First resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(v,o(b,{get when(){return r().lastResolved},children:p=>o(vt,{label:"Last resolved",get value(){return new Date(p()).toLocaleString()}})}),null),l(v,o(b,{get when(){return r().resolveDurationMs!=null},get children(){return o(vt,{label:"Resolution duration",get value(){return`${(r().resolveDurationMs??0).toFixed(2)} ms`}})}}),null),v}}),null),l(s,o(gt,{title:"PostConstruct",get children(){var v=Ia();return l(v,()=>r().postConstructStatus??"none"),w(()=>R(v,`px-2 py-0.5 rounded text-xs font-semibold ${Ka(r().postConstructStatus)}`)),v}}),null),w(v=>{var p=`px-2 py-0.5 rounded text-xs font-semibold ${Va(r().kind)}`,m=`px-2 py-0.5 rounded text-xs font-semibold ${Ga(r())}`;return p!==v.e&&R(c,v.e=p),m!==v.t&&R(d,v.t=m),v},{e:void 0,t:void 0}),n})()})},gt=e=>(()=>{var t=Da(),r=t.firstChild;return l(r,()=>e.title),l(t,()=>e.children,null),t})(),vt=e=>(()=>{var t=Ua(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),t})();function Va(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function Ga(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function Ja(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function Ka(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}ie(["click"]);var Wa=g("<div class=overflow-x-auto><table><thead><tr><th class=w-6 aria-label=expand></th><th>Token</th><th>Kind</th><th>Scope</th><th>Status</th><th class=text-right>Resolves</th><th class=text-right>Deps</th></tr></thead><tbody>"),Ya=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col gap-3 mb-4"><div class=relative><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search tokens…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"></div><div class="flex flex-col sm:flex-row gap-3"><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Kind:</span></div><div class="flex gap-1 items-center"><span class="text-xs text-text-muted mr-1">Scope:'),qr=g("<button type=button>"),Qa=g("<div class=empty>"),Xa=g('<tr class="cursor-pointer select-none"><td><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M9 5l7 7-7 7"></path></svg></td><td class="font-mono text-sm"></td><td><span></span></td><td><span class="bg-border-strong/50 text-text-strong px-2 py-0.5 rounded text-xs font-semibold"></span></td><td><span></span></td><td class="text-right tabular-nums"></td><td class="text-right text-text-muted text-xs">'),Za=g('<tr><td colspan=7 class="bg-surface-2/30 px-6 py-4 border-b border-border">'),eo=g('<div class="flex flex-wrap gap-1">'),to=g('<div class="flex justify-between"><span class=text-text-secondary>Duration</span><span class=tabular-nums>ms'),ro=g('<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Dependencies</h4></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">Resolve Stats</h4><div class="space-y-1 text-sm"><div class="flex justify-between"><span class=text-text-secondary>Resolve count</span><span class=tabular-nums></span></div></div></div><div><h4 class="text-xs font-semibold uppercase tracking-wider text-text-muted mb-2">PostConstruct</h4><span></span></div><div class="md:col-span-2 flex justify-end"><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-kick-500/20 text-kick-500 border border-kick-500/30 hover:bg-kick-500/30 transition-colors">View full details'),no=g('<span class="text-text-muted text-sm">None'),lo=g('<button type=button class="bg-border-strong/50 text-kick-500 hover:bg-border-strong px-2 py-0.5 rounded text-xs font-mono transition-colors">'),so=g('<div class="flex justify-between"><span class=text-text-secondary>First resolved</span><span class=text-xs>'),io=g('<div class="flex justify-between"><span class=text-text-secondary>Last resolved</span><span class=text-xs>'),ao=["ALL","controller","service","repository","other"],oo=["ALL","singleton","transient","request"],co=()=>{const[e,t]=x(""),[r,n]=x("ALL"),[s,i]=x("ALL"),[u,a]=x(new Set),c=H(()=>{let f=q.container();if(r()!=="ALL"){const p=r();f=f.filter(m=>p==="other"?!["controller","service","repository"].includes(m.kind??""):m.kind===p)}s()!=="ALL"&&(f=f.filter(p=>p.scope===s()));const v=e().trim().toLowerCase();return v&&(f=f.filter(p=>p.token.toLowerCase().includes(v))),f}),h=Pe(()=>c()),d=f=>{a(v=>{const p=new Set(v);return p.has(f)?p.delete(f):p.add(f),p})};return(()=>{var f=Ya(),v=f.firstChild.firstChild,p=v.firstChild.nextSibling,m=v.nextSibling.firstChild;m.firstChild;var k=m.nextSibling;return k.firstChild,p.$$input=S=>t(S.currentTarget.value),l(m,o(N,{each:ao,children:S=>(()=>{var y=qr();return y.$$click=()=>n(S),l(y,S),w(()=>R(y,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${r()===S?fo(S):"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),y})()}),null),l(k,o(N,{each:oo,children:S=>(()=>{var y=qr();return y.$$click=()=>i(S),l(y,S),w(()=>R(y,`px-3 py-1.5 text-xs font-semibold rounded-lg transition-colors border ${s()===S?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),y})()}),null),l(f,o(b,{get when(){return h.page().length>0},get fallback(){return(()=>{var S=Qa();return l(S,()=>e()||r()!=="ALL"||s()!=="ALL"?"No tokens match the current filter":"No DI registrations"),S})()},get children(){return[(()=>{var S=Wa(),y=S.firstChild.firstChild,$=y.firstChild.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;$.firstChild;var L=y.nextSibling;return l($,o(ve,{metric:"resolve.count",placement:"bottom"}),null),l(L,o(N,{get each(){return h.page()},children:A=>[(()=>{var O=Xa(),K=O.firstChild,V=K.firstChild,F=K.nextSibling,B=F.nextSibling,le=B.firstChild,Y=B.nextSibling,Z=Y.firstChild,G=Y.nextSibling,Q=G.firstChild,ee=G.nextSibling,de=ee.nextSibling;return O.$$click=()=>d(A.token),l(F,()=>A.token),l(le,()=>A.kind??"unknown"),l(Z,()=>A.scope??"—"),l(Q,()=>vo(A)),l(ee,()=>A.resolveCount??0),l(de,()=>A.dependencies?.length??0),w(pe=>{var ne=`w-3 h-3 text-text-muted transition-transform ${u().has(A.token)?"rotate-90":""}`,ae=`px-2 py-0.5 rounded text-xs font-semibold ${ho(A.kind)}`,Ee=`px-2 py-0.5 rounded text-xs font-semibold ${go(A)}`;return ne!==pe.e&&z(V,"class",pe.e=ne),ae!==pe.t&&R(le,pe.t=ae),Ee!==pe.a&&R(Q,pe.a=Ee),pe},{e:void 0,t:void 0,a:void 0}),O})(),o(b,{get when(){return u().has(A.token)},get children(){var O=Za(),K=O.firstChild;return l(K,o(uo,{registration:A})),O}})]})),S})(),o(Be,{pager:h})]}}),null),w(()=>p.value=e()),f})()},uo=e=>(()=>{var t=ro(),r=t.firstChild;r.firstChild;var n=r.nextSibling,s=n.firstChild.nextSibling,i=s.firstChild.firstChild.nextSibling,u=n.nextSibling,a=u.firstChild;a.firstChild;var c=a.nextSibling,h=u.nextSibling.firstChild;return l(r,o(b,{get when(){return(e.registration.dependencies?.length??0)>0},get fallback(){return no()},get children(){var d=eo();return l(d,o(N,{get each(){return e.registration.dependencies},children:f=>(()=>{var v=lo();return v.$$click=p=>{p.stopPropagation(),Ct(f)},z(v,"title",`Open detail for ${f}`),l(v,f),v})()})),d}}),null),l(i,()=>e.registration.resolveCount??0),l(s,o(b,{get when(){return e.registration.firstResolved},children:d=>(()=>{var f=so(),v=f.firstChild.nextSibling;return l(v,()=>new Date(d()).toLocaleTimeString()),f})()}),null),l(s,o(b,{get when(){return e.registration.lastResolved},children:d=>(()=>{var f=io(),v=f.firstChild.nextSibling;return l(v,()=>new Date(d()).toLocaleTimeString()),f})()}),null),l(s,o(b,{get when(){return e.registration.resolveDurationMs!=null},get children(){var d=to(),f=d.firstChild.nextSibling,v=f.firstChild;return l(f,()=>(e.registration.resolveDurationMs??0).toFixed(2),v),d}}),null),l(a,o(ve,{metric:"post-construct"}),null),l(c,()=>e.registration.postConstructStatus??"none"),h.$$click=d=>{d.stopPropagation(),Ct(e.registration.token)},w(()=>R(c,`px-2 py-0.5 rounded text-xs font-semibold ${po(e.registration.postConstructStatus)}`)),t})();function ho(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function fo(e){return e==="controller"?"bg-violet-900/50 text-violet-300 border-violet-700/50":e==="service"?"bg-blue-900/50 text-blue-300 border-blue-700/50":e==="repository"?"bg-teal-900/50 text-teal-300 border-teal-700/50":e==="other"?"bg-border-strong/50 text-text-strong border-border-strong/50":"bg-kick-500/20 text-kick-500 border-kick-500/30"}function go(e){return e.postConstructStatus==="failed"?"bg-red-900/50 text-red-300":e.instantiated?"bg-emerald-900/50 text-emerald-300":"bg-amber-900/50 text-amber-300"}function vo(e){return e.postConstructStatus==="failed"?"failed":e.instantiated?"active":"registered"}function po(e){return e==="done"?"bg-emerald-900/50 text-emerald-300":e==="failed"?"bg-red-900/50 text-red-300":"bg-border-strong/50 text-text-secondary"}ie(["input","click"]);var mo=g('<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">'),bo=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Search queues by name…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),xo=g('<div class=card><div class=card-title>Queues</div><p class="text-text-muted text-sm mt-2">QueueAdapter not detected. Install <code class="font-mono text-kick-500">@forinda/kickjs-queue</code> and register the adapter in your bootstrap to see queue stats here.'),$o=g("<div class=empty>No queues registered"),yo=g("<div class=empty>No queues match the search"),_o=g('<div class="grid grid-cols-2 gap-2 text-sm">'),wo=g('<div class="bg-surface-2/50 rounded-lg border border-border-strong p-4"><h3 class="font-mono text-sm font-semibold text-kick-500 mb-3 break-all">'),So=g('<div class="text-red-400 text-sm">'),ko=g('<div class="flex justify-between"><span class=text-text-secondary></span><span>'),Co=()=>{const[e,t]=x(""),r=H(()=>{const s=q.queues().queues,i=e().trim().toLowerCase();return i?s.filter(u=>u.name.toLowerCase().includes(i)):s}),n=Pe(()=>r());return o(b,{get when(){return q.queues().enabled},get fallback(){return xo()},get children(){return o(b,{get when(){return q.queues().queues.length>0},get fallback(){return $o()},get children(){var s=bo(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return n.page().length>0},get fallback(){return yo()},get children(){return[(()=>{var u=mo();return l(u,o(N,{get each(){return n.page()},children:a=>o(To,{queue:a})})),u})(),o(Be,{pager:n})]}}),null),w(()=>i.value=e()),s}})}})},To=e=>(()=>{var t=wo(),r=t.firstChild;return l(r,()=>e.queue.name),l(t,o(b,{get when(){return!e.queue.error},get fallback(){return(()=>{var n=So();return l(n,()=>e.queue.error),n})()},get children(){var n=_o();return l(n,o(He,{label:"Waiting",get value(){return e.queue.waiting??0},colour:"text-amber-400"}),null),l(n,o(He,{label:"Active",get value(){return e.queue.active??0},colour:"text-blue-400"}),null),l(n,o(He,{label:"Completed",get value(){return e.queue.completed??0},colour:"text-emerald-400"}),null),l(n,o(He,{label:"Failed",get value(){return e.queue.failed??0},colour:"text-red-400"}),null),l(n,o(He,{label:"Delayed",get value(){return e.queue.delayed??0},colour:"text-violet-400"}),null),l(n,o(He,{label:"Paused",get value(){return e.queue.paused??0},colour:"text-text-secondary"}),null),n}}),null),t})(),He=e=>(()=>{var t=ko(),r=t.firstChild,n=r.nextSibling;return l(r,()=>e.label),l(n,()=>e.value),w(()=>R(n,`font-semibold tabular-nums ${e.colour}`)),t})();ie(["input"]);function Eo(){let e=new Map,t=new Set;return{on:(r,n)=>{let s=e.get(r);return s||(s=new Set,e.set(r,s)),s.add(n),()=>{let i=e.get(r);i?.delete(n),i&&i.size===0&&e.delete(r)}},onAny:r=>(t.add(r),()=>{t.delete(r)}),dispatch:r=>{let n=e.get(r.type);if(n&&n.size>0)for(let s of[...n])try{s(r.payload)}catch(i){console.error(`[kick:devtools-bus] handler for "${r.type}" threw`,i)}if(t.size>0)for(let s of[...t])try{s(r)}catch(i){console.error("[kick:devtools-bus] onAny handler threw",i)}}}}function Ao(e={}){let t=Eo(),r=e.channel===!1?null:e.channel??"kick-devtools",n=r!=null&&typeof BroadcastChannel<"u"?new BroadcastChannel(r):null;n?.addEventListener("message",v=>{let p=v.data;p&&typeof p.type=="string"&&typeof p.ts=="number"&&t.dispatch({...p,__kick_origin:"broadcast"})});let s=null,i=0,u=null,a=e.reconnectMs??500,c=e.reconnectMaxMs??5e3,h=()=>{e.wsUrl&&(typeof WebSocket>"u"||(!s||s.readyState!==WebSocket.OPEN&&s.readyState!==WebSocket.CONNECTING)&&(s=new WebSocket(e.wsUrl),s.addEventListener("open",()=>{i=0}),s.addEventListener("message",v=>{try{let p=JSON.parse(String(v.data));if(!p||typeof p.type!="string"||typeof p.ts!="number")return;t.dispatch({...p,__kick_origin:"ws"})}catch{}}),s.addEventListener("close",()=>{s=null,d()}),s.addEventListener("error",()=>{d()})))},d=()=>{if(!e.wsUrl||u!=null)return;i+=1;let v=Math.min(i*a,c);u=setTimeout(()=>{u=null,h()},v)},f=v=>{n?.postMessage(v),s&&s.readyState===WebSocket.OPEN?s.send(JSON.stringify(v)):e.wsUrl&&h()};return{on(v,p){return h(),t.on(v,p)},onAny(v){return h(),t.onAny(v)},emit(v,p){let m={type:v,payload:p,ts:Date.now(),__kick_origin:"local"};t.dispatch(m),f(m)}}}var Xe=null,[Mo,Xt]=x([]);function Lo(){if(Xe)return()=>{};const e=`${Ie()}/_bus`,t=location.protocol==="https:"?"wss:":"ws:",r=De(),n=r?`?token=${encodeURIComponent(r)}`:"",s=`${t}//${location.host}${e}${n}`;Xe=Ao({channel:"kick-devtools",wsUrl:s});const i=Xe.onAny(u=>{Xt(a=>{const c=a.length>=500?a.slice(1):a.slice();return c.push(u),c})});return()=>{i(),Xe=null,Xt([])}}function Tt(){return Mo}function Ro(){Xt([])}function Oo(){return Xe}var Bt=200;function jo(e){if(e==null)return String(e);if(typeof e=="bigint")return`${e.toString()}n`;if(typeof e!="object")return String(e);const t=new WeakSet,r=(s,i)=>{if(typeof i=="bigint")return`${i.toString()}n`;if(i instanceof Error)return{name:i.name,message:i.message};if(i&&typeof i=="object"){if(t.has(i))return"[Circular]";t.add(i)}return i};let n;try{n=JSON.stringify(e,r)}catch{n="[unserialisable]"}return n===void 0&&(n=String(e)),n.length>Bt?`${n.slice(0,Bt)}… (+${n.length-Bt} chars)`:n}function gn(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}var No=g("<table><thead><tr><th>Time</th><th>Dialect</th><th class=text-right>Duration</th><th>SQL</th></tr></thead><tbody>"),Io=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="grid mb-4"></div><input type=text placeholder="Filter by SQL (substring)…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500 mb-4">'),Po=g("<div class=empty>No queries yet. <code>kick/db</code> emits a <code>db:query</code> event per statement when DevTools is installed — run a query to see it here."),Bo=g("<code class=break-all>"),qo=g("<tr><td class=dimmed></td><td></td><td class=text-right></td><td>"),Do=g("<span style=color:var(--color-red-400)>"),Uo=g("<div class=card><div class=card-header><div class=card-title></div></div><div class=card-value>"),qt=50,Fo=300,Ho=()=>{const[e,t]=x([]),[r,n]=x(""),s=h=>{t(d=>{const f=d.length>=Fo?d.slice(1):d.slice();return f.push(h),f})},i=(h,d)=>{const f=h,v=f.error;return{sql:f.sql,parameters:f.parameters,durationMs:0,dialect:f.dialect,error:v instanceof Error?v.message:String(v??"query error"),ts:d}};Je(()=>{for(const v of Tt()())v.type==="db:query"?s({...v.payload,ts:v.ts}):v.type==="db:query-error"&&s(i(v.payload,v.ts));const h=Oo(),d=h?.on("db:query",v=>{const p=v;s({...p,ts:p.ts??Date.now()})}),f=h?.on("db:query-error",v=>s(i(v,Date.now())));$e(()=>{d?.(),f?.()})});const u=H(()=>{const h=e(),d=h.filter(p=>p.error).length,f=h.filter(p=>p.durationMs>=qt).length,v=h.length;return{total:v,errors:d,slow:f,avg:v?h.reduce((p,m)=>p+m.durationMs,0)/v:0}}),a=H(()=>{const h=r().trim().toLowerCase();return[...h?e().filter(d=>d.sql.toLowerCase().includes(h)):e()].toReversed()}),c=Pe(()=>a());return(()=>{var h=Io(),d=h.firstChild,f=d.nextSibling;return l(d,o(pt,{label:"Queries",get value(){return String(u().total)}}),null),l(d,o(pt,{label:"Errors",get value(){return String(u().errors)},get tone(){return u().errors?"err":void 0}}),null),l(d,o(pt,{label:`Slow (≥${qt}ms)`,get value(){return String(u().slow)},get tone(){return u().slow?"warn":void 0}}),null),l(d,o(pt,{label:"Avg duration",get value(){return Me(u().avg)}}),null),f.$$input=v=>n(v.currentTarget.value),l(h,o(b,{get when(){return e().length},get fallback(){return Po()},get children(){return[(()=>{var v=No(),p=v.firstChild.nextSibling;return l(p,o(N,{get each(){return c.page()},children:m=>(()=>{var k=qo(),S=k.firstChild,y=S.nextSibling,$=y.nextSibling,L=$.nextSibling;return l(S,()=>gn(m.ts)),l(y,()=>m.dialect??"—"),l($,()=>Me(m.durationMs)),l(L,o(b,{get when(){return!m.error},get fallback(){return(()=>{var A=Do();return l(A,()=>m.error),A})()},get children(){var A=Bo();return l(A,()=>m.sql),A}})),w(A=>rr($,m.durationMs>=qt?"color:var(--color-amber-400);font-weight:600":"",A)),k})()})),v})(),o(Be,{pager:c})]}}),null),w(()=>f.value=r()),h})()},pt=e=>(()=>{var t=Uo(),r=t.firstChild,n=r.firstChild,s=r.nextSibling;return l(n,()=>e.label),l(s,()=>e.value),w(i=>rr(s,e.tone==="err"?"color:var(--color-red-400)":e.tone==="warn"?"color:var(--color-amber-400)":"",i)),t})();ie(["input"]);var zo=g("<div class=space-y-6>"),Vo=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="relative mb-4"><svg class="absolute left-3 top-2.5 w-4 h-4 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg><input type=text placeholder="Filter graph (token or kind)…"class="w-full bg-surface-2 border border-border-strong rounded-lg pl-10 pr-4 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500">'),Go=g("<div class=empty>"),Jo=g("<div class=space-y-1>"),Ko=g('<div><button type=button><svg fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2.5 d="M9 5l7 7-7 7"></path></svg><span></span><span class="ml-2 text-text-muted font-normal normal-case">(<!>)'),Wo=g('<span class="bg-border-strong/50 text-text-secondary px-1.5 py-0.5 rounded text-xs">'),Yo=g('<span class="text-text-muted text-xs ml-auto tabular-nums"> resolves'),Qo=g('<div class="ml-8 mt-1 space-y-0.5">'),Xo=g('<button type=button class="w-full text-left px-3 py-2 rounded-lg hover:bg-surface-2/50 transition-colors group"><div class="flex items-center gap-2"><span></span><span class="font-mono text-sm text-text-body break-all">'),Zo=g('<div class="flex items-center gap-2 text-xs text-text-muted hover:text-text-strong"><svg class="w-3 h-3 text-text-muted"fill=none stroke=currentColor viewBox="0 0 24 24"aria-hidden=true><path stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M13 7l5 5-5 5M6 12h12"></path></svg><span></span><span class=font-mono>'),ec=[{id:"controllers",label:"Controllers",match:e=>e==="controller"},{id:"services",label:"Services",match:e=>e==="service"},{id:"repositories",label:"Repositories",match:e=>e==="repository"},{id:"other",label:"Other",match:e=>!["controller","service","repository"].includes(e??"")}],tc=()=>{const[e,t]=x(""),r=H(()=>{const s=q.container(),i=e().trim().toLowerCase();return i?s.filter(u=>u.token.toLowerCase().includes(i)||(u.kind??"").toLowerCase().includes(i)):s}),n=H(()=>ec.map(s=>Object.assign(s,{nodes:r().filter(i=>s.match(i.kind))})));return(()=>{var s=Vo(),i=s.firstChild.firstChild.nextSibling;return i.$$input=u=>t(u.currentTarget.value),l(s,o(b,{get when(){return r().length>0},get fallback(){return(()=>{var u=Go();return l(u,()=>e()?"No nodes match the filter":"No DI registrations to graph"),u})()},get children(){var u=zo();return l(u,o(N,{get each(){return n()},children:a=>o(b,{get when(){return a.nodes.length>0},get children(){return o(rc,{get label(){return a.label},get nodes(){return a.nodes}})}})})),u}}),null),w(()=>i.value=e()),s})()},rc=e=>{const t=H(()=>e.nodes??[]),r=Pe(t),n=`kickjs-devtools-graph-collapsed-${e.label}`,s=()=>{try{return localStorage.getItem(n)==="1"}catch{return!1}},[i,u]=x(s()),a=()=>{const c=!i();u(c);try{c?localStorage.setItem(n,"1"):localStorage.removeItem(n)}catch{}};return(()=>{var c=Ko(),h=c.firstChild,d=h.firstChild,f=d.nextSibling,v=f.nextSibling,p=v.firstChild.nextSibling;return p.nextSibling,h.$$click=a,l(f,()=>e.label),l(v,()=>t().length,p),l(c,o(b,{get when(){return!i()},get children(){return[(()=>{var m=Jo();return l(m,o(N,{get each(){return r.page()},children:k=>o(nc,{node:k})})),m})(),o(b,{get when(){return r.total()>1},get children(){return o(Be,{pager:r})}})]}}),null),w(m=>{var k=!i(),S=`w-full flex items-center text-left text-xs font-semibold uppercase tracking-wider mb-2 ${lc(e.label)} cursor-pointer hover:opacity-80 transition-opacity`,y=`w-3 h-3 mr-1.5 transition-transform ${i()?"":"rotate-90"}`;return k!==m.e&&z(h,"aria-expanded",m.e=k),S!==m.t&&R(h,m.t=S),y!==m.a&&z(d,"class",m.a=y),m},{e:void 0,t:void 0,a:void 0}),c})()},nc=e=>{const t=()=>e.node.dependencies??[];return(()=>{var r=Xo(),n=r.firstChild,s=n.firstChild,i=s.nextSibling;return r.$$click=()=>Ct(e.node.token),l(s,()=>vn(e.node.kind)),l(i,()=>e.node.token),l(n,o(b,{get when(){return e.node.scope},get children(){var u=Wo();return l(u,()=>e.node.scope),u}}),null),l(n,o(b,{get when(){return(e.node.resolveCount??0)>0},get children(){var u=Yo(),a=u.firstChild;return l(u,()=>e.node.resolveCount,a),u}}),null),l(r,o(b,{get when(){return t().length>0},get children(){var u=Qo();return l(u,o(N,{get each(){return t()},children:a=>(()=>{var c=Zo(),h=c.firstChild.nextSibling,d=h.nextSibling;return c.$$click=f=>{f.stopPropagation(),Ct(a)},l(h,()=>sc(a)),l(d,a),w(()=>R(h,`px-1.5 py-0.5 rounded text-xs font-semibold ${ic(a)}`)),c})()})),u}}),null),w(()=>R(s,`px-2 py-0.5 rounded text-xs font-semibold ${pn(e.node.kind)}`)),r})()};function vn(e){return e==="controller"?"ctrl":e==="service"?"svc":e==="repository"?"repo":"other"}function pn(e){return e==="controller"?"bg-violet-900/50 text-violet-300":e==="service"?"bg-blue-900/50 text-blue-300":e==="repository"?"bg-teal-900/50 text-teal-300":"bg-border-strong/50 text-text-strong"}function lc(e){return e==="Controllers"?"text-violet-400":e==="Services"?"text-blue-400":e==="Repositories"?"text-teal-400":"text-text-secondary"}function sc(e){return vn(q.container().find(t=>t.token===e)?.kind)}function ic(e){return pn(q.container().find(t=>t.token===e)?.kind)}ie(["input","click"]);var ac=g("<div class=overflow-x-auto><table><thead><tr><th style=width:140px>Time</th><th style=width:200px>Type</th><th style=width:120px>Source</th><th>Payload</th></tr></thead><tbody>"),oc=g('<div class="bg-surface-1 rounded-xl border border-border p-5"><div class="flex flex-col sm:flex-row gap-3 mb-4 items-stretch sm:items-center"><input type=text placeholder="Filter by event type (substring)…"class="flex-1 bg-surface-2 border border-border-strong rounded-lg px-3 py-2 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex gap-2"><button type=button></button><button type=button class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-surface-2 text-text-secondary border border-border-strong hover:text-text-body transition-colors">Clear</button></div></div><div class="text-xs text-text-muted mb-3 font-mono">/<!> buffered'),cc=g("<div class=empty>"),uc=g('<tr><td class="font-mono text-xs text-text-muted"></td><td class="font-mono text-xs"></td><td class="font-mono text-xs text-text-secondary"></td><td class="font-mono text-xs"><code class="text-text-body break-all">'),dc=()=>{const e=Tt(),[t,r]=x(""),[n,s]=x(!1),[i,u]=x(null),a=()=>{s(d=>{const f=!d;return u(f?e():null),f})},c=H(()=>{const d=i()??e(),f=t().trim().toLowerCase();return[...f?d.filter(v=>v.type.toLowerCase().includes(f)):d].toReversed()}),h=Pe(()=>c());return(()=>{var d=oc(),f=d.firstChild,v=f.firstChild,p=v.nextSibling.firstChild,m=p.nextSibling,k=f.nextSibling,S=k.firstChild,y=S.nextSibling;return y.nextSibling,v.$$input=$=>r($.currentTarget.value),p.$$click=a,l(p,()=>n()?"▶ Resume":"⏸ Pause"),m.$$click=()=>Ro(),l(k,()=>e().length,S),l(k,500,y),l(k,o(b,{get when(){return n()},children:" · paused"}),null),l(k,o(b,{get when(){return t().trim()},get children(){return[' · filter: "',fe(()=>t().trim()),'"']}}),null),l(d,o(b,{get when(){return h.page().length>0},get fallback(){return(()=>{var $=cc();return l($,o(b,{get when(){return e().length===0},fallback:"No events match the current filter",children:"No events yet — emits from kickjs-db, plugins, or the panel itself land here."})),$})()},get children(){return[(()=>{var $=ac(),L=$.firstChild.firstChild.nextSibling;return l(L,o(N,{get each(){return h.page()},children:A=>(()=>{var O=uc(),K=O.firstChild,V=K.nextSibling,F=V.nextSibling,B=F.nextSibling.firstChild;return l(K,()=>gn(A.ts)),l(V,()=>A.type),l(F,()=>A.pluginId??"—"),l(B,()=>jo(A.payload)),O})()})),$})(),o(Be,{pager:h})]}}),null),w(()=>R(p,`px-3 py-1.5 text-xs font-semibold rounded-lg border transition-colors ${n()?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`)),w(()=>v.value=t()),d})()};ie(["input","click"]);var hc=g("<div style=display:flex;flex-direction:column;height:100%>"),fc=g('<iframe title="custom devtools tab"sandbox="allow-scripts allow-same-origin allow-forms"style=flex:1;width:100%;border:none;background:var(--bg)>'),gc=g("<div style=padding:16px><div class=card>"),vc=g("<div style=color:var(--text-dim);font-size:12px>"),pc=g('<div style="display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border)"><div><div style=font-weight:600></div></div><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:6px 14px;border-bottom-color:var(--border)">'),mc=g("<div class=card><div class=card-title>Last response</div><code>"),bc=g("<div style=padding:16px;flex:1;overflow:auto>"),xc=e=>(()=>{var t=hc();return l(t,o(b,{get when(){return e.tab.view.type==="iframe"},get children(){return o($c,{get view(){return e.tab.view}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="launch"},get children(){return o(yc,{get view(){return e.tab.view},get tabId(){return e.tab.id}})}}),null),l(t,o(b,{get when(){return e.tab.view.type==="html"},get children(){return o(_c,{get view(){return e.tab.view}})}}),null),t})(),$c=e=>{const t=()=>{const r=e.view.src,n=(r.startsWith("http")||r.startsWith("//"),r),s=De();return s?`${n}${n.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`:n};return(()=>{var r=fc();return w(()=>z(r,"src",t())),r})()},yc=e=>{const[t,r]=x(null),[n,s]=x(null),i=async u=>{r(u),s(null);try{const a=`${Ie()}/tabs/${encodeURIComponent(e.tabId)}/actions/${encodeURIComponent(u)}`,c=De(),h=await fetch(c?`${a}?token=${encodeURIComponent(c)}`:a,{method:"POST",headers:c?{"x-devtools-token":c}:void 0});s(`${h.status} ${h.statusText}`)}catch(a){s(a instanceof Error?a.message:String(a))}finally{r(null)}};return(()=>{var u=gc(),a=u.firstChild;return l(a,o(N,{get each(){return e.view.actions},children:c=>(()=>{var h=pc(),d=h.firstChild,f=d.firstChild,v=d.nextSibling;return l(f,()=>c.label),l(d,o(b,{get when(){return c.description},get children(){var p=vc();return l(p,()=>c.description),p}}),null),v.$$click=()=>{i(c.id)},l(v,()=>t()===c.id?"Running…":"Run"),w(()=>v.disabled=t()===c.id),h})()})),l(u,o(b,{get when(){return n()},children:c=>(()=>{var h=mc(),d=h.firstChild.nextSibling;return l(d,c),h})()}),null),u})()},_c=e=>(()=>{var t=bc();return w(()=>t.innerHTML=e.view.html),t})();ie(["click"]);var Et=!1,Ze=null,$t=null;async function wc(){return X.setConnectionStatus("connecting"),await Zt(),$t=ir("/stream",e=>{if(!Et){if(X.setConnectionStatus("live"),mn(),e.type==="metrics"){Sc(e),X.touch();return}if(e.type==="container"){Zt();return}}},()=>{Et||(X.setConnectionStatus("polling"),kc())}),Cc}async function Zt(){const e=await Promise.allSettled([ge.health(),ge.metrics(),ge.routeRegistry(),ge.container(),ge.queues(),ge.ws()]);if(e.every(a=>a.status==="rejected"&&a.reason instanceof ln)){X.setAuthRequired(!0),X.setConnectionStatus("disconnected");return}q.authRequired()&&(X.setAuthRequired(!1),X.setAuthError(null));const[t,r,n,s,i,u]=e;t.status==="fulfilled"&&X.setHealth({status:t.value.status,errorRate:t.value.errorRate,uptime:t.value.uptime,adapters:t.value.adapters??{}}),r.status==="fulfilled"&&X.setMetrics({requests:r.value.requests,serverErrors:r.value.serverErrors,clientErrors:r.value.clientErrors,errorRate:r.value.errorRate,uptimeSeconds:r.value.uptimeSeconds,startedAt:r.value.startedAt}),n.status==="fulfilled"&&X.setRoutes(n.value.routes??[]),s.status==="fulfilled"&&X.setContainer(s.value.registrations??[]),i.status==="fulfilled"&&X.setQueues({enabled:i.value.enabled,queues:i.value.queues??[]}),u.status==="fulfilled"&&X.setWs(u.value),X.touch()}function Sc(e){const t=q.metrics();if(!t)return;X.setMetrics({...t,requests:e.requestCount,serverErrors:e.errorCount,clientErrors:e.clientErrorCount,errorRate:e.errorRate,uptimeSeconds:e.uptimeSeconds});const r=q.health();r&&X.setHealth({...r,uptime:e.uptimeSeconds,errorRate:e.errorRate})}function kc(){Ze||(Ze=setInterval(()=>{Et||Zt()},5e3))}function mn(){Ze&&(clearInterval(Ze),Ze=null)}function Cc(){Et=!0,mn(),$t&&($t(),$t=null),X.setConnectionStatus("disconnected")}var Tc=g('<div class="fixed inset-0 z-[60] bg-slate-950/90 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-8 max-w-md w-full shadow-2xl"><div class="text-center mb-6"><h2 class="text-xl font-bold text-kick-500 mb-2">⚡ KickJS DevTools</h2><p class="text-sm text-slate-400">Enter your DevTools token to continue.</p><p class="text-xs text-slate-600 mt-1">The token is printed in the server console on startup, e.g. <code class="font-mono text-slate-500">[token: abc123…]</code></p></div><form><input type=text autofocus placeholder="Paste your token here…"class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-3 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-kick-500 font-mono mb-3"><button type=submit class="w-full bg-kick-500 hover:bg-kick-600 text-white font-semibold py-2.5 rounded-lg transition-colors disabled:opacity-50">'),Ec=g('<p class="text-red-400 text-sm mb-3">'),Ac=()=>{const[e,t]=x(""),[r,n]=x(!1),s=async()=>{const i=e().trim();if(!i){X.setAuthError("Token is required");return}n(!0),X.setAuthError(null);try{Jt(i),await ge.health(),X.setAuthRequired(!1),X.setAuthError(null),t("")}catch{X.setAuthError("Invalid token — request was rejected.")}finally{n(!1)}};return o(b,{get when(){return q.authRequired()},get children(){var i=Tc(),u=i.firstChild.firstChild.nextSibling,a=u.firstChild,c=a.nextSibling;return u.addEventListener("submit",h=>{h.preventDefault(),s()}),a.$$input=h=>t(h.currentTarget.value),l(u,o(b,{get when(){return q.authError()},children:h=>(()=>{var d=Ec();return l(d,h),d})()}),c),l(c,()=>r()?"Verifying…":"Authenticate"),w(()=>c.disabled=r()),w(()=>a.value=e()),i}})};ie(["input"]);var Mc=g("<div class=dt-nav-sep>"),Lc=g('<div class=card style=border-color:var(--warn);margin-top:16px><div class=card-title style=color:var(--warn)> custom-tab issue(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),Rc=g("<div class=app><header class=dt-header><div class=dt-header-brand><span class=dt-bolt aria-hidden=true>⚡</span><h1>KickJS DevTools</h1></div><div style=display:flex;align-items:center;gap:12px></div></header><div class=dt-shell><aside class=dt-sidebar role=tablist></aside><div class=dt-resizer role=separator aria-orientation=vertical></div><main class=dt-main role=tabpanel>"),Dt=g("<button type=button role=tab><span class=dt-nav-label>"),Dr=g("<span class=tab-badge>"),Oc=g("<div class=dt-nav-group><button type=button class=dt-nav-group-header><span>▾"),jc=g("<li>: "),Nc=g("<div class=dt-conn><span aria-hidden=true></span><span class=dt-conn-label></span><span class=dt-conn-sep>·</span><span class=dt-conn-ts>Updated "),Ic=g("<div class=dt-settings-pop role=menu><div class=dt-settings-section><div class=dt-settings-label>Density</div><div class=dt-seg></div><div class=dt-settings-hint>Controls spacing & font scale. Default: Small."),Pc=g('<div class=dt-settings><button type=button aria-label=Settings aria-haspopup=true title=Settings><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=3></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.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-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z">'),Bc=g("<button type=button>"),qc=g('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z">'),Dc=g("<button type=button class=dt-theme-toggle>"),Uc=g('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=4></circle><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41">');function bn(){return[{id:"overview",label:"Overview"},{id:"runtime",label:"Runtime"},{id:"memory",label:"Memory"},{id:"topology",label:"Topology"},{id:"routes",label:"Routes",count:()=>q.routes().length||void 0},{id:"metrics",label:"Metrics"},{id:"container",label:"Container",count:()=>q.container().length||void 0},{id:"queues",label:"Queues",count:()=>q.queues().queues.length||void 0},{id:"database",label:"Database",count:()=>Tt()().filter(e=>e.type==="db:query"||e.type==="db:query-error").length||void 0},{id:"graph",label:"Graph",count:()=>q.container().length||void 0},{id:"activity",label:"Activity",count:()=>Tt()().length||void 0}]}var Fc=new Set(bn().map(e=>e.id)),Hc=[{label:null,ids:["overview"]},{label:"Runtime",ids:["runtime","memory","topology","metrics"]},{label:"Architecture",ids:["routes","container","graph"]},{label:"Data & Jobs",ids:["database","queues"]},{label:null,ids:["activity"]}],xn="kickjs-devtools-sidebar-w",$n="kickjs-devtools-sidebar-collapsed",yn=150,_n=360;function zc(){try{const e=Number(localStorage.getItem(xn));if(e>=yn&&e<=_n)return e}catch{}return 200}function Vc(){try{const e=localStorage.getItem($n);if(e)return JSON.parse(e)}catch{}return[]}var Gc=()=>{const e=(()=>{try{const $=localStorage.getItem("kickjs-devtools-tab");if($)return $}catch{}return"overview"})(),[t,r]=x(e),[n,s]=x([]),[i,u]=x([]),a=bn(),c=new Map(a.map($=>[$.id,$])),[h,d]=x(zc()),[f,v]=x(Vc()),p=$=>{v(L=>{const A=L.includes($)?L.filter(O=>O!==$):[...L,$];try{localStorage.setItem($n,JSON.stringify(A))}catch{}return A})};let m=null;$e(()=>m?.());const k=$=>{$.preventDefault();const L=$.clientX,A=h();document.body.style.cursor="col-resize";const O=F=>{const B=Math.min(_n,Math.max(yn,A+(F.clientX-L)));d(B)},K=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",V),document.body.style.cursor="",m=null},V=()=>{K();try{localStorage.setItem(xn,String(h()))}catch{}};m=K,document.addEventListener("mousemove",O),document.addEventListener("mouseup",V)};Je(()=>{ge.tabs().then(({tabs:A,errors:O})=>{s(A.filter(K=>!Fc.has(K.id))),u(O)}).catch(()=>{});let $=null;wc().then(A=>{$=A});const L=Lo();$e(()=>{$?.(),L()}),rl(),il()});const S=$=>{r($);try{localStorage.setItem("kickjs-devtools-tab",$)}catch{}queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${$}"]`)?.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})})},y=()=>n().find($=>$.id===t());return(()=>{var $=Rc(),L=$.firstChild,A=L.firstChild.nextSibling,O=L.nextSibling.firstChild,K=O.nextSibling,V=K.nextSibling;return l(A,o(Jc,{}),null),l(A,o(Yc,{}),null),l(A,o(Wc,{}),null),l(O,o(N,{each:Hc,children:F=>o(b,{get when(){return F.label},get fallback(){return o(N,{get each(){return F.ids},children:B=>{const le=c.get(B);return o(b,{when:le,children:Y=>(()=>{var Z=Dt(),G=Z.firstChild;return Z.$$click=()=>S(B),z(Z,"data-tab-id",B),l(G,()=>Y().label),l(Z,o(b,{get when(){return Y().count?.()},children:Q=>(()=>{var ee=Dr();return l(ee,Q),ee})()}),null),w(Q=>{var ee=`dt-nav-item ${t()===B?"active":""}`,de=t()===B;return ee!==Q.e&&R(Z,Q.e=ee),de!==Q.t&&z(Z,"aria-selected",Q.t=de),Q},{e:void 0,t:void 0}),Z})()})}})},children:B=>(()=>{var le=Oc(),Y=le.firstChild,Z=Y.firstChild;return Y.$$click=()=>p(B()),l(Y,B,null),l(le,o(b,{get when(){return!f().includes(B())},get children(){return o(N,{get each(){return F.ids},children:G=>{const Q=c.get(G);return o(b,{when:Q,children:ee=>(()=>{var de=Dt(),pe=de.firstChild;return de.$$click=()=>S(G),z(de,"data-tab-id",G),l(pe,()=>ee().label),l(de,o(b,{get when(){return ee().count?.()},children:ne=>(()=>{var ae=Dr();return l(ae,ne),ae})()}),null),w(ne=>{var ae=`dt-nav-item nested ${t()===G?"active":""}`,Ee=t()===G;return ae!==ne.e&&R(de,ne.e=ae),Ee!==ne.t&&z(de,"aria-selected",ne.t=Ee),ne},{e:void 0,t:void 0}),de})()})}})}}),null),w(G=>{var Q=!f().includes(B()),ee=`dt-nav-caret ${f().includes(B())?"closed":""}`;return Q!==G.e&&z(Y,"aria-expanded",G.e=Q),ee!==G.t&&R(Z,G.t=ee),G},{e:void 0,t:void 0}),le})()})}),null),l(O,o(b,{get when(){return n().length>0},get children(){return[Mc(),o(N,{get each(){return n()},children:F=>(()=>{var B=Dt(),le=B.firstChild;return B.$$click=()=>S(F.id),l(le,()=>F.title),w(Y=>{var Z=F.id,G=`dt-nav-item ${t()===F.id?"active":""}`,Q=t()===F.id,ee=F.title;return Z!==Y.e&&z(B,"data-tab-id",Y.e=Z),G!==Y.t&&R(B,Y.t=G),Q!==Y.a&&z(B,"aria-selected",Y.a=Q),ee!==Y.o&&z(B,"title",Y.o=ee),Y},{e:void 0,t:void 0,a:void 0,o:void 0}),B})()})]}}),null),K.$$mousedown=k,l(V,o(b,{get when(){return t()==="overview"},get children(){return o(Jl,{})}}),null),l(V,o(b,{get when(){return t()==="runtime"},get children(){return o(os,{})}}),null),l(V,o(b,{get when(){return t()==="memory"},get children(){return o(Ss,{})}}),null),l(V,o(b,{get when(){return t()==="topology"},get children(){return o(ti,{})}}),null),l(V,o(b,{get when(){return t()==="routes"},get children(){return o(Sa,{})}}),null),l(V,o(b,{get when(){return t()==="metrics"},get children(){return o(Oa,{})}}),null),l(V,o(b,{get when(){return t()==="container"},get children(){return o(co,{})}}),null),l(V,o(b,{get when(){return t()==="queues"},get children(){return o(Co,{})}}),null),l(V,o(b,{get when(){return t()==="database"},get children(){return o(Ho,{})}}),null),l(V,o(b,{get when(){return t()==="graph"},get children(){return o(tc,{})}}),null),l(V,o(b,{get when(){return t()==="activity"},get children(){return o(dc,{})}}),null),l(V,o(b,{get when(){return y()},children:F=>o(xc,{get tab(){return F()}})}),null),l(V,o(b,{get when(){return fe(()=>i().length>0)()&&t()==="overview"},get children(){var F=Lc(),B=F.firstChild,le=B.firstChild,Y=B.nextSibling;return l(B,()=>i().length,le),l(Y,o(N,{get each(){return i()},children:Z=>(()=>{var G=jc(),Q=G.firstChild;return l(G,()=>Z.source,Q),l(G,()=>Z.reason,null),G})()})),F}}),null),l($,o(za,{}),null),l($,o(va,{}),null),l($,o(Ac,{}),null),w(F=>rr(O,`width:${h()}px`,F)),$})()},Jc=()=>{const e=r=>r==="live"?"Live":r==="polling"?"Polling":r==="disconnected"?"Disconnected":"Connecting…",t=r=>r?r.toLocaleTimeString():"never";return(()=>{var r=Nc(),n=r.firstChild,s=n.nextSibling,i=s.nextSibling.nextSibling;return i.firstChild,l(s,()=>e(q.connectionStatus())),l(i,()=>t(q.lastUpdate()),null),w(()=>R(n,`dt-pulse dt-pulse-${q.connectionStatus()}`)),r})()},Kc=[{id:"sm",label:"Small"},{id:"md",label:"Medium"},{id:"lg",label:"Large"}],Wc=()=>{const[e,t]=x(!1);let r;const n=i=>{e()&&r&&!r.contains(i.target)&&t(!1)},s=i=>{i.key==="Escape"&&t(!1)};return document.addEventListener("click",n),document.addEventListener("keydown",s),$e(()=>{document.removeEventListener("click",n),document.removeEventListener("keydown",s)}),(()=>{var i=Pc(),u=i.firstChild;return Kn(a=>r=a,i),u.$$click=()=>t(a=>!a),l(i,o(b,{get when(){return e()},get children(){var a=Ic(),c=a.firstChild.firstChild.nextSibling;return l(c,o(N,{each:Kc,children:h=>(()=>{var d=Bc();return d.$$click=()=>sl(h.id),l(d,()=>h.label),w(f=>{var v=`dt-seg-item ${br()===h.id?"active":""}`,p=br()===h.id;return v!==f.e&&R(d,f.e=v),p!==f.t&&z(d,"aria-pressed",f.t=p),f},{e:void 0,t:void 0}),d})()})),a}}),null),w(a=>{var c=`dt-settings-btn ${e()?"open":""}`,h=e();return c!==a.e&&R(u,a.e=c),h!==a.t&&z(u,"aria-expanded",a.t=h),a},{e:void 0,t:void 0}),i})()},Yc=()=>{const e=()=>{const r=Ot()==="system"?"light":Ot()==="light"?"dark":"system";tl(r)},t=()=>{const r=Ot();return`Theme: ${r==="system"?"follow system":r} (click to cycle)`};return(()=>{var r=Dc();return r.$$click=e,l(r,o(b,{get when(){return Xr()==="dark"},get fallback(){return Uc()},get children(){return qc()}})),w(n=>{var s=t(),i=t();return s!==n.e&&z(r,"aria-label",n.e=s),i!==n.t&&z(r,"title",n.t=i),n},{e:void 0,t:void 0}),r})()};ie(["mousedown","click"]);var wn=document.getElementById("root");if(!wn)throw new Error("#root not found");Jn(()=>o(Gc,{}),wn);
|
|
8
|
+
await fetch(${JSON.stringify(e.url)}, ${s})`}return typeof e.body=="string"&&(t.body=e.body),`await fetch(${JSON.stringify(e.url)}, ${JSON.stringify(t,null,2)})`}function Ns(e,t){if(!t?.includes("json"))return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}var Nt=e=>`kickjs-devtools:runner:${e.method.toUpperCase()} ${e.path}`,Yn=e=>{const t=e.upload&&e.upload.mode!=="none"?e.upload:void 0;return{params:Object.fromEntries(qt(e.path).map(r=>[r,""])),query:[],headers:[],body:"",bodyMode:t?"form":"raw",form:t?[{key:t.fieldName??"file",value:"",enabled:!0,type:"file"}]:[]}};function Wn(e){return{...e,form:e.form?.map(({files:t,...r})=>r)}}function Ps(e,t,r=30){return[{...t,inputs:Wn(t.inputs)},...e].slice(0,r)}var Is=e=>Vn("",e.path,e.inputs.params,e.inputs.query);function Ds(e,t){for(const[r,s]of Object.entries(e?.paths??{}))if(r.replace(/\{([^}]+)\}/g,":$1")===t.path)return s?.[t.method.toLowerCase()]}function Qn(e,t){const r=t?.$ref;if(typeof r!="string"||!r.startsWith("#/"))return t;let s=e;for(const l of r.slice(2).split("/"))s=s?.[l];return s}function ot(e,t,r=0){const s=Qn(e,t);if(!s||r>6)return null;if(s.example!==void 0)return s.example;if(s.default!==void 0)return s.default;if(Array.isArray(s.enum)&&s.enum.length)return s.enum[0];const l=s.oneOf?.[0]??s.anyOf?.[0];if(l)return ot(e,l,r+1);if(s.allOf)return Object.assign({},...s.allOf.map(a=>ot(e,a,r+1)));switch((Array.isArray(s.type)?s.type.find(a=>a!=="null"):s.type)??(s.properties?"object":void 0)){case"object":return Object.fromEntries(Object.entries(s.properties??{}).map(([a,i])=>[a,ot(e,i,r+1)]));case"array":return s.items?[ot(e,s.items,r+1)]:[];case"string":return"";case"integer":case"number":return 0;case"boolean":return!1;default:return null}}function Us(e,t){const r=Ds(e,t);if(!r)return;const s={},l=[];for(const i of r.parameters??[]){const u=Qn(e,i);u?.name&&(u.in==="path"&&u.description&&(s[u.name]=u.description),u.in==="query"&&l.push({name:u.name,required:!!u.required,description:u.description}))}const a=r.requestBody?.content?.["application/json"]?.schema;return{summary:r.summary??r.description,params:s,query:l,...a?{body:JSON.stringify(ot(e,a),null,2)}:{}}}function tn(e,t){const r=new Set(e.query.map(a=>a.key)),s=[...e.query,...t.query.filter(a=>!r.has(a.name)).map(a=>({key:a.name,value:"",enabled:a.required}))],l=e.body.trim()||!t.body?e.body:t.body;return{...e,query:s,body:l}}function js(e,t,r){const s=t.replace(/\\/g,"/").replace(/^(?=[A-Za-z]:)/,"/");return e.replace("{file}",encodeURI(s)).replace("{line}",String(r))}var Hs=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select a route to try it'),Bs=d('<p class="text-sm text-text-secondary mt-1">'),zs=d('<p class="text-xs text-amber-400 mt-2">No value for <!> — add it under Environment → Variables.'),Fs=d('<label class="flex items-start gap-2 text-sm mb-3"><input type=checkbox class=mt-1><span>Remember on this browser<span class="block text-xs text-text-muted">'),Ks=d('<h3 class="text-xs font-semibold text-text-secondary mb-1">Default headers'),Js=d('<p class="text-xs text-text-muted mb-2">Sent with every route. A default Authorization is skipped on routes carrying a public flag.'),Vs=d('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Variables'),Gs=d('<p class="text-xs text-text-muted mb-2">Use <code>{{name}}</code> in any param, query, header or body value — e.g. a default header <code>Authorization: Bearer {{token}}</code>. Fill them by hand or with "Save to variable" on a response.'),Ys=d('<h3 class="text-xs font-semibold text-text-secondary mt-4 mb-1">Settings'),Ws=d('<div class="grid grid-cols-1 sm:grid-cols-2 gap-3"><label class="flex flex-col gap-1 text-xs text-text-muted">Public route flags (comma-separated)<input>'),Qs=d('<span class="text-xs text-text-muted"role=status>'),Xs=d('<div class="flex items-center gap-1 mb-2"><button type=button>Copy'),Zs=d('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all select-text">'),ea=d('<div class="text-sm text-red-400 bg-red-500/10 border border-red-500/30 rounded-lg p-3">Request failed: '),ta=d('<ul class="flex flex-col gap-1">'),ra=d("<button type=button>Clear history"),na=d('<div class="h-full flex flex-col min-h-0"><section class="h-full bg-surface-1 flex flex-col min-h-0"><header class="px-5 py-4 border-b border-border"><div class="flex items-start justify-between gap-4"><div class=min-w-0><div class="flex items-center gap-2"><span></span><h2 class="text-base font-semibold font-mono text-text-body break-all"></h2></div><p class="text-xs text-text-muted mt-1"><button type=button class="underline decoration-dotted hover:text-kick-500"title="Open in editor">.</button></p></div><button type=button class="text-text-muted hover:text-text-strong p-1 text-lg leading-none"aria-label=Close>✕</button></div><div class="flex items-stretch gap-2 mt-3"><div class="flex-1 min-w-0 flex items-center gap-2 font-mono text-xs bg-surface-2 border border-border rounded-lg px-3 py-2 text-text-secondary"><span></span><span class=break-all></span></div><button type=button></button></div></header><div class="flex-1 overflow-y-auto px-5 py-3 flex flex-col gap-2">'),jr=d('<div class="flex flex-col gap-2">'),la=d('<ul class="text-xs text-text-muted mt-2 flex flex-col gap-0.5">'),sa=d('<span class="text-xs text-text-muted ml-2">@FileUpload: field <code>'),aa=d('<div class="flex items-center gap-1 mb-2">'),oa=d(`<p class="text-xs text-text-muted mt-2">Sent as multipart/form-data. Picked files aren't saved — pick them again after reopening.`),ia=d('<label class="flex items-center gap-3 text-sm"><span class="font-mono text-text-secondary w-28 shrink-0">:</span><input>'),ca=d("<li><code>"),rn=d("<button type=button>"),ua=d('<textarea placeholder="{ "name": "value" }">'),da=d("<button type=button>Fill empty inputs from OpenAPI"),fa=d('<label class="flex flex-col gap-1 text-xs text-text-muted"><input>'),ha=d('<details class="text-xs mb-2"><summary class="cursor-pointer text-text-secondary">Response headers (<!>)</summary><table class=mt-2><tbody>'),ga=d('<pre class="text-xs font-mono bg-surface-2 border border-border rounded-lg p-3 overflow-x-auto max-h-[50vh] whitespace-pre-wrap break-all">'),ma=d('<div class="flex flex-col sm:flex-row sm:items-center gap-2 mt-3 text-xs"><span class="text-text-secondary font-semibold shrink-0">Save to variable</span><input placeholder="JSON path, e.g. data.accessToken"><input placeholder="variable, e.g. token"><button type=button>Save'),va=d('<p class="text-xs text-text-muted mt-1"role=status>'),pa=d('<p class="mt-1 text-xs text-text-muted">Body truncated to <!> characters.'),xa=d('<span class="flex items-center gap-3">Response<span> </span><span class="text-text-muted text-xs font-normal"> ms'),ba=d('<tr><td class="font-mono text-text-secondary pr-4"></td><td class="font-mono break-all">'),$a=d('<p class="text-xs text-text-muted">Nothing sent yet.'),ya=d('<li><button type=button class="w-full flex items-center gap-2 text-xs text-left rounded px-2 py-1 hover:bg-surface-2"title="Open with these inputs"><span></span><span class="font-mono truncate flex-1"></span><span></span><span class="text-text-muted w-16 text-right"> ms</span><span class="text-text-muted w-16 text-right">'),wa=d('<span class="text-xs font-normal text-text-muted">(<!>)'),_a=d('<details class="border border-border rounded-lg bg-surface-1 group"><summary class="cursor-pointer select-none px-3 py-2 text-sm font-semibold text-text-body flex items-center gap-2"><span class="text-text-muted transition-transform group-open:rotate-90">▸</span></summary><div class="px-3 pb-3">'),ka=d("<label><input type=file class=sr-only>"),Sa=d('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><select aria-label="Field type"><option value=text>Text</option><option value=file>File</option></select><input placeholder=name>'),Ca=d("<input placeholder=value>"),Ea=d('<div class="flex items-center gap-2"><input type=checkbox aria-label=Enabled><input placeholder=name><input placeholder=value>'),Zt="kickjs-devtools:runner:defaults",er="kickjs-devtools:runner:variables",nn="kickjs-devtools:runner:settings",Xn="kickjs-devtools:runner:remember",ln="kickjs-devtools:runner:history",tr=2e5,[Oe,$r]=R(null),lt=0,it=null,[Zn,sn]=R({});function Ma(e){e in Ae(Zn)||(sn(t=>({...t,[e]:void 0})),fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.json():null).catch(()=>null).then(t=>sn(r=>({...r,[e]:t}))))}var[Ta,Aa]=R(0);function Jt(e,t){if(t){const r=yr(()=>localStorage,Nt(e),Yn(e));it={...r,params:{...r.params,...t}}}$r(e),Aa(r=>r+1),rt("routes")}function yr(e,t,r){try{const s=e().getItem(t);return s?{...r,...JSON.parse(s)}:r}catch{return r}}function an(e,t){try{const r=JSON.parse(e().getItem(t)??"[]");return Array.isArray(r)?r:[]}catch{return[]}}function on(e,t){try{e().removeItem(t)}catch{}}function La(){try{return localStorage.getItem(Xn)==="true"}catch{return!1}}function We(e,t,r){try{e().setItem(t,JSON.stringify(r))}catch{}}var kt=e=>e.filter(t=>t.enabled&&t.key).length,Ra=()=>{const[e,t]=R(null),[r,s]=R(La()),l=()=>r()?localStorage:sessionStorage,a=()=>r()?sessionStorage:localStorage,[i,u]=R(an(l,Zt)),[c,h]=R(an(l,er)),[f,p]=R({path:"",name:""}),[v,x]=R(null),[w,M]=R(yr(()=>localStorage,nn,ws)),[y,m]=R(!1),[S,b]=R(!1),[g,$]=R(null),[C,O]=R(null),[q,T]=R(null),[D,U]=R("curl"),[re,Q]=R((()=>{try{const L=JSON.parse(localStorage.getItem(ln)??"[]");return Array.isArray(L)?L:[]}catch{return[]}})()),[k,A]=R(null),[J,V]=R(!1),B=se(()=>{const L=Oe(),z=Zn()[w().openApiUrl];return L&&z?Us(z,L):void 0});qe(()=>{const L=Oe();if(Ta(),lt++,!L)return;let z=!1;try{z=localStorage.getItem(Nt(L))===null}catch{}const fe=it??yr(()=>localStorage,Nt(L),Yn(L));it=null;const be=Object.fromEntries(qt(L.path).map(ke=>[ke,fe.params[ke]??""]));t({...fe,params:be}),V(z),A(null),$(null),O(null),m(!1),b(!1)}),qe(()=>{const L=Oe(),z=e();L&&z&&We(()=>localStorage,Nt(L),Wn(z))}),qe(()=>{We(l,Zt,i()),We(l,er,c()),on(a,Zt),on(a,er),We(()=>localStorage,Xn,r())}),qe(()=>We(()=>localStorage,nn,w())),qe(()=>We(()=>localStorage,ln,re())),qe(()=>{Oe()&&Ma(w().openApiUrl)}),qe(()=>{const L=B();!L||!J()||(V(!1),t(z=>z&&tn(z,L)))});const I=se(()=>{const L=Oe(),z=e();return!L||!z?null:Ls({route:L,inputs:z,defaults:i(),variables:Ts(c()),settings:w(),origin:window.location.origin,cookies:document.cookie})}),ie=()=>$r(null),E=L=>{m(!1),t(z=>z&&{...z,...L})};async function P(){const L=I();if(!L)return;if(Ss(L.method)&&!y()){m(!0);return}m(!1),b(!0),O(null);const z=performance.now(),fe=lt,be=Oe(),ke=e(),Ce=me=>Q(ge=>Ps(ge,{at:Date.now(),method:be.method.toUpperCase(),path:be.path,inputs:ke,ms:Math.round(performance.now()-z),...me}));try{const me=await fetch(L.url,{method:L.method,headers:L.headers,body:L.body,credentials:"same-origin"}),ge=await me.text();if(Ce({status:me.status}),fe!==lt)return;$({status:me.status,statusText:me.statusText,ms:Math.round(performance.now()-z),headers:[...me.headers.entries()],raw:ge,body:Ns(ge.slice(0,tr),me.headers.get("content-type")),truncated:ge.length>tr})}catch(me){if(Ce({error:me instanceof Error?me.message:String(me)}),fe!==lt)return;$(null),O(me instanceof Error?me.message:String(me))}finally{fe===lt&&b(!1)}}const Y=se(()=>{const L=I();return L?D()==="curl"?Os(L):qs(L):""});async function Z(){try{await navigator.clipboard.writeText(Y()),T("Copied")}catch{T("Copy failed — select the text instead")}setTimeout(()=>T(null),1500)}function H(){const L=g(),{path:z,name:fe}=f();if(!L||!z.trim()||!fe.trim())return;let be;try{be=JSON.parse(L.raw)}catch{x("The response is not JSON");return}const ke=As(be,z.trim());if(ke===void 0){x(`Nothing at "${z.trim()}"`);return}const Ce=fe.trim(),me=c();h(me.some(ge=>ge.key===Ce)?me.map(ge=>ge.key===Ce?{...ge,value:ke,enabled:!0}:ge):[...me,{key:Ce,value:ke,enabled:!0}]),x(`Saved {{${Ce}}}`)}function ne(L){const z=ae.routes().find(fe=>fe.method.toUpperCase()===L.method&&fe.path===L.path);z&&(it=L.inputs,z===Oe()?(it=null,E(L.inputs)):$r(z))}async function W(){const L=Oe();if(L){A(null);try{const z=await we.source(L.controller,L.handler);window.location.href=js(w().editorUrl,z.file,z.line),A(`${z.relative}:${z.line}`)}catch{A("Source not found under src/")}}}const de=()=>{const L=Oe();return L?Jn(L,w()):!1};return o(_,{get when(){return Oe()},get fallback(){return Hs()},children:L=>(()=>{var z=na(),fe=z.firstChild,be=fe.firstChild,ke=be.firstChild,Ce=ke.firstChild,me=Ce.firstChild,ge=me.firstChild,xt=ge.nextSibling,Ve=me.nextSibling,ze=Ve.firstChild,bt=ze.firstChild,$t=Ce.nextSibling,Hr=ke.nextSibling.firstChild,Vt=Hr.firstChild,pl=Vt.nextSibling,yt=Hr.nextSibling,Ge=be.nextSibling;return n(ge,()=>L().method.toUpperCase()),n(xt,()=>L().path),ze.$$click=W,n(ze,()=>L().controller,bt),n(ze,()=>L().handler,null),n(Ve,o(_,{get when(){return k()},get children(){return[" · ",le(()=>k())]}}),null),n(Ve,o(_,{get when(){return de()},children:" · public route — default Authorization not sent"}),null),n(Ce,o(_,{get when(){return B()?.summary},get children(){var G=Bs();return n(G,()=>B().summary),G}}),null),$t.$$click=ie,n(Vt,()=>L().method.toUpperCase()),n(pl,()=>I()?.url),yt.$$click=P,n(yt,(()=>{var G=le(()=>!!S());return()=>G()?"Sending…":le(()=>!!y())()?`Confirm ${L().method.toUpperCase()}`:"Send"})()),n(be,o(_,{get when(){return le(()=>!!I())()&&en(I()).length>0},get children(){var G=zs(),K=G.firstChild.nextSibling;return K.nextSibling,n(G,()=>en(I()).map(ee=>`{{${ee}}}`).join(", "),K),G}}),null),n(Ge,o(_,{get when(){return e()},children:G=>[o(_,{get when(){return qt(L().path).length>0},get children(){return o(je,{title:"Path params",open:!0,get children(){var K=jr();return n(K,o(te,{get each(){return qt(L().path)},children:ee=>(()=>{var ce=ia(),oe=ce.firstChild;oe.firstChild;var ue=oe.nextSibling;return n(oe,ee,null),ue.$$input=Me=>E({params:{...G().params,[ee]:Me.currentTarget.value}}),j(ue,Le),N(()=>X(ue,"placeholder",B()?.params[ee])),N(()=>ue.value=G().params[ee]??""),ce})()})),K}})}}),o(je,{title:"Query",get count(){return kt(G().query)},get children(){return[o(St,{get rows(){return G().query},onChange:K=>E({query:K})}),o(_,{get when(){return B()?.query.length},get children(){var K=la();return n(K,o(te,{get each(){return B().query},children:ee=>(()=>{var ce=ca(),oe=ce.firstChild;return n(oe,()=>ee.name),n(ce,()=>ee.required?" (required)":"",null),n(ce,(()=>{var ue=le(()=>!!ee.description);return()=>ue()?` — ${ee.description}`:""})(),null),ce})()})),K}})]}}),o(je,{title:"Headers",get count(){return kt(G().headers)},get children(){return o(St,{get rows(){return G().headers},onChange:K=>E({headers:K})})}}),o(_,{get when(){return br(L().method)},get children(){return o(je,{title:"Body",open:!0,get children(){return[(()=>{var K=aa();return n(K,o(te,{each:[["raw","Raw"],["form","Form data"]],children:([ee,ce])=>(()=>{var oe=rn();return oe.$$click=()=>E({bodyMode:ee}),n(oe,ce),N(ue=>{var Me=(G().bodyMode??"raw")===ee,De=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${(G().bodyMode??"raw")===ee?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return Me!==ue.e&&X(oe,"aria-pressed",ue.e=Me),De!==ue.t&&j(oe,ue.t=De),ue},{e:void 0,t:void 0}),oe})()}),null),n(K,o(_,{get when(){return le(()=>!!L().upload)()&&L().upload.mode!=="none"},get children(){var ee=sa(),ce=ee.firstChild.nextSibling;return n(ce,()=>L().upload.fieldName??"file"),n(ee,(()=>{var oe=le(()=>L().upload.mode==="array");return()=>oe()?`, up to ${L().upload.maxCount??10} files`:", one file"})(),null),ee}}),null),K})(),o(_,{get when(){return G().bodyMode==="form"},get fallback(){return(()=>{var K=ua();return K.$$input=ee=>E({body:ee.currentTarget.value}),j(K,`${Le} font-mono min-h-40`),N(()=>K.value=G().body),K})()},get children(){return[o(Oa,{get rows(){return G().form??[]},get multiple(){return L().upload?.mode==="array"},onChange:K=>E({form:K})}),oa()]}})]}})}})]}),null),n(Ge,o(je,{title:"Environment",get count(){return kt(i())+kt(c())},get children(){return[(()=>{var G=Fs(),K=G.firstChild,ee=K.nextSibling.firstChild.nextSibling;return K.addEventListener("change",ce=>s(ce.currentTarget.checked)),n(ee,()=>r()?"Default headers and variables are saved in localStorage and survive closing the tab. They may hold tokens — turn this off on a shared machine.":"Default headers and variables are kept for this browser tab only."),N(()=>K.checked=r()),G})(),Ks(),Js(),o(St,{get rows(){return i()},onChange:u}),Vs(),Gs(),o(St,{get rows(){return c()},onChange:h}),o(_,{get when(){return B()},children:G=>(()=>{var K=da();return K.$$click=()=>E(tn(e(),G())),j(K,`${Ct} mt-4`),K})()}),Ys(),(()=>{var G=Ws(),K=G.firstChild.firstChild.nextSibling;return K.addEventListener("change",ee=>M({...w(),publicFlag:xr(ee.currentTarget.value)})),j(K,Le),n(G,o(te,{each:[["csrfCookie","CSRF cookie"],["csrfHeader","CSRF header"],["openApiUrl","OpenAPI spec URL"],["editorUrl","Editor link ({file}, {line})"]],children:([ee,ce])=>(()=>{var oe=fa(),ue=oe.firstChild;return n(oe,ce,ue),ue.$$input=Me=>M({...w(),[ee]:Me.currentTarget.value}),j(ue,Le),N(()=>ue.value=w()[ee]),oe})()}),null),N(()=>K.value=xr(w().publicFlag).join(", ")),G})()]}}),null),n(Ge,o(je,{title:"Code snippet",get children(){return[(()=>{var G=Xs(),K=G.firstChild;return n(G,o(te,{each:["curl","fetch"],children:ee=>(()=>{var ce=rn();return ce.$$click=()=>U(ee),n(ce,ee),N(oe=>{var ue=D()===ee,Me=`px-3 py-1 text-xs font-semibold rounded-lg border transition-colors ${D()===ee?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return ue!==oe.e&&X(ce,"aria-pressed",oe.e=ue),Me!==oe.t&&j(ce,oe.t=Me),oe},{e:void 0,t:void 0}),ce})()}),K),K.$$click=Z,j(K,`${Ct} ml-auto`),n(G,o(_,{get when(){return q()},get children(){var ee=Qs();return n(ee,q),ee}}),null),G})(),(()=>{var G=Zs();return n(G,Y),G})()]}}),null),n(Ge,o(_,{get when(){return C()},get children(){var G=ea();return G.firstChild,n(G,C,null),G}}),null),n(Ge,o(_,{get when(){return g()},children:G=>o(je,{open:!0,get title(){return(()=>{var K=xa(),ee=K.firstChild.nextSibling,ce=ee.firstChild,oe=ee.nextSibling,ue=oe.firstChild;return n(ee,()=>G().status,ce),n(ee,()=>G().statusText,null),n(oe,()=>G().ms,ue),N(()=>j(ee,gt(G().status))),K})()},get children(){return[(()=>{var K=ha(),ee=K.firstChild,ce=ee.firstChild.nextSibling;ce.nextSibling;var oe=ee.nextSibling.firstChild;return n(ee,()=>G().headers.length,ce),n(oe,o(te,{get each(){return G().headers},children:([ue,Me])=>(()=>{var De=ba(),wt=De.firstChild,Gt=wt.nextSibling;return n(wt,ue),n(Gt,Me),De})()})),K})(),(()=>{var K=ga();return n(K,()=>G().body||"(empty body)"),K})(),(()=>{var K=ma(),ee=K.firstChild.nextSibling,ce=ee.nextSibling,oe=ce.nextSibling;return ee.$$input=ue=>p({...f(),path:ue.currentTarget.value}),j(ee,Le),ce.$$input=ue=>p({...f(),name:ue.currentTarget.value}),j(ce,Le),oe.$$click=H,j(oe,Ct),N(()=>ee.value=f().path),N(()=>ce.value=f().name),K})(),o(_,{get when(){return v()},get children(){var K=va();return n(K,v),K}}),o(_,{get when(){return G().truncated},get children(){var K=pa(),ee=K.firstChild.nextSibling;return ee.nextSibling,n(K,()=>tr.toLocaleString(),ee),K}})]}})}),null),n(Ge,o(je,{title:"History",get count(){return re().length},get children(){return o(_,{get when(){return re().length>0},get fallback(){return $a()},get children(){return[(()=>{var G=ta();return n(G,o(te,{get each(){return re()},children:K=>(()=>{var ee=ya(),ce=ee.firstChild,oe=ce.firstChild,ue=oe.nextSibling,Me=ue.nextSibling,De=Me.nextSibling,wt=De.firstChild,Gt=De.nextSibling;return ce.$$click=()=>ne(K),n(oe,()=>K.method),n(ue,()=>Is(K)),n(Me,()=>K.status??"failed"),n(De,()=>K.ms,wt),n(Gt,()=>new Date(K.at).toLocaleTimeString()),N(nt=>{var Br=`font-bold w-14 shrink-0 ${He(K.method)}`,zr=K.status?gt(K.status):"dt-pill dt-pill-err";return Br!==nt.e&&j(oe,nt.e=Br),zr!==nt.t&&j(Me,nt.t=zr),nt},{e:void 0,t:void 0}),ee})()})),G})(),(()=>{var G=ra();return G.$$click=()=>Q([]),j(G,`${Ct} mt-2`),G})()]}})}}),null),N(G=>{var K=`Try ${L().method} ${L().path}`,ee=`text-xs font-bold ${He(L().method)}`,ce=`font-bold ${He(L().method)}`,oe=S(),ue=`shrink-0 px-4 text-sm font-semibold rounded-lg border transition-colors ${y()?"bg-red-500/20 text-red-400 border-red-500/40":"bg-kick-500/20 text-kick-500 border-kick-500/30 hover:bg-kick-500/30"}`;return K!==G.e&&X(fe,"aria-label",G.e=K),ee!==G.t&&j(ge,G.t=ee),ce!==G.a&&j(Vt,G.a=ce),oe!==G.o&&(yt.disabled=G.o=oe),ue!==G.i&&j(yt,G.i=ue),G},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),z})()})},je=e=>(()=>{var t=_a(),r=t.firstChild;r.firstChild;var s=r.nextSibling;return n(r,()=>e.title,null),n(r,o(_,{get when(){return e.count},get children(){var l=wa(),a=l.firstChild.nextSibling;return a.nextSibling,n(l,()=>e.count,a),l}}),null),n(s,()=>e.children),N(()=>t.open=e.open),t})(),Oa=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0,type:"text"}],r=(s,l)=>{const a=t().map((i,u)=>u===s?{...i,...l}:i);e.onChange(a.filter(i=>i.key||i.value||i.files?.length))};return(()=>{var s=jr();return n(s,o(Nn,{get each(){return t()},children:(l,a)=>(()=>{var i=Sa(),u=i.firstChild,c=u.nextSibling,h=c.nextSibling;return u.addEventListener("change",f=>r(a,{enabled:f.currentTarget.checked})),c.addEventListener("change",f=>r(a,{type:f.currentTarget.value,value:"",files:[]})),j(c,`${Le} w-24 shrink-0`),h.$$input=f=>r(a,{key:f.currentTarget.value}),j(h,Le),n(i,o(_,{get when(){return l().type==="file"},get fallback(){return(()=>{var f=Ca();return f.$$input=p=>r(a,{value:p.currentTarget.value}),j(f,Le),N(()=>f.value=l().value),f})()},get children(){var f=ka(),p=f.firstChild;return j(f,`${Le} cursor-pointer truncate`),p.addEventListener("change",v=>r(a,{files:[...v.currentTarget.files??[]]})),n(f,(()=>{var v=le(()=>!!l().files?.length);return()=>v()?l().files.map(x=>x.name).join(", "):"Choose file…"})(),null),N(()=>p.multiple=e.multiple),f}}),null),N(()=>u.checked=l().enabled),N(()=>c.value=l().type),N(()=>h.value=l().key),i})()})),s})()},St=e=>{const t=()=>[...e.rows,{key:"",value:"",enabled:!0}],r=(s,l)=>{const a=t().map((i,u)=>u===s?{...i,...l}:i);e.onChange(a.filter(i=>i.key||i.value))};return(()=>{var s=jr();return n(s,o(Nn,{get each(){return t()},children:(l,a)=>(()=>{var i=Ea(),u=i.firstChild,c=u.nextSibling,h=c.nextSibling;return u.addEventListener("change",f=>r(a,{enabled:f.currentTarget.checked})),c.$$input=f=>r(a,{key:f.currentTarget.value}),j(c,Le),h.$$input=f=>r(a,{value:f.currentTarget.value}),j(h,Le),N(()=>u.checked=l().enabled),N(()=>c.value=l().key),N(()=>h.value=l().value),i})()})),s})()},Le="w-full min-w-0 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500",Ct="px-3 py-2 text-xs font-semibold rounded-lg border bg-surface-2 text-text-secondary border-border-strong hover:text-text-body";ye(["click","input"]);var qa=d("<div class=dt-split><div class=dt-split-left></div><div class=dt-resizer role=separator aria-orientation=vertical></div><div class=dt-split-right>"),cn=240,un=720,Je=e=>{const t=`kickjs-devtools-split:${e.storageKey}`,r=(()=>{try{const u=Number(localStorage.getItem(t));if(u>=cn&&u<=un)return u}catch{}return e.defaultLeft??380})(),[s,l]=R(r);let a=null;Se(()=>a?.());const i=u=>{u.preventDefault();const c=u.clientX,h=s();document.body.style.cursor="col-resize";const f=v=>l(Math.min(un,Math.max(cn,h+v.clientX-c))),p=()=>{a?.();try{localStorage.setItem(t,String(s()))}catch{}};a=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",p),document.body.style.cursor="",a=null},document.addEventListener("mousemove",f),document.addEventListener("mouseup",p)};return(()=>{var u=qa(),c=u.firstChild,h=c.nextSibling,f=h.nextSibling;return n(c,()=>e.left),h.$$mousedown=i,n(f,()=>e.right),N(p=>Pn(c,`width:${s()}px`,p)),u})()};ye(["mousedown"]);var Na=d('<div class="flex flex-col gap-1.5 border-b border-border p-2"><input type=text placeholder="Search method or path…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex items-center gap-1 flex-wrap"><span class=flex-1></span><button type=button></button><button type=button>Clear</button></div><div class="text-xs text-text-muted"> requests'),Pa=d('<div class="min-h-0 flex-1 overflow-y-auto">'),Ia=d("<button type=button>"),Da=d("<div class=empty>"),Ua=d('<span class="text-red-500 text-[0.66rem]">●'),ja=d('<button type=button><span></span><span></span><span class="min-w-0 flex-1 truncate font-mono"></span><span class="shrink-0 text-[0.7rem] text-text-muted tabular-nums"></span><span class="w-14 shrink-0 text-right text-[0.66rem] text-text-muted tabular-nums">'),Ha=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select a request to see its details'),Ba=d('<section class="flex h-full min-h-0 flex-col gap-3 overflow-y-auto bg-surface-1 p-4"><div class="flex items-center gap-2"><span></span><span></span><span class="min-w-0 truncate font-mono text-sm text-text-strong"></span></div><dl class="grid grid-cols-[8rem_1fr] gap-x-3 gap-y-1.5 text-[0.8rem]"><dt class=text-text-muted>Route</dt><dd class="m-0 font-mono"></dd><dt class=text-text-muted>Duration</dt><dd class=m-0></dd><dt class=text-text-muted>Time</dt><dd class=m-0></dd><dt class=text-text-muted>Request ID</dt><dd class="m-0 font-mono break-all">'),za=d('<div class="rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm"><span class="font-semibold text-red-500"></span><span class=text-text-body>: '),Fa=d(`<div><button type=button class="rounded-md border border-kick-500/30 bg-kick-500/20 px-3 py-1 text-xs font-semibold text-kick-500 hover:bg-kick-500/30">Replay in runner</button><p class="mt-1.5 text-xs text-text-muted">Opens the route with these path params. Query, headers and body aren't logged — the runner keeps the ones saved for this route.`),Ka=1500,Ja=500,Va=["ALL","2xx","3xx","4xx","5xx"],wr=null;function Ga(e){wr=e,rt("requests")}var Ya=e=>new Date(e).toLocaleTimeString([],{hour12:!1}),Wa=()=>{const[e,t]=R([]),[r,s]=R(wr);wr=null;const[l,a]=R(""),[i,u]=R("ALL"),[c,h]=R(!1);let f=0,p=!1;const v=async()=>{if(!(c()||p)){p=!0;try{const{requests:b,latest:g}=await we.requests(f);if(g<f){f=0,t([]),s(null);return}if(b.length===0)return;f=b[b.length-1].seq,t($=>[...b.toReversed(),...$].slice(0,Ja))}catch{}finally{p=!1}}};Ne(()=>{v();const b=setInterval(()=>{v()},Ka);Se(()=>clearInterval(b))});const x=se(()=>{const b=l().trim().toLowerCase(),g=i();return e().filter($=>(g==="ALL"||Math.floor($.status/100)===Number(g[0]))&&(!b||`${$.method} ${$.path}`.toLowerCase().includes(b)))}),w=se(()=>e().find(b=>b.seq===r())??null),M=b=>b.route===void 0?void 0:ae.routes().find(g=>g.method.toUpperCase()===b.method.toUpperCase()&&g.path===b.route),y=b=>`px-2 py-0.5 text-[0.68rem] font-semibold rounded-md border ${b?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`,m=[(()=>{var b=Na(),g=b.firstChild,$=g.nextSibling,C=$.firstChild,O=C.nextSibling,q=O.nextSibling,T=$.nextSibling,D=T.firstChild;return g.$$input=U=>a(U.currentTarget.value),n($,o(te,{each:Va,children:U=>(()=>{var re=Ia();return re.$$click=()=>u(U),n(re,U),N(Q=>{var k=i()===U,A=y(i()===U);return k!==Q.e&&X(re,"aria-pressed",Q.e=k),A!==Q.t&&j(re,Q.t=A),Q},{e:void 0,t:void 0}),re})()}),C),O.$$click=()=>h(U=>!U),n(O,()=>c()?"Paused":"Pause"),q.$$click=()=>{t([]),s(null)},n(T,o(_,{get when(){return l()||i()!=="ALL"},get children(){return[le(()=>x().length)," matched · "]}}),D),n(T,()=>e().length,D),N(U=>{var re=c(),Q=y(c()),k=y(!1);return re!==U.e&&X(O,"aria-pressed",U.e=re),Q!==U.t&&j(O,U.t=Q),k!==U.a&&j(q,U.a=k),U},{e:void 0,t:void 0,a:void 0}),N(()=>g.value=l()),b})(),(()=>{var b=Pa();return n(b,o(_,{get when(){return x().length>0},get fallback(){return(()=>{var g=Da();return n(g,()=>e().length?"No requests match":"No requests yet — call the app"),g})()},get children(){return o(te,{get each(){return x()},children:g=>(()=>{var $=ja(),C=$.firstChild,O=C.nextSibling,q=O.nextSibling,T=q.nextSibling,D=T.nextSibling;return $.$$click=()=>s(g.seq),n(C,()=>g.status),n(O,()=>g.method),n(q,()=>g.path),n($,o(_,{get when(){return g.error},get children(){var U=Ua();return N(()=>X(U,"title",g.error.message)),U}}),T),n(T,()=>$e(g.durationMs)),n(D,()=>Ya(g.at)),N(U=>{var re=`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.78rem] text-text-body ${r()===g.seq?"bg-accent/12 shadow-[inset_2px_0_0_0_var(--color-accent)]":"bg-transparent hover:bg-surface-hover"}`,Q=`${gt(g.status)} w-10 shrink-0 text-center`,k=`w-[3.4rem] shrink-0 font-mono text-[0.68rem] font-bold ${He(g.method)}`;return re!==U.e&&j($,U.e=re),Q!==U.t&&j(C,U.t=Q),k!==U.a&&j(O,U.a=k),U},{e:void 0,t:void 0,a:void 0}),$})()})}})),b})()],S=o(_,{get when(){return w()},get fallback(){return Ha()},children:b=>(()=>{var g=Ba(),$=g.firstChild,C=$.firstChild,O=C.nextSibling,q=O.nextSibling,T=$.nextSibling,D=T.firstChild.nextSibling,U=D.nextSibling.nextSibling,re=U.nextSibling.nextSibling,Q=re.nextSibling.nextSibling;return n(C,()=>b().status),n(O,()=>b().method),n(q,()=>b().path),n(g,o(_,{get when(){return b().error},children:k=>(()=>{var A=za(),J=A.firstChild,V=J.nextSibling;return V.firstChild,n(J,()=>k().name),n(V,()=>k().message,null),A})()}),T),n(D,()=>b().route??"no route matched"),n(U,()=>$e(b().durationMs)),n(re,()=>new Date(b().at).toLocaleString()),n(Q,()=>b().requestId??"—"),n(g,o(_,{get when(){return M(b())},children:k=>(()=>{var A=Fa(),J=A.firstChild;return J.$$click=()=>Jt(k(),Cs(k().path,b().path)),A})()}),null),N(k=>{var A=gt(b().status),J=`font-mono text-sm font-bold ${He(b().method)}`;return A!==k.e&&j(C,k.e=A),J!==k.t&&j(O,k.t=J),k},{e:void 0,t:void 0}),g})()});return o(Je,{storageKey:"requests",left:m,right:S})};ye(["input","click"]);var Qa=d('<div class="flex flex-col gap-4"><div class="grid grid-cols-2 gap-3 lg:grid-cols-4"></div><div class="grid grid-cols-1 gap-4 lg:grid-cols-[2fr_1fr]"><section class="rounded-xl border border-border bg-surface-1"><header class="flex items-center justify-between border-b border-border px-4 py-2.5"><h2 class="text-xs font-semibold uppercase tracking-wider text-text-muted">Recent failures</h2><button type=button class="text-xs text-text-muted hover:text-text-strong">All requests →</button></header></section><section class="rounded-xl border border-border bg-surface-1 px-4 py-3 text-[0.8rem]"><h2 class="mb-2 text-xs font-semibold uppercase tracking-wider text-text-muted">App'),Xa=d('<div class="flex flex-col items-center gap-2 px-4 py-8 text-sm text-text-muted">'),Za=d('<button type=button class="rounded-md border border-kick-500/30 bg-kick-500/20 px-3 py-1 text-xs font-semibold text-kick-500 hover:bg-kick-500/30">Try a route'),eo=d('<button type=button class="flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 bg-transparent px-4 py-1.5 text-left text-[0.78rem] text-text-body last:border-b-0 hover:bg-surface-hover"><span></span><span></span><span class="min-w-0 shrink truncate font-mono"></span><span class="min-w-0 flex-1 truncate text-xs text-red-500"></span><span class="shrink-0 text-[0.66rem] text-text-muted tabular-nums">'),to=d('<p class="italic text-text-muted">Loading…'),ro=d("<span>"),no=d('<h3 class="mt-3 mb-1 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">Adapters'),lo=d('<span class="text-xs text-amber-500">'),so=d('<div class="flex items-center gap-2 py-0.5"><span aria-hidden=true></span><span class="min-w-0 flex-1 truncate text-text-secondary">'),ao=d('<div class="flex flex-col rounded-xl border border-border bg-surface-1 px-4 pt-3 pb-2"><span class="text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted"></span><span></span><span class="text-xs text-text-muted"></span><div class="mt-1 h-8 [&_svg]:block [&_svg]:h-full [&_svg]:w-full">'),oo=d('<div class="flex items-center justify-between py-0.5"><span class=text-text-secondary></span><span class="font-medium tabular-nums">'),io=2e3,co=()=>{const[e,t]=R([]),[r,s]=R(null);let l=0,a=!1;const i=async()=>{if(!a){a=!0;try{const[h,f]=await Promise.allSettled([we.requests(l),we.runtime()]);if(h.status==="fulfilled"){if(h.value.latest<l){l=0,t([]);return}const p=h.value.requests;p.length&&(l=p[p.length-1].seq,t(v=>[...v,...p].slice(-200)))}s(f.status==="fulfilled"?f.value.history.map(p=>p.memory.heapUsed):null)}finally{a=!1}}};Ne(()=>{i();const h=setInterval(()=>{i()},io);Se(()=>clearInterval(h))});const u=se(()=>vr(e().map(h=>h.durationMs),95)),c=se(()=>e().filter(h=>h.status>=500||h.error).toReversed().slice(0,6));return(()=>{var h=Qa(),f=h.firstChild,p=f.nextSibling.firstChild,v=p.firstChild.firstChild.nextSibling,x=p.nextSibling;return x.firstChild,n(f,o(st,{label:"Requests",get value(){return ae.metrics()?.requests.toLocaleString()??"—"},get hint(){return`${uo(Qt(Zr()))} in the last minute`},get series(){return Qt(Zr())}}),null),n(f,o(st,{label:"Server errors",get value(){return ae.metrics()?.serverErrors.toLocaleString()??"—"},get hint(){return[le(()=>Ht(ae.metrics()?.errorRate??0))," error rate",o(Pe,{metric:"error-rate"})]},get series(){return Qt(ds())},stroke:"#ef4444",get tone(){return ae.metrics()?.serverErrors?"err":void 0}}),null),n(f,o(st,{label:"Latency p95",get value(){return le(()=>u()===void 0)()?"—":$e(u())},get hint(){return`over the last ${e().length} requests`},get series(){return e().slice(-60).map(w=>w.durationMs)}}),null),n(f,o(_,{get when(){return r()},get fallback(){return o(st,{label:"Uptime",get value(){return le(()=>!!ae.health())()?pr(ae.health().uptime):"—"},hint:"runtime sampler is off"})},children:w=>o(st,{label:"Heap used",get value(){return le(()=>!!w().length)()?Ze(w()[w().length-1]):"—"},hint:"sampled every second",get series(){return w()}})}),null),v.$$click=()=>rt("requests"),n(p,o(_,{get when(){return c().length>0},get fallback(){return(()=>{var w=Xa();return n(w,o(_,{get when(){return e().length>0},get fallback(){return["No requests yet.",(()=>{var M=Za();return M.$$click=()=>rt("routes"),M})()]},get children(){return["No failures in the last ",le(()=>e().length)," requests."]}})),w})()},get children(){return o(te,{get each(){return c()},children:w=>(()=>{var M=eo(),y=M.firstChild,m=y.nextSibling,S=m.nextSibling,b=S.nextSibling,g=b.nextSibling;return M.$$click=()=>Ga(w.seq),n(y,()=>w.status),n(m,()=>w.method),n(S,()=>w.path),n(b,(()=>{var $=le(()=>!!w.error);return()=>$()?`${w.error.name}: ${w.error.message}`:""})()),n(g,()=>new Date(w.at).toLocaleTimeString([],{hour12:!1})),N($=>{var C=`${gt(w.status)} w-10 shrink-0 text-center`,O=`w-[3.4rem] shrink-0 font-mono text-[0.68rem] font-bold ${He(w.method)}`;return C!==$.e&&j(y,$.e=C),O!==$.t&&j(m,$.t=O),$},{e:void 0,t:void 0}),M})()})}}),null),n(x,o(_,{get when(){return ae.health()},get fallback(){return to()},children:w=>[o(Et,{label:"Status",get children(){var M=ro();return n(M,()=>w().status),N(()=>j(M,`badge ${fo(w().status)}`)),M}}),o(Et,{label:"Uptime",get children(){return pr(w().uptime)}}),o(_,{get when(){return ae.metrics()},children:M=>o(Et,{label:"Started",get children(){return new Date(M().startedAt).toLocaleTimeString()}})}),o(_,{get when(){return ae.ws().enabled},get children(){return o(Et,{label:"WebSocket",get children(){return[le(()=>ae.ws().activeConnections??0)," open ·"," ",le(()=>(ae.ws().messagesReceived??0)+(ae.ws().messagesSent??0))," msgs"]}})}}),o(_,{get when(){return Object.keys(w().adapters).length>0},get children(){return[no(),o(te,{get each(){return Object.entries(w().adapters)},children:([M,y])=>(()=>{var m=so(),S=m.firstChild,b=S.nextSibling;return X(m,"title",y),j(S,`h-2 w-2 shrink-0 rounded-full ${y==="running"?"bg-emerald-500":"bg-amber-500"}`),n(b,M),n(m,o(_,{when:y!=="running",get children(){var g=lo();return n(g,y),g}}),null),m})()})]}})]}),null),h})()},st=e=>(()=>{var t=ao(),r=t.firstChild,s=r.nextSibling,l=s.nextSibling,a=l.nextSibling;return n(r,()=>e.label),n(s,()=>e.value),n(l,()=>e.hint),n(a,o(_,{get when(){return(e.series?.length??0)>1},get children(){return o(ms,{get values(){return e.series},get stroke(){return e.stroke}})}})),N(()=>j(s,`mt-0.5 text-xl font-semibold tabular-nums ${e.tone==="err"?"text-red-500":"text-text-strong"}`)),t})(),Et=e=>(()=>{var t=oo(),r=t.firstChild,s=r.nextSibling;return n(r,()=>e.label),n(s,()=>e.children),t})(),uo=e=>e.reduce((t,r)=>t+r,0);function fo(e){return e==="healthy"?"badge-ok":e==="degraded"?"badge-warn":"badge-critical"}ye(["click"]);var ho=d('<section class="flex flex-col rounded-xl border border-border bg-surface-1 px-4 pt-3 pb-2"><header class="flex items-baseline gap-2"><h3 class="text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted"></h3><span class=flex-1></span></header><div class="relative mt-1"><svg viewBox="0 0 300 80"preserveAspectRatio=none class="block h-20 w-full"><line x1=0 x2=300 y1=79.5 y2=79.5 stroke=var(--color-border)></line></svg><span class="pointer-events-none absolute top-0 left-0 text-[0.6rem] text-text-muted tabular-nums"></span></div><div class="flex justify-between text-[0.6rem] text-text-muted"><span></span><span>now'),go=d('<span class="inline-block h-0.5 w-2.5 rounded">'),mo=d('<span class="flex items-center gap-1 text-xs text-text-muted"><span>'),vo=d("<svg><line y1=74 y2=80 stroke=var(--color-text-muted) vector-effect=non-scaling-stroke></svg>",!1,!0,!1),po=d("<svg><path fill=none stroke-width=1.5 stroke-linejoin=round vector-effect=non-scaling-stroke></svg>",!1,!0,!1),xo=300,bo=80,Mt=e=>{const t=se(()=>Math.max(0,...e.series.map(c=>c.values.length))),r=se(()=>e.max??(Math.max(0,...e.series.flatMap(c=>[...c.values]))*1.1||1)),s=c=>t()>1?c/(t()-1)*xo:0,l=c=>bo-Math.min(c,r())/r()*78-1,a=c=>c.map((h,f)=>`${f?"L":"M"}${s(f).toFixed(1)} ${l(h).toFixed(1)}`).join(" "),i=(c,h)=>c.color??(h===0?"var(--color-accent)":"var(--color-text-muted)"),u=c=>c.values[c.values.length-1];return(()=>{var c=ho(),h=c.firstChild,f=h.firstChild,p=f.nextSibling,v=h.nextSibling,x=v.firstChild;x.firstChild;var w=x.nextSibling,M=v.nextSibling.firstChild;return n(f,()=>e.title),n(h,()=>e.info,p),n(h,o(te,{get each(){return e.series},children:(y,m)=>o(_,{get when(){return u(y)!==void 0},get children(){var S=mo(),b=S.firstChild;return n(S,o(_,{get when(){return e.series.length>1},get children(){return[(()=>{var g=go();return N($=>Ie(g,"background",i(y,m()))),g})(),le(()=>y.label)]}}),b),n(b,()=>e.format(u(y))),N(()=>j(b,`tabular-nums ${m()===0?"text-base font-semibold text-text-strong":""}`)),S}})}),null),n(x,o(te,{get each(){return e.marks??[]},children:y=>(()=>{var m=vo();return N(S=>{var b=s(y),g=s(y);return b!==S.e&&X(m,"x1",S.e=b),g!==S.t&&X(m,"x2",S.t=g),S},{e:void 0,t:void 0}),m})()}),null),n(x,o(te,{get each(){return e.series.map((y,m)=>({s:y,i:m})).toReversed()},children:({s:y,i:m})=>(()=>{var S=po();return N(b=>{var g=a(y.values),$=i(y,m);return g!==b.e&&X(S,"d",b.e=g),$!==b.t&&X(S,"stroke",b.t=$),b},{e:void 0,t:void 0}),S})()}),null),n(w,()=>e.format(r())),n(M,(()=>{var y=le(()=>t()>1);return()=>y()?`${t()}s ago`:""})()),c})()},$o=d('<div class="flex flex-col gap-4"><header class="flex flex-wrap items-center gap-2 text-xs"><span class=flex-1></span></header><div class="grid grid-cols-1 gap-3 lg:grid-cols-2"></div><p class="-mt-2 text-[0.66rem] text-text-muted">Ticks under the event-loop chart mark garbage collections. CPU is a percentage of one core.'),yo=d('<div class=dt-panel-grid><div class="card max-w-md text-sm text-text-secondary">The runtime sampler is off. Remove <code>runtime: { enabled: false }</code> from <code>DevToolsAdapter(...)</code> to see process metrics here.'),wo=d('<span class="dt-tone dt-tone-gray">Node '),_o=d('<span class="dt-tone dt-tone-gray">/'),ko=d('<span class="dt-tone dt-tone-gray">pid '),So=d('<span class="dt-tone dt-tone-blue">'),Co=d("<span class=text-text-muted>up <!> · <!> GCs, <!> paused"),Eo=d('<div class="mt-2 flex flex-wrap gap-1.5">'),Mo=d('<p class="mt-2 text-xs text-text-muted">Growth is judged once the process has run past its startup — about 50 seconds.'),To=d('<section class="rounded-xl border border-border bg-surface-1 px-4 py-3"><header class="mb-2 flex items-center gap-2"><h3 class="text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">Memory health</h3><span></span></header><dl class="grid grid-cols-2 gap-x-6 gap-y-1 text-[0.8rem] md:grid-cols-4">'),Ao=d('<span class="dt-tone dt-tone-gray font-mono"> '),Lo=d('<div><dt class="text-xs text-text-muted"></dt><dd class="m-0 font-semibold tabular-nums">'),el=d('<span class="max-w-80 truncate text-text-muted">'),Ro=d('<button type=button class="rounded-md border border-border-strong bg-surface-2 px-2.5 py-1 text-xs text-text-secondary hover:text-text-strong disabled:opacity-50"title="Blocks the event loop for a few seconds — avoid in production">'),Oo=d('<button type=button class="rounded-md border border-border-strong bg-surface-2 px-2.5 py-1 text-xs text-text-secondary hover:text-text-strong disabled:opacity-50"title="Needs node --expose-gc">'),qo=()=>{const[e,t]=R([]),[r,s]=R(null),[l,a]=R(null),[i,u]=R(!1),c=x=>{t(w=>[...w,...x].slice(-60))};Ne(()=>{we.runtime().then(w=>{a(w.process??null),s(w.health),c(w.history)}).catch(()=>u(!0));const x=Fn("/memory/stream",w=>{c([w.snapshot]),s(w.health)},()=>{});Se(x)});const h=se(()=>e()[e().length-1]),f=x=>e().map(x),p=se(()=>e().map((x,w,M)=>{const y=w?x.timestamp-M[w-1].timestamp:1e3;return(x.cpu.userMicros+x.cpu.systemMicros)/1e3/Math.max(1,y)*100})),v=se(()=>e().flatMap((x,w,M)=>w&&x.gc.count>M[w-1].gc.count?[w]:[]));return o(_,{get when(){return!i()},get fallback(){return yo()},get children(){var x=$o(),w=x.firstChild,M=w.firstChild,y=w.nextSibling;return y.nextSibling,n(w,o(_,{get when(){return l()},children:m=>[o(_,{get when(){return m().runtime},children:S=>(()=>{var b=So();return n(b,()=>S().name),b})()}),(()=>{var S=wo();return S.firstChild,n(S,()=>m().nodeVersion,null),S})(),(()=>{var S=_o(),b=S.firstChild;return n(S,()=>m().platform,b),n(S,()=>m().arch,null),S})(),(()=>{var S=ko();return S.firstChild,n(S,()=>m().pid,null),S})()]}),M),n(w,o(_,{get when(){return h()},children:m=>(()=>{var S=Co(),b=S.firstChild.nextSibling,g=b.nextSibling.nextSibling,$=g.nextSibling.nextSibling;return $.nextSibling,n(S,()=>pr(m().uptimeSec),b),n(S,()=>m().gc.count,g),n(S,()=>$e(m().gc.totalPauseMs),$),S})()}),M),n(w,o(No,{}),null),n(w,o(Po,{}),null),n(y,o(Mt,{title:"Heap",get info(){return o(Pe,{metric:"heap.used"})},format:Ze,get series(){return[{label:"used",values:f(m=>m.memory.heapUsed)},{label:"total",values:f(m=>m.memory.heapTotal)}]}}),null),n(y,o(Mt,{title:"Process memory",get info(){return o(Pe,{metric:"rss"})},format:Ze,get series(){return[{label:"RSS",values:f(m=>m.memory.rss)},{label:"external",values:f(m=>m.memory.external)}]}}),null),n(y,o(Mt,{title:"Event loop delay",get info(){return o(Pe,{metric:"event-loop.p99"})},format:$e,get marks(){return v()},get series(){return[{label:"p99",values:f(m=>m.eventLoop.p99)},{label:"p50",values:f(m=>m.eventLoop.p50)}]}}),null),n(y,o(Mt,{title:"CPU",format:m=>`${m.toFixed(m<10?1:0)}%`,get max(){return Math.max(100,...p())},get series(){return[{label:"CPU",values:p()}]}}),null),n(x,o(_,{get when(){return r()},children:m=>(()=>{var S=To(),b=S.firstChild,g=b.firstChild.nextSibling,$=b.nextSibling;return n(b,o(Pe,{metric:"leak.risk"}),g),n(g,(()=>{var C=le(()=>!!m().sampling);return()=>C()?"sampling":m().heapGrowthSeverity})()),n($,o(Tt,{label:"Heap growth",get children(){return le(()=>!!m().sampling)()?"measuring…":`${Ze(m().heapGrowthBytesPerSec*60)}/min`}}),null),n($,o(Tt,{label:"GC reclaim",metric:"gc.reclaim",get children(){return le(()=>!!m().sampling)()?"—":Ht(m().gcReclaimRatio)}}),null),n($,o(Tt,{label:"Heap of limit",metric:"heap.utilization",get children(){return Ht(m().heapUtilization)}}),null),n($,o(Tt,{label:"Open handles",get children(){return m().activeHandles}}),null),n(S,o(_,{get when(){return Object.keys(m().handlesByType).length>0},get children(){var C=Eo();return n(C,o(te,{get each(){return Object.entries(m().handlesByType).toSorted((O,q)=>q[1]-O[1])},children:([O,q])=>(()=>{var T=Ao(),D=T.firstChild;return n(T,O,D),n(T,q,null),T})()})),C}}),null),n(S,o(_,{get when(){return m().sampling},get children(){return Mo()}}),null),N(()=>j(g,m().sampling?et("idle"):et(m().heapGrowthSeverity==="ok"?"ok":m().heapGrowthSeverity==="warn"?"warn":"err"))),S})()}),null),x}})},Tt=e=>(()=>{var t=Lo(),r=t.firstChild,s=r.nextSibling;return n(r,()=>e.label,null),n(r,o(_,{get when(){return e.metric},get children(){return o(Pe,{get metric(){return e.metric}})}}),null),n(s,()=>e.children),t})(),No=()=>{const[e,t]=R(null),[r,s]=R(!1),l=async()=>{s(!0),t(null);try{const a=await Ir("/memory/snapshot"),i=await a.blob(),u=/filename="?([^";]+)"?/.exec(a.headers.get("content-disposition")??"")?.[1]??`kickjs-heap-${Date.now()}.heapsnapshot`,c=URL.createObjectURL(i);Object.assign(document.createElement("a"),{href:c,download:u}).click(),URL.revokeObjectURL(c),t(`Saved ${u} (${Ze(i.size)})`)}catch(a){t(a instanceof Error?a.message:String(a))}finally{s(!1)}};return[o(_,{get when(){return e()},get children(){var a=el();return n(a,e),N(()=>X(a,"title",e())),a}}),(()=>{var a=Ro();return a.$$click=()=>{l()},n(a,()=>r()?"Capturing…":"Heap snapshot"),N(()=>a.disabled=r()),a})()]},Po=()=>{const[e,t]=R(null),[r,s]=R(!1),l=async()=>{s(!0),t(null);try{const a=await(await Ir("/memory/gc")).json();t(`GC freed ${Ze(a.reclaimedBytes)} in ${a.elapsedMs}ms`)}catch(a){t(a instanceof Error?a.message:String(a))}finally{s(!1)}};return[o(_,{get when(){return e()},get children(){var a=el();return n(a,e),N(()=>X(a,"title",e())),a}}),(()=>{var a=Oo();return a.$$click=()=>{l()},n(a,()=>r()?"Collecting…":"Run GC"),N(()=>a.disabled=r()),a})()]};ye(["click"]);var Io=d('<div class="flex flex-wrap gap-1">'),Do=d('<span class="text-xs text-text-muted">None'),Uo=d('<button type=button class="rounded border border-border-strong bg-surface-2 px-2 py-0.5 font-mono text-xs text-text-body hover:border-kick-500 hover:text-kick-500">'),jo=d('<div class="p-4 text-sm text-text-muted"> is no longer registered.'),Ho=d("<dt class=text-text-muted>First"),dn=d("<dd class=m-0>"),Bo=d("<dt class=text-text-muted>Last"),zo=d("<dt class=text-text-muted>Took "),Fo=d('<dd class="m-0 tabular-nums">'),Ko=d('<dl class="grid grid-cols-[9rem_1fr] gap-y-1"><dt class=text-text-muted>Resolves </dt><dd class="m-0 tabular-nums"></dd><dt class=text-text-muted>@PostConstruct </dt><dd class=m-0><span>'),Jo=d('<section class="flex flex-col gap-4 p-4 text-[0.8rem]"><header><h2 class="m-0 break-all font-mono text-base text-text-strong"></h2><div class="mt-1.5 flex flex-wrap gap-1.5"><span></span><span class="dt-tone dt-tone-gray"></span><span>'),Vo=d('<div><h3 class="mb-1.5 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">'),_r=null;function tl(e){_r=e,rt("container")}function Go(){const e=_r;return _r=null,e}function Bt(e){return e.postConstructStatus==="failed"?{label:"failed",tone:et("err")}:e.instantiated?{label:"active",tone:et("ok")}:{label:"registered",tone:et("idle")}}var rl=e=>{const t=se(()=>ae.container().find(l=>l.token===e.token)),r=se(()=>ae.container().filter(l=>l.dependencies?.includes(e.token)).map(l=>l.token)),s=l=>o(_,{get when(){return l.length},get fallback(){return Do()},get children(){var a=Io();return n(a,o(te,{each:l,children:i=>(()=>{var u=Uo();return u.$$click=()=>e.onSelect(i),n(u,i),u})()})),a}});return o(_,{get when(){return t()},get fallback(){return(()=>{var l=jo(),a=l.firstChild;return n(l,()=>e.token,a),l})()},children:l=>(()=>{var a=Jo(),i=a.firstChild.firstChild,u=i.nextSibling.firstChild,c=u.nextSibling,h=c.nextSibling;return n(i,()=>l().token),n(u,()=>l().kind??"unknown"),n(c,()=>l().scope??"singleton"),n(h,()=>Bt(l()).label),n(a,o(rr,{get title(){return`Depends on (${l().dependencies?.length??0})`},get children(){return s(l().dependencies??[])}}),null),n(a,o(rr,{get title(){return`Used by (${r().length})`},get children(){return s(r())}}),null),n(a,o(rr,{title:"Resolution",get children(){var f=Ko(),p=f.firstChild;p.firstChild;var v=p.nextSibling,x=v.nextSibling;x.firstChild;var w=x.nextSibling.firstChild;return n(p,o(Pe,{metric:"resolve.count"}),null),n(v,()=>l().resolveCount??0),n(f,o(_,{get when(){return l().firstResolvedAt},get children(){return[Ho(),(()=>{var M=dn();return n(M,()=>new Date(l().firstResolvedAt).toLocaleTimeString()),M})()]}}),x),n(f,o(_,{get when(){return l().lastResolvedAt},get children(){return[Bo(),(()=>{var M=dn();return n(M,()=>new Date(l().lastResolvedAt).toLocaleTimeString()),M})()]}}),x),n(f,o(_,{get when(){return l().resolveDurationMs!=null},get children(){return[(()=>{var M=zo();return M.firstChild,n(M,o(Pe,{metric:"resolve.duration"}),null),M})(),(()=>{var M=Fo();return n(M,()=>$e(l().resolveDurationMs)),M})()]}}),x),n(x,o(Pe,{metric:"post-construct"}),null),n(w,()=>l().postConstructStatus??"none"),N(()=>j(w,et(l().postConstructStatus==="failed"?"err":l().postConstructStatus==="done"?"ok":"idle"))),f}}),null),N(f=>{var p=Dr(l().kind),v=Bt(l()).tone;return p!==f.e&&j(u,f.e=p),v!==f.t&&j(h,f.t=v),f},{e:void 0,t:void 0}),a})()})},rr=e=>(()=>{var t=Vo(),r=t.firstChild;return n(r,()=>e.title),n(t,()=>e.children,null),t})();ye(["click"]);var Yo=d('<div class="card text-sm text-red-500">'),Wo=d('<div class="rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm">'),Qo=d('<div class="flex flex-col gap-3"><div class="flex items-center gap-3 text-xs text-text-muted"><span class=flex-1></span><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2.5 py-1 text-xs text-text-secondary hover:text-text-strong">Refresh'),Xo=d("<span> plugins · <!> adapters · <!> contributors · updated "),Zo=d('<div><span class="font-semibold text-red-500"> (<!>) introspect() failed:</span> '),ei=d("<div class=empty>Loading topology…"),ti=d('<div class="grid grid-cols-1 items-start gap-3 lg:grid-cols-3">'),ri=d('<section class="flex flex-col gap-2"><h2 class="text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted"> <span class=font-normal>(<!>)'),ni=d('<div class="rounded-lg border border-dashed border-border px-3 py-2 text-xs text-text-muted">'),li=d('<span class="dt-tone dt-tone-gray">v'),si=d('<div class="mt-1.5 flex flex-wrap gap-x-3 gap-y-0.5">'),ai=d('<dl class="mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5">'),oi=d('<p class="mt-1 text-xs text-text-muted">Reports nothing — it has no introspect().'),ii=d('<article><header class="flex items-center gap-2"><span class="h-1.5 w-1.5 rounded-full bg-emerald-500"aria-hidden=true></span><span class="min-w-0 flex-1 truncate font-mono font-semibold text-text-strong">'),ci=d('<span class=text-text-muted> <span class="font-semibold text-text-body tabular-nums">'),ui=d("<dt class=text-text-muted>"),di=d('<dd class="m-0 truncate font-mono">'),fi=d('<div class="mt-1.5 flex flex-wrap items-center gap-1"><span class="w-14 text-[0.66rem] text-text-muted">'),hi=d('<button type=button title="Open in Container">'),gi=d('<div class="mt-1 flex flex-wrap items-center gap-1 text-[0.68rem] text-text-muted">after'),mi=d('<article><div class="flex items-center gap-2"><span class="min-w-0 flex-1 truncate font-mono font-semibold">ctx.</span><span class="dt-tone dt-tone-gray">'),vi=d("<span>"),pi=()=>{const[e,t]=R(null),[r,s]=R(null),[l,a]=R(null),i=async()=>{try{t(await we.topology()),s(null)}catch(c){s(c instanceof Error?c.message:String(c))}};Ne(()=>{i();const c=setInterval(()=>{i()},5e3);Se(()=>clearInterval(c))});const u=(c,h)=>!!h&&(!!c.tokens?.provides.includes(h)||!!c.tokens?.requires.includes(h));return(()=>{var c=Qo(),h=c.firstChild,f=h.firstChild,p=f.nextSibling;return n(h,o(_,{get when(){return e()},children:v=>(()=>{var x=Xo(),w=x.firstChild,M=w.nextSibling,y=M.nextSibling.nextSibling;return y.nextSibling,n(x,()=>v().plugins.length,w),n(x,()=>v().adapters.length,M),n(x,()=>v().contributors.length,y),n(x,()=>Ur(v().timestamp),null),x})()}),f),p.$$click=()=>{i()},n(c,o(_,{get when(){return r()},get children(){var v=Yo();return n(v,r),v}}),null),n(c,o(_,{get when(){return e()?.errors.length},get children(){var v=Wo();return n(v,o(te,{get each(){return e().errors},children:x=>(()=>{var w=Zo(),M=w.firstChild,y=M.firstChild,m=y.nextSibling;return m.nextSibling,M.nextSibling,n(M,()=>x.name,y),n(M,()=>x.kind,m),n(w,()=>x.message,null),w})()})),v}}),null),n(c,o(_,{get when(){return e()},get fallback(){return ei()},children:v=>(()=>{var x=ti();return n(x,o(nr,{title:"Plugins",get count(){return v().plugins.length},empty:"No plugins — definePlugin(...) adds one.",get children(){return o(te,{get each(){return v().plugins},children:w=>o(fn,{p:w,get lit(){return u(w,l())},get hover(){return l()},onHover:a})})}}),null),n(x,o(nr,{title:"Adapters",get count(){return v().adapters.length},empty:"No adapters registered.",get children(){return o(te,{get each(){return v().adapters},children:w=>o(fn,{p:w,get lit(){return u(w,l())},get hover(){return l()},onHover:a})})}}),null),n(x,o(nr,{title:"Contributors",get count(){return v().contributors.length},empty:"No context contributors — defineContextDecorator(...) adds one.",get children(){return o(te,{get each(){return v().contributors},children:w=>o(xi,{c:w,get hover(){return l()},onHover:a})})}}),null),x})()}),null),c})()},nr=e=>(()=>{var t=ri(),r=t.firstChild,s=r.firstChild,l=s.nextSibling,a=l.firstChild.nextSibling;return a.nextSibling,n(r,()=>e.title,s),n(l,()=>e.count,a),n(t,o(_,{get when(){return e.count>0},get fallback(){return(()=>{var i=ni();return n(i,()=>e.empty),i})()},get children(){return e.children}}),null),t})(),fn=e=>{const t=se(()=>Object.entries(e.p.state??{})),r=se(()=>Object.entries(e.p.metrics??{})),s=()=>t().length+r().length+(e.p.tokens?.provides.length??0)+(e.p.tokens?.requires.length??0)>0;return(()=>{var l=ii(),a=l.firstChild,i=a.firstChild.nextSibling;return n(i,()=>e.p.name),n(a,o(_,{get when(){return e.p.version},get children(){var u=li();return u.firstChild,n(u,()=>e.p.version,null),u}}),null),n(l,o(_,{get when(){return r().length},get children(){var u=si();return n(u,o(te,{get each(){return r()},children:([c,h])=>(()=>{var f=ci(),p=f.firstChild,v=p.nextSibling;return n(f,c,p),n(v,()=>h.toLocaleString()),f})()})),u}}),null),n(l,o(_,{get when(){return t().length},get children(){var u=ai();return n(u,o(te,{get each(){return t()},children:([c,h])=>[(()=>{var f=ui();return n(f,c),f})(),(()=>{var f=di();return n(f,()=>typeof h=="string"?h:JSON.stringify(h)),N(()=>X(f,"title",JSON.stringify(h))),f})()]})),u}}),null),n(l,o(hn,{label:"provides",get tokens(){return e.p.tokens?.provides??[]},get hover(){return e.hover},get onHover(){return e.onHover}}),null),n(l,o(hn,{label:"requires",get tokens(){return e.p.tokens?.requires??[]},get hover(){return e.hover},get onHover(){return e.onHover}}),null),n(l,o(_,{get when(){return!s()},get children(){return oi()}}),null),N(()=>j(l,`rounded-lg border bg-surface-1 px-3 py-2 text-[0.78rem] transition-colors ${e.lit?"border-kick-500 shadow-[0_0_0_1px_var(--color-accent)]":"border-border"}`)),l})()},hn=e=>o(_,{get when(){return e.tokens.length},get children(){var t=fi(),r=t.firstChild;return n(r,()=>e.label),n(t,o(te,{get each(){return e.tokens},children:s=>(()=>{var l=hi();return l.$$click=()=>tl(s),l.addEventListener("mouseleave",()=>e.onHover(null)),l.addEventListener("mouseenter",()=>e.onHover(s)),n(l,s),N(()=>j(l,`rounded border px-1.5 font-mono text-[0.68rem] ${e.hover===s?"border-kick-500 text-kick-500":"border-border-strong text-text-secondary hover:text-text-strong"}`)),l})()}),null),t}}),xi=e=>(()=>{var t=mi(),r=t.firstChild.firstChild;r.firstChild;var s=r.nextSibling;return t.addEventListener("mouseleave",()=>e.onHover(null)),t.addEventListener("mouseenter",()=>e.onHover(e.c.key)),n(r,()=>e.c.key,null),n(s,()=>e.c.source),n(t,o(_,{get when(){return e.c.dependsOn.length},get children(){var l=gi();return l.firstChild,n(l,o(te,{get each(){return e.c.dependsOn},children:a=>(()=>{var i=vi();return n(i,a),N(()=>j(i,`rounded border px-1.5 font-mono ${e.hover===a?"border-kick-500 text-kick-500":"border-border-strong"}`)),i})()}),null),l}}),null),N(()=>j(t,`rounded-lg border bg-surface-1 px-3 py-1.5 text-[0.78rem] ${e.hover===e.c.key?"border-kick-500":"border-border"}`)),t})();ye(["click"]);var bi=d('<div class="flex flex-col gap-1.5 border-b border-border p-2"><input type=text placeholder="Search path, controller, handler…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex items-center gap-1 flex-wrap"></div><div class="text-xs text-text-muted"> routes'),$i=d('<div class="min-h-0 flex-1 overflow-y-auto">'),yi=d("<button type=button>"),wi=d("<div class=empty>"),_i=d('<div class="sticky top-0 z-1 border-b border-border bg-surface-2 px-2.5 py-1 text-[0.66rem] font-bold uppercase tracking-wide text-text-muted"> <span class=font-normal>(<!>)'),ki=d('<button type=button><span></span><span class="min-w-0 flex-1 truncate font-mono">'),Si=d('<span class="max-w-[40%] truncate text-[0.66rem] text-text-muted">'),Ci=["ALL","GET","POST","PUT","PATCH","DELETE"];function Ei(e){return Object.entries(e??{}).map(([t,r])=>r===!0?t:`${t}=${JSON.stringify(r)}`).join(", ")}var Mi=()=>{const[e,t]=R(""),[r,s]=R("ALL"),l=se(()=>{const c=e().trim().toLowerCase();return ae.routes().filter(h=>(r()==="ALL"||h.method.toUpperCase()===r())&&(!c||h.path.toLowerCase().includes(c)||h.controller.toLowerCase().includes(c)||h.handler.toLowerCase().includes(c)))}),a=se(()=>{const c=new Map;for(const h of l()){const f=c.get(h.controller)??[];f.push(h),c.set(h.controller,f)}return[...c]}),i=c=>{const h=Oe();return!!h&&h.method===c.method&&h.path===c.path},u=[(()=>{var c=bi(),h=c.firstChild,f=h.nextSibling,p=f.nextSibling,v=p.firstChild;return h.$$input=x=>t(x.currentTarget.value),n(f,o(te,{each:Ci,children:x=>(()=>{var w=yi();return w.$$click=()=>s(x),n(w,x),N(M=>{var y=r()===x,m=`px-2 py-0.5 text-[0.68rem] font-semibold rounded-md border ${r()===x?"bg-kick-500/20 text-kick-500 border-kick-500/30":"bg-surface-2 text-text-secondary border-border-strong hover:text-text-body"}`;return y!==M.e&&X(w,"aria-pressed",M.e=y),m!==M.t&&j(w,M.t=m),M},{e:void 0,t:void 0}),w})()})),n(p,o(_,{get when(){return e()||r()!=="ALL"},get children(){return[le(()=>l().length)," matched · "]}}),v),n(p,()=>ae.routes().length,v),N(()=>h.value=e()),c})(),(()=>{var c=$i();return n(c,o(_,{get when(){return a().length>0},get fallback(){return(()=>{var h=wi();return n(h,()=>ae.routes().length?"No routes match":"No routes registered"),h})()},get children(){return o(te,{get each(){return a()},children:([h,f])=>[(()=>{var p=_i(),v=p.firstChild,x=v.nextSibling,w=x.firstChild.nextSibling;return w.nextSibling,n(p,h,v),n(x,()=>f.length,w),p})(),o(te,{each:f,children:p=>(()=>{var v=ki(),x=v.firstChild,w=x.nextSibling;return v.$$click=()=>Jt(p),n(x,()=>p.method),n(w,()=>p.path),n(v,o(_,{get when(){return Ei(p.flags)},children:M=>(()=>{var y=Si();return n(y,M),y})()}),null),N(M=>{var y=`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.78rem] text-text-body ${i(p)?"bg-accent/12 shadow-[inset_2px_0_0_0_var(--color-accent)]":"bg-transparent hover:bg-surface-hover"}`,m=`${p.controller}.${p.handler}${p.middleware.length?` · middleware: ${p.middleware.join(", ")}`:""}`,S=`w-[3.4rem] shrink-0 font-mono text-[0.68rem] font-bold ${He(p.method)}`;return y!==M.e&&j(v,M.e=y),m!==M.t&&X(v,"title",M.t=m),S!==M.a&&j(x,M.a=S),M},{e:void 0,t:void 0,a:void 0}),v})()})]})}})),c})()];return o(Je,{storageKey:"routes",left:u,get right(){return o(Ra,{})}})};ye(["input","click"]);var Ti=d('<th><button type=button class="inline-flex items-center gap-1 text-text-muted hover:text-text-strong"><span aria-hidden=true>');function nl(e,t=!0){const[r,s]=R(e),[l,a]=R(t);return{key:r,desc:l,toggle:c=>{c===r()?a(h=>!h):(s(()=>c),a(!0))},apply:(c,h)=>c.toSorted((f,p)=>{const v=h(f,r()),x=h(p,r()),w=typeof v=="number"&&typeof x=="number"?v-x:String(v).localeCompare(String(x));return l()?-w:w}),set:s}}var ll=e=>(()=>{var t=Ti(),r=t.firstChild,s=r.firstChild;return Lr(r,"click",e.onClick,!0),n(r,()=>e.label,s),n(s,()=>e.desc?"↓":"↑"),N(l=>{var a=`px-2 py-1.5 font-semibold ${e.align==="left"?"text-left":"text-right"}`,i=e.active?"opacity-70":"opacity-0";return a!==l.e&&j(t,l.e=a),i!==l.t&&j(s,l.t=i),l},{e:void 0,t:void 0}),t})();ye(["click"]);var Ai=d('<div class="card text-sm text-red-500">'),Li=d('<div class="overflow-hidden rounded-xl border border-border bg-surface-1"><table class="w-full border-collapse text-[0.8rem]"><thead class="border-b border-border text-xs"><tr></tr></thead><tbody>'),Ri=d(`<p class="text-[0.66rem] text-text-muted">Percentiles cover each route's last 1,000 calls. Durations turn amber above 200 ms, orange above 500 ms, red above 1 s.`),Oi=d('<div class="flex flex-col gap-3"><div class="flex flex-wrap items-center gap-2"><input type=text placeholder="Filter routes…"class="w-64 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex overflow-hidden rounded-md border border-border-strong text-xs"></div><span class=flex-1></span><span class="text-xs text-text-muted"> routes'),qi=d("<button type=button>"),Ni=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">'),Pi=d('<tr class="cursor-pointer border-b border-dashed border-transparent hover:border-border hover:bg-surface-hover"><td class="px-2 py-1.5"><span class="flex items-center gap-2"><span></span><span class="truncate font-mono"></span></span></td><td class="px-2 py-1.5 text-right tabular-nums"></td><td></td><td>'),Ii=d('<tr class="border-b border-border bg-surface-2/50"><td colspan=7 class="px-4 py-3">'),Di=d('<span class="h-1.5 w-16 overflow-hidden rounded-full bg-border/60"><span class="block h-full rounded-full bg-kick-500/70">'),Ui=d('<td class="px-2 py-1.5 text-right tabular-nums"><span class="inline-flex items-center justify-end gap-2"><span>'),ji=d('<div class="flex flex-wrap items-end gap-8"><div><div class="mb-1 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">Latency (ms)</div><div class="flex h-16 items-end gap-1"></div></div><div class=text-xs><div class="mb-1 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">Outcomes</div><div class="flex gap-2"><span class="dt-pill dt-pill-ok"> ok</span><span class="dt-pill dt-pill-warn"> 4xx</span><span class="dt-pill dt-pill-err"> 5xx</span></div><div class="mt-2 text-text-muted">min <!> · avg '),Hi=d('<div class="flex w-7 flex-col items-center gap-0.5"><div class="w-full rounded-sm bg-kick-500/60"></div><span class="text-[0.58rem] text-text-muted tabular-nums">'),Bi=d('<button type=button class="rounded-md border border-kick-500/30 bg-kick-500/20 px-3 py-1 text-xs font-semibold text-kick-500 hover:bg-kick-500/30">Try in runner'),gn=["p50","p95","p99"],zi=()=>{const[e,t]=R(null),[r,s]=R(null),[l,a]=R(""),[i,u]=R("p95"),[c,h]=R(null),f=nl("p95"),p=async()=>{try{t(await we.metrics()),s(null)}catch(y){s(y instanceof Error?y.message:String(y))}};Ne(()=>{p();const y=setInterval(()=>{p()},2e3);Se(()=>clearInterval(y))});const v=se(()=>{const y=l().trim().toLowerCase(),m=Object.entries(e()?.routeLatency??{}).map(([b,g])=>{const $=b.indexOf(" ");return{...g,key:b,method:b.slice(0,$),path:b.slice($+1),errorShare:g.count?g.serverErrors/g.count:0}}),S=y?m.filter(b=>b.key.toLowerCase().includes(y)):m;return f.apply(S,(b,g)=>g==="route"?b.path:g==="errors"?b.errorShare:b[g])}),x=se(()=>Math.max(1,...v().map(y=>y[i()]))),w=y=>{u(y),f.set(y)},M=(y,m,S="right")=>o(ll,{label:m,align:S,get active(){return f.key()===y},get desc(){return f.desc()},onClick:()=>f.toggle(y)});return(()=>{var y=Oi(),m=y.firstChild,S=m.firstChild,b=S.nextSibling,g=b.nextSibling,$=g.nextSibling,C=$.firstChild;return S.$$input=O=>a(O.currentTarget.value),n(b,o(te,{each:gn,children:O=>(()=>{var q=qi();return q.$$click=()=>w(O),n(q,O),N(T=>{var D=i()===O,U=`px-2.5 py-1 font-semibold ${i()===O?"bg-kick-500/20 text-kick-500":"bg-surface-2 text-text-secondary hover:text-text-body"}`;return D!==T.e&&X(q,"aria-pressed",T.e=D),U!==T.t&&j(q,T.t=U),T},{e:void 0,t:void 0}),q})()})),n(m,o(Pe,{get metric(){return`latency.${i()}`}}),g),n($,()=>v().length,C),n(y,o(_,{get when(){return r()},get children(){var O=Ai();return n(O,r),O}}),null),n(y,o(_,{get when(){return v().length>0},get fallback(){return(()=>{var O=Ni(),q=O.firstChild;return n(q,()=>l()?"No routes match":"No requests yet — latency appears per route once the app is called."),O})()},get children(){return[(()=>{var O=Li(),q=O.firstChild.firstChild,T=q.firstChild,D=q.nextSibling;return n(T,()=>M("route","Route","left"),null),n(T,()=>M("count","Calls"),null),n(T,()=>M("errors","5xx"),null),n(T,()=>M("p50","p50"),null),n(T,()=>M("p95","p95"),null),n(T,()=>M("p99","p99"),null),n(T,()=>M("maxMs","Max"),null),n(D,o(te,{get each(){return v()},children:U=>[(()=>{var re=Pi(),Q=re.firstChild,k=Q.firstChild.firstChild,A=k.nextSibling,J=Q.nextSibling,V=J.nextSibling,B=V.nextSibling;return re.$$click=()=>h(I=>I===U.key?null:U.key),n(k,()=>U.method),n(A,()=>U.path),n(J,()=>U.count.toLocaleString()),n(V,(()=>{var I=le(()=>!!U.serverErrors);return()=>I()?Ht(U.errorShare):"—"})()),n(re,o(te,{each:gn,children:I=>(()=>{var ie=Ui(),E=ie.firstChild,P=E.firstChild;return n(E,o(_,{get when(){return I===i()},get children(){var Y=Di(),Z=Y.firstChild;return N(H=>Ie(Z,"width",`${U[I]/x()*100}%`)),Y}}),P),n(P,()=>$e(U[I])),N(()=>j(P,`min-w-14 ${ut(U[I])}`)),ie})()}),B),n(B,()=>$e(U.maxMs)),N(I=>{var ie=`w-[3.4rem] shrink-0 font-mono text-[0.68rem] font-bold ${He(U.method)}`,E=`px-2 py-1.5 text-right tabular-nums ${U.serverErrors?"text-red-500":"text-text-muted"}`,P=`${U.serverErrors} server errors, ${U.clientErrors} client errors`,Y=`px-2 py-1.5 text-right tabular-nums ${ut(U.maxMs)}`;return ie!==I.e&&j(k,I.e=ie),E!==I.t&&j(V,I.t=E),P!==I.a&&X(V,"title",I.a=P),Y!==I.o&&j(B,I.o=Y),I},{e:void 0,t:void 0,a:void 0,o:void 0}),re})(),o(_,{get when(){return c()===U.key},get children(){var re=Ii(),Q=re.firstChild;return n(Q,o(Fi,{row:U,get buckets(){return e()?.latencyBucketsMs??[]}})),re}})]})),O})(),Ri()]}}),null),N(()=>S.value=l()),y})()},Fi=e=>{const t=()=>Math.max(1,...e.row.histogram),r=a=>a<e.buckets.length?`≤${e.buckets[a]}`:`>${e.buckets[e.buckets.length-1]}`,s=()=>ae.routes().find(a=>a.method.toUpperCase()===e.row.method&&a.path===e.row.path),l=()=>e.row.count-e.row.serverErrors-e.row.clientErrors;return(()=>{var a=ji(),i=a.firstChild,u=i.firstChild.nextSibling,c=i.nextSibling.firstChild.nextSibling,h=c.firstChild,f=h.firstChild,p=h.nextSibling,v=p.firstChild,x=p.nextSibling,w=x.firstChild,M=c.nextSibling,y=M.firstChild.nextSibling;return y.nextSibling,n(u,o(te,{get each(){return e.row.histogram},children:(m,S)=>(()=>{var b=Hi(),g=b.firstChild,$=g.nextSibling;return n($,()=>r(S())),N(C=>{var O=`${m} calls ${r(S())} ms`,q=`${Math.max(m?2:0,m/t()*48)}px`;return O!==C.e&&X(b,"title",C.e=O),q!==C.t&&Ie(g,"height",C.t=q),C},{e:void 0,t:void 0}),b})()})),n(h,l,f),n(p,()=>e.row.clientErrors,v),n(x,()=>e.row.serverErrors,w),n(M,()=>$e(Number.isFinite(e.row.minMs)?e.row.minMs:0),y),n(M,()=>$e(e.row.count?e.row.totalMs/e.row.count:0),null),n(a,o(_,{get when(){return s()},children:m=>(()=>{var S=Bi();return S.$$click=()=>Jt(m()),S})()}),null),a})()};ye(["input","click"]);var Ki=d('<button type=button> <span class="font-normal opacity-70">'),Ji=d('<div class="flex flex-col gap-1.5 border-b border-border p-2"><input type=text placeholder="Search tokens…"class="w-full bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex flex-wrap items-center gap-1"><span class="mx-1 h-4 w-px bg-border"></span></div><div class="text-xs text-text-muted"> tokens'),Vi=d('<div class="min-h-0 flex-1 overflow-y-auto">'),Gi=d("<div class=empty>"),Yi=d('<span class="dt-tone dt-tone-gray">'),Wi=d('<button type=button><span></span><span class="min-w-0 flex-1 truncate font-mono"></span><span></span><span class="w-10 shrink-0 text-right text-[0.7rem] text-text-muted tabular-nums">×</span><span class="w-14 shrink-0 text-right text-[0.66rem] text-text-muted">'),Qi=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select a token to see its dependencies'),Xi=d('<div class="h-full overflow-y-auto bg-surface-1">'),sl=["controller","service","repository"],At=e=>sl.includes(e.kind??"")?e.kind:"other",Zi=()=>{const[e,t]=R(""),[r,s]=R(null),[l,a]=R(null),[i,u]=R(Go()),c=se(()=>{const y=e().trim().toLowerCase();return ae.container().filter(m=>!y||m.token.toLowerCase().includes(y))}),h=(y,m)=>{const S=new Map;for(const b of m)S.set(y(b),(S.get(y(b))??0)+1);return S},f=se(()=>h(At,c().filter(y=>!l()||(y.scope??"singleton")===l()))),p=se(()=>h(y=>y.scope??"singleton",c().filter(y=>!r()||At(y)===r()))),v=se(()=>c().filter(y=>(!r()||At(y)===r())&&(!l()||(y.scope??"singleton")===l())).toSorted((y,m)=>(m.resolveCount??0)-(y.resolveCount??0)||y.token.localeCompare(m.token))),x=(y,m,S,b)=>(()=>{var g=Ki(),$=g.firstChild,C=$.nextSibling;return Lr(g,"click",b,!0),X(g,"aria-pressed",S),j(g,`rounded-md border px-2 py-0.5 text-[0.68rem] font-semibold ${S?"border-kick-500/30 bg-kick-500/20 text-kick-500":"border-border-strong bg-surface-2 text-text-secondary hover:text-text-body"}`),n(g,y,$),n(C,m??0),g})(),w=[(()=>{var y=Ji(),m=y.firstChild,S=m.nextSibling,b=S.firstChild,g=S.nextSibling,$=g.firstChild;return m.$$input=C=>t(C.currentTarget.value),n(S,o(te,{get each(){return[...sl,"other"]},children:C=>x(C,f().get(C),r()===C,()=>s(O=>O===C?null:C))}),b),n(S,o(te,{each:["singleton","transient","request"],children:C=>x(C,p().get(C),l()===C,()=>a(O=>O===C?null:C))}),null),n(g,o(_,{get when(){return v().length!==ae.container().length},get children(){return[le(()=>v().length)," matched · "]}}),$),n(g,()=>ae.container().length,$),N(()=>m.value=e()),y})(),(()=>{var y=Vi();return n(y,o(_,{get when(){return v().length>0},get fallback(){return(()=>{var m=Gi();return n(m,()=>ae.container().length?"No tokens match":"Nothing registered yet"),m})()},get children(){return o(te,{get each(){return v()},children:m=>(()=>{var S=Wi(),b=S.firstChild,g=b.nextSibling,$=g.nextSibling,C=$.nextSibling,O=C.firstChild,q=C.nextSibling;return S.$$click=()=>u(m.token),n(g,()=>m.token),n($,()=>At(m)),n(S,o(_,{get when(){return(m.scope??"singleton")!=="singleton"},get children(){var T=Yi();return n(T,()=>m.scope),T}}),C),n(C,()=>m.resolveCount??0,O),n(q,(()=>{var T=le(()=>!!m.lastResolvedAt);return()=>T()?Ur(m.lastResolvedAt):"—"})()),N(T=>{var D=`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.78rem] text-text-body ${i()===m.token?"bg-accent/12 shadow-[inset_2px_0_0_0_var(--color-accent)]":"bg-transparent hover:bg-surface-hover"}`,U=`h-1.5 w-1.5 shrink-0 rounded-full ${Bt(m).label==="failed"?"bg-red-500":m.instantiated?"bg-emerald-500":"bg-border-strong"}`,re=Bt(m).label,Q=Dr(m.kind);return D!==T.e&&j(S,T.e=D),U!==T.t&&j(b,T.t=U),re!==T.a&&X(b,"title",T.a=re),Q!==T.o&&j($,T.o=Q),T},{e:void 0,t:void 0,a:void 0,o:void 0}),S})()})}})),y})()],M=o(_,{get when(){return i()},get fallback(){return Qi()},children:y=>(()=>{var m=Xi();return n(m,o(rl,{get token(){return y()},onSelect:u})),m})()});return o(Je,{storageKey:"container",left:w,right:M})};ye(["click","input"]);var ec=d("<button type=button>Retry all failed"),Lt=d("<button type=button>"),tc=d('<span class="text-xs text-text-muted">'),rc=d('<div class="flex flex-wrap items-center gap-1.5">'),nc=d('<div class="flex flex-col gap-2 border-b border-border p-2"><div class="flex flex-wrap gap-1">'),lc=d('<div class="p-4 text-sm text-text-muted">'),sc=d('<button type=button class="w-full py-2 text-xs text-text-muted hover:text-text-strong">Load 50 more'),ac=d('<div class="min-h-0 flex-1 overflow-y-auto">'),oc=d('<span class="font-normal text-text-muted">paused'),ic=d('<span class="rounded bg-red-500/15 px-1 text-red-500">'),cc=d('<div class="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">'),uc=d("<button type=button> <span>"),dc=d("<div class=empty>No <!> jobs"),fc=d('<span class="shrink-0 text-[0.68rem] text-text-muted tabular-nums"title=attempts>'),hc=d('<button type=button><span class="w-16 shrink-0 truncate font-mono text-[0.68rem] text-text-muted">#</span><span class="w-32 shrink-0 truncate font-mono font-semibold"></span><span class="min-w-0 flex-1 truncate text-[0.72rem] text-red-500"></span><span class="w-14 shrink-0 text-right text-[0.66rem] text-text-muted">'),gc=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">'),mc=d("<button type=button>Retry"),vc=d("<dt class=text-text-muted>Created"),lr=d("<dd class=m-0>"),pc=d("<dt class=text-text-muted>Ran for"),xc=d("<dt class=text-text-muted>Delay"),bc=d('<div class="rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-red-500">'),$c=d('<section class="flex h-full flex-col gap-3 overflow-y-auto bg-surface-1 p-4 text-[0.8rem]"><header class="flex flex-wrap items-center gap-2"><h2 class="m-0 font-mono text-base text-text-strong"></h2><span></span><span class="font-mono text-xs text-text-muted">#</span><span class=flex-1></span></header><dl class="grid grid-cols-[7rem_1fr] gap-y-1 text-xs"><dt class=text-text-muted>Attempts</dt><dd class="m-0 tabular-nums">'),yc=d('<pre class="m-0 mb-1.5 max-h-48 overflow-auto rounded-md border border-border bg-surface-2 p-2 font-mono text-[0.68rem]">'),wc=d('<div class=dt-panel-grid><div class="card max-w-lg text-sm text-text-secondary">'),_c=d('<p class="m-0 mb-2 font-semibold text-text-strong">No job tool is connected'),kc=d("<p class=m-0>Add <code>QueueAdapter</code> from <code>@forinda/kickjs-queue</code> to browse BullMQ jobs here — retry failures, remove jobs, pause a queue. Any other job tool can show up too by exposing <code>jobInspector()</code> from its adapter."),Sc=d('<pre class="m-0 max-h-72 overflow-auto rounded-md border border-border bg-surface-2 p-3 font-mono text-xs">'),Cc=d('<div><h3 class="mb-1.5 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">'),Ec=["failed","active","waiting","delayed","completed","paused"],sr=50,mn={failed:"text-red-500",active:"text-blue-500",waiting:"text-text-secondary",delayed:"text-amber-500",completed:"text-emerald-500",paused:"text-text-muted"},Mc=()=>{const[e,t]=R(null),[r,s]=R(null),[l,a]=R(null),[i,u]=R("failed"),[c,h]=R([]),[f,p]=R(null),[v,x]=R(sr),[w,M]=R(null),[y,m]=R(null),[S,b]=R(null),[g,$]=R(!1),[C,O]=R(null),q=se(()=>e()?.find(E=>E.source===l()?.source)),T=se(()=>q()?.queues.find(E=>E.name===l()?.queue)),D=E=>!!q()?.actions.includes(E),U=async()=>{try{const{sources:E}=await we.jobs();if(t(E),s(null),!l()){const P=E.find(Y=>Y.queues.length);P&&a({source:P.source,queue:P.queues[0].name})}}catch(E){s(E instanceof Error?E.message:String(E))}},re=async()=>{const E=l();if(E)try{const{jobs:P}=await we.jobList({...E,state:i(),start:0,end:v()-1});h(P),p(null)}catch(P){h([]),p(P instanceof Error?P.message:String(P))}},Q=async()=>{const E=l(),P=w();if(!E||!P){m(null);return}try{m(await we.job({...E,id:P}))}catch{m(null)}},k=async()=>{await U(),await Promise.all([re(),Q()])};Ne(()=>{k();const E=setInterval(()=>{k()},3e3);Se(()=>clearInterval(E))});const A=(E,P=i())=>{a(E),u(P),x(sr),M(null),m(null),re()},J=E=>{M(E),Q()},V=async(E,P={})=>{const Y=l();if(!Y)return;const Z=`${E}:${P.id??P.state??""}`;if(P.confirm&&C()!==Z){O(Z);return}O(null),$(!0),b(null);try{const H=await we.jobAction({...Y,action:E,id:P.id,state:P.state});b(E==="clean"?`Removed ${H.count??0} ${P.state} jobs`:E==="remove"?"Job removed":E==="retry"?"Job queued to run again":E==="retryAll"?"Failed jobs queued to run again":E==="pause"?"Queue paused":"Queue resumed"),(E==="remove"||E==="retry")&&M(null),await k()}catch(H){b(H instanceof Error?H.message:String(H))}finally{$(!1)}},B=(E=!1)=>`rounded-md border px-2 py-0.5 text-xs disabled:opacity-50 ${E?"border-red-500/40 text-red-500 hover:bg-red-500/10":"border-border-strong bg-surface-2 text-text-secondary hover:text-text-strong"}`,I=[(()=>{var E=nc(),P=E.firstChild;return n(P,o(te,{get each(){return e()??[]},children:Y=>o(te,{get each(){return Y.queues},children:Z=>{const H=()=>l()?.source===Y.source&&l()?.queue===Z.name;return(()=>{var ne=Lt();return ne.$$click=()=>A({source:Y.source,queue:Z.name},"failed"),n(ne,()=>Z.name,null),n(ne,o(_,{get when(){return Z.paused},get children(){return oc()}}),null),n(ne,o(_,{get when(){return Z.counts.failed},get children(){var W=ic();return n(W,()=>Z.counts.failed),W}}),null),N(W=>{var de=(e()?.length??0)>1?Y.source:void 0,L=`flex items-center gap-1.5 rounded-md border px-2 py-0.5 text-xs font-semibold ${H()?"border-kick-500/30 bg-kick-500/20 text-kick-500":"border-border-strong bg-surface-2 text-text-secondary hover:text-text-body"}`;return de!==W.e&&X(ne,"title",W.e=de),L!==W.t&&j(ne,W.t=L),W},{e:void 0,t:void 0}),ne})()}})})),n(E,o(_,{get when(){return T()},children:Y=>(()=>{var Z=cc();return n(Z,o(te,{each:Ec,children:H=>(()=>{var ne=uc(),W=ne.firstChild,de=W.nextSibling;return ne.$$click=()=>A(l(),H),n(ne,H,W),n(de,()=>Y().counts[H]??"–"),N(L=>{var z=`border-b-2 pb-0.5 ${i()===H?"border-kick-500 font-semibold text-text-strong":"border-transparent text-text-muted hover:text-text-body"}`,fe=`tabular-nums ${Y().counts[H]?mn[H]:""}`;return z!==L.e&&j(ne,L.e=z),fe!==L.t&&j(de,L.t=fe),L},{e:void 0,t:void 0}),ne})()})),Z})()}),null),n(E,o(_,{get when(){return T()},get children(){var Y=rc();return n(Y,o(_,{get when(){return le(()=>!!(D("retryAll")&&i()==="failed"))()&&T().counts.failed},get children(){var Z=ec();return Z.$$click=()=>{V("retryAll")},N(H=>{var ne=B(),W=g();return ne!==H.e&&j(Z,H.e=ne),W!==H.t&&(Z.disabled=H.t=W),H},{e:void 0,t:void 0}),Z}}),null),n(Y,o(_,{get when(){return le(()=>!!D("clean"))()&&c().length>0},get children(){var Z=Lt();return Z.addEventListener("blur",()=>O(null)),Z.$$click=()=>{V("clean",{state:i(),confirm:!0})},n(Z,(()=>{var H=le(()=>C()===`clean:${i()}`);return()=>H()?`Confirm: delete all ${i()}`:`Clean ${i()}`})()),N(H=>{var ne=B(!0),W=g();return ne!==H.e&&j(Z,H.e=ne),W!==H.t&&(Z.disabled=H.t=W),H},{e:void 0,t:void 0}),Z}}),null),n(Y,o(_,{get when(){return D(T().paused?"resume":"pause")},get children(){var Z=Lt();return Z.$$click=()=>{V(T().paused?"resume":"pause")},n(Z,()=>T().paused?"Resume queue":"Pause queue"),N(H=>{var ne=B(),W=g();return ne!==H.e&&j(Z,H.e=ne),W!==H.t&&(Z.disabled=H.t=W),H},{e:void 0,t:void 0}),Z}}),null),n(Y,o(_,{get when(){return S()},get children(){var Z=tc();return n(Z,S),Z}}),null),Y}}),null),E})(),(()=>{var E=ac();return n(E,o(_,{get when(){return f()},get children(){var P=lc();return n(P,f),P}}),null),n(E,o(_,{get when(){return c().length>0},get fallback(){return o(_,{get when(){return le(()=>!!T())()&&!f()},get children(){var P=dc(),Y=P.firstChild.nextSibling;return Y.nextSibling,n(P,i,Y),P}})},get children(){return[o(te,{get each(){return c()},children:P=>(()=>{var Y=hc(),Z=Y.firstChild;Z.firstChild;var H=Z.nextSibling,ne=H.nextSibling,W=ne.nextSibling;return Y.$$click=()=>J(P.id),n(Z,()=>P.id,null),n(H,()=>P.name),n(ne,()=>P.failedReason??""),n(Y,o(_,{get when(){return P.attempts>1||P.maxAttempts},get children(){var de=fc();return n(de,()=>P.attempts,null),n(de,(()=>{var L=le(()=>!!P.maxAttempts);return()=>L()?`/${P.maxAttempts}`:""})(),null),de}}),W),n(W,(()=>{var de=le(()=>!!(P.finishedAt??P.createdAt));return()=>de()?Ur(P.finishedAt??P.createdAt):""})()),N(()=>j(Y,`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.76rem] text-text-body ${w()===P.id?"bg-accent/12 shadow-[inset_2px_0_0_0_var(--color-accent)]":"bg-transparent hover:bg-surface-hover"}`)),Y})()}),o(_,{get when(){return c().length>=v()},get children(){var P=sc();return P.$$click=()=>{x(Y=>Y+sr),re()},P}})]}}),null),E})()],ie=o(_,{get when(){return y()},get fallback(){return(()=>{var E=gc(),P=E.firstChild;return n(P,()=>w()?"Loading…":"Select a job to see its data and errors"),E})()},children:E=>(()=>{var P=$c(),Y=P.firstChild,Z=Y.firstChild,H=Z.nextSibling,ne=H.nextSibling;ne.firstChild,ne.nextSibling;var W=Y.nextSibling,de=W.firstChild.nextSibling;return n(Z,()=>E().name),n(H,()=>E().state),n(ne,()=>E().id,null),n(Y,o(_,{get when(){return le(()=>!!D("retry"))()&&E().state==="failed"},get children(){var L=mc();return L.$$click=()=>{V("retry",{id:E().id})},N(z=>{var fe=B(),be=g();return fe!==z.e&&j(L,z.e=fe),be!==z.t&&(L.disabled=z.t=be),z},{e:void 0,t:void 0}),L}}),null),n(Y,o(_,{get when(){return D("remove")},get children(){var L=Lt();return L.addEventListener("blur",()=>O(null)),L.$$click=()=>{V("remove",{id:E().id,confirm:!0})},n(L,()=>C()===`remove:${E().id}`?"Confirm remove":"Remove"),N(z=>{var fe=B(!0),be=g();return fe!==z.e&&j(L,z.e=fe),be!==z.t&&(L.disabled=z.t=be),z},{e:void 0,t:void 0}),L}}),null),n(de,()=>E().attempts,null),n(de,(()=>{var L=le(()=>!!E().maxAttempts);return()=>L()?` of ${E().maxAttempts}`:""})(),null),n(W,o(_,{get when(){return E().createdAt},get children(){return[vc(),(()=>{var L=lr();return n(L,()=>new Date(E().createdAt).toLocaleString()),L})()]}}),null),n(W,o(_,{get when(){return le(()=>!!E().processedAt)()&&E().finishedAt},get children(){return[pc(),(()=>{var L=lr();return n(L,()=>$e(E().finishedAt-E().processedAt)),L})()]}}),null),n(W,o(_,{get when(){return E().delayMs},get children(){return[xc(),(()=>{var L=lr();return n(L,()=>$e(E().delayMs)),L})()]}}),null),n(P,o(_,{get when(){return E().failedReason},get children(){var L=bc();return n(L,()=>E().failedReason),L}}),null),n(P,o(ar,{title:"Data",get children(){return vn(E().data)}}),null),n(P,o(_,{get when(){return le(()=>E().result!==void 0)()&&E().result!==null},get children(){return o(ar,{title:"Result",get children(){return vn(E().result)}})}}),null),n(P,o(_,{get when(){return E().stacktrace?.length},get children(){return o(ar,{get title(){return`Stack traces (${E().stacktrace.length})`},get children(){return o(te,{get each(){return E().stacktrace.toReversed()},children:L=>(()=>{var z=yc();return n(z,L),z})()})}})}}),null),N(()=>j(H,`text-xs font-semibold ${mn[E().state]}`)),P})()});return o(_,{get when(){return le(()=>!!e())()&&e().length>0},get fallback(){return(()=>{var E=wc(),P=E.firstChild;return n(P,o(_,{get when(){return r()},get fallback(){return e()?Tc:"Loading…"},get children(){return r()}})),E})()},get children(){return o(Je,{storageKey:"queues",left:I,right:ie,defaultLeft:560})}})},Tc=[_c(),kc()];function vn(e){let t;try{t=JSON.stringify(e,null,2)??String(e)}catch{t=String(e)}return(()=>{var r=Sc();return n(r,t),r})()}var ar=e=>(()=>{var t=Cc(),r=t.firstChild;return n(r,()=>e.title),n(t,()=>e.children,null),t})();ye(["click"]);function Ac(){let e=new Map,t=new Set;return{on:(r,s)=>{let l=e.get(r);return l||(l=new Set,e.set(r,l)),l.add(s),()=>{let a=e.get(r);a?.delete(s),a&&a.size===0&&e.delete(r)}},onAny:r=>(t.add(r),()=>{t.delete(r)}),dispatch:r=>{let s=e.get(r.type);if(s&&s.size>0)for(let l of[...s])try{l(r.payload)}catch(a){console.error(`[kick:devtools-bus] handler for "${r.type}" threw`,a)}if(t.size>0)for(let l of[...t])try{l(r)}catch(a){console.error("[kick:devtools-bus] onAny handler threw",a)}}}}function Lc(e={}){let t=Ac(),r=e.channel===!1?null:e.channel??"kick-devtools",s=r!=null&&typeof BroadcastChannel<"u"?new BroadcastChannel(r):null;s?.addEventListener("message",v=>{let x=v.data;x&&typeof x.type=="string"&&typeof x.ts=="number"&&t.dispatch({...x,__kick_origin:"broadcast"})});let l=null,a=0,i=null,u=e.reconnectMs??500,c=e.reconnectMaxMs??5e3,h=()=>{e.wsUrl&&(typeof WebSocket>"u"||(!l||l.readyState!==WebSocket.OPEN&&l.readyState!==WebSocket.CONNECTING)&&(l=new WebSocket(e.wsUrl),l.addEventListener("open",()=>{a=0}),l.addEventListener("message",v=>{try{let x=JSON.parse(String(v.data));if(!x||typeof x.type!="string"||typeof x.ts!="number")return;t.dispatch({...x,__kick_origin:"ws"})}catch{}}),l.addEventListener("close",()=>{l=null,f()}),l.addEventListener("error",()=>{f()})))},f=()=>{if(!e.wsUrl||i!=null)return;a+=1;let v=Math.min(a*u,c);i=setTimeout(()=>{i=null,h()},v)},p=v=>{s?.postMessage(v),l&&l.readyState===WebSocket.OPEN?l.send(JSON.stringify(v)):e.wsUrl&&h()};return{on(v,x){return h(),t.on(v,x)},onAny(v){return h(),t.onAny(v)},emit(v,x){let w={type:v,payload:x,ts:Date.now(),__kick_origin:"local"};t.dispatch(w),p(w)}}}var ct=null,[Rc,kr]=R([]);function Oc(){if(ct)return()=>{};const e=`${Ke()}/_bus`,t=location.protocol==="https:"?"wss:":"ws:",r=pt(),s=r?`?token=${encodeURIComponent(r)}`:"",l=`${t}//${location.host}${e}${s}`;ct=Lc({channel:"kick-devtools",wsUrl:l});const a=ct.onAny(i=>{kr(u=>{const c=u.length>=500?u.slice(1):u.slice();return c.push(i),c})});return()=>{a(),ct=null,kr([])}}function zt(){return Rc}function qc(){kr([])}function al(){return ct}var or=200;function Sr(e){if(e==null)return String(e);if(typeof e=="bigint")return`${e.toString()}n`;if(typeof e!="object")return String(e);const t=new WeakSet,r=(l,a)=>{if(typeof a=="bigint")return`${a.toString()}n`;if(a instanceof Error)return{name:a.name,message:a.message};if(a&&typeof a=="object"){if(t.has(a))return"[Circular]";t.add(a)}return a};let s;try{s=JSON.stringify(e,r)}catch{s="[unserialisable]"}return s===void 0&&(s=String(e)),s.length>or?`${s.slice(0,or)}… (+${s.length-or} chars)`:s}function Cr(e){const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}:${String(t.getSeconds()).padStart(2,"0")}.${String(t.getMilliseconds()).padStart(3,"0")}`}function Nc(e){return e.replace(/'(?:[^']|'')*'/g,"?").replace(/\$\d+|:\w+|@\w+/g,"?").replace(/\b\d+(?:\.\d+)?\b/g,"?").replace(/\(\s*\?(?:\s*,\s*\?)+\s*\)/g,"(?)").replace(/\s+/g," ").trim()}var Pc=d("<button type=button>"),Ic=d('<span>p95 <b class="text-text-body tabular-nums">'),Dc=d("<span> statements"),Uc=d('<div class="flex flex-col gap-1.5 border-b border-border p-2"><div class="flex items-center gap-1.5"><input type=text placeholder="Filter SQL…"class="min-w-0 flex-1 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><div class="flex overflow-hidden rounded-md border border-border-strong text-xs"></div></div><div class="flex flex-wrap gap-x-3 text-xs text-text-muted"><span><b class="text-text-body tabular-nums"></b> queries</span><span><b class=tabular-nums></b> failed</span><span><b class=tabular-nums></b> ≥ 50 ms'),jc=d('<table class="w-full table-fixed border-collapse text-[0.76rem]"><colgroup><col><col class=w-14><col class=w-16><col class=w-20><col class=w-32><col class=w-20></colgroup><thead class="sticky top-0 z-1 border-b border-border bg-surface-2 text-xs"><tr></tr></thead><tbody>'),Hc=d('<div class="min-h-0 flex-1 overflow-y-auto">'),Bc=d("<div class=empty>No queries yet. kick/db reports each statement here when DevTools is installed — run one."),zc=d('<button type=button><span class="w-[5.6rem] shrink-0 font-mono text-[0.68rem] text-text-muted tabular-nums"></span><span></span><span class="min-w-0 flex-1 truncate font-mono text-[0.7rem]">'),Fc=d('<tr><td class="truncate px-2 py-1 font-mono text-[0.7rem]"></td><td class="px-2 py-1 text-right tabular-nums"></td><td></td><td></td><td class="px-2 py-1 text-right tabular-nums"><span class="inline-flex items-center gap-1.5"><span class="h-1.5 w-12 overflow-hidden rounded-full bg-border/60"><span class="block h-full rounded-full bg-kick-500/70"></span></span><span></span></span></td><td class="px-2 py-1 text-right tabular-nums">'),Kc=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select a query to see its SQL and parameters'),Jc=d('<section class="flex h-full flex-col gap-3 overflow-y-auto bg-surface-1 p-4 text-[0.8rem]">'),Vc=d('<dl class="grid grid-cols-3 gap-2">'),Gc=d('<div class="text-xs text-text-muted">'),Yc=d('<div class="rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-red-500">'),Wc=d('<pre class="m-0 whitespace-pre-wrap break-words rounded-md border border-border bg-surface-2 p-3 font-mono text-xs">'),Qc=d('<ol class="m-0 list-none rounded-md border border-border bg-surface-2 p-2 font-mono text-xs">'),Xc=d('<li class="flex gap-3 py-0.5"><span class="w-6 text-right text-text-muted">$</span><span class=break-all>'),Zc=d('<div class="rounded-md border border-border bg-surface-2 px-3 py-2"><dt class="text-[0.66rem] uppercase tracking-wider text-text-muted"></dt><dd class="m-0 font-semibold tabular-nums">'),eu=d('<div><h3 class="mb-1.5 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">'),tu=50,ru=()=>{const[e,t]=R([]),[r,s]=R("slowest"),[l,a]=R(""),[i,u]=R(null),c=nl("totalMs"),h=b=>{t(g=>[...g,b].slice(-500))},f=(b,g)=>{const $=b;return{sql:$.sql,parameters:$.parameters,durationMs:0,dialect:$.dialect,error:$.error instanceof Error?$.error.message:String($.error??"query error"),ts:g}};Ne(()=>{for(const C of zt()())C.type==="db:query"?h({...C.payload,ts:C.ts}):C.type==="db:query-error"&&h(f(C.payload,C.ts));const b=al(),g=b?.on("db:query",C=>h({...C,ts:C.ts??Date.now()})),$=b?.on("db:query-error",C=>h(f(C,Date.now())));Se(()=>{g?.(),$?.()})});const p=se(()=>{const b=l().trim().toLowerCase();return b?e().filter(g=>g.sql.toLowerCase().includes(b)):e()}),v=se(()=>{const b=new Map;for(const $ of p()){const C=Nc($.sql),O=b.get(C)??[];O.push($),b.set(C,O)}const g=[...b].map(([$,C])=>{const O=C.filter(T=>!T.error).map(T=>T.durationMs),q=O.reduce((T,D)=>T+D,0);return{sql:$,calls:C.length,errors:C.length-O.length,totalMs:q,meanMs:O.length?q/O.length:0,p95Ms:vr(O,95)??0,last:C[C.length-1]}});return c.apply(g,($,C)=>$[C])}),x=se(()=>Math.max(1,...v().map(b=>b.p95Ms))),w=se(()=>{const b=p(),g=b.filter($=>!$.error).map($=>$.durationMs);return{total:b.length,errors:b.length-g.length,slow:g.filter($=>$>=tu).length,p95:vr(g,95)}}),M=(b,g)=>(()=>{var $=Pc();return $.$$click=()=>s(b),n($,g),N(C=>{var O=r()===b,q=`px-2.5 py-1 font-semibold ${r()===b?"bg-kick-500/20 text-kick-500":"bg-surface-2 text-text-secondary hover:text-text-body"}`;return O!==C.e&&X($,"aria-pressed",C.e=O),q!==C.t&&j($,C.t=q),C},{e:void 0,t:void 0}),$})(),y=b=>`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.76rem] text-text-body ${b?"bg-accent/12 shadow-[inset_2px_0_0_0_var(--color-accent)]":"bg-transparent hover:bg-surface-hover"}`,m=[(()=>{var b=Uc(),g=b.firstChild,$=g.firstChild,C=$.nextSibling,O=g.nextSibling,q=O.firstChild,T=q.firstChild,D=q.nextSibling,U=D.firstChild,re=D.nextSibling,Q=re.firstChild;return $.$$input=k=>a(k.currentTarget.value),n(C,()=>M("slowest","Slowest"),null),n(C,()=>M("recent","Recent"),null),n(T,()=>w().total),n(U,()=>w().errors),n(Q,()=>w().slow),n(O,o(_,{get when(){return w().p95!==void 0},get children(){var k=Ic(),A=k.firstChild.nextSibling;return n(A,()=>$e(w().p95)),k}}),null),n(O,o(_,{get when(){return r()==="slowest"},get children(){var k=Dc(),A=k.firstChild;return n(k,()=>v().length,A),k}}),null),N(k=>{var A=w().errors?"text-red-500":"",J=w().slow?"text-amber-500":"";return A!==k.e&&j(D,k.e=A),J!==k.t&&j(re,k.t=J),k},{e:void 0,t:void 0}),N(()=>$.value=l()),b})(),(()=>{var b=Hc();return n(b,o(_,{get when(){return e().length>0},get fallback(){return Bc()},get children(){return o(_,{get when(){return r()==="slowest"},get fallback(){return o(te,{get each(){return p().toReversed()},children:g=>(()=>{var $=zc(),C=$.firstChild,O=C.nextSibling,q=O.nextSibling;return $.$$click=()=>u({query:g}),n(C,()=>Cr(g.ts)),n(O,(()=>{var T=le(()=>!!g.error);return()=>T()?"failed":$e(g.durationMs)})()),n(q,()=>g.sql),N(T=>{var D=y(i()?.query===g),U=`w-14 shrink-0 text-right tabular-nums ${g.error?"text-red-500":ut(g.durationMs,4)}`;return D!==T.e&&j($,T.e=D),U!==T.t&&j(O,T.t=U),T},{e:void 0,t:void 0}),$})()})},get children(){var g=jc(),$=g.firstChild.nextSibling,C=$.firstChild,O=$.nextSibling;return n(C,()=>[["sql","Statement","left"],["calls","Calls"],["errors","Failed"],["meanMs","Mean"],["p95Ms","p95"],["totalMs","Total"]].map(([q,T,D])=>o(ll,{label:T,align:D==="left"?"left":"right",get active(){return c.key()===q},get desc(){return c.desc()},onClick:()=>c.toggle(q)}))),n(O,o(te,{get each(){return v()},children:q=>(()=>{var T=Fc(),D=T.firstChild,U=D.nextSibling,re=U.nextSibling,Q=re.nextSibling,k=Q.nextSibling,A=k.firstChild.firstChild,J=A.firstChild,V=A.nextSibling,B=k.nextSibling;return T.$$click=()=>u({group:q,query:q.last}),n(D,()=>q.sql),n(U,()=>q.calls),n(re,()=>q.errors||"—"),n(Q,(()=>{var I=le(()=>q.calls>q.errors);return()=>I()?$e(q.meanMs):"—"})()),n(V,(()=>{var I=le(()=>q.calls>q.errors);return()=>I()?$e(q.p95Ms):"—"})()),n(B,()=>$e(q.totalMs)),N(I=>{var ie=`cursor-pointer border-b border-border/50 ${i()?.group?.sql===q.sql?"bg-accent/12":"hover:bg-surface-hover"}`,E=q.sql,P=`px-2 py-1 text-right tabular-nums ${q.errors?"text-red-500":"text-text-muted"}`,Y=`px-2 py-1 text-right tabular-nums ${ut(q.meanMs,4)}`,Z=`${q.p95Ms/x()*100}%`,H=`min-w-12 ${ut(q.p95Ms,4)}`;return ie!==I.e&&j(T,I.e=ie),E!==I.t&&X(D,"title",I.t=E),P!==I.a&&j(re,I.a=P),Y!==I.o&&j(Q,I.o=Y),Z!==I.i&&Ie(J,"width",I.i=Z),H!==I.n&&j(V,I.n=H),I},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),T})()})),g}})}})),b})()],S=o(_,{get when(){return i()},get fallback(){return Kc()},children:b=>(()=>{var g=Jc();return n(g,o(_,{get when(){return b().group},children:$=>(()=>{var C=Vc();return n(C,o(ir,{label:"Calls",get children(){return $().calls}}),null),n(C,o(ir,{label:"Mean",get children(){return le(()=>$().calls>$().errors)()?$e($().meanMs):"—"}}),null),n(C,o(ir,{label:"p95",get children(){return le(()=>$().calls>$().errors)()?$e($().p95Ms):"—"}}),null),C})()}),null),n(g,o(_,{get when(){return b().query},children:$=>[(()=>{var C=Gc();return n(C,()=>b().group?"Latest call · ":"",null),n(C,()=>new Date($().ts).toLocaleString(),null),n(C,o(_,{get when(){return $().dialect},get children(){return[" · ",le(()=>$().dialect)]}}),null),n(C,o(_,{get when(){return!$().error},get children(){return[" · ",le(()=>$e($().durationMs))]}}),null),C})(),o(_,{get when(){return $().error},get children(){var C=Yc();return n(C,()=>$().error),C}}),o(pn,{title:"SQL",get children(){var C=Wc();return n(C,()=>$().sql),C}}),o(_,{get when(){return $().parameters?.length},get children(){return o(pn,{get title(){return`Parameters (${$().parameters.length})`},get children(){var C=Qc();return n(C,o(te,{get each(){return $().parameters},children:(O,q)=>(()=>{var T=Xc(),D=T.firstChild;D.firstChild;var U=D.nextSibling;return n(D,()=>q()+1,null),n(U,()=>JSON.stringify(O)??String(O)),T})()})),C}})}})]}),null),g})()});return o(Je,{storageKey:"database",left:m,right:S,defaultLeft:600})},ir=e=>(()=>{var t=Zc(),r=t.firstChild,s=r.nextSibling;return n(r,()=>e.label),n(s,()=>e.children),t})(),pn=e=>(()=>{var t=eu(),r=t.firstChild;return n(r,()=>e.title),n(t,()=>e.children,null),t})();ye(["click","input"]);var Er=(e,t)=>`${e}→${t}`;function nu(e,t){const r=new Map(e.map(v=>[v,[]]));for(const v of t)r.has(v.from)&&r.has(v.to)&&r.get(v.from).push(v.to);const s=new Set,l=new Map,a=v=>{l.set(v,"active");for(const x of r.get(v))l.get(x)==="active"?s.add(Er(v,x)):l.has(x)||a(x);l.set(v,"done")};for(const v of e)l.has(v)||a(v);const i=v=>r.get(v).filter(x=>!s.has(Er(v,x))),u=new Set;for(const[v,x]of r){x.length&&u.add(v);for(const w of x)u.add(w)}const c=new Map,h=new Map([...u].map(v=>[v,0]));for(const v of u)for(const x of i(v))h.set(x,h.get(x)+1);const f=[...u].filter(v=>h.get(v)===0);for(const v of f)c.set(v,0);for(;f.length;){const v=f.shift();for(const x of i(v))c.set(x,Math.max(c.get(x)??0,c.get(v)+1)),h.set(x,h.get(x)-1),h.get(x)===0&&f.push(x)}const p=[];for(const v of e){if(!u.has(v))continue;const x=c.get(v)??0;(p[x]??=[]).push(v)}for(let v=1;v<p.length;v++){const x=new Map(p[v-1].map((M,y)=>[M,y])),w=M=>{const y=p[v-1].filter(m=>i(m).includes(M)).map(m=>x.get(m));return y.length?y.reduce((m,S)=>m+S,0)/y.length:1/0};p[v]=p[v].toSorted((M,y)=>w(M)-w(y))}return{layers:p,cycleEdges:s,isolated:e.filter(v=>!u.has(v))}}var lu=.2;var ol=e=>Math.min(3,Math.max(lu,e));function xn(e,t,r,s){const l=ol(e.k*t),a=l/e.k;return{k:l,x:r-(r-e.x)*a,y:s-(s-e.y)*a}}function su(e,t,r,s=24){const l=ol(Math.min(1,(t-s*2)/e.w,(r-s*2)/e.h));return{k:l,x:(t-e.w*l)/2-e.x*l,y:(r-e.h*l)/2-e.y*l}}var au=d('<span class="flex items-center gap-1 text-xs text-red-500"><span class="h-0.5 w-3 bg-red-500"></span> cycle'),ou=d('<button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-0.5 text-xs text-text-secondary hover:text-text-strong">Reset layout'),iu=d('<svg class="absolute inset-0 h-full w-full"><defs><marker id=dt-arrow viewBox="0 0 8 8"refX=7 refY=4 markerWidth=6 markerHeight=6 orient=auto><path d="M0 0 L8 4 L0 8 z"fill=var(--color-text-muted)></path></marker></defs><g>'),cu=d('<div class="max-h-32 overflow-y-auto border-t border-border p-3"><div class="mb-1.5 text-[0.66rem] font-semibold uppercase tracking-wider text-text-muted">No dependencies either way (<!>)</div><div class="flex flex-wrap gap-1">'),uu=d('<div class="flex h-full flex-col"><div class="flex flex-wrap items-center gap-2 border-b border-border p-2"><input type=text placeholder="Find a token — Enter to jump"class="w-52 bg-surface-2 border border-border-strong rounded-lg px-3 py-1 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><span class=flex-1></span><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-0.5 text-xs text-text-secondary hover:text-text-strong"aria-label="Zoom out">−</button><span class="w-10 text-center text-xs text-text-muted tabular-nums">%</span><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-0.5 text-xs text-text-secondary hover:text-text-strong"aria-label="Zoom in">+</button><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-0.5 text-xs text-text-secondary hover:text-text-strong">Fit</button></div><div style="background-image:radial-gradient(var(--color-border) 1px, transparent 1px)"><span class="pointer-events-none absolute bottom-2 left-2 text-[0.62rem] text-text-muted">Drag tokens to arrange · drag or scroll to pan · ⌘/Ctrl + scroll to zoom'),du=d('<span class="flex items-center gap-1 text-xs text-text-muted"><span class="h-2 w-2 rounded-sm">'),fu=d('<div class="p-6 text-sm text-text-muted">No dependencies between registered tokens yet.'),hu=d("<svg><path fill=none marker-end=url(#dt-arrow)></svg>",!1,!0,!1),gu=d("<svg><g class=cursor-move><title> — drag to move, click to focus</title><rect width=164 height=26 rx=5 fill=var(--color-surface-1)></rect><rect width=4 height=26 rx=2></rect><text x=12 y=17 font-size=11.5 font-family=var(--font-mono) fill=var(--color-text-body)></svg>",!1,!0,!1),mu=d("<button type=button>"),vu=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select a token to trace its dependencies'),pu=d('<div class="h-full overflow-y-auto bg-surface-1">'),cr=164,Rt=26,il="kickjs-devtools-graph-positions",xu=3,bn={controller:"#8b5cf6",service:"#3b82f6",repository:"#14b8a6"};function bu(){try{return JSON.parse(localStorage.getItem(il)??"{}")}catch{return{}}}var $u=()=>{const[e,t]=R(null),[r,s]=R(""),[l,a]=R(bu()),[i,u]=R({x:0,y:0,k:1}),[c,h]=R(!1);let f;const p=se(()=>ae.container()),v=se(()=>new Map(p().map(k=>[k.token,k]))),x=se(()=>p().flatMap(k=>(k.dependencies??[]).filter(A=>v().has(A)).map(A=>({from:k.token,to:A})))),w=se(()=>nu(p().map(k=>k.token),x())),M=se(()=>{const k=new Map;return w().layers.forEach((A,J)=>A.forEach((V,B)=>k.set(V,l()[V]??{x:J*220,y:B*36}))),k}),y=()=>{if(!f||M().size===0)return;const k=[...M().values()],A=Math.min(...k.map(B=>B.x)),J=Math.min(...k.map(B=>B.y)),V={x:A,y:J,w:Math.max(...k.map(B=>B.x))+cr-A,h:Math.max(...k.map(B=>B.y))+Rt-J};u(su(V,f.clientWidth,f.clientHeight))};Ne(()=>requestAnimationFrame(y)),qe($l(()=>M().size>0,(k,A)=>{k&&!A&&requestAnimationFrame(y)}));const m=k=>{a(k);try{localStorage.setItem(il,JSON.stringify(k))}catch{}};let S=null;const b=k=>{if(k.button!==0)return;const A=k.target.closest("[data-node]")?.getAttribute("data-node");if(k.currentTarget.setPointerCapture(k.pointerId),A){const J=M().get(A);S={kind:"node",id:A,sx:k.clientX,sy:k.clientY,from:J,dragged:!1}}else S={kind:"pan",sx:k.clientX,sy:k.clientY,view:i()},h(!0)},g=k=>{const A=S;if(!A)return;const J=k.clientX-A.sx,V=k.clientY-A.sy;if(A.kind==="pan"){u({...A.view,x:A.view.x+J,y:A.view.y+V});return}if(!A.dragged&&Math.hypot(J,V)<xu)return;A.dragged=!0;const B=i().k;a(I=>({...I,[A.id]:{x:A.from.x+J/B,y:A.from.y+V/B}}))},$=()=>{const k=S;S=null,h(!1),k?.kind==="node"?k.dragged?m(l()):t(A=>A===k.id?null:k.id):k?.kind==="pan"&&k.view===i()&&t(null)},C=k=>{if(k.preventDefault(),k.ctrlKey||k.metaKey){const A=f.getBoundingClientRect(),J=Math.max(-50,Math.min(50,k.deltaY));u(V=>xn(V,Math.exp(-J*.005),k.clientX-A.left,k.clientY-A.top))}else u(A=>({...A,x:A.x-k.deltaX,y:A.y-k.deltaY}))},O=k=>{f&&u(A=>xn(A,k,f.clientWidth/2,f.clientHeight/2))},q=se(()=>{const k=e();if(!k)return null;const A=(B,I)=>{const ie=new Set([B]),E=[B];for(;E.length;)for(const P of I(E.pop()))ie.has(P)||(ie.add(P),E.push(P));return ie},J=A(k,B=>x().filter(I=>I.from===B).map(I=>I.to)),V=A(k,B=>x().filter(I=>I.to===B).map(I=>I.from));return new Set([...J,...V])}),T=k=>!!q()&&!q().has(k),D=()=>{const k=r().trim().toLowerCase(),A=k&&p().find(V=>V.token.toLowerCase().includes(k));if(!A)return;t(A.token);const J=M().get(A.token);if(J&&f){const V=i().k;u({k:V,x:f.clientWidth/2-(J.x+cr/2)*V,y:f.clientHeight/2-(J.y+Rt/2)*V})}},U=(k,A)=>{const J=M().get(k),V=M().get(A),B=J.x+cr,I=J.y+Rt/2,ie=V.x,E=V.y+Rt/2,P=Math.max(30,Math.abs(ie-B)/2);return`M${B} ${I} C${B+P} ${I} ${ie-P} ${E} ${ie} ${E}`},re=(()=>{var k=uu(),A=k.firstChild,J=A.firstChild,V=J.nextSibling,B=V.nextSibling,I=B.nextSibling,ie=I.firstChild,E=I.nextSibling,P=E.nextSibling,Y=A.nextSibling,Z=Y.firstChild;return J.$$keydown=H=>H.key==="Enter"&&D(),J.$$input=H=>s(H.currentTarget.value),n(A,o(te,{get each(){return Object.entries(bn)},children:([H,ne])=>(()=>{var W=du(),de=W.firstChild;return Ie(de,"background",ne),n(W,H,null),W})()}),V),n(A,o(_,{get when(){return w().cycleEdges.size>0},get children(){return au()}}),V),B.$$click=()=>O(1/1.25),n(I,()=>Math.round(i().k*100),ie),E.$$click=()=>O(1.25),P.$$click=y,n(A,o(_,{get when(){return Object.keys(l()).length>0},get children(){var H=ou();return H.$$click=()=>{m({}),requestAnimationFrame(y)},H}}),null),Y.addEventListener("wheel",C),Y.addEventListener("pointercancel",$),Y.$$pointerup=$,Y.$$pointermove=g,Y.$$pointerdown=b,tt(H=>f=H,Y),n(Y,o(_,{get when(){return w().layers.length>0},get fallback(){return fu()},get children(){var H=iu(),ne=H.firstChild.nextSibling;return n(ne,o(te,{get each(){return x()},children:W=>{const de=()=>w().cycleEdges.has(Er(W.from,W.to));return(()=>{var L=hu();return N(z=>{var fe=U(W.from,W.to),be=de()?"#ef4444":"var(--color-border-strong)",ke=e()===W.from||e()===W.to?2:1.25,Ce=de()?"4 3":void 0,me=T(W.from)||T(W.to)?.15:1;return fe!==z.e&&X(L,"d",z.e=fe),be!==z.t&&X(L,"stroke",z.t=be),ke!==z.a&&X(L,"stroke-width",z.a=ke),Ce!==z.o&&X(L,"stroke-dasharray",z.o=Ce),me!==z.i&&X(L,"opacity",z.i=me),z},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),L})()}}),null),n(ne,o(te,{get each(){return w().layers.flat()},children:W=>{const de=()=>M().get(W),L=()=>v().get(W)?.kind??"";return(()=>{var z=gu(),fe=z.firstChild,be=fe.firstChild,ke=fe.nextSibling,Ce=ke.nextSibling,me=Ce.nextSibling;return X(z,"data-node",W),n(fe,W,be),n(me,(()=>{var ge=le(()=>W.length>22);return()=>ge()?`${W.slice(0,21)}…`:W})()),N(ge=>{var xt=`translate(${de().x} ${de().y})`,Ve=T(W)?.25:1,ze=e()===W?"var(--color-accent)":"var(--color-border-strong)",bt=e()===W?2:1,$t=bn[L()]??"var(--color-text-muted)";return xt!==ge.e&&X(z,"transform",ge.e=xt),Ve!==ge.t&&X(z,"opacity",ge.t=Ve),ze!==ge.a&&X(ke,"stroke",ge.a=ze),bt!==ge.o&&X(ke,"stroke-width",ge.o=bt),$t!==ge.i&&X(Ce,"fill",ge.i=$t),ge},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),z})()}}),null),N(()=>X(ne,"transform",`translate(${i().x} ${i().y}) scale(${i().k})`)),H}}),Z),n(k,o(_,{get when(){return w().isolated.length>0},get children(){var H=cu(),ne=H.firstChild,W=ne.firstChild.nextSibling;W.nextSibling;var de=ne.nextSibling;return n(ne,()=>w().isolated.length,W),n(de,o(te,{get each(){return w().isolated},children:L=>(()=>{var z=mu();return z.$$click=()=>t(L),n(z,L),N(()=>j(z,`${Dr(v().get(L)?.kind)} font-mono ${e()===L?"ring-1 ring-kick-500":""}`)),z})()})),H}}),null),N(H=>{var ne=`relative min-h-0 flex-1 touch-none select-none overflow-hidden ${c()?"cursor-grabbing":"cursor-grab"}`,W=`${16*i().k}px ${16*i().k}px`,de=`${i().x}px ${i().y}px`;return ne!==H.e&&j(Y,H.e=ne),W!==H.t&&Ie(Y,"background-size",H.t=W),de!==H.a&&Ie(Y,"background-position",H.a=de),H},{e:void 0,t:void 0,a:void 0}),N(()=>J.value=r()),k})(),Q=o(_,{get when(){return e()},get fallback(){return vu()},children:k=>(()=>{var A=pu();return n(A,o(rl,{get token(){return k()},onSelect:t})),A})()});return o(Je,{storageKey:"graph",defaultLeft:720,left:re,right:Q})};ye(["input","keydown","click","pointerdown","pointermove","pointerup"]);var yu=d('<div class="flex flex-wrap gap-1">'),wu=d("<span class=text-amber-500>"),_u=d('<div class="flex flex-col gap-1.5 border-b border-border p-2"><div class="flex items-center gap-1.5"><input type=text placeholder="Search type or payload…"class="min-w-0 flex-1 bg-surface-2 border border-border-strong rounded-lg px-3 py-1.5 text-sm text-text-body placeholder:text-text-muted focus:outline-none focus:border-kick-500"><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-1 text-xs text-text-secondary hover:text-text-strong"></button><button type=button class="rounded-md border border-border-strong bg-surface-2 px-2 py-1 text-xs text-text-secondary hover:text-text-strong">Clear</button></div><div class="flex items-center text-xs text-text-muted"><span> shown · <!>/<!> kept</span><span class=flex-1>'),ku=d('<button type=button class="absolute top-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-kick-500 px-3 py-0.5 text-xs font-semibold text-white shadow"> new ↑'),Su=d('<div class="relative min-h-0 flex-1"><div class="h-full overflow-y-auto">'),Cu=d('<button type=button><span class="h-1.5 w-1.5 rounded-full"></span><span class="font-normal text-text-muted">'),Eu=d("<div class=empty>"),Mu=d('<button type=button><span class="w-[5.6rem] shrink-0 font-mono text-[0.68rem] text-text-muted tabular-nums"></span><span class="flex w-36 shrink-0 items-center gap-1.5 truncate font-mono text-[0.72rem] font-semibold"><span class="h-1.5 w-1.5 shrink-0 rounded-full"></span></span><span class="min-w-0 flex-1 truncate font-mono text-[0.7rem] text-text-secondary">'),Tu=d('<div class=dt-panel-grid><div class="card text-sm text-text-muted">Select an event to see its payload'),Au=d('<section class="flex h-full flex-col gap-2 overflow-y-auto bg-surface-1 p-4 text-[0.8rem]"><header class="flex items-center gap-2"><span class="h-2 w-2 rounded-full"></span><h2 class="m-0 font-mono text-sm text-text-strong"></h2></header><div class="text-xs text-text-muted"> · </div><pre class="m-0 overflow-x-auto rounded-md border border-border bg-surface-2 p-3 font-mono text-xs leading-relaxed">'),at=e=>e.split(":")[0]||e;function $n(e){return/error|fail|crash/i.test(e)?"err":/warn|slow|retry|timeout/i.test(e)?"warn":"info"}function Lu(e){try{return JSON.stringify(e,null,2)??String(e)}catch{return Sr(e)}}var Ru=()=>{const e=zt(),[t,r]=R(""),[s,l]=R(new Set),[a,i]=R(null),[u,c]=R(null),[h,f]=R(!1);let p;const v=se(()=>{const q=new Map;for(const T of e())q.set(at(T.type),(q.get(at(T.type))??0)+1);return[...q].toSorted((T,D)=>D[1]-T[1])}),x=q=>{const T=t().trim().toLowerCase();return q.filter(D=>!s().has(at(D.type))&&(!T||D.type.toLowerCase().includes(T)||Sr(D.payload).toLowerCase().includes(T))).toReversed()},w=se(()=>x(u()??e())),M=se(()=>u()?x(e()).length-w().length:0),y=()=>{u()||c(e())},m=()=>{f(!1),c(null),p?.scrollTo({top:0})},S=()=>{!p||h()||(p.scrollTop>8?y():c(null))},b=q=>{l(T=>{const D=new Set(T);return D.has(q)?D.delete(q):D.add(q),D})},g={err:"bg-red-500/8",warn:"bg-amber-500/8",info:""},$={err:"shadow-[inset_2px_0_0_0_#ef4444]",warn:"shadow-[inset_2px_0_0_0_#f59e0b]",info:""},C=[(()=>{var q=_u(),T=q.firstChild,D=T.firstChild,U=D.nextSibling,re=U.nextSibling,Q=T.nextSibling,k=Q.firstChild,A=k.firstChild,J=A.nextSibling,V=J.nextSibling.nextSibling;return V.nextSibling,k.nextSibling,D.$$input=B=>r(B.currentTarget.value),U.$$click=()=>{h()?m():(f(!0),y())},n(U,()=>h()?"Resume":"Pause"),re.$$click=()=>{qc(),c(null),i(null)},n(q,o(_,{get when(){return v().length>0},get children(){var B=yu();return n(B,o(te,{get each(){return v()},children:([I,ie])=>(()=>{var E=Cu(),P=E.firstChild,Y=P.nextSibling;return E.$$click=()=>b(I),n(E,I,Y),n(Y,ie),N(Z=>{var H=!s().has(I),ne=`flex items-center gap-1 rounded-md border border-border-strong px-1.5 py-0.5 text-[0.68rem] font-semibold ${s().has(I)?"opacity-40":"bg-surface-2"}`,W=Xt(I);return H!==Z.e&&X(E,"aria-pressed",Z.e=H),ne!==Z.t&&j(E,Z.t=ne),W!==Z.a&&Ie(P,"background",Z.a=W),Z},{e:void 0,t:void 0,a:void 0}),E})()})),B}}),Q),n(k,()=>w().length,A),n(k,()=>e().length,J),n(k,500,V),n(Q,o(_,{get when(){return u()},get children(){var B=wu();return n(B,()=>h()?"paused":"held while scrolled"),B}}),null),N(()=>D.value=t()),q})(),(()=>{var q=Su(),T=q.firstChild;return n(q,o(_,{get when(){return M()>0},get children(){var D=ku(),U=D.firstChild;return D.$$click=m,n(D,M,U),D}}),T),T.addEventListener("scroll",S),tt(D=>p=D,T),n(T,o(_,{get when(){return w().length>0},get fallback(){return(()=>{var D=Eu();return n(D,()=>e().length?"No events match":"No events yet — kick/db queries, queue jobs and anything emitted on DEVTOOLS_BUS show up here."),D})()},get children(){return o(te,{get each(){return w()},children:D=>(()=>{var U=Mu(),re=U.firstChild,Q=re.nextSibling,k=Q.firstChild,A=Q.nextSibling;return U.$$click=()=>i(D),n(re,()=>Cr(D.ts)),n(Q,()=>D.type,null),n(A,()=>Sr(D.payload)),N(J=>{var V=`flex w-full cursor-pointer items-center gap-2 border-0 border-b border-border/50 px-2.5 py-1 text-left text-[0.76rem] text-text-body ${g[$n(D.type)]} ${$[$n(D.type)]} ${a()===D?"!bg-accent/12":"hover:bg-surface-hover"}`,B=Xt(at(D.type));return V!==J.e&&j(U,J.e=V),B!==J.t&&Ie(k,"background",J.t=B),J},{e:void 0,t:void 0}),U})()})}})),q})()],O=o(_,{get when(){return a()},get fallback(){return Tu()},children:q=>(()=>{var T=Au(),D=T.firstChild,U=D.firstChild,re=U.nextSibling,Q=D.nextSibling,k=Q.firstChild,A=Q.nextSibling;return n(re,()=>q().type),n(Q,()=>new Date(q().ts).toLocaleString(),k),n(Q,()=>Cr(q().ts),null),n(Q,o(_,{get when(){return q().pluginId},get children(){return[" · from ",le(()=>q().pluginId)]}}),null),n(A,()=>Lu(q().payload)),N(J=>Ie(U,"background",Xt(at(q().type)))),T})()});return o(Je,{storageKey:"activity",left:C,right:O,defaultLeft:560})};ye(["input","click"]);var Ou="modulepreload",qu=function(e){return"/_debug/"+e},yn={},Nu=function(t,r,s){let l=Promise.resolve();if(r&&r.length>0){let h=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))},f=function(p){return import.meta.resolve?import.meta.resolve(p):new URL(p,import.meta.url).href};const i=document.getElementsByTagName("link"),u=document.querySelector("meta[property=csp-nonce]"),c=u?.nonce||u?.getAttribute("nonce");l=h(r.map(p=>{if(p=qu(p,s),p=f(p),p in yn)return;yn[p]=!0;const v=p.endsWith(".css");for(let w=i.length-1;w>=0;w--){const M=i[w];if(M.href===p&&(!v||M.rel==="stylesheet"))return}const x=document.createElement("link");if(x.rel=v?"stylesheet":Ou,v||(x.as="script"),x.crossOrigin="",x.href=p,c&&x.setAttribute("nonce",c),document.head.appendChild(x),v)return new Promise((w,M)=>{x.addEventListener("load",w),x.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${p}`)))})}).filter(p=>p!==void 0))}function a(i){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=i,window.dispatchEvent(u),!u.defaultPrevented)throw i}return l.then(i=>{for(const u of i||[])u.status==="rejected"&&a(u.reason);return t().catch(a)})},Pu=d("<div style=display:flex;flex-direction:column;height:100%>"),Iu=d('<iframe title="custom devtools tab"sandbox="allow-scripts allow-same-origin allow-forms"style=flex:1;width:100%;border:none;background:var(--bg)>'),Du=d("<div style=padding:16px><div class=card>"),Uu=d("<div style=color:var(--text-dim);font-size:12px>"),ju=d('<div style="display:flex;align-items:center;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border)"><div><div style=font-weight:600></div></div><button type=button class=tab style="border:1px solid var(--border);border-radius:4px;padding:6px 14px;border-bottom-color:var(--border)">'),Hu=d('<div class=card><div class=card-title>Last response</div><pre class="m-0 font-mono text-xs whitespace-pre-wrap">'),Bu=d("<div style=padding:16px;flex:1;overflow:auto>"),zu=d('<div class="card m-4 text-red-500">'),Fu=d('<div class="min-h-0 flex-1 overflow-auto">'),Ku=e=>(()=>{var t=Pu();return n(t,o(_,{get when(){return e.tab.view.type==="iframe"},get children(){return o(Ju,{get view(){return e.tab.view}})}}),null),n(t,o(_,{get when(){return e.tab.view.type==="launch"},get children(){return o(Vu,{get view(){return e.tab.view},get tabId(){return e.tab.id}})}}),null),n(t,o(_,{get when(){return e.tab.view.type==="module"},get children(){return o(Yu,{get view(){return e.tab.view}})}}),null),n(t,o(_,{get when(){return e.tab.view.type==="html"},get children(){return o(Gu,{get view(){return e.tab.view}})}}),null),t})(),Ju=e=>{const t=()=>{const r=new URL(e.view.src,location.href),s=pt();return s&&r.origin===location.origin&&r.searchParams.set("token",s),r.href};return(()=>{var r=Iu();return N(()=>X(r,"src",t())),r})()},Vu=e=>{const[t,r]=R(null),[s,l]=R(null),a=async i=>{r(i),l(null);try{const u=new URLSearchParams({tab:e.tabId,action:i}),c=pt();c&&u.set("token",c);const h=await fetch(`${Ke()}/tabs/run?${u}`,{method:"POST",headers:c?{"x-devtools-token":c}:void 0}),f=await h.json().catch(()=>({}));l(h.ok?JSON.stringify(f.result,null,2):`${h.status} — ${f.error??h.statusText}`)}catch(u){l(u instanceof Error?u.message:String(u))}finally{r(null)}};return(()=>{var i=Du(),u=i.firstChild;return n(u,o(te,{get each(){return e.view.actions},children:c=>(()=>{var h=ju(),f=h.firstChild,p=f.firstChild,v=f.nextSibling;return n(p,()=>c.label),n(f,o(_,{get when(){return c.description},get children(){var x=Uu();return n(x,()=>c.description),x}}),null),v.$$click=()=>{a(c.id)},n(v,()=>t()===c.id?"Running…":"Run"),N(()=>v.disabled=t()===c.id),h})()})),n(i,o(_,{get when(){return s()},children:c=>(()=>{var h=Hu(),f=h.firstChild.nextSibling;return n(f,c),h})()}),null),i})()},Gu=e=>(()=>{var t=Bu();return N(()=>t.innerHTML=e.view.html),t})(),Yu=e=>{let t;const[r,s]=R(null);let l,a=!1;return Ne(async()=>{const i=new URL(e.view.src,location.href);if(i.origin!==location.origin){s(`Refusing to load a tab module from another origin: ${i.origin}`);return}const u=al();if(!u){s("The event bus is not ready yet — reopen the tab.");return}try{const c=await Nu(()=>import(i.href),[]),h=typeof c.default=="function"?c.default:c.default?.render;if(typeof h!="function"){s(`${i.pathname} has no default export with a render function`);return}if(a||!t)return;const f={bus:u,config:{theme:Or(),panelHeight:t.clientHeight},query:new URLSearchParams(location.search)};l=h(t,f)}catch(c){s(c instanceof Error?c.message:String(c))}}),Se(()=>{a=!0,typeof l=="function"&&l()}),[o(_,{get when(){return r()},get children(){var i=zu();return n(i,r),i}}),(()=>{var i=Fu();return tt(u=>t=u,i),i})()]};ye(["click"]);var Ft=!1,dt=null,Pt=null;async function Wu(){return pe.setConnectionStatus("connecting"),await Mr(),Pt=Fn("/stream",e=>{if(!Ft){if(pe.setConnectionStatus("live"),ul(),e.type==="metrics"){Qu(e),pe.touch();return}if(e.type==="container"){Mr();return}}},()=>{Ft||(ae.connectionStatus()!=="disconnected"&&pe.setConnectionStatus("polling"),cl())}),Xu}async function Mr(){const e=await Promise.allSettled([we.health(),we.metrics(),we.routeRegistry(),we.container(),we.queues(),we.ws()]);if(e.every(u=>u.status==="rejected"&&u.reason instanceof Pr)){pe.setAuthRequired(!0),pe.setConnectionStatus("disconnected");return}if(e.every(u=>u.status==="rejected")){pe.setConnectionStatus("disconnected"),cl();return}ae.connectionStatus()==="disconnected"&&pe.setConnectionStatus("polling"),ae.authRequired()&&(pe.setAuthRequired(!1),pe.setAuthError(null));const[t,r,s,l,a,i]=e;t.status==="fulfilled"&&pe.setHealth({status:t.value.status,errorRate:t.value.errorRate,uptime:t.value.uptime,adapters:t.value.adapters??{}}),r.status==="fulfilled"&&pe.setMetrics({requests:r.value.requests,serverErrors:r.value.serverErrors,clientErrors:r.value.clientErrors,errorRate:r.value.errorRate,uptimeSeconds:r.value.uptimeSeconds,startedAt:r.value.startedAt}),s.status==="fulfilled"&&pe.setRoutes(s.value.routes??[]),l.status==="fulfilled"&&pe.setContainer(l.value.registrations??[]),a.status==="fulfilled"&&pe.setQueues({enabled:a.value.enabled,queues:a.value.queues??[]}),i.status==="fulfilled"&&pe.setWs(i.value),pe.touch()}function Qu(e){const t=ae.metrics();if(!t)return;pe.setMetrics({...t,requests:e.requestCount,serverErrors:e.errorCount,clientErrors:e.clientErrorCount,errorRate:e.errorRate,uptimeSeconds:e.uptimeSeconds});const r=ae.health();r&&pe.setHealth({...r,uptime:e.uptimeSeconds,errorRate:e.errorRate})}function cl(){dt||(dt=setInterval(()=>{Ft||Mr()},5e3))}function ul(){dt&&(clearInterval(dt),dt=null)}function Xu(){Ft=!0,ul(),Pt&&(Pt(),Pt=null),pe.setConnectionStatus("disconnected")}var Zu=d('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.8 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path>'),wn={overview:"M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z",runtime:"M22 12h-4l-3 9L9 3l-3 9H2",memory:"M9 3v2M15 3v2M9 19v2M15 19v2M3 9h2M3 15h2M19 9h2M19 15h2M7 5h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2z",topology:"M12 2l10 5-10 5L2 7zM2 17l10 5 10-5M2 12l10 5 10-5",metrics:"M3 3v18h18M7 16v-4M12 16V8M17 16v-7",routes:"M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9a9 9 0 0 1-9 9",requests:"M7 7h13l-4-4M17 17H4l4 4",container:"M21 8l-9-5-9 5v8l9 5 9-5zM3 8l9 5 9-5M12 13v8",graph:"M18 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8.6 13.5l6.8 4M15.4 6.5l-6.8 4",database:"M12 3c4.97 0 9 1.34 9 3s-4.03 3-9 3-9-1.34-9-3 4.03-3 9-3zM21 12c0 1.66-4 3-9 3s-9-1.34-9-3M3 6v12c0 1.66 4 3 9 3s9-1.34 9-3V6",queues:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01",activity:"M12 8v4l3 3M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z",custom:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM17 14v6M14 17h6",expand:"M9 18l6-6-6-6",collapse:"M15 18l-6-6 6-6",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",action:"M13 2L3 14h9l-1 8 10-12h-9z",editor:"M16 18l6-6-6-6M8 6l-6 6 6 6"},Fe=e=>(()=>{var t=Zu(),r=t.firstChild;return N(s=>{var l=e.size??18,a=e.size??18,i=e.class,u=wn[e.name]??wn.custom;return l!==s.e&&X(t,"width",s.e=l),a!==s.t&&X(t,"height",s.t=a),i!==s.a&&X(t,"class",s.a=i),u!==s.o&&X(r,"d",s.o=u),s},{e:void 0,t:void 0,a:void 0,o:void 0}),t})(),ed=d('<div class="fixed inset-0 z-[60] bg-slate-950/90 flex items-center justify-center p-4"><div class="bg-slate-900 border border-slate-700 rounded-2xl p-8 max-w-md w-full shadow-2xl"><div class="text-center mb-6"><h2 class="text-xl font-bold text-kick-500 mb-2">⚡ KickJS DevTools</h2><p class="text-sm text-slate-400">Enter your DevTools token to continue.</p><p class="text-xs text-slate-600 mt-1">The token is printed in the server console on startup, e.g. <code class="font-mono text-slate-500">[token: abc123…]</code></p></div><form><input type=text autofocus placeholder="Paste your token here…"class="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-3 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-kick-500 font-mono mb-3"><button type=submit class="w-full bg-kick-500 hover:bg-kick-600 text-white font-semibold py-2.5 rounded-lg transition-colors disabled:opacity-50">'),td=d('<p class="text-red-400 text-sm mb-3">'),rd=()=>{const[e,t]=R(""),[r,s]=R(!1),l=async()=>{const a=e().trim();if(!a){pe.setAuthError("Token is required");return}s(!0),pe.setAuthError(null);try{mr(a),await we.health(),pe.setAuthRequired(!1),pe.setAuthError(null),t("")}catch{pe.setAuthError("Invalid token — request was rejected.")}finally{s(!1)}};return o(_,{get when(){return ae.authRequired()},get children(){var a=ed(),i=a.firstChild.firstChild.nextSibling,u=i.firstChild,c=u.nextSibling;return i.addEventListener("submit",h=>{h.preventDefault(),l()}),u.$$input=h=>t(h.currentTarget.value),n(i,o(_,{get when(){return ae.authError()},children:h=>(()=>{var f=td();return n(f,h),f})()}),c),n(c,()=>r()?"Verifying…":"Authenticate"),N(()=>c.disabled=r()),N(()=>u.value=e()),a}})};ye(["input"]);function _n(e,t){const r=e.trim().toLowerCase();if(!r)return 0;const s=t.toLowerCase(),l=s.indexOf(r);if(l>=0){const u=l===0||/[\s/.\-_:]/.test(s[l-1]);return 1e3-l+(u?100:0)}let a=0,i=0;for(const u of r){const c=s.indexOf(u,a);if(c<0)return null;i+=c-a,a=c+1}return 500-i}function nd(e,t){if(!t.trim())return[...e];const r=e.map(l=>{const a=_n(t,l.title),i=l.description?_n(t,l.description):null;return{item:l,score:Math.max(a??-1/0,i===null?-1/0:i-50)}}).filter(l=>l.score>-1/0).toSorted((l,a)=>a.score-l.score).map(l=>l.item),s=[...new Set(r.map(l=>l.group))];return r.toSorted((l,a)=>s.indexOf(l.group)-s.indexOf(a.group))}var ld=d('<div class="fixed inset-0 z-70 flex items-start justify-center bg-black/45 pt-[12vh]"><div class="flex max-h-[60vh] w-[min(640px,calc(100vw-32px))] flex-col overflow-hidden rounded-md border border-border-strong bg-surface-1 shadow-2xl"role=dialog aria-modal=true aria-label="Command palette"><div class="flex items-center gap-2.5 border-b border-border px-3.5 py-2.5 text-text-muted"><input class="flex-1 border-none bg-transparent text-sm text-text-body outline-none"placeholder="Jump to a tab, route or DI token…"aria-label=Search><kbd class=dt-kbd>Esc</kbd></div><div class="overflow-y-auto p-1.5"role=listbox>'),sd=d('<div class="p-6 text-center text-text-muted">No results for “<!>”'),ad=d('<div class="px-2 pt-2 pb-1 text-[0.64rem] font-bold uppercase tracking-wider text-text-muted">'),od=d('<span class="min-w-0 truncate text-xs text-text-muted">'),id=d("<button type=button role=option><span class=whitespace-nowrap>"),cd=e=>{const[t,r]=R(!1),[s,l]=R(""),[a,i]=R(0);let u,c,h=null;const f=se(()=>nd(e.items(),s()).slice(0,50)),p=()=>{h=document.activeElement instanceof HTMLElement?document.activeElement:null,l(""),i(0),r(!0),queueMicrotask(()=>u?.focus())},v=()=>{r(!1),h?.focus(),h=null},x=y=>{y&&(v(),y.run())};Ne(()=>{const y=m=>{if(m.key==="Escape"&&t()){m.preventDefault(),v();return}const S=m.target instanceof HTMLElement&&(m.target.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(m.target.tagName));(m.key==="k"&&(m.metaKey||m.ctrlKey)||m.key==="/"&&!S&&!t())&&(m.preventDefault(),t()?v():p())};document.addEventListener("keydown",y),Se(()=>document.removeEventListener("keydown",y))});const w=y=>{const m=f().length;y.key==="ArrowDown"?(y.preventDefault(),i(S=>m?(S+1)%m:0)):y.key==="ArrowUp"?(y.preventDefault(),i(S=>m?(S-1+m)%m:0)):y.key==="Enter"&&(y.preventDefault(),x(f()[a()]))},M=y=>{if(y.key!=="Tab"||!c)return;const m=[u,...c.querySelectorAll('[role="option"]')].filter(g=>!!g);if(m.length===0)return;const S=m.indexOf(document.activeElement),b=y.shiftKey?S<=0?m.length-1:S-1:(S+1)%m.length;y.preventDefault(),m[b].focus()};return o(_,{get when(){return t()},get children(){var y=ld(),m=y.firstChild,S=m.firstChild,b=S.firstChild,g=S.nextSibling;return y.$$click=$=>$.target===$.currentTarget&&v(),m.$$keydown=M,tt($=>c=$,m),n(S,o(Fe,{name:"search",size:16}),b),b.$$keydown=w,b.$$input=$=>{l($.currentTarget.value),i(0)},tt($=>u=$,b),n(g,o(_,{get when(){return f().length>0},get fallback(){return(()=>{var $=sd(),C=$.firstChild.nextSibling;return C.nextSibling,n($,s,C),$})()},get children(){return o(te,{get each(){return f()},children:($,C)=>[o(_,{get when(){return C()===0||f()[C()-1].group!==$.group},get children(){var O=ad();return n(O,()=>$.group),O}}),(()=>{var O=id(),q=O.firstChild;return O.$$click=()=>x($),O.$$mousemove=()=>i(C()),n(O,o(Fe,{get name(){return $.icon},size:16}),q),n(q,()=>$.title),n(O,o(_,{get when(){return $.description},get children(){var T=od();return n(T,()=>$.description),T}}),null),N(T=>{var D=C()===a(),U=`flex w-full cursor-pointer items-center gap-2.5 rounded-md border-none px-2 py-1.5 text-left text-[0.82rem] ${C()===a()?"bg-accent/15 text-text-strong":"bg-transparent text-text-secondary"}`;return D!==T.e&&X(O,"aria-selected",T.e=D),U!==T.t&&j(O,T.t=U),T},{e:void 0,t:void 0}),O})()]})}})),N(()=>b.value=s()),y}})};function ud(){document.dispatchEvent(new KeyboardEvent("keydown",{key:"k",ctrlKey:!0}))}ye(["click","keydown","input","mousemove"]);var kn=d("<div class=dt-nav-sep>"),dd=d("<div class=dt-resizer role=separator aria-orientation=vertical>"),fd=d('<div class=card style=border-color:var(--warn);margin-top:16px><div class=card-title style=color:var(--warn)> custom-tab issue(s)</div><ul style="margin:8px 0 0;padding-left:20px;font-family:var(--font-mono);font-size:12px">'),hd=d(`<div class="fixed bottom-4 left-1/2 z-60 flex -translate-x-1/2 items-center gap-2.5 rounded-md border border-red-500/40 bg-surface-1 px-3.5 py-2 text-[0.8rem] shadow-xl"role=status><span class="dt-pulse dt-pulse-disconnected"aria-hidden=true></span>Can't reach the app — retrying every few seconds…`),gd=d('<div class=app><header class=dt-header><div class=dt-header-brand><span class=dt-bolt aria-hidden=true>⚡</span><h1>KickJS DevTools</h1></div><div style=display:flex;align-items:center;gap:12px><button type=button class="flex cursor-pointer items-center gap-2 rounded-md border border-border-strong bg-surface-2 px-2.5 py-1 text-xs text-text-muted hover:text-text-strong">Search<kbd class=dt-kbd>⌘K</kbd></button></div></header><div class=dt-shell><aside role=tablist><div class=dt-sidebar-foot><button type=button class=dt-rail-toggle></button></div></aside><main role=tabpanel>'),ur=d("<button type=button role=tab><span class=dt-nav-main><span class=dt-nav-label>"),Sn=d("<span class=tab-badge>"),md=d("<div class=dt-nav-group><button type=button class=dt-nav-group-header><span>▾"),vd=d("<li>: "),pd=d("<div class=dt-conn><span aria-hidden=true></span><span class=dt-conn-label></span><span class=dt-conn-sep>·</span><span class=dt-conn-ts>Updated "),xd=d("<div class=dt-settings-pop role=menu><div class=dt-settings-section><div class=dt-settings-label>Density</div><div class=dt-seg></div><div class=dt-settings-hint>Controls spacing & font scale. Default: Small."),bd=d('<div class=dt-settings><button type=button aria-label=Settings aria-haspopup=true title=Settings><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=3></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.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-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z">'),$d=d("<button type=button>"),yd=d('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z">'),wd=d("<button type=button class=dt-theme-toggle>"),_d=d('<svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><circle cx=12 cy=12 r=4></circle><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41">');function dl(){return[{id:"overview",label:"Overview"},{id:"runtime",label:"Runtime"},{id:"topology",label:"Topology"},{id:"routes",label:"Routes",count:()=>ae.routes().length||void 0},{id:"metrics",label:"Metrics"},{id:"requests",label:"Requests"},{id:"container",label:"Container",count:()=>ae.container().length||void 0},{id:"queues",label:"Queues",count:()=>ae.queues().queues.length||void 0},{id:"database",label:"Database",count:()=>zt()().filter(e=>e.type==="db:query"||e.type==="db:query-error").length||void 0},{id:"graph",label:"Graph",count:()=>ae.container().length||void 0},{id:"activity",label:"Activity",count:()=>zt()().length||void 0}]}var kd=new Set(dl().map(e=>e.id)),Sd=[{label:null,ids:["overview"]},{label:"Runtime",ids:["runtime","topology","metrics","requests"]},{label:"Architecture",ids:["routes","container","graph"]},{label:"Data & Jobs",ids:["database","queues"]},{label:null,ids:["activity"]}],fl="kickjs-devtools-sidebar-w",Cn="kickjs-devtools-sidebar-mode",Cd=new Set(["routes","requests","container","graph","activity","database","queues"]),hl="kickjs-devtools-sidebar-collapsed",gl=150,ml=360;function Ed(){try{const e=Number(localStorage.getItem(fl));if(e>=gl&&e<=ml)return e}catch{}return 200}function Md(){try{const e=localStorage.getItem(hl);if(e)return JSON.parse(e)}catch{}return[]}var Td=()=>{const e=$s,[t,r]=R((()=>{try{return localStorage.getItem(Cn)!=="full"}catch{return!0}})()),s=()=>{const g=!t();r(g);try{localStorage.setItem(Cn,g?"rail":"full")}catch{}},[l,a]=R([]),[i,u]=R([]),c=dl(),h=new Map(c.map(g=>[g.id,g])),[f,p]=R(Ed()),[v,x]=R(Md()),w=g=>{x($=>{const C=$.includes(g)?$.filter(O=>O!==g):[...$,g];try{localStorage.setItem(hl,JSON.stringify(C))}catch{}return C})};let M=null;Se(()=>M?.());const y=g=>{g.preventDefault();const $=g.clientX,C=f();document.body.style.cursor="col-resize";const O=D=>{const U=Math.min(ml,Math.max(gl,C+(D.clientX-$)));p(U)},q=()=>{document.removeEventListener("mousemove",O),document.removeEventListener("mouseup",T),document.body.style.cursor="",M=null},T=()=>{q();try{localStorage.setItem(fl,String(f()))}catch{}};M=q,document.addEventListener("mousemove",O),document.addEventListener("mouseup",T)};Ne(()=>{we.tabs().then(({tabs:O,errors:q})=>{a(O.filter(T=>!kd.has(T.id))),u(q)}).catch(()=>{});let g=null;Wu().then(O=>{g=O});const $=Oc(),C=hs();Se(()=>{g?.(),$(),C()}),Ul(),Bl()});const m=g=>{rt(g),queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${g}"]`)?.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})})},S=()=>[...c.map(g=>({id:`tab:${g.id}`,title:g.label,group:"Tabs",icon:g.id,run:()=>m(g.id)})),...l().map(g=>({id:`tab:${g.id}`,title:g.title,group:"Tabs",icon:"custom",run:()=>m(g.id)})),...ae.routes().map(g=>({id:`route:${g.method} ${g.path}`,title:`${g.method} ${g.path}`,description:`${g.controller}.${g.handler}`,group:"Routes",icon:"routes",run:()=>Jt(g)})),...ae.container().map(g=>({id:`token:${g.token}`,title:g.token,description:[g.kind,g.scope].filter(Boolean).join(" · "),group:"DI tokens",icon:"container",run:()=>tl(g.token)})),...["system","light","dark"].map(g=>({id:`theme:${g}`,title:`Theme: ${g}`,group:"Actions",icon:"action",run:()=>Un(g)})),...["sm","md","lg"].map(g=>({id:`density:${g}`,title:`Density: ${g}`,group:"Actions",icon:"action",run:()=>Bn(g)}))],b=()=>l().find(g=>g.id===e());return(()=>{var g=gd(),$=g.firstChild,C=$.firstChild.nextSibling,O=C.firstChild,q=O.firstChild,T=$.nextSibling,D=T.firstChild,U=D.firstChild,re=U.firstChild,Q=D.nextSibling;return Lr(O,"click",ud,!0),n(O,o(Fe,{name:"search",size:13}),q),n(C,o(Ad,{}),null),n(C,o(Od,{}),null),n(C,o(Rd,{}),null),n(D,o(te,{each:Sd,children:k=>o(_,{get when(){return k.label},get fallback(){return o(te,{get each(){return k.ids},children:A=>{const J=h.get(A);return o(_,{when:J,children:V=>(()=>{var B=ur(),I=B.firstChild,ie=I.firstChild;return B.$$click=()=>m(A),X(B,"data-tab-id",A),n(I,o(Fe,{name:A}),ie),n(ie,()=>V().label),n(B,o(_,{get when(){return V().count?.()},children:E=>(()=>{var P=Sn();return n(P,E),P})()}),null),N(E=>{var P=`dt-nav-item ${e()===A?"active":""}`,Y=e()===A,Z=V().label;return P!==E.e&&j(B,E.e=P),Y!==E.t&&X(B,"aria-selected",E.t=Y),Z!==E.a&&X(B,"title",E.a=Z),E},{e:void 0,t:void 0,a:void 0}),B})()})}})},children:A=>(()=>{var J=md(),V=J.firstChild,B=V.firstChild;return n(J,o(_,{get when(){return t()},get children(){return kn()}}),V),V.$$click=()=>w(A()),n(V,A,null),n(J,o(_,{get when(){return t()||!v().includes(A())},get children(){return o(te,{get each(){return k.ids},children:I=>{const ie=h.get(I);return o(_,{when:ie,children:E=>(()=>{var P=ur(),Y=P.firstChild,Z=Y.firstChild;return P.$$click=()=>m(I),X(P,"data-tab-id",I),n(Y,o(Fe,{name:I}),Z),n(Z,()=>E().label),n(P,o(_,{get when(){return E().count?.()},children:H=>(()=>{var ne=Sn();return n(ne,H),ne})()}),null),N(H=>{var ne=`dt-nav-item nested ${e()===I?"active":""}`,W=e()===I,de=E().label;return ne!==H.e&&j(P,H.e=ne),W!==H.t&&X(P,"aria-selected",H.t=W),de!==H.a&&X(P,"title",H.a=de),H},{e:void 0,t:void 0,a:void 0}),P})()})}})}}),null),N(I=>{var ie=t(),E=!v().includes(A()),P=`dt-nav-caret ${v().includes(A())?"closed":""}`;return ie!==I.e&&(V.hidden=I.e=ie),E!==I.t&&X(V,"aria-expanded",I.t=E),P!==I.a&&j(B,I.a=P),I},{e:void 0,t:void 0,a:void 0}),J})()})}),U),n(D,o(_,{get when(){return l().length>0},get children(){return[kn(),o(te,{get each(){return l()},children:k=>(()=>{var A=ur(),J=A.firstChild,V=J.firstChild;return A.$$click=()=>m(k.id),n(J,o(Fe,{name:"custom"}),V),n(V,()=>k.title),N(B=>{var I=k.id,ie=`dt-nav-item ${e()===k.id?"active":""}`,E=e()===k.id,P=k.title;return I!==B.e&&X(A,"data-tab-id",B.e=I),ie!==B.t&&j(A,B.t=ie),E!==B.a&&X(A,"aria-selected",B.a=E),P!==B.o&&X(A,"title",B.o=P),B},{e:void 0,t:void 0,a:void 0,o:void 0}),A})()})]}}),U),re.$$click=s,n(re,o(Fe,{get name(){return t()?"expand":"collapse"},size:16})),n(T,o(_,{get when(){return!t()},get children(){var k=dd();return k.$$mousedown=y,k}}),Q),n(Q,o(_,{get when(){return e()==="overview"},get children(){return o(co,{})}}),null),n(Q,o(_,{get when(){return e()==="runtime"},get children(){return o(qo,{})}}),null),n(Q,o(_,{get when(){return e()==="topology"},get children(){return o(pi,{})}}),null),n(Q,o(_,{get when(){return e()==="routes"},get children(){return o(Mi,{})}}),null),n(Q,o(_,{get when(){return e()==="requests"},get children(){return o(Wa,{})}}),null),n(Q,o(_,{get when(){return e()==="metrics"},get children(){return o(zi,{})}}),null),n(Q,o(_,{get when(){return e()==="container"},get children(){return o(Zi,{})}}),null),n(Q,o(_,{get when(){return e()==="queues"},get children(){return o(Mc,{})}}),null),n(Q,o(_,{get when(){return e()==="database"},get children(){return o(ru,{})}}),null),n(Q,o(_,{get when(){return e()==="graph"},get children(){return o($u,{})}}),null),n(Q,o(_,{get when(){return e()==="activity"},get children(){return o(Ru,{})}}),null),n(Q,o(_,{get when(){return b()},children:k=>o(Ku,{get tab(){return k()}})}),null),n(Q,o(_,{get when(){return le(()=>i().length>0)()&&e()==="overview"},get children(){var k=fd(),A=k.firstChild,J=A.firstChild,V=A.nextSibling;return n(A,()=>i().length,J),n(V,o(te,{get each(){return i()},children:B=>(()=>{var I=vd(),ie=I.firstChild;return n(I,()=>B.source,ie),n(I,()=>B.reason,null),I})()})),k}}),null),n(g,o(cd,{items:S}),null),n(g,o(rd,{}),null),n(g,o(_,{get when(){return le(()=>ae.connectionStatus()==="disconnected")()&&!ae.authRequired()},get children(){return hd()}}),null),N(k=>{var A=`dt-sidebar ${t()?"rail":""}`,J=`width:${f()}px`,V=t()?"Show labels":"Icons only",B=t()?"Show labels":"Icons only",I=`dt-main ${Cd.has(e())?"flush":""}`;return A!==k.e&&j(D,k.e=A),k.t=Pn(D,J,k.t),V!==k.a&&X(re,"title",k.a=V),B!==k.o&&X(re,"aria-label",k.o=B),I!==k.i&&j(Q,k.i=I),k},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),g})()},Ad=()=>{const e=r=>r==="live"?"Live":r==="polling"?"Polling":r==="disconnected"?"Disconnected":"Connecting…",t=r=>r?r.toLocaleTimeString():"never";return(()=>{var r=pd(),s=r.firstChild,l=s.nextSibling,a=l.nextSibling.nextSibling;return a.firstChild,n(l,()=>e(ae.connectionStatus())),n(a,()=>t(ae.lastUpdate()),null),N(()=>j(s,`dt-pulse dt-pulse-${ae.connectionStatus()}`)),r})()},Ld=[{id:"sm",label:"Small"},{id:"md",label:"Medium"},{id:"lg",label:"Large"}],Rd=()=>{const[e,t]=R(!1);let r;const s=a=>{e()&&r&&!r.contains(a.target)&&t(!1)},l=a=>{a.key==="Escape"&&t(!1)};return document.addEventListener("click",s),document.addEventListener("keydown",l),Se(()=>{document.removeEventListener("click",s),document.removeEventListener("keydown",l)}),(()=>{var a=bd(),i=a.firstChild;return tt(u=>r=u,a),i.$$click=()=>t(u=>!u),n(a,o(_,{get when(){return e()},get children(){var u=xd(),c=u.firstChild.firstChild.nextSibling;return n(c,o(te,{each:Ld,children:h=>(()=>{var f=$d();return f.$$click=()=>Bn(h.id),n(f,()=>h.label),N(p=>{var v=`dt-seg-item ${Qr()===h.id?"active":""}`,x=Qr()===h.id;return v!==p.e&&j(f,p.e=v),x!==p.t&&X(f,"aria-pressed",p.t=x),p},{e:void 0,t:void 0}),f})()})),u}}),null),N(u=>{var c=`dt-settings-btn ${e()?"open":""}`,h=e();return c!==u.e&&j(i,u.e=c),h!==u.t&&X(i,"aria-expanded",u.t=h),u},{e:void 0,t:void 0}),a})()},Od=()=>{const e=()=>{const r=Yt()==="system"?"light":Yt()==="light"?"dark":"system";Un(r)},t=()=>{const r=Yt();return`Theme: ${r==="system"?"follow system":r} (click to cycle)`};return(()=>{var r=wd();return r.$$click=e,n(r,o(_,{get when(){return Or()==="dark"},get fallback(){return _d()},get children(){return yd()}})),N(s=>{var l=t(),a=t();return l!==s.e&&X(r,"aria-label",s.e=l),a!==s.t&&X(r,"title",s.t=a),s},{e:void 0,t:void 0}),r})()};ye(["click","mousedown"]);var vl=document.getElementById("root");if(!vl)throw new Error("#root not found");Rl(()=>o(Td,{}),vl);
|