rails-profiler 0.44.4 → 0.44.6

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.
@@ -1,17 +1,17 @@
1
- "use strict";(()=>{var gn=e=>{throw TypeError(e)};var is=(e,r,o)=>r.has(e)||gn("Cannot "+o);var p=(e,r,o)=>(is(e,r,"read from private field"),o?o.call(e):r.get(e)),S=(e,r,o)=>r.has(e)?gn("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,o),E=(e,r,o,s)=>(is(e,r,"write to private field"),s?s.call(e,o):r.set(e,o),o),I=(e,r,o)=>(is(e,r,"access private method"),o);var Jr=(e,r,o,s)=>({set _(n){E(e,r,n,o)},get _(){return p(e,r,s)}});var Fo,ee,_n,gl,wt,bn,Tn,wn,Cn,ds,ls,us,En,So={},Ao=[],bl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qo=Array.isArray;function dt(e,r){for(var o in r)e[o]=r[o];return e}function fs(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vl(e,r,o){var s,n,a,i={};for(a in r)a=="key"?s=r[a]:a=="ref"?n=r[a]:i[a]=r[a];if(arguments.length>2&&(i.children=arguments.length>3?Fo.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return ko(e,i,s,n,null)}function ko(e,r,o,s,n){var a={type:e,props:r,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++_n,__i:-1,__u:0};return n==null&&ee.vnode!=null&&ee.vnode(a),a}function M(e){return e.children}function Po(e,r){this.props=e,this.context=r}function dr(e,r){if(r==null)return e.__?dr(e.__,e.__i+1):null;for(var o;r<e.__k.length;r++)if((o=e.__k[r])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?dr(e):null}function xl(e){if(e.__P&&e.__d){var r=e.__v,o=r.__e,s=[],n=[],a=dt({},r);a.__v=r.__v+1,ee.vnode&&ee.vnode(a),ms(e.__P,a,r,e.__n,e.__P.namespaceURI,32&r.__u?[o]:null,s,o??dr(r),!!(32&r.__u),n),a.__v=r.__v,a.__.__k[a.__i]=a,Sn(s,a,n),r.__e=r.__=null,a.__e!=o&&Rn(a)}}function Rn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(r){if(r!=null&&r.__e!=null)return e.__e=e.__c.base=r.__e}),Rn(e)}function cs(e){(!e.__d&&(e.__d=!0)&&wt.push(e)&&!Mo.__r++||bn!=ee.debounceRendering)&&((bn=ee.debounceRendering)||Tn)(Mo)}function Mo(){try{for(var e,r=1;wt.length;)wt.length>r&&wt.sort(wn),e=wt.shift(),r=wt.length,xl(e)}finally{wt.length=Mo.__r=0}}function kn(e,r,o,s,n,a,i,l,c,d,m){var f,y,h,g,b,x,w,C=s&&s.__k||Ao,A=r.length;for(c=_l(o,r,C,c,A),f=0;f<A;f++)(h=o.__k[f])!=null&&(y=h.__i!=-1&&C[h.__i]||So,h.__i=f,x=ms(e,h,y,n,a,i,l,c,d,m),g=h.__e,h.ref&&y.ref!=h.ref&&(y.ref&&hs(y.ref,null,h),m.push(h.ref,h.__c||g,h)),b==null&&g!=null&&(b=g),(w=!!(4&h.__u))||y.__k===h.__k?c=Pn(h,c,e,w):typeof h.type=="function"&&x!==void 0?c=x:g&&(c=g.nextSibling),h.__u&=-7);return o.__e=b,c}function _l(e,r,o,s,n){var a,i,l,c,d,m=o.length,f=m,y=0;for(e.__k=new Array(n),a=0;a<n;a++)(i=r[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=ko(null,i,null,null,null):qo(i)?i=e.__k[a]=ko(M,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=ko(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,c=a+y,i.__=e,i.__b=e.__b+1,l=null,(d=i.__i=Tl(i,o,c,f))!=-1&&(f--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(n>m?y--:n<m&&y++),typeof i.type!="function"&&(i.__u|=4)):d!=c&&(d==c-1?y--:d==c+1?y++:(d>c?y--:y++,i.__u|=4))):e.__k[a]=null;if(f)for(a=0;a<m;a++)(l=o[a])!=null&&(2&l.__u)==0&&(l.__e==s&&(s=dr(l)),Mn(l,l));return s}function Pn(e,r,o,s){var n,a;if(typeof e.type=="function"){for(n=e.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=e,r=Pn(n[a],r,o,s));return r}e.__e!=r&&(s&&(r&&e.type&&!r.parentNode&&(r=dr(e)),o.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function Tl(e,r,o,s){var n,a,i,l=e.key,c=e.type,d=r[o],m=d!=null&&(2&d.__u)==0;if(d===null&&l==null||m&&l==d.key&&c==d.type)return o;if(s>(m?1:0)){for(n=o-1,a=o+1;n>=0||a<r.length;)if((d=r[i=n>=0?n--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return i}return-1}function vn(e,r,o){r[0]=="-"?e.setProperty(r,o??""):e[r]=o==null?"":typeof o!="number"||bl.test(r)?o:o+"px"}function Ro(e,r,o,s,n){var a,i;e:if(r=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(r in s)o&&r in o||vn(e.style,r,"");if(o)for(r in o)s&&o[r]==s[r]||vn(e.style,r,o[r])}else if(r[0]=="o"&&r[1]=="n")a=r!=(r=r.replace(Cn,"$1")),i=r.toLowerCase(),r=i in e||r=="onFocusOut"||r=="onFocusIn"?i.slice(2):r.slice(2),e.l||(e.l={}),e.l[r+a]=o,o?s?o.u=s.u:(o.u=ds,e.addEventListener(r,a?us:ls,a)):e.removeEventListener(r,a?us:ls,a);else{if(n=="http://www.w3.org/2000/svg")r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!="width"&&r!="height"&&r!="href"&&r!="list"&&r!="form"&&r!="tabIndex"&&r!="download"&&r!="rowSpan"&&r!="colSpan"&&r!="role"&&r!="popover"&&r in e)try{e[r]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&r[4]!="-"?e.removeAttribute(r):e.setAttribute(r,r=="popover"&&o==1?"":o))}}function xn(e){return function(r){if(this.l){var o=this.l[r.type+e];if(r.t==null)r.t=ds++;else if(r.t<o.u)return;return o(ee.event?ee.event(r):r)}}}function ms(e,r,o,s,n,a,i,l,c,d){var m,f,y,h,g,b,x,w,C,A,k,K,U,L,j,T=r.type;if(r.constructor!==void 0)return null;128&o.__u&&(c=!!(32&o.__u),a=[l=r.__e=o.__e]),(m=ee.__b)&&m(r);e:if(typeof T=="function")try{if(w=r.props,C=T.prototype&&T.prototype.render,A=(m=T.contextType)&&s[m.__c],k=m?A?A.props.value:m.__:s,o.__c?x=(f=r.__c=o.__c).__=f.__E:(C?r.__c=f=new T(w,k):(r.__c=f=new Po(w,k),f.constructor=T,f.render=Cl),A&&A.sub(f),f.state||(f.state={}),f.__n=s,y=f.__d=!0,f.__h=[],f._sb=[]),C&&f.__s==null&&(f.__s=f.state),C&&T.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dt({},f.__s)),dt(f.__s,T.getDerivedStateFromProps(w,f.__s))),h=f.props,g=f.state,f.__v=r,y)C&&T.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),C&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(C&&T.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,k),r.__v==o.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,k)===!1){r.__v!=o.__v&&(f.props=w,f.state=f.__s,f.__d=!1),r.__e=o.__e,r.__k=o.__k,r.__k.some(function(F){F&&(F.__=r)}),Ao.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,k),C&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,g,b)})}if(f.context=k,f.props=w,f.__P=e,f.__e=!1,K=ee.__r,U=0,C)f.state=f.__s,f.__d=!1,K&&K(r),m=f.render(f.props,f.state,f.context),Ao.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,K&&K(r),m=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++U<25);f.state=f.__s,f.getChildContext!=null&&(s=dt(dt({},s),f.getChildContext())),C&&!y&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(h,g)),L=m!=null&&m.type===M&&m.key==null?An(m.props.children):m,l=kn(e,qo(L)?L:[L],r,o,s,n,a,i,l,c,d),f.base=r.__e,r.__u&=-161,f.__h.length&&i.push(f),x&&(f.__E=f.__=null)}catch(F){if(r.__v=null,c||a!=null)if(F.then){for(r.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,r.__e=l}else{for(j=a.length;j--;)fs(a[j]);ps(r)}else r.__e=o.__e,r.__k=o.__k,F.then||ps(r);ee.__e(F,r,o)}else a==null&&r.__v==o.__v?(r.__k=o.__k,r.__e=o.__e):l=r.__e=wl(o.__e,r,o,s,n,a,i,c,d);return(m=ee.diffed)&&m(r),128&r.__u?void 0:l}function ps(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ps))}function Sn(e,r,o){for(var s=0;s<o.length;s++)hs(o[s],o[++s],o[++s]);ee.__c&&ee.__c(r,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(a){a.call(n)})}catch(a){ee.__e(a,n.__v)}})}function An(e){return typeof e!="object"||e==null||e.__b>0?e:qo(e)?e.map(An):dt({},e)}function wl(e,r,o,s,n,a,i,l,c){var d,m,f,y,h,g,b,x=o.props||So,w=r.props,C=r.type;if(C=="svg"?n="http://www.w3.org/2000/svg":C=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((h=a[d])&&"setAttribute"in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,a[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(w);e=document.createElementNS(n,C,w.is&&w),l&&(ee.__m&&ee.__m(r,a),l=!1),a=null}if(C==null)x===w||l&&e.data==w||(e.data=w);else{if(a=a&&Fo.call(e.childNodes),!l&&a!=null)for(x={},d=0;d<e.attributes.length;d++)x[(h=e.attributes[d]).name]=h.value;for(d in x)h=x[d],d=="dangerouslySetInnerHTML"?f=h:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||Ro(e,d,null,h,n);for(d in w)h=w[d],d=="children"?y=h:d=="dangerouslySetInnerHTML"?m=h:d=="value"?g=h:d=="checked"?b=h:l&&typeof h!="function"||x[d]===h||Ro(e,d,h,x[d],n);if(m)l||f&&(m.__html==f.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),r.__k=[];else if(f&&(e.innerHTML=""),kn(r.type=="template"?e.content:e,qo(y)?y:[y],r,o,s,C=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:o.__k&&dr(o,0),l,c),a!=null)for(d=a.length;d--;)fs(a[d]);l||(d="value",C=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||C=="progress"&&!g||C=="option"&&g!=x[d])&&Ro(e,d,g,x[d],n),d="checked",b!=null&&b!=e[d]&&Ro(e,d,b,x[d],n))}return e}function hs(e,r,o){try{if(typeof e=="function"){var s=typeof e.__u=="function";s&&e.__u(),s&&r==null||(e.__u=e(r))}else e.current=r}catch(n){ee.__e(n,o)}}function Mn(e,r,o){var s,n;if(ee.unmount&&ee.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||hs(s,null,r)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(a){ee.__e(a,r)}s.base=s.__P=null}if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&Mn(s[n],r,o||typeof e.type!="function");o||fs(e.__e),e.__c=e.__=e.__e=void 0}function Cl(e,r,o){return this.constructor(e,o)}function fr(e,r,o){var s,n,a,i;r==document&&(r=document.documentElement),ee.__&&ee.__(e,r),n=(s=typeof o=="function")?null:o&&o.__k||r.__k,a=[],i=[],ms(r,e=(!s&&o||r).__k=vl(M,null,[e]),n||So,So,r.namespaceURI,!s&&o?[o]:n?null:r.firstChild?Fo.call(r.childNodes):null,a,!s&&o?o:n?n.__e:r.firstChild,s,i),Sn(a,e,i)}function mr(e){function r(o){var s,n;return this.getChildContext||(s=new Set,(n={})[r.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){s=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&s.forEach(function(i){i.__e=!0,cs(i)})},this.sub=function(a){s.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){s&&s.delete(a),i&&i.call(a)}}),o.children}return r.__c="__cC"+En++,r.__=e,r.Provider=r.__l=(r.Consumer=function(o,s){return o.children(s)}).contextType=r,r}Fo=Ao.slice,ee={__e:function(e,r,o,s){for(var n,a,i;r=r.__;)if((n=r.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,s||{}),i=n.__d),i)return n.__E=n}catch(l){e=l}throw e}},_n=0,gl=function(e){return e!=null&&e.constructor===void 0},Po.prototype.setState=function(e,r){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof e=="function"&&(e=e(dt({},o),this.props)),e&&dt(o,e),e!=null&&this.__v&&(r&&this._sb.push(r),cs(this))},Po.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),cs(this))},Po.prototype.render=M,wt=[],Tn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wn=function(e,r){return e.__v.__b-r.__v.__b},Mo.__r=0,Cn=/(PointerCapture)$|Capture$/i,ds=0,ls=xn(!1),us=xn(!0),En=0;var Ke=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Jt,Ct,hr,Fn,El=(Fn=class extends Ke{constructor(){super();S(this,Jt);S(this,Ct);S(this,hr);E(this,hr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){p(this,Ct)||this.setEventListener(p(this,hr))}onUnsubscribe(){var r;this.hasListeners()||((r=p(this,Ct))==null||r.call(this),E(this,Ct,void 0))}setEventListener(r){var o;E(this,hr,r),(o=p(this,Ct))==null||o.call(this),E(this,Ct,r(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(r){p(this,Jt)!==r&&(E(this,Jt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(o=>{o(r)})}isFocused(){return typeof p(this,Jt)=="boolean"?p(this,Jt):globalThis.document?.visibilityState!=="hidden"}},Jt=new WeakMap,Ct=new WeakMap,hr=new WeakMap,Fn),yr=new El;var Rl={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},Et,ys,qn,kl=(qn=class{constructor(){S(this,Et,Rl);S(this,ys,!1)}setTimeoutProvider(e){E(this,Et,e)}setTimeout(e,r){return p(this,Et).setTimeout(e,r)}clearTimeout(e){p(this,Et).clearTimeout(e)}setInterval(e,r){return p(this,Et).setInterval(e,r)}clearInterval(e){p(this,Et).clearInterval(e)}},Et=new WeakMap,ys=new WeakMap,qn),ze=new kl;function On(e){setTimeout(e,0)}var bs=typeof window>"u"||"Deno"in globalThis;function ie(){}function Ln(e,r){return typeof e=="function"?e(r):e}function zr(e){return typeof e=="number"&&e>=0&&e!==1/0}function Oo(e,r){return Math.max(e+(r||0)-Date.now(),0)}function He(e,r){return typeof e=="function"?e(r):e}function ke(e,r){return typeof e=="function"?e(r):e}function Do(e,r){let{type:o="all",exact:s,fetchStatus:n,predicate:a,queryKey:i,stale:l}=e;if(i){if(s){if(r.queryHash!==Wr(i,r.options))return!1}else if(!zt(r.queryKey,i))return!1}if(o!=="all"){let c=r.isActive();if(o==="active"&&!c||o==="inactive"&&c)return!1}return!(typeof l=="boolean"&&r.isStale()!==l||n&&n!==r.state.fetchStatus||a&&!a(r))}function Qo(e,r){let{exact:o,status:s,predicate:n,mutationKey:a}=e;if(a){if(!r.options.mutationKey)return!1;if(o){if(We(r.options.mutationKey)!==We(a))return!1}else if(!zt(r.options.mutationKey,a))return!1}return!(s&&r.state.status!==s||n&&!n(r))}function Wr(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,o)=>gs(o)?Object.keys(o).sort().reduce((s,n)=>(s[n]=o[n],s),{}):o)}function zt(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(o=>zt(e[o],r[o])):!1}var Pl=Object.prototype.hasOwnProperty;function vs(e,r,o=0){if(e===r)return e;if(o>500)return r;let s=Dn(e)&&Dn(r);if(!s&&!(gs(e)&&gs(r)))return r;let a=(s?e:Object.keys(e)).length,i=s?r:Object.keys(r),l=i.length,c=s?new Array(l):{},d=0;for(let m=0;m<l;m++){let f=s?m:i[m],y=e[f],h=r[f];if(y===h){c[f]=y,(s?m<a:Pl.call(e,f))&&d++;continue}if(y===null||h===null||typeof y!="object"||typeof h!="object"){c[f]=h;continue}let g=vs(y,h,o+1);c[f]=g,g===y&&d++}return a===l&&d===a?e:c}function gr(e,r){if(!r||Object.keys(e).length!==Object.keys(r).length)return!1;for(let o in e)if(e[o]!==r[o])return!1;return!0}function Dn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gs(e){if(!Qn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let o=r.prototype;return!(!Qn(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Qn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Kn(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Zr(e,r,o){return typeof o.structuralSharing=="function"?o.structuralSharing(e,r):o.structuralSharing!==!1?vs(e,r):r}function Un(e,r,o=0){let s=[...e,r];return o&&s.length>o?s.slice(1):s}function Nn(e,r,o=0){let s=[r,...e];return o&&s.length>o?s.slice(0,-1):s}var br=Symbol();function Lo(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===br?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xr(e,r){return typeof e=="function"?e(...r):!!e}function jn(e,r,o){let s=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=r()),s||(s=!0,n.aborted?o():n.addEventListener("abort",o,{once:!0})),n)}),e}var Ze=(()=>{let e=()=>bs;return{isServer(){return e()},setIsServer(r){e=r}}})();function Yr(){let e,r,o=new Promise((n,a)=>{e=n,r=a});o.status="pending",o.catch(()=>{});function s(n){Object.assign(o,n),delete o.resolve,delete o.reject}return o.resolve=n=>{s({status:"fulfilled",value:n}),e(n)},o.reject=n=>{s({status:"rejected",reason:n}),r(n)},o}var In=On;function Sl(){let e=[],r=0,o=l=>{l()},s=l=>{l()},n=In,a=l=>{r?e.push(l):n(()=>{o(l)})},i=()=>{let l=e;e=[],l.length&&n(()=>{s(()=>{l.forEach(c=>{o(c)})})})};return{batch:l=>{let c;r++;try{c=l()}finally{r--,r||i()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{o=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{n=l}}}var te=Sl();var vr,Rt,xr,$n,Al=($n=class extends Ke{constructor(){super();S(this,vr,!0);S(this,Rt);S(this,xr);E(this,xr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r(!0),s=()=>r(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",s)}}})}onSubscribe(){p(this,Rt)||this.setEventListener(p(this,xr))}onUnsubscribe(){var r;this.hasListeners()||((r=p(this,Rt))==null||r.call(this),E(this,Rt,void 0))}setEventListener(r){var o;E(this,xr,r),(o=p(this,Rt))==null||o.call(this),E(this,Rt,r(this.setOnline.bind(this)))}setOnline(r){p(this,vr)!==r&&(E(this,vr,r),this.listeners.forEach(s=>{s(r)}))}isOnline(){return p(this,vr)}},vr=new WeakMap,Rt=new WeakMap,xr=new WeakMap,$n),_r=new Al;function Ml(e){return Math.min(1e3*2**e,3e4)}function xs(e){return(e??"online")==="online"?_r.isOnline():!0}var Ko=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Uo(e){let r=!1,o=0,s,n=Yr(),a=()=>n.status!=="pending",i=b=>{if(!a()){let x=new Ko(b);y(x),e.onCancel?.(x)}},l=()=>{r=!0},c=()=>{r=!1},d=()=>yr.isFocused()&&(e.networkMode==="always"||_r.isOnline())&&e.canRun(),m=()=>xs(e.networkMode)&&e.canRun(),f=b=>{a()||(s?.(),n.resolve(b))},y=b=>{a()||(s?.(),n.reject(b))},h=()=>new Promise(b=>{s=x=>{(a()||d())&&b(x)},e.onPause?.()}).then(()=>{s=void 0,a()||e.onContinue?.()}),g=()=>{if(a())return;let b,x=o===0?e.initialPromise:void 0;try{b=x??e.fn()}catch(w){b=Promise.reject(w)}Promise.resolve(b).then(f).catch(w=>{if(a())return;let C=e.retry??(Ze.isServer()?0:3),A=e.retryDelay??Ml,k=typeof A=="function"?A(o,w):A,K=C===!0||typeof C=="number"&&o<C||typeof C=="function"&&C(o,w);if(r||!K){y(w);return}o++,e.onFail?.(o,w),Kn(k).then(()=>d()?void 0:h()).then(()=>{r?y(w):g()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(s?.(),n),cancelRetry:l,continueRetry:c,canStart:m,start:()=>(m()?g():h().then(g),n)}}var Wt,Vn,No=(Vn=class{constructor(){S(this,Wt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zr(this.gcTime)&&E(this,Wt,ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ze.isServer()?1/0:300*1e3))}clearGcTimeout(){p(this,Wt)!==void 0&&(ze.clearTimeout(p(this,Wt)),E(this,Wt,void 0))}},Wt=new WeakMap,Vn);function Hn(e){return{onFetch:(r,o)=>{let s=r.options,n=r.fetchOptions?.meta?.fetchMore?.direction,a=r.state.data?.pages||[],i=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},c=0,d=async()=>{let m=!1,f=g=>{jn(g,()=>r.signal,()=>m=!0)},y=Lo(r.options,r.fetchOptions),h=async(g,b,x)=>{if(m)return Promise.reject(r.signal.reason);if(b==null&&g.pages.length)return Promise.resolve(g);let C=(()=>{let U={client:r.client,queryKey:r.queryKey,pageParam:b,direction:x?"backward":"forward",meta:r.options.meta};return f(U),U})(),A=await y(C),{maxPages:k}=r.options,K=x?Nn:Un;return{pages:K(g.pages,A,k),pageParams:K(g.pageParams,b,k)}};if(n&&a.length){let g=n==="backward",b=g?Gn:_s,x={pages:a,pageParams:i},w=b(s,x);l=await h(x,w,g)}else{let g=e??a.length;do{let b=c===0?i[0]??s.initialPageParam:_s(s,l);if(c>0&&b==null)break;l=await h(l,b),c++}while(c<g)}return l};r.options.persister?r.fetchFn=()=>r.options.persister?.(d,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},o):r.fetchFn=d}}}function _s(e,{pages:r,pageParams:o}){let s=r.length-1;return r.length>0?e.getNextPageParam(r[s],r,o[s],o):void 0}function Gn(e,{pages:r,pageParams:o}){return r.length>0?e.getPreviousPageParam?.(r[0],r,o[0],o):void 0}function Bn(e,r){return r?_s(e,r)!=null:!1}function Jn(e,r){return!r||!e.getPreviousPageParam?!1:Gn(e,r)!=null}var Tr,Zt,wr,Ue,Xt,me,eo,Yt,Oe,Yn,ft,Zn,Xn=(Zn=class extends No{constructor(r){super();S(this,Oe);S(this,Tr);S(this,Zt);S(this,wr);S(this,Ue);S(this,Xt);S(this,me);S(this,eo);S(this,Yt);E(this,Yt,!1),E(this,eo,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,Xt,r.client),E(this,Ue,p(this,Xt).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,Zt,Wn(this.options)),this.state=r.state??p(this,Zt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return p(this,Tr)}get promise(){return p(this,me)?.promise}setOptions(r){if(this.options={...p(this,eo),...r},r?._type&&E(this,Tr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let o=Wn(this.options);o.data!==void 0&&(this.setState(zn(o.data,o.dataUpdatedAt)),E(this,Zt,o))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,Ue).remove(this)}setData(r,o){let s=Zr(this.state.data,r,this.options);return I(this,Oe,ft).call(this,{data:s,type:"success",dataUpdatedAt:o?.updatedAt,manual:o?.manual}),s}setState(r){I(this,Oe,ft).call(this,{type:"setState",state:r})}cancel(r){let o=p(this,me)?.promise;return p(this,me)?.cancel(r),o?o.then(ie).catch(ie):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return p(this,Zt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>ke(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===br||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>He(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!Oo(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find(o=>o.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),p(this,me)?.continue()}onOnline(){this.observers.find(o=>o.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),p(this,me)?.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),p(this,Ue).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(o=>o!==r),this.observers.length||(p(this,me)&&(p(this,Yt)||I(this,Oe,Yn).call(this)?p(this,me).cancel({revert:!0}):p(this,me).cancelRetry()),this.scheduleGc()),p(this,Ue).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||I(this,Oe,ft).call(this,{type:"invalidate"})}async fetch(r,o){if(this.state.fetchStatus!=="idle"&&p(this,me)?.status()!=="rejected"){if(this.state.data!==void 0&&o?.cancelRefetch)this.cancel({silent:!0});else if(p(this,me))return p(this,me).continueRetry(),p(this,me).promise}if(r&&this.setOptions(r),!this.options.queryFn){let d=this.observers.find(m=>m.options.queryFn);d&&this.setOptions(d.options)}let s=new AbortController,n=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(E(this,Yt,!0),s.signal)})},a=()=>{let d=Lo(this.options,o),f=(()=>{let y={client:p(this,Xt),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,Yt,!1),this.options.persister?this.options.persister(d,f,this):d(f)},l=(()=>{let d={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:p(this,Xt),state:this.state,fetchFn:a};return n(d),d})();(p(this,Tr)==="infinite"?Hn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,wr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&I(this,Oe,ft).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,me,Uo({initialPromise:o?.initialPromise,fn:l.fetchFn,onCancel:d=>{d instanceof Ko&&d.revert&&this.setState({...p(this,wr),fetchStatus:"idle"}),s.abort()},onFail:(d,m)=>{I(this,Oe,ft).call(this,{type:"failed",failureCount:d,error:m})},onPause:()=>{I(this,Oe,ft).call(this,{type:"pause"})},onContinue:()=>{I(this,Oe,ft).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{let d=await p(this,me).start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),p(this,Ue).config.onSuccess?.(d,this),p(this,Ue).config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Ko){if(d.silent)return p(this,me).promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw I(this,Oe,ft).call(this,{type:"error",error:d}),p(this,Ue).config.onError?.(d,this),p(this,Ue).config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}},Tr=new WeakMap,Zt=new WeakMap,wr=new WeakMap,Ue=new WeakMap,Xt=new WeakMap,me=new WeakMap,eo=new WeakMap,Yt=new WeakMap,Oe=new WeakSet,Yn=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ft=function(r){let o=s=>{switch(r.type){case"failed":return{...s,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Ts(s.data,this.options),fetchMeta:r.meta??null};case"success":let n={...s,...zn(r.data,r.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,wr,r.manual?n:void 0),n;case"error":let a=r.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...r.state}}};this.state=o(this.state),te.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),p(this,Ue).notify({query:this,type:"updated",action:r})})},Zn);function Ts(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xs(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zn(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wn(e){let r=typeof e.initialData=="function"?e.initialData():e.initialData,o=r!==void 0,s=o?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var Ae,z,ro,Pe,er,Cr,mt,kt,oo,Er,Rr,tr,rr,Pt,kr,X,to,ws,Cs,Es,Rs,ks,Ps,Ss,oa,ra,so=(ra=class extends Ke{constructor(r,o){super();S(this,X);S(this,Ae);S(this,z);S(this,ro);S(this,Pe);S(this,er);S(this,Cr);S(this,mt);S(this,kt);S(this,oo);S(this,Er);S(this,Rr);S(this,tr);S(this,rr);S(this,Pt);S(this,kr,new Set);this.options=o,E(this,Ae,r),E(this,kt,null),E(this,mt,Yr()),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(p(this,z).addObserver(this),ea(p(this,z),this.options)?I(this,X,to).call(this):this.updateResult(),I(this,X,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return As(p(this,z),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return As(p(this,z),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,I(this,X,ks).call(this),I(this,X,Ps).call(this),p(this,z).removeObserver(this)}setOptions(r){let o=this.options,s=p(this,z);if(this.options=p(this,Ae).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ke(this.options.enabled,p(this,z))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");I(this,X,Ss).call(this),p(this,z).setOptions(this.options),o._defaulted&&!gr(this.options,o)&&p(this,Ae).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,z),observer:this});let n=this.hasListeners();n&&ta(p(this,z),s,this.options,o)&&I(this,X,to).call(this),this.updateResult(),n&&(p(this,z)!==s||ke(this.options.enabled,p(this,z))!==ke(o.enabled,p(this,z))||He(this.options.staleTime,p(this,z))!==He(o.staleTime,p(this,z)))&&I(this,X,ws).call(this);let a=I(this,X,Cs).call(this);n&&(p(this,z)!==s||ke(this.options.enabled,p(this,z))!==ke(o.enabled,p(this,z))||a!==p(this,Pt))&&I(this,X,Es).call(this,a)}getOptimisticResult(r){let o=p(this,Ae).getQueryCache().build(p(this,Ae),r),s=this.createResult(o,r);return ql(this,s)&&(E(this,Pe,s),E(this,Cr,this.options),E(this,er,p(this,z).state)),s}getCurrentResult(){return p(this,Pe)}trackResult(r,o){return new Proxy(r,{get:(s,n)=>(this.trackProp(n),o?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,mt).status==="pending"&&p(this,mt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(r){p(this,kr).add(r)}getCurrentQuery(){return p(this,z)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){let o=p(this,Ae).defaultQueryOptions(r),s=p(this,Ae).getQueryCache().build(p(this,Ae),o);return s.fetch().then(()=>this.createResult(s,o))}fetch(r){return I(this,X,to).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),p(this,Pe)))}createResult(r,o){let s=p(this,z),n=this.options,a=p(this,Pe),i=p(this,er),l=p(this,Cr),d=r!==s?r.state:p(this,ro),{state:m}=r,f={...m},y=!1,h;if(o._optimisticResults){let T=this.hasListeners(),F=!T&&ea(r,o),$=T&&ta(r,s,o,n);(F||$)&&(f={...f,...Ts(m.data,r.options)}),o._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:b,status:x}=f;h=f.data;let w=!1;if(o.placeholderData!==void 0&&h===void 0&&x==="pending"){let T;a?.isPlaceholderData&&o.placeholderData===l?.placeholderData?(T=a.data,w=!0):T=typeof o.placeholderData=="function"?o.placeholderData(p(this,Rr)?.state.data,p(this,Rr)):o.placeholderData,T!==void 0&&(x="success",h=Zr(a?.data,T,o),y=!0)}if(o.select&&h!==void 0&&!w)if(a&&h===i?.data&&o.select===p(this,oo))h=p(this,Er);else try{E(this,oo,o.select),h=o.select(h),h=Zr(a?.data,h,o),E(this,Er,h),E(this,kt,null)}catch(T){E(this,kt,T)}p(this,kt)&&(g=p(this,kt),h=p(this,Er),b=Date.now(),x="error");let C=f.fetchStatus==="fetching",A=x==="pending",k=x==="error",K=A&&C,U=h!==void 0,j={status:x,fetchStatus:f.fetchStatus,isPending:A,isSuccess:x==="success",isError:k,isInitialLoading:K,isLoading:K,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:r.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!A,isLoadingError:k&&!U,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:k&&U,isStale:Ms(r,o),refetch:this.refetch,promise:p(this,mt),isEnabled:ke(o.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){let T=j.data!==void 0,F=j.status==="error"&&!T,$=ce=>{F?ce.reject(j.error):T&&ce.resolve(j.data)},Z=()=>{let ce=E(this,mt,j.promise=Yr());$(ce)},B=p(this,mt);switch(B.status){case"pending":r.queryHash===s.queryHash&&$(B);break;case"fulfilled":(F||j.data!==B.value)&&Z();break;case"rejected":(!F||j.error!==B.reason)&&Z();break}}return j}updateResult(){let r=p(this,Pe),o=this.createResult(p(this,z),this.options);if(E(this,er,p(this,z).state),E(this,Cr,this.options),p(this,er).data!==void 0&&E(this,Rr,p(this,z)),gr(o,r))return;E(this,Pe,o);let s=()=>{if(!r)return!0;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,kr).size)return!0;let i=new Set(a??p(this,kr));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Pe)).some(l=>{let c=l;return p(this,Pe)[c]!==r[c]&&i.has(c)})};I(this,X,oa).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&I(this,X,Rs).call(this)}},Ae=new WeakMap,z=new WeakMap,ro=new WeakMap,Pe=new WeakMap,er=new WeakMap,Cr=new WeakMap,mt=new WeakMap,kt=new WeakMap,oo=new WeakMap,Er=new WeakMap,Rr=new WeakMap,tr=new WeakMap,rr=new WeakMap,Pt=new WeakMap,kr=new WeakMap,X=new WeakSet,to=function(r){I(this,X,Ss).call(this);let o=p(this,z).fetch(this.options,r);return r?.throwOnError||(o=o.catch(ie)),o},ws=function(){I(this,X,ks).call(this);let r=He(this.options.staleTime,p(this,z));if(Ze.isServer()||p(this,Pe).isStale||!zr(r))return;let s=Oo(p(this,Pe).dataUpdatedAt,r)+1;E(this,tr,ze.setTimeout(()=>{p(this,Pe).isStale||this.updateResult()},s))},Cs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,z)):this.options.refetchInterval)??!1},Es=function(r){I(this,X,Ps).call(this),E(this,Pt,r),!(Ze.isServer()||ke(this.options.enabled,p(this,z))===!1||!zr(p(this,Pt))||p(this,Pt)===0)&&E(this,rr,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&I(this,X,to).call(this)},p(this,Pt)))},Rs=function(){I(this,X,ws).call(this),I(this,X,Es).call(this,I(this,X,Cs).call(this))},ks=function(){p(this,tr)!==void 0&&(ze.clearTimeout(p(this,tr)),E(this,tr,void 0))},Ps=function(){p(this,rr)!==void 0&&(ze.clearInterval(p(this,rr)),E(this,rr,void 0))},Ss=function(){let r=p(this,Ae).getQueryCache().build(p(this,Ae),this.options);if(r===p(this,z))return;let o=p(this,z);E(this,z,r),E(this,ro,r.state),this.hasListeners()&&(o?.removeObserver(this),r.addObserver(this))},oa=function(r){te.batch(()=>{r.listeners&&this.listeners.forEach(o=>{o(p(this,Pe))}),p(this,Ae).getQueryCache().notify({query:p(this,z),type:"observerResultsUpdated"})})},ra);function Fl(e,r){return ke(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&ke(r.retryOnMount,e)===!1)}function ea(e,r){return Fl(e,r)||e.state.data!==void 0&&As(e,r,r.refetchOnMount)}function As(e,r,o){if(ke(r.enabled,e)!==!1&&He(r.staleTime,e)!=="static"){let s=typeof o=="function"?o(e):o;return s==="always"||s!==!1&&Ms(e,r)}return!1}function ta(e,r,o,s){return(e!==r||ke(s.enabled,e)===!1)&&(!o.suspense||e.state.status!=="error")&&Ms(e,o)}function Ms(e,r){return ke(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function ql(e,r){return!gr(e.getCurrentResult(),r)}var Fs=class extends so{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:o}=e,s=super.createResult(e,r),{isFetching:n,isRefetching:a,isError:i,isRefetchError:l}=s,c=o.fetchMeta?.fetchMore?.direction,d=i&&c==="forward",m=n&&c==="forward",f=i&&c==="backward",y=n&&c==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Bn(r,o.data),hasPreviousPage:Jn(r,o.data),isFetchNextPageError:d,isFetchingNextPage:m,isFetchPreviousPageError:f,isFetchingPreviousPage:y,isRefetchError:l&&!d&&!f,isRefetching:a&&!m&&!y}}};var no,Xe,_e,or,Ye,St,sa,na=(sa=class extends No{constructor(r){super();S(this,Ye);S(this,no);S(this,Xe);S(this,_e);S(this,or);E(this,no,r.client),this.mutationId=r.mutationId,E(this,_e,r.mutationCache),E(this,Xe,[]),this.state=r.state||qs(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){p(this,Xe).includes(r)||(p(this,Xe).push(r),this.clearGcTimeout(),p(this,_e).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){E(this,Xe,p(this,Xe).filter(o=>o!==r)),this.scheduleGc(),p(this,_e).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){p(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():p(this,_e).remove(this))}continue(){return p(this,or)?.continue()??this.execute(this.state.variables)}async execute(r){let o=()=>{I(this,Ye,St).call(this,{type:"continue"})},s={client:p(this,no),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,or,Uo({fn:()=>this.options.mutationFn?this.options.mutationFn(r,s):Promise.reject(new Error("No mutationFn found")),onFail:(i,l)=>{I(this,Ye,St).call(this,{type:"failed",failureCount:i,error:l})},onPause:()=>{I(this,Ye,St).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,_e).canRun(this)}));let n=this.state.status==="pending",a=!p(this,or).canStart();try{if(n)o();else{I(this,Ye,St).call(this,{type:"pending",variables:r,isPaused:a}),p(this,_e).config.onMutate&&await p(this,_e).config.onMutate(r,this,s);let l=await this.options.onMutate?.(r,s);l!==this.state.context&&I(this,Ye,St).call(this,{type:"pending",context:l,variables:r,isPaused:a})}let i=await p(this,or).start();return await p(this,_e).config.onSuccess?.(i,r,this.state.context,this,s),await this.options.onSuccess?.(i,r,this.state.context,s),await p(this,_e).config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,r,this.state.context,s),I(this,Ye,St).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,_e).config.onError?.(i,r,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onError?.(i,r,this.state.context,s)}catch(l){Promise.reject(l)}try{await p(this,_e).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,i,r,this.state.context,s)}catch(l){Promise.reject(l)}throw I(this,Ye,St).call(this,{type:"error",error:i}),i}finally{p(this,_e).runNext(this)}}},no=new WeakMap,Xe=new WeakMap,_e=new WeakMap,or=new WeakMap,Ye=new WeakSet,St=function(r){let o=s=>{switch(r.type){case"failed":return{...s,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...s,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:r.error,failureCount:s.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=o(this.state),te.batch(()=>{p(this,Xe).forEach(s=>{s.onMutationUpdate(r)}),p(this,_e).notify({mutation:this,type:"updated",action:r})})},sa);function qs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ht,Ge,ao,aa,ia=(aa=class extends Ke{constructor(r={}){super();S(this,ht);S(this,Ge);S(this,ao);this.config=r,E(this,ht,new Set),E(this,Ge,new Map),E(this,ao,0)}build(r,o,s){let n=new na({client:r,mutationCache:this,mutationId:++Jr(this,ao)._,options:r.defaultMutationOptions(o),state:s});return this.add(n),n}add(r){p(this,ht).add(r);let o=jo(r);if(typeof o=="string"){let s=p(this,Ge).get(o);s?s.push(r):p(this,Ge).set(o,[r])}this.notify({type:"added",mutation:r})}remove(r){if(p(this,ht).delete(r)){let o=jo(r);if(typeof o=="string"){let s=p(this,Ge).get(o);if(s)if(s.length>1){let n=s.indexOf(r);n!==-1&&s.splice(n,1)}else s[0]===r&&p(this,Ge).delete(o)}}this.notify({type:"removed",mutation:r})}canRun(r){let o=jo(r);if(typeof o=="string"){let n=p(this,Ge).get(o)?.find(a=>a.state.status==="pending");return!n||n===r}else return!0}runNext(r){let o=jo(r);return typeof o=="string"?p(this,Ge).get(o)?.find(n=>n!==r&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{p(this,ht).forEach(r=>{this.notify({type:"removed",mutation:r})}),p(this,ht).clear(),p(this,Ge).clear()})}getAll(){return Array.from(p(this,ht))}find(r){let o={exact:!0,...r};return this.getAll().find(s=>Qo(o,s))}findAll(r={}){return this.getAll().filter(o=>Qo(r,o))}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}resumePausedMutations(){let r=this.getAll().filter(o=>o.state.isPaused);return te.batch(()=>Promise.all(r.map(o=>o.continue().catch(ie))))}},ht=new WeakMap,Ge=new WeakMap,ao=new WeakMap,aa);function jo(e){return e.options.scope?.id}var yt,At,Me,gt,bt,Io,Os,la,Ds=(la=class extends Ke{constructor(r,o){super();S(this,bt);S(this,yt);S(this,At);S(this,Me);S(this,gt);E(this,yt,r),this.setOptions(o),this.bindMethods(),I(this,bt,Io).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){let o=this.options;this.options=p(this,yt).defaultMutationOptions(r),gr(this.options,o)||p(this,yt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:p(this,Me),observer:this}),o?.mutationKey&&this.options.mutationKey&&We(o.mutationKey)!==We(this.options.mutationKey)?this.reset():p(this,Me)?.state.status==="pending"&&p(this,Me).setOptions(this.options)}onUnsubscribe(){this.hasListeners()||p(this,Me)?.removeObserver(this)}onMutationUpdate(r){I(this,bt,Io).call(this),I(this,bt,Os).call(this,r)}getCurrentResult(){return p(this,At)}reset(){p(this,Me)?.removeObserver(this),E(this,Me,void 0),I(this,bt,Io).call(this),I(this,bt,Os).call(this)}mutate(r,o){return E(this,gt,o),p(this,Me)?.removeObserver(this),E(this,Me,p(this,yt).getMutationCache().build(p(this,yt),this.options)),p(this,Me).addObserver(this),p(this,Me).execute(r)}},yt=new WeakMap,At=new WeakMap,Me=new WeakMap,gt=new WeakMap,bt=new WeakSet,Io=function(){let r=p(this,Me)?.state??qs();E(this,At,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(r){te.batch(()=>{if(p(this,gt)&&this.hasListeners()){let o=p(this,At).variables,s=p(this,At).context,n={client:p(this,yt),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{p(this,gt).onSuccess?.(r.data,o,s,n)}catch(a){Promise.reject(a)}try{p(this,gt).onSettled?.(r.data,null,o,s,n)}catch(a){Promise.reject(a)}}else if(r?.type==="error"){try{p(this,gt).onError?.(r.error,o,s,n)}catch(a){Promise.reject(a)}try{p(this,gt).onSettled?.(void 0,r.error,o,s,n)}catch(a){Promise.reject(a)}}}this.listeners.forEach(o=>{o(p(this,At))})})},la);var et,ua,ca=(ua=class extends Ke{constructor(r={}){super();S(this,et);this.config=r,E(this,et,new Map)}build(r,o,s){let n=o.queryKey,a=o.queryHash??Wr(n,o),i=this.get(a);return i||(i=new Xn({client:r,queryKey:n,queryHash:a,options:r.defaultQueryOptions(o),state:s,defaultOptions:r.getQueryDefaults(n)}),this.add(i)),i}add(r){p(this,et).has(r.queryHash)||(p(this,et).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){let o=p(this,et).get(r.queryHash);o&&(r.destroy(),o===r&&p(this,et).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){te.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return p(this,et).get(r)}getAll(){return[...p(this,et).values()]}find(r){let o={exact:!0,...r};return this.getAll().find(s=>Do(o,s))}findAll(r={}){let o=this.getAll();return Object.keys(r).length>0?o.filter(s=>Do(r,s)):o}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}onFocus(){te.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},et=new WeakMap,ua);var le,Mt,Ft,Pr,Sr,qt,Ar,Mr,pa,Qs=(pa=class{constructor(e={}){S(this,le);S(this,Mt);S(this,Ft);S(this,Pr);S(this,Sr);S(this,qt);S(this,Ar);S(this,Mr);E(this,le,e.queryCache||new ca),E(this,Mt,e.mutationCache||new ia),E(this,Ft,e.defaultOptions||{}),E(this,Pr,new Map),E(this,Sr,new Map),E(this,qt,0)}mount(){Jr(this,qt)._++,p(this,qt)===1&&(E(this,Ar,yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,le).onFocus())})),E(this,Mr,_r.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,le).onOnline())})))}unmount(){var e,r;Jr(this,qt)._--,p(this,qt)===0&&((e=p(this,Ar))==null||e.call(this),E(this,Ar,void 0),(r=p(this,Mr))==null||r.call(this),E(this,Mr,void 0))}isFetching(e){return p(this,le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,Mt).findAll({...e,status:"pending"}).length}getQueryData(e){let r=this.defaultQueryOptions({queryKey:e});return p(this,le).get(r.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),o=p(this,le).build(this,r),s=o.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&o.isStaleByTime(He(r.staleTime,o))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(e){return p(this,le).findAll(e).map(({queryKey:r,state:o})=>{let s=o.data;return[r,s]})}setQueryData(e,r,o){let s=this.defaultQueryOptions({queryKey:e}),a=p(this,le).get(s.queryHash)?.state.data,i=Ln(r,a);if(i!==void 0)return p(this,le).build(this,s).setData(i,{...o,manual:!0})}setQueriesData(e,r,o){return te.batch(()=>p(this,le).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,r,o)]))}getQueryState(e){let r=this.defaultQueryOptions({queryKey:e});return p(this,le).get(r.queryHash)?.state}removeQueries(e){let r=p(this,le);te.batch(()=>{r.findAll(e).forEach(o=>{r.remove(o)})})}resetQueries(e,r){let o=p(this,le);return te.batch(()=>(o.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},r)))}cancelQueries(e,r={}){let o={revert:!0,...r},s=te.batch(()=>p(this,le).findAll(e).map(n=>n.cancel(o)));return Promise.all(s).then(ie).catch(ie)}invalidateQueries(e,r={}){return te.batch(()=>(p(this,le).findAll(e).forEach(o=>{o.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){let o={...r,cancelRefetch:r.cancelRefetch??!0},s=te.batch(()=>p(this,le).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,o);return o.throwOnError||(a=a.catch(ie)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(ie)}fetchQuery(e){let r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);let o=p(this,le).build(this,r);return o.isStaleByTime(He(r.staleTime,o))?o.fetch(r):Promise.resolve(o.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ie).catch(ie)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ie).catch(ie)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _r.isOnline()?p(this,Mt).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,le)}getMutationCache(){return p(this,Mt)}getDefaultOptions(){return p(this,Ft)}setDefaultOptions(e){E(this,Ft,e)}setQueryDefaults(e,r){p(this,Pr).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...p(this,Pr).values()],o={};return r.forEach(s=>{zt(e,s.queryKey)&&Object.assign(o,s.defaultOptions)}),o}setMutationDefaults(e,r){p(this,Sr).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...p(this,Sr).values()],o={};return r.forEach(s=>{zt(e,s.mutationKey)&&Object.assign(o,s.defaultOptions)}),o}defaultQueryOptions(e){if(e._defaulted)return e;let r={...p(this,Ft).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=Wr(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===br&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,Ft).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){p(this,le).clear(),p(this,Mt).clear()}},le=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Pr=new WeakMap,Sr=new WeakMap,qt=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,pa);var sr,ne,Ls,da,io=0,xa=[],ue=ee,fa=ue.__b,ma=ue.__r,ha=ue.diffed,ya=ue.__c,ga=ue.unmount,ba=ue.__;function lo(e,r){ue.__h&&ue.__h(ne,e,io||r),io=0;var o=ne.__H||(ne.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function v(e){return io=1,Ol(Ta,e)}function Ol(e,r,o){var s=lo(sr++,2);if(s.t=e,!s.__c&&(s.__=[o?o(r):Ta(void 0,r),function(l){var c=s.__N?s.__N[0]:s.__[0],d=s.t(c,l);c!==d&&(s.__N=[d,s.__[1]],s.__c.setState({}))}],s.__c=ne,!ne.__f)){var n=function(l,c,d){if(!s.__c.__H)return!0;var m=s.__c.__H.__.filter(function(y){return y.__c});if(m.every(function(y){return!y.__N}))return!a||a.call(this,l,c,d);var f=s.__c.props!==l;return m.some(function(y){if(y.__N){var h=y.__[0];y.__=y.__N,y.__N=void 0,h!==y.__[0]&&(f=!0)}}),a&&a.call(this,l,c,d)||f};ne.__f=!0;var a=ne.shouldComponentUpdate,i=ne.componentWillUpdate;ne.componentWillUpdate=function(l,c,d){if(this.__e){var m=a;a=void 0,n(l,c,d),a=m}i&&i.call(this,l,c,d)},ne.shouldComponentUpdate=n}return s.__N||s.__}function G(e,r){var o=lo(sr++,3);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__H.__h.push(o))}function _a(e,r){var o=lo(sr++,4);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__h.push(o))}function he(e){return io=5,nr(function(){return{current:e}},[])}function nr(e,r){var o=lo(sr++,7);return Us(o.__H,r)&&(o.__=e(),o.__H=r,o.__h=e),o.__}function ar(e,r){return io=8,nr(function(){return e},r)}function Fr(e){var r=ne.context[e.__c],o=lo(sr++,9);return o.c=e,r?(o.__==null&&(o.__=!0,r.sub(ne)),r.props.value):e.__}function Dl(){for(var e;e=xa.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some($o),r.__h.some(Ks),r.__h=[]}catch(o){r.__h=[],ue.__e(o,e.__v)}}}ue.__b=function(e){ne=null,fa&&fa(e)},ue.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),ba&&ba(e,r)},ue.__r=function(e){ma&&ma(e),sr=0;var r=(ne=e.__c).__H;r&&(Ls===ne?(r.__h=[],ne.__h=[],r.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(r.__h.some($o),r.__h.some(Ks),r.__h=[],sr=0)),Ls=ne},ue.diffed=function(e){ha&&ha(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(xa.push(r)!==1&&da===ue.requestAnimationFrame||((da=ue.requestAnimationFrame)||Ql)(Dl)),r.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),Ls=ne=null},ue.__c=function(e,r){r.some(function(o){try{o.__h.some($o),o.__h=o.__h.filter(function(s){return!s.__||Ks(s)})}catch(s){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ue.__e(s,o.__v)}}),ya&&ya(e,r)},ue.unmount=function(e){ga&&ga(e);var r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{$o(s)}catch(n){r=n}}),o.__H=void 0,r&&ue.__e(r,o.__v))};var va=typeof requestAnimationFrame=="function";function Ql(e){var r,o=function(){clearTimeout(s),va&&cancelAnimationFrame(r),setTimeout(e)},s=setTimeout(o,35);va&&(r=requestAnimationFrame(o))}function $o(e){var r=ne,o=e.__c;typeof o=="function"&&(e.__c=void 0,o()),ne=r}function Ks(e){var r=ne;e.__c=e.__(),ne=r}function Us(e,r){return!e||e.length!==r.length||r.some(function(o,s){return o!==e[s]})}function Ta(e,r){return typeof r=="function"?r(e):r}var wa=mr(!1),Ca=()=>Fr(wa),vf=wa.Provider;var Ll=0;function t(e,r,o,s,n,a){r||(r={});var i,l,c=r;if("ref"in c)for(l in c={},r)l=="ref"?i=r[l]:c[l]=r[l];var d={type:e,props:c,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ll,__i:-1,__u:0,__source:n,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)c[l]===void 0&&(c[l]=i[l]);return ee.vnode&&ee.vnode(d),d}var Ns=mr(void 0),uo=e=>{let r=Fr(Ns);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},qr=({client:e,children:r})=>(G(()=>(e.mount(),()=>{e.unmount()}),[e]),t(Ns.Provider,{value:e,children:r}));function Kl(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ul=mr(Kl()),Ea=()=>Fr(Ul);var Ra=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},ka=e=>{G(()=>{e.clearReset()},[e])},Pa=({result:e,errorResetBoundary:r,throwOnError:o,query:s,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&s&&(n&&e.data===void 0||Xr(o,[e.error,s]));var Sa=e=>{if(e.suspense){let o=n=>n==="static"?n:Math.max(n??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...n)=>o(s(...n)):o(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Aa=(e,r)=>e.isLoading&&e.isFetching&&!r,Ma=(e,r)=>e?.suspense&&r.isPending,js=(e,r,o)=>r.fetchOptimistic(e).catch(()=>{o.clearReset()});function Vo(e,r){let o=r(),[{_instance:s},n]=v({_instance:{_value:o,_getSnapshot:r}});return _a(()=>{s._value=o,s._getSnapshot=r,Is(s)&&n({_instance:s})},[e,o,r]),G(()=>(Is(s)&&n({_instance:s}),e(()=>{Is(s)&&n({_instance:s})})),[e]),o}function Is(e){let r=e._getSnapshot,o=e._value;try{let s=r();return!Object.is(o,s)}catch{return!0}}function Ho(e,r,o){let s=Ca(),n=Ea(),a=uo(o),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=s?"isRestoring":"optimistic",Sa(i),Ra(i,n),ka(n);let l=!a.getQueryCache().get(i.queryHash),[c]=v(()=>new r(a,i)),d=c.getOptimisticResult(i),m=!s&&e.subscribed!==!1;if(Vo(ar(f=>{let y=m?c.subscribe(te.batchCalls(f)):ie;return c.updateResult(),y},[c,m]),()=>c.getCurrentResult()),G(()=>{c.setOptions(i)},[i,c]),Ma(i,d))throw js(i,c,n);if(Pa({result:d,errorResetBoundary:n,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!Ze.isServer()&&Aa(d,s)&&(l?js(i,c,n):a.getQueryCache().get(i.queryHash)?.promise)?.catch(ie).finally(()=>{c.updateResult()}),i.notifyOnChangeProps?d:c.trackResult(d)}function Ot(e,r){return Ho(e,so,r)}function ye(e,r){let o=uo(r),[s]=v(()=>new Ds(o,e));G(()=>{s.setOptions(e)},[s,e]);let n=Vo(ar(i=>s.subscribe(te.batchCalls(i)),[s]),()=>s.getCurrentResult()),a=ar((i,l)=>{s.mutate(i,l).catch(ie)},[s]);if(n.error&&Xr(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}function Or(e,r){return Ho(e,Fs,r)}var $s="profiler-active-slave",Go=(()=>{try{let e=sessionStorage.getItem($s);return e?`/slaves/${e}`:""}catch{return""}})();function Fa(){return Go}function qa(){return Go?Go.replace("/slaves/",""):null}function Oa(e){try{e?sessionStorage.setItem($s,e):sessionStorage.removeItem($s)}catch{}Go=e?`/slaves/${e}`:"",window.location.reload()}var Nl="/_profiler/api/cluster/";async function se(e){let r=e.url.startsWith(Nl)?"":Fa(),o=r?e.url.replace("/_profiler/api",`/_profiler/api${r}`):e.url,{method:s,params:n,data:a,headers:i={},signal:l}=e,c=o,d=n?"?"+new URLSearchParams(Object.entries(n).map(([h,g])=>[h,String(g)])).toString():"",m={"X-Profiler-Request":"1",...i},f=await fetch(c+d,{method:s,signal:l,headers:a!==void 0?{"Content-Type":"application/json",...m}:m,body:a!==void 0?JSON.stringify(a):void 0});if(f.status===204)return{};let y=await f.json();if(!f.ok)throw Object.assign(new Error(y?.error??`HTTP ${f.status}`),{status:f.status,data:y});return y}var tt=(e,r)=>{let o={queryKey:r};for(let s of Object.keys(e))s!=="queryKey"&&Object.defineProperty(o,s,{enumerable:!0,configurable:!0,get:()=>e[s]});return o};var jl=e=>se({url:"/_profiler/api/cluster/slaves",method:"GET",signal:e});var Il=()=>["/_profiler/api/cluster/slaves"];var $l=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Il(),queryFn:({signal:n})=>jl(n),...r}};function Da(e){let r=$l(e),o=Ot(r);return tt(o,r.queryKey)}var Vs=(e,r)=>se({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),Vl=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var Hl=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Vl(e),queryFn:({signal:a})=>Vs(e,a),...o}};function Qa(e,r){let o=Hl(e,r),s=Or(o);return tt(s,o.queryKey)}var Gl=(e,r)=>se({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),Bl=()=>["deleteConsole"],Jl=e=>{let r=Bl(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Gl(a)},...o}},La=e=>ye(Jl(e)),zl=e=>se({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),Wl=()=>["clearConsoles"],Zl=e=>{let r=Wl(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>zl(),...o}},Ka=e=>ye(Zl(e)),Hs=e=>se({url:"/_profiler/api/env_vars",method:"GET",signal:e}),Xl=()=>["/_profiler/api/env_vars"],Yl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Xl(),queryFn:({signal:n})=>Hs(n),...r}};function Ua(e){let r=Yl(e),o=Ot(r);return tt(o,r.queryKey)}var eu=(e,r)=>se({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),tu=()=>["updateEnvVar"],ru=e=>{let r=tu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return eu(a)},...o}},Na=e=>ye(ru(e)),ou=(e,r)=>se({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),su=()=>["resetEnvVar"],nu=e=>{let r=su(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{params:a}=n??{};return ou(a)},...o}},ja=e=>ye(nu(e)),au=e=>se({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),iu=()=>["resetAllEnvVars"],lu=e=>{let r=iu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>au(),...o}},Ia=e=>ye(lu(e));var uu=(e,r)=>se({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),cu=()=>["explainQuery"],pu=e=>{let r=cu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return uu(a)},...o}},$a=e=>ye(pu(e)),du=e=>se({url:"/_profiler/api/config",method:"GET",signal:e}),Gs=()=>["/_profiler/api/config"],fu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Gs(),queryFn:({signal:n})=>du(n),...r}};function Va(e){let r=fu(e),o=Ot(r);return tt(o,r.queryKey)}var mu=(e,r)=>se({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),hu=()=>["updateFunctionProfiling"],yu=e=>{let r=hu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return mu(a)},...o}},Ha=e=>ye(yu(e)),Bs=(e,r)=>se({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),gu=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var bu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??gu(e),queryFn:({signal:a})=>Bs(e,a),...o}};function Ga(e,r){let o=bu(e,r),s=Or(o);return tt(s,o.queryKey)}var vu=(e,r)=>se({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),xu=()=>["deleteJob"],_u=e=>{let r=xu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return vu(a)},...o}},Ba=e=>ye(_u(e)),Tu=e=>se({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),wu=()=>["clearJobs"],Cu=e=>{let r=wu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Tu(),...o}},Ja=e=>ye(Cu(e)),Eu=e=>se({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),Ru=()=>["/_profiler/api/outbound_http"],ku=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Ru(),queryFn:({signal:n})=>Eu(n),...r}};function za(e){let r=ku(e),o=Ot(r);return tt(o,r.queryKey)}var Bo=(e,r)=>se({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),Pu=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]],Su=e=>["/_profiler/api/profiles",...e?[e]:[]],Au=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Pu(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Wa(e,r){let o=Au(e,r),s=Or(o);return tt(s,o.queryKey)}var Mu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Su(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Za(e,r){let o=Mu(e,r),s=Ot(o);return tt(s,o.queryKey)}var Fu=(e,r)=>se({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),qu=()=>["deleteProfile"],Ou=e=>{let r=qu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Fu(a)},...o}},Xa=e=>ye(Ou(e)),Du=(e,r,o)=>se({url:`/_profiler/api/profiles/${e}/replay`,method:"POST",headers:{"Content-Type":"application/json"},data:r,signal:o}),Qu=()=>["replayProfile"],Lu=e=>{let r=Qu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a,data:i}=n??{};return Du(a,i)},...o}},Ya=e=>ye(Lu(e)),Ku=e=>se({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),Uu=()=>["clearProfiles"],Nu=e=>{let r=Uu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Ku(),...o}},ei=e=>ye(Nu(e)),ju=(e,r)=>se({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),Iu=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],$u=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Iu(e),queryFn:({signal:a})=>ju(e,a),...o}};function ti(e,r){let o=$u(e,r),s=Ot(o);return tt(s,o.queryKey)}var Vu=(e,r)=>se({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Hu=()=>["createTestRun"],Gu=e=>{let r=Hu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return Vu(a)},...o}},ri=e=>ye(Gu(e));var Bu=(e,r)=>se({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),Ju=()=>["deleteTestRun"],zu=e=>{let r=Ju(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Bu(a)},...o}},oi=e=>ye(zu(e)),Js=(e,r)=>se({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),Wu=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var Zu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Wu(e),queryFn:({signal:a})=>Js(e,a),...o}};function si(e,r){let o=Zu(e,r),s=Or(o);return tt(s,o.queryKey)}var Xu=(e,r)=>se({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),Yu=()=>["deleteTest"],ec=e=>{let r=Yu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Xu(a)},...o}},ni=e=>ye(ec(e)),tc=e=>se({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),rc=()=>["clearTests"],oc=e=>{let r=rc(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>tc(),...o}},ai=e=>ye(oc(e));async function Dt(e){if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return sc(e)}function sc(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";let o=document.activeElement;document.body.appendChild(r);try{return r.select(),r.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(r),o?.focus?.()}}function Be(){return document.querySelector('meta[name="profiler-version"]')?.content??""}function Te(e){return e.allocated_objects!=null?e.allocated_objects:e.memory!=null?Math.round(e.memory/40):null}function rt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var ot="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function ii(){let{data:e,isError:r}=Va({query:{queryKey:Gs(),staleTime:1/0,retry:!1}});return e?{scheme:e.editor_url_scheme,pathMap:e.editor_path_map}:r?{scheme:"vscode",pathMap:{}}:{scheme:null,pathMap:{}}}var nc=["vscode","idea","cursor"];function ac(e){return typeof e=="string"&&nc.includes(e)}var ic=/^[A-Za-z]:\//;function co(e){return e.replace(/\\/g,"/")}function lc(e,r){if(!r)return e;let o=null;for(let a of Object.keys(r)){let i=co(a).replace(/\/+$/,"");(e===i||e.startsWith(i+"/"))&&(o===null||i.length>co(o).replace(/\/+$/,"").length)&&(o=a)}if(o===null)return e;let s=co(o).replace(/\/+$/,"");return co(String(r[o])).replace(/\/+$/,"")+e.slice(s.length)}function uc(e){return e.startsWith("/")||ic.test(e)}function cc(e){return(e.startsWith("/")?e:"/"+e).split("/").map((o,s)=>s===1&&/^[A-Za-z]:$/.test(o)?o:encodeURIComponent(o)).join("/")}function li(e,r,o){let{scheme:s,pathMap:n}=o;if(!ac(s)||!Number.isInteger(r)||r<1||typeof e!="string"||e===""||e.includes("\0"))return null;let a=lc(co(e),n);return uc(a)?s==="idea"?`idea://open?file=${encodeURIComponent(a)}&line=${r}`:`${s}://file${cc(a)}:${r}`:null}function ui(e){let r=/^(.+?):(\d+)(?::in\b.*)?$/.exec(e);return r?{file:r[1],line:Number(r[2])}:null}function ir({file:e,line:r,children:o,class:s}){let n=ii(),a=o??`${e}:${r}`,i=li(e,r,n);return i?t("a",{href:i,class:s,title:`Open ${e}:${r} in your editor`,rel:"noopener noreferrer","data-source-link":"",onClick:l=>l.stopPropagation(),children:a}):t("span",{class:s,children:a})}function vt({frame:e,class:r}){let o=ui(e);return o?t(ir,{file:o.file,line:o.line,class:r,children:e}):t("span",{class:r,children:e})}function lr(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Dr(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Qr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function zs({text:e}){let[r,o]=v(null);function s(){Dt(e).then(n=>{o(n?"copied":"failed"),setTimeout(()=>o(null),2e3)})}return t("button",{onClick:s,class:"profiler-body-download-btn profiler-text--xs",style:"cursor:pointer",children:r==="copied"?"Copied!":r==="failed"?"Copy not available":"Copy"})}function mi(e){let r=e.split(";")[0].trim().toLowerCase();return{"application/json":".json","application/ld+json":".jsonld","application/xml":".xml","text/xml":".xml","text/csv":".csv","application/csv":".csv","text/html":".html","text/plain":".txt","text/css":".css","application/javascript":".js","text/javascript":".js","image/svg+xml":".svg","image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","application/pdf":".pdf","application/zip":".zip","application/gzip":".gz","application/octet-stream":".bin"}[r]||".bin"}function ci({text:e,mime:r}){let[o,s]=v(null);return G(()=>{let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));return s(n),()=>URL.revokeObjectURL(n)},[e,r]),o?t("a",{href:o,download:`body${mi(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function pi({headers:e}){let r=Object.entries(e);return r.length?t("table",{class:"profiler-table profiler-table--compact",children:t("tbody",{children:r.map(([o,s])=>t("tr",{children:[t("td",{class:"profiler-text--xs profiler-text--muted",style:"white-space:nowrap;padding-right:16px",children:o}),t("td",{class:"profiler-text--xs",style:"word-break:break-all",children:s})]},o))})}):t("span",{class:"profiler-text--muted profiler-text--xs",children:"none"})}function pc(e){let o=(Object.entries(e).find(([s])=>s.toLowerCase()==="content-type")?.[1]||"").split(";")[0].trim().toLowerCase();return o.includes("json")?"json":o==="image/svg+xml"?"svg":o.startsWith("image/")?"image":o==="application/pdf"?"pdf":o.includes("xml")?"xml":o==="text/csv"||o==="application/csv"?"csv":o==="text/html"?"html":o.startsWith("application/")&&!o.includes("json")&&!o.includes("xml")&&!o.includes("javascript")?"binary":"text"}function dc(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,o=>{if(o.startsWith("</"))return r=Math.max(0,r-1),`
1
+ "use strict";(()=>{var gn=e=>{throw TypeError(e)};var is=(e,r,o)=>r.has(e)||gn("Cannot "+o);var p=(e,r,o)=>(is(e,r,"read from private field"),o?o.call(e):r.get(e)),S=(e,r,o)=>r.has(e)?gn("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,o),E=(e,r,o,s)=>(is(e,r,"write to private field"),s?s.call(e,o):r.set(e,o),o),I=(e,r,o)=>(is(e,r,"access private method"),o);var Jr=(e,r,o,s)=>({set _(n){E(e,r,n,o)},get _(){return p(e,r,s)}});var Fo,ee,_n,gl,wt,bn,Tn,wn,Cn,ds,ls,us,En,So={},Ao=[],bl=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qo=Array.isArray;function dt(e,r){for(var o in r)e[o]=r[o];return e}function fs(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vl(e,r,o){var s,n,a,i={};for(a in r)a=="key"?s=r[a]:a=="ref"?n=r[a]:i[a]=r[a];if(arguments.length>2&&(i.children=arguments.length>3?Fo.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]===void 0&&(i[a]=e.defaultProps[a]);return ko(e,i,s,n,null)}function ko(e,r,o,s,n){var a={type:e,props:r,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++_n,__i:-1,__u:0};return n==null&&ee.vnode!=null&&ee.vnode(a),a}function M(e){return e.children}function Po(e,r){this.props=e,this.context=r}function dr(e,r){if(r==null)return e.__?dr(e.__,e.__i+1):null;for(var o;r<e.__k.length;r++)if((o=e.__k[r])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?dr(e):null}function xl(e){if(e.__P&&e.__d){var r=e.__v,o=r.__e,s=[],n=[],a=dt({},r);a.__v=r.__v+1,ee.vnode&&ee.vnode(a),ms(e.__P,a,r,e.__n,e.__P.namespaceURI,32&r.__u?[o]:null,s,o??dr(r),!!(32&r.__u),n),a.__v=r.__v,a.__.__k[a.__i]=a,Sn(s,a,n),r.__e=r.__=null,a.__e!=o&&Rn(a)}}function Rn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(r){if(r!=null&&r.__e!=null)return e.__e=e.__c.base=r.__e}),Rn(e)}function cs(e){(!e.__d&&(e.__d=!0)&&wt.push(e)&&!Mo.__r++||bn!=ee.debounceRendering)&&((bn=ee.debounceRendering)||Tn)(Mo)}function Mo(){try{for(var e,r=1;wt.length;)wt.length>r&&wt.sort(wn),e=wt.shift(),r=wt.length,xl(e)}finally{wt.length=Mo.__r=0}}function kn(e,r,o,s,n,a,i,l,c,d,m){var f,y,h,g,b,x,w,C=s&&s.__k||Ao,A=r.length;for(c=_l(o,r,C,c,A),f=0;f<A;f++)(h=o.__k[f])!=null&&(y=h.__i!=-1&&C[h.__i]||So,h.__i=f,x=ms(e,h,y,n,a,i,l,c,d,m),g=h.__e,h.ref&&y.ref!=h.ref&&(y.ref&&hs(y.ref,null,h),m.push(h.ref,h.__c||g,h)),b==null&&g!=null&&(b=g),(w=!!(4&h.__u))||y.__k===h.__k?c=Pn(h,c,e,w):typeof h.type=="function"&&x!==void 0?c=x:g&&(c=g.nextSibling),h.__u&=-7);return o.__e=b,c}function _l(e,r,o,s,n){var a,i,l,c,d,m=o.length,f=m,y=0;for(e.__k=new Array(n),a=0;a<n;a++)(i=r[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[a]=ko(null,i,null,null,null):qo(i)?i=e.__k[a]=ko(M,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[a]=ko(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[a]=i,c=a+y,i.__=e,i.__b=e.__b+1,l=null,(d=i.__i=Tl(i,o,c,f))!=-1&&(f--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(n>m?y--:n<m&&y++),typeof i.type!="function"&&(i.__u|=4)):d!=c&&(d==c-1?y--:d==c+1?y++:(d>c?y--:y++,i.__u|=4))):e.__k[a]=null;if(f)for(a=0;a<m;a++)(l=o[a])!=null&&(2&l.__u)==0&&(l.__e==s&&(s=dr(l)),Mn(l,l));return s}function Pn(e,r,o,s){var n,a;if(typeof e.type=="function"){for(n=e.__k,a=0;n&&a<n.length;a++)n[a]&&(n[a].__=e,r=Pn(n[a],r,o,s));return r}e.__e!=r&&(s&&(r&&e.type&&!r.parentNode&&(r=dr(e)),o.insertBefore(e.__e,r||null)),r=e.__e);do r=r&&r.nextSibling;while(r!=null&&r.nodeType==8);return r}function Tl(e,r,o,s){var n,a,i,l=e.key,c=e.type,d=r[o],m=d!=null&&(2&d.__u)==0;if(d===null&&l==null||m&&l==d.key&&c==d.type)return o;if(s>(m?1:0)){for(n=o-1,a=o+1;n>=0||a<r.length;)if((d=r[i=n>=0?n--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return i}return-1}function vn(e,r,o){r[0]=="-"?e.setProperty(r,o??""):e[r]=o==null?"":typeof o!="number"||bl.test(r)?o:o+"px"}function Ro(e,r,o,s,n){var a,i;e:if(r=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(r in s)o&&r in o||vn(e.style,r,"");if(o)for(r in o)s&&o[r]==s[r]||vn(e.style,r,o[r])}else if(r[0]=="o"&&r[1]=="n")a=r!=(r=r.replace(Cn,"$1")),i=r.toLowerCase(),r=i in e||r=="onFocusOut"||r=="onFocusIn"?i.slice(2):r.slice(2),e.l||(e.l={}),e.l[r+a]=o,o?s?o.u=s.u:(o.u=ds,e.addEventListener(r,a?us:ls,a)):e.removeEventListener(r,a?us:ls,a);else{if(n=="http://www.w3.org/2000/svg")r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!="width"&&r!="height"&&r!="href"&&r!="list"&&r!="form"&&r!="tabIndex"&&r!="download"&&r!="rowSpan"&&r!="colSpan"&&r!="role"&&r!="popover"&&r in e)try{e[r]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&r[4]!="-"?e.removeAttribute(r):e.setAttribute(r,r=="popover"&&o==1?"":o))}}function xn(e){return function(r){if(this.l){var o=this.l[r.type+e];if(r.t==null)r.t=ds++;else if(r.t<o.u)return;return o(ee.event?ee.event(r):r)}}}function ms(e,r,o,s,n,a,i,l,c,d){var m,f,y,h,g,b,x,w,C,A,k,K,U,L,j,T=r.type;if(r.constructor!==void 0)return null;128&o.__u&&(c=!!(32&o.__u),a=[l=r.__e=o.__e]),(m=ee.__b)&&m(r);e:if(typeof T=="function")try{if(w=r.props,C=T.prototype&&T.prototype.render,A=(m=T.contextType)&&s[m.__c],k=m?A?A.props.value:m.__:s,o.__c?x=(f=r.__c=o.__c).__=f.__E:(C?r.__c=f=new T(w,k):(r.__c=f=new Po(w,k),f.constructor=T,f.render=Cl),A&&A.sub(f),f.state||(f.state={}),f.__n=s,y=f.__d=!0,f.__h=[],f._sb=[]),C&&f.__s==null&&(f.__s=f.state),C&&T.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dt({},f.__s)),dt(f.__s,T.getDerivedStateFromProps(w,f.__s))),h=f.props,g=f.state,f.__v=r,y)C&&T.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),C&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(C&&T.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,k),r.__v==o.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,k)===!1){r.__v!=o.__v&&(f.props=w,f.state=f.__s,f.__d=!1),r.__e=o.__e,r.__k=o.__k,r.__k.some(function(F){F&&(F.__=r)}),Ao.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,k),C&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,g,b)})}if(f.context=k,f.props=w,f.__P=e,f.__e=!1,K=ee.__r,U=0,C)f.state=f.__s,f.__d=!1,K&&K(r),m=f.render(f.props,f.state,f.context),Ao.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,K&&K(r),m=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++U<25);f.state=f.__s,f.getChildContext!=null&&(s=dt(dt({},s),f.getChildContext())),C&&!y&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(h,g)),L=m!=null&&m.type===M&&m.key==null?An(m.props.children):m,l=kn(e,qo(L)?L:[L],r,o,s,n,a,i,l,c,d),f.base=r.__e,r.__u&=-161,f.__h.length&&i.push(f),x&&(f.__E=f.__=null)}catch(F){if(r.__v=null,c||a!=null)if(F.then){for(r.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,r.__e=l}else{for(j=a.length;j--;)fs(a[j]);ps(r)}else r.__e=o.__e,r.__k=o.__k,F.then||ps(r);ee.__e(F,r,o)}else a==null&&r.__v==o.__v?(r.__k=o.__k,r.__e=o.__e):l=r.__e=wl(o.__e,r,o,s,n,a,i,c,d);return(m=ee.diffed)&&m(r),128&r.__u?void 0:l}function ps(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ps))}function Sn(e,r,o){for(var s=0;s<o.length;s++)hs(o[s],o[++s],o[++s]);ee.__c&&ee.__c(r,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(a){a.call(n)})}catch(a){ee.__e(a,n.__v)}})}function An(e){return typeof e!="object"||e==null||e.__b>0?e:qo(e)?e.map(An):dt({},e)}function wl(e,r,o,s,n,a,i,l,c){var d,m,f,y,h,g,b,x=o.props||So,w=r.props,C=r.type;if(C=="svg"?n="http://www.w3.org/2000/svg":C=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((h=a[d])&&"setAttribute"in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,a[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(w);e=document.createElementNS(n,C,w.is&&w),l&&(ee.__m&&ee.__m(r,a),l=!1),a=null}if(C==null)x===w||l&&e.data==w||(e.data=w);else{if(a=a&&Fo.call(e.childNodes),!l&&a!=null)for(x={},d=0;d<e.attributes.length;d++)x[(h=e.attributes[d]).name]=h.value;for(d in x)h=x[d],d=="dangerouslySetInnerHTML"?f=h:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||Ro(e,d,null,h,n);for(d in w)h=w[d],d=="children"?y=h:d=="dangerouslySetInnerHTML"?m=h:d=="value"?g=h:d=="checked"?b=h:l&&typeof h!="function"||x[d]===h||Ro(e,d,h,x[d],n);if(m)l||f&&(m.__html==f.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),r.__k=[];else if(f&&(e.innerHTML=""),kn(r.type=="template"?e.content:e,qo(y)?y:[y],r,o,s,C=="foreignObject"?"http://www.w3.org/1999/xhtml":n,a,i,a?a[0]:o.__k&&dr(o,0),l,c),a!=null)for(d=a.length;d--;)fs(a[d]);l||(d="value",C=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||C=="progress"&&!g||C=="option"&&g!=x[d])&&Ro(e,d,g,x[d],n),d="checked",b!=null&&b!=e[d]&&Ro(e,d,b,x[d],n))}return e}function hs(e,r,o){try{if(typeof e=="function"){var s=typeof e.__u=="function";s&&e.__u(),s&&r==null||(e.__u=e(r))}else e.current=r}catch(n){ee.__e(n,o)}}function Mn(e,r,o){var s,n;if(ee.unmount&&ee.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||hs(s,null,r)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(a){ee.__e(a,r)}s.base=s.__P=null}if(s=e.__k)for(n=0;n<s.length;n++)s[n]&&Mn(s[n],r,o||typeof e.type!="function");o||fs(e.__e),e.__c=e.__=e.__e=void 0}function Cl(e,r,o){return this.constructor(e,o)}function fr(e,r,o){var s,n,a,i;r==document&&(r=document.documentElement),ee.__&&ee.__(e,r),n=(s=typeof o=="function")?null:o&&o.__k||r.__k,a=[],i=[],ms(r,e=(!s&&o||r).__k=vl(M,null,[e]),n||So,So,r.namespaceURI,!s&&o?[o]:n?null:r.firstChild?Fo.call(r.childNodes):null,a,!s&&o?o:n?n.__e:r.firstChild,s,i),Sn(a,e,i)}function mr(e){function r(o){var s,n;return this.getChildContext||(s=new Set,(n={})[r.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){s=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&s.forEach(function(i){i.__e=!0,cs(i)})},this.sub=function(a){s.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){s&&s.delete(a),i&&i.call(a)}}),o.children}return r.__c="__cC"+En++,r.__=e,r.Provider=r.__l=(r.Consumer=function(o,s){return o.children(s)}).contextType=r,r}Fo=Ao.slice,ee={__e:function(e,r,o,s){for(var n,a,i;r=r.__;)if((n=r.__c)&&!n.__)try{if((a=n.constructor)&&a.getDerivedStateFromError!=null&&(n.setState(a.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,s||{}),i=n.__d),i)return n.__E=n}catch(l){e=l}throw e}},_n=0,gl=function(e){return e!=null&&e.constructor===void 0},Po.prototype.setState=function(e,r){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof e=="function"&&(e=e(dt({},o),this.props)),e&&dt(o,e),e!=null&&this.__v&&(r&&this._sb.push(r),cs(this))},Po.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),cs(this))},Po.prototype.render=M,wt=[],Tn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,wn=function(e,r){return e.__v.__b-r.__v.__b},Mo.__r=0,Cn=/(PointerCapture)$|Capture$/i,ds=0,ls=xn(!1),us=xn(!0),En=0;var Ke=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}};var Jt,Ct,hr,Fn,El=(Fn=class extends Ke{constructor(){super();S(this,Jt);S(this,Ct);S(this,hr);E(this,hr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){p(this,Ct)||this.setEventListener(p(this,hr))}onUnsubscribe(){var r;this.hasListeners()||((r=p(this,Ct))==null||r.call(this),E(this,Ct,void 0))}setEventListener(r){var o;E(this,hr,r),(o=p(this,Ct))==null||o.call(this),E(this,Ct,r(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(r){p(this,Jt)!==r&&(E(this,Jt,r),this.onFocus())}onFocus(){let r=this.isFocused();this.listeners.forEach(o=>{o(r)})}isFocused(){return typeof p(this,Jt)=="boolean"?p(this,Jt):globalThis.document?.visibilityState!=="hidden"}},Jt=new WeakMap,Ct=new WeakMap,hr=new WeakMap,Fn),yr=new El;var Rl={setTimeout:(e,r)=>setTimeout(e,r),clearTimeout:e=>clearTimeout(e),setInterval:(e,r)=>setInterval(e,r),clearInterval:e=>clearInterval(e)},Et,ys,qn,kl=(qn=class{constructor(){S(this,Et,Rl);S(this,ys,!1)}setTimeoutProvider(e){E(this,Et,e)}setTimeout(e,r){return p(this,Et).setTimeout(e,r)}clearTimeout(e){p(this,Et).clearTimeout(e)}setInterval(e,r){return p(this,Et).setInterval(e,r)}clearInterval(e){p(this,Et).clearInterval(e)}},Et=new WeakMap,ys=new WeakMap,qn),ze=new kl;function On(e){setTimeout(e,0)}var bs=typeof window>"u"||"Deno"in globalThis;function ie(){}function Ln(e,r){return typeof e=="function"?e(r):e}function zr(e){return typeof e=="number"&&e>=0&&e!==1/0}function Oo(e,r){return Math.max(e+(r||0)-Date.now(),0)}function He(e,r){return typeof e=="function"?e(r):e}function ke(e,r){return typeof e=="function"?e(r):e}function Do(e,r){let{type:o="all",exact:s,fetchStatus:n,predicate:a,queryKey:i,stale:l}=e;if(i){if(s){if(r.queryHash!==Wr(i,r.options))return!1}else if(!zt(r.queryKey,i))return!1}if(o!=="all"){let c=r.isActive();if(o==="active"&&!c||o==="inactive"&&c)return!1}return!(typeof l=="boolean"&&r.isStale()!==l||n&&n!==r.state.fetchStatus||a&&!a(r))}function Qo(e,r){let{exact:o,status:s,predicate:n,mutationKey:a}=e;if(a){if(!r.options.mutationKey)return!1;if(o){if(We(r.options.mutationKey)!==We(a))return!1}else if(!zt(r.options.mutationKey,a))return!1}return!(s&&r.state.status!==s||n&&!n(r))}function Wr(e,r){return(r?.queryKeyHashFn||We)(e)}function We(e){return JSON.stringify(e,(r,o)=>gs(o)?Object.keys(o).sort().reduce((s,n)=>(s[n]=o[n],s),{}):o)}function zt(e,r){return e===r?!0:typeof e!=typeof r?!1:e&&r&&typeof e=="object"&&typeof r=="object"?Object.keys(r).every(o=>zt(e[o],r[o])):!1}var Pl=Object.prototype.hasOwnProperty;function vs(e,r,o=0){if(e===r)return e;if(o>500)return r;let s=Dn(e)&&Dn(r);if(!s&&!(gs(e)&&gs(r)))return r;let a=(s?e:Object.keys(e)).length,i=s?r:Object.keys(r),l=i.length,c=s?new Array(l):{},d=0;for(let m=0;m<l;m++){let f=s?m:i[m],y=e[f],h=r[f];if(y===h){c[f]=y,(s?m<a:Pl.call(e,f))&&d++;continue}if(y===null||h===null||typeof y!="object"||typeof h!="object"){c[f]=h;continue}let g=vs(y,h,o+1);c[f]=g,g===y&&d++}return a===l&&d===a?e:c}function gr(e,r){if(!r||Object.keys(e).length!==Object.keys(r).length)return!1;for(let o in e)if(e[o]!==r[o])return!1;return!0}function Dn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function gs(e){if(!Qn(e))return!1;let r=e.constructor;if(r===void 0)return!0;let o=r.prototype;return!(!Qn(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Qn(e){return Object.prototype.toString.call(e)==="[object Object]"}function Kn(e){return new Promise(r=>{ze.setTimeout(r,e)})}function Zr(e,r,o){return typeof o.structuralSharing=="function"?o.structuralSharing(e,r):o.structuralSharing!==!1?vs(e,r):r}function Un(e,r,o=0){let s=[...e,r];return o&&s.length>o?s.slice(1):s}function Nn(e,r,o=0){let s=[r,...e];return o&&s.length>o?s.slice(0,-1):s}var br=Symbol();function Lo(e,r){return!e.queryFn&&r?.initialPromise?()=>r.initialPromise:!e.queryFn||e.queryFn===br?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Xr(e,r){return typeof e=="function"?e(...r):!!e}function jn(e,r,o){let s=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=r()),s||(s=!0,n.aborted?o():n.addEventListener("abort",o,{once:!0})),n)}),e}var Ze=(()=>{let e=()=>bs;return{isServer(){return e()},setIsServer(r){e=r}}})();function Yr(){let e,r,o=new Promise((n,a)=>{e=n,r=a});o.status="pending",o.catch(()=>{});function s(n){Object.assign(o,n),delete o.resolve,delete o.reject}return o.resolve=n=>{s({status:"fulfilled",value:n}),e(n)},o.reject=n=>{s({status:"rejected",reason:n}),r(n)},o}var In=On;function Sl(){let e=[],r=0,o=l=>{l()},s=l=>{l()},n=In,a=l=>{r?e.push(l):n(()=>{o(l)})},i=()=>{let l=e;e=[],l.length&&n(()=>{s(()=>{l.forEach(c=>{o(c)})})})};return{batch:l=>{let c;r++;try{c=l()}finally{r--,r||i()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{o=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{n=l}}}var te=Sl();var vr,Rt,xr,$n,Al=($n=class extends Ke{constructor(){super();S(this,vr,!0);S(this,Rt);S(this,xr);E(this,xr,r=>{if(typeof window<"u"&&window.addEventListener){let o=()=>r(!0),s=()=>r(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",s)}}})}onSubscribe(){p(this,Rt)||this.setEventListener(p(this,xr))}onUnsubscribe(){var r;this.hasListeners()||((r=p(this,Rt))==null||r.call(this),E(this,Rt,void 0))}setEventListener(r){var o;E(this,xr,r),(o=p(this,Rt))==null||o.call(this),E(this,Rt,r(this.setOnline.bind(this)))}setOnline(r){p(this,vr)!==r&&(E(this,vr,r),this.listeners.forEach(s=>{s(r)}))}isOnline(){return p(this,vr)}},vr=new WeakMap,Rt=new WeakMap,xr=new WeakMap,$n),_r=new Al;function Ml(e){return Math.min(1e3*2**e,3e4)}function xs(e){return(e??"online")==="online"?_r.isOnline():!0}var Ko=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Uo(e){let r=!1,o=0,s,n=Yr(),a=()=>n.status!=="pending",i=b=>{if(!a()){let x=new Ko(b);y(x),e.onCancel?.(x)}},l=()=>{r=!0},c=()=>{r=!1},d=()=>yr.isFocused()&&(e.networkMode==="always"||_r.isOnline())&&e.canRun(),m=()=>xs(e.networkMode)&&e.canRun(),f=b=>{a()||(s?.(),n.resolve(b))},y=b=>{a()||(s?.(),n.reject(b))},h=()=>new Promise(b=>{s=x=>{(a()||d())&&b(x)},e.onPause?.()}).then(()=>{s=void 0,a()||e.onContinue?.()}),g=()=>{if(a())return;let b,x=o===0?e.initialPromise:void 0;try{b=x??e.fn()}catch(w){b=Promise.reject(w)}Promise.resolve(b).then(f).catch(w=>{if(a())return;let C=e.retry??(Ze.isServer()?0:3),A=e.retryDelay??Ml,k=typeof A=="function"?A(o,w):A,K=C===!0||typeof C=="number"&&o<C||typeof C=="function"&&C(o,w);if(r||!K){y(w);return}o++,e.onFail?.(o,w),Kn(k).then(()=>d()?void 0:h()).then(()=>{r?y(w):g()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(s?.(),n),cancelRetry:l,continueRetry:c,canStart:m,start:()=>(m()?g():h().then(g),n)}}var Wt,Vn,No=(Vn=class{constructor(){S(this,Wt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zr(this.gcTime)&&E(this,Wt,ze.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ze.isServer()?1/0:300*1e3))}clearGcTimeout(){p(this,Wt)!==void 0&&(ze.clearTimeout(p(this,Wt)),E(this,Wt,void 0))}},Wt=new WeakMap,Vn);function Hn(e){return{onFetch:(r,o)=>{let s=r.options,n=r.fetchOptions?.meta?.fetchMore?.direction,a=r.state.data?.pages||[],i=r.state.data?.pageParams||[],l={pages:[],pageParams:[]},c=0,d=async()=>{let m=!1,f=g=>{jn(g,()=>r.signal,()=>m=!0)},y=Lo(r.options,r.fetchOptions),h=async(g,b,x)=>{if(m)return Promise.reject(r.signal.reason);if(b==null&&g.pages.length)return Promise.resolve(g);let C=(()=>{let U={client:r.client,queryKey:r.queryKey,pageParam:b,direction:x?"backward":"forward",meta:r.options.meta};return f(U),U})(),A=await y(C),{maxPages:k}=r.options,K=x?Nn:Un;return{pages:K(g.pages,A,k),pageParams:K(g.pageParams,b,k)}};if(n&&a.length){let g=n==="backward",b=g?Gn:_s,x={pages:a,pageParams:i},w=b(s,x);l=await h(x,w,g)}else{let g=e??a.length;do{let b=c===0?i[0]??s.initialPageParam:_s(s,l);if(c>0&&b==null)break;l=await h(l,b),c++}while(c<g)}return l};r.options.persister?r.fetchFn=()=>r.options.persister?.(d,{client:r.client,queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},o):r.fetchFn=d}}}function _s(e,{pages:r,pageParams:o}){let s=r.length-1;return r.length>0?e.getNextPageParam(r[s],r,o[s],o):void 0}function Gn(e,{pages:r,pageParams:o}){return r.length>0?e.getPreviousPageParam?.(r[0],r,o[0],o):void 0}function Bn(e,r){return r?_s(e,r)!=null:!1}function Jn(e,r){return!r||!e.getPreviousPageParam?!1:Gn(e,r)!=null}var Tr,Zt,wr,Ue,Xt,me,eo,Yt,Oe,Yn,ft,Zn,Xn=(Zn=class extends No{constructor(r){super();S(this,Oe);S(this,Tr);S(this,Zt);S(this,wr);S(this,Ue);S(this,Xt);S(this,me);S(this,eo);S(this,Yt);E(this,Yt,!1),E(this,eo,r.defaultOptions),this.setOptions(r.options),this.observers=[],E(this,Xt,r.client),E(this,Ue,p(this,Xt).getQueryCache()),this.queryKey=r.queryKey,this.queryHash=r.queryHash,E(this,Zt,Wn(this.options)),this.state=r.state??p(this,Zt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return p(this,Tr)}get promise(){return p(this,me)?.promise}setOptions(r){if(this.options={...p(this,eo),...r},r?._type&&E(this,Tr,r._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let o=Wn(this.options);o.data!==void 0&&(this.setState(zn(o.data,o.dataUpdatedAt)),E(this,Zt,o))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&p(this,Ue).remove(this)}setData(r,o){let s=Zr(this.state.data,r,this.options);return I(this,Oe,ft).call(this,{data:s,type:"success",dataUpdatedAt:o?.updatedAt,manual:o?.manual}),s}setState(r){I(this,Oe,ft).call(this,{type:"setState",state:r})}cancel(r){let o=p(this,me)?.promise;return p(this,me)?.cancel(r),o?o.then(ie).catch(ie):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return p(this,Zt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(r=>ke(r.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===br||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(r=>He(r.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(r=>r.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(r=0){return this.state.data===void 0?!0:r==="static"?!1:this.state.isInvalidated?!0:!Oo(this.state.dataUpdatedAt,r)}onFocus(){this.observers.find(o=>o.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),p(this,me)?.continue()}onOnline(){this.observers.find(o=>o.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),p(this,me)?.continue()}addObserver(r){this.observers.includes(r)||(this.observers.push(r),this.clearGcTimeout(),p(this,Ue).notify({type:"observerAdded",query:this,observer:r}))}removeObserver(r){this.observers.includes(r)&&(this.observers=this.observers.filter(o=>o!==r),this.observers.length||(p(this,me)&&(p(this,Yt)||I(this,Oe,Yn).call(this)?p(this,me).cancel({revert:!0}):p(this,me).cancelRetry()),this.scheduleGc()),p(this,Ue).notify({type:"observerRemoved",query:this,observer:r}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||I(this,Oe,ft).call(this,{type:"invalidate"})}async fetch(r,o){if(this.state.fetchStatus!=="idle"&&p(this,me)?.status()!=="rejected"){if(this.state.data!==void 0&&o?.cancelRefetch)this.cancel({silent:!0});else if(p(this,me))return p(this,me).continueRetry(),p(this,me).promise}if(r&&this.setOptions(r),!this.options.queryFn){let d=this.observers.find(m=>m.options.queryFn);d&&this.setOptions(d.options)}let s=new AbortController,n=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(E(this,Yt,!0),s.signal)})},a=()=>{let d=Lo(this.options,o),f=(()=>{let y={client:p(this,Xt),queryKey:this.queryKey,meta:this.meta};return n(y),y})();return E(this,Yt,!1),this.options.persister?this.options.persister(d,f,this):d(f)},l=(()=>{let d={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:p(this,Xt),state:this.state,fetchFn:a};return n(d),d})();(p(this,Tr)==="infinite"?Hn(this.options.pages):this.options.behavior)?.onFetch(l,this),E(this,wr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&I(this,Oe,ft).call(this,{type:"fetch",meta:l.fetchOptions?.meta}),E(this,me,Uo({initialPromise:o?.initialPromise,fn:l.fetchFn,onCancel:d=>{d instanceof Ko&&d.revert&&this.setState({...p(this,wr),fetchStatus:"idle"}),s.abort()},onFail:(d,m)=>{I(this,Oe,ft).call(this,{type:"failed",failureCount:d,error:m})},onPause:()=>{I(this,Oe,ft).call(this,{type:"pause"})},onContinue:()=>{I(this,Oe,ft).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{let d=await p(this,me).start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),p(this,Ue).config.onSuccess?.(d,this),p(this,Ue).config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Ko){if(d.silent)return p(this,me).promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw I(this,Oe,ft).call(this,{type:"error",error:d}),p(this,Ue).config.onError?.(d,this),p(this,Ue).config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}},Tr=new WeakMap,Zt=new WeakMap,wr=new WeakMap,Ue=new WeakMap,Xt=new WeakMap,me=new WeakMap,eo=new WeakMap,Yt=new WeakMap,Oe=new WeakSet,Yn=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ft=function(r){let o=s=>{switch(r.type){case"failed":return{...s,fetchFailureCount:r.failureCount,fetchFailureReason:r.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Ts(s.data,this.options),fetchMeta:r.meta??null};case"success":let n={...s,...zn(r.data,r.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!r.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return E(this,wr,r.manual?n:void 0),n;case"error":let a=r.error;return{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...r.state}}};this.state=o(this.state),te.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),p(this,Ue).notify({query:this,type:"updated",action:r})})},Zn);function Ts(e,r){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xs(r.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zn(e,r){return{data:e,dataUpdatedAt:r??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Wn(e){let r=typeof e.initialData=="function"?e.initialData():e.initialData,o=r!==void 0,s=o?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:r,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var Ae,z,ro,Pe,er,Cr,mt,kt,oo,Er,Rr,tr,rr,Pt,kr,X,to,ws,Cs,Es,Rs,ks,Ps,Ss,oa,ra,so=(ra=class extends Ke{constructor(r,o){super();S(this,X);S(this,Ae);S(this,z);S(this,ro);S(this,Pe);S(this,er);S(this,Cr);S(this,mt);S(this,kt);S(this,oo);S(this,Er);S(this,Rr);S(this,tr);S(this,rr);S(this,Pt);S(this,kr,new Set);this.options=o,E(this,Ae,r),E(this,kt,null),E(this,mt,Yr()),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(p(this,z).addObserver(this),ea(p(this,z),this.options)?I(this,X,to).call(this):this.updateResult(),I(this,X,Rs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return As(p(this,z),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return As(p(this,z),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,I(this,X,ks).call(this),I(this,X,Ps).call(this),p(this,z).removeObserver(this)}setOptions(r){let o=this.options,s=p(this,z);if(this.options=p(this,Ae).defaultQueryOptions(r),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ke(this.options.enabled,p(this,z))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");I(this,X,Ss).call(this),p(this,z).setOptions(this.options),o._defaulted&&!gr(this.options,o)&&p(this,Ae).getQueryCache().notify({type:"observerOptionsUpdated",query:p(this,z),observer:this});let n=this.hasListeners();n&&ta(p(this,z),s,this.options,o)&&I(this,X,to).call(this),this.updateResult(),n&&(p(this,z)!==s||ke(this.options.enabled,p(this,z))!==ke(o.enabled,p(this,z))||He(this.options.staleTime,p(this,z))!==He(o.staleTime,p(this,z)))&&I(this,X,ws).call(this);let a=I(this,X,Cs).call(this);n&&(p(this,z)!==s||ke(this.options.enabled,p(this,z))!==ke(o.enabled,p(this,z))||a!==p(this,Pt))&&I(this,X,Es).call(this,a)}getOptimisticResult(r){let o=p(this,Ae).getQueryCache().build(p(this,Ae),r),s=this.createResult(o,r);return ql(this,s)&&(E(this,Pe,s),E(this,Cr,this.options),E(this,er,p(this,z).state)),s}getCurrentResult(){return p(this,Pe)}trackResult(r,o){return new Proxy(r,{get:(s,n)=>(this.trackProp(n),o?.(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&p(this,mt).status==="pending"&&p(this,mt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,n))})}trackProp(r){p(this,kr).add(r)}getCurrentQuery(){return p(this,z)}refetch({...r}={}){return this.fetch({...r})}fetchOptimistic(r){let o=p(this,Ae).defaultQueryOptions(r),s=p(this,Ae).getQueryCache().build(p(this,Ae),o);return s.fetch().then(()=>this.createResult(s,o))}fetch(r){return I(this,X,to).call(this,{...r,cancelRefetch:r.cancelRefetch??!0}).then(()=>(this.updateResult(),p(this,Pe)))}createResult(r,o){let s=p(this,z),n=this.options,a=p(this,Pe),i=p(this,er),l=p(this,Cr),d=r!==s?r.state:p(this,ro),{state:m}=r,f={...m},y=!1,h;if(o._optimisticResults){let T=this.hasListeners(),F=!T&&ea(r,o),$=T&&ta(r,s,o,n);(F||$)&&(f={...f,...Ts(m.data,r.options)}),o._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:b,status:x}=f;h=f.data;let w=!1;if(o.placeholderData!==void 0&&h===void 0&&x==="pending"){let T;a?.isPlaceholderData&&o.placeholderData===l?.placeholderData?(T=a.data,w=!0):T=typeof o.placeholderData=="function"?o.placeholderData(p(this,Rr)?.state.data,p(this,Rr)):o.placeholderData,T!==void 0&&(x="success",h=Zr(a?.data,T,o),y=!0)}if(o.select&&h!==void 0&&!w)if(a&&h===i?.data&&o.select===p(this,oo))h=p(this,Er);else try{E(this,oo,o.select),h=o.select(h),h=Zr(a?.data,h,o),E(this,Er,h),E(this,kt,null)}catch(T){E(this,kt,T)}p(this,kt)&&(g=p(this,kt),h=p(this,Er),b=Date.now(),x="error");let C=f.fetchStatus==="fetching",A=x==="pending",k=x==="error",K=A&&C,U=h!==void 0,j={status:x,fetchStatus:f.fetchStatus,isPending:A,isSuccess:x==="success",isError:k,isInitialLoading:K,isLoading:K,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:b,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:r.isFetched(),isFetchedAfterMount:f.dataUpdateCount>d.dataUpdateCount||f.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!A,isLoadingError:k&&!U,isPaused:f.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:k&&U,isStale:Ms(r,o),refetch:this.refetch,promise:p(this,mt),isEnabled:ke(o.enabled,r)!==!1};if(this.options.experimental_prefetchInRender){let T=j.data!==void 0,F=j.status==="error"&&!T,$=ce=>{F?ce.reject(j.error):T&&ce.resolve(j.data)},Z=()=>{let ce=E(this,mt,j.promise=Yr());$(ce)},B=p(this,mt);switch(B.status){case"pending":r.queryHash===s.queryHash&&$(B);break;case"fulfilled":(F||j.data!==B.value)&&Z();break;case"rejected":(!F||j.error!==B.reason)&&Z();break}}return j}updateResult(){let r=p(this,Pe),o=this.createResult(p(this,z),this.options);if(E(this,er,p(this,z).state),E(this,Cr,this.options),p(this,er).data!==void 0&&E(this,Rr,p(this,z)),gr(o,r))return;E(this,Pe,o);let s=()=>{if(!r)return!0;let{notifyOnChangeProps:n}=this.options,a=typeof n=="function"?n():n;if(a==="all"||!a&&!p(this,kr).size)return!0;let i=new Set(a??p(this,kr));return this.options.throwOnError&&i.add("error"),Object.keys(p(this,Pe)).some(l=>{let c=l;return p(this,Pe)[c]!==r[c]&&i.has(c)})};I(this,X,oa).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&I(this,X,Rs).call(this)}},Ae=new WeakMap,z=new WeakMap,ro=new WeakMap,Pe=new WeakMap,er=new WeakMap,Cr=new WeakMap,mt=new WeakMap,kt=new WeakMap,oo=new WeakMap,Er=new WeakMap,Rr=new WeakMap,tr=new WeakMap,rr=new WeakMap,Pt=new WeakMap,kr=new WeakMap,X=new WeakSet,to=function(r){I(this,X,Ss).call(this);let o=p(this,z).fetch(this.options,r);return r?.throwOnError||(o=o.catch(ie)),o},ws=function(){I(this,X,ks).call(this);let r=He(this.options.staleTime,p(this,z));if(Ze.isServer()||p(this,Pe).isStale||!zr(r))return;let s=Oo(p(this,Pe).dataUpdatedAt,r)+1;E(this,tr,ze.setTimeout(()=>{p(this,Pe).isStale||this.updateResult()},s))},Cs=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(p(this,z)):this.options.refetchInterval)??!1},Es=function(r){I(this,X,Ps).call(this),E(this,Pt,r),!(Ze.isServer()||ke(this.options.enabled,p(this,z))===!1||!zr(p(this,Pt))||p(this,Pt)===0)&&E(this,rr,ze.setInterval(()=>{(this.options.refetchIntervalInBackground||yr.isFocused())&&I(this,X,to).call(this)},p(this,Pt)))},Rs=function(){I(this,X,ws).call(this),I(this,X,Es).call(this,I(this,X,Cs).call(this))},ks=function(){p(this,tr)!==void 0&&(ze.clearTimeout(p(this,tr)),E(this,tr,void 0))},Ps=function(){p(this,rr)!==void 0&&(ze.clearInterval(p(this,rr)),E(this,rr,void 0))},Ss=function(){let r=p(this,Ae).getQueryCache().build(p(this,Ae),this.options);if(r===p(this,z))return;let o=p(this,z);E(this,z,r),E(this,ro,r.state),this.hasListeners()&&(o?.removeObserver(this),r.addObserver(this))},oa=function(r){te.batch(()=>{r.listeners&&this.listeners.forEach(o=>{o(p(this,Pe))}),p(this,Ae).getQueryCache().notify({query:p(this,z),type:"observerResultsUpdated"})})},ra);function Fl(e,r){return ke(r.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&ke(r.retryOnMount,e)===!1)}function ea(e,r){return Fl(e,r)||e.state.data!==void 0&&As(e,r,r.refetchOnMount)}function As(e,r,o){if(ke(r.enabled,e)!==!1&&He(r.staleTime,e)!=="static"){let s=typeof o=="function"?o(e):o;return s==="always"||s!==!1&&Ms(e,r)}return!1}function ta(e,r,o,s){return(e!==r||ke(s.enabled,e)===!1)&&(!o.suspense||e.state.status!=="error")&&Ms(e,o)}function Ms(e,r){return ke(r.enabled,e)!==!1&&e.isStaleByTime(He(r.staleTime,e))}function ql(e,r){return!gr(e.getCurrentResult(),r)}var Fs=class extends so{constructor(e,r){super(e,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,r){let{state:o}=e,s=super.createResult(e,r),{isFetching:n,isRefetching:a,isError:i,isRefetchError:l}=s,c=o.fetchMeta?.fetchMore?.direction,d=i&&c==="forward",m=n&&c==="forward",f=i&&c==="backward",y=n&&c==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Bn(r,o.data),hasPreviousPage:Jn(r,o.data),isFetchNextPageError:d,isFetchingNextPage:m,isFetchPreviousPageError:f,isFetchingPreviousPage:y,isRefetchError:l&&!d&&!f,isRefetching:a&&!m&&!y}}};var no,Xe,_e,or,Ye,St,sa,na=(sa=class extends No{constructor(r){super();S(this,Ye);S(this,no);S(this,Xe);S(this,_e);S(this,or);E(this,no,r.client),this.mutationId=r.mutationId,E(this,_e,r.mutationCache),E(this,Xe,[]),this.state=r.state||qs(),this.setOptions(r.options),this.scheduleGc()}setOptions(r){this.options=r,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(r){p(this,Xe).includes(r)||(p(this,Xe).push(r),this.clearGcTimeout(),p(this,_e).notify({type:"observerAdded",mutation:this,observer:r}))}removeObserver(r){E(this,Xe,p(this,Xe).filter(o=>o!==r)),this.scheduleGc(),p(this,_e).notify({type:"observerRemoved",mutation:this,observer:r})}optionalRemove(){p(this,Xe).length||(this.state.status==="pending"?this.scheduleGc():p(this,_e).remove(this))}continue(){return p(this,or)?.continue()??this.execute(this.state.variables)}async execute(r){let o=()=>{I(this,Ye,St).call(this,{type:"continue"})},s={client:p(this,no),meta:this.options.meta,mutationKey:this.options.mutationKey};E(this,or,Uo({fn:()=>this.options.mutationFn?this.options.mutationFn(r,s):Promise.reject(new Error("No mutationFn found")),onFail:(i,l)=>{I(this,Ye,St).call(this,{type:"failed",failureCount:i,error:l})},onPause:()=>{I(this,Ye,St).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(this,_e).canRun(this)}));let n=this.state.status==="pending",a=!p(this,or).canStart();try{if(n)o();else{I(this,Ye,St).call(this,{type:"pending",variables:r,isPaused:a}),p(this,_e).config.onMutate&&await p(this,_e).config.onMutate(r,this,s);let l=await this.options.onMutate?.(r,s);l!==this.state.context&&I(this,Ye,St).call(this,{type:"pending",context:l,variables:r,isPaused:a})}let i=await p(this,or).start();return await p(this,_e).config.onSuccess?.(i,r,this.state.context,this,s),await this.options.onSuccess?.(i,r,this.state.context,s),await p(this,_e).config.onSettled?.(i,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(i,null,r,this.state.context,s),I(this,Ye,St).call(this,{type:"success",data:i}),i}catch(i){try{await p(this,_e).config.onError?.(i,r,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onError?.(i,r,this.state.context,s)}catch(l){Promise.reject(l)}try{await p(this,_e).config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,s)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,i,r,this.state.context,s)}catch(l){Promise.reject(l)}throw I(this,Ye,St).call(this,{type:"error",error:i}),i}finally{p(this,_e).runNext(this)}}},no=new WeakMap,Xe=new WeakMap,_e=new WeakMap,or=new WeakMap,Ye=new WeakSet,St=function(r){let o=s=>{switch(r.type){case"failed":return{...s,failureCount:r.failureCount,failureReason:r.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:r.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:r.isPaused,status:"pending",variables:r.variables,submittedAt:Date.now()};case"success":return{...s,data:r.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:r.error,failureCount:s.failureCount+1,failureReason:r.error,isPaused:!1,status:"error"}}};this.state=o(this.state),te.batch(()=>{p(this,Xe).forEach(s=>{s.onMutationUpdate(r)}),p(this,_e).notify({mutation:this,type:"updated",action:r})})},sa);function qs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ht,Ge,ao,aa,ia=(aa=class extends Ke{constructor(r={}){super();S(this,ht);S(this,Ge);S(this,ao);this.config=r,E(this,ht,new Set),E(this,Ge,new Map),E(this,ao,0)}build(r,o,s){let n=new na({client:r,mutationCache:this,mutationId:++Jr(this,ao)._,options:r.defaultMutationOptions(o),state:s});return this.add(n),n}add(r){p(this,ht).add(r);let o=jo(r);if(typeof o=="string"){let s=p(this,Ge).get(o);s?s.push(r):p(this,Ge).set(o,[r])}this.notify({type:"added",mutation:r})}remove(r){if(p(this,ht).delete(r)){let o=jo(r);if(typeof o=="string"){let s=p(this,Ge).get(o);if(s)if(s.length>1){let n=s.indexOf(r);n!==-1&&s.splice(n,1)}else s[0]===r&&p(this,Ge).delete(o)}}this.notify({type:"removed",mutation:r})}canRun(r){let o=jo(r);if(typeof o=="string"){let n=p(this,Ge).get(o)?.find(a=>a.state.status==="pending");return!n||n===r}else return!0}runNext(r){let o=jo(r);return typeof o=="string"?p(this,Ge).get(o)?.find(n=>n!==r&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){te.batch(()=>{p(this,ht).forEach(r=>{this.notify({type:"removed",mutation:r})}),p(this,ht).clear(),p(this,Ge).clear()})}getAll(){return Array.from(p(this,ht))}find(r){let o={exact:!0,...r};return this.getAll().find(s=>Qo(o,s))}findAll(r={}){return this.getAll().filter(o=>Qo(r,o))}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}resumePausedMutations(){let r=this.getAll().filter(o=>o.state.isPaused);return te.batch(()=>Promise.all(r.map(o=>o.continue().catch(ie))))}},ht=new WeakMap,Ge=new WeakMap,ao=new WeakMap,aa);function jo(e){return e.options.scope?.id}var yt,At,Me,gt,bt,Io,Os,la,Ds=(la=class extends Ke{constructor(r,o){super();S(this,bt);S(this,yt);S(this,At);S(this,Me);S(this,gt);E(this,yt,r),this.setOptions(o),this.bindMethods(),I(this,bt,Io).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(r){let o=this.options;this.options=p(this,yt).defaultMutationOptions(r),gr(this.options,o)||p(this,yt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:p(this,Me),observer:this}),o?.mutationKey&&this.options.mutationKey&&We(o.mutationKey)!==We(this.options.mutationKey)?this.reset():p(this,Me)?.state.status==="pending"&&p(this,Me).setOptions(this.options)}onUnsubscribe(){this.hasListeners()||p(this,Me)?.removeObserver(this)}onMutationUpdate(r){I(this,bt,Io).call(this),I(this,bt,Os).call(this,r)}getCurrentResult(){return p(this,At)}reset(){p(this,Me)?.removeObserver(this),E(this,Me,void 0),I(this,bt,Io).call(this),I(this,bt,Os).call(this)}mutate(r,o){return E(this,gt,o),p(this,Me)?.removeObserver(this),E(this,Me,p(this,yt).getMutationCache().build(p(this,yt),this.options)),p(this,Me).addObserver(this),p(this,Me).execute(r)}},yt=new WeakMap,At=new WeakMap,Me=new WeakMap,gt=new WeakMap,bt=new WeakSet,Io=function(){let r=p(this,Me)?.state??qs();E(this,At,{...r,isPending:r.status==="pending",isSuccess:r.status==="success",isError:r.status==="error",isIdle:r.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(r){te.batch(()=>{if(p(this,gt)&&this.hasListeners()){let o=p(this,At).variables,s=p(this,At).context,n={client:p(this,yt),meta:this.options.meta,mutationKey:this.options.mutationKey};if(r?.type==="success"){try{p(this,gt).onSuccess?.(r.data,o,s,n)}catch(a){Promise.reject(a)}try{p(this,gt).onSettled?.(r.data,null,o,s,n)}catch(a){Promise.reject(a)}}else if(r?.type==="error"){try{p(this,gt).onError?.(r.error,o,s,n)}catch(a){Promise.reject(a)}try{p(this,gt).onSettled?.(void 0,r.error,o,s,n)}catch(a){Promise.reject(a)}}}this.listeners.forEach(o=>{o(p(this,At))})})},la);var et,ua,ca=(ua=class extends Ke{constructor(r={}){super();S(this,et);this.config=r,E(this,et,new Map)}build(r,o,s){let n=o.queryKey,a=o.queryHash??Wr(n,o),i=this.get(a);return i||(i=new Xn({client:r,queryKey:n,queryHash:a,options:r.defaultQueryOptions(o),state:s,defaultOptions:r.getQueryDefaults(n)}),this.add(i)),i}add(r){p(this,et).has(r.queryHash)||(p(this,et).set(r.queryHash,r),this.notify({type:"added",query:r}))}remove(r){let o=p(this,et).get(r.queryHash);o&&(r.destroy(),o===r&&p(this,et).delete(r.queryHash),this.notify({type:"removed",query:r}))}clear(){te.batch(()=>{this.getAll().forEach(r=>{this.remove(r)})})}get(r){return p(this,et).get(r)}getAll(){return[...p(this,et).values()]}find(r){let o={exact:!0,...r};return this.getAll().find(s=>Do(o,s))}findAll(r={}){let o=this.getAll();return Object.keys(r).length>0?o.filter(s=>Do(r,s)):o}notify(r){te.batch(()=>{this.listeners.forEach(o=>{o(r)})})}onFocus(){te.batch(()=>{this.getAll().forEach(r=>{r.onFocus()})})}onOnline(){te.batch(()=>{this.getAll().forEach(r=>{r.onOnline()})})}},et=new WeakMap,ua);var le,Mt,Ft,Pr,Sr,qt,Ar,Mr,pa,Qs=(pa=class{constructor(e={}){S(this,le);S(this,Mt);S(this,Ft);S(this,Pr);S(this,Sr);S(this,qt);S(this,Ar);S(this,Mr);E(this,le,e.queryCache||new ca),E(this,Mt,e.mutationCache||new ia),E(this,Ft,e.defaultOptions||{}),E(this,Pr,new Map),E(this,Sr,new Map),E(this,qt,0)}mount(){Jr(this,qt)._++,p(this,qt)===1&&(E(this,Ar,yr.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,le).onFocus())})),E(this,Mr,_r.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(this,le).onOnline())})))}unmount(){var e,r;Jr(this,qt)._--,p(this,qt)===0&&((e=p(this,Ar))==null||e.call(this),E(this,Ar,void 0),(r=p(this,Mr))==null||r.call(this),E(this,Mr,void 0))}isFetching(e){return p(this,le).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return p(this,Mt).findAll({...e,status:"pending"}).length}getQueryData(e){let r=this.defaultQueryOptions({queryKey:e});return p(this,le).get(r.queryHash)?.state.data}ensureQueryData(e){let r=this.defaultQueryOptions(e),o=p(this,le).build(this,r),s=o.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&o.isStaleByTime(He(r.staleTime,o))&&this.prefetchQuery(r),Promise.resolve(s))}getQueriesData(e){return p(this,le).findAll(e).map(({queryKey:r,state:o})=>{let s=o.data;return[r,s]})}setQueryData(e,r,o){let s=this.defaultQueryOptions({queryKey:e}),a=p(this,le).get(s.queryHash)?.state.data,i=Ln(r,a);if(i!==void 0)return p(this,le).build(this,s).setData(i,{...o,manual:!0})}setQueriesData(e,r,o){return te.batch(()=>p(this,le).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,r,o)]))}getQueryState(e){let r=this.defaultQueryOptions({queryKey:e});return p(this,le).get(r.queryHash)?.state}removeQueries(e){let r=p(this,le);te.batch(()=>{r.findAll(e).forEach(o=>{r.remove(o)})})}resetQueries(e,r){let o=p(this,le);return te.batch(()=>(o.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},r)))}cancelQueries(e,r={}){let o={revert:!0,...r},s=te.batch(()=>p(this,le).findAll(e).map(n=>n.cancel(o)));return Promise.all(s).then(ie).catch(ie)}invalidateQueries(e,r={}){return te.batch(()=>(p(this,le).findAll(e).forEach(o=>{o.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},r)))}refetchQueries(e,r={}){let o={...r,cancelRefetch:r.cancelRefetch??!0},s=te.batch(()=>p(this,le).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,o);return o.throwOnError||(a=a.catch(ie)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(s).then(ie)}fetchQuery(e){let r=this.defaultQueryOptions(e);r.retry===void 0&&(r.retry=!1);let o=p(this,le).build(this,r);return o.isStaleByTime(He(r.staleTime,o))?o.fetch(r):Promise.resolve(o.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ie).catch(ie)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ie).catch(ie)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return _r.isOnline()?p(this,Mt).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(this,le)}getMutationCache(){return p(this,Mt)}getDefaultOptions(){return p(this,Ft)}setDefaultOptions(e){E(this,Ft,e)}setQueryDefaults(e,r){p(this,Pr).set(We(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...p(this,Pr).values()],o={};return r.forEach(s=>{zt(e,s.queryKey)&&Object.assign(o,s.defaultOptions)}),o}setMutationDefaults(e,r){p(this,Sr).set(We(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...p(this,Sr).values()],o={};return r.forEach(s=>{zt(e,s.mutationKey)&&Object.assign(o,s.defaultOptions)}),o}defaultQueryOptions(e){if(e._defaulted)return e;let r={...p(this,Ft).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=Wr(r.queryKey,r)),r.refetchOnReconnect===void 0&&(r.refetchOnReconnect=r.networkMode!=="always"),r.throwOnError===void 0&&(r.throwOnError=!!r.suspense),!r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r.queryFn===br&&(r.enabled=!1),r}defaultMutationOptions(e){return e?._defaulted?e:{...p(this,Ft).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){p(this,le).clear(),p(this,Mt).clear()}},le=new WeakMap,Mt=new WeakMap,Ft=new WeakMap,Pr=new WeakMap,Sr=new WeakMap,qt=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,pa);var sr,ne,Ls,da,io=0,xa=[],ue=ee,fa=ue.__b,ma=ue.__r,ha=ue.diffed,ya=ue.__c,ga=ue.unmount,ba=ue.__;function lo(e,r){ue.__h&&ue.__h(ne,e,io||r),io=0;var o=ne.__H||(ne.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function v(e){return io=1,Ol(Ta,e)}function Ol(e,r,o){var s=lo(sr++,2);if(s.t=e,!s.__c&&(s.__=[o?o(r):Ta(void 0,r),function(l){var c=s.__N?s.__N[0]:s.__[0],d=s.t(c,l);c!==d&&(s.__N=[d,s.__[1]],s.__c.setState({}))}],s.__c=ne,!ne.__f)){var n=function(l,c,d){if(!s.__c.__H)return!0;var m=s.__c.__H.__.filter(function(y){return y.__c});if(m.every(function(y){return!y.__N}))return!a||a.call(this,l,c,d);var f=s.__c.props!==l;return m.some(function(y){if(y.__N){var h=y.__[0];y.__=y.__N,y.__N=void 0,h!==y.__[0]&&(f=!0)}}),a&&a.call(this,l,c,d)||f};ne.__f=!0;var a=ne.shouldComponentUpdate,i=ne.componentWillUpdate;ne.componentWillUpdate=function(l,c,d){if(this.__e){var m=a;a=void 0,n(l,c,d),a=m}i&&i.call(this,l,c,d)},ne.shouldComponentUpdate=n}return s.__N||s.__}function G(e,r){var o=lo(sr++,3);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__H.__h.push(o))}function _a(e,r){var o=lo(sr++,4);!ue.__s&&Us(o.__H,r)&&(o.__=e,o.u=r,ne.__h.push(o))}function he(e){return io=5,nr(function(){return{current:e}},[])}function nr(e,r){var o=lo(sr++,7);return Us(o.__H,r)&&(o.__=e(),o.__H=r,o.__h=e),o.__}function ar(e,r){return io=8,nr(function(){return e},r)}function Fr(e){var r=ne.context[e.__c],o=lo(sr++,9);return o.c=e,r?(o.__==null&&(o.__=!0,r.sub(ne)),r.props.value):e.__}function Dl(){for(var e;e=xa.shift();){var r=e.__H;if(e.__P&&r)try{r.__h.some($o),r.__h.some(Ks),r.__h=[]}catch(o){r.__h=[],ue.__e(o,e.__v)}}}ue.__b=function(e){ne=null,fa&&fa(e)},ue.__=function(e,r){e&&r.__k&&r.__k.__m&&(e.__m=r.__k.__m),ba&&ba(e,r)},ue.__r=function(e){ma&&ma(e),sr=0;var r=(ne=e.__c).__H;r&&(Ls===ne?(r.__h=[],ne.__h=[],r.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(r.__h.some($o),r.__h.some(Ks),r.__h=[],sr=0)),Ls=ne},ue.diffed=function(e){ha&&ha(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(xa.push(r)!==1&&da===ue.requestAnimationFrame||((da=ue.requestAnimationFrame)||Ql)(Dl)),r.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),Ls=ne=null},ue.__c=function(e,r){r.some(function(o){try{o.__h.some($o),o.__h=o.__h.filter(function(s){return!s.__||Ks(s)})}catch(s){r.some(function(n){n.__h&&(n.__h=[])}),r=[],ue.__e(s,o.__v)}}),ya&&ya(e,r)},ue.unmount=function(e){ga&&ga(e);var r,o=e.__c;o&&o.__H&&(o.__H.__.some(function(s){try{$o(s)}catch(n){r=n}}),o.__H=void 0,r&&ue.__e(r,o.__v))};var va=typeof requestAnimationFrame=="function";function Ql(e){var r,o=function(){clearTimeout(s),va&&cancelAnimationFrame(r),setTimeout(e)},s=setTimeout(o,35);va&&(r=requestAnimationFrame(o))}function $o(e){var r=ne,o=e.__c;typeof o=="function"&&(e.__c=void 0,o()),ne=r}function Ks(e){var r=ne;e.__c=e.__(),ne=r}function Us(e,r){return!e||e.length!==r.length||r.some(function(o,s){return o!==e[s]})}function Ta(e,r){return typeof r=="function"?r(e):r}var wa=mr(!1),Ca=()=>Fr(wa),xf=wa.Provider;var Ll=0;function t(e,r,o,s,n,a){r||(r={});var i,l,c=r;if("ref"in c)for(l in c={},r)l=="ref"?i=r[l]:c[l]=r[l];var d={type:e,props:c,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ll,__i:-1,__u:0,__source:n,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(l in i)c[l]===void 0&&(c[l]=i[l]);return ee.vnode&&ee.vnode(d),d}var Ns=mr(void 0),uo=e=>{let r=Fr(Ns);if(e)return e;if(!r)throw new Error("No QueryClient set, use QueryClientProvider to set one");return r},qr=({client:e,children:r})=>(G(()=>(e.mount(),()=>{e.unmount()}),[e]),t(Ns.Provider,{value:e,children:r}));function Kl(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ul=mr(Kl()),Ea=()=>Fr(Ul);var Ra=(e,r)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(r.isReset()||(e.retryOnMount=!1))},ka=e=>{G(()=>{e.clearReset()},[e])},Pa=({result:e,errorResetBoundary:r,throwOnError:o,query:s,suspense:n})=>e.isError&&!r.isReset()&&!e.isFetching&&s&&(n&&e.data===void 0||Xr(o,[e.error,s]));var Sa=e=>{if(e.suspense){let o=n=>n==="static"?n:Math.max(n??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...n)=>o(s(...n)):o(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Aa=(e,r)=>e.isLoading&&e.isFetching&&!r,Ma=(e,r)=>e?.suspense&&r.isPending,js=(e,r,o)=>r.fetchOptimistic(e).catch(()=>{o.clearReset()});function Vo(e,r){let o=r(),[{_instance:s},n]=v({_instance:{_value:o,_getSnapshot:r}});return _a(()=>{s._value=o,s._getSnapshot=r,Is(s)&&n({_instance:s})},[e,o,r]),G(()=>(Is(s)&&n({_instance:s}),e(()=>{Is(s)&&n({_instance:s})})),[e]),o}function Is(e){let r=e._getSnapshot,o=e._value;try{let s=r();return!Object.is(o,s)}catch{return!0}}function Ho(e,r,o){let s=Ca(),n=Ea(),a=uo(o),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i),i._optimisticResults=s?"isRestoring":"optimistic",Sa(i),Ra(i,n),ka(n);let l=!a.getQueryCache().get(i.queryHash),[c]=v(()=>new r(a,i)),d=c.getOptimisticResult(i),m=!s&&e.subscribed!==!1;if(Vo(ar(f=>{let y=m?c.subscribe(te.batchCalls(f)):ie;return c.updateResult(),y},[c,m]),()=>c.getCurrentResult()),G(()=>{c.setOptions(i)},[i,c]),Ma(i,d))throw js(i,c,n);if(Pa({result:d,errorResetBoundary:n,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,d),i.experimental_prefetchInRender&&!Ze.isServer()&&Aa(d,s)&&(l?js(i,c,n):a.getQueryCache().get(i.queryHash)?.promise)?.catch(ie).finally(()=>{c.updateResult()}),i.notifyOnChangeProps?d:c.trackResult(d)}function Ot(e,r){return Ho(e,so,r)}function ye(e,r){let o=uo(r),[s]=v(()=>new Ds(o,e));G(()=>{s.setOptions(e)},[s,e]);let n=Vo(ar(i=>s.subscribe(te.batchCalls(i)),[s]),()=>s.getCurrentResult()),a=ar((i,l)=>{s.mutate(i,l).catch(ie)},[s]);if(n.error&&Xr(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}function Or(e,r){return Ho(e,Fs,r)}var $s="profiler-active-slave",Go=(()=>{try{let e=sessionStorage.getItem($s);return e?`/slaves/${e}`:""}catch{return""}})();function Fa(){return Go}function qa(){return Go?Go.replace("/slaves/",""):null}function Oa(e){try{e?sessionStorage.setItem($s,e):sessionStorage.removeItem($s)}catch{}Go=e?`/slaves/${e}`:"",window.location.reload()}var Nl=["/_profiler/api/cluster/","/_profiler/api/toolbar/","/_profiler/api/events/"];function jl(e){return Nl.some(r=>e.startsWith(r))}async function se(e){let r=jl(e.url)?"":Fa(),o=r?e.url.replace("/_profiler/api",`/_profiler/api${r}`):e.url,{method:s,params:n,data:a,headers:i={},signal:l}=e,c=o,d=n?"?"+new URLSearchParams(Object.entries(n).map(([h,g])=>[h,String(g)])).toString():"",m={"X-Profiler-Request":"1",...i},f=await fetch(c+d,{method:s,signal:l,headers:a!==void 0?{"Content-Type":"application/json",...m}:m,body:a!==void 0?JSON.stringify(a):void 0});if(f.status===204)return{};let y=await f.json();if(!f.ok)throw Object.assign(new Error(y?.error??`HTTP ${f.status}`),{status:f.status,data:y});return y}var tt=(e,r)=>{let o={queryKey:r};for(let s of Object.keys(e))s!=="queryKey"&&Object.defineProperty(o,s,{enumerable:!0,configurable:!0,get:()=>e[s]});return o};var Il=e=>se({url:"/_profiler/api/cluster/slaves",method:"GET",signal:e});var $l=()=>["/_profiler/api/cluster/slaves"];var Vl=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??$l(),queryFn:({signal:n})=>Il(n),...r}};function Da(e){let r=Vl(e),o=Ot(r);return tt(o,r.queryKey)}var Vs=(e,r)=>se({url:"/_profiler/api/console",method:"GET",params:e,signal:r}),Hl=e=>["infinite","/_profiler/api/console",...e?[e]:[]];var Gl=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Hl(e),queryFn:({signal:a})=>Vs(e,a),...o}};function Qa(e,r){let o=Gl(e,r),s=Or(o);return tt(s,o.queryKey)}var Bl=(e,r)=>se({url:`/_profiler/api/console/${e}`,method:"DELETE",signal:r}),Jl=()=>["deleteConsole"],zl=e=>{let r=Jl(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Bl(a)},...o}},La=e=>ye(zl(e)),Wl=e=>se({url:"/_profiler/api/console/clear",method:"DELETE",signal:e}),Zl=()=>["clearConsoles"],Xl=e=>{let r=Zl(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Wl(),...o}},Ka=e=>ye(Xl(e)),Hs=e=>se({url:"/_profiler/api/env_vars",method:"GET",signal:e}),Yl=()=>["/_profiler/api/env_vars"],eu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Yl(),queryFn:({signal:n})=>Hs(n),...r}};function Ua(e){let r=eu(e),o=Ot(r);return tt(o,r.queryKey)}var tu=(e,r)=>se({url:"/_profiler/api/env_vars",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),ru=()=>["updateEnvVar"],ou=e=>{let r=ru(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return tu(a)},...o}},Na=e=>ye(ou(e)),su=(e,r)=>se({url:"/_profiler/api/env_vars/reset",method:"DELETE",params:e,signal:r}),nu=()=>["resetEnvVar"],au=e=>{let r=nu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{params:a}=n??{};return su(a)},...o}},ja=e=>ye(au(e)),iu=e=>se({url:"/_profiler/api/env_vars/reset_all",method:"DELETE",signal:e}),lu=()=>["resetAllEnvVars"],uu=e=>{let r=lu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>iu(),...o}},Ia=e=>ye(uu(e));var cu=(e,r)=>se({url:"/_profiler/api/explain",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),pu=()=>["explainQuery"],du=e=>{let r=pu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return cu(a)},...o}},$a=e=>ye(du(e)),fu=e=>se({url:"/_profiler/api/config",method:"GET",signal:e}),Gs=()=>["/_profiler/api/config"],mu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??Gs(),queryFn:({signal:n})=>fu(n),...r}};function Va(e){let r=mu(e),o=Ot(r);return tt(o,r.queryKey)}var hu=(e,r)=>se({url:"/_profiler/api/function_profiling",method:"PATCH",headers:{"Content-Type":"application/json"},data:e,signal:r}),yu=()=>["updateFunctionProfiling"],gu=e=>{let r=yu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return hu(a)},...o}},Ha=e=>ye(gu(e)),Bs=(e,r)=>se({url:"/_profiler/api/jobs",method:"GET",params:e,signal:r}),bu=e=>["infinite","/_profiler/api/jobs",...e?[e]:[]];var vu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??bu(e),queryFn:({signal:a})=>Bs(e,a),...o}};function Ga(e,r){let o=vu(e,r),s=Or(o);return tt(s,o.queryKey)}var xu=(e,r)=>se({url:`/_profiler/api/jobs/${e}`,method:"DELETE",signal:r}),_u=()=>["deleteJob"],Tu=e=>{let r=_u(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return xu(a)},...o}},Ba=e=>ye(Tu(e)),wu=e=>se({url:"/_profiler/api/jobs/clear",method:"DELETE",signal:e}),Cu=()=>["clearJobs"],Eu=e=>{let r=Cu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>wu(),...o}},Ja=e=>ye(Eu(e)),Ru=e=>se({url:"/_profiler/api/outbound_http",method:"GET",signal:e}),ku=()=>["/_profiler/api/outbound_http"],Pu=e=>{let{query:r}=e??{};return{queryKey:r?.queryKey??ku(),queryFn:({signal:n})=>Ru(n),...r}};function za(e){let r=Pu(e),o=Ot(r);return tt(o,r.queryKey)}var Bo=(e,r)=>se({url:"/_profiler/api/profiles",method:"GET",params:e,signal:r}),Su=e=>["infinite","/_profiler/api/profiles",...e?[e]:[]],Au=e=>["/_profiler/api/profiles",...e?[e]:[]],Mu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Su(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Wa(e,r){let o=Mu(e,r),s=Or(o);return tt(s,o.queryKey)}var Fu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Au(e),queryFn:({signal:a})=>Bo(e,a),...o}};function Za(e,r){let o=Fu(e,r),s=Ot(o);return tt(s,o.queryKey)}var qu=(e,r)=>se({url:`/_profiler/api/profiles/${e}`,method:"DELETE",signal:r}),Ou=()=>["deleteProfile"],Du=e=>{let r=Ou(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return qu(a)},...o}},Xa=e=>ye(Du(e)),Qu=(e,r,o)=>se({url:`/_profiler/api/profiles/${e}/replay`,method:"POST",headers:{"Content-Type":"application/json"},data:r,signal:o}),Lu=()=>["replayProfile"],Ku=e=>{let r=Lu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a,data:i}=n??{};return Qu(a,i)},...o}},Ya=e=>ye(Ku(e)),Uu=e=>se({url:"/_profiler/api/profiles/clear",method:"DELETE",signal:e}),Nu=()=>["clearProfiles"],ju=e=>{let r=Nu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>Uu(),...o}},ei=e=>ye(ju(e)),Iu=(e,r)=>se({url:"/_profiler/api/test_runner/files",method:"GET",params:e,signal:r}),$u=e=>["/_profiler/api/test_runner/files",...e?[e]:[]],Vu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??$u(e),queryFn:({signal:a})=>Iu(e,a),...o}};function ti(e,r){let o=Vu(e,r),s=Ot(o);return tt(s,o.queryKey)}var Hu=(e,r)=>se({url:"/_profiler/api/test_runner/runs",method:"POST",headers:{"Content-Type":"application/json"},data:e,signal:r}),Gu=()=>["createTestRun"],Bu=e=>{let r=Gu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{data:a}=n??{};return Hu(a)},...o}},ri=e=>ye(Bu(e));var Ju=(e,r)=>se({url:`/_profiler/api/test_runner/runs/${e}`,method:"DELETE",signal:r}),zu=()=>["deleteTestRun"],Wu=e=>{let r=zu(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Ju(a)},...o}},oi=e=>ye(Wu(e)),Js=(e,r)=>se({url:"/_profiler/api/tests",method:"GET",params:e,signal:r}),Zu=e=>["infinite","/_profiler/api/tests",...e?[e]:[]];var Xu=(e,r)=>{let{query:o}=r??{};return{queryKey:o?.queryKey??Zu(e),queryFn:({signal:a})=>Js(e,a),...o}};function si(e,r){let o=Xu(e,r),s=Or(o);return tt(s,o.queryKey)}var Yu=(e,r)=>se({url:`/_profiler/api/tests/${e}`,method:"DELETE",signal:r}),ec=()=>["deleteTest"],tc=e=>{let r=ec(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:n=>{let{id:a}=n??{};return Yu(a)},...o}},ni=e=>ye(tc(e)),rc=e=>se({url:"/_profiler/api/tests/clear",method:"DELETE",signal:e}),oc=()=>["clearTests"],sc=e=>{let r=oc(),{mutation:o}=e?e.mutation&&"mutationKey"in e.mutation&&e.mutation.mutationKey?e:{...e,mutation:{...e.mutation,mutationKey:r}}:{mutation:{mutationKey:r}};return{mutationFn:()=>rc(),...o}},ai=e=>ye(sc(e));async function Dt(e){if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}return nc(e)}function nc(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;let r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";let o=document.activeElement;document.body.appendChild(r);try{return r.select(),r.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(r),o?.focus?.()}}function Be(){return document.querySelector('meta[name="profiler-version"]')?.content??""}function Te(e){return e.allocated_objects!=null?e.allocated_objects:e.memory!=null?Math.round(e.memory/40):null}function rt(e){return e==null?"-":`${e.toLocaleString("en")} objects`}var ot="Objects allocated by the whole process while this ran: on a multi-threaded server, it includes what other threads allocated meanwhile.";function ii(){let{data:e,isError:r}=Va({query:{queryKey:Gs(),staleTime:1/0,retry:!1}});return e?{scheme:e.editor_url_scheme,pathMap:e.editor_path_map}:r?{scheme:"vscode",pathMap:{}}:{scheme:null,pathMap:{}}}var ac=["vscode","idea","cursor"];function ic(e){return typeof e=="string"&&ac.includes(e)}var lc=/^[A-Za-z]:\//;function co(e){return e.replace(/\\/g,"/")}function uc(e,r){if(!r)return e;let o=null;for(let a of Object.keys(r)){let i=co(a).replace(/\/+$/,"");(e===i||e.startsWith(i+"/"))&&(o===null||i.length>co(o).replace(/\/+$/,"").length)&&(o=a)}if(o===null)return e;let s=co(o).replace(/\/+$/,"");return co(String(r[o])).replace(/\/+$/,"")+e.slice(s.length)}function cc(e){return e.startsWith("/")||lc.test(e)}function pc(e){return(e.startsWith("/")?e:"/"+e).split("/").map((o,s)=>s===1&&/^[A-Za-z]:$/.test(o)?o:encodeURIComponent(o)).join("/")}function li(e,r,o){let{scheme:s,pathMap:n}=o;if(!ic(s)||!Number.isInteger(r)||r<1||typeof e!="string"||e===""||e.includes("\0"))return null;let a=uc(co(e),n);return cc(a)?s==="idea"?`idea://open?file=${encodeURIComponent(a)}&line=${r}`:`${s}://file${pc(a)}:${r}`:null}function ui(e){let r=/^(.+?):(\d+)(?::in\b.*)?$/.exec(e);return r?{file:r[1],line:Number(r[2])}:null}function ir({file:e,line:r,children:o,class:s}){let n=ii(),a=o??`${e}:${r}`,i=li(e,r,n);return i?t("a",{href:i,class:s,title:`Open ${e}:${r} in your editor`,rel:"noopener noreferrer","data-source-link":"",onClick:l=>l.stopPropagation(),children:a}):t("span",{class:s,children:a})}function vt({frame:e,class:r}){let o=ui(e);return o?t(ir,{file:o.file,line:o.line,class:r,children:e}):t("span",{class:r,children:e})}function lr(e){return{GET:"info",POST:"success",PUT:"warning",PATCH:"warning",DELETE:"error"}[e]||"default"}function Dr(e){return e===0?"error":e>=200&&e<300?"success":e>=400?"error":"warning"}function Qr(e){return e<0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function zs({text:e}){let[r,o]=v(null);function s(){Dt(e).then(n=>{o(n?"copied":"failed"),setTimeout(()=>o(null),2e3)})}return t("button",{onClick:s,class:"profiler-body-download-btn profiler-text--xs",style:"cursor:pointer",children:r==="copied"?"Copied!":r==="failed"?"Copy not available":"Copy"})}function mi(e){let r=e.split(";")[0].trim().toLowerCase();return{"application/json":".json","application/ld+json":".jsonld","application/xml":".xml","text/xml":".xml","text/csv":".csv","application/csv":".csv","text/html":".html","text/plain":".txt","text/css":".css","application/javascript":".js","text/javascript":".js","image/svg+xml":".svg","image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/avif":".avif","application/pdf":".pdf","application/zip":".zip","application/gzip":".gz","application/octet-stream":".bin"}[r]||".bin"}function ci({text:e,mime:r}){let[o,s]=v(null);return G(()=>{let n=URL.createObjectURL(new Blob([e],{type:"application/octet-stream"}));return s(n),()=>URL.revokeObjectURL(n)},[e,r]),o?t("a",{href:o,download:`body${mi(r)}`,class:"profiler-body-download-btn profiler-text--xs",children:"Download"}):null}function pi({headers:e}){let r=Object.entries(e);return r.length?t("table",{class:"profiler-table profiler-table--compact",children:t("tbody",{children:r.map(([o,s])=>t("tr",{children:[t("td",{class:"profiler-text--xs profiler-text--muted",style:"white-space:nowrap;padding-right:16px",children:o}),t("td",{class:"profiler-text--xs",style:"word-break:break-all",children:s})]},o))})}):t("span",{class:"profiler-text--muted profiler-text--xs",children:"none"})}function dc(e){let o=(Object.entries(e).find(([s])=>s.toLowerCase()==="content-type")?.[1]||"").split(";")[0].trim().toLowerCase();return o.includes("json")?"json":o==="image/svg+xml"?"svg":o.startsWith("image/")?"image":o==="application/pdf"?"pdf":o.includes("xml")?"xml":o==="text/csv"||o==="application/csv"?"csv":o==="text/html"?"html":o.startsWith("application/")&&!o.includes("json")&&!o.includes("xml")&&!o.includes("javascript")?"binary":"text"}function fc(e){try{let r=0;return e.replace(/>\s*</g,"><").replace(/(<\/?[^>]+>)/g,o=>{if(o.startsWith("</"))return r=Math.max(0,r-1),`
2
2
  `+" ".repeat(r)+o;if(o.endsWith("/>")||/<\?/.test(o))return`
3
3
  `+" ".repeat(r)+o;let s=`
4
- `+" ".repeat(r)+o;return r++,s}).trim()}catch{return e}}function fc(e){return e.split(`
5
- `).filter(Boolean).map(r=>{let o=[],s="",n=!1;for(let a=0;a<r.length;a++){let i=r[a];i==='"'?n=!n:i===","&&!n?(o.push(s),s=""):s+=i}return o.push(s),o})}function mc(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?dc(e):e}function hc(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var yc=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function gc(e){let r=e.toLowerCase();return yc.includes(r)?r:"application/octet-stream"}var Ws=500,di=10;function fi({body:e,encoding:r,headers:o}){let[s,n]=v(!1),[a,i]=v(null),[l,c]=v(null),d=pc(o);if(G(()=>{if(r!=="base64"||!e)return;let g=Object.entries(o).find(([A])=>A.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",b=atob(e),x=new Uint8Array(b.length);for(let A=0;A<b.length;A++)x[A]=b.charCodeAt(A);let w=URL.createObjectURL(new Blob([x],{type:gc(g)})),C=URL.createObjectURL(new Blob([x],{type:"application/octet-stream"}));return i(w),c(C),()=>{URL.revokeObjectURL(w),URL.revokeObjectURL(C)}},[e,r,o]),!e)return t("span",{class:"profiler-text--muted profiler-text--xs",children:"empty"});if(r==="base64"){let g=Object.entries(o).find(([x])=>x.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",b=`body${mi(g)}`;return t("div",{class:"profiler-body-binary",children:[a&&d==="image"&&t("img",{src:a,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),d==="svg"&&t("img",{src:`data:image/svg+xml;base64,${e}`,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),a&&d==="pdf"&&t("iframe",{src:a,class:"profiler-body-preview-frame",title:"PDF preview"}),t("div",{style:"display:flex;gap:8px;margin-top:4px",children:[l&&t("a",{href:l,download:b,class:"profiler-body-download-btn profiler-text--xs",children:["Download ",g]}),t(zs,{text:e})]}),!a&&t("span",{class:"profiler-text--muted profiler-text--xs",children:"Loading preview\u2026"})]})}let m=Object.entries(o).find(([g])=>g.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||hc(d);if(d==="csv"){let g=fc(e),b=g[0]||[],x=g.slice(1),w=s?x:x.slice(0,di),C=x.length>di;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:e}),t(ci,{text:e,mime:m})]}),t("div",{style:"overflow-x:auto",children:t("table",{class:"profiler-body-csv",children:[t("thead",{children:t("tr",{children:b.map((A,k)=>t("th",{children:A},k))})}),t("tbody",{children:w.map((A,k)=>t("tr",{children:A.map((K,U)=>t("td",{children:K},U))},k))})]})}),C&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(A=>!A),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:s?"Show less":`Show all (${x.length} rows)`})]})}let f=mc(e,d),y=s?f:f.slice(0,Ws),h=f.length>Ws&&!s;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:f}),t(ci,{text:f,mime:m})]}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:[y,h?"\u2026":""]}),f.length>Ws&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(g=>!g),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:s?"Show less":`Show all (${f.length} chars)`})]})}function Jo({request:e,response:r,backtrace:o}){return t("div",{style:"padding:12px 4px 4px;border-top:1px solid rgba(0,0,0,0.08);margin-top:8px",children:[t("div",{style:"margin-bottom:16px",children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"REQUEST"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(pi,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Params"}),t("pre",{class:"profiler-code profiler-text--xs",style:"margin:0",children:JSON.stringify(e.params,null,2)})]}),e.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(fi,{body:e.body,encoding:e.body_encoding,headers:e.headers})]})]}),t("div",{children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"RESPONSE"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(pi,{headers:r.headers}),r.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(fi,{body:r.body,encoding:r.body_encoding,headers:r.headers})]})]}),o&&o.length>1&&t("div",{style:"margin-top:12px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Backtrace"}),o.map((s,n)=>t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding:2px 0",children:t(vt,{frame:s})},n))]})]})}function zo({method:e,url:r,copyUrl:o,status:s,duration:n,curlCommand:a,expandable:i,open:l,onToggle:c}){let[d,m]=v(!1),[f,y]=v(!1);function h(b){b.stopPropagation(),Dt(o??r).then(x=>{x&&(m(!0),setTimeout(()=>m(!1),2e3))})}function g(b){b.stopPropagation(),Dt(a).then(x=>{x&&(y(!0),setTimeout(()=>y(!1),2e3))})}return t("div",{class:"profiler-ajax-card__row",style:i?"cursor:pointer;user-select:none":void 0,onClick:i?c:void 0,children:[t("div",{class:"profiler-flex profiler-flex--gap-3",style:"min-width:0;flex:1",children:[i&&t("span",{style:"font-size:11px;color:var(--profiler-muted)",children:l?"\u25BE":"\u25B8"}),t("span",{class:`profiler-ajax-card__method badge-${lr(e)}`,children:e}),t("strong",{class:"profiler-ajax-card__path",style:"word-break:break-all",children:r}),t("button",{onClick:h,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy URL",children:d?"Copied!":"Copy URL"}),t("button",{onClick:g,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy as cURL",children:f?"Copied!":"Copy as cURL"})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:"flex-shrink:0",children:[t("span",{class:`badge-${Dr(s)}`,children:s===0?"ERR":s}),t("span",{class:n>=500?"badge-error":n>=100?"badge-warning":"badge-success",children:[n.toFixed(2)," ms"]})]})]})}function bc(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function vc({requests:e}){let r=e.filter(i=>i.started_at).map(i=>({...i,startMs:new Date(i.started_at).getTime()}));if(!r.length)return t("div",{class:"profiler-text--muted profiler-text--sm",children:"No timing data available (started_at missing)."});let o=Math.min(...r.map(i=>i.startMs)),n=Math.max(...r.map(i=>i.startMs+i.duration))-o||1,a=[0,.25,.5,.75,1].map(i=>({pct:i*100,label:`${Math.round(i*n)}ms`}));return t("div",{children:[t("div",{style:"display:flex;position:relative;margin-left:200px;margin-bottom:4px;height:16px",children:a.map(i=>t("div",{style:`position:absolute;left:${i.pct}%;font-size:10px;color:var(--profiler-text-muted);transform:translateX(-50%)`,children:i.label},i.pct))}),t("div",{style:"position:relative",children:[a.map(i=>t("div",{style:`position:absolute;left:calc(200px + ${i.pct}% * (100% - 200px) / 100);top:0;bottom:0;width:1px;background:var(--profiler-border);opacity:0.5;pointer-events:none`},i.pct)),r.map((i,l)=>{let c=(i.startMs-o)/n*100,d=Math.max(i.duration/n*100,.5),m=i.url.replace(/^https?:\/\/[^/]+/,"")||i.url,f=bc(i.status,i.duration);return t("div",{style:"display:flex;align-items:center;gap:0;margin-bottom:3px;height:22px",children:[t("div",{title:i.url,style:"width:200px;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--profiler-text-muted);padding-right:8px;text-align:right",children:[t("span",{style:`font-size:10px;font-weight:600;margin-right:4px;color:${f}`,children:i.method}),m]}),t("div",{style:"flex:1;position:relative;height:14px;background:var(--profiler-bg-lighter);border-radius:2px",children:t("div",{style:`position:absolute;left:${c}%;width:${d}%;min-width:2px;height:100%;background:${f};border-radius:2px;opacity:0.85`,title:`${i.duration.toFixed(2)}ms \xB7 ${i.status||"ERR"}`})}),t("div",{style:"width:52px;text-align:right;font-size:11px;color:var(--profiler-text-muted);padding-left:6px;flex-shrink:0",children:[i.duration.toFixed(0),"ms"]})]},l)})]}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:8px",children:["Total span: ",n.toFixed(0),"ms \xB7 ",r.length," request",r.length!==1?"s":""]})]})}function xc(e){let r=[`curl -X ${e.method}`],o=e.request_headers||{};for(let[s,n]of Object.entries(o))r.push(` -H ${JSON.stringify(`${s}: ${n}`)}`);return e.request_body&&e.request_body_encoding!=="base64"&&r.push(` -d ${JSON.stringify(e.request_body)}`),r.push(` ${JSON.stringify(e.url)}`),r.join(` \\
6
- `)}function _c(e){let r=[];return e.request_body_not_captured&&r.push("Request body not captured: a stream that cannot be rewound is sent unread."),e.request_body_truncated&&r.push("Request body truncated: only the beginning was kept (max_captured_body_bytes)."),e.response_body_truncated&&r.push("Response body truncated: only the beginning was kept (max_captured_body_bytes)."),r}function Zs({req:e,index:r,threshold:o}){let[s,n]=v(!1),a=e.status>=400||e.status===0,i=e.duration>=o;return t("div",{class:`profiler-ajax-card ${a?"profiler-ajax-card--error":i?"profiler-ajax-card--warning":"profiler-ajax-card--success"}`,style:"margin-bottom:8px",children:[t(zo,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:xc(e),expandable:!0,open:s,onToggle:()=>n(c=>!c)}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["\u2191 ",e.request_size==null?"size unknown":`${e.request_size_is_minimum?"at least ":""}${Qr(e.request_size)}`," \xB7 \u2193 ",Qr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:t(vt,{frame:e.backtrace[0]})})]}),_c(e).map(c=>t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--muted",children:c})})),e.error&&t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--error",children:e.error})}),s&&t(Jo,{request:{headers:e.request_headers||{},body:e.request_body??void 0,body_encoding:e.request_body_encoding},response:{headers:e.response_headers||{},body:e.response_body??void 0,body_encoding:e.response_body_encoding},backtrace:e.backtrace})]})}function Lr({httpData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No outbound HTTP requests"}),t("p",{class:"profiler-empty__description",children:"External API calls made during this request will appear here."})]});let r=500,o=e.total_duration/e.total_requests;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Outbound HTTP (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Avg: ",t("strong",{children:[o.toFixed(2)," ms"]})]}),t("span",{children:["Slow (>",r,"ms): ",t("strong",{class:e.slow_requests>0?"profiler-text--error":"",children:e.slow_requests})]}),t("span",{children:["Errors: ",t("strong",{class:e.error_requests>0?"profiler-text--error":"",children:e.error_requests})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Host"}),Object.entries(e.by_host).map(([s,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:s}),t("strong",{children:n})]},s))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([s,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${s.startsWith("2")?"success":s.startsWith("4")||s.startsWith("5")||s==="error"?"error":"warning"}`,children:s}),t("strong",{children:n})]},s))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),t(vc,{requests:e.requests}),t("div",{style:"margin-top:16px",children:[t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:"Click a request to expand headers and body."}),e.requests.map((s,n)=>t(Zs,{req:s,index:n,threshold:r},n))]})]})}var hi="[FILTERED]";function Tc(e){return e===""?{label:"empty",color:"var(--profiler-text-muted)"}:/^(true|false|yes|no)$/i.test(e)?{label:"bool",color:"#a78bfa"}:/^\d+$/.test(e)?{label:"int",color:"var(--profiler-success,#22c55e)"}:/^\d+\.\d+$/.test(e)?{label:"float",color:"var(--profiler-success,#22c55e)"}:{label:"string",color:"var(--profiler-text-muted)"}}function wc(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function Cc(e){let r={};for(let o of e.split(`
7
- `)){let s=o.trim();if(!s||s.startsWith("#"))continue;let n=s.indexOf("=");if(n<1)continue;let a=s.slice(0,n).trim(),i=s.slice(n+1);(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),r[a]=i}return r}function Ec(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Xs(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function yi({value:e}){let r=Tc(e);return r?t("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:"3px",fontSize:"10px",fontWeight:600,fontFamily:"monospace",border:`1px solid ${r.color}`,color:r.color,marginRight:"6px",verticalAlign:"middle",lineHeight:"16px",flexShrink:0},children:r.label}):null}function gi(e){return/^(true|false|yes|no)$/i.test(e)}function Ys(e){return!(e===""||gi(e)||/^\d+(\.\d+)?$/.test(e))}function st({envData:e,readOnly:r=!1}){let[o,s]=v(()=>({...e?.variables??{}})),[n,a]=v(o),[i,l]=v(e?.overrides??{}),[c,d]=v(e?.total??0),[m,f]=v(""),[y,h]=v(new Set),[g,b]=v(null),[x,w]=v(""),[C,A]=v(""),[k,K]=v(""),[U,L]=v(null),[j,T]=v(!1),[F,$]=v(!1),[Z,B]=v(Ec),[ce,fe]=v(null),[Y,Fe]=v(r),[Ne,je]=v(!1),[De,be]=v(""),we=he(null),{mutateAsync:qe}=Na(),{mutateAsync:nt}=ja(),{mutateAsync:P}=Ia();G(()=>{g!==null&&we.current?.focus()},[g]),G(()=>{r||Q()},[]);let H=(_,D)=>{L({type:_,message:D}),setTimeout(()=>L(null),3e3)},Ce=_=>{B(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),Xs(O),O})},at=async(_,D)=>{await Dt(_)?(fe(D),setTimeout(()=>fe(null),1500)):H("error","Copy is not available in this browser: select the value and copy it by hand")},ur=_=>{h(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),O})},Q=async()=>{$(!0);try{let _=await Hs();return a(_.variables),d(_.total),l(_.overrides??{}),H("success",`Refreshed - ${_.total} variables`),_}catch(_){H("error",_.message??"Failed to refresh")}finally{$(!1)}},W=()=>{let _=ut,D=_.map(([Re,Je])=>`${Re}=${Je}`).join(`
4
+ `+" ".repeat(r)+o;return r++,s}).trim()}catch{return e}}function mc(e){return e.split(`
5
+ `).filter(Boolean).map(r=>{let o=[],s="",n=!1;for(let a=0;a<r.length;a++){let i=r[a];i==='"'?n=!n:i===","&&!n?(o.push(s),s=""):s+=i}return o.push(s),o})}function hc(e,r){if(r==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return r==="xml"?fc(e):e}function yc(e){return{json:"application/json",xml:"application/xml",csv:"text/csv",html:"text/html",svg:"image/svg+xml"}[e]||"text/plain"}var gc=["image/png","image/jpeg","image/gif","image/webp","image/avif","application/pdf"];function bc(e){let r=e.toLowerCase();return gc.includes(r)?r:"application/octet-stream"}var Ws=500,di=10;function fi({body:e,encoding:r,headers:o}){let[s,n]=v(!1),[a,i]=v(null),[l,c]=v(null),d=dc(o);if(G(()=>{if(r!=="base64"||!e)return;let g=Object.entries(o).find(([A])=>A.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",b=atob(e),x=new Uint8Array(b.length);for(let A=0;A<b.length;A++)x[A]=b.charCodeAt(A);let w=URL.createObjectURL(new Blob([x],{type:bc(g)})),C=URL.createObjectURL(new Blob([x],{type:"application/octet-stream"}));return i(w),c(C),()=>{URL.revokeObjectURL(w),URL.revokeObjectURL(C)}},[e,r,o]),!e)return t("span",{class:"profiler-text--muted profiler-text--xs",children:"empty"});if(r==="base64"){let g=Object.entries(o).find(([x])=>x.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||"application/octet-stream",b=`body${mi(g)}`;return t("div",{class:"profiler-body-binary",children:[a&&d==="image"&&t("img",{src:a,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),d==="svg"&&t("img",{src:`data:image/svg+xml;base64,${e}`,alt:"response preview",style:"max-width:100%;max-height:300px;display:block;margin-bottom:8px;border-radius:4px;border:1px solid var(--profiler-border)"}),a&&d==="pdf"&&t("iframe",{src:a,class:"profiler-body-preview-frame",title:"PDF preview"}),t("div",{style:"display:flex;gap:8px;margin-top:4px",children:[l&&t("a",{href:l,download:b,class:"profiler-body-download-btn profiler-text--xs",children:["Download ",g]}),t(zs,{text:e})]}),!a&&t("span",{class:"profiler-text--muted profiler-text--xs",children:"Loading preview\u2026"})]})}let m=Object.entries(o).find(([g])=>g.toLowerCase()==="content-type")?.[1]?.split(";")[0].trim()||yc(d);if(d==="csv"){let g=mc(e),b=g[0]||[],x=g.slice(1),w=s?x:x.slice(0,di),C=x.length>di;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:e}),t(ci,{text:e,mime:m})]}),t("div",{style:"overflow-x:auto",children:t("table",{class:"profiler-body-csv",children:[t("thead",{children:t("tr",{children:b.map((A,k)=>t("th",{children:A},k))})}),t("tbody",{children:w.map((A,k)=>t("tr",{children:A.map((K,U)=>t("td",{children:K},U))},k))})]})}),C&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(A=>!A),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:s?"Show less":`Show all (${x.length} rows)`})]})}let f=hc(e,d),y=s?f:f.slice(0,Ws),h=f.length>Ws&&!s;return t("div",{children:[t("div",{style:"display:flex;gap:8px;margin-bottom:6px",children:[t(zs,{text:f}),t(ci,{text:f,mime:m})]}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:[y,h?"\u2026":""]}),f.length>Ws&&t("button",{class:"profiler-link profiler-text--xs",onClick:()=>n(g=>!g),style:"margin-top:4px;background:none;border:none;cursor:pointer;color:var(--profiler-accent);padding:0",children:s?"Show less":`Show all (${f.length} chars)`})]})}function Jo({request:e,response:r,backtrace:o}){return t("div",{style:"padding:12px 4px 4px;border-top:1px solid rgba(0,0,0,0.08);margin-top:8px",children:[t("div",{style:"margin-bottom:16px",children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"REQUEST"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(pi,{headers:e.headers}),e.params&&Object.keys(e.params).length>0&&!e.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Params"}),t("pre",{class:"profiler-code profiler-text--xs",style:"margin:0",children:JSON.stringify(e.params,null,2)})]}),e.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(fi,{body:e.body,encoding:e.body_encoding,headers:e.headers})]})]}),t("div",{children:[t("div",{class:"profiler-text--sm",style:"font-weight:600;margin-bottom:8px;color:var(--profiler-muted)",children:"RESPONSE"}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Headers"}),t(pi,{headers:r.headers}),r.body&&t(M,{children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:10px;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Body"}),t(fi,{body:r.body,encoding:r.body_encoding,headers:r.headers})]})]}),o&&o.length>1&&t("div",{style:"margin-top:12px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px",children:"Backtrace"}),o.map((s,n)=>t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding:2px 0",children:t(vt,{frame:s})},n))]})]})}function zo({method:e,url:r,copyUrl:o,status:s,duration:n,curlCommand:a,expandable:i,open:l,onToggle:c}){let[d,m]=v(!1),[f,y]=v(!1);function h(b){b.stopPropagation(),Dt(o??r).then(x=>{x&&(m(!0),setTimeout(()=>m(!1),2e3))})}function g(b){b.stopPropagation(),Dt(a).then(x=>{x&&(y(!0),setTimeout(()=>y(!1),2e3))})}return t("div",{class:"profiler-ajax-card__row",style:i?"cursor:pointer;user-select:none":void 0,onClick:i?c:void 0,children:[t("div",{class:"profiler-flex profiler-flex--gap-3",style:"min-width:0;flex:1",children:[i&&t("span",{style:"font-size:11px;color:var(--profiler-muted)",children:l?"\u25BE":"\u25B8"}),t("span",{class:`profiler-ajax-card__method badge-${lr(e)}`,children:e}),t("strong",{class:"profiler-ajax-card__path",style:"word-break:break-all",children:r}),t("button",{onClick:h,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy URL",children:d?"Copied!":"Copy URL"}),t("button",{onClick:g,class:"profiler-body-download-btn profiler-text--xs",style:"flex-shrink:0;cursor:pointer",title:"Copy as cURL",children:f?"Copied!":"Copy as cURL"})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:"flex-shrink:0",children:[t("span",{class:`badge-${Dr(s)}`,children:s===0?"ERR":s}),t("span",{class:n>=500?"badge-error":n>=100?"badge-warning":"badge-success",children:[n.toFixed(2)," ms"]})]})]})}function vc(e,r){return e===0||e>=500?"var(--profiler-error, #ef4444)":e>=400||r>=500?"var(--profiler-warning, #f59e0b)":"var(--profiler-success, #22c55e)"}function xc({requests:e}){let r=e.filter(i=>i.started_at).map(i=>({...i,startMs:new Date(i.started_at).getTime()}));if(!r.length)return t("div",{class:"profiler-text--muted profiler-text--sm",children:"No timing data available (started_at missing)."});let o=Math.min(...r.map(i=>i.startMs)),n=Math.max(...r.map(i=>i.startMs+i.duration))-o||1,a=[0,.25,.5,.75,1].map(i=>({pct:i*100,label:`${Math.round(i*n)}ms`}));return t("div",{children:[t("div",{style:"display:flex;position:relative;margin-left:200px;margin-bottom:4px;height:16px",children:a.map(i=>t("div",{style:`position:absolute;left:${i.pct}%;font-size:10px;color:var(--profiler-text-muted);transform:translateX(-50%)`,children:i.label},i.pct))}),t("div",{style:"position:relative",children:[a.map(i=>t("div",{style:`position:absolute;left:calc(200px + ${i.pct}% * (100% - 200px) / 100);top:0;bottom:0;width:1px;background:var(--profiler-border);opacity:0.5;pointer-events:none`},i.pct)),r.map((i,l)=>{let c=(i.startMs-o)/n*100,d=Math.max(i.duration/n*100,.5),m=i.url.replace(/^https?:\/\/[^/]+/,"")||i.url,f=vc(i.status,i.duration);return t("div",{style:"display:flex;align-items:center;gap:0;margin-bottom:3px;height:22px",children:[t("div",{title:i.url,style:"width:200px;flex-shrink:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--profiler-text-muted);padding-right:8px;text-align:right",children:[t("span",{style:`font-size:10px;font-weight:600;margin-right:4px;color:${f}`,children:i.method}),m]}),t("div",{style:"flex:1;position:relative;height:14px;background:var(--profiler-bg-lighter);border-radius:2px",children:t("div",{style:`position:absolute;left:${c}%;width:${d}%;min-width:2px;height:100%;background:${f};border-radius:2px;opacity:0.85`,title:`${i.duration.toFixed(2)}ms \xB7 ${i.status||"ERR"}`})}),t("div",{style:"width:52px;text-align:right;font-size:11px;color:var(--profiler-text-muted);padding-left:6px;flex-shrink:0",children:[i.duration.toFixed(0),"ms"]})]},l)})]}),t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-top:8px",children:["Total span: ",n.toFixed(0),"ms \xB7 ",r.length," request",r.length!==1?"s":""]})]})}function _c(e){let r=[`curl -X ${e.method}`],o=e.request_headers||{};for(let[s,n]of Object.entries(o))r.push(` -H ${JSON.stringify(`${s}: ${n}`)}`);return e.request_body&&e.request_body_encoding!=="base64"&&r.push(` -d ${JSON.stringify(e.request_body)}`),r.push(` ${JSON.stringify(e.url)}`),r.join(` \\
6
+ `)}function Tc(e){let r=[];return e.request_body_not_captured&&r.push("Request body not captured: a stream that cannot be rewound is sent unread."),e.request_body_truncated&&r.push("Request body truncated: only the beginning was kept (max_captured_body_bytes)."),e.response_body_truncated&&r.push("Response body truncated: only the beginning was kept (max_captured_body_bytes)."),r}function Zs({req:e,index:r,threshold:o}){let[s,n]=v(!1),a=e.status>=400||e.status===0,i=e.duration>=o;return t("div",{class:`profiler-ajax-card ${a?"profiler-ajax-card--error":i?"profiler-ajax-card--warning":"profiler-ajax-card--success"}`,style:"margin-bottom:8px",children:[t(zo,{method:e.method,url:e.url,status:e.status,duration:e.duration,curlCommand:_c(e),expandable:!0,open:s,onToggle:()=>n(c=>!c)}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["\u2191 ",e.request_size==null?"size unknown":`${e.request_size_is_minimum?"at least ":""}${Qr(e.request_size)}`," \xB7 \u2193 ",Qr(e.response_size)]}),e.backtrace&&e.backtrace.length>0&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-left:12px",children:t(vt,{frame:e.backtrace[0]})})]}),Tc(e).map(c=>t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--muted",children:c})})),e.error&&t("div",{class:"profiler-ajax-card__row",children:t("span",{class:"profiler-text--xs profiler-text--error",children:e.error})}),s&&t(Jo,{request:{headers:e.request_headers||{},body:e.request_body??void 0,body_encoding:e.request_body_encoding},response:{headers:e.response_headers||{},body:e.response_body??void 0,body_encoding:e.response_body_encoding},backtrace:e.backtrace})]})}function Lr({httpData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No outbound HTTP requests"}),t("p",{class:"profiler-empty__description",children:"External API calls made during this request will appear here."})]});let r=500,o=e.total_duration/e.total_requests;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Outbound HTTP (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Avg: ",t("strong",{children:[o.toFixed(2)," ms"]})]}),t("span",{children:["Slow (>",r,"ms): ",t("strong",{class:e.slow_requests>0?"profiler-text--error":"",children:e.slow_requests})]}),t("span",{children:["Errors: ",t("strong",{class:e.error_requests>0?"profiler-text--error":"",children:e.error_requests})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Host"}),Object.entries(e.by_host).map(([s,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:s}),t("strong",{children:n})]},s))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([s,n])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${s.startsWith("2")?"success":s.startsWith("4")||s.startsWith("5")||s==="error"?"error":"warning"}`,children:s}),t("strong",{children:n})]},s))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),t(xc,{requests:e.requests}),t("div",{style:"margin-top:16px",children:[t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:"Click a request to expand headers and body."}),e.requests.map((s,n)=>t(Zs,{req:s,index:n,threshold:r},n))]})]})}var hi="[FILTERED]";function wc(e){return e===""?{label:"empty",color:"var(--profiler-text-muted)"}:/^(true|false|yes|no)$/i.test(e)?{label:"bool",color:"#a78bfa"}:/^\d+$/.test(e)?{label:"int",color:"var(--profiler-success,#22c55e)"}:/^\d+\.\d+$/.test(e)?{label:"float",color:"var(--profiler-success,#22c55e)"}:{label:"string",color:"var(--profiler-text-muted)"}}function Cc(e){let r=e.indexOf("_");return r>0?e.slice(0,r):"OTHER"}function Ec(e){let r={};for(let o of e.split(`
7
+ `)){let s=o.trim();if(!s||s.startsWith("#"))continue;let n=s.indexOf("=");if(n<1)continue;let a=s.slice(0,n).trim(),i=s.slice(n+1);(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),r[a]=i}return r}function Rc(){try{let e=localStorage.getItem("profiler_unmasked_env_keys");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Xs(e){try{localStorage.setItem("profiler_unmasked_env_keys",JSON.stringify([...e]))}catch{}}function yi({value:e}){let r=wc(e);return r?t("span",{style:{display:"inline-block",padding:"0 5px",borderRadius:"3px",fontSize:"10px",fontWeight:600,fontFamily:"monospace",border:`1px solid ${r.color}`,color:r.color,marginRight:"6px",verticalAlign:"middle",lineHeight:"16px",flexShrink:0},children:r.label}):null}function gi(e){return/^(true|false|yes|no)$/i.test(e)}function Ys(e){return!(e===""||gi(e)||/^\d+(\.\d+)?$/.test(e))}function st({envData:e,readOnly:r=!1}){let[o,s]=v(()=>({...e?.variables??{}})),[n,a]=v(o),[i,l]=v(e?.overrides??{}),[c,d]=v(e?.total??0),[m,f]=v(""),[y,h]=v(new Set),[g,b]=v(null),[x,w]=v(""),[C,A]=v(""),[k,K]=v(""),[U,L]=v(null),[j,T]=v(!1),[F,$]=v(!1),[Z,B]=v(Rc),[ce,fe]=v(null),[Y,Fe]=v(r),[Ne,je]=v(!1),[De,be]=v(""),we=he(null),{mutateAsync:qe}=Na(),{mutateAsync:nt}=ja(),{mutateAsync:P}=Ia();G(()=>{g!==null&&we.current?.focus()},[g]),G(()=>{r||Q()},[]);let H=(_,D)=>{L({type:_,message:D}),setTimeout(()=>L(null),3e3)},Ce=_=>{B(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),Xs(O),O})},at=async(_,D)=>{await Dt(_)?(fe(D),setTimeout(()=>fe(null),1500)):H("error","Copy is not available in this browser: select the value and copy it by hand")},ur=_=>{h(D=>{let O=new Set(D);return O.has(_)?O.delete(_):O.add(_),O})},Q=async()=>{$(!0);try{let _=await Hs();return a(_.variables),d(_.total),l(_.overrides??{}),H("success",`Refreshed - ${_.total} variables`),_}catch(_){H("error",_.message??"Failed to refresh")}finally{$(!1)}},W=()=>{let _=ut,D=_.map(([Re,Je])=>`${Re}=${Je}`).join(`
8
8
  `)+`
9
- `,O=new Blob([D],{type:"text/plain"}),q=URL.createObjectURL(O),J=document.createElement("a");J.href=q,J.download=".env",J.click(),URL.revokeObjectURL(q),H("success",`Exported ${_.length} variables`)},Ie=nr(()=>Cc(De),[De]),Ee=nr(()=>Object.fromEntries(Object.entries(Ie).filter(([,_])=>_!==hi)),[Ie]),Qe=Object.keys(Ee).length,Le=Object.keys(Ie).length-Qe,Vt=async()=>{let _=Object.entries(Ee);if(_.length){T(!0);try{await Promise.all(_.map(([O,q])=>qe({data:{key:O,value:q}}))),a(O=>({...O,...Ee})),be(""),je(!1);let D=Le>0?`, skipped ${Le} masked`:"";H("success",`Imported ${_.length} variables${D}`)}catch(D){H("error",D.message??"Import failed")}finally{T(!1)}}},pe=_=>{b(_),w(n[_]??"")},it=()=>{b(null),w("")},lt=async()=>{if(!g)return;let _=g;if(x===n[_]){b(null);return}T(!0);try{let D=await qe({data:{key:_,value:x}});a(O=>({...O,[_]:x})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),H("success",`${_} updated`),b(null)}catch(D){H("error",D.message??"Failed to update")}finally{T(!1)}},yo=async _=>{T(!0);try{let D=await qe({data:{key:_,value:null}});a(O=>{let q={...O};return delete q[_],q}),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),B(O=>{let q=new Set(O);return q.delete(_),Xs(q),q}),H("success",`${_} deleted`)}catch(D){H("error",D.message??"Failed to delete")}finally{T(!1)}},Ht=async(_,D)=>{let O=/^(true|yes)$/i.test(D)?"false":"true";T(!0);try{let q=await qe({data:{key:_,value:O}});a(J=>({...J,[_]:O})),l(J=>{let Re={...J};return q.override?Re[_]=q.override:delete Re[_],Re})}catch(q){H("error",q.message??"Failed to update")}finally{T(!1)}},cr=async()=>{let _=C.trim();if(_){T(!0);try{let D=await qe({data:{key:_,value:k}});a(O=>({...O,[_]:k})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),A(""),K(""),H("success",`${_} added`)}catch(D){H("error",D.message??"Failed to add")}finally{T(!1)}}},$e=_=>{_.key==="Enter"&&lt(),_.key==="Escape"&&it()},go=async _=>{T(!0);try{let D=await nt({params:{key:_}});l(q=>{let J={...q};return delete J[_],J});let O=q=>{let J={...q};return D.value===null||D.value===void 0?delete J[_]:J[_]=D.value,J};a(O),s(O),H("success",`${_} reset to original`)}catch(D){H("error",D.message??"Failed to reset")}finally{T(!1)}},oe=async()=>{T(!0);try{await P(),l({});let _=await Q();_&&s(_.variables),H("success","All overrides reset")}catch(_){H("error",_.message??"Failed to reset all")}finally{T(!1)}},jr=Object.keys(i).length,ge=Object.entries(n),ut=nr(()=>{let _=m.toLowerCase().trim();return _?ge.filter(([D,O])=>D.toLowerCase().includes(_)||O.toLowerCase().includes(_)):ge},[n,m]),ve=nr(()=>{let _={};for(let D of ut){let O=wc(D[0]);(_[O]??(_[O]=[])).push(D)}return Object.entries(_).sort(([D],[O])=>D==="OTHER"?1:O==="OTHER"?-1:D.localeCompare(O))},[ut]),Ir=ut.every(([_])=>Z.has(_)),pr=()=>{let _=ut.map(([D])=>D);B(D=>{let O=new Set(D);return Ir?_.forEach(q=>O.delete(q)):_.forEach(q=>O.add(q)),Xs(O),O})},$r="width:100%;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);",ct="background:none;border:none;cursor:pointer;font-size:12px;padding:0 3px;color:var(--profiler-text-muted);opacity:0.7;flex-shrink:0;",pt="background:none;border:1px solid var(--profiler-border);border-radius:4px;cursor:pointer;color:var(--profiler-text-muted);font-size:11px;padding:3px 8px;";return t(M,{children:[t("div",{class:"profiler-flex profiler-mb-4",style:"align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;",children:[t("h2",{class:"profiler-section__header",style:"margin:0;",children:"Environment Variables"}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[!r&&t(M,{children:[t("button",{onClick:Q,disabled:F,style:pt,children:F?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>je(_=>!_),style:`${pt}${Ne?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:W,style:pt,children:"\u2B07 Export"}),t("button",{onClick:pr,style:pt,children:Ir?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&jr>0&&t("button",{onClick:oe,disabled:j,title:"Remove all Sidekiq overrides and restore original values",style:`${pt}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",jr,")"]}),!r&&t("button",{onClick:()=>Fe(_=>!_),title:Y?"Unlock editing":"Lock editing",style:`${pt}${Y?"border-color:var(--profiler-error,#ef4444);color:var(--profiler-error,#ef4444);":""}`,children:Y?"\u{1F512} Locked":"\u{1F513} Edit"})]})]}),r?t("div",{style:"background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));border:1px solid var(--profiler-border);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-text-muted);",children:["Snapshot taken at request time - modify env vars in ",t("a",{href:"/_profiler?section=env",style:"color:var(--profiler-accent);",children:"/_profiler?section=env"}),"."]}):t("div",{style:"background:var(--profiler-warning-bg,rgba(245,158,11,0.1));border:1px solid var(--profiler-warning,#f59e0b);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-warning,#f59e0b);",children:"\u26A0 Changes affect the current process only - for development use."}),U&&t("div",{style:`background:${U.type==="success"?"var(--profiler-success-bg,rgba(34,197,94,0.1))":"var(--profiler-error-bg,rgba(239,68,68,0.08))"};border:1px solid ${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[U.type==="success"?"\u2713":"\u2717"," ",U.message]}),Ne&&t("div",{style:"border:1px solid var(--profiler-border);border-radius:6px;padding:12px;margin-bottom:16px;",children:[t("p",{class:"profiler-text--xs profiler-text--muted",style:"margin:0 0 8px;",children:["Paste the contents of a ",t("code",{children:".env"})," file. Comments and blank lines are ignored."]}),t("textarea",{value:De,onInput:_=>be(_.target.value),placeholder:`APP_NAME=MyApp
9
+ `,O=new Blob([D],{type:"text/plain"}),q=URL.createObjectURL(O),J=document.createElement("a");J.href=q,J.download=".env",J.click(),URL.revokeObjectURL(q),H("success",`Exported ${_.length} variables`)},Ie=nr(()=>Ec(De),[De]),Ee=nr(()=>Object.fromEntries(Object.entries(Ie).filter(([,_])=>_!==hi)),[Ie]),Qe=Object.keys(Ee).length,Le=Object.keys(Ie).length-Qe,Vt=async()=>{let _=Object.entries(Ee);if(_.length){T(!0);try{await Promise.all(_.map(([O,q])=>qe({data:{key:O,value:q}}))),a(O=>({...O,...Ee})),be(""),je(!1);let D=Le>0?`, skipped ${Le} masked`:"";H("success",`Imported ${_.length} variables${D}`)}catch(D){H("error",D.message??"Import failed")}finally{T(!1)}}},pe=_=>{b(_),w(n[_]??"")},it=()=>{b(null),w("")},lt=async()=>{if(!g)return;let _=g;if(x===n[_]){b(null);return}T(!0);try{let D=await qe({data:{key:_,value:x}});a(O=>({...O,[_]:x})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),H("success",`${_} updated`),b(null)}catch(D){H("error",D.message??"Failed to update")}finally{T(!1)}},yo=async _=>{T(!0);try{let D=await qe({data:{key:_,value:null}});a(O=>{let q={...O};return delete q[_],q}),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),B(O=>{let q=new Set(O);return q.delete(_),Xs(q),q}),H("success",`${_} deleted`)}catch(D){H("error",D.message??"Failed to delete")}finally{T(!1)}},Ht=async(_,D)=>{let O=/^(true|yes)$/i.test(D)?"false":"true";T(!0);try{let q=await qe({data:{key:_,value:O}});a(J=>({...J,[_]:O})),l(J=>{let Re={...J};return q.override?Re[_]=q.override:delete Re[_],Re})}catch(q){H("error",q.message??"Failed to update")}finally{T(!1)}},cr=async()=>{let _=C.trim();if(_){T(!0);try{let D=await qe({data:{key:_,value:k}});a(O=>({...O,[_]:k})),l(O=>{let q={...O};return D.override?q[_]=D.override:delete q[_],q}),A(""),K(""),H("success",`${_} added`)}catch(D){H("error",D.message??"Failed to add")}finally{T(!1)}}},$e=_=>{_.key==="Enter"&&lt(),_.key==="Escape"&&it()},go=async _=>{T(!0);try{let D=await nt({params:{key:_}});l(q=>{let J={...q};return delete J[_],J});let O=q=>{let J={...q};return D.value===null||D.value===void 0?delete J[_]:J[_]=D.value,J};a(O),s(O),H("success",`${_} reset to original`)}catch(D){H("error",D.message??"Failed to reset")}finally{T(!1)}},oe=async()=>{T(!0);try{await P(),l({});let _=await Q();_&&s(_.variables),H("success","All overrides reset")}catch(_){H("error",_.message??"Failed to reset all")}finally{T(!1)}},jr=Object.keys(i).length,ge=Object.entries(n),ut=nr(()=>{let _=m.toLowerCase().trim();return _?ge.filter(([D,O])=>D.toLowerCase().includes(_)||O.toLowerCase().includes(_)):ge},[n,m]),ve=nr(()=>{let _={};for(let D of ut){let O=Cc(D[0]);(_[O]??(_[O]=[])).push(D)}return Object.entries(_).sort(([D],[O])=>D==="OTHER"?1:O==="OTHER"?-1:D.localeCompare(O))},[ut]),Ir=ut.every(([_])=>Z.has(_)),pr=()=>{let _=ut.map(([D])=>D);B(D=>{let O=new Set(D);return Ir?_.forEach(q=>O.delete(q)):_.forEach(q=>O.add(q)),Xs(O),O})},$r="width:100%;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);",ct="background:none;border:none;cursor:pointer;font-size:12px;padding:0 3px;color:var(--profiler-text-muted);opacity:0.7;flex-shrink:0;",pt="background:none;border:1px solid var(--profiler-border);border-radius:4px;cursor:pointer;color:var(--profiler-text-muted);font-size:11px;padding:3px 8px;";return t(M,{children:[t("div",{class:"profiler-flex profiler-mb-4",style:"align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;",children:[t("h2",{class:"profiler-section__header",style:"margin:0;",children:"Environment Variables"}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[!r&&t(M,{children:[t("button",{onClick:Q,disabled:F,style:pt,children:F?"\u2026":"\u21BA Refresh"}),t("button",{onClick:()=>je(_=>!_),style:`${pt}${Ne?"border-color:var(--profiler-accent);color:var(--profiler-accent);":""}`,children:"\u2B06 Import"})]}),t("button",{onClick:W,style:pt,children:"\u2B07 Export"}),t("button",{onClick:pr,style:pt,children:Ir?"\u{1F648} Mask all":"\u{1F441} Reveal all"}),!r&&jr>0&&t("button",{onClick:oe,disabled:j,title:"Remove all Sidekiq overrides and restore original values",style:`${pt}border-color:var(--profiler-warning,#f59e0b);color:var(--profiler-warning,#f59e0b);`,children:["\u21A9 Reset all (",jr,")"]}),!r&&t("button",{onClick:()=>Fe(_=>!_),title:Y?"Unlock editing":"Lock editing",style:`${pt}${Y?"border-color:var(--profiler-error,#ef4444);color:var(--profiler-error,#ef4444);":""}`,children:Y?"\u{1F512} Locked":"\u{1F513} Edit"})]})]}),r?t("div",{style:"background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));border:1px solid var(--profiler-border);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-text-muted);",children:["Snapshot taken at request time - modify env vars in ",t("a",{href:"/_profiler?section=env",style:"color:var(--profiler-accent);",children:"/_profiler?section=env"}),"."]}):t("div",{style:"background:var(--profiler-warning-bg,rgba(245,158,11,0.1));border:1px solid var(--profiler-warning,#f59e0b);border-radius:6px;padding:8px 12px;margin-bottom:16px;font-size:12px;color:var(--profiler-warning,#f59e0b);",children:"\u26A0 Changes affect the current process only - for development use."}),U&&t("div",{style:`background:${U.type==="success"?"var(--profiler-success-bg,rgba(34,197,94,0.1))":"var(--profiler-error-bg,rgba(239,68,68,0.08))"};border:1px solid ${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};border-radius:6px;padding:6px 12px;margin-bottom:12px;font-size:12px;color:${U.type==="success"?"var(--profiler-success,#22c55e)":"var(--profiler-error,#ef4444)"};`,children:[U.type==="success"?"\u2713":"\u2717"," ",U.message]}),Ne&&t("div",{style:"border:1px solid var(--profiler-border);border-radius:6px;padding:12px;margin-bottom:16px;",children:[t("p",{class:"profiler-text--xs profiler-text--muted",style:"margin:0 0 8px;",children:["Paste the contents of a ",t("code",{children:".env"})," file. Comments and blank lines are ignored."]}),t("textarea",{value:De,onInput:_=>be(_.target.value),placeholder:`APP_NAME=MyApp
10
10
  FEATURE_BETA=true
11
- # comment`,rows:6,style:"width:100%;font-family:monospace;font-size:12px;padding:6px 8px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);resize:vertical;box-sizing:border-box;"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2",style:"align-items:center;",children:[Qe>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Qe," variable",Qe!==1?"s":""," to import"]}),Le>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Le," masked (",hi,") skipped"]}),t("button",{onClick:Vt,disabled:j||Qe===0,style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:4px 12px;border-radius:4px;margin-left:auto;",children:"Apply"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:[t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:c}),t("div",{class:"profiler-stat-card__label",children:"Total vars"})]}),m&&t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:ut.length}),t("div",{class:"profiler-stat-card__label",children:"Matching"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",children:t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by key or value\u2026",value:m,onInput:_=>f(_.target.value),style:"flex:1;"})}),t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32%",children:"Key"}),t("th",{children:"Value"}),!Y&&t("th",{style:"width:120px;text-align:right;"})]})}),t("tbody",{children:[ve.map(([_,D])=>{let O=y.has(_);return t(M,{children:[t("tr",{onClick:()=>ur(_),style:"cursor:pointer;background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));",children:t("td",{colspan:Y?2:3,style:"padding:4px 8px;",children:[t("span",{style:"font-size:11px;font-weight:600;color:var(--profiler-text-muted);letter-spacing:0.05em;font-family:monospace;",children:[O?"\u25B6":"\u25BC"," ",_,"_"]}),t("span",{style:"font-size:10px;color:var(--profiler-text-muted);margin-left:6px;",children:D.length})]})},`group-${_}`),!O&&D.map(([q,J])=>{let Re=Z.has(q),Je=g===q,Gt=ce===q,_t=ce===`__key__${q}`,bo=o[q]!==void 0&&o[q]!==J,xe=o[q]===void 0,de=i[q];return t("tr",{style:de?"border-left:3px solid var(--profiler-accent);":bo?"border-left:3px solid #f59e0b;":xe?"border-left:3px solid var(--profiler-success,#22c55e);":"",children:[t("td",{children:t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t("code",{class:"profiler-text--xs profiler-text--mono",children:q}),t("button",{onClick:()=>at(q,`__key__${q}`),title:"Copy key",style:`${ct}${_t?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:_t?"\u2713":"\u2398"})]})}),t("td",{children:Je?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'}),t("input",{ref:we,type:"text",value:x,onInput:vo=>w(vo.target.value),onKeyDown:$e,disabled:j,style:"flex:1;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-accent);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);"}),Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):gi(J)?t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(yi,{value:J}),t("button",{onClick:()=>!Y&&!j&&Ht(q,J),disabled:j||Y,title:`Click to set ${/^(true|yes)$/i.test(J)?"false":"true"}`,style:`position:relative;display:inline-block;width:36px;height:20px;border-radius:10px;border:none;cursor:${Y||j?"default":"pointer"};padding:0;transition:background 0.2s;background:${/^(true|yes)$/i.test(J)?"var(--profiler-accent)":"var(--profiler-border,#d1d5db)"};flex-shrink:0;`,children:t("span",{style:`position:absolute;top:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:left 0.2s;left:${/^(true|yes)$/i.test(J)?"19px":"3px"};`})}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"color:var(--profiler-text-muted);",children:J}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":de.value," \xB7 original: ",de.original??"(unset)"]})]}):t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(yi,{value:J}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Y&&!Je&&pe(q),title:Y?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Y?"":"cursor:pointer;"}`,children:Re?Ys(J)?t(M,{children:[t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'}),J,t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'})]}):J:"\u2022".repeat(Math.min(J.length,20))}),t("button",{onClick:()=>Ce(q),title:Re?"Hide value":"Show value",style:`${ct}${Re?"opacity:1;color:var(--profiler-accent);":""}`,children:Re?"\u{1F441}":"\u{1F648}"}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":Re?de.value:"\u2022".repeat(Math.min((de.value??"").length,20))," \xB7 original: ",de.original==null?"(unset)":Re?de.original:"\u2022".repeat(Math.min(de.original.length,20))]})]})}),!Y&&t("td",{style:"text-align:right;white-space:nowrap;",children:Je?t(M,{children:[t("button",{onClick:lt,disabled:j,title:"Save",style:"background:none;border:none;cursor:pointer;color:var(--profiler-success,#22c55e);font-size:14px;padding:0 4px;",children:"\u2713"}),t("button",{onClick:it,disabled:j,title:"Cancel",style:"background:none;border:none;cursor:pointer;color:var(--profiler-text-muted);font-size:14px;padding:0 4px;",children:"\u2717"})]}):t(M,{children:[t("button",{onClick:()=>pe(q),disabled:j,title:"Edit",style:"background:none;border:none;cursor:pointer;color:var(--profiler-accent);font-size:14px;padding:0 4px;",children:"\u270E"}),de&&t("button",{onClick:()=>go(q),disabled:j,title:`Reset to original: ${de.original??"(unset)"}`,style:"background:none;border:none;cursor:pointer;color:var(--profiler-warning,#f59e0b);font-size:14px;padding:0 4px;",children:"\u21A9"}),t("button",{onClick:()=>yo(q),disabled:j,title:"Delete",style:"background:none;border:none;cursor:pointer;color:var(--profiler-error,#ef4444);font-size:14px;padding:0 4px;",children:"\u2715"})]})})]},q)})]})}),!Y&&t("tr",{children:[t("td",{children:t("input",{type:"text",value:C,onInput:_=>A(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"NEW_KEY",disabled:j,style:$r})}),t("td",{children:t("input",{type:"text",value:k,onInput:_=>K(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"value",disabled:j,style:$r})}),t("td",{style:"text-align:right;",children:t("button",{onClick:cr,disabled:j||!C.trim(),style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:3px 8px;border-radius:4px;",children:"Add"})})]})]})]})]})}function bi({tree:e,selected:r,onToggleFile:o,onToggleDir:s}){let[n,a]=v(new Set),i=c=>{a(d=>{let m=new Set(d);return m.has(c)?m.delete(c):m.add(c),m})},l=c=>{let d=c.filter(m=>r.has(m)).length;return d===0?"none":d===c.length?"all":"partial"};return t("div",{class:"profiler-text--xs profiler-text--mono",style:"overflow-y: auto; height: 100%",children:e.map(({directory:c,files:d})=>{let m=d.map(h=>h.path),f=l(m),y=n.has(c);return t("div",{style:"margin-bottom: 4px",children:[t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer; border-radius: 4px; background: var(--profiler-bg-secondary, rgba(255,255,255,0.05))",onClick:()=>i(c),children:[t("input",{type:"checkbox",checked:f==="all",ref:h=>{h&&(h.indeterminate=f==="partial")},onClick:h=>{h.stopPropagation(),s(c,m)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"color: var(--profiler-text-muted, #888); flex-shrink: 0",children:y?"\u25B6":"\u25BC"}),t("span",{style:"color: var(--profiler-accent, #06b6d4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",title:c,children:[c,"/"]}),t("span",{style:"color: var(--profiler-text-muted, #888); margin-left: auto; flex-shrink: 0",children:["(",d.length,")"]})]}),!y&&d.map(h=>t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 24px; cursor: pointer; border-radius: 4px",onClick:()=>o(h.path),children:[t("input",{type:"checkbox",checked:r.has(h.path),onClick:g=>{g.stopPropagation(),o(h.path)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--profiler-text, #e2e8f0)",title:h.path,children:h.name})]},h.path))]},c)})})}function Rc(e){return e==="passed"?"var(--profiler-success, #10b981)":e==="failed"?"var(--profiler-error, #ef4444)":e==="running"?"var(--profiler-accent, #06b6d4)":e==="killed"||e==="signaled"||e==="error"?"var(--profiler-warning, #f59e0b)":"var(--profiler-text-muted, #888)"}function kc(e){return{pending:"\u23F3 Pending",running:"\u25CF Running\u2026",passed:"\u2713 Passed",failed:"\u2717 Failed",killed:"\u25A0 Killed",signaled:"\u26A1 Ended by a signal",error:"\u26A0 Error"}[e]||e}function Pc(e){let r={0:"",1:"font-weight:bold",31:"color:var(--ansi-red)",32:"color:var(--ansi-green)",33:"color:var(--ansi-yellow)",34:"color:var(--ansi-blue)",35:"color:var(--ansi-purple)",36:"color:var(--ansi-cyan)"},o=[],s="",n=e.split(/(\x1b\[[0-9;]*m)/);for(let a of n)if(a.startsWith("\x1B[")&&a.endsWith("m")){let i=a.slice(2,-1).split(";");if(i.includes("0"))s="";else{let l=i.map(c=>r[c]??"").filter(Boolean);s=[...s?[s]:[],...l].join(";")}}else a.length>0&&o.push({text:a,style:s});return o}function Sc({text:e}){let r=Pc(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(M,{children:r.map((o,s)=>o.style?t("span",{style:o.style,children:o.text},s):t("span",{children:o.text},s))})}function vi({run:e}){let r=he(null);return G(()=>{r.current&&e?.status==="running"&&(r.current.scrollTop=r.current.scrollHeight)},[e?.output]),e?t("div",{style:"display: flex; flex-direction: column; height: 100%; gap: 12px",children:[t("div",{style:"display: flex; align-items: center; gap: 12px; flex-shrink: 0",children:[t("span",{style:`font-weight: 600; color: ${Rc(e.status)}`,children:kc(e.status)}),e.duration!=null&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[(e.duration/1e3).toFixed(1),"s"]}),(e.status==="passed"||e.status==="failed")&&t("a",{href:"/_profiler?section=tests",class:"profiler-text--xs",style:"color: var(--profiler-accent, #06b6d4); margin-left: auto",children:"View in Profiler \u2192"})]}),t("pre",{ref:r,style:"flex: 1; overflow-y: auto; background: var(--profiler-terminal-bg); color: var(--profiler-terminal-text); padding: 14px 16px; border-radius: 6px; font-family: var(--profiler-font-mono); font-size: 12px; line-height: 1.65; margin: 0; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--profiler-border)",children:t(Sc,{text:e.output||""})}),e.files.length>0&&t("div",{class:"profiler-text--xs profiler-text--muted",style:"flex-shrink: 0",children:[e.files.length," file",e.files.length!==1?"s":""," \xB7 ",e.framework]})]}):t("div",{class:"profiler-empty",style:"height: 100%; display: flex; align-items: center; justify-content: center",children:t("div",{children:[t("div",{class:"profiler-empty__title",style:"font-size: 1.1rem",children:"Select files and click Run"}),t("p",{class:"profiler-empty__description",children:"Test output will appear here in real time"})]})})}var xi="/_profiler";function Wo(){let[e,r]=v(""),[o,s]=v(new Set),[n,a]=v(null),[i,l]=v(!1),[c,d]=v(null),{data:m,isLoading:f,refetch:y}=ti(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:h}=ri(),{mutateAsync:g}=oi(),b=m?.frameworks??[],x=m?.tree??[];G(()=>{!e&&b.length>0&&r(b[0])},[b]);let w=ar(F=>{s(new Set),y()},[y]);G(()=>{if(!n||!i)return;if(["passed","failed","killed","signaled","error"].includes(n.status)){l(!1);return}let F=new EventSource(`${xi}/api/test_runner/runs/${n.id}/stream`);return F.addEventListener("output",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,output:(B.output||"")+Z.chunk})}catch{}}),F.addEventListener("done",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,status:Z.status})}catch{}l(!1),F.close()}),F.onerror=()=>{F.readyState===EventSource.CLOSED&&fetch(`${xi}/api/test_runner/runs/${n.id}`).then($=>$.json()).then($=>{a($),l(!1)}).catch(()=>l(!1))},()=>F.close()},[n?.id,i]);let C=F=>{r(F),w(F)},A=F=>{s($=>{let Z=new Set($);return Z.has(F)?Z.delete(F):Z.add(F),Z})},k=(F,$)=>{s(Z=>{let B=new Set(Z);return $.every(fe=>B.has(fe))?$.forEach(fe=>B.delete(fe)):$.forEach(fe=>B.add(fe)),B})},K=()=>{let F=x.flatMap($=>$.files.map(Z=>Z.path));s(new Set(F))},U=()=>s(new Set),L=async()=>{if(!(o.size===0||i)){d(null);try{let F=await h({data:{files:Array.from(o),framework:e}});a(F),l(!0)}catch(F){d(F instanceof Error&&F.message?F.message:"Failed to start test run")}}},j=async()=>{if(n)try{await g({id:n.id}),l(!1),a(F=>F&&{...F,status:"killed"})}catch{}},T=x.reduce((F,$)=>F+$.files.length,0);return t("div",{children:[c&&t("div",{style:"color: var(--profiler-error, #ef4444); background: rgba(239,68,68,0.1); border: 1px solid var(--profiler-error, #ef4444); border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px",children:c}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:b.length>0&&b.map(F=>t("button",{class:`profiler-preset-btn${e===F?" profiler-preset-btn--active":""}`,onClick:()=>C(F),disabled:i,children:F==="rspec"?"RSpec":"Minitest"},F))}),t("div",{class:"profiler-filter-group",style:"margin-left: auto",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:[o.size," / ",T," selected"]}),t("button",{class:"btn btn-secondary btn-sm",onClick:K,disabled:i||f,children:"All"}),t("button",{class:"btn btn-secondary btn-sm",onClick:U,disabled:i,children:"None"}),i?t("button",{class:"btn btn-danger btn-sm",onClick:j,children:"\u25A0 Stop"}):t("button",{class:"btn btn-sm",style:"background: var(--profiler-accent, #06b6d4); color: #000; font-weight: 600",onClick:L,disabled:o.size===0,children:["\u25B6 Run Selected (",o.size,")"]})]})]}),t("div",{style:"display: grid; grid-template-columns: 260px 1fr; height: 460px; border: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); border-radius: 6px; overflow: hidden",children:[t("div",{style:"border-right: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); overflow-y: auto; padding: 8px",children:f?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:"Loading files\u2026"}):x.length===0?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:["No ",e," test files found"]}):t(bi,{tree:x,selected:o,onToggleFile:A,onToggleDir:k})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(vi,{run:n})})]})]})}var Kr="/_profiler";function Ur({cols:e,rows:r=6}){return t("div",{children:Array.from({length:r}).map((o,s)=>t("div",{class:"profiler-skeleton__row",children:e.map((n,a)=>t("div",{class:`profiler-skeleton__cell profiler-skeleton__cell--${n}`},a))},s))})}function Ac(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function Mc(e){return e>=200&&e<300?"badge-success":e>=300&&e<400?"badge-info":e>=400&&e<500?"badge-warning":e>=500?"badge-error":"badge-default"}function Zo(e){return e>=500?"badge-error":e>=100?"badge-warning":"badge-success"}function _i(e){let r=e.collectors_data?.job?.status;return r||(e.status===500?"failed":"completed")}function po(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var Ti=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function wi(){let e=Be(),r=new URLSearchParams(window.location.search),o=()=>{let u=r.get("section");return u==="http"||u==="jobs"||u==="console"||u==="tests"||u==="runner"||u==="outbound"||u==="env"?u:"http"},s=()=>{let u=r.get("sort"),R=r.get("dir");return{col:u==="date"||u==="duration"||u==="memory"||u==="status"||u==="queries"?u:null,dir:R==="desc"?"desc":"asc"}},[n,a]=v(o),i=(u,R)=>({query:{enabled:n===u,queryFn:({pageParam:N=0,signal:re})=>R(N,re),getNextPageParam:N=>N.has_more?N.offset+N.limit:void 0,initialPageParam:0,refetchOnWindowFocus:!1}}),l=Wa({limit:50},i("http",(u,R)=>Bo({limit:50,offset:u},R))),c=Ga({limit:50},i("jobs",(u,R)=>Bs({limit:50,offset:u},R))),d=Qa({limit:50},i("console",(u,R)=>Vs({limit:50,offset:u},R))),m=si({limit:50},i("tests",(u,R)=>Js({limit:50,offset:u},R))),f=za({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Ua({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:h}=Xa(),{mutateAsync:g}=ei(),{mutateAsync:b}=Ba(),{mutateAsync:x}=Ja(),{mutateAsync:w}=La(),{mutateAsync:C}=Ka(),{mutateAsync:A}=ni(),{mutateAsync:k}=ai(),K=l.data?.pages.flatMap(u=>u.profiles)??[],U=c.data?.pages.flatMap(u=>u.profiles)??[],L=d.data?.pages.flatMap(u=>u.profiles)??[],j=m.data?.pages.flatMap(u=>u.profiles)??[],T=f.data??[],F=y.data,$=l.isLoading,Z=c.isLoading,B=d.isLoading,ce=m.isLoading,fe=f.isLoading,Y=y.isLoading,Fe=l.error?.message??null,Ne=c.error?.message??null,je=d.error?.message??null,De=m.error?.message??null,be=f.error?.message??null,we=y.error?.message??null,qe=!!l.hasNextPage,nt=!!c.hasNextPage,P=!!d.hasNextPage,H=!!m.hasNextPage,Ce=l.isFetchingNextPage,at=c.isFetchingNextPage,ur=d.isFetchingNextPage,Q=m.isFetchingNextPage,[W,Ie]=v(null),[Ee,Qe]=v(new Set),[Le,Vt]=v(""),[pe,it]=v(""),[lt,yo]=v(""),[Ht,cr]=v(""),[$e,go]=v(()=>{let u=r.get("preset");return Ti.some(R=>R.key===u)?u:""}),[oe,jr]=v(s),[ge,ut]=v({col:null,dir:"asc"}),[ve,Ir]=v({col:null,dir:"asc"}),[pr,$r]=v(""),[ct,pt]=v(""),[_,D]=v(""),[O,q]=v(""),[J,Re]=v(""),[Je,Gt]=v(""),[_t,bo]=v(""),[xe,de]=v({col:null,dir:"asc"}),[Vr,vo]=v(""),[xo,cn]=v(""),[Hr,pn]=v("");G(()=>{let u=new URL(window.location.href);oe.col?(u.searchParams.set("sort",oe.col),u.searchParams.set("dir",oe.dir)):(u.searchParams.delete("sort"),u.searchParams.delete("dir")),$e?u.searchParams.set("preset",$e):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[oe,$e]);let Gr=u=>{jr(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},os=u=>{ut(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Xi=u=>{go(R=>R===u?"":u)},Yi=()=>l.fetchNextPage(),el=()=>c.fetchNextPage(),tl=()=>d.fetchNextPage(),rl=()=>m.fetchNextPage(),dn=u=>{u==="http"?l.refetch():u==="jobs"?c.refetch():u==="console"?d.refetch():u==="tests"?m.refetch():u==="outbound"?f.refetch():u==="env"&&y.refetch()},Tt=u=>{if(u===n){dn(u);return}a(u);let R=new URL(window.location.href);R.searchParams.set("section",u),history.pushState(null,"",R.toString()),Vt(""),it(""),yo(""),cr(""),go(""),jr({col:null,dir:"asc"}),$r(""),pt(""),D(""),ut({col:null,dir:"asc"}),q(""),Re(""),Ir({col:null,dir:"asc"}),Gt(""),bo(""),de({col:null,dir:"asc"}),vo(""),cn(""),pn("")},_o=u=>{Dt(u).then(R=>{if(!R){window.prompt("Copy is not available here. Select the token and copy it:",u);return}Ie(u),setTimeout(()=>Ie(null),1500)})},ol=u=>h({id:u}).then(()=>l.refetch()),sl=u=>{Qe(R=>{let N=new Set(R);return N.has(u)?N.delete(u):N.size<2&&N.add(u),N})},nl=u=>b({id:u}).then(()=>c.refetch()),al=u=>w({id:u}).then(()=>d.refetch()),il=u=>A({id:u}).then(()=>m.refetch()),ll=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},ul=()=>{window.confirm("Delete all job profiles?")&&x().then(()=>c.refetch())},cl=()=>{window.confirm("Delete all console profiles?")&&C().then(()=>d.refetch())},pl=()=>{window.confirm("Delete all test profiles?")&&k().then(()=>m.refetch())},ss=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),x(),C()]).then(()=>{l.refetch(),c.refetch(),d.refetch()})},Br=()=>dn(n),ns=u=>{Ir(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Bt=u=>`tab${n===u?" active":""}`,To=K.filter(u=>{if(Le&&!u.path.toLowerCase().includes(Le.toLowerCase())||pe&&u.method!==pe)return!1;if(lt){let R=parseInt(lt);if(!(u.status>=R&&u.status<R+100))return!1}return!(Ht&&(Ht==="lt100"?u.duration>=100:u.duration<parseInt(Ht))||$e==="slow"&&u.duration<500||$e==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||$e==="errors"&&u.status<500||$e==="has_exception"&&!u.collectors_data?.exception)}),dl=oe.col?[...To].sort((u,R)=>{if(oe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return oe.dir==="asc"?Ve:-Ve}let N,re;switch(oe.col){case"duration":N=u.duration,re=R.duration;break;case"memory":N=Te(u)??0,re=Te(R)??0;break;case"status":N=u.status,re=R.status;break;case"queries":N=u.collectors_data?.database?.total_queries??0,re=R.collectors_data?.database?.total_queries??0;break;default:return 0}return oe.dir==="asc"?N-re:re-N}):To,wo=U.filter(u=>!(pr&&!u.path.toLowerCase().includes(pr.toLowerCase())||ct&&_i(u)!==ct||_&&(_==="lt100"?u.duration>=100:u.duration<parseInt(_)))),fl=ge.col?[...wo].sort((u,R)=>{if(ge.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return ge.dir==="asc"?Ve:-Ve}let N,re;switch(ge.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return ge.dir==="asc"?N-re:re-N}):wo,as=T.filter(u=>{if(Vr&&!u.url.toLowerCase().includes(Vr.toLowerCase())||xo&&u.method!==xo)return!1;if(Hr)if(Hr==="error"){if(u.status!==0)return!1}else{let R=parseInt(Hr);if(!(u.status>=R&&u.status<R+100))return!1}return!0}),Co=L.filter(u=>!(O&&!u.path.toLowerCase().includes(O.toLowerCase())||J==="error"&&u.status!==500||J==="ok"&&u.status===500)),ml=ve.col?[...Co].sort((u,R)=>{if(ve.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return ve.dir==="asc"?Ve:-Ve}let N,re;switch(ve.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return ve.dir==="asc"?N-re:re-N}):Co,Eo=j.filter(u=>!(Je&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes(Je.toLowerCase())||_t==="failed"&&u.status!==500||_t==="passed"&&u.status===500||_t==="pending"&&u.collectors_data?.test?.status!=="pending")),hl=xe.col?[...Eo].sort((u,R)=>{let N,re;if(xe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return xe.dir==="asc"?Ve:-Ve}switch(xe.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return xe.dir==="asc"?N-re:re-N}):Eo,fn=!!(Le||pe||lt||Ht||$e),mn=!!(pr||ct||_),hn=!!(O||J),yn=!!(Je||_t),yl=!!(Vr||xo||Hr),Se=(u,R,N)=>u!==N?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:R==="asc"?"\u25B2":"\u25BC"});return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("span",{class:"h1-emoji",children:"\u{1F50D}"})," Rails Profiler"]}),t("p",{children:"Recent profiled requests and jobs"}),e&&t("span",{class:"profiler-version-badge",children:["v",e]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:Bt("http"),onClick:u=>{u.preventDefault(),Tt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:Bt("jobs"),onClick:u=>{u.preventDefault(),Tt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:Bt("console"),onClick:u=>{u.preventDefault(),Tt("console")},children:"Console"}),t("a",{href:"#",class:Bt("tests"),onClick:u=>{u.preventDefault(),Tt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:Bt("runner"),onClick:u=>{u.preventDefault(),Tt("runner")},children:"Test Runner"}),t("a",{href:"#",class:Bt("outbound"),onClick:u=>{u.preventDefault(),Tt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:Bt("env"),onClick:u=>{u.preventDefault(),Tt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&($?t(Ur,{cols:["sm","xs","flex","sm","sm","sm","xs","sm"]}):Fe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Fe})}):K.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No profiles found"}),t("p",{class:"profiler-empty__description",children:"Make some requests to your application to see profiling data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:Ti.map(u=>t("button",{class:`profiler-preset-btn${$e===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Xi(u.key),children:u.label},u.key))})}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search path\u2026",value:Le,onInput:u=>Vt(u.target.value)}),t("select",{class:"profiler-filter-select",value:pe,onChange:u=>it(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:lt,onChange:u=>yo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"})]}),t("select",{class:"profiler-filter-select",value:Ht,onChange:u=>cr(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[fn&&t("span",{class:"profiler-filter-count",children:[To.length," / ",K.length]}),Ee.size===2&&t("a",{class:"btn btn-secondary btn-sm",href:`${Kr}/compare?a=${encodeURIComponent(Array.from(Ee)[0])}&b=${encodeURIComponent(Array.from(Ee)[1])}`,children:"Compare 2 profiles"}),Ee.size===1&&t("span",{class:"profiler-text--xs profiler-text--muted",children:"Select 1 more to compare"}),t("button",{class:`btn-refresh${$?" btn-refresh--spinning":""}`,onClick:Br,disabled:$,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ll,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),To.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32px"}),t("th",{class:`sortable${oe.col==="date"?" sortable--active":""}`,onClick:()=>Gr("date"),children:["Time ",Se(oe.col,oe.dir,"date")]}),t("th",{children:"Method"}),t("th",{children:"Path"}),t("th",{class:`sortable${oe.col==="duration"?" sortable--active":""}`,onClick:()=>Gr("duration"),children:["Duration ",Se(oe.col,oe.dir,"duration")]}),t("th",{class:`sortable${oe.col==="queries"?" sortable--active":""}`,onClick:()=>Gr("queries"),children:["Queries ",Se(oe.col,oe.dir,"queries")]}),t("th",{class:`sortable${oe.col==="memory"?" sortable--active":""}`,onClick:()=>Gr("memory"),title:ot,children:["Allocations ",Se(oe.col,oe.dir,"memory")]}),t("th",{class:`sortable${oe.col==="status"?" sortable--active":""}`,onClick:()=>Gr("status"),children:["Status ",Se(oe.col,oe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:dl.map(u=>{let R=Ee.has(u.token),N=!R&&Ee.size>=2;return t("tr",{class:R?"profiler-row--selected":"",children:[t("td",{children:t("input",{type:"checkbox",checked:R,disabled:N,onChange:()=>sl(u.token),title:N?"Deselect another profile first":"Select for comparison"})}),t("td",{children:po(u.started_at)}),t("td",{children:t("span",{class:Ac(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:rt(Te(u))}),t("td",{children:t("span",{class:Mc(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>ol(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),qe&&!fn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Yi,disabled:Ce,children:Ce?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(Z?t(Ur,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ne?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ne})}):U.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No job profiles found"}),t("p",{class:"profiler-empty__description",children:"Run background jobs in your application to see profiling data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search job class\u2026",value:pr,onInput:u=>$r(u.target.value)}),t("select",{class:"profiler-filter-select",value:ct,onChange:u=>pt(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"running",children:"Running"}),t("option",{value:"completed",children:"Completed"}),t("option",{value:"failed",children:"Failed"})]}),t("select",{class:"profiler-filter-select",value:_,onChange:u=>D(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[mn&&t("span",{class:"profiler-filter-count",children:[wo.length," / ",U.length]}),t("button",{class:`btn-refresh${Z?" btn-refresh--spinning":""}`,onClick:Br,disabled:Z,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ul,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),wo.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ge.col==="date"?" sortable--active":""}`,onClick:()=>os("date"),children:["Time ",Se(ge.col,ge.dir,"date")]}),t("th",{children:"Job Class"}),t("th",{children:"Queue"}),t("th",{class:`sortable${ge.col==="duration"?" sortable--active":""}`,onClick:()=>os("duration"),children:["Duration ",Se(ge.col,ge.dir,"duration")]}),t("th",{class:`sortable${ge.col==="status"?" sortable--active":""}`,onClick:()=>os("status"),children:["Status ",Se(ge.col,ge.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:fl.map(u=>{let R=u.collectors_data?.job,N=_i(u);return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--mono",children:R?.queue||"-"})}),t("td",{children:N==="running"?t("span",{class:"profiler-text--muted",children:"-"}):t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:N==="running"?t("span",{class:"badge-info",children:[t("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," Running"]}):t("span",{class:N==="failed"?"badge-error":"badge-success",children:N==="failed"?"\u2717 Failed":"\u2713 Completed"})}),t("td",{children:R?.executions??"-"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>nl(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),nt&&!mn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:el,disabled:at,children:at?"Loading\u2026":"Load more"})})]})),n==="console"&&(B?t(Ur,{cols:["sm","flex","sm","sm","xs","sm"]}):je?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:je})}):L.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No console profiles found"}),t("p",{class:"profiler-empty__description",children:["Run expressions in ",t("code",{children:"rails console"})," to see profiling data"]})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search expression\u2026",value:O,onInput:u=>q(u.target.value)}),t("select",{class:"profiler-filter-select",value:J,onChange:u=>Re(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"ok",children:"OK"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[hn&&t("span",{class:"profiler-filter-count",children:[Co.length," / ",L.length]}),t("button",{class:`btn-refresh${B?" btn-refresh--spinning":""}`,onClick:Br,disabled:B,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:cl,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all profiles",children:"Clear All"})]})]}),Co.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ve.col==="date"?" sortable--active":""}`,onClick:()=>ns("date"),children:["Time ",Se(ve.col,ve.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${ve.col==="duration"?" sortable--active":""}`,onClick:()=>ns("duration"),children:["Duration ",Se(ve.col,ve.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${ve.col==="status"?" sortable--active":""}`,onClick:()=>ns("status"),children:["Status ",Se(ve.col,ve.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:ml.map(u=>{let R=u.status===500;return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,class:"profiler-text--mono",style:"font-size:0.85em;",children:u.path.length>60?u.path.slice(0,60)+"\u2026":u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:R?"badge-error":"badge-success",children:R?"\u2717 Error":"\u2713 OK"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>al(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),P&&!hn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:tl,disabled:ur,children:ur?"Loading\u2026":"Load more"})})]})),n==="tests"&&(ce?t(Ur,{cols:["sm","flex","md","sm","xs","sm"]}):De?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:De})}):j.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No test profiles found"}),t("p",{class:"profiler-empty__description",children:["Add ",t("code",{children:"Profiler::TestHelpers::RSpecSupport.install(config)"})," to your spec_helper.rb and run your tests. Or use the ",t("a",{href:"#",style:"color:var(--profiler-accent,#06b6d4)",onClick:u=>{u.preventDefault(),Tt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search test name\u2026",value:Je,onInput:u=>Gt(u.target.value)}),t("select",{class:"profiler-filter-select",value:_t,onChange:u=>bo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"passed",children:"Passed"}),t("option",{value:"failed",children:"Failed"}),t("option",{value:"pending",children:"Pending"})]})]}),t("div",{class:"profiler-filter-group",children:[yn&&t("span",{class:"profiler-filter-count",children:[Eo.length," / ",j.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Br,disabled:ce,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:pl,title:"Delete test profiles",children:"Clear All"})]})]}),Eo.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${xe.col==="date"?" sortable--active":""}`,onClick:()=>de(u=>({col:"date",dir:u.col==="date"&&u.dir==="asc"?"desc":"asc"})),children:["Time ",Se(xe.col,xe.dir,"date")]}),t("th",{children:"Test Name"}),t("th",{children:"File"}),t("th",{class:`sortable${xe.col==="duration"?" sortable--active":""}`,onClick:()=>de(u=>({col:"duration",dir:u.col==="duration"&&u.dir==="asc"?"desc":"asc"})),children:["Duration ",Se(xe.col,xe.dir,"duration")]}),t("th",{children:"Queries"}),t("th",{class:`sortable${xe.col==="status"?" sortable--active":""}`,onClick:()=>de(u=>({col:"status",dir:u.col==="status"&&u.dir==="asc"?"desc":"asc"})),children:["Status ",Se(xe.col,xe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:hl.map(u=>{let R=u.collectors_data?.test,N=u.status===500,re=R?.status||(N?"failed":"passed");return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${Kr}/profiles/${u.token}`,title:R?.test_name||u.path,children:R?.test_name||u.path})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:R?.test_file||"-"}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:re==="failed"?"badge-error":re==="pending"?"badge-warning":"badge-success",children:re==="failed"?"\u2717 Failed":re==="pending"?"\u23F8 Pending":"\u2713 Passed"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>il(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),H&&!yn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:rl,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Wo,{}),n==="outbound"&&(fe?t(Ur,{cols:["sm","xs","flex","sm","xs"],rows:4}):be?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:be})}):T.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No outbound HTTP requests found"}),t("p",{class:"profiler-empty__description",children:"Make requests to external services to see outbound HTTP data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search URL\u2026",value:Vr,onInput:u=>vo(u.target.value)}),t("select",{class:"profiler-filter-select",value:xo,onChange:u=>cn(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:Hr,onChange:u=>pn(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[yl&&t("span",{class:"profiler-filter-count",children:[as.length," / ",T.length]}),t("button",{class:`btn-refresh${fe?" btn-refresh--spinning":""}`,onClick:Br,disabled:fe,title:"Refresh",children:"\u21BA"})]})]}),t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:[T.length," outbound request",T.length!==1?"s":""," across all profiles. Click a request to expand headers and body."]}),as.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):as.map((u,R)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[po(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${Kr}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Zs,{req:u,index:R,threshold:500})]},R))]})),n==="env"&&(Y?t(Ur,{cols:["sm","flex","sm","sm"],rows:8}):we?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:we})}):t(st,{envData:F}))]})]})]})}function Ci(){let{data:e}=Da({query:{retry:!1,refetchOnWindowFocus:!1}}),r=e?.slaves??[],o=qa();return r.length===0?null:t("div",{class:"profiler-selector",style:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 12px",background:"var(--profiler-bg-secondary, #f5f5f5)",borderBottom:"1px solid var(--profiler-border, #e0e0e0)"},children:[t("span",{style:{fontSize:"12px",fontWeight:600,color:"var(--profiler-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Profiler"}),t("select",{value:o??"__local__",onChange:a=>{let i=a.target.value;Oa(i==="__local__"?null:i)},style:{fontSize:"13px",padding:"2px 6px",borderRadius:"4px",border:"1px solid var(--profiler-border, #ccc)",background:"var(--profiler-bg, #fff)",color:"var(--profiler-text, #333)",cursor:"pointer"},children:[t("option",{value:"__local__",children:"Local (master)"}),r.map(a=>t("option",{value:a.name,disabled:a.status==="offline",children:[a.name," ",a.status==="offline"?"(offline)":""]},a.name))]}),o&&t("span",{style:{fontSize:"11px",color:"var(--profiler-text-secondary, #888)",fontStyle:"italic"},children:"Viewing slave data via proxy"})]})}function Fc(e){let r=e.headers??{},o=e.params??{},s=e.request_body,n=[`curl -X ${e.method}`];Object.entries(r).filter(([i])=>i!=="User-Agent").forEach(([i,l])=>n.push(` -H '${i}: ${l}'`)),["POST","PUT","PATCH"].includes(e.method)&&(s&&s.length>0?n.push(` -d '${s.replace(/'/g,"'\\''")}'`):Object.keys(o).length>0&&((r["Content-Type"]??"").includes("application/json")?n.push(` -d '${JSON.stringify(o).replace(/'/g,"'\\''")}'`):Object.entries(o).forEach(([l,c])=>n.push(` --data-urlencode '${l}=${c}'`))));let a=`http://localhost:3000${e.path}`;return e.method==="GET"&&Object.keys(o).length>0&&(a+="?"+Object.entries(o).map(([i,l])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(l))}`).join("&")),n.push(` '${a}'`),n.join(` \\
12
- `)}function qc(e,r){let o=[],s=(a,i,l,c)=>{if(i){let d=l!=null?`${c?"at least ":""}${l.toLocaleString("en")} bytes, `:"";o.push(`${a} body truncated: ${d}only the beginning was kept (max_captured_body_bytes).`)}};s("Request",e.request_body_truncated??r.request_body_truncated,e.request_body_size??r.request_body_size,e.request_body_size_is_minimum??r.request_body_size_is_minimum),s("Response",e.response_body_truncated??r.response_body_truncated,e.response_body_size??r.response_body_size,e.response_body_size_is_minimum??r.response_body_size_is_minimum);let n=e.collectors_released_after_seconds??r.collectors_released_after_seconds;return n!=null&&o.push(`Incomplete profile: the collectors of this stream were released after ${n} s, before the server closed it; what it did later is missing.`),o}var Oc=["POST","PUT","PATCH","DELETE"];function Dc({profile:e}){let{mutateAsync:r,isPending:o}=Ya(),[s,n]=v(null),[a,i]=v(null);return t("div",{class:"profiler-ajax-card__row",children:[t("button",{class:"profiler-btn profiler-btn--sm",disabled:o,onClick:async()=>{let c=Oc.includes(e.method)?`
11
+ # comment`,rows:6,style:"width:100%;font-family:monospace;font-size:12px;padding:6px 8px;border:1px solid var(--profiler-border);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);resize:vertical;box-sizing:border-box;"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2",style:"align-items:center;",children:[Qe>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Qe," variable",Qe!==1?"s":""," to import"]}),Le>0&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[Le," masked (",hi,") skipped"]}),t("button",{onClick:Vt,disabled:j||Qe===0,style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:4px 12px;border-radius:4px;margin-left:auto;",children:"Apply"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:[t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:c}),t("div",{class:"profiler-stat-card__label",children:"Total vars"})]}),m&&t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:ut.length}),t("div",{class:"profiler-stat-card__label",children:"Matching"})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",children:t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by key or value\u2026",value:m,onInput:_=>f(_.target.value),style:"flex:1;"})}),t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32%",children:"Key"}),t("th",{children:"Value"}),!Y&&t("th",{style:"width:120px;text-align:right;"})]})}),t("tbody",{children:[ve.map(([_,D])=>{let O=y.has(_);return t(M,{children:[t("tr",{onClick:()=>ur(_),style:"cursor:pointer;background:var(--profiler-bg-subtle,rgba(0,0,0,0.03));",children:t("td",{colspan:Y?2:3,style:"padding:4px 8px;",children:[t("span",{style:"font-size:11px;font-weight:600;color:var(--profiler-text-muted);letter-spacing:0.05em;font-family:monospace;",children:[O?"\u25B6":"\u25BC"," ",_,"_"]}),t("span",{style:"font-size:10px;color:var(--profiler-text-muted);margin-left:6px;",children:D.length})]})},`group-${_}`),!O&&D.map(([q,J])=>{let Re=Z.has(q),Je=g===q,Gt=ce===q,_t=ce===`__key__${q}`,bo=o[q]!==void 0&&o[q]!==J,xe=o[q]===void 0,de=i[q];return t("tr",{style:de?"border-left:3px solid var(--profiler-accent);":bo?"border-left:3px solid #f59e0b;":xe?"border-left:3px solid var(--profiler-success,#22c55e);":"",children:[t("td",{children:t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t("code",{class:"profiler-text--xs profiler-text--mono",children:q}),t("button",{onClick:()=>at(q,`__key__${q}`),title:"Copy key",style:`${ct}${_t?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:_t?"\u2713":"\u2398"})]})}),t("td",{children:Je?t("div",{class:"profiler-flex",style:"align-items:center;gap:2px;",children:[Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'}),t("input",{ref:we,type:"text",value:x,onInput:vo=>w(vo.target.value),onKeyDown:$e,disabled:j,style:"flex:1;font-family:monospace;font-size:12px;padding:2px 6px;border:1px solid var(--profiler-accent);border-radius:4px;background:var(--profiler-bg);color:var(--profiler-text);"}),Ys(x)&&t("span",{style:"font-family:monospace;font-size:12px;color:var(--profiler-text-muted);opacity:0.5;flex-shrink:0;",children:'"'})]}):gi(J)?t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:8px;",children:[t(yi,{value:J}),t("button",{onClick:()=>!Y&&!j&&Ht(q,J),disabled:j||Y,title:`Click to set ${/^(true|yes)$/i.test(J)?"false":"true"}`,style:`position:relative;display:inline-block;width:36px;height:20px;border-radius:10px;border:none;cursor:${Y||j?"default":"pointer"};padding:0;transition:background 0.2s;background:${/^(true|yes)$/i.test(J)?"var(--profiler-accent)":"var(--profiler-border,#d1d5db)"};flex-shrink:0;`,children:t("span",{style:`position:absolute;top:3px;width:14px;height:14px;border-radius:50%;background:#fff;transition:left 0.2s;left:${/^(true|yes)$/i.test(J)?"19px":"3px"};`})}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"color:var(--profiler-text-muted);",children:J}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":de.value," \xB7 original: ",de.original??"(unset)"]})]}):t(M,{children:[t("div",{class:"profiler-flex",style:"align-items:center;gap:4px;",children:[t(yi,{value:J}),t("span",{class:"profiler-text--xs profiler-text--mono",onClick:()=>!Y&&!Je&&pe(q),title:Y?void 0:"Click to edit",style:`word-break:break-all;flex:1;${Y?"":"cursor:pointer;"}`,children:Re?Ys(J)?t(M,{children:[t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'}),J,t("span",{style:"color:var(--profiler-text-muted);opacity:0.5;",children:'"'})]}):J:"\u2022".repeat(Math.min(J.length,20))}),t("button",{onClick:()=>Ce(q),title:Re?"Hide value":"Show value",style:`${ct}${Re?"opacity:1;color:var(--profiler-accent);":""}`,children:Re?"\u{1F441}":"\u{1F648}"}),t("button",{onClick:()=>at(J,q),title:"Copy value",style:`${ct}${Gt?"color:var(--profiler-success,#22c55e);opacity:1;":""}`,children:Gt?"\u2713":"\u2398"})]}),de&&t("div",{style:"font-size:10px;color:var(--profiler-accent);margin-top:2px;font-family:monospace;",children:["workers \u2190 ",de.value==="__profiler_deleted__"?"(deleted)":Re?de.value:"\u2022".repeat(Math.min((de.value??"").length,20))," \xB7 original: ",de.original==null?"(unset)":Re?de.original:"\u2022".repeat(Math.min(de.original.length,20))]})]})}),!Y&&t("td",{style:"text-align:right;white-space:nowrap;",children:Je?t(M,{children:[t("button",{onClick:lt,disabled:j,title:"Save",style:"background:none;border:none;cursor:pointer;color:var(--profiler-success,#22c55e);font-size:14px;padding:0 4px;",children:"\u2713"}),t("button",{onClick:it,disabled:j,title:"Cancel",style:"background:none;border:none;cursor:pointer;color:var(--profiler-text-muted);font-size:14px;padding:0 4px;",children:"\u2717"})]}):t(M,{children:[t("button",{onClick:()=>pe(q),disabled:j,title:"Edit",style:"background:none;border:none;cursor:pointer;color:var(--profiler-accent);font-size:14px;padding:0 4px;",children:"\u270E"}),de&&t("button",{onClick:()=>go(q),disabled:j,title:`Reset to original: ${de.original??"(unset)"}`,style:"background:none;border:none;cursor:pointer;color:var(--profiler-warning,#f59e0b);font-size:14px;padding:0 4px;",children:"\u21A9"}),t("button",{onClick:()=>yo(q),disabled:j,title:"Delete",style:"background:none;border:none;cursor:pointer;color:var(--profiler-error,#ef4444);font-size:14px;padding:0 4px;",children:"\u2715"})]})})]},q)})]})}),!Y&&t("tr",{children:[t("td",{children:t("input",{type:"text",value:C,onInput:_=>A(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"NEW_KEY",disabled:j,style:$r})}),t("td",{children:t("input",{type:"text",value:k,onInput:_=>K(_.target.value),onKeyDown:_=>_.key==="Enter"&&cr(),placeholder:"value",disabled:j,style:$r})}),t("td",{style:"text-align:right;",children:t("button",{onClick:cr,disabled:j||!C.trim(),style:"background:var(--profiler-accent);border:none;cursor:pointer;color:#fff;font-size:11px;padding:3px 8px;border-radius:4px;",children:"Add"})})]})]})]})]})}function bi({tree:e,selected:r,onToggleFile:o,onToggleDir:s}){let[n,a]=v(new Set),i=c=>{a(d=>{let m=new Set(d);return m.has(c)?m.delete(c):m.add(c),m})},l=c=>{let d=c.filter(m=>r.has(m)).length;return d===0?"none":d===c.length?"all":"partial"};return t("div",{class:"profiler-text--xs profiler-text--mono",style:"overflow-y: auto; height: 100%",children:e.map(({directory:c,files:d})=>{let m=d.map(h=>h.path),f=l(m),y=n.has(c);return t("div",{style:"margin-bottom: 4px",children:[t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 3px 6px; cursor: pointer; border-radius: 4px; background: var(--profiler-bg-secondary, rgba(255,255,255,0.05))",onClick:()=>i(c),children:[t("input",{type:"checkbox",checked:f==="all",ref:h=>{h&&(h.indeterminate=f==="partial")},onClick:h=>{h.stopPropagation(),s(c,m)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"color: var(--profiler-text-muted, #888); flex-shrink: 0",children:y?"\u25B6":"\u25BC"}),t("span",{style:"color: var(--profiler-accent, #06b6d4); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",title:c,children:[c,"/"]}),t("span",{style:"color: var(--profiler-text-muted, #888); margin-left: auto; flex-shrink: 0",children:["(",d.length,")"]})]}),!y&&d.map(h=>t("div",{style:"display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px 24px; cursor: pointer; border-radius: 4px",onClick:()=>o(h.path),children:[t("input",{type:"checkbox",checked:r.has(h.path),onClick:g=>{g.stopPropagation(),o(h.path)},style:"cursor: pointer; flex-shrink: 0"}),t("span",{style:"overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--profiler-text, #e2e8f0)",title:h.path,children:h.name})]},h.path))]},c)})})}function kc(e){return e==="passed"?"var(--profiler-success, #10b981)":e==="failed"?"var(--profiler-error, #ef4444)":e==="running"?"var(--profiler-accent, #06b6d4)":e==="killed"||e==="signaled"||e==="error"?"var(--profiler-warning, #f59e0b)":"var(--profiler-text-muted, #888)"}function Pc(e){return{pending:"\u23F3 Pending",running:"\u25CF Running\u2026",passed:"\u2713 Passed",failed:"\u2717 Failed",killed:"\u25A0 Killed",signaled:"\u26A1 Ended by a signal",error:"\u26A0 Error"}[e]||e}function Sc(e){let r={0:"",1:"font-weight:bold",31:"color:var(--ansi-red)",32:"color:var(--ansi-green)",33:"color:var(--ansi-yellow)",34:"color:var(--ansi-blue)",35:"color:var(--ansi-purple)",36:"color:var(--ansi-cyan)"},o=[],s="",n=e.split(/(\x1b\[[0-9;]*m)/);for(let a of n)if(a.startsWith("\x1B[")&&a.endsWith("m")){let i=a.slice(2,-1).split(";");if(i.includes("0"))s="";else{let l=i.map(c=>r[c]??"").filter(Boolean);s=[...s?[s]:[],...l].join(";")}}else a.length>0&&o.push({text:a,style:s});return o}function Ac({text:e}){let r=Sc(e);return r.length===0?t("span",{style:"color:var(--profiler-text-muted)",children:"No output yet\u2026"}):t(M,{children:r.map((o,s)=>o.style?t("span",{style:o.style,children:o.text},s):t("span",{children:o.text},s))})}function vi({run:e}){let r=he(null);return G(()=>{r.current&&e?.status==="running"&&(r.current.scrollTop=r.current.scrollHeight)},[e?.output]),e?t("div",{style:"display: flex; flex-direction: column; height: 100%; gap: 12px",children:[t("div",{style:"display: flex; align-items: center; gap: 12px; flex-shrink: 0",children:[t("span",{style:`font-weight: 600; color: ${kc(e.status)}`,children:Pc(e.status)}),e.duration!=null&&t("span",{class:"profiler-text--xs profiler-text--muted",children:[(e.duration/1e3).toFixed(1),"s"]}),(e.status==="passed"||e.status==="failed")&&t("a",{href:"/_profiler?section=tests",class:"profiler-text--xs",style:"color: var(--profiler-accent, #06b6d4); margin-left: auto",children:"View in Profiler \u2192"})]}),t("pre",{ref:r,style:"flex: 1; overflow-y: auto; background: var(--profiler-terminal-bg); color: var(--profiler-terminal-text); padding: 14px 16px; border-radius: 6px; font-family: var(--profiler-font-mono); font-size: 12px; line-height: 1.65; margin: 0; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--profiler-border)",children:t(Ac,{text:e.output||""})}),e.files.length>0&&t("div",{class:"profiler-text--xs profiler-text--muted",style:"flex-shrink: 0",children:[e.files.length," file",e.files.length!==1?"s":""," \xB7 ",e.framework]})]}):t("div",{class:"profiler-empty",style:"height: 100%; display: flex; align-items: center; justify-content: center",children:t("div",{children:[t("div",{class:"profiler-empty__title",style:"font-size: 1.1rem",children:"Select files and click Run"}),t("p",{class:"profiler-empty__description",children:"Test output will appear here in real time"})]})})}var xi="/_profiler";function Wo(){let[e,r]=v(""),[o,s]=v(new Set),[n,a]=v(null),[i,l]=v(!1),[c,d]=v(null),{data:m,isLoading:f,refetch:y}=ti(e?{framework:e}:{},{query:{refetchOnWindowFocus:!1}}),{mutateAsync:h}=ri(),{mutateAsync:g}=oi(),b=m?.frameworks??[],x=m?.tree??[];G(()=>{!e&&b.length>0&&r(b[0])},[b]);let w=ar(F=>{s(new Set),y()},[y]);G(()=>{if(!n||!i)return;if(["passed","failed","killed","signaled","error"].includes(n.status)){l(!1);return}let F=new EventSource(`${xi}/api/test_runner/runs/${n.id}/stream`);return F.addEventListener("output",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,output:(B.output||"")+Z.chunk})}catch{}}),F.addEventListener("done",$=>{try{let Z=JSON.parse($.data);a(B=>B&&{...B,status:Z.status})}catch{}l(!1),F.close()}),F.onerror=()=>{F.readyState===EventSource.CLOSED&&fetch(`${xi}/api/test_runner/runs/${n.id}`).then($=>$.json()).then($=>{a($),l(!1)}).catch(()=>l(!1))},()=>F.close()},[n?.id,i]);let C=F=>{r(F),w(F)},A=F=>{s($=>{let Z=new Set($);return Z.has(F)?Z.delete(F):Z.add(F),Z})},k=(F,$)=>{s(Z=>{let B=new Set(Z);return $.every(fe=>B.has(fe))?$.forEach(fe=>B.delete(fe)):$.forEach(fe=>B.add(fe)),B})},K=()=>{let F=x.flatMap($=>$.files.map(Z=>Z.path));s(new Set(F))},U=()=>s(new Set),L=async()=>{if(!(o.size===0||i)){d(null);try{let F=await h({data:{files:Array.from(o),framework:e}});a(F),l(!0)}catch(F){d(F instanceof Error&&F.message?F.message:"Failed to start test run")}}},j=async()=>{if(n)try{await g({id:n.id}),l(!1),a(F=>F&&{...F,status:"killed"})}catch{}},T=x.reduce((F,$)=>F+$.files.length,0);return t("div",{children:[c&&t("div",{style:"color: var(--profiler-error, #ef4444); background: rgba(239,68,68,0.1); border: 1px solid var(--profiler-error, #ef4444); border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px",children:c}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:b.length>0&&b.map(F=>t("button",{class:`profiler-preset-btn${e===F?" profiler-preset-btn--active":""}`,onClick:()=>C(F),disabled:i,children:F==="rspec"?"RSpec":"Minitest"},F))}),t("div",{class:"profiler-filter-group",style:"margin-left: auto",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:[o.size," / ",T," selected"]}),t("button",{class:"btn btn-secondary btn-sm",onClick:K,disabled:i||f,children:"All"}),t("button",{class:"btn btn-secondary btn-sm",onClick:U,disabled:i,children:"None"}),i?t("button",{class:"btn btn-danger btn-sm",onClick:j,children:"\u25A0 Stop"}):t("button",{class:"btn btn-sm",style:"background: var(--profiler-accent, #06b6d4); color: #000; font-weight: 600",onClick:L,disabled:o.size===0,children:["\u25B6 Run Selected (",o.size,")"]})]})]}),t("div",{style:"display: grid; grid-template-columns: 260px 1fr; height: 460px; border: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); border-radius: 6px; overflow: hidden",children:[t("div",{style:"border-right: 1px solid var(--profiler-border, rgba(255,255,255,0.1)); overflow-y: auto; padding: 8px",children:f?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:"Loading files\u2026"}):x.length===0?t("div",{class:"profiler-text--xs profiler-text--muted",style:"padding: 8px",children:["No ",e," test files found"]}):t(bi,{tree:x,selected:o,onToggleFile:A,onToggleDir:k})}),t("div",{style:"overflow: hidden; display: flex; flex-direction: column",children:t(vi,{run:n})})]})]})}var Kr="/_profiler";function Ur({cols:e,rows:r=6}){return t("div",{children:Array.from({length:r}).map((o,s)=>t("div",{class:"profiler-skeleton__row",children:e.map((n,a)=>t("div",{class:`profiler-skeleton__cell profiler-skeleton__cell--${n}`},a))},s))})}function Mc(e){return{GET:"badge-info",POST:"badge-success",PUT:"badge-warning",PATCH:"badge-warning",DELETE:"badge-error"}[e]||"badge-default"}function Fc(e){return e>=200&&e<300?"badge-success":e>=300&&e<400?"badge-info":e>=400&&e<500?"badge-warning":e>=500?"badge-error":"badge-default"}function Zo(e){return e>=500?"badge-error":e>=100?"badge-warning":"badge-success"}function _i(e){let r=e.collectors_data?.job?.status;return r||(e.status===500?"failed":"completed")}function po(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}var Ti=[{key:"slow",label:"Slow"},{key:"many_queries",label:"Many queries"},{key:"errors",label:"Errors"},{key:"has_exception",label:"Has exception"}];function wi(){let e=Be(),r=new URLSearchParams(window.location.search),o=()=>{let u=r.get("section");return u==="http"||u==="jobs"||u==="console"||u==="tests"||u==="runner"||u==="outbound"||u==="env"?u:"http"},s=()=>{let u=r.get("sort"),R=r.get("dir");return{col:u==="date"||u==="duration"||u==="memory"||u==="status"||u==="queries"?u:null,dir:R==="desc"?"desc":"asc"}},[n,a]=v(o),i=(u,R)=>({query:{enabled:n===u,queryFn:({pageParam:N=0,signal:re})=>R(N,re),getNextPageParam:N=>N.has_more?N.offset+N.limit:void 0,initialPageParam:0,refetchOnWindowFocus:!1}}),l=Wa({limit:50},i("http",(u,R)=>Bo({limit:50,offset:u},R))),c=Ga({limit:50},i("jobs",(u,R)=>Bs({limit:50,offset:u},R))),d=Qa({limit:50},i("console",(u,R)=>Vs({limit:50,offset:u},R))),m=si({limit:50},i("tests",(u,R)=>Js({limit:50,offset:u},R))),f=za({query:{enabled:n==="outbound",refetchOnWindowFocus:!1}}),y=Ua({query:{enabled:n==="env",refetchOnWindowFocus:!1}}),{mutateAsync:h}=Xa(),{mutateAsync:g}=ei(),{mutateAsync:b}=Ba(),{mutateAsync:x}=Ja(),{mutateAsync:w}=La(),{mutateAsync:C}=Ka(),{mutateAsync:A}=ni(),{mutateAsync:k}=ai(),K=l.data?.pages.flatMap(u=>u.profiles)??[],U=c.data?.pages.flatMap(u=>u.profiles)??[],L=d.data?.pages.flatMap(u=>u.profiles)??[],j=m.data?.pages.flatMap(u=>u.profiles)??[],T=f.data??[],F=y.data,$=l.isLoading,Z=c.isLoading,B=d.isLoading,ce=m.isLoading,fe=f.isLoading,Y=y.isLoading,Fe=l.error?.message??null,Ne=c.error?.message??null,je=d.error?.message??null,De=m.error?.message??null,be=f.error?.message??null,we=y.error?.message??null,qe=!!l.hasNextPage,nt=!!c.hasNextPage,P=!!d.hasNextPage,H=!!m.hasNextPage,Ce=l.isFetchingNextPage,at=c.isFetchingNextPage,ur=d.isFetchingNextPage,Q=m.isFetchingNextPage,[W,Ie]=v(null),[Ee,Qe]=v(new Set),[Le,Vt]=v(""),[pe,it]=v(""),[lt,yo]=v(""),[Ht,cr]=v(""),[$e,go]=v(()=>{let u=r.get("preset");return Ti.some(R=>R.key===u)?u:""}),[oe,jr]=v(s),[ge,ut]=v({col:null,dir:"asc"}),[ve,Ir]=v({col:null,dir:"asc"}),[pr,$r]=v(""),[ct,pt]=v(""),[_,D]=v(""),[O,q]=v(""),[J,Re]=v(""),[Je,Gt]=v(""),[_t,bo]=v(""),[xe,de]=v({col:null,dir:"asc"}),[Vr,vo]=v(""),[xo,cn]=v(""),[Hr,pn]=v("");G(()=>{let u=new URL(window.location.href);oe.col?(u.searchParams.set("sort",oe.col),u.searchParams.set("dir",oe.dir)):(u.searchParams.delete("sort"),u.searchParams.delete("dir")),$e?u.searchParams.set("preset",$e):u.searchParams.delete("preset"),history.replaceState(null,"",u.toString())},[oe,$e]);let Gr=u=>{jr(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},os=u=>{ut(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Xi=u=>{go(R=>R===u?"":u)},Yi=()=>l.fetchNextPage(),el=()=>c.fetchNextPage(),tl=()=>d.fetchNextPage(),rl=()=>m.fetchNextPage(),dn=u=>{u==="http"?l.refetch():u==="jobs"?c.refetch():u==="console"?d.refetch():u==="tests"?m.refetch():u==="outbound"?f.refetch():u==="env"&&y.refetch()},Tt=u=>{if(u===n){dn(u);return}a(u);let R=new URL(window.location.href);R.searchParams.set("section",u),history.pushState(null,"",R.toString()),Vt(""),it(""),yo(""),cr(""),go(""),jr({col:null,dir:"asc"}),$r(""),pt(""),D(""),ut({col:null,dir:"asc"}),q(""),Re(""),Ir({col:null,dir:"asc"}),Gt(""),bo(""),de({col:null,dir:"asc"}),vo(""),cn(""),pn("")},_o=u=>{Dt(u).then(R=>{if(!R){window.prompt("Copy is not available here. Select the token and copy it:",u);return}Ie(u),setTimeout(()=>Ie(null),1500)})},ol=u=>h({id:u}).then(()=>l.refetch()),sl=u=>{Qe(R=>{let N=new Set(R);return N.has(u)?N.delete(u):N.size<2&&N.add(u),N})},nl=u=>b({id:u}).then(()=>c.refetch()),al=u=>w({id:u}).then(()=>d.refetch()),il=u=>A({id:u}).then(()=>m.refetch()),ll=()=>{window.confirm("Delete all HTTP profiles?")&&g().then(()=>l.refetch())},ul=()=>{window.confirm("Delete all job profiles?")&&x().then(()=>c.refetch())},cl=()=>{window.confirm("Delete all console profiles?")&&C().then(()=>d.refetch())},pl=()=>{window.confirm("Delete all test profiles?")&&k().then(()=>m.refetch())},ss=()=>{window.confirm("Delete all HTTP, job and console profiles?")&&Promise.all([g(),x(),C()]).then(()=>{l.refetch(),c.refetch(),d.refetch()})},Br=()=>dn(n),ns=u=>{Ir(R=>R.col===u?{col:u,dir:R.dir==="asc"?"desc":"asc"}:{col:u,dir:"asc"})},Bt=u=>`tab${n===u?" active":""}`,To=K.filter(u=>{if(Le&&!u.path.toLowerCase().includes(Le.toLowerCase())||pe&&u.method!==pe)return!1;if(lt){let R=parseInt(lt);if(!(u.status>=R&&u.status<R+100))return!1}return!(Ht&&(Ht==="lt100"?u.duration>=100:u.duration<parseInt(Ht))||$e==="slow"&&u.duration<500||$e==="many_queries"&&(u.collectors_data?.database?.total_queries??0)<=20||$e==="errors"&&u.status<500||$e==="has_exception"&&!u.collectors_data?.exception)}),dl=oe.col?[...To].sort((u,R)=>{if(oe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return oe.dir==="asc"?Ve:-Ve}let N,re;switch(oe.col){case"duration":N=u.duration,re=R.duration;break;case"memory":N=Te(u)??0,re=Te(R)??0;break;case"status":N=u.status,re=R.status;break;case"queries":N=u.collectors_data?.database?.total_queries??0,re=R.collectors_data?.database?.total_queries??0;break;default:return 0}return oe.dir==="asc"?N-re:re-N}):To,wo=U.filter(u=>!(pr&&!u.path.toLowerCase().includes(pr.toLowerCase())||ct&&_i(u)!==ct||_&&(_==="lt100"?u.duration>=100:u.duration<parseInt(_)))),fl=ge.col?[...wo].sort((u,R)=>{if(ge.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return ge.dir==="asc"?Ve:-Ve}let N,re;switch(ge.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return ge.dir==="asc"?N-re:re-N}):wo,as=T.filter(u=>{if(Vr&&!u.url.toLowerCase().includes(Vr.toLowerCase())||xo&&u.method!==xo)return!1;if(Hr)if(Hr==="error"){if(u.status!==0)return!1}else{let R=parseInt(Hr);if(!(u.status>=R&&u.status<R+100))return!1}return!0}),Co=L.filter(u=>!(O&&!u.path.toLowerCase().includes(O.toLowerCase())||J==="error"&&u.status!==500||J==="ok"&&u.status===500)),ml=ve.col?[...Co].sort((u,R)=>{if(ve.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return ve.dir==="asc"?Ve:-Ve}let N,re;switch(ve.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return ve.dir==="asc"?N-re:re-N}):Co,Eo=j.filter(u=>!(Je&&!(u.collectors_data?.test?.test_name||u.path).toLowerCase().includes(Je.toLowerCase())||_t==="failed"&&u.status!==500||_t==="passed"&&u.status===500||_t==="pending"&&u.collectors_data?.test?.status!=="pending")),hl=xe.col?[...Eo].sort((u,R)=>{let N,re;if(xe.col==="date"){let Ve=new Date(u.started_at).getTime()-new Date(R.started_at).getTime();return xe.dir==="asc"?Ve:-Ve}switch(xe.col){case"duration":N=u.duration,re=R.duration;break;case"status":N=u.status,re=R.status;break;default:return 0}return xe.dir==="asc"?N-re:re-N}):Eo,fn=!!(Le||pe||lt||Ht||$e),mn=!!(pr||ct||_),hn=!!(O||J),yn=!!(Je||_t),yl=!!(Vr||xo||Hr),Se=(u,R,N)=>u!==N?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:R==="asc"?"\u25B2":"\u25BC"});return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("span",{class:"h1-emoji",children:"\u{1F50D}"})," Rails Profiler"]}),t("p",{children:"Recent profiled requests and jobs"}),e&&t("span",{class:"profiler-version-badge",children:["v",e]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:Bt("http"),onClick:u=>{u.preventDefault(),Tt("http")},children:"HTTP Requests"}),t("a",{href:"#",class:Bt("jobs"),onClick:u=>{u.preventDefault(),Tt("jobs")},children:"Background Jobs"}),t("a",{href:"#",class:Bt("console"),onClick:u=>{u.preventDefault(),Tt("console")},children:"Console"}),t("a",{href:"#",class:Bt("tests"),onClick:u=>{u.preventDefault(),Tt("tests")},children:"Tests"}),t("div",{style:"flex: 1"}),t("a",{href:"#",class:Bt("runner"),onClick:u=>{u.preventDefault(),Tt("runner")},children:"Test Runner"}),t("a",{href:"#",class:Bt("outbound"),onClick:u=>{u.preventDefault(),Tt("outbound")},children:"Outbound HTTP"}),t("a",{href:"#",class:Bt("env"),onClick:u=>{u.preventDefault(),Tt("env")},children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[n==="http"&&($?t(Ur,{cols:["sm","xs","flex","sm","sm","sm","xs","sm"]}):Fe?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Fe})}):K.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No profiles found"}),t("p",{class:"profiler-empty__description",children:"Make some requests to your application to see profiling data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-2",children:t("div",{class:"profiler-filter-group",children:Ti.map(u=>t("button",{class:`profiler-preset-btn${$e===u.key?" profiler-preset-btn--active":""}`,onClick:()=>Xi(u.key),children:u.label},u.key))})}),t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search path\u2026",value:Le,onInput:u=>Vt(u.target.value)}),t("select",{class:"profiler-filter-select",value:pe,onChange:u=>it(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:lt,onChange:u=>yo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"})]}),t("select",{class:"profiler-filter-select",value:Ht,onChange:u=>cr(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[fn&&t("span",{class:"profiler-filter-count",children:[To.length," / ",K.length]}),Ee.size===2&&t("a",{class:"btn btn-secondary btn-sm",href:`${Kr}/compare?a=${encodeURIComponent(Array.from(Ee)[0])}&b=${encodeURIComponent(Array.from(Ee)[1])}`,children:"Compare 2 profiles"}),Ee.size===1&&t("span",{class:"profiler-text--xs profiler-text--muted",children:"Select 1 more to compare"}),t("button",{class:`btn-refresh${$?" btn-refresh--spinning":""}`,onClick:Br,disabled:$,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ll,title:"Delete HTTP profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),To.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{style:"width:32px"}),t("th",{class:`sortable${oe.col==="date"?" sortable--active":""}`,onClick:()=>Gr("date"),children:["Time ",Se(oe.col,oe.dir,"date")]}),t("th",{children:"Method"}),t("th",{children:"Path"}),t("th",{class:`sortable${oe.col==="duration"?" sortable--active":""}`,onClick:()=>Gr("duration"),children:["Duration ",Se(oe.col,oe.dir,"duration")]}),t("th",{class:`sortable${oe.col==="queries"?" sortable--active":""}`,onClick:()=>Gr("queries"),children:["Queries ",Se(oe.col,oe.dir,"queries")]}),t("th",{class:`sortable${oe.col==="memory"?" sortable--active":""}`,onClick:()=>Gr("memory"),title:ot,children:["Allocations ",Se(oe.col,oe.dir,"memory")]}),t("th",{class:`sortable${oe.col==="status"?" sortable--active":""}`,onClick:()=>Gr("status"),children:["Status ",Se(oe.col,oe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:dl.map(u=>{let R=Ee.has(u.token),N=!R&&Ee.size>=2;return t("tr",{class:R?"profiler-row--selected":"",children:[t("td",{children:t("input",{type:"checkbox",checked:R,disabled:N,onChange:()=>sl(u.token),title:N?"Deselect another profile first":"Select for comparison"})}),t("td",{children:po(u.started_at)}),t("td",{children:t("span",{class:Mc(u.method),children:u.method})}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:rt(Te(u))}),t("td",{children:t("span",{class:Fc(u.status),children:u.status})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>ol(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),qe&&!fn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:Yi,disabled:Ce,children:Ce?"Loading\u2026":"Load more"})})]})),n==="jobs"&&(Z?t(Ur,{cols:["sm","flex","md","sm","xs","xs","sm"]}):Ne?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:Ne})}):U.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No job profiles found"}),t("p",{class:"profiler-empty__description",children:"Run background jobs in your application to see profiling data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search job class\u2026",value:pr,onInput:u=>$r(u.target.value)}),t("select",{class:"profiler-filter-select",value:ct,onChange:u=>pt(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"running",children:"Running"}),t("option",{value:"completed",children:"Completed"}),t("option",{value:"failed",children:"Failed"})]}),t("select",{class:"profiler-filter-select",value:_,onChange:u=>D(u.target.value),children:[t("option",{value:"",children:"All Durations"}),t("option",{value:"lt100",children:"<100ms"}),t("option",{value:"100",children:"\u2265100ms"}),t("option",{value:"500",children:"\u2265500ms"})]})]}),t("div",{class:"profiler-filter-group",children:[mn&&t("span",{class:"profiler-filter-count",children:[wo.length," / ",U.length]}),t("button",{class:`btn-refresh${Z?" btn-refresh--spinning":""}`,onClick:Br,disabled:Z,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:ul,title:"Delete job profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all HTTP and job profiles",children:"Clear All"})]})]}),wo.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ge.col==="date"?" sortable--active":""}`,onClick:()=>os("date"),children:["Time ",Se(ge.col,ge.dir,"date")]}),t("th",{children:"Job Class"}),t("th",{children:"Queue"}),t("th",{class:`sortable${ge.col==="duration"?" sortable--active":""}`,onClick:()=>os("duration"),children:["Duration ",Se(ge.col,ge.dir,"duration")]}),t("th",{class:`sortable${ge.col==="status"?" sortable--active":""}`,onClick:()=>os("status"),children:["Status ",Se(ge.col,ge.dir,"status")]}),t("th",{children:"Executions"}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:fl.map(u=>{let R=u.collectors_data?.job,N=_i(u);return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,children:u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--mono",children:R?.queue||"-"})}),t("td",{children:N==="running"?t("span",{class:"profiler-text--muted",children:"-"}):t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:N==="running"?t("span",{class:"badge-info",children:[t("span",{class:"profiler-spinner","aria-hidden":"true",children:"\u25D0"})," Running"]}):t("span",{class:N==="failed"?"badge-error":"badge-success",children:N==="failed"?"\u2717 Failed":"\u2713 Completed"})}),t("td",{children:R?.executions??"-"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>nl(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),nt&&!mn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:el,disabled:at,children:at?"Loading\u2026":"Load more"})})]})),n==="console"&&(B?t(Ur,{cols:["sm","flex","sm","sm","xs","sm"]}):je?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:je})}):L.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No console profiles found"}),t("p",{class:"profiler-empty__description",children:["Run expressions in ",t("code",{children:"rails console"})," to see profiling data"]})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search expression\u2026",value:O,onInput:u=>q(u.target.value)}),t("select",{class:"profiler-filter-select",value:J,onChange:u=>Re(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"ok",children:"OK"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[hn&&t("span",{class:"profiler-filter-count",children:[Co.length," / ",L.length]}),t("button",{class:`btn-refresh${B?" btn-refresh--spinning":""}`,onClick:Br,disabled:B,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:cl,title:"Delete console profiles",children:"Clear"}),t("button",{class:"btn btn-danger btn-sm",onClick:ss,title:"Delete all profiles",children:"Clear All"})]})]}),Co.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${ve.col==="date"?" sortable--active":""}`,onClick:()=>ns("date"),children:["Time ",Se(ve.col,ve.dir,"date")]}),t("th",{children:"Expression"}),t("th",{class:`sortable${ve.col==="duration"?" sortable--active":""}`,onClick:()=>ns("duration"),children:["Duration ",Se(ve.col,ve.dir,"duration")]}),t("th",{children:"SQL"}),t("th",{class:`sortable${ve.col==="status"?" sortable--active":""}`,onClick:()=>ns("status"),children:["Status ",Se(ve.col,ve.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:ml.map(u=>{let R=u.status===500;return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{children:[t("a",{href:`${Kr}/profiles/${u.token}`,class:"profiler-text--mono",style:"font-size:0.85em;",children:u.path.length>60?u.path.slice(0,60)+"\u2026":u.path}),u.gem_version&&u.gem_version!==e&&t("span",{class:"profiler-version-warn",title:`Captur\xE9 avec v${u.gem_version} (actuel : v${e})`,children:"\u26A0\uFE0F"})]}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:R?"badge-error":"badge-success",children:R?"\u2717 Error":"\u2713 OK"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>al(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),P&&!hn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:tl,disabled:ur,children:ur?"Loading\u2026":"Load more"})})]})),n==="tests"&&(ce?t(Ur,{cols:["sm","flex","md","sm","xs","sm"]}):De?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:De})}):j.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No test profiles found"}),t("p",{class:"profiler-empty__description",children:["Add ",t("code",{children:"Profiler::TestHelpers::RSpecSupport.install(config)"})," to your spec_helper.rb and run your tests. Or use the ",t("a",{href:"#",style:"color:var(--profiler-accent,#06b6d4)",onClick:u=>{u.preventDefault(),Tt("runner")},children:"Test Runner"})," tab to run tests from here."]})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search test name\u2026",value:Je,onInput:u=>Gt(u.target.value)}),t("select",{class:"profiler-filter-select",value:_t,onChange:u=>bo(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"passed",children:"Passed"}),t("option",{value:"failed",children:"Failed"}),t("option",{value:"pending",children:"Pending"})]})]}),t("div",{class:"profiler-filter-group",children:[yn&&t("span",{class:"profiler-filter-count",children:[Eo.length," / ",j.length]}),t("button",{class:`btn-refresh${ce?" btn-refresh--spinning":""}`,onClick:Br,disabled:ce,title:"Refresh",children:"\u21BA"}),t("button",{class:"btn btn-danger btn-sm",onClick:pl,title:"Delete test profiles",children:"Clear All"})]})]}),Eo.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{class:`sortable${xe.col==="date"?" sortable--active":""}`,onClick:()=>de(u=>({col:"date",dir:u.col==="date"&&u.dir==="asc"?"desc":"asc"})),children:["Time ",Se(xe.col,xe.dir,"date")]}),t("th",{children:"Test Name"}),t("th",{children:"File"}),t("th",{class:`sortable${xe.col==="duration"?" sortable--active":""}`,onClick:()=>de(u=>({col:"duration",dir:u.col==="duration"&&u.dir==="asc"?"desc":"asc"})),children:["Duration ",Se(xe.col,xe.dir,"duration")]}),t("th",{children:"Queries"}),t("th",{class:`sortable${xe.col==="status"?" sortable--active":""}`,onClick:()=>de(u=>({col:"status",dir:u.col==="status"&&u.dir==="asc"?"desc":"asc"})),children:["Status ",Se(xe.col,xe.dir,"status")]}),t("th",{children:"Token"}),t("th",{})]})}),t("tbody",{children:hl.map(u=>{let R=u.collectors_data?.test,N=u.status===500,re=R?.status||(N?"failed":"passed");return t("tr",{children:[t("td",{children:po(u.started_at)}),t("td",{style:"max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap",children:t("a",{href:`${Kr}/profiles/${u.token}`,title:R?.test_name||u.path,children:R?.test_name||u.path})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:R?.test_file||"-"}),t("td",{children:t("span",{class:Zo(u.duration),children:[u.duration.toFixed(2)," ms"]})}),t("td",{children:u.collectors_data?.database?.total_queries??"-"}),t("td",{children:t("span",{class:re==="failed"?"badge-error":re==="pending"?"badge-warning":"badge-success",children:re==="failed"?"\u2717 Failed":re==="pending"?"\u23F8 Pending":"\u2713 Passed"})}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:t("button",{class:"token-copy",onClick:()=>_o(u.token),title:"Copy full token",children:W===u.token?"\u2713":u.token.substring(0,8)+"\u2026"})}),t("td",{children:t("button",{class:"btn-row-delete",onClick:()=>il(u.token),title:"Delete",children:"\xD7"})})]},u.token)})})]}),H&&!yn&&t("div",{class:"profiler-load-more",children:t("button",{class:"btn btn-secondary",onClick:rl,disabled:Q,children:Q?"Loading\u2026":"Load more"})})]})),n==="runner"&&t(Wo,{}),n==="outbound"&&(fe?t(Ur,{cols:["sm","xs","flex","sm","xs"],rows:4}):be?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:be})}):T.length===0?t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__title",children:"No outbound HTTP requests found"}),t("p",{class:"profiler-empty__description",children:"Make requests to external services to see outbound HTTP data"})]}):t(M,{children:[t("div",{class:"profiler-action-bar profiler-mb-3",children:[t("div",{class:"profiler-filter-group",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search URL\u2026",value:Vr,onInput:u=>vo(u.target.value)}),t("select",{class:"profiler-filter-select",value:xo,onChange:u=>cn(u.target.value),children:[t("option",{value:"",children:"All Methods"}),t("option",{value:"GET",children:"GET"}),t("option",{value:"POST",children:"POST"}),t("option",{value:"PUT",children:"PUT"}),t("option",{value:"PATCH",children:"PATCH"}),t("option",{value:"DELETE",children:"DELETE"})]}),t("select",{class:"profiler-filter-select",value:Hr,onChange:u=>pn(u.target.value),children:[t("option",{value:"",children:"All Statuses"}),t("option",{value:"200",children:"2xx"}),t("option",{value:"300",children:"3xx"}),t("option",{value:"400",children:"4xx"}),t("option",{value:"500",children:"5xx"}),t("option",{value:"error",children:"Error"})]})]}),t("div",{class:"profiler-filter-group",children:[yl&&t("span",{class:"profiler-filter-count",children:[as.length," / ",T.length]}),t("button",{class:`btn-refresh${fe?" btn-refresh--spinning":""}`,onClick:Br,disabled:fe,title:"Refresh",children:"\u21BA"})]})]}),t("p",{class:"profiler-text--xs profiler-text--muted profiler-mb-3",children:[T.length," outbound request",T.length!==1?"s":""," across all profiles. Click a request to expand headers and body."]}),as.length===0?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"No results match filters"})}):as.map((u,R)=>t("div",{style:"margin-bottom:4px",children:[t("div",{class:"profiler-text--xs profiler-text--muted",style:"margin-bottom:2px",children:[po(u.profile_started_at)," \xB7 Profile: ",t("a",{href:`${Kr}/profiles/${u.profile_token}`,children:[u.profile_token.substring(0,8),"\u2026"]})]}),t(Zs,{req:u,index:R,threshold:500})]},R))]})),n==="env"&&(Y?t(Ur,{cols:["sm","flex","sm","sm"],rows:8}):we?t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:we})}):t(st,{envData:F}))]})]})]})}function Ci(){let{data:e}=Da({query:{retry:!1,refetchOnWindowFocus:!1}}),r=e?.slaves??[],o=qa();return r.length===0?null:t("div",{class:"profiler-selector",style:{display:"flex",alignItems:"center",gap:"8px",padding:"4px 12px",background:"var(--profiler-bg-secondary, #f5f5f5)",borderBottom:"1px solid var(--profiler-border, #e0e0e0)"},children:[t("span",{style:{fontSize:"12px",fontWeight:600,color:"var(--profiler-text-secondary, #666)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Profiler"}),t("select",{value:o??"__local__",onChange:a=>{let i=a.target.value;Oa(i==="__local__"?null:i)},style:{fontSize:"13px",padding:"2px 6px",borderRadius:"4px",border:"1px solid var(--profiler-border, #ccc)",background:"var(--profiler-bg, #fff)",color:"var(--profiler-text, #333)",cursor:"pointer"},children:[t("option",{value:"__local__",children:"Local (master)"}),r.map(a=>t("option",{value:a.name,disabled:a.status==="offline",children:[a.name," ",a.status==="offline"?"(offline)":""]},a.name))]}),o&&t("span",{style:{fontSize:"11px",color:"var(--profiler-text-secondary, #888)",fontStyle:"italic"},children:"Viewing slave data via proxy"})]})}function qc(e){let r=e.headers??{},o=e.params??{},s=e.request_body,n=[`curl -X ${e.method}`];Object.entries(r).filter(([i])=>i!=="User-Agent").forEach(([i,l])=>n.push(` -H '${i}: ${l}'`)),["POST","PUT","PATCH"].includes(e.method)&&(s&&s.length>0?n.push(` -d '${s.replace(/'/g,"'\\''")}'`):Object.keys(o).length>0&&((r["Content-Type"]??"").includes("application/json")?n.push(` -d '${JSON.stringify(o).replace(/'/g,"'\\''")}'`):Object.entries(o).forEach(([l,c])=>n.push(` --data-urlencode '${l}=${c}'`))));let a=`http://localhost:3000${e.path}`;return e.method==="GET"&&Object.keys(o).length>0&&(a+="?"+Object.entries(o).map(([i,l])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(l))}`).join("&")),n.push(` '${a}'`),n.join(` \\
12
+ `)}function Oc(e,r){let o=[],s=(a,i,l,c)=>{if(i){let d=l!=null?`${c?"at least ":""}${l.toLocaleString("en")} bytes, `:"";o.push(`${a} body truncated: ${d}only the beginning was kept (max_captured_body_bytes).`)}};s("Request",e.request_body_truncated??r.request_body_truncated,e.request_body_size??r.request_body_size,e.request_body_size_is_minimum??r.request_body_size_is_minimum),s("Response",e.response_body_truncated??r.response_body_truncated,e.response_body_size??r.response_body_size,e.response_body_size_is_minimum??r.response_body_size_is_minimum);let n=e.collectors_released_after_seconds??r.collectors_released_after_seconds;return n!=null&&o.push(`Incomplete profile: the collectors of this stream were released after ${n} s, before the server closed it; what it did later is missing.`),o}var Dc=["POST","PUT","PATCH","DELETE"];function Qc({profile:e}){let{mutateAsync:r,isPending:o}=Ya(),[s,n]=v(null),[a,i]=v(null);return t("div",{class:"profiler-ajax-card__row",children:[t("button",{class:"profiler-btn profiler-btn--sm",disabled:o,onClick:async()=>{let c=Dc.includes(e.method)?`
13
13
 
14
- ${e.method} requests usually change data: the replay will really do it.`:"",d=`Replay ${e.method} ${e.path} against the application for real?${c}`;if(window.confirm(d)){i(null),n(null);try{n(await r({id:e.token,data:{}}))}catch(m){i(m instanceof Error?m.message:String(m))}}},children:o?"Replaying\u2026":"\u21BB Replay request"}),a&&t("span",{class:"profiler-text--xs profiler-text--error",style:"margin-left:8px",children:a}),s&&s.replays.map(c=>t("span",{class:"profiler-text--xs",style:"margin-left:8px",children:c.error?c.error:c.token?t("a",{href:`/_profiler/profiles/${c.token}?tab=request`,children:[c.status," \xB7 open the new profile"]}):`${c.status} (not profiled)`},c.index))]})}function Ei({profile:e}){let r=e.collectors_data?.request??{},o=e.params&&Object.keys(e.params).length>0,s=qc(e,r);return t("div",{class:"profiler-ajax-card profiler-ajax-card--success",style:"margin-bottom:8px;background:var(--profiler-bg-elevated);transform:translateX(3px);box-shadow:var(--profiler-shadow-sm);transition:none",children:[t(zo,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:Fc(e)}),e.replay_of&&t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--muted",children:["Replay of ",t("a",{href:`/_profiler/profiles/${e.replay_of}?tab=request`,children:e.replay_of})]}),t(Dc,{profile:e}),(r.controller_action||r.route_pattern)&&t("div",{class:"profiler-ajax-card__row",children:[r.controller_action&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-right:16px",children:r.controller_action}),r.route_pattern&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"font-family:monospace",children:[r.route_name?`${r.route_name} \xB7 `:"",r.route_pattern]})]}),s.map(n=>t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--warning",children:n},n)),t(Jo,{request:{headers:e.headers??{},body:e.request_body??void 0,body_encoding:e.request_body_encoding,params:o?e.params:void 0},response:{headers:e.response_headers??{},body:e.response_body??void 0,body_encoding:e.response_body_encoding}})]})}function Qc(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function Lc(e){let r=new Map;e.forEach((s,n)=>{if(s.cached||s.transaction)return;let a=Qc(s.sql);r.has(a)||r.set(a,{indices:[],backtrace:s.backtrace??[]}),r.get(a).indices.push(n)});let o=[];return r.forEach(({indices:s,backtrace:n},a)=>{s.length>=3&&o.push({pattern:a,indices:s,backtrace:n})}),o.sort((s,n)=>n.indices.length-s.indices.length)}function Ri(e,r=0){let o=e["Node Type"]??"",s=e["Actual Rows"]??0,n=e["Plan Rows"]??1,a=o.includes("Seq Scan")||o.includes("Hash Join")||o.includes("Nested Loop")||o.includes("Filter")||s>0&&n>0&&s>n*10,i=e.Plans??[];return t("div",{class:`profiler-explain-node${a?" profiler-explain-node--expensive":""}`,style:`margin-left:${r*14}px`,children:[t("span",{class:"profiler-explain-node__type",children:o}),e["Relation Name"]&&t("span",{class:"profiler-text--muted",children:[" on ",e["Relation Name"]]}),e["Index Name"]&&t("span",{class:"profiler-text--muted",children:[" using ",e["Index Name"]]}),t("div",{class:"profiler-explain-node__stats profiler-text--xs profiler-text--muted",children:[e["Actual Total Time"]!=null&&t("span",{children:["time: ",e["Actual Total Time"].toFixed(3),"ms"]}),e["Actual Rows"]!=null&&t("span",{children:["rows: ",s," (est: ",n,")"]}),e["Total Cost"]!=null&&t("span",{children:["cost: ",e["Total Cost"].toFixed(2)]}),e.Filter&&t("span",{class:"profiler-text--warning",children:["filter: ",e.Filter]})]}),i.map((l,c)=>Ri(l,r+1))]})}function Kc({state:e,onClose:r}){if(G(()=>{if(!e.open)return;let s=n=>{n.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e.open]),!e.open)return null;let o=()=>{if(e.loading)return t("div",{class:"profiler-text--muted",children:"Running EXPLAIN ANALYZE\u2026"});if(e.error)return t("div",{class:"profiler-text--error",children:e.error});if(!e.result)return null;if(e.format==="json")try{let s=typeof e.result=="string"?JSON.parse(e.result):e.result,n=Array.isArray(s)?s:[s];return t("div",{class:"profiler-explain-result",children:n.map((a,i)=>t("div",{children:[Ri(a.Plan??a),a["Planning Time"]!=null&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:["Planning: ",a["Planning Time"].toFixed(3),"ms",a["Execution Time"]!=null&&t(M,{children:[" \xB7 Execution: ",a["Execution Time"].toFixed(3),"ms"]})]})]},i))})}catch{return t("pre",{class:"profiler-explain-result",children:String(e.result)})}return t("pre",{class:"profiler-explain-result",children:String(e.result)})};return t("div",{class:"profiler-modal__overlay",onClick:r,children:t("div",{class:"profiler-modal",onClick:s=>s.stopPropagation(),children:[t("div",{class:"profiler-modal__header",children:[t("span",{class:"profiler-modal__title",children:"EXPLAIN ANALYZE"}),t("span",{class:"profiler-text--xs profiler-text--muted",children:e.adapter}),t("button",{class:"profiler-modal__close",onClick:r,children:"\xD7"})]}),t("div",{class:"profiler-modal__body",children:o()})]})})}function Qt({dbData:e,token:r}){let[o,s]=v(new Set),[n,a]=v({open:!1,loading:!1,result:null,format:"text",adapter:"",error:null}),{mutateAsync:i}=$a();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=Lc(e.queries),c=new Set(l.flatMap(y=>y.indices)),d=y=>{s(h=>{let g=new Set(h);return g.has(y)?g.delete(y):g.add(y),g})},m=async y=>{a({open:!0,loading:!0,result:null,format:"text",adapter:"",error:null});try{let h=await i({data:{token:r,query_index:y}});a(g=>({...g,loading:!1,result:h.result,format:h.format??"text",adapter:h.adapter??""}))}catch(h){a(g=>({...g,loading:!1,error:h.message??"Request failed"}))}},f=()=>a(y=>({...y,open:!1}));return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Database Queries (",e.total_queries,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]}),t("span",{children:["Slow Queries: ",t("strong",{class:"profiler-text--error",children:e.slow_queries})]}),t("span",{children:["Cached: ",t("strong",{children:e.cached_queries})]})]}),l.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:"flex:1",children:[t("strong",{children:"Potential N+1 detected"})," - ",l.length," pattern",l.length>1?"s":""," repeated ",l.reduce((y,h)=>y+h.indices.length,0)," times total",t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:"Queries causing N+1 are highlighted below. Expand each group to see the call stack."})]}),l.length>1&&t("button",{class:"profiler-btn profiler-btn--sm",style:"flex-shrink:0;align-self:flex-start",onClick:()=>{let y=l.every(h=>o.has(h.pattern));s(y?new Set:new Set(l.map(h=>h.pattern)))},children:l.every(y=>o.has(y.pattern))?"Collapse all":"Expand all"})]}),l.map(y=>t("div",{class:"profiler-n1-group profiler-mb-4",children:[t("div",{class:"profiler-n1-group__header",onClick:()=>d(y.pattern),children:[t("span",{class:"profiler-n1-group__count",children:["N+1 \xB7 ",y.indices.length,"\xD7"]}),t("code",{class:"profiler-n1-group__pattern",children:y.pattern}),t("span",{class:"profiler-n1-group__toggle",children:[o.has(y.pattern)?"\u25B2":"\u25BC"," backtrace"]})]}),o.has(y.pattern)&&y.backtrace.length>0&&t("div",{class:"profiler-n1-backtrace",children:y.backtrace.map((h,g)=>t("div",{class:"profiler-n1-backtrace__frame",children:t(vt,{frame:h})},g))})]},y.pattern)),e.queries.map((y,h)=>t("div",{class:["profiler-query-card",y.slow?"profiler-query-card--slow":"",c.has(h)?"profiler-query-card--n1":""].filter(Boolean).join(" "),children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:"profiler-text--muted",children:["#",h+1]}),c.has(h)&&t("span",{class:"profiler-badge profiler-badge--warning",children:"N+1"}),y.name&&t("span",{class:"profiler-text--xs profiler-text--muted",children:y.name})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`profiler-query-card__duration ${y.slow?"profiler-query-card__duration--slow":"profiler-query-card__duration--fast"}`,children:[y.duration.toFixed(2)," ms"]}),!y.cached&&!y.transaction&&t("button",{class:"profiler-btn profiler-btn--sm",onClick:()=>m(h),children:"Explain"})]})]}),t("code",{class:"profiler-query-card__code",children:y.sql})]},h)),t(Kc,{state:n,onClose:f})]})}function Lt({dumpData:e}){return e?.dumps?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Dumped Variables (",e.count,")"]}),e.dumps.map((r,o)=>t("div",{class:"profiler-dump-card",children:[t("div",{class:"profiler-dump-card__header",children:[t("div",{children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["#",o+1]}),r.label&&t("span",{class:"profiler-dump-card__label",children:r.label})]}),t("div",{children:[t("div",{class:"profiler-dump-card__location",children:t(ir,{file:r.file,line:r.line})}),t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:new Date(r.timestamp).toLocaleTimeString("en",{hour12:!1})})]})]}),t("div",{class:"profiler-dump-card__content",children:t("pre",{children:r.formatted})})]},o))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F50D}"}),t("h3",{class:"profiler-empty__title",children:"No dumps recorded"}),t("div",{class:"profiler-empty__description",children:[t("p",{children:["Use ",t("code",{children:"Profiler.dump(variable)"})," in your code to dump variables here."]}),t("p",{class:"profiler-mt-3",children:["Example: ",t("code",{children:'Profiler.dump(@user, "Current user")'})]})]})]})}var Uc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},xt=24,Nc=1,en=xt+Nc,jc=60,Ic=300,fo=class{constructor(r,o,s){this.frames=[];this.maxDepth=0;this.globalStart=0;this.globalEnd=0;this.viewport={start:0,end:0};this.targetViewport={start:0,end:0};this.animating=!1;this.animStart=0;this.prevViewport={start:0,end:0};this.dpr=1;this.hoveredFrame=null;this.zoomStack=[];this.searchQuery="";this.highlightName="";this.isPanning=!1;this.panStartX=0;this.panStartViewport={start:0,end:0};this.boundHandlers={};this.canvas=r,this.ctx=r.getContext("2d"),this.callbacks=s,this.flatten(o),this.computeGlobalBounds(),this.viewport={start:this.globalStart,end:this.globalEnd},this.targetViewport={...this.viewport},this.setupCanvas(),this.bindEvents(),this.render()}flatten(r){this.frames=[],this.maxDepth=0;let o=(s,n)=>{for(let a of s)this.frames.push({node:a,depth:n,absStart:a.started_at,absEnd:a.finished_at}),n>this.maxDepth&&(this.maxDepth=n),a.children?.length&&o(a.children,n+1)};o(r,0)}computeGlobalBounds(){if(this.frames.length===0){this.globalStart=0,this.globalEnd=1;return}this.globalStart=Math.min(...this.frames.map(r=>r.absStart)),this.globalEnd=Math.max(...this.frames.map(r=>r.absEnd)),this.globalEnd<=this.globalStart&&(this.globalEnd=this.globalStart+1)}setupCanvas(){this.dpr=window.devicePixelRatio||1,this.resizeCanvas()}resizeCanvas(){let o=this.canvas.getBoundingClientRect().width,s=(this.maxDepth+1)*en+8;this.canvas.width=o*this.dpr,this.canvas.height=s*this.dpr,this.canvas.style.height=`${s}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.render()}bindEvents(){this.boundHandlers.mousemove=r=>this.onMouseMove(r),this.boundHandlers.mouseleave=()=>this.onMouseLeave(),this.boundHandlers.click=r=>this.onClickEvent(r),this.boundHandlers.wheel=r=>this.onWheel(r),this.boundHandlers.mousedown=r=>this.onMouseDown(r),this.boundHandlers.mouseupmove=r=>this.onMouseUpOrMove(r),this.boundHandlers.mouseup=()=>this.onMouseUp(),this.canvas.addEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.addEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.addEventListener("click",this.boundHandlers.click),this.canvas.addEventListener("wheel",this.boundHandlers.wheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.boundHandlers.mousedown),window.addEventListener("mousemove",this.boundHandlers.mouseupmove),window.addEventListener("mouseup",this.boundHandlers.mouseup)}hitTest(r,o){let s=this.canvas.getBoundingClientRect(),n=r-s.left,a=o-s.top,i=s.width,l=this.viewport.end-this.viewport.start;for(let c=this.frames.length-1;c>=0;c--){let d=this.frames[c],m=(d.absStart-this.viewport.start)/l*i,f=(d.absEnd-d.absStart)/l*i,y=d.depth*en;if(n>=m&&n<=m+f&&a>=y&&a<=y+xt)return d}return null}onMouseMove(r){if(this.isPanning)return;let o=this.hitTest(r.clientX,r.clientY);this.hoveredFrame=o,this.canvas.style.cursor=o?"pointer":"default",this.callbacks.onHover(o,r.clientX,r.clientY),this.render()}onMouseLeave(){this.hoveredFrame=null,this.canvas.style.cursor="default",this.callbacks.onHover(null,0,0),this.render()}onClickEvent(r){if(this.isPanning)return;let o=this.hitTest(r.clientX,r.clientY);o&&(this.callbacks.onClick(o),this.zoomTo(o.node))}onWheel(r){r.preventDefault();let o=this.canvas.getBoundingClientRect(),n=(r.clientX-o.left)/o.width,a=this.viewport.end-this.viewport.start,i=r.deltaY>0?1.3:.7,l=Math.min(this.globalEnd-this.globalStart,a*i),c=this.viewport.start+n*a,d=c-n*l,m=c+(1-n)*l;d<this.globalStart&&(d=this.globalStart,m=d+l),m>this.globalEnd&&(m=this.globalEnd,d=m-l),this.animateViewport({start:d,end:m}),this.updateZoomStack(d,m)}onMouseDown(r){r.button===0&&(this.isPanning=!0,this.panStartX=r.clientX,this.panStartViewport={...this.viewport},this.canvas.style.cursor="grabbing")}onMouseUpOrMove(r){if(!this.isPanning)return;let o=r.clientX-this.panStartX,s=this.canvas.getBoundingClientRect(),n=this.panStartViewport.end-this.panStartViewport.start,a=-(o/s.width)*n,i=this.panStartViewport.start+a,l=this.panStartViewport.end+a;i<this.globalStart&&(l+=this.globalStart-i,i=this.globalStart),l>this.globalEnd&&(i-=l-this.globalEnd,l=this.globalEnd),this.viewport={start:i,end:l},this.targetViewport={...this.viewport},this.render()}onMouseUp(){this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")}zoomTo(r){let o=[],s=(a,i,l)=>{for(let c of a){if(c===i)return o.push(...l,c),!0;if(c.children?.length&&s(c.children,i,[...l,c]))return!0}return!1},n=this.frames.filter(a=>a.depth===0).map(a=>a.node);s(n,r,[]),this.zoomStack=o,this.animateViewport({start:r.started_at,end:r.finished_at}),this.callbacks.onZoomChange(o)}resetZoom(){this.zoomStack=[],this.animateViewport({start:this.globalStart,end:this.globalEnd}),this.callbacks.onZoomChange([])}updateZoomStack(r,o){let s=this.globalEnd-this.globalStart;o-r>=s*.99&&(this.zoomStack=[],this.callbacks.onZoomChange([]))}animateViewport(r){this.prevViewport={...this.viewport},this.targetViewport=r,this.animStart=performance.now(),this.animating||(this.animating=!0,this.animLoop())}animLoop(){let r=Math.min(1,(performance.now()-this.animStart)/Ic),o=r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2;this.viewport={start:this.prevViewport.start+(this.targetViewport.start-this.prevViewport.start)*o,end:this.prevViewport.end+(this.targetViewport.end-this.prevViewport.end)*o},this.render(),r<1?requestAnimationFrame(()=>this.animLoop()):(this.animating=!1,this.viewport={...this.targetViewport},this.render())}setSearchQuery(r){this.searchQuery=r,this.render()}setHighlightName(r){this.highlightName=r,this.render()}render(){let r=this.ctx,o=this.canvas.width/this.dpr,s=this.canvas.height/this.dpr,n=this.viewport.end-this.viewport.start;r.clearRect(0,0,o,s);let a=getComputedStyle(this.canvas),i=a.getPropertyValue("--profiler-text").trim()||"#eef2f7",l=a.getPropertyValue("--profiler-text-muted").trim()||"#5e7080",c=this.searchQuery.toLowerCase(),d=c.length>0;if(d&&this.callbacks.onSearchResults){let m=0;for(let f of this.frames)f.node.name.toLowerCase().includes(c)&&m++;this.callbacks.onSearchResults(m,this.frames.length)}for(let m of this.frames){let f=(m.absStart-this.viewport.start)/n*o,y=(m.absEnd-m.absStart)/n*o,h=m.depth*en;if(f+y<0||f>o||y<.5)continue;let g=Uc[m.node.category]||"#a78bfa",b=m===this.hoveredFrame,x=!!this.highlightName&&m.node.name===this.highlightName,w=!d||m.node.name.toLowerCase().includes(c);if(r.fillStyle=b||x?this.lightenColor(g,.2):g,r.globalAlpha=d&&!w?.2:b||x?1:.85,this.roundRect(r,f,h,y,xt,3),r.fill(),r.globalAlpha=1,b?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,f,h,y,xt,3),r.stroke()):x?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,f,h,y,xt,3),r.stroke()):d&&w&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,f,h,y,xt,3),r.stroke(),r.globalAlpha=1),y>jc&&w){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let C=m.node.name,A=`${m.node.duration.toFixed(1)}ms`,k=y-8,K=r.measureText(A).width;if(k>K+20){let U=k-K-8;r.fillText(this.truncateText(r,C,U),f+4,h+xt/2),r.fillStyle=b?i:l,r.fillText(A,f+y-K-4,h+xt/2)}else r.fillText(this.truncateText(r,C,k),f+4,h+xt/2)}}}roundRect(r,o,s,n,a,i){r.beginPath(),r.moveTo(o+i,s),r.lineTo(o+n-i,s),r.quadraticCurveTo(o+n,s,o+n,s+i),r.lineTo(o+n,s+a-i),r.quadraticCurveTo(o+n,s+a,o+n-i,s+a),r.lineTo(o+i,s+a),r.quadraticCurveTo(o,s+a,o,s+a-i),r.lineTo(o,s+i),r.quadraticCurveTo(o,s,o+i,s),r.closePath()}truncateText(r,o,s){if(r.measureText(o).width<=s)return o;let n=o;for(;n.length>0&&r.measureText(n+"...").width>s;)n=n.slice(0,-1);return n.length>0?n+"...":""}lightenColor(r,o){let s=parseInt(r.slice(1),16),n=Math.min(255,(s>>16&255)+Math.round(255*o)),a=Math.min(255,(s>>8&255)+Math.round(255*o)),i=Math.min(255,(s&255)+Math.round(255*o));return`rgb(${n},${a},${i})`}getTextColor(r){let o=parseInt(r.slice(1),16),s=o>>16&255,n=o>>8&255,a=o&255;return(.299*s+.587*n+.114*a)/255>.5?"#1a1a2e":"#f0f0f0"}destroy(){this.canvas.removeEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.removeEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.removeEventListener("click",this.boundHandlers.click),this.canvas.removeEventListener("wheel",this.boundHandlers.wheel),this.canvas.removeEventListener("mousedown",this.boundHandlers.mousedown),window.removeEventListener("mousemove",this.boundHandlers.mouseupmove),window.removeEventListener("mouseup",this.boundHandlers.mouseup)}};var $c={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},Vc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function Hc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var mo=class{constructor(r,o){this.totalDuration=o,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__tooltip",r.appendChild(this.el)}show(r,o,s){let n=r.node,a=n.category,i=Vc[a]||"#a78bfa",l=$c[a]||a,c=this.totalDuration>0?(n.duration/this.totalDuration*100).toFixed(1):"0";this.el.textContent="";let d=document.createElement("div");if(d.className="tooltip-header",d.textContent=n.name,this.el.appendChild(d),this.addRow("Category",()=>{let h=document.createElement("span");return h.className="tooltip-badge",h.style.background=i,h.textContent=l,h}),this.addRow("Duration",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.duration.toFixed(2)} ms`,h}),this.addRow("% of total",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${c}%`,h}),a==="method"&&n.payload&&(n.payload.memory_bytes!=null&&this.addRow("Memory",()=>{let h=document.createElement("span");return h.className="value",h.textContent=Hc(n.payload.memory_bytes),h}),n.payload.allocated_objects!=null&&this.addRow("Objects",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.payload.allocated_objects.toLocaleString()} obj`,h}),n.payload.recursive&&this.addRow("Recursive",()=>{let h=document.createElement("span");return h.className="value",h.style.color="var(--profiler-warning)",h.textContent="\u21BA yes",h}),n.payload.file)){let h=document.createElement("div");h.className="tooltip-payload",h.textContent=`${n.payload.file}:${n.payload.line}`,this.el.appendChild(h)}if(n.payload&&a!=="method"){let h=null;if(a==="sql"&&n.payload.sql){let g=n.payload.sql;h=g.length>200?g.slice(0,200)+"...":g}else if(a==="cache"&&n.payload.key)h=`Key: ${n.payload.key}`;else if(a==="http"&&n.payload.url)h=n.payload.url;else if(a==="custom"&&Object.keys(n.payload).length>0){let g=Object.entries(n.payload).map(([b,x])=>`${b}: ${JSON.stringify(x)}`).join(`
15
- `);h=g.length>200?g.slice(0,200)+"...":g}if(h){let g=document.createElement("div");g.className="tooltip-payload",g.textContent=h,this.el.appendChild(g)}}let m=o+12,f=s-8,y=this.el.getBoundingClientRect();m+y.width>window.innerWidth&&(m=o-y.width-12),f+y.height>window.innerHeight&&(f=s-y.height-8),f<0&&(f=4),this.el.style.left=`${m}px`,this.el.style.top=`${f}px`,this.el.classList.add("visible")}hide(){this.el.classList.remove("visible")}destroy(){this.el.remove()}addRow(r,o){let s=document.createElement("div");s.className="tooltip-row";let n=document.createElement("span");n.className="label",n.textContent=r,s.appendChild(n),s.appendChild(o()),this.el.appendChild(s)}};var ho=class{constructor(r,o){this.onNavigate=o,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__breadcrumbs",r.appendChild(this.el)}update(r){if(this.el.textContent="",r.length===0){this.el.style.display="none";return}this.el.style.display="flex";let o=document.createElement("button");o.className="breadcrumb-item",o.textContent="Root",o.addEventListener("click",()=>this.onNavigate(null)),this.el.appendChild(o);for(let s of r){let n=document.createElement("span");n.className="breadcrumb-separator",n.textContent="\u203A",this.el.appendChild(n);let a=document.createElement("button");a.className="breadcrumb-item";let i=s.name.length>30?s.name.slice(0,30)+"...":s.name;a.textContent=i,a.addEventListener("click",()=>this.onNavigate(s)),this.el.appendChild(a)}}destroy(){this.el.remove()}};var tn={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},ki={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Kt({flamegraphData:e,perfData:r,functionProfileData:o}){let s=he(null),n=he(null),a=he(null),i=he(null),l=he(null),c=he(null),[d,m]=v(!1),[f,y]=v(""),[h,g]=v(0),[b,x]=v(0),[w,C]=v("total_duration"),[A,k]=v("desc"),[K,U]=v(o?.reason==="stackprof_missing"?!0:o?.enabled??!1),[L,j]=v(o?.max_frames??2e3),[T,F]=v(o?.mode==="lite"?"lite":"full"),[$,Z]=v(o?.clock??"wall"),[B,ce]=v(!1),[fe,Y]=v(!1),[Fe,Ne]=v(!1),[je,De]=v(!1),{mutateAsync:be}=Ha(),we=async()=>{ce(!0);try{let Q=await be({data:{enabled:!K}});U(Q.enabled)}finally{ce(!1)}},qe=async Q=>{Y(!0);try{let W=await be({data:{max_frames:Q}});j(W.max_frames)}finally{Y(!1)}},nt=async Q=>{F(Q),Ne(!0);try{let W=await be({data:{mode:Q}});F(W.mode??Q)}finally{Ne(!1)}},P=async Q=>{De(!0);try{let W=await be({data:{clock:Q}});Z(W.clock??Q)}finally{De(!1)}},H=e;if(G(()=>{if(!H?.root_events?.length||!s.current||!n.current)return;let Q=n.current,W=s.current,Ie=new mo(Q,H.total_duration);i.current=Ie;let Ee=new ho(Q,pe=>{a.current&&(pe?a.current.zoomTo(pe):a.current.resetZoom())});l.current=Ee,Q.insertBefore(Ee.el,W);let Qe=new fo(W,H.root_events,{onHover:(pe,it,lt)=>{pe?Ie.show(pe,it,lt):Ie.hide()},onClick:pe=>{m(!0)},onZoomChange:pe=>{Ee.update(pe),m(pe.length>0)},onSearchResults:(pe,it)=>{g(pe),x(it)}});a.current=Qe;let Le=()=>Qe.resizeCanvas();window.addEventListener("resize",Le);let Vt=()=>Qe.render();return document.addEventListener("profiler:theme-change",Vt),()=>{Qe.destroy(),Ie.destroy(),Ee.destroy(),window.removeEventListener("resize",Le),document.removeEventListener("profiler:theme-change",Vt),a.current=null,i.current=null,l.current=null}},[H]),G(()=>{a.current?.setSearchQuery(f),f||(g(0),x(0))},[f]),G(()=>{let Q=W=>{(W.ctrlKey||W.metaKey)&&W.key==="f"&&(W.preventDefault(),c.current?.focus())};return document.addEventListener("keydown",Q,{capture:!0}),()=>document.removeEventListener("keydown",Q,{capture:!0})},[]),!H?.root_events?.length)return r?.events?.length?t("div",{class:"profiler-flamegraph",children:[t("h2",{class:"profiler-section__header",children:["Performance Timeline (",r.total_events," events)"]}),t("p",{class:"profiler-mb-4",children:["Total Duration: ",t("strong",{children:[r.total_duration," ms"]})]}),r.events.map((Q,W)=>t("div",{class:"profiler-query-card",children:[t("div",{class:"profiler-query-card__header",children:[t("strong",{children:Q.name}),t("span",{class:Q.duration>=500?"badge-error":Q.duration>=100?"badge-warning":"badge-success",children:[Q.duration.toFixed(2)," ms"]})]}),Q.payload&&Object.keys(Q.payload).length>0&&t("pre",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:JSON.stringify(Q.payload,null,2)})]},W)),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]}):t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No performance events recorded"})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]});let Ce={},at=Q=>{let W=Q.category;Ce[W]||(Ce[W]={count:0,duration:0}),Ce[W].count++,Ce[W].duration+=Q.duration,Q.children?.forEach(at)};H.root_events.forEach(at);let ur=()=>{a.current?.resetZoom(),m(!1)};return t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-flamegraph__stats",children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Events"}),t("span",{class:"stat-value",children:H.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[H.total_duration.toFixed(2)," ",t("small",{children:"ms"})]})]}),Object.keys(Ce).map(Q=>t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:[t("span",{class:"stat-dot",style:{background:tn[Q]}}),ki[Q]]}),t("span",{class:"stat-value",children:Ce[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(tn).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:tn[Q]}}),t("span",{children:ki[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[d&&t("button",{class:"profiler-flamegraph__reset",onClick:ur,children:"Reset Zoom"}),t("div",{class:"profiler-flamegraph__search",children:[t("input",{ref:c,type:"text",class:"profiler-flamegraph__search-input",placeholder:"Search events\u2026 (Ctrl+F)",value:f,onInput:Q=>y(Q.target.value)}),f&&t("span",{class:"profiler-flamegraph__match-count",children:[h," / ",b]})]}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom, scroll to zoom in/out, drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:n,children:t("canvas",{ref:s,class:"profiler-flamegraph__canvas",style:{width:"100%"}})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]})}function Pi(e,r=new Set){return r.add(e.name),e.children?.forEach(o=>Pi(o,r)),r}function Si(e,r){for(let o of e){if(o.name===r)return o;let s=Si(o.children??[],r);if(s)return s}return null}function rn({data:e,enabled:r,toggling:o,maxFrames:s,maxFramesUpdating:n,mode:a,modeUpdating:i,clock:l,clockUpdating:c,sortKey:d,sortDir:m,onToggle:f,onMaxFramesChange:y,onModeChange:h,onClockChange:g,onSortChange:b}){let[x,w]=v(null),[C,A]=v(null),[k,K]=v(null),U=he(null),L=r&&e?.enabled&&(e.functions?.length??0)>0,j=e?.reason==="stackprof_missing"&&a==="lite",T=e?.mode??"full",F=e?.clock??"wall",$=T==="lite",Z=F==="object",B=!$,ce=T==="full",fe=a==="lite",Y=d==="memory_bytes"&&!ce||d==="allocated_objects"&&!B?"total_duration":d,Fe=L?e.root_calls??[]:[],Ne=L?[...e.functions].sort((P,H)=>m==="asc"?P[Y]-H[Y]:H[Y]-P[Y]):[],je=x?Ne.filter(P=>x.has(P.name)):Ne,De=P=>{P?(w(Pi(P)),A(P.name)):(w(null),A(null))},be=P=>{P===d?b(P,m==="asc"?"desc":"asc"):b(P,"desc")},we=P=>Y!==P?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:m==="asc"?"\u25B2":"\u25BC"}),qe=P=>{let H=parseInt(P.target.value,10);!isNaN(H)&&H>0&&H!==s&&y(H)},nt=P=>{P.key==="Enter"&&P.target.blur()};return t("div",{class:"profiler-fn-profiling",children:[t("div",{class:"profiler-fn-profiling__header",children:[t("span",{class:`profiler-fn-profiling__title${r?" profiler-fn-profiling__title--active":""}`,children:"Function Profiling"}),t("div",{class:"profiler-fn-profiling__controls",children:[t("div",{class:"profiler-fn-profiling__mode-selector",children:["full","lite"].map(P=>t("button",{class:`profiler-fn-profiling__mode-btn${a===P?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>a!==P&&h(P),disabled:i,title:P==="full"?"Exhaustive TracePoint - timing + allocations + memory bytes":"StackProf sampling - very low overhead",children:P.charAt(0).toUpperCase()+P.slice(1)},P))}),fe&&t("div",{class:"profiler-fn-profiling__mode-selector",children:["wall","cpu","object"].map(P=>t("button",{class:`profiler-fn-profiling__mode-btn${l===P?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>l!==P&&g(P),disabled:c,title:P==="wall"?"Wall-clock time (includes I/O waits)":P==="cpu"?"CPU time only (excludes I/O waits)":"Object allocations per function",children:P==="wall"?"Wall":P==="cpu"?"CPU":"Alloc"},P))}),t("label",{class:"profiler-fn-profiling__max-frames-label",children:["Max frames",t("input",{type:"number",class:"profiler-fn-profiling__max-frames-input",defaultValue:s,min:1,disabled:n,onBlur:qe,onKeyDown:nt}),n&&t("span",{class:"profiler-fn-profiling__updating",children:"\u2026"})]}),t("button",{class:`profiler-fn-profiling__toggle${r?" profiler-fn-profiling__toggle--active":""}`,onClick:f,disabled:o,children:o?"\u2026":r?"Enabled (click to disable)":"Disabled (click to enable)"})]})]}),!r&&t("p",{class:"profiler-fn-profiling__hint",children:["Enable function profiling to see where your app spends time."," ",t("strong",{children:"Lite"}),": statistical sampling with the stackprof gem, to add to the application's Gemfile; very low overhead (<1%), on by default once stackprof is installed."," ",t("strong",{children:"Full"}),": exhaustive TracePoint tracing with memory bytes - significant overhead."]}),r&&j&&t("p",{class:"profiler-fn-profiling__hint",children:["No data: sampling needs the ",t("code",{children:"stackprof"})," gem, which is not installed. Add"," ",t("code",{children:'gem "stackprof"'})," to the application's Gemfile. To trace every method call instead, at a much higher cost, choose ",t("strong",{children:"Full"}),", or set"," ",t("code",{children:"Profiler.function_profiling_tracepoint_fallback = true"})," in an initializer."]}),r&&!L&&!j&&t("p",{class:"profiler-fn-profiling__hint",children:"Function profiling is active. Data will appear on the next request."}),L&&t(M,{children:[e.frame_cap_reached&&t("div",{class:"profiler-fn-profiling__cap-warning",children:["\u26A0 Frame cap reached (",e.max_frames,' frames) - call tree is truncated. Increase "Max frames" to capture more.']}),t("div",{class:"profiler-flamegraph__stats",style:{marginTop:"0.75rem"},children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Functions"}),t("span",{class:"stat-value",children:e.functions.length})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:$?"Total Samples":"Total Calls"}),t("span",{class:"stat-value",children:e.total_calls})]}),!Z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Wall"}),t("span",{class:"stat-value",children:[(e.elapsed_wall_ms??e.total_duration??0).toFixed(2)," ",t("small",{children:"ms"})]})]}),$&&!Z&&e.elapsed_cpu_ms!=null&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:"CPU time excludes I/O waits (DB, network, sleep). Low CPU% = I/O-bound.",children:"CPU"}),t("span",{class:"stat-value",children:[e.elapsed_cpu_ms.toFixed(2)," ",t("small",{children:"ms"}),e.elapsed_wall_ms!=null&&e.elapsed_wall_ms>0&&t("small",{class:"profiler-fn-profiling__cpu-pct",children:[" ","(",Math.round(e.elapsed_cpu_ms/e.elapsed_wall_ms*100),"%)"]})]})]}),Z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocations"}),t("span",{class:"stat-value",children:[e.total_duration?.toLocaleString()," ",t("small",{children:"obj"})]})]}),$&&(e.gc_overhead_pct??0)>0&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:`${e.gc_samples} samples during GC`,children:"GC"}),t("span",{class:`stat-value${(e.gc_overhead_pct??0)>=20?" profiler-fn-profiling__gc--high":(e.gc_overhead_pct??0)>=5?" profiler-fn-profiling__gc--medium":""}`,children:[e.gc_overhead_pct,"%"]})]}),B&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocated"}),t("span",{class:"stat-value",children:[e.total_allocated_objects?.toLocaleString()," ",t("small",{children:"obj"})]})]}),ce&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Memory"}),t("span",{class:"stat-value",children:Qr(e.total_memory_bytes??0)})]})]}),Fe.length>0&&t(Gc,{rootCalls:Fe,onFrameSelect:De,rendererRef:U,onHoverName:P=>K(P)}),x&&t("div",{class:"profiler-fn-profiling__filter-active",children:[t("span",{children:["Showing ",t("strong",{children:C})," + ",x.size-1," child function",x.size!==2?"s":""]}),t("button",{class:"profiler-fn-profiling__filter-clear",onClick:()=>{w(null),A(null)},children:"\u2715 Clear"})]}),t("table",{class:"profiler-table profiler-fn-profiling__table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Function"}),t("th",{children:"File"}),t("th",{class:`profiler-text--right sortable${Y==="calls"?" sortable--active":""}`,onClick:()=>be("calls"),children:[$?"Samples":"Calls"," ",we("calls")]}),t("th",{class:`profiler-text--right sortable${Y==="total_duration"?" sortable--active":""}`,onClick:()=>be("total_duration"),children:[Z?"Total Alloc":"Total Time"," ",we("total_duration")]}),t("th",{class:`profiler-text--right sortable${Y==="self_duration"?" sortable--active":""}`,onClick:()=>be("self_duration"),children:[Z?"Self Alloc":"Self Time"," ",we("self_duration")]}),B&&t("th",{class:`profiler-text--right sortable${Y==="allocated_objects"?" sortable--active":""}`,onClick:()=>be("allocated_objects"),children:["Objects ",we("allocated_objects")]}),ce&&t("th",{class:`profiler-text--right sortable${Y==="memory_bytes"?" sortable--active":""}`,onClick:()=>be("memory_bytes"),children:["Memory ",we("memory_bytes")]})]})}),t("tbody",{children:je.map((P,H)=>t("tr",{class:k===P.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Fe.length>0?"pointer":"default"},onMouseEnter:()=>{K(P.name),U.current?.setHighlightName(P.name)},onMouseLeave:()=>{K(null),U.current?.setHighlightName("")},onClick:()=>{let Ce=Si(Fe,P.name);Ce&&(U.current?.zoomTo(Ce),De(Ce))},children:[t("td",{class:"profiler-fn-profiling__name",children:[P.recursive_calls>0&&t("span",{class:"profiler-fn-profiling__recursive",title:`${P.recursive_calls} recursive call(s)`,children:"\u21BA"}),P.name]}),t("td",{class:"profiler-text--muted profiler-text--xs",style:{fontFamily:"var(--profiler-font-mono)"},children:t(ir,{file:P.file,line:P.line})}),t("td",{class:"profiler-text--right",children:P.calls}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[P.total_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:P.total_duration>=100?"badge-error":P.total_duration>=10?"badge-warning":"badge-success",children:[P.total_duration.toFixed(2)," ms"]})}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[P.self_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:P.self_duration>=50?"badge-error":P.self_duration>=5?"badge-warning":"badge-success",children:[P.self_duration.toFixed(2)," ms"]})}),B&&t("td",{class:"profiler-text--right profiler-text--muted",children:[P.allocated_objects.toLocaleString()," ",t("small",{children:"obj"})]}),ce&&t("td",{class:"profiler-text--right profiler-text--muted",children:Qr(P.memory_bytes)})]},H))})]})]})]})}function Gc({rootCalls:e,onFrameSelect:r,rendererRef:o,onHoverName:s}){let n=he(null),a=he(null),i=he(null),l=he(r),c=he(s),[d,m]=v(!1);G(()=>{l.current=r},[r]),G(()=>{c.current=s},[s]);let f=e.reduce((h,g)=>h+g.duration,0);return G(()=>{if(!e.length||!n.current||!a.current)return;let h=a.current,g=n.current,b=new mo(h,f),x=new ho(h,k=>{k?(i.current?.zoomTo(k),l.current?.(k)):(i.current?.resetZoom(),l.current?.(null))});h.insertBefore(x.el,g);let w=new fo(g,e,{onHover:(k,K,U)=>{k?(b.show(k,K,U),c.current?.(k.node.name)):(b.hide(),c.current?.(null))},onClick:k=>{m(!0),l.current?.(k.node),w.zoomTo(k.node)},onZoomChange:k=>{x.update(k),m(k.length>0),k.length===0&&l.current?.(null)}});i.current=w,o&&(o.current=w);let C=()=>w.resizeCanvas();window.addEventListener("resize",C);let A=()=>w.render();return document.addEventListener("profiler:theme-change",A),()=>{w.destroy(),b.destroy(),x.destroy(),window.removeEventListener("resize",C),document.removeEventListener("profiler:theme-change",A),i.current=null,o&&(o.current=null)}},[e]),t("div",{class:"profiler-fn-profiling__flamegraph",children:[t("div",{class:"profiler-flamegraph__controls",children:[d&&t("button",{class:"profiler-flamegraph__reset",onClick:()=>{i.current?.resetZoom(),m(!1),l.current?.(null)},children:"Reset Zoom"}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom & filter table \xB7 scroll to zoom in/out \xB7 drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:a,children:t("canvas",{ref:n,class:"profiler-flamegraph__canvas",style:{width:"100%"}})})]})}function Ai({viewData:e}){return e?t(M,{children:[t("h2",{class:"profiler-section__header",children:"View Rendering"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Views: ",t("strong",{children:e.total_views})]}),t("span",{children:["Partials: ",t("strong",{children:e.total_partials})]}),t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]})]}),e.views&&e.views.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Templates"}),e.views.map((r,o)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},o))]}),e.partials&&e.partials.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Partials"}),e.partials.map((r,o)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No view data recorded"})})}var Bc={frame:"Turbo Frame request",stream:"Turbo Stream response"};function Mi({ajaxData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No AJAX requests tracked"}),t("p",{class:"profiler-empty__description",children:"AJAX requests made from this page will appear here."})]});let r=e.total_duration/e.total_requests;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["AJAX Requests (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Average: ",t("strong",{children:[r.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Method"}),Object.entries(e.by_method).map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${lr(o)}`,children:o}),t("strong",{children:s})]},o))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${o.startsWith("2")?"success":o.startsWith("4")||o.startsWith("5")?"error":"warning"}`,children:o}),t("strong",{children:s})]},o))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),e.requests.map((o,s)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${o.status>=200&&o.status<300?"success":"error"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${lr(o.method)}`,children:o.method}),o.turbo&&t("span",{class:"badge-default",title:Bc[o.turbo],children:o.turbo.toUpperCase()}),t("strong",{class:"profiler-ajax-card__path",children:o.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(o.status)}`,children:o.status}),t("span",{class:o.duration>=500?"badge-error":o.duration>=100?"badge-warning":"badge-success",children:[o.duration.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:new Date(o.started_at).toLocaleTimeString("en",{hour12:!1})}),t("a",{href:`/_profiler/profiles/${o.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},s))]})}function Ut({cacheData:e}){return e?t(M,{children:[t("h2",{class:"profiler-section__header",children:"Cache Operations"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Reads: ",t("strong",{children:e.total_reads})]}),t("span",{children:["Writes: ",t("strong",{children:e.total_writes})]}),t("span",{children:["Deletes: ",t("strong",{children:e.total_deletes})]}),t("span",{children:["Hit Rate:"," ",t("strong",{class:`badge-${e.hit_rate>80?"success":"warning"}`,children:[e.hit_rate,"%"]})]})]}),e.reads&&e.reads.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Cache Reads"}),e.reads.map((r,o)=>t("div",{class:"profiler-query-card",children:t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--mono profiler-text--sm",children:r.key}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:r.hit?"badge-success":"badge-error",children:r.hit?"HIT":"MISS"}),t("span",{class:r.duration>=500?"badge-error":r.duration>=100?"badge-warning":"badge-success",children:[r.duration.toFixed(2)," ms"]})]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No cache operations recorded"})})}function Jc(e){switch(e){case"ERROR":case"FATAL":return"profiler-text--error";case"WARN":return"profiler-text--warning";case"INFO":return"profiler-text--success";default:return"profiler-text--muted"}}function zc(e){switch(e){case"ERROR":case"FATAL":return"background: var(--profiler-error, #ef4444); color: #fff;";case"WARN":return"background: var(--profiler-warning, #f59e0b); color: #fff;";case"INFO":return"background: var(--profiler-success, #22c55e); color: #fff;";default:return"background: var(--profiler-muted, #6b7280); color: #fff;"}}function Nt({logData:e}){let[r,o]=v("ALL"),[s,n]=v("");if(!e?.logs?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4CB}"}),t("h3",{class:"profiler-empty__title",children:"No log messages captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Log messages emitted via ",t("code",{children:"Rails.logger"})," during this request will appear here."]})})]});let a=["ALL","DEBUG","INFO","WARN","ERROR","FATAL"],i=e.logs.filter(l=>!(r!=="ALL"&&l.level!==r||s&&!l.message.toLowerCase().includes(s.toLowerCase())));return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Log Messages (",e.count,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[e.errors>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.errors})]}),e.warnings>0&&t("span",{children:["Warnings: ",t("strong",{class:"profiler-text--warning",children:e.warnings})]})]}),t("div",{class:"profiler-action-bar profiler-mb-4",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:a.map(l=>t("button",{onClick:()=>o(l),class:`btn btn-sm ${r===l?"btn-primary":"btn-secondary"}`,children:l},l))}),t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search messages\u2026",value:s,onInput:l=>n(l.target.value),style:"width:200px"})]}),i.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:["No messages match",s?` "${s}"`:"","."]}):i.map((l,c)=>t("div",{class:"profiler-query-card profiler-mb-2",children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--xs",style:`display:inline-block;padding:1px 6px;border-radius:3px;font-weight:600;${zc(l.level)}`,children:l.level}),t("span",{class:"profiler-text--xs profiler-text--muted",children:new Date(l.timestamp).toLocaleTimeString("en",{hour12:!1})})]}),t("pre",{class:`profiler-query-card__code ${Jc(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},c))]})}function jt({exceptionData:e}){let[r,o]=v(!1);if(!e?.exception_class)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4A5}"}),t("h3",{class:"profiler-empty__title",children:"No exception recorded"}),t("div",{class:"profiler-empty__description",children:t("p",{children:"Exceptions raised during this request will appear here."})})]});let s=e.backtrace||[],n=s.filter(i=>i.app_frame),a=r?s:s.slice(0,30);return t(M,{children:[t("div",{class:"profiler-mb-4",style:"padding: 12px 16px; background: color-mix(in srgb, var(--profiler-error, #ef4444) 10%, transparent); border-left: 4px solid var(--profiler-error, #ef4444); border-radius: 4px;",children:[t("div",{class:"profiler-text--error",style:"font-size:1.1em;font-weight:700;margin-bottom:4px;",children:e.exception_class}),t("div",{style:"font-family:monospace;font-size:0.9em;word-break:break-word;",children:e.message})]}),n.length>0&&t("div",{class:"profiler-mb-4",children:[t("h3",{class:"profiler-section__header",children:["Application frames (",n.length,")"]}),n.map((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",children:t("code",{class:"profiler-text--sm",children:t(vt,{frame:i.location})})},l))]}),t("div",{children:[t("h3",{class:"profiler-section__header",children:["Full backtrace (",s.length," frames)"]}),a.map((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",style:i.app_frame?"":"opacity:0.45;",children:t("code",{class:`profiler-text--sm${i.app_frame?" profiler-text--success":" profiler-text--muted"}`,children:t(vt,{frame:i.location})})},l)),!r&&s.length>30&&t("button",{class:"btn btn-secondary btn-sm profiler-mt-2",onClick:()=>o(!0),children:["Show all ",s.length," frames"]})]})]})}var Wc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function Fi({verb:e}){let r=Wc[e]??"var(--profiler-text-muted)";return t("span",{style:{display:"inline-block",minWidth:"52px",textAlign:"center",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:700,fontFamily:"monospace",border:`1px solid ${r}`,color:r},children:e})}function qi({routesData:e}){let[r,o]=v(""),[s,n]=v("ALL"),{total:a,matched:i,routes:l}=e,c=["ALL",...Array.from(new Set(l.map(m=>m.verb))).sort()],d=l.filter(m=>{let f=s==="ALL"||m.verb===s,y=r.toLowerCase(),h=!y||(m.pattern??"").toLowerCase().includes(y)||(m.name??"").toLowerCase().includes(y)||(m.controller_action??"").toLowerCase().includes(y);return f&&h});return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:a}),t("div",{class:"profiler-stat-card__label",children:"Total routes"})]})}),i&&t(M,{children:[t("h2",{class:"profiler-section__header profiler-mt-4",children:"Matched Route"}),t("table",{class:"profiler-mb-4",children:[t("tr",{children:[t("th",{class:"profiler-text--sm",style:"width:120px;",children:"Verb"}),t("td",{children:t(Fi,{verb:i.verb})})]}),t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Pattern"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.pattern})]}),i.name&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Route Name"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[i.name,"_path"]})]}),i.controller_action&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Controller#Action"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.controller_action})]})]})]}),t("h2",{class:"profiler-section__header profiler-mt-4",children:"All Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",style:"flex-wrap:wrap;align-items:center;",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by path, name or controller\u2026",value:r,onInput:m=>o(m.target.value),style:"flex:1;width:auto;min-width:200px;"}),t("div",{class:"profiler-flex profiler-flex--gap-1",children:c.map(m=>t("button",{onClick:()=>n(m),style:{padding:"3px 8px",fontSize:"11px",fontWeight:600,borderRadius:"4px",border:"1px solid var(--profiler-border)",background:s===m?"var(--profiler-accent)":"transparent",color:s===m?"#fff":"var(--profiler-text-muted)",cursor:"pointer"},children:m},m))})]}),t("div",{class:"profiler-flex-table",children:[t("div",{class:"profiler-flex-table__header",children:[t("span",{class:"profiler-flex-table__cell--fixed",children:"Verb"}),t("span",{class:"profiler-flex-table__cell",children:"Pattern"}),t("span",{class:"profiler-flex-table__cell",children:"Name"}),t("span",{class:"profiler-flex-table__cell",children:"Controller#Action"})]}),d.map((m,f)=>t("div",{class:`profiler-flex-table__row${m.matched?" profiler-flex-table__row--matched":""}`,children:[t("span",{class:"profiler-flex-table__cell--fixed",children:t(Fi,{verb:m.verb})}),t("span",{class:"profiler-flex-table__cell profiler-text--mono profiler-text--xs",title:m.pattern,children:m.pattern}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.name?`${m.name}_path`:"",children:m.name?`${m.name}_path`:"-"}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.controller_action??"",children:m.controller_action??"-"})]},f))]})]})}function Oi({i18nData:e}){let[r,o]=v("ALL");if(!e?.lookups?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No translation lookups captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Calls to ",t("code",{children:"I18n.t"})," during this request will appear here."]})})]});let s=r==="MISSING"?e.lookups.filter(n=>n.missing):e.lookups;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["I18n Lookups (",e.total,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Locale: ",t("strong",{children:e.locale})]}),e.missing_count>0&&t("span",{children:["Missing: ",t("strong",{class:"profiler-text--error",children:e.missing_count})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-4",children:["ALL","MISSING"].map(n=>t("button",{onClick:()=>o(n),class:`btn btn-sm ${r===n?"btn-primary":"btn-secondary"}`,children:n},n))}),s.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:"No missing translations."}):t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Locale"}),t("th",{children:"Value"}),t("th",{children:"Status"})]})}),t("tbody",{children:s.map((n,a)=>t("tr",{style:n.missing?"background:var(--profiler-error-bg,rgba(239,68,68,0.08));":"",children:[t("td",{children:t("code",{class:`profiler-text--xs profiler-text--mono${n.missing?" profiler-text--error":""}`,children:n.key})}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--muted",children:n.locale})}),t("td",{children:t("span",{class:`profiler-text--xs${n.missing?" profiler-text--error":""}`,children:n.value})}),t("td",{children:n.missing?t("span",{class:"profiler-text--xs profiler-text--error",style:"font-weight:600;",children:"\u26A0 missing"}):t("span",{class:"profiler-text--xs profiler-text--success",children:"\u2713"})})]},a))})]})]})}function Xo({jobs:e}){return e?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Background Jobs (",e.length,")"]}),e.map((r,o)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${r.status==="completed"?"success":r.status==="failed"?"error":"default"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`badge-${r.status==="completed"?"success":r.status==="failed"?"error":r.status==="running"?"info":"warning"}`,children:r.status??"unknown"}),t("strong",{class:"profiler-ajax-card__path",children:r.job_class})]}),r.status==="running"?t("span",{class:"badge-info",children:"running"}):t("span",{class:r.duration>=1e3?"badge-error":r.duration>=200?"badge-warning":"badge-success",children:[r.duration?.toFixed(2)," ms"]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time profiler-text--muted",children:[r.queue&&t("span",{children:["Queue: ",t("strong",{children:r.queue})," \xB7 "]}),new Date(r.started_at).toLocaleTimeString("en",{hour12:!1})]}),t("a",{href:`/_profiler/profiles/${r.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Job \u2192"})]})]},o))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No jobs triggered"}),t("p",{class:"profiler-empty__description",children:"Background jobs enqueued during this request will appear here."})]})}function Zc({email:e}){let r=!!e.body_html,o=!!e.body_text;if(!e.body_captured)return t("div",{class:"profiler-mt-3 profiler-text--xs profiler-text--muted",children:["Body not captured - enable ",t("code",{children:"config.capture_mail_body = true"})," in your profiler initializer"]});if(!r&&!o)return null;let[s,n]=v(r?"preview":"text"),a=l=>c=>{c.stopPropagation(),n(l)},i={borderColor:"var(--profiler-accent)",color:"var(--profiler-accent)"};return t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-mb-2 profiler-flex profiler-flex--gap-2",style:{alignItems:"center"},children:[t("span",{class:"profiler-text--muted profiler-text--xs",children:"Body"}),r&&t(M,{children:[t("button",{class:"profiler-btn profiler-btn--sm",style:s==="preview"?i:{},onClick:a("preview"),children:"HTML preview"}),t("button",{class:"profiler-btn profiler-btn--sm",style:s==="source"?i:{},onClick:a("source"),children:"HTML source"})]}),o&&t("button",{class:"profiler-btn profiler-btn--sm",style:s==="text"?i:{},onClick:a("text"),children:"Plain text"})]}),s==="preview"&&r&&t("iframe",{srcdoc:e.body_html??void 0,sandbox:"",style:{width:"100%",height:"300px",border:"1px solid var(--profiler-border)",borderRadius:"var(--profiler-radius-md)",background:"#fff",display:"block"}}),(s==="source"||s==="text")&&t("pre",{style:{maxHeight:"300px",overflow:"auto",background:"var(--profiler-bg-lighter, rgba(0,0,0,0.2))",padding:"12px",borderRadius:"var(--profiler-radius-md)",fontSize:"12px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--profiler-border)"},children:s==="source"?e.body_html:e.body_text})]})}function Qi({assigns:e}){let r=Object.entries(e);return r.length===0?null:t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-text--xs profiler-text--muted profiler-mb-1",style:{textTransform:"uppercase",letterSpacing:"0.05em"},children:"Variables"}),r.map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{children:t("code",{children:["@",o]})}),t("code",{style:{textAlign:"right",wordBreak:"break-all",maxWidth:"60%"},children:s})]},o))]})}function Xc({email:e}){return t("div",{class:"profiler-mt-3",onClick:r=>r.stopPropagation(),children:[e.subject&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Subject"}),t("span",{children:e.subject})]}),e.to&&e.to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"To"}),t("span",{style:{textAlign:"right",wordBreak:"break-all"},children:e.to.join(", ")})]}),e.from&&e.from.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"From"}),t("span",{style:{textAlign:"right"},children:e.from.join(", ")})]}),e.cc&&e.cc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"CC"}),t("span",{style:{textAlign:"right"},children:e.cc.join(", ")})]}),e.bcc&&e.bcc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"BCC"}),t("span",{style:{textAlign:"right"},children:e.bcc.join(", ")})]}),e.reply_to&&e.reply_to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Reply-To"}),t("span",{style:{textAlign:"right"},children:e.reply_to.join(", ")})]}),e.template&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Template"}),t("code",{children:e.template})]}),e.parts&&e.parts.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parts"}),t("span",{style:{textAlign:"right"},children:e.parts.join(", ")})]}),e.attachments&&e.attachments.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Attachments"}),t("span",{style:{textAlign:"right"},children:e.attachments.map(r=>`${r.filename} (${(r.size/1024).toFixed(1)} KB)`).join(", ")})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Render"}),t("span",{class:"profiler-query-card__duration",children:e.duration_ms!=null?`${e.duration_ms} ms`:"-"})]}),e.delivery_ms!=null&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Delivery"}),t("span",{class:"profiler-query-card__duration",children:[e.delivery_ms," ms"]})]}),e.message_id&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Message-ID"}),t("code",{style:{fontSize:"11px",wordBreak:"break-all",maxWidth:"70%",textAlign:"right"},children:e.message_id})]}),e.error&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Error"}),t("span",{class:"profiler-text--error",style:{textAlign:"right"},children:e.error})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(Qi,{assigns:e.assigns}),t(Zc,{email:e})]})}function Di({email:e,onClick:r,isExpanded:o}){let s=["profiler-query-card",e.error?"profiler-query-card--slow":""].filter(Boolean).join(" ");return t("div",{class:s,style:{cursor:"pointer",marginBottom:"6px"},onClick:r,children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",style:{minWidth:0,flex:1},children:t("span",{class:"profiler-text--sm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]}),e.subject&&t("span",{class:"profiler-text--muted",children:[" - ",e.subject.slice(0,60),e.subject.length>60?"\u2026":""]})]})}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[e.delivery_mode&&t("span",{class:"badge-info profiler-text--xs",children:e.delivery_mode}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]}),e.error?t("span",{class:"badge-error profiler-text--xs",children:"Error"}):t("span",{class:"badge-success profiler-text--xs",children:"Sent"}),t("span",{class:"profiler-text--muted profiler-text--xs",children:o?"\u25B2":"\u25BC"})]})]}),o&&t(Xc,{email:e})]})}function Yc({email:e}){return t("div",{class:"profiler-query-card",style:{marginBottom:"6px",borderLeft:"3px solid var(--profiler-info, #38bdf8)"},children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--sm",children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[t("span",{class:"badge-info profiler-text--xs",children:"queued"}),e.delivery_method&&t("span",{class:"badge-default profiler-text--xs",children:e.delivery_method}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]})]})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(Qi,{assigns:e.assigns})]})}function Yo({mailerData:e}){let[r,o]=v(null),[s,n]=v(null),a=e?.queued_count??0;if(!e||e.total===0&&a===0)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No emails sent during this request"})});let i=c=>o(r===c?null:c),l=c=>n(s===c?null:c);return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Mailer Deliveries"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:e.total})]}),e.deliver_now>0&&t("span",{children:["deliver_now: ",t("strong",{children:e.deliver_now})]}),e.deliver_later>0&&t("span",{children:["deliver_later: ",t("strong",{children:e.deliver_later})]}),a>0&&t("span",{children:["queued: ",t("strong",{children:a})]}),e.multi_part_count>0&&t("span",{children:["Multi-part: ",t("strong",{children:e.multi_part_count})]}),e.failed>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.failed})]})]}),e.loop_warnings.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:{flex:1},children:[t("strong",{children:"Send loop detected"})," - ",e.loop_warnings.length," pattern",e.loop_warnings.length>1?"s":"",e.loop_warnings.map((c,d)=>t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:c.message},d))]})]}),e.truncated&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("span",{children:"Showing first 50 emails only - additional emails were truncated"})]}),e.emails.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-3",children:["Emails",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"click to expand"})]}),e.emails.map((c,d)=>t(Di,{email:c,onClick:()=>i(d),isExpanded:r===d},d))]}),e.queued&&e.queued.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-2",children:["Queued",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"deliver_later - will be sent in a background job"})]}),e.queued.map((c,d)=>t(Yc,{email:c},`q-${d}`))]}),e.errors.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3 profiler-text--error",children:"Delivery Errors"}),e.errors.map((c,d)=>t(Di,{email:c,onClick:()=>l(d),isExpanded:s===d},`err-${d}`))]})]})}function Li({profile:e}){return e.trace_id?t(ep,{profile:e,traceId:e.trace_id}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No trace for this profile"}),t("p",{class:"profiler-empty__description",children:"This profile was saved before distributed tracing was available."})]})}function ep({profile:e,traceId:r}){let{data:o,isLoading:s,isError:n}=Za({trace_id:r,limit:50}),a=(o?.profiles??[]).filter(i=>i.token!==e.token);return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Trace"}),t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-6",children:[t("div",{class:"profiler-kv-row",children:[t("span",{children:"Trace ID"}),t("code",{class:"profiler-code",children:r})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Span ID"}),t("code",{class:"profiler-code",children:e.span_id??"-"})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parent span ID"}),e.parent_span_id?t("code",{class:"profiler-code",children:e.parent_span_id}):t("span",{class:"profiler-text--muted",children:"none, this request started the trace"})]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Other profiles in this trace"}),s&&t("p",{class:"profiler-text--muted",children:"Loading..."}),n&&t("p",{class:"profiler-text--muted",children:"Could not load the profiles of this trace."}),!s&&!n&&a.length===0&&t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"Single-span trace"}),t("p",{class:"profiler-empty__description",children:"No other stored profile shares this trace id. The request had no traceparent from a caller, or the other services are not profiled here."})]}),a.map(i=>t("div",{class:"profiler-ajax-card",children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${lr(i.method??"")}`,children:i.method}),t("strong",{class:"profiler-ajax-card__path",children:i.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(i.status??0)}`,children:i.status}),i.span_id&&i.span_id===e.parent_span_id&&t("span",{class:"badge-info",children:"caller"})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:["span ",i.span_id??"-"]}),t("a",{href:`/_profiler/profiles/${i.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},i.token))]})}function Ki({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.ajax?.total_requests??0)>0,a=(s.http?.total_requests??0)>0,i=!!s.exception?.exception_class,l=(s.logs?.count??0)>0,c=(s.routes?.total??0)>0,d=(s.i18n?.total??0)>0,m=(e.child_jobs?.length??0)>0,f=(s.mailer?.total??0)>0,[y,h]=v(i?"exception":r),g=x=>w=>{w.preventDefault(),h(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${y===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=http",children:[t("span",{class:"h1-emoji",children:"\u{1F4CA}"})," Profile Details"]})}),t("p",{children:[e.method," ",e.path]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:e.status})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),t("span",{style:"color:var(--profiler-text-muted)",children:new Date(e.started_at).toLocaleString("en",{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[i&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:b("request"),onClick:g("request"),children:"Request"}),t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:"Dump"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),n&&t("a",{href:"#",class:b("ajax"),onClick:g("ajax"),children:"AJAX"}),a&&t("a",{href:"#",class:b("http"),onClick:g("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"}),t("a",{href:"#",class:b("views"),onClick:g("views"),children:"Views"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),l&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),c&&t("a",{href:"#",class:b("routes"),onClick:g("routes"),children:"Routes"}),d&&t("a",{href:"#",class:b("i18n"),onClick:g("i18n"),children:"I18n"}),m&&t("a",{href:"#",class:b("jobs"),onClick:g("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),f&&t("a",{href:"#",class:b("mailer"),onClick:g("mailer"),children:"Mailers"}),t("a",{href:"#",class:b("trace"),onClick:g("trace"),children:"Trace"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="request"&&t(Ei,{profile:e}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="ajax"&&t(Mi,{ajaxData:s.ajax}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="views"&&t(Ai,{viewData:s.view}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="logs"&&t(Nt,{logData:s.logs}),y==="routes"&&t(qi,{routesData:s.routes}),y==="i18n"&&t(Oi,{i18nData:s.i18n}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="trace"&&t(Li,{profile:e}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function Ui({jobData:e}){if(!e)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No job data"})]});let r=e.status==="completed";return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Job Details"}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Info"}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Class"}),t("strong",{class:"profiler-text--mono",children:e.job_class})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Job ID"}),t("span",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:e.job_id})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Queue"}),t("span",{class:"profiler-text--mono",children:e.queue})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Executions"}),t("span",{children:e.executions})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Status"}),t("span",{class:`badge-${r?"success":"error"}`,children:r?"\u2713 Completed":"\u2717 Failed"})]})]}),e.arguments&&e.arguments.length>0&&t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Arguments"}),e.arguments.map((o,s)=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["[",s,"]"]}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"word-break:break-all",children:String(o)})]},s))]})]}),e.error&&t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-4",style:"border-left: 3px solid var(--profiler-error, #ef4444)",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-2",children:"Error"}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:e.error})]})]})}function Ni({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(e.child_jobs?.length??0)>0,i=(s.dump?.count??0)>0,l=(s.logs?.total??0)>0,c=!!s.exception?.exception_class,d=(s.mailer?.total??0)>0,f=["job","database","cache","http","jobs","dump","logs","exception","env","timeline","mailer"].includes(r)?r:"job",[y,h]=v(c?"exception":f),g=s.job,b=g?.status==="failed",x=g?.status==="running",w=e.parent_profile,C=k=>K=>{K.preventDefault(),h(k);let U=new URL(window.location.href);U.searchParams.set("tab",k),history.pushState(null,"",U.toString())},A=k=>`tab${y===k?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=jobs",children:[t("span",{class:"h1-emoji",children:"\u2699\uFE0F"})," Job Profile"]})}),t("p",{children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:x?"running":`${e.duration.toFixed(2)} ms`})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${b?"error":x?"info":"success"}`,children:b?"Failed":x?"Running":"Completed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]}),w&&t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2 profiler-text--sm",children:[t("span",{style:"color:var(--profiler-text-muted)",children:"Triggered by:"}),w.profile_type==="http"?t("span",{children:[t("strong",{children:w.method})," ",w.path," \xB7 ",w.http_status," \xB7 ",w.duration?.toFixed(2)," ms"]}):t("span",{children:["\u2699\uFE0F ",t("strong",{children:w.path})," \xB7 ",w.duration?.toFixed(2)," ms"]}),t("a",{href:`/_profiler/profiles/${w.token}`,style:"color: var(--profiler-accent);",children:"View \u2192"})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[c&&t("a",{href:"#",class:A("exception"),onClick:C("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:A("job"),onClick:C("job"),children:"Job"}),t("a",{href:"#",class:A("database"),onClick:C("database"),children:"Database"}),t("a",{href:"#",class:A("cache"),onClick:C("cache"),children:"Cache"}),n&&t("a",{href:"#",class:A("http"),onClick:C("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:A("timeline"),onClick:C("timeline"),children:"Timeline"}),a&&t("a",{href:"#",class:A("jobs"),onClick:C("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),i&&t("a",{href:"#",class:A("dump"),onClick:C("dump"),children:["Dumps (",s.dump.count,")"]}),l&&t("a",{href:"#",class:A("logs"),onClick:C("logs"),children:"Logs"}),d&&t("a",{href:"#",class:A("mailer"),onClick:C("mailer"),children:"Mailers"}),t("a",{href:"#",class:A("env"),onClick:C("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="job"&&t(Ui,{jobData:s.job}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="logs"&&t(Nt,{logData:s.logs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function ji({data:e}){return t("div",{class:"profiler-p-4",children:[t("div",{class:"profiler-mb-6",children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Expression"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.expression})]}),e.return_value!==void 0&&t("div",{children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Return value"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.return_value})]})]})}function Ii({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(s.dump?.count??0)>0,i=(s.logs?.total??0)>0,l=!!s.exception?.exception_class,c=s.console,m=["console","database","cache","http","dump","logs","exception","env","timeline"].includes(r)?r:"console",[f,y]=v(l?"exception":m),h=e.status===500,g=x=>w=>{w.preventDefault(),y(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${f===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=console",children:[t("span",{class:"h1-emoji",children:">_"})," Console Profile"]})}),t("p",{style:"font-family: monospace; word-break: break-all",children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${h?"error":"success"}`,children:h?"Error":"OK"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]})]}),t("div",{class:"profiler-panel",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:b("console"),onClick:g("console"),children:"Console"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),n&&t("a",{href:"#",class:b("http"),onClick:g("http"),children:"HTTP"}),a&&t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:"Dumps"}),i&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),l&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),children:"Exception"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"})]}),t("div",{class:"profiler-p-0 tab-content active",children:[f==="console"&&c&&t(ji,{data:c}),f==="database"&&t(Qt,{dbData:s.database,token:e.token}),f==="cache"&&t(Ut,{cacheData:s.cache}),f==="http"&&n&&t(Lr,{httpData:s.http}),f==="dump"&&a&&t(Lt,{dumpData:s.dump}),f==="logs"&&i&&t(Nt,{logData:s.logs}),f==="exception"&&l&&t(jt,{exceptionData:s.exception}),f==="env"&&t(st,{envData:s.env,readOnly:!0}),f==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function tp(e){return e==="passed"?t("span",{class:"badge-success",children:"\u2713 Passed"}):e==="failed"?t("span",{class:"badge-error",children:"\u2717 Failed"}):e==="pending"?t("span",{class:"badge-warning",children:"\u23F8 Pending"}):t("span",{class:"badge-default",children:e})}function $i({testData:e}){return t("div",{children:t("table",{class:"profiler-detail-table",children:t("tbody",{children:[t("tr",{children:[t("th",{children:"Test Name"}),t("td",{style:"word-break: break-word",children:e.test_name})]}),t("tr",{children:[t("th",{children:"Status"}),t("td",{children:tp(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:t(ir,{file:e.test_file,line:e.test_line})})]}),t("tr",{children:[t("th",{children:"Framework"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:e.framework})]}),e.assertions!=null&&t("tr",{children:[t("th",{children:"Assertions"}),t("td",{children:e.assertions})]}),e.skip_reason&&t("tr",{children:[t("th",{children:"Skip reason"}),t("td",{class:"profiler-text--xs profiler-text--muted",children:e.skip_reason})]}),e.exception_message&&t("tr",{children:[t("th",{children:"Exception"}),t("td",{children:t("pre",{class:"profiler-text--xs",style:"white-space: pre-wrap; color: var(--profiler-error, #ef4444)",children:e.exception_message})})]})]})})})}function Vi({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.dump?.count??0)>0,a=(s.logs?.total??0)>0,i=!!s.exception?.exception_class,l=s.test,d=["test","database","cache","dump","logs","exception","env","timeline"].includes(r)?r:"test",[m,f]=v(i?"exception":d),y=e.status===500,h=l?.status||(y?"failed":"passed"),g=x=>w=>{w.preventDefault(),f(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${m===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=tests",children:[t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Profile"]})}),t("p",{style:"word-break: break-word",children:l?.test_name||e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${y?"error":h==="pending"?"warning":"success"}`,children:h==="failed"?"\u2717 Failed":h==="pending"?"\u23F8 Pending":"\u2713 Passed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]})]}),l?.test_file&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:[t("span",{class:"profiler-text--mono",children:[l.test_file,":",l.test_line]}),t("span",{style:"margin-left: 8px",children:["\xB7 ",l.framework]})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[i&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:b("test"),onClick:g("test"),children:"Test"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"}),n&&t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:["Dumps (",s.dump.count,")"]}),a&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[m==="test"&&l&&t($i,{testData:l}),m==="database"&&t(Qt,{dbData:s.database,token:e.token}),m==="cache"&&t(Ut,{cacheData:s.cache}),m==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),m==="dump"&&n&&t(Lt,{dumpData:s.dump}),m==="logs"&&a&&t(Nt,{logData:s.logs}),m==="exception"&&i&&t(jt,{exceptionData:s.exception}),m==="env"&&t(st,{envData:s.env})]})]})]})}var rp="/_profiler";function Hi(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:rp,children:t("span",{class:"h1-emoji",children:"\u{1F50D}"})})," ",t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Runner"]}),t("p",{children:"Run tests from the profiler and capture a performance profile for each test."})]}),t("div",{class:"profiler-panel profiler-mb-6",children:t("div",{class:"profiler-p-4",children:t(Wo,{})})})]})}var Nr="/_profiler";function ts(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}function ae(e){return e==null?"-":e.toFixed(2)+" ms"}function V(e,r=""){return e==null?"-":e.toFixed(2)+r}function op(e){return e>0?`+${e.toFixed(2)}`:e.toFixed(2)}function sp(e){return e!=null?` (${e>0?"+":""}${e.toFixed(1)}%)`:""}function It(e,r,o,s){if(!r)return"";let n=o?o(r.value_a):V(r.value_a),a=s?s(r.value_b):V(r.value_b),i=`${op(r.delta)}${sp(r.delta_pct)}`,l=r.status==="improved"?"\u2705":r.status==="regression"?"\u274C":"\u2796";return`| ${e} | ${n} | ${a} | ${i} | ${l} |`}function np(e){let{profile_a:r,profile_b:o,metrics:s}=e,n=["## Profile Comparison","",`**A:** \`${r.token}\` - ${r.method} ${r.path} - ${ts(r.started_at)}`,`**B:** \`${o.token}\` - ${o.method} ${o.path} - ${ts(o.started_at)}`];return e.same_endpoint||n.push("","> \u26A0\uFE0F Profiles are from different endpoints."),n.push("","| Metric | Before (A) | After (B) | Delta | |","|--------|-----------|-----------|-------|---|",It("Duration",s.duration,ae,ae),It("Allocated objects",s.allocated_objects,V,V),It("DB Queries",s.db_queries,V,V),It("DB Duration",s.db_duration,ae,ae),It("Cache Hit Rate",s.cache_hit_rate,a=>V(a,"%"),a=>V(a,"%")),It("View Duration",s.view_duration,ae,ae),It("HTTP Requests",s.http_requests,V,V),It("HTTP Duration",s.http_duration,ae,ae)),n.filter(a=>a!=="").join(`
16
- `)}function ap(e){return e==="improved"?"badge-success":e==="regression"?"badge-error":"badge-default"}function ip({metric:e}){if(!e)return t("span",{class:"badge-default",children:"-"});let r=e.delta>0?"+":"",o=e.delta_pct!=null?` (${e.delta>0?"+":""}${e.delta_pct}%)`:"",s=`${r}${e.delta.toFixed(2)}${o}`;return t("span",{class:ap(e.status),children:s})}function $t({label:e,metric:r,formatA:o,formatB:s}){return r?t("tr",{children:[t("td",{children:e}),t("td",{class:"profiler-text--mono",children:o(r.value_a)}),t("td",{class:"profiler-text--mono",children:s(r.value_b)}),t("td",{children:t(ip,{metric:r})})]}):null}function es({label:e,rows:r}){return r.some(s=>s.a!=="-"||s.b!=="-")?t("div",{class:"profiler-mb-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:r.map(s=>t("tr",{children:[t("td",{children:s.key}),t("td",{class:"profiler-text--mono",children:s.a}),t("td",{class:"profiler-text--mono",children:s.b})]},s.key))})]})}):t("div",{class:"profiler-empty profiler-mb-4",children:t("div",{class:"profiler-empty__title",children:["No ",e.toLowerCase()," data"]})})}function on({title:e,rows:r}){return t("div",{class:"profiler-mb-4",children:[t("h3",{children:[e," (",r.length,")"]}),r.length===0?t("p",{class:"profiler-text--muted",children:"None."}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Query"}),t("th",{children:"Count A"}),t("th",{children:"Count B"}),t("th",{children:"Time A"}),t("th",{children:"Time B"})]})}),t("tbody",{children:r.map(o=>t("tr",{children:[t("td",{class:"profiler-text--mono profiler-text--xs",children:o.fingerprint}),t("td",{children:o.count_a}),t("td",{children:o.count_b}),t("td",{children:ae(o.total_duration_a)}),t("td",{children:[ae(o.total_duration_b),o.delta_pct!=null?` (+${o.delta_pct}%)`:""]})]}))})]})]})}function Gi({label:e,name:r,value:o,nodes:s,onChange:n}){return t("label",{style:"margin-right: 16px",children:[e," ",t("select",{name:r,value:o,onChange:a=>n(a.target.value),children:s.map(a=>t("option",{value:a,children:a}))})]})}function Bi({tokenA:e,tokenB:r,nodeA:o="",nodeB:s=""}){let[n,a]=v(["local"]),[i,l]=v(o||"local"),[c,d]=v(s||"local");G(()=>{fetch(`${Nr}/api/compare/nodes`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():{nodes:["local"]}).then(T=>a(T.nodes)).catch(()=>{})},[]);let[m,f]=v(null),[y,h]=v(null),[g,b]=v(!0),[x,w]=v("sql");G(()=>{fetch(`${Nr}/api/compare?${new URLSearchParams({a:e,b:r,node_a:o,node_b:s}).toString()}`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():T.json().then(F=>Promise.reject(F.errors?.join(", ")||"Error"))).then(T=>{f(T),b(!1)}).catch(T=>{h(typeof T=="string"?T:"Failed to load comparison"),b(!1)})},[e,r,o,s]);let[C,A]=v("");if(G(()=>{if(!m)return;let T=np(m),F=new Blob([T],{type:"text/plain"}),$=URL.createObjectURL(F);return A($),()=>URL.revokeObjectURL($)},[m]),g)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"Loading\u2026"})})})]});if(y||!m)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:y||"Unknown error"})})})]});let{profile_a:k,profile_b:K,metrics:U,collectors:L}=m,j=T=>`tab${x===T?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:"Profile Comparison"}),t("p",{children:t("a",{href:`${Nr}/`,children:"\u2190 Back to list"})}),n.length>1&&t("form",{method:"get",action:`${Nr}/compare`,children:[t("input",{type:"hidden",name:"a",value:e}),t("input",{type:"hidden",name:"b",value:r}),t(Gi,{label:"Node A",name:"node_a",value:i,nodes:n,onChange:l}),t(Gi,{label:"Node B",name:"node_b",value:c,nodes:n,onChange:d}),t("button",{type:"submit",class:"btn btn-secondary btn-sm",children:"Compare"})]})]}),!m.same_endpoint&&t("div",{class:"profiler-panel profiler-p-4 profiler-mb-4",style:"border-left: 3px solid var(--color-warning, #f59e0b)",children:"\u26A0\uFE0F These profiles are from different endpoints - comparison may not be meaningful."}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Endpoint"}),t("td",{children:k.node==="local"?t("a",{href:`${Nr}/profiles/${k.token}`,children:[k.method," ",k.path]}):t("span",{children:[k.method," ",k.path]})}),t("td",{children:K.node==="local"?t("a",{href:`${Nr}/profiles/${K.token}`,children:[K.method," ",K.path]}):t("span",{children:[K.method," ",K.path]})})]}),t("tr",{children:[t("td",{children:"Time"}),t("td",{class:"profiler-text--mono",children:ts(k.started_at)}),t("td",{class:"profiler-text--mono",children:ts(K.started_at)})]}),t("tr",{children:[t("td",{children:"Token"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[k.token.substring(0,16),"\u2026"]}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[K.token.substring(0,16),"\u2026"]})]})]})]})})}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:[t("div",{style:"display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px",children:[t("h2",{style:"margin: 0",children:"Scorecard"}),C&&t("a",{class:"btn btn-secondary btn-sm",href:C,download:`compare-${e.substring(0,8)}-vs-${r.substring(0,8)}.md`,children:"Export as Markdown"})]}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"A"}),t("th",{children:"B"}),t("th",{children:"Delta"})]})}),t("tbody",{children:[t($t,{label:"Duration",metric:U.duration,formatA:ae,formatB:ae}),t($t,{label:"Allocated objects",metric:U.allocated_objects,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Queries",metric:U.db_queries,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Duration",metric:U.db_duration,formatA:ae,formatB:ae}),t($t,{label:"Cache Hit Rate",metric:U.cache_hit_rate,formatA:T=>V(T,"%"),formatB:T=>V(T,"%")}),t($t,{label:"View Duration",metric:U.view_duration,formatA:ae,formatB:ae}),t($t,{label:"HTTP Requests",metric:U.http_requests,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"HTTP Duration",metric:U.http_duration,formatA:ae,formatB:ae})]})]})]})}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:j("sql"),onClick:T=>{T.preventDefault(),w("sql")},children:"SQL"}),t("a",{href:"#",class:j("database"),onClick:T=>{T.preventDefault(),w("database")},children:"Database"}),t("a",{href:"#",class:j("cache"),onClick:T=>{T.preventDefault(),w("cache")},children:"Cache"}),t("a",{href:"#",class:j("views"),onClick:T=>{T.preventDefault(),w("views")},children:"Views"}),t("a",{href:"#",class:j("http"),onClick:T=>{T.preventDefault(),w("http")},children:"HTTP"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[x==="sql"&&t("div",{children:[t(on,{title:"New queries (only in B)",rows:m.sql.new}),t(on,{title:"Gone queries (only in A)",rows:m.sql.gone}),t(on,{title:"Slower queries",rows:m.sql.slower})]}),x==="database"&&t(es,{label:"Database",rows:[{key:"Total Queries",a:V(L.database.total_queries_a),b:V(L.database.total_queries_b)},{key:"Total Duration",a:ae(L.database.total_duration_a),b:ae(L.database.total_duration_b)},{key:"Slow Queries",a:V(L.database.slow_queries_a),b:V(L.database.slow_queries_b)},{key:"Cached Queries",a:V(L.database.cached_queries_a),b:V(L.database.cached_queries_b)}]}),x==="cache"&&t(es,{label:"Cache",rows:[{key:"Total Reads",a:V(L.cache.total_reads_a),b:V(L.cache.total_reads_b)},{key:"Total Writes",a:V(L.cache.total_writes_a),b:V(L.cache.total_writes_b)},{key:"Hit Rate",a:V(L.cache.hit_rate_a,"%"),b:V(L.cache.hit_rate_b,"%")}]}),x==="views"&&t(es,{label:"Views",rows:[{key:"Templates",a:V(L.views.total_views_a),b:V(L.views.total_views_b)},{key:"Partials",a:V(L.views.total_partials_a),b:V(L.views.total_partials_b)},{key:"Total Duration",a:ae(L.views.total_duration_a),b:ae(L.views.total_duration_b)}]}),x==="http"&&t(es,{label:"HTTP",rows:[{key:"Total Requests",a:V(L.http.total_requests_a),b:V(L.http.total_requests_b)},{key:"Total Duration",a:ae(L.http.total_duration_a),b:ae(L.http.total_duration_b)},{key:"Slow Requests",a:V(L.http.slow_requests_a),b:V(L.http.slow_requests_b)},{key:"Error Requests",a:V(L.http.error_requests_a),b:V(L.http.error_requests_b)}]})]})]})]})}function Ji(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}lp(r).then(o=>{up(e,o)})}async function lp(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function up(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let o=cp(r);e.appendChild(o)}function cp(e){let o=e.length*40+40,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width","1200"),s.setAttribute("height",o.toString()),s.style.cssText="background: #1e1e1e; border-radius: 4px;";let n=Math.min(...e.map(c=>c.started_at)),l=1100/(Math.max(...e.map(c=>c.finished_at))-n);return e.forEach((c,d)=>{let m=d*40+20,f=(c.started_at-n)*l+50,y=c.duration*l,h=document.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("x",f.toString()),h.setAttribute("y",m.toString()),h.setAttribute("width",Math.max(y,2).toString()),h.setAttribute("height","20"),h.setAttribute("fill",pp(c.name)),h.setAttribute("rx","2");let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=`${c.name}
17
- Duration: ${c.duration.toFixed(2)}ms`,h.appendChild(g),s.appendChild(h);let b=document.createElementNS("http://www.w3.org/2000/svg","text");b.setAttribute("x","5"),b.setAttribute("y",(m+15).toString()),b.setAttribute("fill","#d4d4d4"),b.setAttribute("font-size","11"),b.textContent=c.name.substring(0,40),s.appendChild(b)}),s}function pp(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var sn=new Map;function zi(e){try{return localStorage.getItem(e)}catch{return sn.has(e)?sn.get(e):null}}function Wi(e,r){sn.set(e,r);try{localStorage.setItem(e,r)}catch{}}var nn="profiler-theme",dp="data-theme",an=class{constructor(){this.systemPreference=window.matchMedia("(prefers-color-scheme: dark)"),this.currentTheme=this.loadTheme(),this.init()}init(){this.applyTheme(this.currentTheme),this.systemPreference.addEventListener("change",r=>{this.currentTheme==="auto"&&this.applyTheme("auto")}),window.addEventListener("storage",r=>{r.key===nn&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return zi(nn)||"auto"}saveTheme(r){Wi(nn,r)}applyTheme(r){let o=this.resolveTheme(r);document.documentElement.setAttribute(dp,o),window.dispatchEvent(new CustomEvent("profiler:theme-change",{detail:{theme:o}}))}resolveTheme(r){return r==="auto"?this.systemPreference.matches?"dark":"light":r}getTheme(){return this.currentTheme}getResolvedTheme(){return this.resolveTheme(this.currentTheme)}setTheme(r){this.currentTheme=r,this.saveTheme(r),this.applyTheme(r)}toggle(){let o=this.getResolvedTheme()==="dark"?"light":"dark";this.setTheme(o)}},un=new an;function fp(){un.toggle()}function ln(){return un.getResolvedTheme()}function mp(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function hp(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function Zi(){let e=document.createElement("button");e.className="profiler-theme-toggle",e.setAttribute("aria-label","Toggle theme"),e.title="Toggle light/dark mode";let r=()=>{let o=ln();for(;e.firstChild;)e.removeChild(e.firstChild);let s=o==="dark"?mp():hp();e.appendChild(s)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{fp()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",ln())}):console.log("\u{1F3A8} Theme system initialized:",ln());var rs=new Qs({defaultOptions:{queries:{staleTime:3e4,retry:1}}});document.addEventListener("DOMContentLoaded",()=>{let e=document.getElementById("profiler-cluster-selector"),r=document.querySelector('meta[name="profiler-is-master"]')?.getAttribute("content")==="true";e&&r&&fr(t(qr,{client:rs,children:t(Ci,{})}),e);let o=document.getElementById("profiler-index");o&&fr(t(qr,{client:rs,children:t(wi,{})}),o);let s=document.getElementById("profiler-show");if(s){let l=document.getElementById("profiler-show-data");if(l){let c=JSON.parse(l.textContent),d=new URLSearchParams(location.search).get("tab")||"request",m=s.dataset.embedded==="true",f;c.profile_type==="job"?f=t(Ni,{profile:c,initialTab:d,embedded:m}):c.profile_type==="console"?f=t(Ii,{profile:c,initialTab:d,embedded:m}):c.profile_type==="test"?f=t(Vi,{profile:c,initialTab:d,embedded:m}):f=t(Ki,{profile:c,initialTab:d,embedded:m}),fr(t(qr,{client:rs,children:f}),s)}}let n=document.getElementById("profiler-test-runner");n&&fr(t(qr,{client:rs,children:t(Hi,{})}),n);let a=document.getElementById("profiler-compare");if(a){let l=a.dataset.tokenA,c=a.dataset.tokenB;l&&c&&fr(t(Bi,{tokenA:l,tokenB:c,nodeA:a.dataset.nodeA||"",nodeB:a.dataset.nodeB||""}),a)}if(!o&&!s&&!n&&!a){let l=document.querySelector(".header, .profiler-detail");if(l){let c=Zi();c.style.position="absolute",c.style.top="20px",c.style.right="20px",l.style.position="relative",l.appendChild(c)}}let i=document.getElementById("profiler-timeline");i&&Ji(i)});})();
14
+ ${e.method} requests usually change data: the replay will really do it.`:"",d=`Replay ${e.method} ${e.path} against the application for real?${c}`;if(window.confirm(d)){i(null),n(null);try{n(await r({id:e.token,data:{}}))}catch(m){i(m instanceof Error?m.message:String(m))}}},children:o?"Replaying\u2026":"\u21BB Replay request"}),a&&t("span",{class:"profiler-text--xs profiler-text--error",style:"margin-left:8px",children:a}),s&&s.replays.map(c=>t("span",{class:"profiler-text--xs",style:"margin-left:8px",children:c.error?c.error:c.token?t("a",{href:`/_profiler/profiles/${c.token}?tab=request`,children:[c.status," \xB7 open the new profile"]}):`${c.status} (not profiled)`},c.index))]})}function Ei({profile:e}){let r=e.collectors_data?.request??{},o=e.params&&Object.keys(e.params).length>0,s=Oc(e,r);return t("div",{class:"profiler-ajax-card profiler-ajax-card--success",style:"margin-bottom:8px;background:var(--profiler-bg-elevated);transform:translateX(3px);box-shadow:var(--profiler-shadow-sm);transition:none",children:[t(zo,{method:e.method,url:e.path,copyUrl:`http://localhost:3000${e.path}`,status:e.status,duration:e.duration,curlCommand:qc(e)}),e.replay_of&&t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--muted",children:["Replay of ",t("a",{href:`/_profiler/profiles/${e.replay_of}?tab=request`,children:e.replay_of})]}),t(Qc,{profile:e}),(r.controller_action||r.route_pattern)&&t("div",{class:"profiler-ajax-card__row",children:[r.controller_action&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"margin-right:16px",children:r.controller_action}),r.route_pattern&&t("span",{class:"profiler-text--xs profiler-text--muted",style:"font-family:monospace",children:[r.route_name?`${r.route_name} \xB7 `:"",r.route_pattern]})]}),s.map(n=>t("div",{class:"profiler-ajax-card__row profiler-text--xs profiler-text--warning",children:n},n)),t(Jo,{request:{headers:e.headers??{},body:e.request_body??void 0,body_encoding:e.request_body_encoding,params:o?e.params:void 0},response:{headers:e.response_headers??{},body:e.response_body??void 0,body_encoding:e.response_body_encoding}})]})}function Lc(e){return e.replace(/\$\d+/g,"?").replace(/\b\d+\b/g,"?").replace(/'[^']*'/g,"?").replace(/"[^"]*"/g,"?").trim()}function Kc(e){let r=new Map;e.forEach((s,n)=>{if(s.cached||s.transaction)return;let a=Lc(s.sql);r.has(a)||r.set(a,{indices:[],backtrace:s.backtrace??[]}),r.get(a).indices.push(n)});let o=[];return r.forEach(({indices:s,backtrace:n},a)=>{s.length>=3&&o.push({pattern:a,indices:s,backtrace:n})}),o.sort((s,n)=>n.indices.length-s.indices.length)}function Ri(e,r=0){let o=e["Node Type"]??"",s=e["Actual Rows"]??0,n=e["Plan Rows"]??1,a=o.includes("Seq Scan")||o.includes("Hash Join")||o.includes("Nested Loop")||o.includes("Filter")||s>0&&n>0&&s>n*10,i=e.Plans??[];return t("div",{class:`profiler-explain-node${a?" profiler-explain-node--expensive":""}`,style:`margin-left:${r*14}px`,children:[t("span",{class:"profiler-explain-node__type",children:o}),e["Relation Name"]&&t("span",{class:"profiler-text--muted",children:[" on ",e["Relation Name"]]}),e["Index Name"]&&t("span",{class:"profiler-text--muted",children:[" using ",e["Index Name"]]}),t("div",{class:"profiler-explain-node__stats profiler-text--xs profiler-text--muted",children:[e["Actual Total Time"]!=null&&t("span",{children:["time: ",e["Actual Total Time"].toFixed(3),"ms"]}),e["Actual Rows"]!=null&&t("span",{children:["rows: ",s," (est: ",n,")"]}),e["Total Cost"]!=null&&t("span",{children:["cost: ",e["Total Cost"].toFixed(2)]}),e.Filter&&t("span",{class:"profiler-text--warning",children:["filter: ",e.Filter]})]}),i.map((l,c)=>Ri(l,r+1))]})}function Uc({state:e,onClose:r}){if(G(()=>{if(!e.open)return;let s=n=>{n.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e.open]),!e.open)return null;let o=()=>{if(e.loading)return t("div",{class:"profiler-text--muted",children:"Running EXPLAIN ANALYZE\u2026"});if(e.error)return t("div",{class:"profiler-text--error",children:e.error});if(!e.result)return null;if(e.format==="json")try{let s=typeof e.result=="string"?JSON.parse(e.result):e.result,n=Array.isArray(s)?s:[s];return t("div",{class:"profiler-explain-result",children:n.map((a,i)=>t("div",{children:[Ri(a.Plan??a),a["Planning Time"]!=null&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:["Planning: ",a["Planning Time"].toFixed(3),"ms",a["Execution Time"]!=null&&t(M,{children:[" \xB7 Execution: ",a["Execution Time"].toFixed(3),"ms"]})]})]},i))})}catch{return t("pre",{class:"profiler-explain-result",children:String(e.result)})}return t("pre",{class:"profiler-explain-result",children:String(e.result)})};return t("div",{class:"profiler-modal__overlay",onClick:r,children:t("div",{class:"profiler-modal",onClick:s=>s.stopPropagation(),children:[t("div",{class:"profiler-modal__header",children:[t("span",{class:"profiler-modal__title",children:"EXPLAIN ANALYZE"}),t("span",{class:"profiler-text--xs profiler-text--muted",children:e.adapter}),t("button",{class:"profiler-modal__close",onClick:r,children:"\xD7"})]}),t("div",{class:"profiler-modal__body",children:o()})]})})}function Qt({dbData:e,token:r}){let[o,s]=v(new Set),[n,a]=v({open:!1,loading:!1,result:null,format:"text",adapter:"",error:null}),{mutateAsync:i}=$a();if(!e?.queries)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No database queries recorded"})});let l=Kc(e.queries),c=new Set(l.flatMap(y=>y.indices)),d=y=>{s(h=>{let g=new Set(h);return g.has(y)?g.delete(y):g.add(y),g})},m=async y=>{a({open:!0,loading:!0,result:null,format:"text",adapter:"",error:null});try{let h=await i({data:{token:r,query_index:y}});a(g=>({...g,loading:!1,result:h.result,format:h.format??"text",adapter:h.adapter??""}))}catch(h){a(g=>({...g,loading:!1,error:h.message??"Request failed"}))}},f=()=>a(y=>({...y,open:!1}));return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Database Queries (",e.total_queries,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]}),t("span",{children:["Slow Queries: ",t("strong",{class:"profiler-text--error",children:e.slow_queries})]}),t("span",{children:["Cached: ",t("strong",{children:e.cached_queries})]})]}),l.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:"flex:1",children:[t("strong",{children:"Potential N+1 detected"})," - ",l.length," pattern",l.length>1?"s":""," repeated ",l.reduce((y,h)=>y+h.indices.length,0)," times total",t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:"Queries causing N+1 are highlighted below. Expand each group to see the call stack."})]}),l.length>1&&t("button",{class:"profiler-btn profiler-btn--sm",style:"flex-shrink:0;align-self:flex-start",onClick:()=>{let y=l.every(h=>o.has(h.pattern));s(y?new Set:new Set(l.map(h=>h.pattern)))},children:l.every(y=>o.has(y.pattern))?"Collapse all":"Expand all"})]}),l.map(y=>t("div",{class:"profiler-n1-group profiler-mb-4",children:[t("div",{class:"profiler-n1-group__header",onClick:()=>d(y.pattern),children:[t("span",{class:"profiler-n1-group__count",children:["N+1 \xB7 ",y.indices.length,"\xD7"]}),t("code",{class:"profiler-n1-group__pattern",children:y.pattern}),t("span",{class:"profiler-n1-group__toggle",children:[o.has(y.pattern)?"\u25B2":"\u25BC"," backtrace"]})]}),o.has(y.pattern)&&y.backtrace.length>0&&t("div",{class:"profiler-n1-backtrace",children:y.backtrace.map((h,g)=>t("div",{class:"profiler-n1-backtrace__frame",children:t(vt,{frame:h})},g))})]},y.pattern)),e.queries.map((y,h)=>t("div",{class:["profiler-query-card",y.slow?"profiler-query-card--slow":"",c.has(h)?"profiler-query-card--n1":""].filter(Boolean).join(" "),children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:"profiler-text--muted",children:["#",h+1]}),c.has(h)&&t("span",{class:"profiler-badge profiler-badge--warning",children:"N+1"}),y.name&&t("span",{class:"profiler-text--xs profiler-text--muted",children:y.name})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`profiler-query-card__duration ${y.slow?"profiler-query-card__duration--slow":"profiler-query-card__duration--fast"}`,children:[y.duration.toFixed(2)," ms"]}),!y.cached&&!y.transaction&&t("button",{class:"profiler-btn profiler-btn--sm",onClick:()=>m(h),children:"Explain"})]})]}),t("code",{class:"profiler-query-card__code",children:y.sql})]},h)),t(Uc,{state:n,onClose:f})]})}function Lt({dumpData:e}){return e?.dumps?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Dumped Variables (",e.count,")"]}),e.dumps.map((r,o)=>t("div",{class:"profiler-dump-card",children:[t("div",{class:"profiler-dump-card__header",children:[t("div",{children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["#",o+1]}),r.label&&t("span",{class:"profiler-dump-card__label",children:r.label})]}),t("div",{children:[t("div",{class:"profiler-dump-card__location",children:t(ir,{file:r.file,line:r.line})}),t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:new Date(r.timestamp).toLocaleTimeString("en",{hour12:!1})})]})]}),t("div",{class:"profiler-dump-card__content",children:t("pre",{children:r.formatted})})]},o))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F50D}"}),t("h3",{class:"profiler-empty__title",children:"No dumps recorded"}),t("div",{class:"profiler-empty__description",children:[t("p",{children:["Use ",t("code",{children:"Profiler.dump(variable)"})," in your code to dump variables here."]}),t("p",{class:"profiler-mt-3",children:["Example: ",t("code",{children:'Profiler.dump(@user, "Current user")'})]})]})]})}var Nc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},xt=24,jc=1,en=xt+jc,Ic=60,$c=300,fo=class{constructor(r,o,s){this.frames=[];this.maxDepth=0;this.globalStart=0;this.globalEnd=0;this.viewport={start:0,end:0};this.targetViewport={start:0,end:0};this.animating=!1;this.animStart=0;this.prevViewport={start:0,end:0};this.dpr=1;this.hoveredFrame=null;this.zoomStack=[];this.searchQuery="";this.highlightName="";this.isPanning=!1;this.panStartX=0;this.panStartViewport={start:0,end:0};this.boundHandlers={};this.canvas=r,this.ctx=r.getContext("2d"),this.callbacks=s,this.flatten(o),this.computeGlobalBounds(),this.viewport={start:this.globalStart,end:this.globalEnd},this.targetViewport={...this.viewport},this.setupCanvas(),this.bindEvents(),this.render()}flatten(r){this.frames=[],this.maxDepth=0;let o=(s,n)=>{for(let a of s)this.frames.push({node:a,depth:n,absStart:a.started_at,absEnd:a.finished_at}),n>this.maxDepth&&(this.maxDepth=n),a.children?.length&&o(a.children,n+1)};o(r,0)}computeGlobalBounds(){if(this.frames.length===0){this.globalStart=0,this.globalEnd=1;return}this.globalStart=Math.min(...this.frames.map(r=>r.absStart)),this.globalEnd=Math.max(...this.frames.map(r=>r.absEnd)),this.globalEnd<=this.globalStart&&(this.globalEnd=this.globalStart+1)}setupCanvas(){this.dpr=window.devicePixelRatio||1,this.resizeCanvas()}resizeCanvas(){let o=this.canvas.getBoundingClientRect().width,s=(this.maxDepth+1)*en+8;this.canvas.width=o*this.dpr,this.canvas.height=s*this.dpr,this.canvas.style.height=`${s}px`,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.render()}bindEvents(){this.boundHandlers.mousemove=r=>this.onMouseMove(r),this.boundHandlers.mouseleave=()=>this.onMouseLeave(),this.boundHandlers.click=r=>this.onClickEvent(r),this.boundHandlers.wheel=r=>this.onWheel(r),this.boundHandlers.mousedown=r=>this.onMouseDown(r),this.boundHandlers.mouseupmove=r=>this.onMouseUpOrMove(r),this.boundHandlers.mouseup=()=>this.onMouseUp(),this.canvas.addEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.addEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.addEventListener("click",this.boundHandlers.click),this.canvas.addEventListener("wheel",this.boundHandlers.wheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.boundHandlers.mousedown),window.addEventListener("mousemove",this.boundHandlers.mouseupmove),window.addEventListener("mouseup",this.boundHandlers.mouseup)}hitTest(r,o){let s=this.canvas.getBoundingClientRect(),n=r-s.left,a=o-s.top,i=s.width,l=this.viewport.end-this.viewport.start;for(let c=this.frames.length-1;c>=0;c--){let d=this.frames[c],m=(d.absStart-this.viewport.start)/l*i,f=(d.absEnd-d.absStart)/l*i,y=d.depth*en;if(n>=m&&n<=m+f&&a>=y&&a<=y+xt)return d}return null}onMouseMove(r){if(this.isPanning)return;let o=this.hitTest(r.clientX,r.clientY);this.hoveredFrame=o,this.canvas.style.cursor=o?"pointer":"default",this.callbacks.onHover(o,r.clientX,r.clientY),this.render()}onMouseLeave(){this.hoveredFrame=null,this.canvas.style.cursor="default",this.callbacks.onHover(null,0,0),this.render()}onClickEvent(r){if(this.isPanning)return;let o=this.hitTest(r.clientX,r.clientY);o&&(this.callbacks.onClick(o),this.zoomTo(o.node))}onWheel(r){r.preventDefault();let o=this.canvas.getBoundingClientRect(),n=(r.clientX-o.left)/o.width,a=this.viewport.end-this.viewport.start,i=r.deltaY>0?1.3:.7,l=Math.min(this.globalEnd-this.globalStart,a*i),c=this.viewport.start+n*a,d=c-n*l,m=c+(1-n)*l;d<this.globalStart&&(d=this.globalStart,m=d+l),m>this.globalEnd&&(m=this.globalEnd,d=m-l),this.animateViewport({start:d,end:m}),this.updateZoomStack(d,m)}onMouseDown(r){r.button===0&&(this.isPanning=!0,this.panStartX=r.clientX,this.panStartViewport={...this.viewport},this.canvas.style.cursor="grabbing")}onMouseUpOrMove(r){if(!this.isPanning)return;let o=r.clientX-this.panStartX,s=this.canvas.getBoundingClientRect(),n=this.panStartViewport.end-this.panStartViewport.start,a=-(o/s.width)*n,i=this.panStartViewport.start+a,l=this.panStartViewport.end+a;i<this.globalStart&&(l+=this.globalStart-i,i=this.globalStart),l>this.globalEnd&&(i-=l-this.globalEnd,l=this.globalEnd),this.viewport={start:i,end:l},this.targetViewport={...this.viewport},this.render()}onMouseUp(){this.isPanning&&(this.isPanning=!1,this.canvas.style.cursor="default")}zoomTo(r){let o=[],s=(a,i,l)=>{for(let c of a){if(c===i)return o.push(...l,c),!0;if(c.children?.length&&s(c.children,i,[...l,c]))return!0}return!1},n=this.frames.filter(a=>a.depth===0).map(a=>a.node);s(n,r,[]),this.zoomStack=o,this.animateViewport({start:r.started_at,end:r.finished_at}),this.callbacks.onZoomChange(o)}resetZoom(){this.zoomStack=[],this.animateViewport({start:this.globalStart,end:this.globalEnd}),this.callbacks.onZoomChange([])}updateZoomStack(r,o){let s=this.globalEnd-this.globalStart;o-r>=s*.99&&(this.zoomStack=[],this.callbacks.onZoomChange([]))}animateViewport(r){this.prevViewport={...this.viewport},this.targetViewport=r,this.animStart=performance.now(),this.animating||(this.animating=!0,this.animLoop())}animLoop(){let r=Math.min(1,(performance.now()-this.animStart)/$c),o=r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2;this.viewport={start:this.prevViewport.start+(this.targetViewport.start-this.prevViewport.start)*o,end:this.prevViewport.end+(this.targetViewport.end-this.prevViewport.end)*o},this.render(),r<1?requestAnimationFrame(()=>this.animLoop()):(this.animating=!1,this.viewport={...this.targetViewport},this.render())}setSearchQuery(r){this.searchQuery=r,this.render()}setHighlightName(r){this.highlightName=r,this.render()}render(){let r=this.ctx,o=this.canvas.width/this.dpr,s=this.canvas.height/this.dpr,n=this.viewport.end-this.viewport.start;r.clearRect(0,0,o,s);let a=getComputedStyle(this.canvas),i=a.getPropertyValue("--profiler-text").trim()||"#eef2f7",l=a.getPropertyValue("--profiler-text-muted").trim()||"#5e7080",c=this.searchQuery.toLowerCase(),d=c.length>0;if(d&&this.callbacks.onSearchResults){let m=0;for(let f of this.frames)f.node.name.toLowerCase().includes(c)&&m++;this.callbacks.onSearchResults(m,this.frames.length)}for(let m of this.frames){let f=(m.absStart-this.viewport.start)/n*o,y=(m.absEnd-m.absStart)/n*o,h=m.depth*en;if(f+y<0||f>o||y<.5)continue;let g=Nc[m.node.category]||"#a78bfa",b=m===this.hoveredFrame,x=!!this.highlightName&&m.node.name===this.highlightName,w=!d||m.node.name.toLowerCase().includes(c);if(r.fillStyle=b||x?this.lightenColor(g,.2):g,r.globalAlpha=d&&!w?.2:b||x?1:.85,this.roundRect(r,f,h,y,xt,3),r.fill(),r.globalAlpha=1,b?(r.strokeStyle="#ffffff",r.lineWidth=1.5,this.roundRect(r,f,h,y,xt,3),r.stroke()):x?(r.strokeStyle="#fbbf24",r.lineWidth=2,this.roundRect(r,f,h,y,xt,3),r.stroke()):d&&w&&(r.strokeStyle="#ffffff",r.lineWidth=1,r.globalAlpha=.5,this.roundRect(r,f,h,y,xt,3),r.stroke(),r.globalAlpha=1),y>Ic&&w){r.fillStyle=this.getTextColor(g),r.font='11px "JetBrains Mono", monospace',r.textBaseline="middle";let C=m.node.name,A=`${m.node.duration.toFixed(1)}ms`,k=y-8,K=r.measureText(A).width;if(k>K+20){let U=k-K-8;r.fillText(this.truncateText(r,C,U),f+4,h+xt/2),r.fillStyle=b?i:l,r.fillText(A,f+y-K-4,h+xt/2)}else r.fillText(this.truncateText(r,C,k),f+4,h+xt/2)}}}roundRect(r,o,s,n,a,i){r.beginPath(),r.moveTo(o+i,s),r.lineTo(o+n-i,s),r.quadraticCurveTo(o+n,s,o+n,s+i),r.lineTo(o+n,s+a-i),r.quadraticCurveTo(o+n,s+a,o+n-i,s+a),r.lineTo(o+i,s+a),r.quadraticCurveTo(o,s+a,o,s+a-i),r.lineTo(o,s+i),r.quadraticCurveTo(o,s,o+i,s),r.closePath()}truncateText(r,o,s){if(r.measureText(o).width<=s)return o;let n=o;for(;n.length>0&&r.measureText(n+"...").width>s;)n=n.slice(0,-1);return n.length>0?n+"...":""}lightenColor(r,o){let s=parseInt(r.slice(1),16),n=Math.min(255,(s>>16&255)+Math.round(255*o)),a=Math.min(255,(s>>8&255)+Math.round(255*o)),i=Math.min(255,(s&255)+Math.round(255*o));return`rgb(${n},${a},${i})`}getTextColor(r){let o=parseInt(r.slice(1),16),s=o>>16&255,n=o>>8&255,a=o&255;return(.299*s+.587*n+.114*a)/255>.5?"#1a1a2e":"#f0f0f0"}destroy(){this.canvas.removeEventListener("mousemove",this.boundHandlers.mousemove),this.canvas.removeEventListener("mouseleave",this.boundHandlers.mouseleave),this.canvas.removeEventListener("click",this.boundHandlers.click),this.canvas.removeEventListener("wheel",this.boundHandlers.wheel),this.canvas.removeEventListener("mousedown",this.boundHandlers.mousedown),window.removeEventListener("mousemove",this.boundHandlers.mouseupmove),window.removeEventListener("mouseup",this.boundHandlers.mouseup)}};var Vc={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"},Hc={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"};function Gc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var mo=class{constructor(r,o){this.totalDuration=o,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__tooltip",r.appendChild(this.el)}show(r,o,s){let n=r.node,a=n.category,i=Hc[a]||"#a78bfa",l=Vc[a]||a,c=this.totalDuration>0?(n.duration/this.totalDuration*100).toFixed(1):"0";this.el.textContent="";let d=document.createElement("div");if(d.className="tooltip-header",d.textContent=n.name,this.el.appendChild(d),this.addRow("Category",()=>{let h=document.createElement("span");return h.className="tooltip-badge",h.style.background=i,h.textContent=l,h}),this.addRow("Duration",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.duration.toFixed(2)} ms`,h}),this.addRow("% of total",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${c}%`,h}),a==="method"&&n.payload&&(n.payload.memory_bytes!=null&&this.addRow("Memory",()=>{let h=document.createElement("span");return h.className="value",h.textContent=Gc(n.payload.memory_bytes),h}),n.payload.allocated_objects!=null&&this.addRow("Objects",()=>{let h=document.createElement("span");return h.className="value",h.textContent=`${n.payload.allocated_objects.toLocaleString()} obj`,h}),n.payload.recursive&&this.addRow("Recursive",()=>{let h=document.createElement("span");return h.className="value",h.style.color="var(--profiler-warning)",h.textContent="\u21BA yes",h}),n.payload.file)){let h=document.createElement("div");h.className="tooltip-payload",h.textContent=`${n.payload.file}:${n.payload.line}`,this.el.appendChild(h)}if(n.payload&&a!=="method"){let h=null;if(a==="sql"&&n.payload.sql){let g=n.payload.sql;h=g.length>200?g.slice(0,200)+"...":g}else if(a==="cache"&&n.payload.key)h=`Key: ${n.payload.key}`;else if(a==="http"&&n.payload.url)h=n.payload.url;else if(a==="custom"&&Object.keys(n.payload).length>0){let g=Object.entries(n.payload).map(([b,x])=>`${b}: ${JSON.stringify(x)}`).join(`
15
+ `);h=g.length>200?g.slice(0,200)+"...":g}if(h){let g=document.createElement("div");g.className="tooltip-payload",g.textContent=h,this.el.appendChild(g)}}let m=o+12,f=s-8,y=this.el.getBoundingClientRect();m+y.width>window.innerWidth&&(m=o-y.width-12),f+y.height>window.innerHeight&&(f=s-y.height-8),f<0&&(f=4),this.el.style.left=`${m}px`,this.el.style.top=`${f}px`,this.el.classList.add("visible")}hide(){this.el.classList.remove("visible")}destroy(){this.el.remove()}addRow(r,o){let s=document.createElement("div");s.className="tooltip-row";let n=document.createElement("span");n.className="label",n.textContent=r,s.appendChild(n),s.appendChild(o()),this.el.appendChild(s)}};var ho=class{constructor(r,o){this.onNavigate=o,this.el=document.createElement("div"),this.el.className="profiler-flamegraph__breadcrumbs",r.appendChild(this.el)}update(r){if(this.el.textContent="",r.length===0){this.el.style.display="none";return}this.el.style.display="flex";let o=document.createElement("button");o.className="breadcrumb-item",o.textContent="Root",o.addEventListener("click",()=>this.onNavigate(null)),this.el.appendChild(o);for(let s of r){let n=document.createElement("span");n.className="breadcrumb-separator",n.textContent="\u203A",this.el.appendChild(n);let a=document.createElement("button");a.className="breadcrumb-item";let i=s.name.length>30?s.name.slice(0,30)+"...":s.name;a.textContent=i,a.addEventListener("click",()=>this.onNavigate(s)),this.el.appendChild(a)}}destroy(){this.el.remove()}};var tn={controller:"#60a5fa",view:"#34d399",partial:"#f59e0b",sql:"#fb923c",cache:"#a78bfa",http:"#f87171",custom:"#e879f9",method:"#94a3b8"},ki={controller:"Controller",view:"View",partial:"Partial",sql:"SQL",cache:"Cache",http:"HTTP",custom:"Custom",method:"Method"};function Kt({flamegraphData:e,perfData:r,functionProfileData:o}){let s=he(null),n=he(null),a=he(null),i=he(null),l=he(null),c=he(null),[d,m]=v(!1),[f,y]=v(""),[h,g]=v(0),[b,x]=v(0),[w,C]=v("total_duration"),[A,k]=v("desc"),[K,U]=v(o?.reason==="stackprof_missing"?!0:o?.enabled??!1),[L,j]=v(o?.max_frames??2e3),[T,F]=v(o?.mode==="lite"?"lite":"full"),[$,Z]=v(o?.clock??"wall"),[B,ce]=v(!1),[fe,Y]=v(!1),[Fe,Ne]=v(!1),[je,De]=v(!1),{mutateAsync:be}=Ha(),we=async()=>{ce(!0);try{let Q=await be({data:{enabled:!K}});U(Q.enabled)}finally{ce(!1)}},qe=async Q=>{Y(!0);try{let W=await be({data:{max_frames:Q}});j(W.max_frames)}finally{Y(!1)}},nt=async Q=>{F(Q),Ne(!0);try{let W=await be({data:{mode:Q}});F(W.mode??Q)}finally{Ne(!1)}},P=async Q=>{De(!0);try{let W=await be({data:{clock:Q}});Z(W.clock??Q)}finally{De(!1)}},H=e;if(G(()=>{if(!H?.root_events?.length||!s.current||!n.current)return;let Q=n.current,W=s.current,Ie=new mo(Q,H.total_duration);i.current=Ie;let Ee=new ho(Q,pe=>{a.current&&(pe?a.current.zoomTo(pe):a.current.resetZoom())});l.current=Ee,Q.insertBefore(Ee.el,W);let Qe=new fo(W,H.root_events,{onHover:(pe,it,lt)=>{pe?Ie.show(pe,it,lt):Ie.hide()},onClick:pe=>{m(!0)},onZoomChange:pe=>{Ee.update(pe),m(pe.length>0)},onSearchResults:(pe,it)=>{g(pe),x(it)}});a.current=Qe;let Le=()=>Qe.resizeCanvas();window.addEventListener("resize",Le);let Vt=()=>Qe.render();return document.addEventListener("profiler:theme-change",Vt),()=>{Qe.destroy(),Ie.destroy(),Ee.destroy(),window.removeEventListener("resize",Le),document.removeEventListener("profiler:theme-change",Vt),a.current=null,i.current=null,l.current=null}},[H]),G(()=>{a.current?.setSearchQuery(f),f||(g(0),x(0))},[f]),G(()=>{let Q=W=>{(W.ctrlKey||W.metaKey)&&W.key==="f"&&(W.preventDefault(),c.current?.focus())};return document.addEventListener("keydown",Q,{capture:!0}),()=>document.removeEventListener("keydown",Q,{capture:!0})},[]),!H?.root_events?.length)return r?.events?.length?t("div",{class:"profiler-flamegraph",children:[t("h2",{class:"profiler-section__header",children:["Performance Timeline (",r.total_events," events)"]}),t("p",{class:"profiler-mb-4",children:["Total Duration: ",t("strong",{children:[r.total_duration," ms"]})]}),r.events.map((Q,W)=>t("div",{class:"profiler-query-card",children:[t("div",{class:"profiler-query-card__header",children:[t("strong",{children:Q.name}),t("span",{class:Q.duration>=500?"badge-error":Q.duration>=100?"badge-warning":"badge-success",children:[Q.duration.toFixed(2)," ms"]})]}),Q.payload&&Object.keys(Q.payload).length>0&&t("pre",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:JSON.stringify(Q.payload,null,2)})]},W)),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]}):t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No performance events recorded"})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]});let Ce={},at=Q=>{let W=Q.category;Ce[W]||(Ce[W]={count:0,duration:0}),Ce[W].count++,Ce[W].duration+=Q.duration,Q.children?.forEach(at)};H.root_events.forEach(at);let ur=()=>{a.current?.resetZoom(),m(!1)};return t("div",{class:"profiler-flamegraph",children:[t("div",{class:"profiler-flamegraph__stats",children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Events"}),t("span",{class:"stat-value",children:H.total_events})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Total Duration"}),t("span",{class:"stat-value",children:[H.total_duration.toFixed(2)," ",t("small",{children:"ms"})]})]}),Object.keys(Ce).map(Q=>t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:[t("span",{class:"stat-dot",style:{background:tn[Q]}}),ki[Q]]}),t("span",{class:"stat-value",children:Ce[Q].count})]},Q))]}),t("div",{class:"profiler-flamegraph__legend",children:Object.keys(tn).map(Q=>t("div",{class:"legend-item",children:[t("span",{class:"legend-color",style:{background:tn[Q]}}),t("span",{children:ki[Q]})]},Q))}),t("div",{class:"profiler-flamegraph__controls",children:[d&&t("button",{class:"profiler-flamegraph__reset",onClick:ur,children:"Reset Zoom"}),t("div",{class:"profiler-flamegraph__search",children:[t("input",{ref:c,type:"text",class:"profiler-flamegraph__search-input",placeholder:"Search events\u2026 (Ctrl+F)",value:f,onInput:Q=>y(Q.target.value)}),f&&t("span",{class:"profiler-flamegraph__match-count",children:[h," / ",b]})]}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom, scroll to zoom in/out, drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:n,children:t("canvas",{ref:s,class:"profiler-flamegraph__canvas",style:{width:"100%"}})}),t(rn,{data:o,enabled:K,toggling:B,maxFrames:L,maxFramesUpdating:fe,mode:T,modeUpdating:Fe,clock:$,clockUpdating:je,sortKey:w,sortDir:A,onToggle:we,onMaxFramesChange:qe,onModeChange:nt,onClockChange:P,onSortChange:(Q,W)=>{C(Q),k(W)}})]})}function Pi(e,r=new Set){return r.add(e.name),e.children?.forEach(o=>Pi(o,r)),r}function Si(e,r){for(let o of e){if(o.name===r)return o;let s=Si(o.children??[],r);if(s)return s}return null}function rn({data:e,enabled:r,toggling:o,maxFrames:s,maxFramesUpdating:n,mode:a,modeUpdating:i,clock:l,clockUpdating:c,sortKey:d,sortDir:m,onToggle:f,onMaxFramesChange:y,onModeChange:h,onClockChange:g,onSortChange:b}){let[x,w]=v(null),[C,A]=v(null),[k,K]=v(null),U=he(null),L=r&&e?.enabled&&(e.functions?.length??0)>0,j=e?.reason==="stackprof_missing"&&a==="lite",T=e?.mode??"full",F=e?.clock??"wall",$=T==="lite",Z=F==="object",B=!$,ce=T==="full",fe=a==="lite",Y=d==="memory_bytes"&&!ce||d==="allocated_objects"&&!B?"total_duration":d,Fe=L?e.root_calls??[]:[],Ne=L?[...e.functions].sort((P,H)=>m==="asc"?P[Y]-H[Y]:H[Y]-P[Y]):[],je=x?Ne.filter(P=>x.has(P.name)):Ne,De=P=>{P?(w(Pi(P)),A(P.name)):(w(null),A(null))},be=P=>{P===d?b(P,m==="asc"?"desc":"asc"):b(P,"desc")},we=P=>Y!==P?t("span",{class:"sort-icon sort-icon--idle",children:"\u21C5"}):t("span",{class:"sort-icon sort-icon--active",children:m==="asc"?"\u25B2":"\u25BC"}),qe=P=>{let H=parseInt(P.target.value,10);!isNaN(H)&&H>0&&H!==s&&y(H)},nt=P=>{P.key==="Enter"&&P.target.blur()};return t("div",{class:"profiler-fn-profiling",children:[t("div",{class:"profiler-fn-profiling__header",children:[t("span",{class:`profiler-fn-profiling__title${r?" profiler-fn-profiling__title--active":""}`,children:"Function Profiling"}),t("div",{class:"profiler-fn-profiling__controls",children:[t("div",{class:"profiler-fn-profiling__mode-selector",children:["full","lite"].map(P=>t("button",{class:`profiler-fn-profiling__mode-btn${a===P?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>a!==P&&h(P),disabled:i,title:P==="full"?"Exhaustive TracePoint - timing + allocations + memory bytes":"StackProf sampling - very low overhead",children:P.charAt(0).toUpperCase()+P.slice(1)},P))}),fe&&t("div",{class:"profiler-fn-profiling__mode-selector",children:["wall","cpu","object"].map(P=>t("button",{class:`profiler-fn-profiling__mode-btn${l===P?" profiler-fn-profiling__mode-btn--active":""}`,onClick:()=>l!==P&&g(P),disabled:c,title:P==="wall"?"Wall-clock time (includes I/O waits)":P==="cpu"?"CPU time only (excludes I/O waits)":"Object allocations per function",children:P==="wall"?"Wall":P==="cpu"?"CPU":"Alloc"},P))}),t("label",{class:"profiler-fn-profiling__max-frames-label",children:["Max frames",t("input",{type:"number",class:"profiler-fn-profiling__max-frames-input",defaultValue:s,min:1,disabled:n,onBlur:qe,onKeyDown:nt}),n&&t("span",{class:"profiler-fn-profiling__updating",children:"\u2026"})]}),t("button",{class:`profiler-fn-profiling__toggle${r?" profiler-fn-profiling__toggle--active":""}`,onClick:f,disabled:o,children:o?"\u2026":r?"Enabled (click to disable)":"Disabled (click to enable)"})]})]}),!r&&t("p",{class:"profiler-fn-profiling__hint",children:["Enable function profiling to see where your app spends time."," ",t("strong",{children:"Lite"}),": statistical sampling with the stackprof gem, to add to the application's Gemfile; very low overhead (<1%), on by default once stackprof is installed."," ",t("strong",{children:"Full"}),": exhaustive TracePoint tracing with memory bytes - significant overhead."]}),r&&j&&t("p",{class:"profiler-fn-profiling__hint",children:["No data: sampling needs the ",t("code",{children:"stackprof"})," gem, which is not installed. Add"," ",t("code",{children:'gem "stackprof"'})," to the application's Gemfile. To trace every method call instead, at a much higher cost, choose ",t("strong",{children:"Full"}),", or set"," ",t("code",{children:"Profiler.function_profiling_tracepoint_fallback = true"})," in an initializer."]}),r&&!L&&!j&&t("p",{class:"profiler-fn-profiling__hint",children:"Function profiling is active. Data will appear on the next request."}),L&&t(M,{children:[e.frame_cap_reached&&t("div",{class:"profiler-fn-profiling__cap-warning",children:["\u26A0 Frame cap reached (",e.max_frames,' frames) - call tree is truncated. Increase "Max frames" to capture more.']}),t("div",{class:"profiler-flamegraph__stats",style:{marginTop:"0.75rem"},children:[t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Functions"}),t("span",{class:"stat-value",children:e.functions.length})]}),t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:$?"Total Samples":"Total Calls"}),t("span",{class:"stat-value",children:e.total_calls})]}),!Z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Wall"}),t("span",{class:"stat-value",children:[(e.elapsed_wall_ms??e.total_duration??0).toFixed(2)," ",t("small",{children:"ms"})]})]}),$&&!Z&&e.elapsed_cpu_ms!=null&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:"CPU time excludes I/O waits (DB, network, sleep). Low CPU% = I/O-bound.",children:"CPU"}),t("span",{class:"stat-value",children:[e.elapsed_cpu_ms.toFixed(2)," ",t("small",{children:"ms"}),e.elapsed_wall_ms!=null&&e.elapsed_wall_ms>0&&t("small",{class:"profiler-fn-profiling__cpu-pct",children:[" ","(",Math.round(e.elapsed_cpu_ms/e.elapsed_wall_ms*100),"%)"]})]})]}),Z&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocations"}),t("span",{class:"stat-value",children:[e.total_duration?.toLocaleString()," ",t("small",{children:"obj"})]})]}),$&&(e.gc_overhead_pct??0)>0&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",title:`${e.gc_samples} samples during GC`,children:"GC"}),t("span",{class:`stat-value${(e.gc_overhead_pct??0)>=20?" profiler-fn-profiling__gc--high":(e.gc_overhead_pct??0)>=5?" profiler-fn-profiling__gc--medium":""}`,children:[e.gc_overhead_pct,"%"]})]}),B&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Allocated"}),t("span",{class:"stat-value",children:[e.total_allocated_objects?.toLocaleString()," ",t("small",{children:"obj"})]})]}),ce&&t("div",{class:"stat-item",children:[t("span",{class:"stat-label",children:"Memory"}),t("span",{class:"stat-value",children:Qr(e.total_memory_bytes??0)})]})]}),Fe.length>0&&t(Bc,{rootCalls:Fe,onFrameSelect:De,rendererRef:U,onHoverName:P=>K(P)}),x&&t("div",{class:"profiler-fn-profiling__filter-active",children:[t("span",{children:["Showing ",t("strong",{children:C})," + ",x.size-1," child function",x.size!==2?"s":""]}),t("button",{class:"profiler-fn-profiling__filter-clear",onClick:()=>{w(null),A(null)},children:"\u2715 Clear"})]}),t("table",{class:"profiler-table profiler-fn-profiling__table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Function"}),t("th",{children:"File"}),t("th",{class:`profiler-text--right sortable${Y==="calls"?" sortable--active":""}`,onClick:()=>be("calls"),children:[$?"Samples":"Calls"," ",we("calls")]}),t("th",{class:`profiler-text--right sortable${Y==="total_duration"?" sortable--active":""}`,onClick:()=>be("total_duration"),children:[Z?"Total Alloc":"Total Time"," ",we("total_duration")]}),t("th",{class:`profiler-text--right sortable${Y==="self_duration"?" sortable--active":""}`,onClick:()=>be("self_duration"),children:[Z?"Self Alloc":"Self Time"," ",we("self_duration")]}),B&&t("th",{class:`profiler-text--right sortable${Y==="allocated_objects"?" sortable--active":""}`,onClick:()=>be("allocated_objects"),children:["Objects ",we("allocated_objects")]}),ce&&t("th",{class:`profiler-text--right sortable${Y==="memory_bytes"?" sortable--active":""}`,onClick:()=>be("memory_bytes"),children:["Memory ",we("memory_bytes")]})]})}),t("tbody",{children:je.map((P,H)=>t("tr",{class:k===P.name?"profiler-fn-profiling__row--highlighted":"",style:{cursor:Fe.length>0?"pointer":"default"},onMouseEnter:()=>{K(P.name),U.current?.setHighlightName(P.name)},onMouseLeave:()=>{K(null),U.current?.setHighlightName("")},onClick:()=>{let Ce=Si(Fe,P.name);Ce&&(U.current?.zoomTo(Ce),De(Ce))},children:[t("td",{class:"profiler-fn-profiling__name",children:[P.recursive_calls>0&&t("span",{class:"profiler-fn-profiling__recursive",title:`${P.recursive_calls} recursive call(s)`,children:"\u21BA"}),P.name]}),t("td",{class:"profiler-text--muted profiler-text--xs",style:{fontFamily:"var(--profiler-font-mono)"},children:t(ir,{file:P.file,line:P.line})}),t("td",{class:"profiler-text--right",children:P.calls}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[P.total_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:P.total_duration>=100?"badge-error":P.total_duration>=10?"badge-warning":"badge-success",children:[P.total_duration.toFixed(2)," ms"]})}),t("td",{class:"profiler-text--right",children:Z?t("span",{class:"profiler-text--muted",children:[P.self_duration.toLocaleString()," ",t("small",{children:"obj"})]}):t("span",{class:P.self_duration>=50?"badge-error":P.self_duration>=5?"badge-warning":"badge-success",children:[P.self_duration.toFixed(2)," ms"]})}),B&&t("td",{class:"profiler-text--right profiler-text--muted",children:[P.allocated_objects.toLocaleString()," ",t("small",{children:"obj"})]}),ce&&t("td",{class:"profiler-text--right profiler-text--muted",children:Qr(P.memory_bytes)})]},H))})]})]})]})}function Bc({rootCalls:e,onFrameSelect:r,rendererRef:o,onHoverName:s}){let n=he(null),a=he(null),i=he(null),l=he(r),c=he(s),[d,m]=v(!1);G(()=>{l.current=r},[r]),G(()=>{c.current=s},[s]);let f=e.reduce((h,g)=>h+g.duration,0);return G(()=>{if(!e.length||!n.current||!a.current)return;let h=a.current,g=n.current,b=new mo(h,f),x=new ho(h,k=>{k?(i.current?.zoomTo(k),l.current?.(k)):(i.current?.resetZoom(),l.current?.(null))});h.insertBefore(x.el,g);let w=new fo(g,e,{onHover:(k,K,U)=>{k?(b.show(k,K,U),c.current?.(k.node.name)):(b.hide(),c.current?.(null))},onClick:k=>{m(!0),l.current?.(k.node),w.zoomTo(k.node)},onZoomChange:k=>{x.update(k),m(k.length>0),k.length===0&&l.current?.(null)}});i.current=w,o&&(o.current=w);let C=()=>w.resizeCanvas();window.addEventListener("resize",C);let A=()=>w.render();return document.addEventListener("profiler:theme-change",A),()=>{w.destroy(),b.destroy(),x.destroy(),window.removeEventListener("resize",C),document.removeEventListener("profiler:theme-change",A),i.current=null,o&&(o.current=null)}},[e]),t("div",{class:"profiler-fn-profiling__flamegraph",children:[t("div",{class:"profiler-flamegraph__controls",children:[d&&t("button",{class:"profiler-flamegraph__reset",onClick:()=>{i.current?.resetZoom(),m(!1),l.current?.(null)},children:"Reset Zoom"}),t("span",{class:"profiler-flamegraph__hint",children:"Click to zoom & filter table \xB7 scroll to zoom in/out \xB7 drag to pan"})]}),t("div",{class:"profiler-flamegraph__canvas-container",ref:a,children:t("canvas",{ref:n,class:"profiler-flamegraph__canvas",style:{width:"100%"}})})]})}function Ai({viewData:e}){return e?t(M,{children:[t("h2",{class:"profiler-section__header",children:"View Rendering"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Views: ",t("strong",{children:e.total_views})]}),t("span",{children:["Partials: ",t("strong",{children:e.total_partials})]}),t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration," ms"]})]})]}),e.views&&e.views.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Templates"}),e.views.map((r,o)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},o))]}),e.partials&&e.partials.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Partials"}),e.partials.map((r,o)=>t("div",{class:"profiler-query-card profiler-query-card--success",children:t("div",{class:"profiler-query-card__header",children:[t("span",{children:r.identifier}),t("span",{class:"badge-success",children:[r.duration.toFixed(2)," ms"]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No view data recorded"})})}var Jc={frame:"Turbo Frame request",stream:"Turbo Stream response"};function Mi({ajaxData:e}){if(!e?.requests?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No AJAX requests tracked"}),t("p",{class:"profiler-empty__description",children:"AJAX requests made from this page will appear here."})]});let r=e.total_duration/e.total_requests;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["AJAX Requests (",e.total_requests,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total Duration: ",t("strong",{children:[e.total_duration.toFixed(2)," ms"]})]}),t("span",{children:["Average: ",t("strong",{children:[r.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Method"}),Object.entries(e.by_method).map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${lr(o)}`,children:o}),t("strong",{children:s})]},o))]}),t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"By Status"}),Object.entries(e.by_status).map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{class:`badge-${o.startsWith("2")?"success":o.startsWith("4")||o.startsWith("5")?"error":"warning"}`,children:o}),t("strong",{children:s})]},o))]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Requests"}),e.requests.map((o,s)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${o.status>=200&&o.status<300?"success":"error"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${lr(o.method)}`,children:o.method}),o.turbo&&t("span",{class:"badge-default",title:Jc[o.turbo],children:o.turbo.toUpperCase()}),t("strong",{class:"profiler-ajax-card__path",children:o.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(o.status)}`,children:o.status}),t("span",{class:o.duration>=500?"badge-error":o.duration>=100?"badge-warning":"badge-success",children:[o.duration.toFixed(2)," ms"]})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:new Date(o.started_at).toLocaleTimeString("en",{hour12:!1})}),t("a",{href:`/_profiler/profiles/${o.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},s))]})}function Ut({cacheData:e}){return e?t(M,{children:[t("h2",{class:"profiler-section__header",children:"Cache Operations"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Reads: ",t("strong",{children:e.total_reads})]}),t("span",{children:["Writes: ",t("strong",{children:e.total_writes})]}),t("span",{children:["Deletes: ",t("strong",{children:e.total_deletes})]}),t("span",{children:["Hit Rate:"," ",t("strong",{class:`badge-${e.hit_rate>80?"success":"warning"}`,children:[e.hit_rate,"%"]})]})]}),e.reads&&e.reads.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3",children:"Cache Reads"}),e.reads.map((r,o)=>t("div",{class:"profiler-query-card",children:t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--mono profiler-text--sm",children:r.key}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:r.hit?"badge-success":"badge-error",children:r.hit?"HIT":"MISS"}),t("span",{class:r.duration>=500?"badge-error":r.duration>=100?"badge-warning":"badge-success",children:[r.duration.toFixed(2)," ms"]})]})]})},o))]})]}):t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No cache operations recorded"})})}function zc(e){switch(e){case"ERROR":case"FATAL":return"profiler-text--error";case"WARN":return"profiler-text--warning";case"INFO":return"profiler-text--success";default:return"profiler-text--muted"}}function Wc(e){switch(e){case"ERROR":case"FATAL":return"background: var(--profiler-error, #ef4444); color: #fff;";case"WARN":return"background: var(--profiler-warning, #f59e0b); color: #fff;";case"INFO":return"background: var(--profiler-success, #22c55e); color: #fff;";default:return"background: var(--profiler-muted, #6b7280); color: #fff;"}}function Nt({logData:e}){let[r,o]=v("ALL"),[s,n]=v("");if(!e?.logs?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4CB}"}),t("h3",{class:"profiler-empty__title",children:"No log messages captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Log messages emitted via ",t("code",{children:"Rails.logger"})," during this request will appear here."]})})]});let a=["ALL","DEBUG","INFO","WARN","ERROR","FATAL"],i=e.logs.filter(l=>!(r!=="ALL"&&l.level!==r||s&&!l.message.toLowerCase().includes(s.toLowerCase())));return t(M,{children:[t("h2",{class:"profiler-section__header",children:["Log Messages (",e.count,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[e.errors>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.errors})]}),e.warnings>0&&t("span",{children:["Warnings: ",t("strong",{class:"profiler-text--warning",children:e.warnings})]})]}),t("div",{class:"profiler-action-bar profiler-mb-4",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",children:a.map(l=>t("button",{onClick:()=>o(l),class:`btn btn-sm ${r===l?"btn-primary":"btn-secondary"}`,children:l},l))}),t("input",{type:"text",class:"profiler-filter-input",placeholder:"Search messages\u2026",value:s,onInput:l=>n(l.target.value),style:"width:200px"})]}),i.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:["No messages match",s?` "${s}"`:"","."]}):i.map((l,c)=>t("div",{class:"profiler-query-card profiler-mb-2",children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--xs",style:`display:inline-block;padding:1px 6px;border-radius:3px;font-weight:600;${Wc(l.level)}`,children:l.level}),t("span",{class:"profiler-text--xs profiler-text--muted",children:new Date(l.timestamp).toLocaleTimeString("en",{hour12:!1})})]}),t("pre",{class:`profiler-query-card__code ${zc(l.level)}`,style:"white-space:pre-wrap;word-break:break-all;",children:l.message})]},c))]})}function jt({exceptionData:e}){let[r,o]=v(!1);if(!e?.exception_class)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F4A5}"}),t("h3",{class:"profiler-empty__title",children:"No exception recorded"}),t("div",{class:"profiler-empty__description",children:t("p",{children:"Exceptions raised during this request will appear here."})})]});let s=e.backtrace||[],n=s.filter(i=>i.app_frame),a=r?s:s.slice(0,30);return t(M,{children:[t("div",{class:"profiler-mb-4",style:"padding: 12px 16px; background: color-mix(in srgb, var(--profiler-error, #ef4444) 10%, transparent); border-left: 4px solid var(--profiler-error, #ef4444); border-radius: 4px;",children:[t("div",{class:"profiler-text--error",style:"font-size:1.1em;font-weight:700;margin-bottom:4px;",children:e.exception_class}),t("div",{style:"font-family:monospace;font-size:0.9em;word-break:break-word;",children:e.message})]}),n.length>0&&t("div",{class:"profiler-mb-4",children:[t("h3",{class:"profiler-section__header",children:["Application frames (",n.length,")"]}),n.map((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",children:t("code",{class:"profiler-text--sm",children:t(vt,{frame:i.location})})},l))]}),t("div",{children:[t("h3",{class:"profiler-section__header",children:["Full backtrace (",s.length," frames)"]}),a.map((i,l)=>t("div",{class:"profiler-query-card profiler-mb-1",style:i.app_frame?"":"opacity:0.45;",children:t("code",{class:`profiler-text--sm${i.app_frame?" profiler-text--success":" profiler-text--muted"}`,children:t(vt,{frame:i.location})})},l)),!r&&s.length>30&&t("button",{class:"btn btn-secondary btn-sm profiler-mt-2",onClick:()=>o(!0),children:["Show all ",s.length," frames"]})]})]})}var Zc={GET:"var(--profiler-success)",POST:"var(--profiler-accent)",PUT:"var(--profiler-warning)",PATCH:"var(--profiler-warning)",DELETE:"var(--profiler-error)"};function Fi({verb:e}){let r=Zc[e]??"var(--profiler-text-muted)";return t("span",{style:{display:"inline-block",minWidth:"52px",textAlign:"center",padding:"1px 6px",borderRadius:"4px",fontSize:"10px",fontWeight:700,fontFamily:"monospace",border:`1px solid ${r}`,color:r},children:e})}function qi({routesData:e}){let[r,o]=v(""),[s,n]=v("ALL"),{total:a,matched:i,routes:l}=e,c=["ALL",...Array.from(new Set(l.map(m=>m.verb))).sort()],d=l.filter(m=>{let f=s==="ALL"||m.verb===s,y=r.toLowerCase(),h=!y||(m.pattern??"").toLowerCase().includes(y)||(m.name??"").toLowerCase().includes(y)||(m.controller_action??"").toLowerCase().includes(y);return f&&h});return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4",children:t("div",{class:"profiler-stat-card",children:[t("div",{class:"profiler-stat-card__value",children:a}),t("div",{class:"profiler-stat-card__label",children:"Total routes"})]})}),i&&t(M,{children:[t("h2",{class:"profiler-section__header profiler-mt-4",children:"Matched Route"}),t("table",{class:"profiler-mb-4",children:[t("tr",{children:[t("th",{class:"profiler-text--sm",style:"width:120px;",children:"Verb"}),t("td",{children:t(Fi,{verb:i.verb})})]}),t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Pattern"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.pattern})]}),i.name&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Route Name"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:[i.name,"_path"]})]}),i.controller_action&&t("tr",{children:[t("th",{class:"profiler-text--sm",children:"Controller#Action"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:i.controller_action})]})]})]}),t("h2",{class:"profiler-section__header profiler-mt-4",children:"All Routes"}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-3",style:"flex-wrap:wrap;align-items:center;",children:[t("input",{type:"text",class:"profiler-filter-input",placeholder:"Filter by path, name or controller\u2026",value:r,onInput:m=>o(m.target.value),style:"flex:1;width:auto;min-width:200px;"}),t("div",{class:"profiler-flex profiler-flex--gap-1",children:c.map(m=>t("button",{onClick:()=>n(m),style:{padding:"3px 8px",fontSize:"11px",fontWeight:600,borderRadius:"4px",border:"1px solid var(--profiler-border)",background:s===m?"var(--profiler-accent)":"transparent",color:s===m?"#fff":"var(--profiler-text-muted)",cursor:"pointer"},children:m},m))})]}),t("div",{class:"profiler-flex-table",children:[t("div",{class:"profiler-flex-table__header",children:[t("span",{class:"profiler-flex-table__cell--fixed",children:"Verb"}),t("span",{class:"profiler-flex-table__cell",children:"Pattern"}),t("span",{class:"profiler-flex-table__cell",children:"Name"}),t("span",{class:"profiler-flex-table__cell",children:"Controller#Action"})]}),d.map((m,f)=>t("div",{class:`profiler-flex-table__row${m.matched?" profiler-flex-table__row--matched":""}`,children:[t("span",{class:"profiler-flex-table__cell--fixed",children:t(Fi,{verb:m.verb})}),t("span",{class:"profiler-flex-table__cell profiler-text--mono profiler-text--xs",title:m.pattern,children:m.pattern}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.name?`${m.name}_path`:"",children:m.name?`${m.name}_path`:"-"}),t("span",{class:"profiler-flex-table__cell profiler-flex-table__cell--muted profiler-text--mono profiler-text--xs",title:m.controller_action??"",children:m.controller_action??"-"})]},f))]})]})}function Oi({i18nData:e}){let[r,o]=v("ALL");if(!e?.lookups?.length)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F310}"}),t("h3",{class:"profiler-empty__title",children:"No translation lookups captured"}),t("div",{class:"profiler-empty__description",children:t("p",{children:["Calls to ",t("code",{children:"I18n.t"})," during this request will appear here."]})})]});let s=r==="MISSING"?e.lookups.filter(n=>n.missing):e.lookups;return t(M,{children:[t("h2",{class:"profiler-section__header",children:["I18n Lookups (",e.total,")"]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Locale: ",t("strong",{children:e.locale})]}),e.missing_count>0&&t("span",{children:["Missing: ",t("strong",{class:"profiler-text--error",children:e.missing_count})]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mb-4",children:["ALL","MISSING"].map(n=>t("button",{onClick:()=>o(n),class:`btn btn-sm ${r===n?"btn-primary":"btn-secondary"}`,children:n},n))}),s.length===0?t("div",{class:"profiler-text--muted profiler-text--sm",children:"No missing translations."}):t("table",{class:"profiler-table",children:[t("thead",{children:t("tr",{children:[t("th",{children:"Key"}),t("th",{children:"Locale"}),t("th",{children:"Value"}),t("th",{children:"Status"})]})}),t("tbody",{children:s.map((n,a)=>t("tr",{style:n.missing?"background:var(--profiler-error-bg,rgba(239,68,68,0.08));":"",children:[t("td",{children:t("code",{class:`profiler-text--xs profiler-text--mono${n.missing?" profiler-text--error":""}`,children:n.key})}),t("td",{children:t("span",{class:"profiler-text--xs profiler-text--muted",children:n.locale})}),t("td",{children:t("span",{class:`profiler-text--xs${n.missing?" profiler-text--error":""}`,children:n.value})}),t("td",{children:n.missing?t("span",{class:"profiler-text--xs profiler-text--error",style:"font-weight:600;",children:"\u26A0 missing"}):t("span",{class:"profiler-text--xs profiler-text--success",children:"\u2713"})})]},a))})]})]})}function Xo({jobs:e}){return e?.length?t(M,{children:[t("h2",{class:"profiler-section__header",children:["Background Jobs (",e.length,")"]}),e.map((r,o)=>t("div",{class:`profiler-ajax-card profiler-ajax-card--${r.status==="completed"?"success":r.status==="failed"?"error":"default"}`,children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`badge-${r.status==="completed"?"success":r.status==="failed"?"error":r.status==="running"?"info":"warning"}`,children:r.status??"unknown"}),t("strong",{class:"profiler-ajax-card__path",children:r.job_class})]}),r.status==="running"?t("span",{class:"badge-info",children:"running"}):t("span",{class:r.duration>=1e3?"badge-error":r.duration>=200?"badge-warning":"badge-success",children:[r.duration?.toFixed(2)," ms"]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time profiler-text--muted",children:[r.queue&&t("span",{children:["Queue: ",t("strong",{children:r.queue})," \xB7 "]}),new Date(r.started_at).toLocaleTimeString("en",{hour12:!1})]}),t("a",{href:`/_profiler/profiles/${r.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Job \u2192"})]})]},o))]}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No jobs triggered"}),t("p",{class:"profiler-empty__description",children:"Background jobs enqueued during this request will appear here."})]})}function Xc({email:e}){let r=!!e.body_html,o=!!e.body_text;if(!e.body_captured)return t("div",{class:"profiler-mt-3 profiler-text--xs profiler-text--muted",children:["Body not captured - enable ",t("code",{children:"config.capture_mail_body = true"})," in your profiler initializer"]});if(!r&&!o)return null;let[s,n]=v(r?"preview":"text"),a=l=>c=>{c.stopPropagation(),n(l)},i={borderColor:"var(--profiler-accent)",color:"var(--profiler-accent)"};return t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-mb-2 profiler-flex profiler-flex--gap-2",style:{alignItems:"center"},children:[t("span",{class:"profiler-text--muted profiler-text--xs",children:"Body"}),r&&t(M,{children:[t("button",{class:"profiler-btn profiler-btn--sm",style:s==="preview"?i:{},onClick:a("preview"),children:"HTML preview"}),t("button",{class:"profiler-btn profiler-btn--sm",style:s==="source"?i:{},onClick:a("source"),children:"HTML source"})]}),o&&t("button",{class:"profiler-btn profiler-btn--sm",style:s==="text"?i:{},onClick:a("text"),children:"Plain text"})]}),s==="preview"&&r&&t("iframe",{srcdoc:e.body_html??void 0,sandbox:"",style:{width:"100%",height:"300px",border:"1px solid var(--profiler-border)",borderRadius:"var(--profiler-radius-md)",background:"#fff",display:"block"}}),(s==="source"||s==="text")&&t("pre",{style:{maxHeight:"300px",overflow:"auto",background:"var(--profiler-bg-lighter, rgba(0,0,0,0.2))",padding:"12px",borderRadius:"var(--profiler-radius-md)",fontSize:"12px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--profiler-border)"},children:s==="source"?e.body_html:e.body_text})]})}function Qi({assigns:e}){let r=Object.entries(e);return r.length===0?null:t("div",{class:"profiler-mt-3",children:[t("div",{class:"profiler-text--xs profiler-text--muted profiler-mb-1",style:{textTransform:"uppercase",letterSpacing:"0.05em"},children:"Variables"}),r.map(([o,s])=>t("div",{class:"profiler-kv-row",children:[t("span",{children:t("code",{children:["@",o]})}),t("code",{style:{textAlign:"right",wordBreak:"break-all",maxWidth:"60%"},children:s})]},o))]})}function Yc({email:e}){return t("div",{class:"profiler-mt-3",onClick:r=>r.stopPropagation(),children:[e.subject&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Subject"}),t("span",{children:e.subject})]}),e.to&&e.to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"To"}),t("span",{style:{textAlign:"right",wordBreak:"break-all"},children:e.to.join(", ")})]}),e.from&&e.from.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"From"}),t("span",{style:{textAlign:"right"},children:e.from.join(", ")})]}),e.cc&&e.cc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"CC"}),t("span",{style:{textAlign:"right"},children:e.cc.join(", ")})]}),e.bcc&&e.bcc.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"BCC"}),t("span",{style:{textAlign:"right"},children:e.bcc.join(", ")})]}),e.reply_to&&e.reply_to.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Reply-To"}),t("span",{style:{textAlign:"right"},children:e.reply_to.join(", ")})]}),e.template&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Template"}),t("code",{children:e.template})]}),e.parts&&e.parts.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parts"}),t("span",{style:{textAlign:"right"},children:e.parts.join(", ")})]}),e.attachments&&e.attachments.length>0&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Attachments"}),t("span",{style:{textAlign:"right"},children:e.attachments.map(r=>`${r.filename} (${(r.size/1024).toFixed(1)} KB)`).join(", ")})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Render"}),t("span",{class:"profiler-query-card__duration",children:e.duration_ms!=null?`${e.duration_ms} ms`:"-"})]}),e.delivery_ms!=null&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Delivery"}),t("span",{class:"profiler-query-card__duration",children:[e.delivery_ms," ms"]})]}),e.message_id&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Message-ID"}),t("code",{style:{fontSize:"11px",wordBreak:"break-all",maxWidth:"70%",textAlign:"right"},children:e.message_id})]}),e.error&&t("div",{class:"profiler-kv-row",children:[t("span",{children:"Error"}),t("span",{class:"profiler-text--error",style:{textAlign:"right"},children:e.error})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(Qi,{assigns:e.assigns}),t(Xc,{email:e})]})}function Di({email:e,onClick:r,isExpanded:o}){let s=["profiler-query-card",e.error?"profiler-query-card--slow":""].filter(Boolean).join(" ");return t("div",{class:s,style:{cursor:"pointer",marginBottom:"6px"},onClick:r,children:[t("div",{class:"profiler-query-card__header",children:[t("div",{class:"profiler-flex profiler-flex--gap-2",style:{minWidth:0,flex:1},children:t("span",{class:"profiler-text--sm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]}),e.subject&&t("span",{class:"profiler-text--muted",children:[" - ",e.subject.slice(0,60),e.subject.length>60?"\u2026":""]})]})}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[e.delivery_mode&&t("span",{class:"badge-info profiler-text--xs",children:e.delivery_mode}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]}),e.error?t("span",{class:"badge-error profiler-text--xs",children:"Error"}):t("span",{class:"badge-success profiler-text--xs",children:"Sent"}),t("span",{class:"profiler-text--muted profiler-text--xs",children:o?"\u25B2":"\u25BC"})]})]}),o&&t(Yc,{email:e})]})}function ep({email:e}){return t("div",{class:"profiler-query-card",style:{marginBottom:"6px",borderLeft:"3px solid var(--profiler-info, #38bdf8)"},children:[t("div",{class:"profiler-query-card__header",children:[t("span",{class:"profiler-text--sm",children:[t("strong",{children:e.mailer_class}),t("span",{class:"profiler-text--muted",children:["#",e.action]})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",style:{flexShrink:0},children:[t("span",{class:"badge-info profiler-text--xs",children:"queued"}),e.delivery_method&&t("span",{class:"badge-default profiler-text--xs",children:e.delivery_method}),e.duration_ms!=null&&t("span",{class:"profiler-query-card__duration profiler-text--xs",children:[e.duration_ms," ms"]})]})]}),e.assigns&&Object.keys(e.assigns).length>0&&t(Qi,{assigns:e.assigns})]})}function Yo({mailerData:e}){let[r,o]=v(null),[s,n]=v(null),a=e?.queued_count??0;if(!e||e.total===0&&a===0)return t("div",{class:"profiler-empty",children:t("p",{class:"profiler-empty__description",children:"No emails sent during this request"})});let i=c=>o(r===c?null:c),l=c=>n(s===c?null:c);return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Mailer Deliveries"}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mb-4 profiler-text--sm",children:[t("span",{children:["Total: ",t("strong",{children:e.total})]}),e.deliver_now>0&&t("span",{children:["deliver_now: ",t("strong",{children:e.deliver_now})]}),e.deliver_later>0&&t("span",{children:["deliver_later: ",t("strong",{children:e.deliver_later})]}),a>0&&t("span",{children:["queued: ",t("strong",{children:a})]}),e.multi_part_count>0&&t("span",{children:["Multi-part: ",t("strong",{children:e.multi_part_count})]}),e.failed>0&&t("span",{children:["Errors: ",t("strong",{class:"profiler-text--error",children:e.failed})]})]}),e.loop_warnings.length>0&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("div",{style:{flex:1},children:[t("strong",{children:"Send loop detected"})," - ",e.loop_warnings.length," pattern",e.loop_warnings.length>1?"s":"",e.loop_warnings.map((c,d)=>t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-1",children:c.message},d))]})]}),e.truncated&&t("div",{class:"profiler-alert-banner profiler-alert-banner--warning profiler-mb-4",children:[t("span",{class:"profiler-alert-banner__icon",children:"\u26A0\uFE0F"}),t("span",{children:"Showing first 50 emails only - additional emails were truncated"})]}),e.emails.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-3",children:["Emails",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"click to expand"})]}),e.emails.map((c,d)=>t(Di,{email:c,onClick:()=>i(d),isExpanded:r===d},d))]}),e.queued&&e.queued.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-4 profiler-mb-2",children:["Queued",t("span",{class:"profiler-text--muted profiler-text--sm",style:{fontWeight:"normal",marginLeft:"8px"},children:"deliver_later - will be sent in a background job"})]}),e.queued.map((c,d)=>t(ep,{email:c},`q-${d}`))]}),e.errors.length>0&&t(M,{children:[t("h3",{class:"profiler-text--lg profiler-mt-6 profiler-mb-3 profiler-text--error",children:"Delivery Errors"}),e.errors.map((c,d)=>t(Di,{email:c,onClick:()=>l(d),isExpanded:s===d},`err-${d}`))]})]})}function Li({profile:e}){return e.trace_id?t(tp,{profile:e,traceId:e.trace_id}):t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"No trace for this profile"}),t("p",{class:"profiler-empty__description",children:"This profile was saved before distributed tracing was available."})]})}function tp({profile:e,traceId:r}){let{data:o,isLoading:s,isError:n}=Za({trace_id:r,limit:50}),a=(o?.profiles??[]).filter(i=>i.token!==e.token);return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Trace"}),t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-6",children:[t("div",{class:"profiler-kv-row",children:[t("span",{children:"Trace ID"}),t("code",{class:"profiler-code",children:r})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Span ID"}),t("code",{class:"profiler-code",children:e.span_id??"-"})]}),t("div",{class:"profiler-kv-row",children:[t("span",{children:"Parent span ID"}),e.parent_span_id?t("code",{class:"profiler-code",children:e.parent_span_id}):t("span",{class:"profiler-text--muted",children:"none, this request started the trace"})]})]}),t("h3",{class:"profiler-text--lg profiler-mb-3",children:"Other profiles in this trace"}),s&&t("p",{class:"profiler-text--muted",children:"Loading..."}),n&&t("p",{class:"profiler-text--muted",children:"Could not load the profiles of this trace."}),!s&&!n&&a.length===0&&t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u{1F517}"}),t("h3",{class:"profiler-empty__title",children:"Single-span trace"}),t("p",{class:"profiler-empty__description",children:"No other stored profile shares this trace id. The request had no traceparent from a caller, or the other services are not profiled here."})]}),a.map(i=>t("div",{class:"profiler-ajax-card",children:[t("div",{class:"profiler-ajax-card__row",children:[t("div",{class:"profiler-flex profiler-flex--gap-3",children:[t("span",{class:`profiler-ajax-card__method badge-${lr(i.method??"")}`,children:i.method}),t("strong",{class:"profiler-ajax-card__path",children:i.path})]}),t("div",{class:"profiler-flex profiler-flex--gap-2",children:[t("span",{class:`badge-${Dr(i.status??0)}`,children:i.status}),i.span_id&&i.span_id===e.parent_span_id&&t("span",{class:"badge-info",children:"caller"})]})]}),t("div",{class:"profiler-ajax-card__row",children:[t("span",{class:"profiler-ajax-card__time",children:["span ",i.span_id??"-"]}),t("a",{href:`/_profiler/profiles/${i.token}`,class:"profiler-text--sm",style:"color: var(--profiler-accent);",children:"View Profile \u2192"})]})]},i.token))]})}function Ki({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.ajax?.total_requests??0)>0,a=(s.http?.total_requests??0)>0,i=!!s.exception?.exception_class,l=(s.logs?.count??0)>0,c=(s.routes?.total??0)>0,d=(s.i18n?.total??0)>0,m=(e.child_jobs?.length??0)>0,f=(s.mailer?.total??0)>0,[y,h]=v(i?"exception":r),g=x=>w=>{w.preventDefault(),h(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${y===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=http",children:[t("span",{class:"h1-emoji",children:"\u{1F4CA}"})," Profile Details"]})}),t("p",{children:[e.method," ",e.path]}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:e.status})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),t("span",{style:"color:var(--profiler-text-muted)",children:new Date(e.started_at).toLocaleString("en",{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[i&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:b("request"),onClick:g("request"),children:"Request"}),t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:"Dump"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),n&&t("a",{href:"#",class:b("ajax"),onClick:g("ajax"),children:"AJAX"}),a&&t("a",{href:"#",class:b("http"),onClick:g("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"}),t("a",{href:"#",class:b("views"),onClick:g("views"),children:"Views"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),l&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),c&&t("a",{href:"#",class:b("routes"),onClick:g("routes"),children:"Routes"}),d&&t("a",{href:"#",class:b("i18n"),onClick:g("i18n"),children:"I18n"}),m&&t("a",{href:"#",class:b("jobs"),onClick:g("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),f&&t("a",{href:"#",class:b("mailer"),onClick:g("mailer"),children:"Mailers"}),t("a",{href:"#",class:b("trace"),onClick:g("trace"),children:"Trace"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="request"&&t(Ei,{profile:e}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="ajax"&&t(Mi,{ajaxData:s.ajax}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="views"&&t(Ai,{viewData:s.view}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="logs"&&t(Nt,{logData:s.logs}),y==="routes"&&t(qi,{routesData:s.routes}),y==="i18n"&&t(Oi,{i18nData:s.i18n}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="trace"&&t(Li,{profile:e}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function Ui({jobData:e}){if(!e)return t("div",{class:"profiler-empty",children:[t("div",{class:"profiler-empty__icon",children:"\u2699\uFE0F"}),t("h3",{class:"profiler-empty__title",children:"No job data"})]});let r=e.status==="completed";return t(M,{children:[t("h2",{class:"profiler-section__header",children:"Job Details"}),t("div",{class:"profiler-grid profiler-grid--2 profiler-mb-6",children:[t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Info"}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Class"}),t("strong",{class:"profiler-text--mono",children:e.job_class})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Job ID"}),t("span",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:e.job_id})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Queue"}),t("span",{class:"profiler-text--mono",children:e.queue})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Executions"}),t("span",{children:e.executions})]}),t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--sm",children:"Status"}),t("span",{class:`badge-${r?"success":"error"}`,children:r?"\u2713 Completed":"\u2717 Failed"})]})]}),e.arguments&&e.arguments.length>0&&t("div",{class:"profiler-panel profiler-panel--sm",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-3",children:"Arguments"}),e.arguments.map((o,s)=>t("div",{class:"profiler-kv-row",children:[t("span",{class:"profiler-text--xs profiler-text--muted",children:["[",s,"]"]}),t("span",{class:"profiler-text--xs profiler-text--mono",style:"word-break:break-all",children:String(o)})]},s))]})]}),e.error&&t("div",{class:"profiler-panel profiler-panel--sm profiler-mb-4",style:"border-left: 3px solid var(--profiler-error, #ef4444)",children:[t("h3",{class:"profiler-text--sm profiler-text--muted profiler-text--uppercase profiler-mb-2",children:"Error"}),t("pre",{class:"profiler-code profiler-text--xs",style:"white-space:pre-wrap;word-break:break-all;margin:0",children:e.error})]})]})}function Ni({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(e.child_jobs?.length??0)>0,i=(s.dump?.count??0)>0,l=(s.logs?.total??0)>0,c=!!s.exception?.exception_class,d=(s.mailer?.total??0)>0,f=["job","database","cache","http","jobs","dump","logs","exception","env","timeline","mailer"].includes(r)?r:"job",[y,h]=v(c?"exception":f),g=s.job,b=g?.status==="failed",x=g?.status==="running",w=e.parent_profile,C=k=>K=>{K.preventDefault(),h(k);let U=new URL(window.location.href);U.searchParams.set("tab",k),history.pushState(null,"",U.toString())},A=k=>`tab${y===k?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=jobs",children:[t("span",{class:"h1-emoji",children:"\u2699\uFE0F"})," Job Profile"]})}),t("p",{children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:x?"running":`${e.duration.toFixed(2)} ms`})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${b?"error":x?"info":"success"}`,children:b?"Failed":x?"Running":"Completed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]}),w&&t("div",{class:"profiler-flex profiler-flex--gap-2 profiler-mt-2 profiler-text--sm",children:[t("span",{style:"color:var(--profiler-text-muted)",children:"Triggered by:"}),w.profile_type==="http"?t("span",{children:[t("strong",{children:w.method})," ",w.path," \xB7 ",w.http_status," \xB7 ",w.duration?.toFixed(2)," ms"]}):t("span",{children:["\u2699\uFE0F ",t("strong",{children:w.path})," \xB7 ",w.duration?.toFixed(2)," ms"]}),t("a",{href:`/_profiler/profiles/${w.token}`,style:"color: var(--profiler-accent);",children:"View \u2192"})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[c&&t("a",{href:"#",class:A("exception"),onClick:C("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:A("job"),onClick:C("job"),children:"Job"}),t("a",{href:"#",class:A("database"),onClick:C("database"),children:"Database"}),t("a",{href:"#",class:A("cache"),onClick:C("cache"),children:"Cache"}),n&&t("a",{href:"#",class:A("http"),onClick:C("http"),children:"Outbound HTTP"}),t("a",{href:"#",class:A("timeline"),onClick:C("timeline"),children:"Timeline"}),a&&t("a",{href:"#",class:A("jobs"),onClick:C("jobs"),children:["Jobs (",e.child_jobs.length,")"]}),i&&t("a",{href:"#",class:A("dump"),onClick:C("dump"),children:["Dumps (",s.dump.count,")"]}),l&&t("a",{href:"#",class:A("logs"),onClick:C("logs"),children:"Logs"}),d&&t("a",{href:"#",class:A("mailer"),onClick:C("mailer"),children:"Mailers"}),t("a",{href:"#",class:A("env"),onClick:C("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[y==="exception"&&t(jt,{exceptionData:s.exception}),y==="job"&&t(Ui,{jobData:s.job}),y==="database"&&t(Qt,{dbData:s.database,token:e.token}),y==="cache"&&t(Ut,{cacheData:s.cache}),y==="http"&&t(Lr,{httpData:s.http}),y==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),y==="jobs"&&t(Xo,{jobs:e.child_jobs}),y==="dump"&&t(Lt,{dumpData:s.dump}),y==="logs"&&t(Nt,{logData:s.logs}),y==="mailer"&&t(Yo,{mailerData:s.mailer}),y==="env"&&t(st,{envData:s.env,readOnly:!0})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function ji({data:e}){return t("div",{class:"profiler-p-4",children:[t("div",{class:"profiler-mb-6",children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Expression"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.expression})]}),e.return_value!==void 0&&t("div",{children:[t("h3",{class:"profiler-section-title profiler-mb-2",children:"Return value"}),t("pre",{class:"profiler-code-block profiler-code-block--full",children:e.return_value})]})]})}function Ii({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=s.http?.total_requests>0,a=(s.dump?.count??0)>0,i=(s.logs?.total??0)>0,l=!!s.exception?.exception_class,c=s.console,m=["console","database","cache","http","dump","logs","exception","env","timeline"].includes(r)?r:"console",[f,y]=v(l?"exception":m),h=e.status===500,g=x=>w=>{w.preventDefault(),y(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${f===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=console",children:[t("span",{class:"h1-emoji",children:">_"})," Console Profile"]})}),t("p",{style:"font-family: monospace; word-break: break-all",children:e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${h?"error":"success"}`,children:h?"Error":"OK"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]}),e.gem_version&&t("span",{class:"profiler-version-badge",children:["v",e.gem_version]})]}),e.gem_version&&e.gem_version!==Be()&&t("div",{class:"profiler-version-mismatch",children:["\u26A0\uFE0F Profil captur\xE9 avec la version ",t("strong",{children:e.gem_version})," - version actuelle : ",t("strong",{children:Be()})]})]}),t("div",{class:"profiler-panel",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:b("console"),onClick:g("console"),children:"Console"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),n&&t("a",{href:"#",class:b("http"),onClick:g("http"),children:"HTTP"}),a&&t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:"Dumps"}),i&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),l&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),children:"Exception"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"})]}),t("div",{class:"profiler-p-0 tab-content active",children:[f==="console"&&c&&t(ji,{data:c}),f==="database"&&t(Qt,{dbData:s.database,token:e.token}),f==="cache"&&t(Ut,{cacheData:s.cache}),f==="http"&&n&&t(Lr,{httpData:s.http}),f==="dump"&&a&&t(Lt,{dumpData:s.dump}),f==="logs"&&i&&t(Nt,{logData:s.logs}),f==="exception"&&l&&t(jt,{exceptionData:s.exception}),f==="env"&&t(st,{envData:s.env,readOnly:!0}),f==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile})]})]}),!o&&t("div",{class:"profiler-mt-6",children:t("a",{href:"/_profiler",style:"color: var(--profiler-accent);",children:"\u2190 Back to profiles"})})]})}function rp(e){return e==="passed"?t("span",{class:"badge-success",children:"\u2713 Passed"}):e==="failed"?t("span",{class:"badge-error",children:"\u2717 Failed"}):e==="pending"?t("span",{class:"badge-warning",children:"\u23F8 Pending"}):t("span",{class:"badge-default",children:e})}function $i({testData:e}){return t("div",{children:t("table",{class:"profiler-detail-table",children:t("tbody",{children:[t("tr",{children:[t("th",{children:"Test Name"}),t("td",{style:"word-break: break-word",children:e.test_name})]}),t("tr",{children:[t("th",{children:"Status"}),t("td",{children:rp(e.status)})]}),t("tr",{children:[t("th",{children:"File"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:t(ir,{file:e.test_file,line:e.test_line})})]}),t("tr",{children:[t("th",{children:"Framework"}),t("td",{class:"profiler-text--mono profiler-text--xs",children:e.framework})]}),e.assertions!=null&&t("tr",{children:[t("th",{children:"Assertions"}),t("td",{children:e.assertions})]}),e.skip_reason&&t("tr",{children:[t("th",{children:"Skip reason"}),t("td",{class:"profiler-text--xs profiler-text--muted",children:e.skip_reason})]}),e.exception_message&&t("tr",{children:[t("th",{children:"Exception"}),t("td",{children:t("pre",{class:"profiler-text--xs",style:"white-space: pre-wrap; color: var(--profiler-error, #ef4444)",children:e.exception_message})})]})]})})})}function Vi({profile:e,initialTab:r,embedded:o}){let s=e.collectors_data||{},n=(s.dump?.count??0)>0,a=(s.logs?.total??0)>0,i=!!s.exception?.exception_class,l=s.test,d=["test","database","cache","dump","logs","exception","env","timeline"].includes(r)?r:"test",[m,f]=v(i?"exception":d),y=e.status===500,h=l?.status||(y?"failed":"passed"),g=x=>w=>{w.preventDefault(),f(x);let C=new URL(window.location.href);C.searchParams.set("tab",x),history.pushState(null,"",C.toString())},b=x=>`tab${m===x?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:t("a",{href:"/_profiler?section=tests",children:[t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Profile"]})}),t("p",{style:"word-break: break-word",children:l?.test_name||e.path}),t("div",{class:"profiler-flex profiler-flex--gap-4 profiler-mt-2",children:[t("span",{children:["Duration: ",t("strong",{children:[e.duration.toFixed(2)," ms"]})]}),t("span",{children:["Status: ",t("strong",{children:t("span",{class:`badge-${y?"error":h==="pending"?"warning":"success"}`,children:h==="failed"?"\u2717 Failed":h==="pending"?"\u23F8 Pending":"\u2713 Passed"})})]}),Te(e)!=null&&t("span",{title:ot,children:["Allocations: ",t("strong",{children:rt(Te(e))})]})]}),l?.test_file&&t("div",{class:"profiler-text--xs profiler-text--muted profiler-mt-2",children:[t("span",{class:"profiler-text--mono",children:[l.test_file,":",l.test_line]}),t("span",{style:"margin-left: 8px",children:["\xB7 ",l.framework]})]})]}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[i&&t("a",{href:"#",class:b("exception"),onClick:g("exception"),style:"color:var(--profiler-error,#ef4444);",children:"\u{1F4A5} Exception"}),t("a",{href:"#",class:b("test"),onClick:g("test"),children:"Test"}),t("a",{href:"#",class:b("database"),onClick:g("database"),children:"Database"}),t("a",{href:"#",class:b("cache"),onClick:g("cache"),children:"Cache"}),t("a",{href:"#",class:b("timeline"),onClick:g("timeline"),children:"Timeline"}),n&&t("a",{href:"#",class:b("dump"),onClick:g("dump"),children:["Dumps (",s.dump.count,")"]}),a&&t("a",{href:"#",class:b("logs"),onClick:g("logs"),children:"Logs"}),t("a",{href:"#",class:b("env"),onClick:g("env"),children:"Env"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[m==="test"&&l&&t($i,{testData:l}),m==="database"&&t(Qt,{dbData:s.database,token:e.token}),m==="cache"&&t(Ut,{cacheData:s.cache}),m==="timeline"&&t(Kt,{flamegraphData:s.flamegraph,perfData:s.performance,functionProfileData:s.function_profile}),m==="dump"&&n&&t(Lt,{dumpData:s.dump}),m==="logs"&&a&&t(Nt,{logData:s.logs}),m==="exception"&&i&&t(jt,{exceptionData:s.exception}),m==="env"&&t(st,{envData:s.env})]})]})]})}var op="/_profiler";function Hi(){return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:[t("a",{href:op,children:t("span",{class:"h1-emoji",children:"\u{1F50D}"})})," ",t("span",{class:"h1-emoji",children:"\u{1F9EA}"})," Test Runner"]}),t("p",{children:"Run tests from the profiler and capture a performance profile for each test."})]}),t("div",{class:"profiler-panel profiler-mb-6",children:t("div",{class:"profiler-p-4",children:t(Wo,{})})})]})}var Nr="/_profiler";function ts(e){return new Date(e).toLocaleTimeString("en",{hour12:!1})}function ae(e){return e==null?"-":e.toFixed(2)+" ms"}function V(e,r=""){return e==null?"-":e.toFixed(2)+r}function sp(e){return e>0?`+${e.toFixed(2)}`:e.toFixed(2)}function np(e){return e!=null?` (${e>0?"+":""}${e.toFixed(1)}%)`:""}function It(e,r,o,s){if(!r)return"";let n=o?o(r.value_a):V(r.value_a),a=s?s(r.value_b):V(r.value_b),i=`${sp(r.delta)}${np(r.delta_pct)}`,l=r.status==="improved"?"\u2705":r.status==="regression"?"\u274C":"\u2796";return`| ${e} | ${n} | ${a} | ${i} | ${l} |`}function ap(e){let{profile_a:r,profile_b:o,metrics:s}=e,n=["## Profile Comparison","",`**A:** \`${r.token}\` - ${r.method} ${r.path} - ${ts(r.started_at)}`,`**B:** \`${o.token}\` - ${o.method} ${o.path} - ${ts(o.started_at)}`];return e.same_endpoint||n.push("","> \u26A0\uFE0F Profiles are from different endpoints."),n.push("","| Metric | Before (A) | After (B) | Delta | |","|--------|-----------|-----------|-------|---|",It("Duration",s.duration,ae,ae),It("Allocated objects",s.allocated_objects,V,V),It("DB Queries",s.db_queries,V,V),It("DB Duration",s.db_duration,ae,ae),It("Cache Hit Rate",s.cache_hit_rate,a=>V(a,"%"),a=>V(a,"%")),It("View Duration",s.view_duration,ae,ae),It("HTTP Requests",s.http_requests,V,V),It("HTTP Duration",s.http_duration,ae,ae)),n.filter(a=>a!=="").join(`
16
+ `)}function ip(e){return e==="improved"?"badge-success":e==="regression"?"badge-error":"badge-default"}function lp({metric:e}){if(!e)return t("span",{class:"badge-default",children:"-"});let r=e.delta>0?"+":"",o=e.delta_pct!=null?` (${e.delta>0?"+":""}${e.delta_pct}%)`:"",s=`${r}${e.delta.toFixed(2)}${o}`;return t("span",{class:ip(e.status),children:s})}function $t({label:e,metric:r,formatA:o,formatB:s}){return r?t("tr",{children:[t("td",{children:e}),t("td",{class:"profiler-text--mono",children:o(r.value_a)}),t("td",{class:"profiler-text--mono",children:s(r.value_b)}),t("td",{children:t(lp,{metric:r})})]}):null}function es({label:e,rows:r}){return r.some(s=>s.a!=="-"||s.b!=="-")?t("div",{class:"profiler-mb-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:r.map(s=>t("tr",{children:[t("td",{children:s.key}),t("td",{class:"profiler-text--mono",children:s.a}),t("td",{class:"profiler-text--mono",children:s.b})]},s.key))})]})}):t("div",{class:"profiler-empty profiler-mb-4",children:t("div",{class:"profiler-empty__title",children:["No ",e.toLowerCase()," data"]})})}function on({title:e,rows:r}){return t("div",{class:"profiler-mb-4",children:[t("h3",{children:[e," (",r.length,")"]}),r.length===0?t("p",{class:"profiler-text--muted",children:"None."}):t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Query"}),t("th",{children:"Count A"}),t("th",{children:"Count B"}),t("th",{children:"Time A"}),t("th",{children:"Time B"})]})}),t("tbody",{children:r.map(o=>t("tr",{children:[t("td",{class:"profiler-text--mono profiler-text--xs",children:o.fingerprint}),t("td",{children:o.count_a}),t("td",{children:o.count_b}),t("td",{children:ae(o.total_duration_a)}),t("td",{children:[ae(o.total_duration_b),o.delta_pct!=null?` (+${o.delta_pct}%)`:""]})]}))})]})]})}function Gi({label:e,name:r,value:o,nodes:s,onChange:n}){return t("label",{style:"margin-right: 16px",children:[e," ",t("select",{name:r,value:o,onChange:a=>n(a.target.value),children:s.map(a=>t("option",{value:a,children:a}))})]})}function Bi({tokenA:e,tokenB:r,nodeA:o="",nodeB:s=""}){let[n,a]=v(["local"]),[i,l]=v(o||"local"),[c,d]=v(s||"local");G(()=>{fetch(`${Nr}/api/compare/nodes`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():{nodes:["local"]}).then(T=>a(T.nodes)).catch(()=>{})},[]);let[m,f]=v(null),[y,h]=v(null),[g,b]=v(!0),[x,w]=v("sql");G(()=>{fetch(`${Nr}/api/compare?${new URLSearchParams({a:e,b:r,node_a:o,node_b:s}).toString()}`,{headers:{"X-Profiler-Request":"1"}}).then(T=>T.ok?T.json():T.json().then(F=>Promise.reject(F.errors?.join(", ")||"Error"))).then(T=>{f(T),b(!1)}).catch(T=>{h(typeof T=="string"?T:"Failed to load comparison"),b(!1)})},[e,r,o,s]);let[C,A]=v("");if(G(()=>{if(!m)return;let T=ap(m),F=new Blob([T],{type:"text/plain"}),$=URL.createObjectURL(F);return A($),()=>URL.revokeObjectURL($)},[m]),g)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:"Loading\u2026"})})})]});if(y||!m)return t("div",{class:"container",children:[t("div",{class:"header",children:t("h1",{children:"Profile Comparison"})}),t("div",{class:"profiler-panel profiler-p-4",children:t("div",{class:"profiler-empty",children:t("div",{class:"profiler-empty__title",children:y||"Unknown error"})})})]});let{profile_a:k,profile_b:K,metrics:U,collectors:L}=m,j=T=>`tab${x===T?" active":""}`;return t("div",{class:"container",children:[t("div",{class:"header",children:[t("h1",{children:"Profile Comparison"}),t("p",{children:t("a",{href:`${Nr}/`,children:"\u2190 Back to list"})}),n.length>1&&t("form",{method:"get",action:`${Nr}/compare`,children:[t("input",{type:"hidden",name:"a",value:e}),t("input",{type:"hidden",name:"b",value:r}),t(Gi,{label:"Node A",name:"node_a",value:i,nodes:n,onChange:l}),t(Gi,{label:"Node B",name:"node_b",value:c,nodes:n,onChange:d}),t("button",{type:"submit",class:"btn btn-secondary btn-sm",children:"Compare"})]})]}),!m.same_endpoint&&t("div",{class:"profiler-panel profiler-p-4 profiler-mb-4",style:"border-left: 3px solid var(--color-warning, #f59e0b)",children:"\u26A0\uFE0F These profiles are from different endpoints - comparison may not be meaningful."}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{}),t("th",{children:"Profile A"}),t("th",{children:"Profile B"})]})}),t("tbody",{children:[t("tr",{children:[t("td",{children:"Endpoint"}),t("td",{children:k.node==="local"?t("a",{href:`${Nr}/profiles/${k.token}`,children:[k.method," ",k.path]}):t("span",{children:[k.method," ",k.path]})}),t("td",{children:K.node==="local"?t("a",{href:`${Nr}/profiles/${K.token}`,children:[K.method," ",K.path]}):t("span",{children:[K.method," ",K.path]})})]}),t("tr",{children:[t("td",{children:"Time"}),t("td",{class:"profiler-text--mono",children:ts(k.started_at)}),t("td",{class:"profiler-text--mono",children:ts(K.started_at)})]}),t("tr",{children:[t("td",{children:"Token"}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[k.token.substring(0,16),"\u2026"]}),t("td",{class:"profiler-text--xs profiler-text--mono profiler-text--muted",children:[K.token.substring(0,16),"\u2026"]})]})]})]})})}),t("div",{class:"profiler-panel profiler-mb-4",children:t("div",{class:"profiler-p-4",children:[t("div",{style:"display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px",children:[t("h2",{style:"margin: 0",children:"Scorecard"}),C&&t("a",{class:"btn btn-secondary btn-sm",href:C,download:`compare-${e.substring(0,8)}-vs-${r.substring(0,8)}.md`,children:"Export as Markdown"})]}),t("table",{children:[t("thead",{children:t("tr",{children:[t("th",{children:"Metric"}),t("th",{children:"A"}),t("th",{children:"B"}),t("th",{children:"Delta"})]})}),t("tbody",{children:[t($t,{label:"Duration",metric:U.duration,formatA:ae,formatB:ae}),t($t,{label:"Allocated objects",metric:U.allocated_objects,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Queries",metric:U.db_queries,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"DB Duration",metric:U.db_duration,formatA:ae,formatB:ae}),t($t,{label:"Cache Hit Rate",metric:U.cache_hit_rate,formatA:T=>V(T,"%"),formatB:T=>V(T,"%")}),t($t,{label:"View Duration",metric:U.view_duration,formatA:ae,formatB:ae}),t($t,{label:"HTTP Requests",metric:U.http_requests,formatA:T=>V(T),formatB:T=>V(T)}),t($t,{label:"HTTP Duration",metric:U.http_duration,formatA:ae,formatB:ae})]})]})]})}),t("div",{class:"profiler-panel profiler-mb-6",children:[t("div",{class:"tabs",children:[t("a",{href:"#",class:j("sql"),onClick:T=>{T.preventDefault(),w("sql")},children:"SQL"}),t("a",{href:"#",class:j("database"),onClick:T=>{T.preventDefault(),w("database")},children:"Database"}),t("a",{href:"#",class:j("cache"),onClick:T=>{T.preventDefault(),w("cache")},children:"Cache"}),t("a",{href:"#",class:j("views"),onClick:T=>{T.preventDefault(),w("views")},children:"Views"}),t("a",{href:"#",class:j("http"),onClick:T=>{T.preventDefault(),w("http")},children:"HTTP"})]}),t("div",{class:"profiler-p-4 tab-content active",children:[x==="sql"&&t("div",{children:[t(on,{title:"New queries (only in B)",rows:m.sql.new}),t(on,{title:"Gone queries (only in A)",rows:m.sql.gone}),t(on,{title:"Slower queries",rows:m.sql.slower})]}),x==="database"&&t(es,{label:"Database",rows:[{key:"Total Queries",a:V(L.database.total_queries_a),b:V(L.database.total_queries_b)},{key:"Total Duration",a:ae(L.database.total_duration_a),b:ae(L.database.total_duration_b)},{key:"Slow Queries",a:V(L.database.slow_queries_a),b:V(L.database.slow_queries_b)},{key:"Cached Queries",a:V(L.database.cached_queries_a),b:V(L.database.cached_queries_b)}]}),x==="cache"&&t(es,{label:"Cache",rows:[{key:"Total Reads",a:V(L.cache.total_reads_a),b:V(L.cache.total_reads_b)},{key:"Total Writes",a:V(L.cache.total_writes_a),b:V(L.cache.total_writes_b)},{key:"Hit Rate",a:V(L.cache.hit_rate_a,"%"),b:V(L.cache.hit_rate_b,"%")}]}),x==="views"&&t(es,{label:"Views",rows:[{key:"Templates",a:V(L.views.total_views_a),b:V(L.views.total_views_b)},{key:"Partials",a:V(L.views.total_partials_a),b:V(L.views.total_partials_b)},{key:"Total Duration",a:ae(L.views.total_duration_a),b:ae(L.views.total_duration_b)}]}),x==="http"&&t(es,{label:"HTTP",rows:[{key:"Total Requests",a:V(L.http.total_requests_a),b:V(L.http.total_requests_b)},{key:"Total Duration",a:ae(L.http.total_duration_a),b:ae(L.http.total_duration_b)},{key:"Slow Requests",a:V(L.http.slow_requests_a),b:V(L.http.slow_requests_b)},{key:"Error Requests",a:V(L.http.error_requests_a),b:V(L.http.error_requests_b)}]})]})]})]})}function Ji(e){console.log("Initializing profiler timeline");let r=e.dataset.token;if(!r){console.error("No profile token found");return}up(r).then(o=>{cp(e,o)})}async function up(e){return(await(await fetch(`/_profiler/profiles/${e}/timeline`)).json()).events||[]}function cp(e,r){if(!r.length){e.innerHTML="<p>No timeline events recorded</p>";return}let o=pp(r);e.appendChild(o)}function pp(e){let o=e.length*40+40,s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("width","1200"),s.setAttribute("height",o.toString()),s.style.cssText="background: #1e1e1e; border-radius: 4px;";let n=Math.min(...e.map(c=>c.started_at)),l=1100/(Math.max(...e.map(c=>c.finished_at))-n);return e.forEach((c,d)=>{let m=d*40+20,f=(c.started_at-n)*l+50,y=c.duration*l,h=document.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("x",f.toString()),h.setAttribute("y",m.toString()),h.setAttribute("width",Math.max(y,2).toString()),h.setAttribute("height","20"),h.setAttribute("fill",dp(c.name)),h.setAttribute("rx","2");let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=`${c.name}
17
+ Duration: ${c.duration.toFixed(2)}ms`,h.appendChild(g),s.appendChild(h);let b=document.createElementNS("http://www.w3.org/2000/svg","text");b.setAttribute("x","5"),b.setAttribute("y",(m+15).toString()),b.setAttribute("fill","#d4d4d4"),b.setAttribute("font-size","11"),b.textContent=c.name.substring(0,40),s.appendChild(b)}),s}function dp(e){return e.includes("Controller")?"#569cd6":e.includes("Render")?"#4ec9b0":e.includes("Partial")?"#ce9178":"#dcdcaa"}var sn=new Map;function zi(e){try{return localStorage.getItem(e)}catch{return sn.has(e)?sn.get(e):null}}function Wi(e,r){sn.set(e,r);try{localStorage.setItem(e,r)}catch{}}var nn="profiler-theme",fp="data-theme",an=class{constructor(){this.systemPreference=window.matchMedia("(prefers-color-scheme: dark)"),this.currentTheme=this.loadTheme(),this.init()}init(){this.applyTheme(this.currentTheme),this.systemPreference.addEventListener("change",r=>{this.currentTheme==="auto"&&this.applyTheme("auto")}),window.addEventListener("storage",r=>{r.key===nn&&r.newValue&&(this.currentTheme=r.newValue,this.applyTheme(this.currentTheme))})}loadTheme(){return zi(nn)||"auto"}saveTheme(r){Wi(nn,r)}applyTheme(r){let o=this.resolveTheme(r);document.documentElement.setAttribute(fp,o),window.dispatchEvent(new CustomEvent("profiler:theme-change",{detail:{theme:o}}))}resolveTheme(r){return r==="auto"?this.systemPreference.matches?"dark":"light":r}getTheme(){return this.currentTheme}getResolvedTheme(){return this.resolveTheme(this.currentTheme)}setTheme(r){this.currentTheme=r,this.saveTheme(r),this.applyTheme(r)}toggle(){let o=this.getResolvedTheme()==="dark"?"light":"dark";this.setTheme(o)}},un=new an;function mp(){un.toggle()}function ln(){return un.getResolvedTheme()}function hp(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function yp(){let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none");let r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d","M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),e.appendChild(r),e}function Zi(){let e=document.createElement("button");e.className="profiler-theme-toggle",e.setAttribute("aria-label","Toggle theme"),e.title="Toggle light/dark mode";let r=()=>{let o=ln();for(;e.firstChild;)e.removeChild(e.firstChild);let s=o==="dark"?hp():yp();e.appendChild(s)};return r(),window.addEventListener("profiler:theme-change",r),e.addEventListener("click",()=>{mp()}),e}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{console.log("\u{1F3A8} Theme system initialized:",ln())}):console.log("\u{1F3A8} Theme system initialized:",ln());var rs=new Qs({defaultOptions:{queries:{staleTime:3e4,retry:1}}});document.addEventListener("DOMContentLoaded",()=>{let e=document.getElementById("profiler-cluster-selector"),r=document.querySelector('meta[name="profiler-is-master"]')?.getAttribute("content")==="true";e&&r&&fr(t(qr,{client:rs,children:t(Ci,{})}),e);let o=document.getElementById("profiler-index");o&&fr(t(qr,{client:rs,children:t(wi,{})}),o);let s=document.getElementById("profiler-show");if(s){let l=document.getElementById("profiler-show-data");if(l){let c=JSON.parse(l.textContent),d=new URLSearchParams(location.search).get("tab")||"request",m=s.dataset.embedded==="true",f;c.profile_type==="job"?f=t(Ni,{profile:c,initialTab:d,embedded:m}):c.profile_type==="console"?f=t(Ii,{profile:c,initialTab:d,embedded:m}):c.profile_type==="test"?f=t(Vi,{profile:c,initialTab:d,embedded:m}):f=t(Ki,{profile:c,initialTab:d,embedded:m}),fr(t(qr,{client:rs,children:f}),s)}}let n=document.getElementById("profiler-test-runner");n&&fr(t(qr,{client:rs,children:t(Hi,{})}),n);let a=document.getElementById("profiler-compare");if(a){let l=a.dataset.tokenA,c=a.dataset.tokenB;l&&c&&fr(t(Bi,{tokenA:l,tokenB:c,nodeA:a.dataset.nodeA||"",nodeB:a.dataset.nodeB||""}),a)}if(!o&&!s&&!n&&!a){let l=document.querySelector(".header, .profiler-detail");if(l){let c=Zi();c.style.position="absolute",c.style.top="20px",c.style.right="20px",l.style.position="relative",l.appendChild(c)}}let i=document.getElementById("profiler-timeline");i&&Ji(i)});})();