context-lens 0.5.0 → 0.5.1

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,2 +1,2 @@
1
- export declare const VERSION = "0.5.0";
1
+ export declare const VERSION = "0.5.1";
2
2
  //# sourceMappingURL=version.generated.d.ts.map
@@ -1,2 +1,2 @@
1
- export const VERSION = "0.5.0";
1
+ export const VERSION = "0.5.1";
2
2
  //# sourceMappingURL=version.generated.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-lens",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "description": "Local HTTP proxy that intercepts LLM API calls and visualizes context windows",
6
6
  "main": "dist/proxy/server.js",
@@ -19,7 +19,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xml-sdJ4AIDG.js
19
19
  * pinia v2.3.1
20
20
  * (c) 2025 Eduardo San Martin Morote
21
21
  * @license MIT
22
- */let Ma;const yo=e=>Ma=e,Ea=Symbol();function si(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var is;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(is||(is={}));function Ud(){const e=bl(!0),t=e.run(()=>me({}));let n=[],s=[];const o=Ti({install(i){yo(o),o._a=i,i.provide(Ea,o),i.config.globalProperties.$pinia=o,s.forEach(r=>n.push(r)),s=[]},use(i){return this._a?n.push(i):s.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}const Pa=()=>{};function Tr(e,t,n,s=Pa){e.push(t);const o=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),s())};return!n&&wl()&&$c(o),o}function An(e,...t){e.slice().forEach(n=>{n(...t)})}const Kd=e=>e(),Cr=Symbol(),No=Symbol();function oi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,s)=>e.set(s,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const s=t[n],o=e[n];si(o)&&si(s)&&e.hasOwnProperty(n)&&!Ge(s)&&!Yt(s)?e[n]=oi(o,s):e[n]=s}return e}const Wd=Symbol();function qd(e){return!si(e)||!e.hasOwnProperty(Wd)}const{assign:rn}=Object;function Gd(e){return!!(Ge(e)&&e.effect)}function Jd(e,t,n,s){const{state:o,actions:i,getters:r}=t,l=n.state.value[e];let c;function p(){l||(n.state.value[e]=o?o():{});const d=Gc(n.state.value[e]);return rn(d,i,Object.keys(r||{}).reduce((m,v)=>(m[v]=Ti(A(()=>{yo(n);const w=n._s.get(e);return r[v].call(w,w)})),m),{}))}return c=Ia(e,p,t,n,s,!0),c}function Ia(e,t,n={},s,o,i){let r;const l=rn({actions:{}},n),c={deep:!0};let p,d,m=[],v=[],w;const I=s.state.value[e];!i&&!I&&(s.state.value[e]={});let S;function _(ue){let O;p=d=!1,typeof ue=="function"?(ue(s.state.value[e]),O={type:is.patchFunction,storeId:e,events:w}):(oi(s.state.value[e],ue),O={type:is.patchObject,payload:ue,storeId:e,events:w});const R=S=Symbol();Ke().then(()=>{S===R&&(p=!0)}),d=!0,An(m,O,s.state.value[e])}const T=i?function(){const{state:O}=n,R=O?O():{};this.$patch(de=>{rn(de,R)})}:Pa;function z(){r.stop(),m=[],v=[],s._s.delete(e)}const K=(ue,O="")=>{if(Cr in ue)return ue[No]=O,ue;const R=function(){yo(s);const de=Array.from(arguments),F=[],te=[];function ce(oe){F.push(oe)}function B(oe){te.push(oe)}An(v,{args:de,name:R[No],store:Q,after:ce,onError:B});let se;try{se=ue.apply(this&&this.$id===e?this:Q,de)}catch(oe){throw An(te,oe),oe}return se instanceof Promise?se.then(oe=>(An(F,oe),oe)).catch(oe=>(An(te,oe),Promise.reject(oe))):(An(F,se),se)};return R[Cr]=!0,R[No]=O,R},V={_p:s,$id:e,$onAction:Tr.bind(null,v),$patch:_,$reset:T,$subscribe(ue,O={}){const R=Tr(m,ue,O.detached,()=>de()),de=r.run(()=>We(()=>s.state.value[e],F=>{(O.flush==="sync"?d:p)&&ue({storeId:e,type:is.direct,events:w},F)},rn({},c,O)));return R},$dispose:z},Q=Cs(V);s._s.set(e,Q);const ae=(s._a&&s._a.runWithContext||Kd)(()=>s._e.run(()=>(r=bl()).run(()=>t({action:K}))));for(const ue in ae){const O=ae[ue];if(Ge(O)&&!Gd(O)||Yt(O))i||(I&&qd(O)&&(Ge(O)?O.value=I[ue]:oi(O,I[ue])),s.state.value[e][ue]=O);else if(typeof O=="function"){const R=K(O,ue);ae[ue]=R,l.actions[ue]=O}}return rn(Q,ae),rn(Oe(Q),ae),Object.defineProperty(Q,"$state",{get:()=>s.state.value[e],set:ue=>{_(O=>{rn(O,ue)})}}),s._p.forEach(ue=>{rn(Q,r.run(()=>ue({store:Q,app:s._a,pinia:s,options:l})))}),I&&i&&n.hydrate&&n.hydrate(Q.$state,I),p=!0,d=!0,Q}/*! #__NO_SIDE_EFFECTS__ */function Yd(e,t,n){let s,o;const i=typeof t=="function";s=e,o=i?n:t;function r(l,c){const p=lu();return l=l||(p?$t(Ea,null):null),l&&yo(l),l=Ma,l._s.has(s)||(i?Ia(s,t,o,l):Jd(s,o,l)),l._s.get(s)}return r.$id=s,r}const Xd=["top","right","bottom","left"],Mr=["start","end"],Er=Xd.reduce((e,t)=>e.concat(t,t+"-"+Mr[0],t+"-"+Mr[1]),[]),bs=Math.min,Sn=Math.max,Zd={left:"right",right:"left",bottom:"top",top:"bottom"},Qd={start:"end",end:"start"};function ii(e,t,n){return Sn(e,bs(t,n))}function Pn(e,t){return typeof e=="function"?e(t):e}function Ht(e){return e.split("-")[0]}function Mt(e){return e.split("-")[1]}function Aa(e){return e==="x"?"y":"x"}function Di(e){return e==="y"?"height":"width"}const ef=new Set(["top","bottom"]);function Jt(e){return ef.has(Ht(e))?"y":"x"}function Ni(e){return Aa(Jt(e))}function La(e,t,n){n===void 0&&(n=!1);const s=Mt(e),o=Ni(e),i=Di(o);let r=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=Ys(r)),[r,Ys(r)]}function tf(e){const t=Ys(e);return[Js(e),t,Js(t)]}function Js(e){return e.replace(/start|end/g,t=>Qd[t])}const Pr=["left","right"],Ir=["right","left"],nf=["top","bottom"],sf=["bottom","top"];function of(e,t,n){switch(e){case"top":case"bottom":return n?t?Ir:Pr:t?Pr:Ir;case"left":case"right":return t?nf:sf;default:return[]}}function rf(e,t,n,s){const o=Mt(e);let i=of(Ht(e),n==="start",s);return o&&(i=i.map(r=>r+"-"+o),t&&(i=i.concat(i.map(Js)))),i}function Ys(e){return e.replace(/left|right|bottom|top/g,t=>Zd[t])}function lf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oa(e){return typeof e!="number"?lf(e):{top:e,right:e,bottom:e,left:e}}function rs(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Ar(e,t,n){let{reference:s,floating:o}=e;const i=Jt(t),r=Ni(t),l=Di(r),c=Ht(t),p=i==="y",d=s.x+s.width/2-o.width/2,m=s.y+s.height/2-o.height/2,v=s[l]/2-o[l]/2;let w;switch(c){case"top":w={x:d,y:s.y-o.height};break;case"bottom":w={x:d,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:m};break;case"left":w={x:s.x-o.width,y:m};break;default:w={x:s.x,y:s.y}}switch(Mt(t)){case"start":w[r]-=v*(n&&p?-1:1);break;case"end":w[r]+=v*(n&&p?-1:1);break}return w}async function af(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:r,elements:l,strategy:c}=e,{boundary:p="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:v=!1,padding:w=0}=Pn(t,e),I=Oa(w),_=l[v?m==="floating"?"reference":"floating":m],T=rs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(_)))==null||n?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:p,rootBoundary:d,strategy:c})),z=m==="floating"?{x:s,y:o,width:r.floating.width,height:r.floating.height}:r.reference,K=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),V=await(i.isElement==null?void 0:i.isElement(K))?await(i.getScale==null?void 0:i.getScale(K))||{x:1,y:1}:{x:1,y:1},Q=rs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:z,offsetParent:K,strategy:c}):z);return{top:(T.top-Q.top+I.top)/V.y,bottom:(Q.bottom-T.bottom+I.bottom)/V.y,left:(T.left-Q.left+I.left)/V.x,right:(Q.right-T.right+I.right)/V.x}}const cf=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:r}=n,l=i.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let p=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:m}=Ar(p,s,c),v=s,w={},I=0;for(let _=0;_<l.length;_++){var S;const{name:T,fn:z}=l[_],{x:K,y:V,data:Q,reset:D}=await z({x:d,y:m,initialPlacement:s,placement:v,strategy:o,middlewareData:w,rects:p,platform:{...r,detectOverflow:(S=r.detectOverflow)!=null?S:af},elements:{reference:e,floating:t}});d=K??d,m=V??m,w={...w,[T]:{...w[T],...Q}},D&&I<=50&&(I++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(p=D.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:o}):D.rects),{x:d,y:m}=Ar(p,v,c)),_=-1)}return{x:d,y:m,placement:v,strategy:o,middlewareData:w}},uf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:r,elements:l,middlewareData:c}=t,{element:p,padding:d=0}=Pn(e,t)||{};if(p==null)return{};const m=Oa(d),v={x:n,y:s},w=Ni(o),I=Di(w),S=await r.getDimensions(p),_=w==="y",T=_?"top":"left",z=_?"bottom":"right",K=_?"clientHeight":"clientWidth",V=i.reference[I]+i.reference[w]-v[w]-i.floating[I],Q=v[w]-i.reference[w],D=await(r.getOffsetParent==null?void 0:r.getOffsetParent(p));let ae=D?D[K]:0;(!ae||!await(r.isElement==null?void 0:r.isElement(D)))&&(ae=l.floating[K]||i.floating[I]);const ue=V/2-Q/2,O=ae/2-S[I]/2-1,R=bs(m[T],O),de=bs(m[z],O),F=R,te=ae-S[I]-de,ce=ae/2-S[I]/2+ue,B=ii(F,ce,te),se=!c.arrow&&Mt(o)!=null&&ce!==B&&i.reference[I]/2-(ce<F?R:de)-S[I]/2<0,oe=se?ce<F?ce-F:ce-te:0;return{[w]:v[w]+oe,data:{[w]:B,centerOffset:ce-B-oe,...se&&{alignmentOffset:oe}},reset:se}}});function df(e,t,n){return(e?[...n.filter(o=>Mt(o)===e),...n.filter(o=>Mt(o)!==e)]:n.filter(o=>Ht(o)===o)).filter(o=>e?Mt(o)===e||(t?Js(o)!==o:!1):!0)}const ff=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,o;const{rects:i,middlewareData:r,placement:l,platform:c,elements:p}=t,{crossAxis:d=!1,alignment:m,allowedPlacements:v=Er,autoAlignment:w=!0,...I}=Pn(e,t),S=m!==void 0||v===Er?df(m||null,w,v):v,_=await c.detectOverflow(t,I),T=((n=r.autoPlacement)==null?void 0:n.index)||0,z=S[T];if(z==null)return{};const K=La(z,i,await(c.isRTL==null?void 0:c.isRTL(p.floating)));if(l!==z)return{reset:{placement:S[0]}};const V=[_[Ht(z)],_[K[0]],_[K[1]]],Q=[...((s=r.autoPlacement)==null?void 0:s.overflows)||[],{placement:z,overflows:V}],D=S[T+1];if(D)return{data:{index:T+1,overflows:Q},reset:{placement:D}};const ae=Q.map(R=>{const de=Mt(R.placement);return[R.placement,de&&d?R.overflows.slice(0,2).reduce((F,te)=>F+te,0):R.overflows[0],R.overflows]}).sort((R,de)=>R[1]-de[1]),O=((o=ae.filter(R=>R[2].slice(0,Mt(R[0])?2:3).every(de=>de<=0))[0])==null?void 0:o[0])||ae[0][0];return O!==l?{data:{index:T+1,overflows:Q},reset:{placement:O}}:{}}}},pf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:r,initialPlacement:l,platform:c,elements:p}=t,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:I="none",flipAlignment:S=!0,..._}=Pn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const T=Ht(o),z=Jt(l),K=Ht(l)===l,V=await(c.isRTL==null?void 0:c.isRTL(p.floating)),Q=v||(K||!S?[Ys(l)]:tf(l)),D=I!=="none";!v&&D&&Q.push(...rf(l,S,I,V));const ae=[l,...Q],ue=await c.detectOverflow(t,_),O=[];let R=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&O.push(ue[T]),m){const ce=La(o,r,V);O.push(ue[ce[0]],ue[ce[1]])}if(R=[...R,{placement:o,overflows:O}],!O.every(ce=>ce<=0)){var de,F;const ce=(((de=i.flip)==null?void 0:de.index)||0)+1,B=ae[ce];if(B&&(!(m==="alignment"?z!==Jt(B):!1)||R.every(W=>Jt(W.placement)===z?W.overflows[0]>0:!0)))return{data:{index:ce,overflows:R},reset:{placement:B}};let se=(F=R.filter(oe=>oe.overflows[0]<=0).sort((oe,W)=>oe.overflows[1]-W.overflows[1])[0])==null?void 0:F.placement;if(!se)switch(w){case"bestFit":{var te;const oe=(te=R.filter(W=>{if(D){const re=Jt(W.placement);return re===z||re==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(re=>re>0).reduce((re,we)=>re+we,0)]).sort((W,re)=>W[1]-re[1])[0])==null?void 0:te[0];oe&&(se=oe);break}case"initialPlacement":se=l;break}if(o!==se)return{reset:{placement:se}}}return{}}}},hf=new Set(["left","top"]);async function vf(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),r=Ht(n),l=Mt(n),c=Jt(n)==="y",p=hf.has(r)?-1:1,d=i&&c?-1:1,m=Pn(t,e);let{mainAxis:v,crossAxis:w,alignmentAxis:I}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof I=="number"&&(w=l==="end"?I*-1:I),c?{x:w*d,y:v*p}:{x:v*p,y:w*d}}const mf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:r,middlewareData:l}=t,c=await vf(t,e);return r===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:r}}}}},gf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:T=>{let{x:z,y:K}=T;return{x:z,y:K}}},...p}=Pn(e,t),d={x:n,y:s},m=await i.detectOverflow(t,p),v=Jt(Ht(o)),w=Aa(v);let I=d[w],S=d[v];if(r){const T=w==="y"?"top":"left",z=w==="y"?"bottom":"right",K=I+m[T],V=I-m[z];I=ii(K,I,V)}if(l){const T=v==="y"?"top":"left",z=v==="y"?"bottom":"right",K=S+m[T],V=S-m[z];S=ii(K,S,V)}const _=c.fn({...t,[w]:I,[v]:S});return{..._,data:{x:_.x-n,y:_.y-s,enabled:{[w]:r,[v]:l}}}}}},yf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:r,elements:l}=t,{apply:c=()=>{},...p}=Pn(e,t),d=await r.detectOverflow(t,p),m=Ht(o),v=Mt(o),w=Jt(o)==="y",{width:I,height:S}=i.floating;let _,T;m==="top"||m==="bottom"?(_=m,T=v===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(T=m,_=v==="end"?"top":"bottom");const z=S-d.top-d.bottom,K=I-d.left-d.right,V=bs(S-d[_],z),Q=bs(I-d[T],K),D=!t.middlewareData.shift;let ae=V,ue=Q;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(ue=K),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(ae=z),D&&!v){const R=Sn(d.left,0),de=Sn(d.right,0),F=Sn(d.top,0),te=Sn(d.bottom,0);w?ue=I-2*(R!==0||de!==0?R+de:Sn(d.left,d.right)):ae=S-2*(F!==0||te!==0?F+te:Sn(d.top,d.bottom))}await c({...t,availableWidth:ue,availableHeight:ae});const O=await r.getDimensions(l.floating);return I!==O.width||S!==O.height?{reset:{rects:!0}}:{}}}};function kt(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zt(e){return kt(e).getComputedStyle(e)}const Lr=Math.min,ls=Math.max,Xs=Math.round;function Ra(e){const t=zt(e);let n=parseFloat(t.width),s=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,r=Xs(n)!==o||Xs(s)!==i;return r&&(n=o,s=i),{width:n,height:s,fallback:r}}function mn(e){return Na(e)?(e.nodeName||"").toLowerCase():""}let Os;function Da(){if(Os)return Os;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Os=e.brands.map((t=>t.brand+"/"+t.version)).join(" "),Os):navigator.userAgent}function Bt(e){return e instanceof kt(e).HTMLElement}function pn(e){return e instanceof kt(e).Element}function Na(e){return e instanceof kt(e).Node}function Or(e){return typeof ShadowRoot>"u"?!1:e instanceof kt(e).ShadowRoot||e instanceof ShadowRoot}function _o(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(o)}function _f(e){return["table","td","th"].includes(mn(e))}function ri(e){const t=/firefox/i.test(Da()),n=zt(e),s=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||!!s&&s!=="none"||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"||["transform","perspective"].some((o=>n.willChange.includes(o)))||["paint","layout","strict","content"].some((o=>{const i=n.contain;return i!=null&&i.includes(o)}))}function Fa(){return!/^((?!chrome|android).)*safari/i.test(Da())}function Fi(e){return["html","body","#document"].includes(mn(e))}function za(e){return pn(e)?e:e.contextElement}const Ba={x:1,y:1};function Fn(e){const t=za(e);if(!Bt(t))return Ba;const n=t.getBoundingClientRect(),{width:s,height:o,fallback:i}=Ra(t);let r=(i?Xs(n.width):n.width)/s,l=(i?Xs(n.height):n.height)/o;return r&&Number.isFinite(r)||(r=1),l&&Number.isFinite(l)||(l=1),{x:r,y:l}}function ws(e,t,n,s){var o,i;t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=za(e);let c=Ba;t&&(s?pn(s)&&(c=Fn(s)):c=Fn(e));const p=l?kt(l):window,d=!Fa()&&n;let m=(r.left+(d&&((o=p.visualViewport)==null?void 0:o.offsetLeft)||0))/c.x,v=(r.top+(d&&((i=p.visualViewport)==null?void 0:i.offsetTop)||0))/c.y,w=r.width/c.x,I=r.height/c.y;if(l){const S=kt(l),_=s&&pn(s)?kt(s):s;let T=S.frameElement;for(;T&&s&&_!==S;){const z=Fn(T),K=T.getBoundingClientRect(),V=getComputedStyle(T);K.x+=(T.clientLeft+parseFloat(V.paddingLeft))*z.x,K.y+=(T.clientTop+parseFloat(V.paddingTop))*z.y,m*=z.x,v*=z.y,w*=z.x,I*=z.y,m+=K.x,v+=K.y,T=kt(T).frameElement}}return{width:w,height:I,top:v,right:m+w,bottom:v+I,left:m,x:m,y:v}}function hn(e){return((Na(e)?e.ownerDocument:e.document)||window.document).documentElement}function bo(e){return pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ha(e){return ws(hn(e)).left+bo(e).scrollLeft}function ks(e){if(mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Or(e)&&e.host||hn(e);return Or(t)?t.host:t}function ja(e){const t=ks(e);return Fi(t)?t.ownerDocument.body:Bt(t)&&_o(t)?t:ja(t)}function Zs(e,t){var n;t===void 0&&(t=[]);const s=ja(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=kt(s);return o?t.concat(i,i.visualViewport||[],_o(s)?s:[]):t.concat(s,Zs(s))}function Rr(e,t,n){return t==="viewport"?rs((function(s,o){const i=kt(s),r=hn(s),l=i.visualViewport;let c=r.clientWidth,p=r.clientHeight,d=0,m=0;if(l){c=l.width,p=l.height;const v=Fa();(v||!v&&o==="fixed")&&(d=l.offsetLeft,m=l.offsetTop)}return{width:c,height:p,x:d,y:m}})(e,n)):pn(t)?rs((function(s,o){const i=ws(s,!0,o==="fixed"),r=i.top+s.clientTop,l=i.left+s.clientLeft,c=Bt(s)?Fn(s):{x:1,y:1};return{width:s.clientWidth*c.x,height:s.clientHeight*c.y,x:l*c.x,y:r*c.y}})(t,n)):rs((function(s){const o=hn(s),i=bo(s),r=s.ownerDocument.body,l=ls(o.scrollWidth,o.clientWidth,r.scrollWidth,r.clientWidth),c=ls(o.scrollHeight,o.clientHeight,r.scrollHeight,r.clientHeight);let p=-i.scrollLeft+Ha(s);const d=-i.scrollTop;return zt(r).direction==="rtl"&&(p+=ls(o.clientWidth,r.clientWidth)-l),{width:l,height:c,x:p,y:d}})(hn(e)))}function Dr(e){return Bt(e)&&zt(e).position!=="fixed"?e.offsetParent:null}function Nr(e){const t=kt(e);let n=Dr(e);for(;n&&_f(n)&&zt(n).position==="static";)n=Dr(n);return n&&(mn(n)==="html"||mn(n)==="body"&&zt(n).position==="static"&&!ri(n))?t:n||(function(s){let o=ks(s);for(;Bt(o)&&!Fi(o);){if(ri(o))return o;o=ks(o)}return null})(e)||t}function bf(e,t,n){const s=Bt(t),o=hn(t),i=ws(e,!0,n==="fixed",t);let r={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(s||!s&&n!=="fixed")if((mn(t)!=="body"||_o(o))&&(r=bo(t)),Bt(t)){const c=ws(t,!0);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=Ha(o));return{x:i.left+r.scrollLeft-l.x,y:i.top+r.scrollTop-l.y,width:i.width,height:i.height}}const wf={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const i=n==="clippingAncestors"?(function(p,d){const m=d.get(p);if(m)return m;let v=Zs(p).filter((_=>pn(_)&&mn(_)!=="body")),w=null;const I=zt(p).position==="fixed";let S=I?ks(p):p;for(;pn(S)&&!Fi(S);){const _=zt(S),T=ri(S);(I?T||w:T||_.position!=="static"||!w||!["absolute","fixed"].includes(w.position))?w=_:v=v.filter((z=>z!==S)),S=ks(S)}return d.set(p,v),v})(t,this._c):[].concat(n),r=[...i,s],l=r[0],c=r.reduce(((p,d)=>{const m=Rr(t,d,o);return p.top=ls(m.top,p.top),p.right=Lr(m.right,p.right),p.bottom=Lr(m.bottom,p.bottom),p.left=ls(m.left,p.left),p}),Rr(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:s}=e;const o=Bt(n),i=hn(n);if(n===i)return t;let r={scrollLeft:0,scrollTop:0},l={x:1,y:1};const c={x:0,y:0};if((o||!o&&s!=="fixed")&&((mn(n)!=="body"||_o(i))&&(r=bo(n)),Bt(n))){const p=ws(n);l=Fn(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-r.scrollLeft*l.x+c.x,y:t.y*l.y-r.scrollTop*l.y+c.y}},isElement:pn,getDimensions:function(e){return Bt(e)?Ra(e):e.getBoundingClientRect()},getOffsetParent:Nr,getDocumentElement:hn,getScale:Fn,async getElementRects(e){let{reference:t,floating:n,strategy:s}=e;const o=this.getOffsetParent||Nr,i=this.getDimensions;return{reference:bf(t,await o(n),s),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>zt(e).direction==="rtl"},kf=(e,t,n)=>{const s=new Map,o={platform:wf,...n},i={...o.platform,_c:s};return cf(e,t,{...o,platform:i})};function Va(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(typeof t[n]=="object"&&e[n]?Va(e[n],t[n]):e[n]=t[n])}const Et={disabled:!1,distance:5,skidding:0,container:"body",boundary:void 0,instantMove:!1,disposeTimeout:150,popperTriggers:[],strategy:"absolute",preventOverflow:!0,flip:!0,shift:!0,overflowPadding:0,arrowPadding:0,arrowOverflow:!0,autoHideOnMousedown:!1,themes:{tooltip:{placement:"top",triggers:["hover","focus","touch"],hideTriggers:e=>[...e,"click"],delay:{show:200,hide:0},handleResize:!1,html:!1,loadingContent:"..."},dropdown:{placement:"bottom",triggers:["click"],delay:0,handleResize:!0,autoHide:!0},menu:{$extend:"dropdown",triggers:["hover","focus"],popperTriggers:["hover"],delay:{show:0,hide:400}}}};function xs(e,t){let n=Et.themes[e]||{},s;do s=n[t],typeof s>"u"?n.$extend?n=Et.themes[n.$extend]||{}:(n=null,s=Et[t]):n=null;while(n);return s}function xf(e){const t=[e];let n=Et.themes[e]||{};do n.$extend&&!n.$resetCss?(t.push(n.$extend),n=Et.themes[n.$extend]||{}):n=null;while(n);return t.map(s=>`v-popper--theme-${s}`)}function Fr(e){const t=[e];let n=Et.themes[e]||{};do n.$extend?(t.push(n.$extend),n=Et.themes[n.$extend]||{}):n=null;while(n);return t}let Hn=!1;if(typeof window<"u"){Hn=!1;try{const e=Object.defineProperty({},"passive",{get(){Hn=!0}});window.addEventListener("test",null,e)}catch{}}let Ua=!1;typeof window<"u"&&typeof navigator<"u"&&(Ua=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream);const Ka=["auto","top","bottom","left","right"].reduce((e,t)=>e.concat([t,`${t}-start`,`${t}-end`]),[]),zr={hover:"mouseenter",focus:"focus",click:"click",touch:"touchstart",pointer:"pointerdown"},Br={hover:"mouseleave",focus:"blur",click:"click",touch:"touchend",pointer:"pointerup"};function Hr(e,t){const n=e.indexOf(t);n!==-1&&e.splice(n,1)}function Fo(){return new Promise(e=>requestAnimationFrame(()=>{requestAnimationFrame(e)}))}const St=[];let xn=null;const jr={};function Vr(e){let t=jr[e];return t||(t=jr[e]=[]),t}let li=function(){};typeof window<"u"&&(li=window.Element);function Le(e){return function(t){return xs(t.theme,e)}}const zo="__floating-vue__popper",Wa=()=>et({name:"VPopper",provide(){return{[zo]:{parentPopper:this}}},inject:{[zo]:{default:null}},props:{theme:{type:String,required:!0},targetNodes:{type:Function,required:!0},referenceNode:{type:Function,default:null},popperNode:{type:Function,required:!0},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:Le("disabled")},positioningDisabled:{type:Boolean,default:Le("positioningDisabled")},placement:{type:String,default:Le("placement"),validator:e=>Ka.includes(e)},delay:{type:[String,Number,Object],default:Le("delay")},distance:{type:[Number,String],default:Le("distance")},skidding:{type:[Number,String],default:Le("skidding")},triggers:{type:Array,default:Le("triggers")},showTriggers:{type:[Array,Function],default:Le("showTriggers")},hideTriggers:{type:[Array,Function],default:Le("hideTriggers")},popperTriggers:{type:Array,default:Le("popperTriggers")},popperShowTriggers:{type:[Array,Function],default:Le("popperShowTriggers")},popperHideTriggers:{type:[Array,Function],default:Le("popperHideTriggers")},container:{type:[String,Object,li,Boolean],default:Le("container")},boundary:{type:[String,li],default:Le("boundary")},strategy:{type:String,validator:e=>["absolute","fixed"].includes(e),default:Le("strategy")},autoHide:{type:[Boolean,Function],default:Le("autoHide")},handleResize:{type:Boolean,default:Le("handleResize")},instantMove:{type:Boolean,default:Le("instantMove")},eagerMount:{type:Boolean,default:Le("eagerMount")},popperClass:{type:[String,Array,Object],default:Le("popperClass")},computeTransformOrigin:{type:Boolean,default:Le("computeTransformOrigin")},autoMinSize:{type:Boolean,default:Le("autoMinSize")},autoSize:{type:[Boolean,String],default:Le("autoSize")},autoMaxSize:{type:Boolean,default:Le("autoMaxSize")},autoBoundaryMaxSize:{type:Boolean,default:Le("autoBoundaryMaxSize")},preventOverflow:{type:Boolean,default:Le("preventOverflow")},overflowPadding:{type:[Number,String],default:Le("overflowPadding")},arrowPadding:{type:[Number,String],default:Le("arrowPadding")},arrowOverflow:{type:Boolean,default:Le("arrowOverflow")},flip:{type:Boolean,default:Le("flip")},shift:{type:Boolean,default:Le("shift")},shiftCrossAxis:{type:Boolean,default:Le("shiftCrossAxis")},noAutoFocus:{type:Boolean,default:Le("noAutoFocus")},disposeTimeout:{type:Number,default:Le("disposeTimeout")}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},data(){return{isShown:!1,isMounted:!1,skipTransition:!1,classes:{showFrom:!1,showTo:!1,hideFrom:!1,hideTo:!0},result:{x:0,y:0,placement:"",strategy:this.strategy,arrow:{x:0,y:0,centerOffset:0},transformOrigin:null},randomId:`popper_${[Math.random(),Date.now()].map(e=>e.toString(36).substring(2,10)).join("_")}`,shownChildren:new Set,lastAutoHide:!0,pendingHide:!1,containsGlobalTarget:!1,isDisposed:!0,mouseDownContains:!1}},computed:{popperId(){return this.ariaId!=null?this.ariaId:this.randomId},shouldMountContent(){return this.eagerMount||this.isMounted},slotData(){return{popperId:this.popperId,isShown:this.isShown,shouldMountContent:this.shouldMountContent,skipTransition:this.skipTransition,autoHide:typeof this.autoHide=="function"?this.lastAutoHide:this.autoHide,show:this.show,hide:this.hide,handleResize:this.handleResize,onResize:this.onResize,classes:{...this.classes,popperClass:this.popperClass},result:this.positioningDisabled?null:this.result,attrs:this.$attrs}},parentPopper(){var e;return(e=this[zo])==null?void 0:e.parentPopper},hasPopperShowTriggerHover(){var e,t;return((e=this.popperTriggers)==null?void 0:e.includes("hover"))||((t=this.popperShowTriggers)==null?void 0:t.includes("hover"))}},watch:{shown:"$_autoShowHide",disabled(e){e?this.dispose():this.init()},async container(){this.isShown&&(this.$_ensureTeleport(),await this.$_computePosition())},triggers:{handler:"$_refreshListeners",deep:!0},positioningDisabled:"$_refreshListeners",...["placement","distance","skidding","boundary","strategy","overflowPadding","arrowPadding","preventOverflow","shift","shiftCrossAxis","flip"].reduce((e,t)=>(e[t]="$_computePosition",e),{})},created(){this.autoMinSize&&console.warn('[floating-vue] `autoMinSize` option is deprecated. Use `autoSize="min"` instead.'),this.autoMaxSize&&console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.")},mounted(){this.init(),this.$_detachPopperNode()},activated(){this.$_autoShowHide()},deactivated(){this.hide()},beforeUnmount(){this.dispose()},methods:{show({event:e=null,skipDelay:t=!1,force:n=!1}={}){var s,o;(s=this.parentPopper)!=null&&s.lockedChild&&this.parentPopper.lockedChild!==this||(this.pendingHide=!1,(n||!this.disabled)&&(((o=this.parentPopper)==null?void 0:o.lockedChild)===this&&(this.parentPopper.lockedChild=null),this.$_scheduleShow(e,t),this.$emit("show"),this.$_showFrameLocked=!0,requestAnimationFrame(()=>{this.$_showFrameLocked=!1})),this.$emit("update:shown",!0))},hide({event:e=null,skipDelay:t=!1}={}){var n;if(!this.$_hideInProgress){if(this.shownChildren.size>0){this.pendingHide=!0;return}if(this.hasPopperShowTriggerHover&&this.$_isAimingPopper()){this.parentPopper&&(this.parentPopper.lockedChild=this,clearTimeout(this.parentPopper.lockedChildTimer),this.parentPopper.lockedChildTimer=setTimeout(()=>{this.parentPopper.lockedChild===this&&(this.parentPopper.lockedChild.hide({skipDelay:t}),this.parentPopper.lockedChild=null)},1e3));return}((n=this.parentPopper)==null?void 0:n.lockedChild)===this&&(this.parentPopper.lockedChild=null),this.pendingHide=!1,this.$_scheduleHide(e,t),this.$emit("hide"),this.$emit("update:shown",!1)}},init(){var e;this.isDisposed&&(this.isDisposed=!1,this.isMounted=!1,this.$_events=[],this.$_preventShow=!1,this.$_referenceNode=((e=this.referenceNode)==null?void 0:e.call(this))??this.$el,this.$_targetNodes=this.targetNodes().filter(t=>t.nodeType===t.ELEMENT_NODE),this.$_popperNode=this.popperNode(),this.$_innerNode=this.$_popperNode.querySelector(".v-popper__inner"),this.$_arrowNode=this.$_popperNode.querySelector(".v-popper__arrow-container"),this.$_swapTargetAttrs("title","data-original-title"),this.$_detachPopperNode(),this.triggers.length&&this.$_addEventListeners(),this.shown&&this.show())},dispose(){this.isDisposed||(this.isDisposed=!0,this.$_removeEventListeners(),this.hide({skipDelay:!0}),this.$_detachPopperNode(),this.isMounted=!1,this.isShown=!1,this.$_updateParentShownChildren(!1),this.$_swapTargetAttrs("data-original-title","title"))},async onResize(){this.isShown&&(await this.$_computePosition(),this.$emit("resize"))},async $_computePosition(){if(this.isDisposed||this.positioningDisabled)return;const e={strategy:this.strategy,middleware:[]};(this.distance||this.skidding)&&e.middleware.push(mf({mainAxis:this.distance,crossAxis:this.skidding}));const t=this.placement.startsWith("auto");if(t?e.middleware.push(ff({alignment:this.placement.split("-")[1]??""})):e.placement=this.placement,this.preventOverflow&&(this.shift&&e.middleware.push(gf({padding:this.overflowPadding,boundary:this.boundary,crossAxis:this.shiftCrossAxis})),!t&&this.flip&&e.middleware.push(pf({padding:this.overflowPadding,boundary:this.boundary}))),e.middleware.push(uf({element:this.$_arrowNode,padding:this.arrowPadding})),this.arrowOverflow&&e.middleware.push({name:"arrowOverflow",fn:({placement:s,rects:o,middlewareData:i})=>{let r;const{centerOffset:l}=i.arrow;return s.startsWith("top")||s.startsWith("bottom")?r=Math.abs(l)>o.reference.width/2:r=Math.abs(l)>o.reference.height/2,{data:{overflow:r}}}}),this.autoMinSize||this.autoSize){const s=this.autoSize?this.autoSize:this.autoMinSize?"min":null;e.middleware.push({name:"autoSize",fn:({rects:o,placement:i,middlewareData:r})=>{var l;if((l=r.autoSize)!=null&&l.skip)return{};let c,p;return i.startsWith("top")||i.startsWith("bottom")?c=o.reference.width:p=o.reference.height,this.$_innerNode.style[s==="min"?"minWidth":s==="max"?"maxWidth":"width"]=c!=null?`${c}px`:null,this.$_innerNode.style[s==="min"?"minHeight":s==="max"?"maxHeight":"height"]=p!=null?`${p}px`:null,{data:{skip:!0},reset:{rects:!0}}}})}(this.autoMaxSize||this.autoBoundaryMaxSize)&&(this.$_innerNode.style.maxWidth=null,this.$_innerNode.style.maxHeight=null,e.middleware.push(yf({boundary:this.boundary,padding:this.overflowPadding,apply:({availableWidth:s,availableHeight:o})=>{this.$_innerNode.style.maxWidth=s!=null?`${s}px`:null,this.$_innerNode.style.maxHeight=o!=null?`${o}px`:null}})));const n=await kf(this.$_referenceNode,this.$_popperNode,e);Object.assign(this.result,{x:n.x,y:n.y,placement:n.placement,strategy:n.strategy,arrow:{...n.middlewareData.arrow,...n.middlewareData.arrowOverflow}})},$_scheduleShow(e,t=!1){if(this.$_updateParentShownChildren(!0),this.$_hideInProgress=!1,clearTimeout(this.$_scheduleTimer),xn&&this.instantMove&&xn.instantMove&&xn!==this.parentPopper){xn.$_applyHide(!0),this.$_applyShow(!0);return}t?this.$_applyShow():this.$_scheduleTimer=setTimeout(this.$_applyShow.bind(this),this.$_computeDelay("show"))},$_scheduleHide(e,t=!1){if(this.shownChildren.size>0){this.pendingHide=!0;return}this.$_updateParentShownChildren(!1),this.$_hideInProgress=!0,clearTimeout(this.$_scheduleTimer),this.isShown&&(xn=this),t?this.$_applyHide():this.$_scheduleTimer=setTimeout(this.$_applyHide.bind(this),this.$_computeDelay("hide"))},$_computeDelay(e){const t=this.delay;return parseInt(t&&t[e]||t||0)},async $_applyShow(e=!1){clearTimeout(this.$_disposeTimer),clearTimeout(this.$_scheduleTimer),this.skipTransition=e,!this.isShown&&(this.$_ensureTeleport(),await Fo(),await this.$_computePosition(),await this.$_applyShowEffect(),this.positioningDisabled||this.$_registerEventListeners([...Zs(this.$_referenceNode),...Zs(this.$_popperNode)],"scroll",()=>{this.$_computePosition()}))},async $_applyShowEffect(){if(this.$_hideInProgress)return;if(this.computeTransformOrigin){const t=this.$_referenceNode.getBoundingClientRect(),n=this.$_popperNode.querySelector(".v-popper__wrapper"),s=n.parentNode.getBoundingClientRect(),o=t.x+t.width/2-(s.left+n.offsetLeft),i=t.y+t.height/2-(s.top+n.offsetTop);this.result.transformOrigin=`${o}px ${i}px`}this.isShown=!0,this.$_applyAttrsToTarget({"aria-describedby":this.popperId,"data-popper-shown":""});const e=this.showGroup;if(e){let t;for(let n=0;n<St.length;n++)t=St[n],t.showGroup!==e&&(t.hide(),t.$emit("close-group"))}St.push(this),document.body.classList.add("v-popper--some-open");for(const t of Fr(this.theme))Vr(t).push(this),document.body.classList.add(`v-popper--some-open--${t}`);this.$emit("apply-show"),this.classes.showFrom=!0,this.classes.showTo=!1,this.classes.hideFrom=!1,this.classes.hideTo=!1,await Fo(),this.classes.showFrom=!1,this.classes.showTo=!0,this.noAutoFocus||this.$_popperNode.focus()},async $_applyHide(e=!1){if(this.shownChildren.size>0){this.pendingHide=!0,this.$_hideInProgress=!1;return}if(clearTimeout(this.$_scheduleTimer),!this.isShown)return;this.skipTransition=e,Hr(St,this),St.length===0&&document.body.classList.remove("v-popper--some-open");for(const n of Fr(this.theme)){const s=Vr(n);Hr(s,this),s.length===0&&document.body.classList.remove(`v-popper--some-open--${n}`)}xn===this&&(xn=null),this.isShown=!1,this.$_applyAttrsToTarget({"aria-describedby":void 0,"data-popper-shown":void 0}),clearTimeout(this.$_disposeTimer);const t=this.disposeTimeout;t!==null&&(this.$_disposeTimer=setTimeout(()=>{this.$_popperNode&&(this.$_detachPopperNode(),this.isMounted=!1)},t)),this.$_removeEventListeners("scroll"),this.$emit("apply-hide"),this.classes.showFrom=!1,this.classes.showTo=!1,this.classes.hideFrom=!0,this.classes.hideTo=!1,await Fo(),this.classes.hideFrom=!1,this.classes.hideTo=!0},$_autoShowHide(){this.shown?this.show():this.hide()},$_ensureTeleport(){if(this.isDisposed)return;let e=this.container;if(typeof e=="string"?e=window.document.querySelector(e):e===!1&&(e=this.$_targetNodes[0].parentNode),!e)throw new Error("No container for popover: "+this.container);e.appendChild(this.$_popperNode),this.isMounted=!0},$_addEventListeners(){const e=n=>{this.isShown&&!this.$_hideInProgress||(n.usedByTooltip=!0,!this.$_preventShow&&this.show({event:n}))};this.$_registerTriggerListeners(this.$_targetNodes,zr,this.triggers,this.showTriggers,e),this.$_registerTriggerListeners([this.$_popperNode],zr,this.popperTriggers,this.popperShowTriggers,e);const t=n=>{n.usedByTooltip||this.hide({event:n})};this.$_registerTriggerListeners(this.$_targetNodes,Br,this.triggers,this.hideTriggers,t),this.$_registerTriggerListeners([this.$_popperNode],Br,this.popperTriggers,this.popperHideTriggers,t)},$_registerEventListeners(e,t,n){this.$_events.push({targetNodes:e,eventType:t,handler:n}),e.forEach(s=>s.addEventListener(t,n,Hn?{passive:!0}:void 0))},$_registerTriggerListeners(e,t,n,s,o){let i=n;s!=null&&(i=typeof s=="function"?s(i):s),i.forEach(r=>{const l=t[r];l&&this.$_registerEventListeners(e,l,o)})},$_removeEventListeners(e){const t=[];this.$_events.forEach(n=>{const{targetNodes:s,eventType:o,handler:i}=n;!e||e===o?s.forEach(r=>r.removeEventListener(o,i)):t.push(n)}),this.$_events=t},$_refreshListeners(){this.isDisposed||(this.$_removeEventListeners(),this.$_addEventListeners())},$_handleGlobalClose(e,t=!1){this.$_showFrameLocked||(this.hide({event:e}),e.closePopover?this.$emit("close-directive"):this.$emit("auto-hide"),t&&(this.$_preventShow=!0,setTimeout(()=>{this.$_preventShow=!1},300)))},$_detachPopperNode(){this.$_popperNode.parentNode&&this.$_popperNode.parentNode.removeChild(this.$_popperNode)},$_swapTargetAttrs(e,t){for(const n of this.$_targetNodes){const s=n.getAttribute(e);s&&(n.removeAttribute(e),n.setAttribute(t,s))}},$_applyAttrsToTarget(e){for(const t of this.$_targetNodes)for(const n in e){const s=e[n];s==null?t.removeAttribute(n):t.setAttribute(n,s)}},$_updateParentShownChildren(e){let t=this.parentPopper;for(;t;)e?t.shownChildren.add(this.randomId):(t.shownChildren.delete(this.randomId),t.pendingHide&&t.hide()),t=t.parentPopper},$_isAimingPopper(){const e=this.$_referenceNode.getBoundingClientRect();if(as>=e.left&&as<=e.right&&cs>=e.top&&cs<=e.bottom){const t=this.$_popperNode.getBoundingClientRect(),n=as-ln,s=cs-an,o=t.left+t.width/2-ln+(t.top+t.height/2)-an+t.width+t.height,i=ln+n*o,r=an+s*o;return Rs(ln,an,i,r,t.left,t.top,t.left,t.bottom)||Rs(ln,an,i,r,t.left,t.top,t.right,t.top)||Rs(ln,an,i,r,t.right,t.top,t.right,t.bottom)||Rs(ln,an,i,r,t.left,t.bottom,t.right,t.bottom)}return!1}},render(){return this.$slots.default(this.slotData)}});if(typeof document<"u"&&typeof window<"u"){if(Ua){const e=Hn?{passive:!0,capture:!0}:!0;document.addEventListener("touchstart",t=>Ur(t,!0),e),document.addEventListener("touchend",t=>Kr(t,!0),e)}else window.addEventListener("mousedown",e=>Ur(e,!1),!0),window.addEventListener("click",e=>Kr(e,!1),!0);window.addEventListener("resize",Sf)}function Ur(e,t){if(Et.autoHideOnMousedown)qa(e,t);else for(let n=0;n<St.length;n++){const s=St[n];try{s.mouseDownContains=s.popperNode().contains(e.target)}catch{}}}function Kr(e,t){Et.autoHideOnMousedown||qa(e,t)}function qa(e,t){const n={};for(let s=St.length-1;s>=0;s--){const o=St[s];try{const i=o.containsGlobalTarget=o.mouseDownContains||o.popperNode().contains(e.target);o.pendingHide=!1,requestAnimationFrame(()=>{if(o.pendingHide=!1,!n[o.randomId]&&Wr(o,i,e)){if(o.$_handleGlobalClose(e,t),!e.closeAllPopover&&e.closePopover&&i){let l=o.parentPopper;for(;l;)n[l.randomId]=!0,l=l.parentPopper;return}let r=o.parentPopper;for(;r&&Wr(r,r.containsGlobalTarget,e);)r.$_handleGlobalClose(e,t),r=r.parentPopper}})}catch{}}}function Wr(e,t,n){return n.closeAllPopover||n.closePopover&&t||$f(e,n)&&!t}function $f(e,t){if(typeof e.autoHide=="function"){const n=e.autoHide(t);return e.lastAutoHide=n,n}return e.autoHide}function Sf(){for(let e=0;e<St.length;e++)St[e].$_computePosition()}let ln=0,an=0,as=0,cs=0;typeof window<"u"&&window.addEventListener("mousemove",e=>{ln=as,an=cs,as=e.clientX,cs=e.clientY},Hn?{passive:!0}:void 0);function Rs(e,t,n,s,o,i,r,l){const c=((r-o)*(t-i)-(l-i)*(e-o))/((l-i)*(n-e)-(r-o)*(s-t)),p=((n-e)*(t-i)-(s-t)*(e-o))/((l-i)*(n-e)-(r-o)*(s-t));return c>=0&&c<=1&&p>=0&&p<=1}const Tf={extends:Wa()},wo=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n};function Cf(e,t,n,s,o,i){return y(),b("div",{ref:"reference",class:he(["v-popper",{"v-popper--shown":e.slotData.isShown}])},[vs(e.$slots,"default",bc(ya(e.slotData)))],2)}const Mf=wo(Tf,[["render",Cf]]);function Ef(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);var n=e.indexOf("Trident/");if(n>0){var s=e.indexOf("rv:");return parseInt(e.substring(s+3,e.indexOf(".",s)),10)}var o=e.indexOf("Edge/");return o>0?parseInt(e.substring(o+5,e.indexOf(".",o)),10):-1}let zs;function ai(){ai.init||(ai.init=!0,zs=Ef()!==-1)}var ko={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){ai(),Ke(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",zs&&this.$el.appendChild(e),e.data="about:blank",zs||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!zs&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const Pf=ru();ou("data-v-b329ee4c");const If={class:"resize-observer",tabindex:"-1"};iu();const Af=Pf((e,t,n,s,o,i)=>(y(),ft("div",If)));ko.render=Af;ko.__scopeId="data-v-b329ee4c";ko.__file="src/components/ResizeObserver.vue";const Ga=(e="theme")=>({computed:{themeClass(){return xf(this[e])}}}),Lf=et({name:"VPopperContent",components:{ResizeObserver:ko},mixins:[Ga()],props:{popperId:String,theme:String,shown:Boolean,mounted:Boolean,skipTransition:Boolean,autoHide:Boolean,handleResize:Boolean,classes:Object,result:Object},emits:["hide","resize"],methods:{toPx(e){return e!=null&&!isNaN(e)?`${e}px`:null}}}),Of=["id","aria-hidden","tabindex","data-popper-placement"],Rf={ref:"inner",class:"v-popper__inner"},Df=u("div",{class:"v-popper__arrow-outer"},null,-1),Nf=u("div",{class:"v-popper__arrow-inner"},null,-1),Ff=[Df,Nf];function zf(e,t,n,s,o,i){const r=hs("ResizeObserver");return y(),b("div",{id:e.popperId,ref:"popover",class:he(["v-popper__popper",[e.themeClass,e.classes.popperClass,{"v-popper__popper--shown":e.shown,"v-popper__popper--hidden":!e.shown,"v-popper__popper--show-from":e.classes.showFrom,"v-popper__popper--show-to":e.classes.showTo,"v-popper__popper--hide-from":e.classes.hideFrom,"v-popper__popper--hide-to":e.classes.hideTo,"v-popper__popper--skip-transition":e.skipTransition,"v-popper__popper--arrow-overflow":e.result&&e.result.arrow.overflow,"v-popper__popper--no-positioning":!e.result}]]),style:Me(e.result?{position:e.result.strategy,transform:`translate3d(${Math.round(e.result.x)}px,${Math.round(e.result.y)}px,0)`}:void 0),"aria-hidden":e.shown?"false":"true",tabindex:e.autoHide?0:void 0,"data-popper-placement":e.result?e.result.placement:void 0,onKeyup:t[2]||(t[2]=Ta(l=>e.autoHide&&e.$emit("hide"),["esc"]))},[u("div",{class:"v-popper__backdrop",onClick:t[0]||(t[0]=l=>e.autoHide&&e.$emit("hide"))}),u("div",{class:"v-popper__wrapper",style:Me(e.result?{transformOrigin:e.result.transformOrigin}:void 0)},[u("div",Rf,[e.mounted?(y(),b(ve,{key:0},[u("div",null,[vs(e.$slots,"default")]),e.handleResize?(y(),ft(r,{key:0,onNotify:t[1]||(t[1]=l=>e.$emit("resize",l))})):le("",!0)],64)):le("",!0)],512),u("div",{ref:"arrow",class:"v-popper__arrow-container",style:Me(e.result?{left:e.toPx(e.result.arrow.x),top:e.toPx(e.result.arrow.y)}:void 0)},Ff,4)],4)],46,Of)}const Ja=wo(Lf,[["render",zf]]),Ya={methods:{show(...e){return this.$refs.popper.show(...e)},hide(...e){return this.$refs.popper.hide(...e)},dispose(...e){return this.$refs.popper.dispose(...e)},onResize(...e){return this.$refs.popper.onResize(...e)}}};let ci=function(){};typeof window<"u"&&(ci=window.Element);const Bf=et({name:"VPopperWrapper",components:{Popper:Mf,PopperContent:Ja},mixins:[Ya,Ga("finalTheme")],props:{theme:{type:String,default:null},referenceNode:{type:Function,default:null},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:void 0},positioningDisabled:{type:Boolean,default:void 0},placement:{type:String,default:void 0},delay:{type:[String,Number,Object],default:void 0},distance:{type:[Number,String],default:void 0},skidding:{type:[Number,String],default:void 0},triggers:{type:Array,default:void 0},showTriggers:{type:[Array,Function],default:void 0},hideTriggers:{type:[Array,Function],default:void 0},popperTriggers:{type:Array,default:void 0},popperShowTriggers:{type:[Array,Function],default:void 0},popperHideTriggers:{type:[Array,Function],default:void 0},container:{type:[String,Object,ci,Boolean],default:void 0},boundary:{type:[String,ci],default:void 0},strategy:{type:String,default:void 0},autoHide:{type:[Boolean,Function],default:void 0},handleResize:{type:Boolean,default:void 0},instantMove:{type:Boolean,default:void 0},eagerMount:{type:Boolean,default:void 0},popperClass:{type:[String,Array,Object],default:void 0},computeTransformOrigin:{type:Boolean,default:void 0},autoMinSize:{type:Boolean,default:void 0},autoSize:{type:[Boolean,String],default:void 0},autoMaxSize:{type:Boolean,default:void 0},autoBoundaryMaxSize:{type:Boolean,default:void 0},preventOverflow:{type:Boolean,default:void 0},overflowPadding:{type:[Number,String],default:void 0},arrowPadding:{type:[Number,String],default:void 0},arrowOverflow:{type:Boolean,default:void 0},flip:{type:Boolean,default:void 0},shift:{type:Boolean,default:void 0},shiftCrossAxis:{type:Boolean,default:void 0},noAutoFocus:{type:Boolean,default:void 0},disposeTimeout:{type:Number,default:void 0}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},computed:{finalTheme(){return this.theme??this.$options.vPopperTheme}},methods:{getTargetNodes(){return Array.from(this.$el.children).filter(e=>e!==this.$refs.popperContent.$el)}}});function Hf(e,t,n,s,o,i){const r=hs("PopperContent"),l=hs("Popper");return y(),ft(l,Oi({ref:"popper"},e.$props,{theme:e.finalTheme,"target-nodes":e.getTargetNodes,"popper-node":()=>e.$refs.popperContent.$el,class:[e.themeClass],onShow:t[0]||(t[0]=()=>e.$emit("show")),onHide:t[1]||(t[1]=()=>e.$emit("hide")),"onUpdate:shown":t[2]||(t[2]=c=>e.$emit("update:shown",c)),onApplyShow:t[3]||(t[3]=()=>e.$emit("apply-show")),onApplyHide:t[4]||(t[4]=()=>e.$emit("apply-hide")),onCloseGroup:t[5]||(t[5]=()=>e.$emit("close-group")),onCloseDirective:t[6]||(t[6]=()=>e.$emit("close-directive")),onAutoHide:t[7]||(t[7]=()=>e.$emit("auto-hide")),onResize:t[8]||(t[8]=()=>e.$emit("resize"))}),{default:pt(({popperId:c,isShown:p,shouldMountContent:d,skipTransition:m,autoHide:v,show:w,hide:I,handleResize:S,onResize:_,classes:T,result:z})=>[vs(e.$slots,"default",{shown:p,show:w,hide:I}),Re(r,{ref:"popperContent","popper-id":c,theme:e.finalTheme,shown:p,mounted:d,"skip-transition":m,"auto-hide":v,"handle-resize":S,classes:T,result:z,onHide:I,onResize:_},{default:pt(()=>[vs(e.$slots,"popper",{shown:p,hide:I})]),_:2},1032,["popper-id","theme","shown","mounted","skip-transition","auto-hide","handle-resize","classes","result","onHide","onResize"])]),_:3},16,["theme","target-nodes","popper-node","class"])}const zi=wo(Bf,[["render",Hf]]),jf={...zi,name:"VDropdown",vPopperTheme:"dropdown"},Vf={...zi,name:"VMenu",vPopperTheme:"menu"},Uf={...zi,name:"VTooltip",vPopperTheme:"tooltip"},Kf=et({name:"VTooltipDirective",components:{Popper:Wa(),PopperContent:Ja},mixins:[Ya],inheritAttrs:!1,props:{theme:{type:String,default:"tooltip"},html:{type:Boolean,default:e=>xs(e.theme,"html")},content:{type:[String,Number,Function],default:null},loadingContent:{type:String,default:e=>xs(e.theme,"loadingContent")},targetNodes:{type:Function,required:!0}},data(){return{asyncContent:null}},computed:{isContentAsync(){return typeof this.content=="function"},loading(){return this.isContentAsync&&this.asyncContent==null},finalContent(){return this.isContentAsync?this.loading?this.loadingContent:this.asyncContent:this.content}},watch:{content:{handler(){this.fetchContent(!0)},immediate:!0},async finalContent(){await this.$nextTick(),this.$refs.popper.onResize()}},created(){this.$_fetchId=0},methods:{fetchContent(e){if(typeof this.content=="function"&&this.$_isShown&&(e||!this.$_loading&&this.asyncContent==null)){this.asyncContent=null,this.$_loading=!0;const t=++this.$_fetchId,n=this.content(this);n.then?n.then(s=>this.onResult(t,s)):this.onResult(t,n)}},onResult(e,t){e===this.$_fetchId&&(this.$_loading=!1,this.asyncContent=t)},onShow(){this.$_isShown=!0,this.fetchContent()},onHide(){this.$_isShown=!1}}}),Wf=["innerHTML"],qf=["textContent"];function Gf(e,t,n,s,o,i){const r=hs("PopperContent"),l=hs("Popper");return y(),ft(l,Oi({ref:"popper"},e.$attrs,{theme:e.theme,"target-nodes":e.targetNodes,"popper-node":()=>e.$refs.popperContent.$el,onApplyShow:e.onShow,onApplyHide:e.onHide}),{default:pt(({popperId:c,isShown:p,shouldMountContent:d,skipTransition:m,autoHide:v,hide:w,handleResize:I,onResize:S,classes:_,result:T})=>[Re(r,{ref:"popperContent",class:he({"v-popper--tooltip-loading":e.loading}),"popper-id":c,theme:e.theme,shown:p,mounted:d,"skip-transition":m,"auto-hide":v,"handle-resize":I,classes:_,result:T,onHide:w,onResize:S},{default:pt(()=>[e.html?(y(),b("div",{key:0,innerHTML:e.finalContent},null,8,Wf)):(y(),b("div",{key:1,textContent:M(e.finalContent)},null,8,qf))]),_:2},1032,["class","popper-id","theme","shown","mounted","skip-transition","auto-hide","handle-resize","classes","result","onHide","onResize"])]),_:1},16,["theme","target-nodes","popper-node","onApplyShow","onApplyHide"])}const Jf=wo(Kf,[["render",Gf]]),Xa="v-popper--has-tooltip";function Yf(e,t){let n=e.placement;if(!n&&t)for(const s of Ka)t[s]&&(n=s);return n||(n=xs(e.theme||"tooltip","placement")),n}function Za(e,t,n){let s;const o=typeof t;return o==="string"?s={content:t}:t&&o==="object"?s=t:s={content:!1},s.placement=Yf(s,n),s.targetNodes=()=>[e],s.referenceNode=()=>e,s}let Bo,$s,Xf=0;function Zf(){if(Bo)return;$s=me([]),Bo=Ca({name:"VTooltipDirectiveApp",setup(){return{directives:$s}},render(){return this.directives.map(t=>Ri(Jf,{...t.options,shown:t.shown||t.options.shown,key:t.id}))},devtools:{hide:!0}});const e=document.createElement("div");document.body.appendChild(e),Bo.mount(e)}function Qf(e,t,n){Zf();const s=me(Za(e,t,n)),o=me(!1),i={id:Xf++,options:s,shown:o};return $s.value.push(i),e.classList&&e.classList.add(Xa),e.$_popper={options:s,item:i,show(){o.value=!0},hide(){o.value=!1}}}function Qa(e){if(e.$_popper){const t=$s.value.indexOf(e.$_popper.item);t!==-1&&$s.value.splice(t,1),delete e.$_popper,delete e.$_popperOldShown,delete e.$_popperMountTarget}e.classList&&e.classList.remove(Xa)}function qr(e,{value:t,modifiers:n}){const s=Za(e,t,n);if(!s.content||xs(s.theme||"tooltip","disabled"))Qa(e);else{let o;e.$_popper?(o=e.$_popper,o.options.value=s):o=Qf(e,t,n),typeof t.shown<"u"&&t.shown!==e.$_popperOldShown&&(e.$_popperOldShown=t.shown,t.shown?o.show():o.hide())}}const ep={beforeMount:qr,updated:qr,beforeUnmount(e){Qa(e)}};function Gr(e){e.addEventListener("mousedown",Qs),e.addEventListener("click",Qs),e.addEventListener("touchstart",ec,Hn?{passive:!0}:!1)}function Jr(e){e.removeEventListener("mousedown",Qs),e.removeEventListener("click",Qs),e.removeEventListener("touchstart",ec),e.removeEventListener("touchend",tc),e.removeEventListener("touchcancel",nc)}function Qs(e){const t=e.currentTarget;e.closePopover=!t.$_vclosepopover_touch,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}function ec(e){if(e.changedTouches.length===1){const t=e.currentTarget;t.$_vclosepopover_touch=!0;const n=e.changedTouches[0];t.$_vclosepopover_touchPoint=n,t.addEventListener("touchend",tc),t.addEventListener("touchcancel",nc)}}function tc(e){const t=e.currentTarget;if(t.$_vclosepopover_touch=!1,e.changedTouches.length===1){const n=e.changedTouches[0],s=t.$_vclosepopover_touchPoint;e.closePopover=Math.abs(n.screenY-s.screenY)<20&&Math.abs(n.screenX-s.screenX)<20,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}}function nc(e){const t=e.currentTarget;t.$_vclosepopover_touch=!1}const tp={beforeMount(e,{value:t,modifiers:n}){e.$_closePopoverModifiers=n,(typeof t>"u"||t)&&Gr(e)},updated(e,{value:t,oldValue:n,modifiers:s}){e.$_closePopoverModifiers=s,t!==n&&(typeof t>"u"||t?Gr(e):Jr(e))},beforeUnmount(e){Jr(e)}};function np(e,t={}){e.$_vTooltipInstalled||(e.$_vTooltipInstalled=!0,Va(Et,t),e.directive("tooltip",ep),e.directive("close-popper",tp),e.component("VTooltip",Uf),e.component("VDropdown",jf),e.component("VMenu",Vf))}const sp={version:"5.2.2",install:np,options:Et},Vn="";async function op(){const e=await fetch(`${Vn}/api/requests?summary=true`);if(!e.ok)throw new Error(`GET /api/requests?summary=true failed: ${e.status}`);return e.json()}async function ip(e){const t=await fetch(`${Vn}/api/conversations/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`GET /api/conversations/${e} failed: ${t.status}`);return t.json()}async function rp(e){const t=await fetch(`${Vn}/api/entries/${e}/detail`);if(t.status===404)return null;if(!t.ok)throw new Error(`GET /api/entries/${e}/detail failed: ${t.status}`);return(await t.json()).contextInfo??null}async function lp(e){const t=await fetch(`${Vn}/api/conversations/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`DELETE conversation failed: ${t.status}`)}async function ap(){const e=await fetch(`${Vn}/api/reset`,{method:"POST"});if(!e.ok)throw new Error(`POST /api/reset failed: ${e.status}`)}function cp(e,t,n){const s=new URLSearchParams;t&&s.set("conversation",t);const o=s.toString();return`${Vn}/api/export/${e}${o?`?${o}`:""}`}const Xe={system_prompt:{label:"System prompt",color:"#2563eb"},tool_definitions:{label:"Tool definitions",color:"#db2777"},tool_results:{label:"Tool results",color:"#059669"},tool_calls:{label:"Tool calls",color:"#ec4899"},assistant_text:{label:"Assistant text",color:"#d97706"},user_text:{label:"User text",color:"#10b981"},thinking:{label:"Thinking",color:"#8b5cf6"},system_injections:{label:"System injections",color:"#6366f1"},images:{label:"Images",color:"#4b5563"},cache_markers:{label:"Cache markers",color:"#6b7280"},other:{label:"Other",color:"#4b5563"}};function up(e){var t;return((t=Xe[e])==null?void 0:t.label)??e}function dp(e,t="#475569"){var n;return((n=Xe[e])==null?void 0:n.color)??t}const jn={system:["system_prompt","system_injections"],tools:["tool_definitions","tool_calls","tool_results"],conversation:["assistant_text","user_text","thinking"],other:["images","cache_markers","other"]},gt={system:{label:"System",color:"#2563eb"},tools:{label:"Tools",color:"#db2777"},conversation:{label:"Conversation",color:"#d97706"},other:{label:"Other",color:"#4b5563"}};function Tt(e){const t=e.role||"user",n=e.content||"",s=e.contentBlocks;if(s&&Array.isArray(s)){const o=s.some(l=>l.type==="tool_use"),i=s.some(l=>l.type==="tool_result"),r=s.some(l=>l.type==="thinking");if(i)return"tool_results";if(o)return"tool_calls";if(r)return"thinking"}return typeof n=="string"&&n.includes("<system-reminder>")?"system_injections":t==="assistant"?"assistant_text":t==="user"?"user_text":"other"}function xo(e){const t={};for(const n of e)if(n.contentBlocks)for(const s of n.contentBlocks)s.type==="tool_use"&&s.id&&s.name&&(t[s.id]=s.name);return t}function Ho(e,t={}){const n=e.contentBlocks;if(n&&Array.isArray(n))for(const s of n){if(s.type==="tool_use")return(s.name||"tool")+"("+(s.input?JSON.stringify(s.input).slice(0,60):"")+")";if(s.type==="tool_result"){const i=s.tool_use_id?t[s.tool_use_id]:null,r=typeof s.content=="string"?s.content:JSON.stringify(s.content||""),l=i?i+": ":"";return l+r.slice(0,80-l.length)}const o=s;if(o.type==="thinking")return(o.thinking||o.text||"").slice(0,80);if(s.type==="text"||s.type==="input_text")return(s.text||"").slice(0,80)}return(e.content||"").slice(0,80)}function fp(e){return e.contentBlocks&&e.contentBlocks.length>0?e.contentBlocks.map(t=>{if(t.type==="tool_use")return t.name+"("+JSON.stringify(t.input,null,2)+")";if(t.type==="tool_result")return typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);const n=t;return n.type==="thinking"?n.thinking||n.text||"":t.type==="text"||t.type==="input_text"?t.text||"":JSON.stringify(t,null,2)}).join(`
22
+ */let Ma;const yo=e=>Ma=e,Ea=Symbol();function si(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var is;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(is||(is={}));function Ud(){const e=bl(!0),t=e.run(()=>me({}));let n=[],s=[];const o=Ti({install(i){yo(o),o._a=i,i.provide(Ea,o),i.config.globalProperties.$pinia=o,s.forEach(r=>n.push(r)),s=[]},use(i){return this._a?n.push(i):s.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}const Pa=()=>{};function Tr(e,t,n,s=Pa){e.push(t);const o=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),s())};return!n&&wl()&&$c(o),o}function An(e,...t){e.slice().forEach(n=>{n(...t)})}const Kd=e=>e(),Cr=Symbol(),No=Symbol();function oi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,s)=>e.set(s,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const s=t[n],o=e[n];si(o)&&si(s)&&e.hasOwnProperty(n)&&!Ge(s)&&!Yt(s)?e[n]=oi(o,s):e[n]=s}return e}const Wd=Symbol();function qd(e){return!si(e)||!e.hasOwnProperty(Wd)}const{assign:rn}=Object;function Gd(e){return!!(Ge(e)&&e.effect)}function Jd(e,t,n,s){const{state:o,actions:i,getters:r}=t,l=n.state.value[e];let c;function p(){l||(n.state.value[e]=o?o():{});const d=Gc(n.state.value[e]);return rn(d,i,Object.keys(r||{}).reduce((m,v)=>(m[v]=Ti(A(()=>{yo(n);const w=n._s.get(e);return r[v].call(w,w)})),m),{}))}return c=Ia(e,p,t,n,s,!0),c}function Ia(e,t,n={},s,o,i){let r;const l=rn({actions:{}},n),c={deep:!0};let p,d,m=[],v=[],w;const I=s.state.value[e];!i&&!I&&(s.state.value[e]={});let S;function _(ue){let O;p=d=!1,typeof ue=="function"?(ue(s.state.value[e]),O={type:is.patchFunction,storeId:e,events:w}):(oi(s.state.value[e],ue),O={type:is.patchObject,payload:ue,storeId:e,events:w});const R=S=Symbol();Ke().then(()=>{S===R&&(p=!0)}),d=!0,An(m,O,s.state.value[e])}const T=i?function(){const{state:O}=n,R=O?O():{};this.$patch(de=>{rn(de,R)})}:Pa;function z(){r.stop(),m=[],v=[],s._s.delete(e)}const K=(ue,O="")=>{if(Cr in ue)return ue[No]=O,ue;const R=function(){yo(s);const de=Array.from(arguments),F=[],te=[];function ce(oe){F.push(oe)}function B(oe){te.push(oe)}An(v,{args:de,name:R[No],store:Q,after:ce,onError:B});let se;try{se=ue.apply(this&&this.$id===e?this:Q,de)}catch(oe){throw An(te,oe),oe}return se instanceof Promise?se.then(oe=>(An(F,oe),oe)).catch(oe=>(An(te,oe),Promise.reject(oe))):(An(F,se),se)};return R[Cr]=!0,R[No]=O,R},V={_p:s,$id:e,$onAction:Tr.bind(null,v),$patch:_,$reset:T,$subscribe(ue,O={}){const R=Tr(m,ue,O.detached,()=>de()),de=r.run(()=>We(()=>s.state.value[e],F=>{(O.flush==="sync"?d:p)&&ue({storeId:e,type:is.direct,events:w},F)},rn({},c,O)));return R},$dispose:z},Q=Cs(V);s._s.set(e,Q);const ae=(s._a&&s._a.runWithContext||Kd)(()=>s._e.run(()=>(r=bl()).run(()=>t({action:K}))));for(const ue in ae){const O=ae[ue];if(Ge(O)&&!Gd(O)||Yt(O))i||(I&&qd(O)&&(Ge(O)?O.value=I[ue]:oi(O,I[ue])),s.state.value[e][ue]=O);else if(typeof O=="function"){const R=K(O,ue);ae[ue]=R,l.actions[ue]=O}}return rn(Q,ae),rn(Oe(Q),ae),Object.defineProperty(Q,"$state",{get:()=>s.state.value[e],set:ue=>{_(O=>{rn(O,ue)})}}),s._p.forEach(ue=>{rn(Q,r.run(()=>ue({store:Q,app:s._a,pinia:s,options:l})))}),I&&i&&n.hydrate&&n.hydrate(Q.$state,I),p=!0,d=!0,Q}/*! #__NO_SIDE_EFFECTS__ */function Yd(e,t,n){let s,o;const i=typeof t=="function";s=e,o=i?n:t;function r(l,c){const p=lu();return l=l||(p?$t(Ea,null):null),l&&yo(l),l=Ma,l._s.has(s)||(i?Ia(s,t,o,l):Jd(s,o,l)),l._s.get(s)}return r.$id=s,r}const Xd=["top","right","bottom","left"],Mr=["start","end"],Er=Xd.reduce((e,t)=>e.concat(t,t+"-"+Mr[0],t+"-"+Mr[1]),[]),bs=Math.min,Sn=Math.max,Zd={left:"right",right:"left",bottom:"top",top:"bottom"},Qd={start:"end",end:"start"};function ii(e,t,n){return Sn(e,bs(t,n))}function Pn(e,t){return typeof e=="function"?e(t):e}function Ht(e){return e.split("-")[0]}function Mt(e){return e.split("-")[1]}function Aa(e){return e==="x"?"y":"x"}function Di(e){return e==="y"?"height":"width"}const ef=new Set(["top","bottom"]);function Jt(e){return ef.has(Ht(e))?"y":"x"}function Ni(e){return Aa(Jt(e))}function La(e,t,n){n===void 0&&(n=!1);const s=Mt(e),o=Ni(e),i=Di(o);let r=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=Ys(r)),[r,Ys(r)]}function tf(e){const t=Ys(e);return[Js(e),t,Js(t)]}function Js(e){return e.replace(/start|end/g,t=>Qd[t])}const Pr=["left","right"],Ir=["right","left"],nf=["top","bottom"],sf=["bottom","top"];function of(e,t,n){switch(e){case"top":case"bottom":return n?t?Ir:Pr:t?Pr:Ir;case"left":case"right":return t?nf:sf;default:return[]}}function rf(e,t,n,s){const o=Mt(e);let i=of(Ht(e),n==="start",s);return o&&(i=i.map(r=>r+"-"+o),t&&(i=i.concat(i.map(Js)))),i}function Ys(e){return e.replace(/left|right|bottom|top/g,t=>Zd[t])}function lf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Oa(e){return typeof e!="number"?lf(e):{top:e,right:e,bottom:e,left:e}}function rs(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Ar(e,t,n){let{reference:s,floating:o}=e;const i=Jt(t),r=Ni(t),l=Di(r),c=Ht(t),p=i==="y",d=s.x+s.width/2-o.width/2,m=s.y+s.height/2-o.height/2,v=s[l]/2-o[l]/2;let w;switch(c){case"top":w={x:d,y:s.y-o.height};break;case"bottom":w={x:d,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:m};break;case"left":w={x:s.x-o.width,y:m};break;default:w={x:s.x,y:s.y}}switch(Mt(t)){case"start":w[r]-=v*(n&&p?-1:1);break;case"end":w[r]+=v*(n&&p?-1:1);break}return w}async function af(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:r,elements:l,strategy:c}=e,{boundary:p="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:v=!1,padding:w=0}=Pn(t,e),I=Oa(w),_=l[v?m==="floating"?"reference":"floating":m],T=rs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(_)))==null||n?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:p,rootBoundary:d,strategy:c})),z=m==="floating"?{x:s,y:o,width:r.floating.width,height:r.floating.height}:r.reference,K=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),V=await(i.isElement==null?void 0:i.isElement(K))?await(i.getScale==null?void 0:i.getScale(K))||{x:1,y:1}:{x:1,y:1},Q=rs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:z,offsetParent:K,strategy:c}):z);return{top:(T.top-Q.top+I.top)/V.y,bottom:(Q.bottom-T.bottom+I.bottom)/V.y,left:(T.left-Q.left+I.left)/V.x,right:(Q.right-T.right+I.right)/V.x}}const cf=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:r}=n,l=i.filter(Boolean),c=await(r.isRTL==null?void 0:r.isRTL(t));let p=await r.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:m}=Ar(p,s,c),v=s,w={},I=0;for(let _=0;_<l.length;_++){var S;const{name:T,fn:z}=l[_],{x:K,y:V,data:Q,reset:D}=await z({x:d,y:m,initialPlacement:s,placement:v,strategy:o,middlewareData:w,rects:p,platform:{...r,detectOverflow:(S=r.detectOverflow)!=null?S:af},elements:{reference:e,floating:t}});d=K??d,m=V??m,w={...w,[T]:{...w[T],...Q}},D&&I<=50&&(I++,typeof D=="object"&&(D.placement&&(v=D.placement),D.rects&&(p=D.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:o}):D.rects),{x:d,y:m}=Ar(p,v,c)),_=-1)}return{x:d,y:m,placement:v,strategy:o,middlewareData:w}},uf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:r,elements:l,middlewareData:c}=t,{element:p,padding:d=0}=Pn(e,t)||{};if(p==null)return{};const m=Oa(d),v={x:n,y:s},w=Ni(o),I=Di(w),S=await r.getDimensions(p),_=w==="y",T=_?"top":"left",z=_?"bottom":"right",K=_?"clientHeight":"clientWidth",V=i.reference[I]+i.reference[w]-v[w]-i.floating[I],Q=v[w]-i.reference[w],D=await(r.getOffsetParent==null?void 0:r.getOffsetParent(p));let ae=D?D[K]:0;(!ae||!await(r.isElement==null?void 0:r.isElement(D)))&&(ae=l.floating[K]||i.floating[I]);const ue=V/2-Q/2,O=ae/2-S[I]/2-1,R=bs(m[T],O),de=bs(m[z],O),F=R,te=ae-S[I]-de,ce=ae/2-S[I]/2+ue,B=ii(F,ce,te),se=!c.arrow&&Mt(o)!=null&&ce!==B&&i.reference[I]/2-(ce<F?R:de)-S[I]/2<0,oe=se?ce<F?ce-F:ce-te:0;return{[w]:v[w]+oe,data:{[w]:B,centerOffset:ce-B-oe,...se&&{alignmentOffset:oe}},reset:se}}});function df(e,t,n){return(e?[...n.filter(o=>Mt(o)===e),...n.filter(o=>Mt(o)!==e)]:n.filter(o=>Ht(o)===o)).filter(o=>e?Mt(o)===e||(t?Js(o)!==o:!1):!0)}const ff=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,o;const{rects:i,middlewareData:r,placement:l,platform:c,elements:p}=t,{crossAxis:d=!1,alignment:m,allowedPlacements:v=Er,autoAlignment:w=!0,...I}=Pn(e,t),S=m!==void 0||v===Er?df(m||null,w,v):v,_=await c.detectOverflow(t,I),T=((n=r.autoPlacement)==null?void 0:n.index)||0,z=S[T];if(z==null)return{};const K=La(z,i,await(c.isRTL==null?void 0:c.isRTL(p.floating)));if(l!==z)return{reset:{placement:S[0]}};const V=[_[Ht(z)],_[K[0]],_[K[1]]],Q=[...((s=r.autoPlacement)==null?void 0:s.overflows)||[],{placement:z,overflows:V}],D=S[T+1];if(D)return{data:{index:T+1,overflows:Q},reset:{placement:D}};const ae=Q.map(R=>{const de=Mt(R.placement);return[R.placement,de&&d?R.overflows.slice(0,2).reduce((F,te)=>F+te,0):R.overflows[0],R.overflows]}).sort((R,de)=>R[1]-de[1]),O=((o=ae.filter(R=>R[2].slice(0,Mt(R[0])?2:3).every(de=>de<=0))[0])==null?void 0:o[0])||ae[0][0];return O!==l?{data:{index:T+1,overflows:Q},reset:{placement:O}}:{}}}},pf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:r,initialPlacement:l,platform:c,elements:p}=t,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:I="none",flipAlignment:S=!0,..._}=Pn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const T=Ht(o),z=Jt(l),K=Ht(l)===l,V=await(c.isRTL==null?void 0:c.isRTL(p.floating)),Q=v||(K||!S?[Ys(l)]:tf(l)),D=I!=="none";!v&&D&&Q.push(...rf(l,S,I,V));const ae=[l,...Q],ue=await c.detectOverflow(t,_),O=[];let R=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&O.push(ue[T]),m){const ce=La(o,r,V);O.push(ue[ce[0]],ue[ce[1]])}if(R=[...R,{placement:o,overflows:O}],!O.every(ce=>ce<=0)){var de,F;const ce=(((de=i.flip)==null?void 0:de.index)||0)+1,B=ae[ce];if(B&&(!(m==="alignment"?z!==Jt(B):!1)||R.every(W=>Jt(W.placement)===z?W.overflows[0]>0:!0)))return{data:{index:ce,overflows:R},reset:{placement:B}};let se=(F=R.filter(oe=>oe.overflows[0]<=0).sort((oe,W)=>oe.overflows[1]-W.overflows[1])[0])==null?void 0:F.placement;if(!se)switch(w){case"bestFit":{var te;const oe=(te=R.filter(W=>{if(D){const re=Jt(W.placement);return re===z||re==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(re=>re>0).reduce((re,we)=>re+we,0)]).sort((W,re)=>W[1]-re[1])[0])==null?void 0:te[0];oe&&(se=oe);break}case"initialPlacement":se=l;break}if(o!==se)return{reset:{placement:se}}}return{}}}},hf=new Set(["left","top"]);async function vf(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),r=Ht(n),l=Mt(n),c=Jt(n)==="y",p=hf.has(r)?-1:1,d=i&&c?-1:1,m=Pn(t,e);let{mainAxis:v,crossAxis:w,alignmentAxis:I}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof I=="number"&&(w=l==="end"?I*-1:I),c?{x:w*d,y:v*p}:{x:v*p,y:w*d}}const mf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:r,middlewareData:l}=t,c=await vf(t,e);return r===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:r}}}}},gf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:c={fn:T=>{let{x:z,y:K}=T;return{x:z,y:K}}},...p}=Pn(e,t),d={x:n,y:s},m=await i.detectOverflow(t,p),v=Jt(Ht(o)),w=Aa(v);let I=d[w],S=d[v];if(r){const T=w==="y"?"top":"left",z=w==="y"?"bottom":"right",K=I+m[T],V=I-m[z];I=ii(K,I,V)}if(l){const T=v==="y"?"top":"left",z=v==="y"?"bottom":"right",K=S+m[T],V=S-m[z];S=ii(K,S,V)}const _=c.fn({...t,[w]:I,[v]:S});return{..._,data:{x:_.x-n,y:_.y-s,enabled:{[w]:r,[v]:l}}}}}},yf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:r,elements:l}=t,{apply:c=()=>{},...p}=Pn(e,t),d=await r.detectOverflow(t,p),m=Ht(o),v=Mt(o),w=Jt(o)==="y",{width:I,height:S}=i.floating;let _,T;m==="top"||m==="bottom"?(_=m,T=v===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(T=m,_=v==="end"?"top":"bottom");const z=S-d.top-d.bottom,K=I-d.left-d.right,V=bs(S-d[_],z),Q=bs(I-d[T],K),D=!t.middlewareData.shift;let ae=V,ue=Q;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(ue=K),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(ae=z),D&&!v){const R=Sn(d.left,0),de=Sn(d.right,0),F=Sn(d.top,0),te=Sn(d.bottom,0);w?ue=I-2*(R!==0||de!==0?R+de:Sn(d.left,d.right)):ae=S-2*(F!==0||te!==0?F+te:Sn(d.top,d.bottom))}await c({...t,availableWidth:ue,availableHeight:ae});const O=await r.getDimensions(l.floating);return I!==O.width||S!==O.height?{reset:{rects:!0}}:{}}}};function kt(e){var t;return((t=e.ownerDocument)==null?void 0:t.defaultView)||window}function zt(e){return kt(e).getComputedStyle(e)}const Lr=Math.min,ls=Math.max,Xs=Math.round;function Ra(e){const t=zt(e);let n=parseFloat(t.width),s=parseFloat(t.height);const o=e.offsetWidth,i=e.offsetHeight,r=Xs(n)!==o||Xs(s)!==i;return r&&(n=o,s=i),{width:n,height:s,fallback:r}}function mn(e){return Na(e)?(e.nodeName||"").toLowerCase():""}let Os;function Da(){if(Os)return Os;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Os=e.brands.map((t=>t.brand+"/"+t.version)).join(" "),Os):navigator.userAgent}function Bt(e){return e instanceof kt(e).HTMLElement}function pn(e){return e instanceof kt(e).Element}function Na(e){return e instanceof kt(e).Node}function Or(e){return typeof ShadowRoot>"u"?!1:e instanceof kt(e).ShadowRoot||e instanceof ShadowRoot}function _o(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(o)}function _f(e){return["table","td","th"].includes(mn(e))}function ri(e){const t=/firefox/i.test(Da()),n=zt(e),s=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!=="none"||n.perspective!=="none"||!!s&&s!=="none"||t&&n.willChange==="filter"||t&&!!n.filter&&n.filter!=="none"||["transform","perspective"].some((o=>n.willChange.includes(o)))||["paint","layout","strict","content"].some((o=>{const i=n.contain;return i!=null&&i.includes(o)}))}function Fa(){return!/^((?!chrome|android).)*safari/i.test(Da())}function Fi(e){return["html","body","#document"].includes(mn(e))}function za(e){return pn(e)?e:e.contextElement}const Ba={x:1,y:1};function Fn(e){const t=za(e);if(!Bt(t))return Ba;const n=t.getBoundingClientRect(),{width:s,height:o,fallback:i}=Ra(t);let r=(i?Xs(n.width):n.width)/s,l=(i?Xs(n.height):n.height)/o;return r&&Number.isFinite(r)||(r=1),l&&Number.isFinite(l)||(l=1),{x:r,y:l}}function ws(e,t,n,s){var o,i;t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=za(e);let c=Ba;t&&(s?pn(s)&&(c=Fn(s)):c=Fn(e));const p=l?kt(l):window,d=!Fa()&&n;let m=(r.left+(d&&((o=p.visualViewport)==null?void 0:o.offsetLeft)||0))/c.x,v=(r.top+(d&&((i=p.visualViewport)==null?void 0:i.offsetTop)||0))/c.y,w=r.width/c.x,I=r.height/c.y;if(l){const S=kt(l),_=s&&pn(s)?kt(s):s;let T=S.frameElement;for(;T&&s&&_!==S;){const z=Fn(T),K=T.getBoundingClientRect(),V=getComputedStyle(T);K.x+=(T.clientLeft+parseFloat(V.paddingLeft))*z.x,K.y+=(T.clientTop+parseFloat(V.paddingTop))*z.y,m*=z.x,v*=z.y,w*=z.x,I*=z.y,m+=K.x,v+=K.y,T=kt(T).frameElement}}return{width:w,height:I,top:v,right:m+w,bottom:v+I,left:m,x:m,y:v}}function hn(e){return((Na(e)?e.ownerDocument:e.document)||window.document).documentElement}function bo(e){return pn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ha(e){return ws(hn(e)).left+bo(e).scrollLeft}function ks(e){if(mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Or(e)&&e.host||hn(e);return Or(t)?t.host:t}function ja(e){const t=ks(e);return Fi(t)?t.ownerDocument.body:Bt(t)&&_o(t)?t:ja(t)}function Zs(e,t){var n;t===void 0&&(t=[]);const s=ja(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),i=kt(s);return o?t.concat(i,i.visualViewport||[],_o(s)?s:[]):t.concat(s,Zs(s))}function Rr(e,t,n){return t==="viewport"?rs((function(s,o){const i=kt(s),r=hn(s),l=i.visualViewport;let c=r.clientWidth,p=r.clientHeight,d=0,m=0;if(l){c=l.width,p=l.height;const v=Fa();(v||!v&&o==="fixed")&&(d=l.offsetLeft,m=l.offsetTop)}return{width:c,height:p,x:d,y:m}})(e,n)):pn(t)?rs((function(s,o){const i=ws(s,!0,o==="fixed"),r=i.top+s.clientTop,l=i.left+s.clientLeft,c=Bt(s)?Fn(s):{x:1,y:1};return{width:s.clientWidth*c.x,height:s.clientHeight*c.y,x:l*c.x,y:r*c.y}})(t,n)):rs((function(s){const o=hn(s),i=bo(s),r=s.ownerDocument.body,l=ls(o.scrollWidth,o.clientWidth,r.scrollWidth,r.clientWidth),c=ls(o.scrollHeight,o.clientHeight,r.scrollHeight,r.clientHeight);let p=-i.scrollLeft+Ha(s);const d=-i.scrollTop;return zt(r).direction==="rtl"&&(p+=ls(o.clientWidth,r.clientWidth)-l),{width:l,height:c,x:p,y:d}})(hn(e)))}function Dr(e){return Bt(e)&&zt(e).position!=="fixed"?e.offsetParent:null}function Nr(e){const t=kt(e);let n=Dr(e);for(;n&&_f(n)&&zt(n).position==="static";)n=Dr(n);return n&&(mn(n)==="html"||mn(n)==="body"&&zt(n).position==="static"&&!ri(n))?t:n||(function(s){let o=ks(s);for(;Bt(o)&&!Fi(o);){if(ri(o))return o;o=ks(o)}return null})(e)||t}function bf(e,t,n){const s=Bt(t),o=hn(t),i=ws(e,!0,n==="fixed",t);let r={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(s||!s&&n!=="fixed")if((mn(t)!=="body"||_o(o))&&(r=bo(t)),Bt(t)){const c=ws(t,!0);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=Ha(o));return{x:i.left+r.scrollLeft-l.x,y:i.top+r.scrollTop-l.y,width:i.width,height:i.height}}const wf={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const i=n==="clippingAncestors"?(function(p,d){const m=d.get(p);if(m)return m;let v=Zs(p).filter((_=>pn(_)&&mn(_)!=="body")),w=null;const I=zt(p).position==="fixed";let S=I?ks(p):p;for(;pn(S)&&!Fi(S);){const _=zt(S),T=ri(S);(I?T||w:T||_.position!=="static"||!w||!["absolute","fixed"].includes(w.position))?w=_:v=v.filter((z=>z!==S)),S=ks(S)}return d.set(p,v),v})(t,this._c):[].concat(n),r=[...i,s],l=r[0],c=r.reduce(((p,d)=>{const m=Rr(t,d,o);return p.top=ls(m.top,p.top),p.right=Lr(m.right,p.right),p.bottom=Lr(m.bottom,p.bottom),p.left=ls(m.left,p.left),p}),Rr(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:s}=e;const o=Bt(n),i=hn(n);if(n===i)return t;let r={scrollLeft:0,scrollTop:0},l={x:1,y:1};const c={x:0,y:0};if((o||!o&&s!=="fixed")&&((mn(n)!=="body"||_o(i))&&(r=bo(n)),Bt(n))){const p=ws(n);l=Fn(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-r.scrollLeft*l.x+c.x,y:t.y*l.y-r.scrollTop*l.y+c.y}},isElement:pn,getDimensions:function(e){return Bt(e)?Ra(e):e.getBoundingClientRect()},getOffsetParent:Nr,getDocumentElement:hn,getScale:Fn,async getElementRects(e){let{reference:t,floating:n,strategy:s}=e;const o=this.getOffsetParent||Nr,i=this.getDimensions;return{reference:bf(t,await o(n),s),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>zt(e).direction==="rtl"},kf=(e,t,n)=>{const s=new Map,o={platform:wf,...n},i={...o.platform,_c:s};return cf(e,t,{...o,platform:i})};function Va(e,t){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(typeof t[n]=="object"&&e[n]?Va(e[n],t[n]):e[n]=t[n])}const Et={disabled:!1,distance:5,skidding:0,container:"body",boundary:void 0,instantMove:!1,disposeTimeout:150,popperTriggers:[],strategy:"absolute",preventOverflow:!0,flip:!0,shift:!0,overflowPadding:0,arrowPadding:0,arrowOverflow:!0,autoHideOnMousedown:!1,themes:{tooltip:{placement:"top",triggers:["hover","focus","touch"],hideTriggers:e=>[...e,"click"],delay:{show:200,hide:0},handleResize:!1,html:!1,loadingContent:"..."},dropdown:{placement:"bottom",triggers:["click"],delay:0,handleResize:!0,autoHide:!0},menu:{$extend:"dropdown",triggers:["hover","focus"],popperTriggers:["hover"],delay:{show:0,hide:400}}}};function xs(e,t){let n=Et.themes[e]||{},s;do s=n[t],typeof s>"u"?n.$extend?n=Et.themes[n.$extend]||{}:(n=null,s=Et[t]):n=null;while(n);return s}function xf(e){const t=[e];let n=Et.themes[e]||{};do n.$extend&&!n.$resetCss?(t.push(n.$extend),n=Et.themes[n.$extend]||{}):n=null;while(n);return t.map(s=>`v-popper--theme-${s}`)}function Fr(e){const t=[e];let n=Et.themes[e]||{};do n.$extend?(t.push(n.$extend),n=Et.themes[n.$extend]||{}):n=null;while(n);return t}let Hn=!1;if(typeof window<"u"){Hn=!1;try{const e=Object.defineProperty({},"passive",{get(){Hn=!0}});window.addEventListener("test",null,e)}catch{}}let Ua=!1;typeof window<"u"&&typeof navigator<"u"&&(Ua=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream);const Ka=["auto","top","bottom","left","right"].reduce((e,t)=>e.concat([t,`${t}-start`,`${t}-end`]),[]),zr={hover:"mouseenter",focus:"focus",click:"click",touch:"touchstart",pointer:"pointerdown"},Br={hover:"mouseleave",focus:"blur",click:"click",touch:"touchend",pointer:"pointerup"};function Hr(e,t){const n=e.indexOf(t);n!==-1&&e.splice(n,1)}function Fo(){return new Promise(e=>requestAnimationFrame(()=>{requestAnimationFrame(e)}))}const St=[];let xn=null;const jr={};function Vr(e){let t=jr[e];return t||(t=jr[e]=[]),t}let li=function(){};typeof window<"u"&&(li=window.Element);function Le(e){return function(t){return xs(t.theme,e)}}const zo="__floating-vue__popper",Wa=()=>et({name:"VPopper",provide(){return{[zo]:{parentPopper:this}}},inject:{[zo]:{default:null}},props:{theme:{type:String,required:!0},targetNodes:{type:Function,required:!0},referenceNode:{type:Function,default:null},popperNode:{type:Function,required:!0},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:Le("disabled")},positioningDisabled:{type:Boolean,default:Le("positioningDisabled")},placement:{type:String,default:Le("placement"),validator:e=>Ka.includes(e)},delay:{type:[String,Number,Object],default:Le("delay")},distance:{type:[Number,String],default:Le("distance")},skidding:{type:[Number,String],default:Le("skidding")},triggers:{type:Array,default:Le("triggers")},showTriggers:{type:[Array,Function],default:Le("showTriggers")},hideTriggers:{type:[Array,Function],default:Le("hideTriggers")},popperTriggers:{type:Array,default:Le("popperTriggers")},popperShowTriggers:{type:[Array,Function],default:Le("popperShowTriggers")},popperHideTriggers:{type:[Array,Function],default:Le("popperHideTriggers")},container:{type:[String,Object,li,Boolean],default:Le("container")},boundary:{type:[String,li],default:Le("boundary")},strategy:{type:String,validator:e=>["absolute","fixed"].includes(e),default:Le("strategy")},autoHide:{type:[Boolean,Function],default:Le("autoHide")},handleResize:{type:Boolean,default:Le("handleResize")},instantMove:{type:Boolean,default:Le("instantMove")},eagerMount:{type:Boolean,default:Le("eagerMount")},popperClass:{type:[String,Array,Object],default:Le("popperClass")},computeTransformOrigin:{type:Boolean,default:Le("computeTransformOrigin")},autoMinSize:{type:Boolean,default:Le("autoMinSize")},autoSize:{type:[Boolean,String],default:Le("autoSize")},autoMaxSize:{type:Boolean,default:Le("autoMaxSize")},autoBoundaryMaxSize:{type:Boolean,default:Le("autoBoundaryMaxSize")},preventOverflow:{type:Boolean,default:Le("preventOverflow")},overflowPadding:{type:[Number,String],default:Le("overflowPadding")},arrowPadding:{type:[Number,String],default:Le("arrowPadding")},arrowOverflow:{type:Boolean,default:Le("arrowOverflow")},flip:{type:Boolean,default:Le("flip")},shift:{type:Boolean,default:Le("shift")},shiftCrossAxis:{type:Boolean,default:Le("shiftCrossAxis")},noAutoFocus:{type:Boolean,default:Le("noAutoFocus")},disposeTimeout:{type:Number,default:Le("disposeTimeout")}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},data(){return{isShown:!1,isMounted:!1,skipTransition:!1,classes:{showFrom:!1,showTo:!1,hideFrom:!1,hideTo:!0},result:{x:0,y:0,placement:"",strategy:this.strategy,arrow:{x:0,y:0,centerOffset:0},transformOrigin:null},randomId:`popper_${[Math.random(),Date.now()].map(e=>e.toString(36).substring(2,10)).join("_")}`,shownChildren:new Set,lastAutoHide:!0,pendingHide:!1,containsGlobalTarget:!1,isDisposed:!0,mouseDownContains:!1}},computed:{popperId(){return this.ariaId!=null?this.ariaId:this.randomId},shouldMountContent(){return this.eagerMount||this.isMounted},slotData(){return{popperId:this.popperId,isShown:this.isShown,shouldMountContent:this.shouldMountContent,skipTransition:this.skipTransition,autoHide:typeof this.autoHide=="function"?this.lastAutoHide:this.autoHide,show:this.show,hide:this.hide,handleResize:this.handleResize,onResize:this.onResize,classes:{...this.classes,popperClass:this.popperClass},result:this.positioningDisabled?null:this.result,attrs:this.$attrs}},parentPopper(){var e;return(e=this[zo])==null?void 0:e.parentPopper},hasPopperShowTriggerHover(){var e,t;return((e=this.popperTriggers)==null?void 0:e.includes("hover"))||((t=this.popperShowTriggers)==null?void 0:t.includes("hover"))}},watch:{shown:"$_autoShowHide",disabled(e){e?this.dispose():this.init()},async container(){this.isShown&&(this.$_ensureTeleport(),await this.$_computePosition())},triggers:{handler:"$_refreshListeners",deep:!0},positioningDisabled:"$_refreshListeners",...["placement","distance","skidding","boundary","strategy","overflowPadding","arrowPadding","preventOverflow","shift","shiftCrossAxis","flip"].reduce((e,t)=>(e[t]="$_computePosition",e),{})},created(){this.autoMinSize&&console.warn('[floating-vue] `autoMinSize` option is deprecated. Use `autoSize="min"` instead.'),this.autoMaxSize&&console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.")},mounted(){this.init(),this.$_detachPopperNode()},activated(){this.$_autoShowHide()},deactivated(){this.hide()},beforeUnmount(){this.dispose()},methods:{show({event:e=null,skipDelay:t=!1,force:n=!1}={}){var s,o;(s=this.parentPopper)!=null&&s.lockedChild&&this.parentPopper.lockedChild!==this||(this.pendingHide=!1,(n||!this.disabled)&&(((o=this.parentPopper)==null?void 0:o.lockedChild)===this&&(this.parentPopper.lockedChild=null),this.$_scheduleShow(e,t),this.$emit("show"),this.$_showFrameLocked=!0,requestAnimationFrame(()=>{this.$_showFrameLocked=!1})),this.$emit("update:shown",!0))},hide({event:e=null,skipDelay:t=!1}={}){var n;if(!this.$_hideInProgress){if(this.shownChildren.size>0){this.pendingHide=!0;return}if(this.hasPopperShowTriggerHover&&this.$_isAimingPopper()){this.parentPopper&&(this.parentPopper.lockedChild=this,clearTimeout(this.parentPopper.lockedChildTimer),this.parentPopper.lockedChildTimer=setTimeout(()=>{this.parentPopper.lockedChild===this&&(this.parentPopper.lockedChild.hide({skipDelay:t}),this.parentPopper.lockedChild=null)},1e3));return}((n=this.parentPopper)==null?void 0:n.lockedChild)===this&&(this.parentPopper.lockedChild=null),this.pendingHide=!1,this.$_scheduleHide(e,t),this.$emit("hide"),this.$emit("update:shown",!1)}},init(){var e;this.isDisposed&&(this.isDisposed=!1,this.isMounted=!1,this.$_events=[],this.$_preventShow=!1,this.$_referenceNode=((e=this.referenceNode)==null?void 0:e.call(this))??this.$el,this.$_targetNodes=this.targetNodes().filter(t=>t.nodeType===t.ELEMENT_NODE),this.$_popperNode=this.popperNode(),this.$_innerNode=this.$_popperNode.querySelector(".v-popper__inner"),this.$_arrowNode=this.$_popperNode.querySelector(".v-popper__arrow-container"),this.$_swapTargetAttrs("title","data-original-title"),this.$_detachPopperNode(),this.triggers.length&&this.$_addEventListeners(),this.shown&&this.show())},dispose(){this.isDisposed||(this.isDisposed=!0,this.$_removeEventListeners(),this.hide({skipDelay:!0}),this.$_detachPopperNode(),this.isMounted=!1,this.isShown=!1,this.$_updateParentShownChildren(!1),this.$_swapTargetAttrs("data-original-title","title"))},async onResize(){this.isShown&&(await this.$_computePosition(),this.$emit("resize"))},async $_computePosition(){if(this.isDisposed||this.positioningDisabled)return;const e={strategy:this.strategy,middleware:[]};(this.distance||this.skidding)&&e.middleware.push(mf({mainAxis:this.distance,crossAxis:this.skidding}));const t=this.placement.startsWith("auto");if(t?e.middleware.push(ff({alignment:this.placement.split("-")[1]??""})):e.placement=this.placement,this.preventOverflow&&(this.shift&&e.middleware.push(gf({padding:this.overflowPadding,boundary:this.boundary,crossAxis:this.shiftCrossAxis})),!t&&this.flip&&e.middleware.push(pf({padding:this.overflowPadding,boundary:this.boundary}))),e.middleware.push(uf({element:this.$_arrowNode,padding:this.arrowPadding})),this.arrowOverflow&&e.middleware.push({name:"arrowOverflow",fn:({placement:s,rects:o,middlewareData:i})=>{let r;const{centerOffset:l}=i.arrow;return s.startsWith("top")||s.startsWith("bottom")?r=Math.abs(l)>o.reference.width/2:r=Math.abs(l)>o.reference.height/2,{data:{overflow:r}}}}),this.autoMinSize||this.autoSize){const s=this.autoSize?this.autoSize:this.autoMinSize?"min":null;e.middleware.push({name:"autoSize",fn:({rects:o,placement:i,middlewareData:r})=>{var l;if((l=r.autoSize)!=null&&l.skip)return{};let c,p;return i.startsWith("top")||i.startsWith("bottom")?c=o.reference.width:p=o.reference.height,this.$_innerNode.style[s==="min"?"minWidth":s==="max"?"maxWidth":"width"]=c!=null?`${c}px`:null,this.$_innerNode.style[s==="min"?"minHeight":s==="max"?"maxHeight":"height"]=p!=null?`${p}px`:null,{data:{skip:!0},reset:{rects:!0}}}})}(this.autoMaxSize||this.autoBoundaryMaxSize)&&(this.$_innerNode.style.maxWidth=null,this.$_innerNode.style.maxHeight=null,e.middleware.push(yf({boundary:this.boundary,padding:this.overflowPadding,apply:({availableWidth:s,availableHeight:o})=>{this.$_innerNode.style.maxWidth=s!=null?`${s}px`:null,this.$_innerNode.style.maxHeight=o!=null?`${o}px`:null}})));const n=await kf(this.$_referenceNode,this.$_popperNode,e);Object.assign(this.result,{x:n.x,y:n.y,placement:n.placement,strategy:n.strategy,arrow:{...n.middlewareData.arrow,...n.middlewareData.arrowOverflow}})},$_scheduleShow(e,t=!1){if(this.$_updateParentShownChildren(!0),this.$_hideInProgress=!1,clearTimeout(this.$_scheduleTimer),xn&&this.instantMove&&xn.instantMove&&xn!==this.parentPopper){xn.$_applyHide(!0),this.$_applyShow(!0);return}t?this.$_applyShow():this.$_scheduleTimer=setTimeout(this.$_applyShow.bind(this),this.$_computeDelay("show"))},$_scheduleHide(e,t=!1){if(this.shownChildren.size>0){this.pendingHide=!0;return}this.$_updateParentShownChildren(!1),this.$_hideInProgress=!0,clearTimeout(this.$_scheduleTimer),this.isShown&&(xn=this),t?this.$_applyHide():this.$_scheduleTimer=setTimeout(this.$_applyHide.bind(this),this.$_computeDelay("hide"))},$_computeDelay(e){const t=this.delay;return parseInt(t&&t[e]||t||0)},async $_applyShow(e=!1){clearTimeout(this.$_disposeTimer),clearTimeout(this.$_scheduleTimer),this.skipTransition=e,!this.isShown&&(this.$_ensureTeleport(),await Fo(),await this.$_computePosition(),await this.$_applyShowEffect(),this.positioningDisabled||this.$_registerEventListeners([...Zs(this.$_referenceNode),...Zs(this.$_popperNode)],"scroll",()=>{this.$_computePosition()}))},async $_applyShowEffect(){if(this.$_hideInProgress)return;if(this.computeTransformOrigin){const t=this.$_referenceNode.getBoundingClientRect(),n=this.$_popperNode.querySelector(".v-popper__wrapper"),s=n.parentNode.getBoundingClientRect(),o=t.x+t.width/2-(s.left+n.offsetLeft),i=t.y+t.height/2-(s.top+n.offsetTop);this.result.transformOrigin=`${o}px ${i}px`}this.isShown=!0,this.$_applyAttrsToTarget({"aria-describedby":this.popperId,"data-popper-shown":""});const e=this.showGroup;if(e){let t;for(let n=0;n<St.length;n++)t=St[n],t.showGroup!==e&&(t.hide(),t.$emit("close-group"))}St.push(this),document.body.classList.add("v-popper--some-open");for(const t of Fr(this.theme))Vr(t).push(this),document.body.classList.add(`v-popper--some-open--${t}`);this.$emit("apply-show"),this.classes.showFrom=!0,this.classes.showTo=!1,this.classes.hideFrom=!1,this.classes.hideTo=!1,await Fo(),this.classes.showFrom=!1,this.classes.showTo=!0,this.noAutoFocus||this.$_popperNode.focus()},async $_applyHide(e=!1){if(this.shownChildren.size>0){this.pendingHide=!0,this.$_hideInProgress=!1;return}if(clearTimeout(this.$_scheduleTimer),!this.isShown)return;this.skipTransition=e,Hr(St,this),St.length===0&&document.body.classList.remove("v-popper--some-open");for(const n of Fr(this.theme)){const s=Vr(n);Hr(s,this),s.length===0&&document.body.classList.remove(`v-popper--some-open--${n}`)}xn===this&&(xn=null),this.isShown=!1,this.$_applyAttrsToTarget({"aria-describedby":void 0,"data-popper-shown":void 0}),clearTimeout(this.$_disposeTimer);const t=this.disposeTimeout;t!==null&&(this.$_disposeTimer=setTimeout(()=>{this.$_popperNode&&(this.$_detachPopperNode(),this.isMounted=!1)},t)),this.$_removeEventListeners("scroll"),this.$emit("apply-hide"),this.classes.showFrom=!1,this.classes.showTo=!1,this.classes.hideFrom=!0,this.classes.hideTo=!1,await Fo(),this.classes.hideFrom=!1,this.classes.hideTo=!0},$_autoShowHide(){this.shown?this.show():this.hide()},$_ensureTeleport(){if(this.isDisposed)return;let e=this.container;if(typeof e=="string"?e=window.document.querySelector(e):e===!1&&(e=this.$_targetNodes[0].parentNode),!e)throw new Error("No container for popover: "+this.container);e.appendChild(this.$_popperNode),this.isMounted=!0},$_addEventListeners(){const e=n=>{this.isShown&&!this.$_hideInProgress||(n.usedByTooltip=!0,!this.$_preventShow&&this.show({event:n}))};this.$_registerTriggerListeners(this.$_targetNodes,zr,this.triggers,this.showTriggers,e),this.$_registerTriggerListeners([this.$_popperNode],zr,this.popperTriggers,this.popperShowTriggers,e);const t=n=>{n.usedByTooltip||this.hide({event:n})};this.$_registerTriggerListeners(this.$_targetNodes,Br,this.triggers,this.hideTriggers,t),this.$_registerTriggerListeners([this.$_popperNode],Br,this.popperTriggers,this.popperHideTriggers,t)},$_registerEventListeners(e,t,n){this.$_events.push({targetNodes:e,eventType:t,handler:n}),e.forEach(s=>s.addEventListener(t,n,Hn?{passive:!0}:void 0))},$_registerTriggerListeners(e,t,n,s,o){let i=n;s!=null&&(i=typeof s=="function"?s(i):s),i.forEach(r=>{const l=t[r];l&&this.$_registerEventListeners(e,l,o)})},$_removeEventListeners(e){const t=[];this.$_events.forEach(n=>{const{targetNodes:s,eventType:o,handler:i}=n;!e||e===o?s.forEach(r=>r.removeEventListener(o,i)):t.push(n)}),this.$_events=t},$_refreshListeners(){this.isDisposed||(this.$_removeEventListeners(),this.$_addEventListeners())},$_handleGlobalClose(e,t=!1){this.$_showFrameLocked||(this.hide({event:e}),e.closePopover?this.$emit("close-directive"):this.$emit("auto-hide"),t&&(this.$_preventShow=!0,setTimeout(()=>{this.$_preventShow=!1},300)))},$_detachPopperNode(){this.$_popperNode.parentNode&&this.$_popperNode.parentNode.removeChild(this.$_popperNode)},$_swapTargetAttrs(e,t){for(const n of this.$_targetNodes){const s=n.getAttribute(e);s&&(n.removeAttribute(e),n.setAttribute(t,s))}},$_applyAttrsToTarget(e){for(const t of this.$_targetNodes)for(const n in e){const s=e[n];s==null?t.removeAttribute(n):t.setAttribute(n,s)}},$_updateParentShownChildren(e){let t=this.parentPopper;for(;t;)e?t.shownChildren.add(this.randomId):(t.shownChildren.delete(this.randomId),t.pendingHide&&t.hide()),t=t.parentPopper},$_isAimingPopper(){const e=this.$_referenceNode.getBoundingClientRect();if(as>=e.left&&as<=e.right&&cs>=e.top&&cs<=e.bottom){const t=this.$_popperNode.getBoundingClientRect(),n=as-ln,s=cs-an,o=t.left+t.width/2-ln+(t.top+t.height/2)-an+t.width+t.height,i=ln+n*o,r=an+s*o;return Rs(ln,an,i,r,t.left,t.top,t.left,t.bottom)||Rs(ln,an,i,r,t.left,t.top,t.right,t.top)||Rs(ln,an,i,r,t.right,t.top,t.right,t.bottom)||Rs(ln,an,i,r,t.left,t.bottom,t.right,t.bottom)}return!1}},render(){return this.$slots.default(this.slotData)}});if(typeof document<"u"&&typeof window<"u"){if(Ua){const e=Hn?{passive:!0,capture:!0}:!0;document.addEventListener("touchstart",t=>Ur(t,!0),e),document.addEventListener("touchend",t=>Kr(t,!0),e)}else window.addEventListener("mousedown",e=>Ur(e,!1),!0),window.addEventListener("click",e=>Kr(e,!1),!0);window.addEventListener("resize",Sf)}function Ur(e,t){if(Et.autoHideOnMousedown)qa(e,t);else for(let n=0;n<St.length;n++){const s=St[n];try{s.mouseDownContains=s.popperNode().contains(e.target)}catch{}}}function Kr(e,t){Et.autoHideOnMousedown||qa(e,t)}function qa(e,t){const n={};for(let s=St.length-1;s>=0;s--){const o=St[s];try{const i=o.containsGlobalTarget=o.mouseDownContains||o.popperNode().contains(e.target);o.pendingHide=!1,requestAnimationFrame(()=>{if(o.pendingHide=!1,!n[o.randomId]&&Wr(o,i,e)){if(o.$_handleGlobalClose(e,t),!e.closeAllPopover&&e.closePopover&&i){let l=o.parentPopper;for(;l;)n[l.randomId]=!0,l=l.parentPopper;return}let r=o.parentPopper;for(;r&&Wr(r,r.containsGlobalTarget,e);)r.$_handleGlobalClose(e,t),r=r.parentPopper}})}catch{}}}function Wr(e,t,n){return n.closeAllPopover||n.closePopover&&t||$f(e,n)&&!t}function $f(e,t){if(typeof e.autoHide=="function"){const n=e.autoHide(t);return e.lastAutoHide=n,n}return e.autoHide}function Sf(){for(let e=0;e<St.length;e++)St[e].$_computePosition()}let ln=0,an=0,as=0,cs=0;typeof window<"u"&&window.addEventListener("mousemove",e=>{ln=as,an=cs,as=e.clientX,cs=e.clientY},Hn?{passive:!0}:void 0);function Rs(e,t,n,s,o,i,r,l){const c=((r-o)*(t-i)-(l-i)*(e-o))/((l-i)*(n-e)-(r-o)*(s-t)),p=((n-e)*(t-i)-(s-t)*(e-o))/((l-i)*(n-e)-(r-o)*(s-t));return c>=0&&c<=1&&p>=0&&p<=1}const Tf={extends:Wa()},wo=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n};function Cf(e,t,n,s,o,i){return y(),b("div",{ref:"reference",class:he(["v-popper",{"v-popper--shown":e.slotData.isShown}])},[vs(e.$slots,"default",bc(ya(e.slotData)))],2)}const Mf=wo(Tf,[["render",Cf]]);function Ef(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);var n=e.indexOf("Trident/");if(n>0){var s=e.indexOf("rv:");return parseInt(e.substring(s+3,e.indexOf(".",s)),10)}var o=e.indexOf("Edge/");return o>0?parseInt(e.substring(o+5,e.indexOf(".",o)),10):-1}let zs;function ai(){ai.init||(ai.init=!0,zs=Ef()!==-1)}var ko={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){ai(),Ke(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",zs&&this.$el.appendChild(e),e.data="about:blank",zs||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!zs&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const Pf=ru();ou("data-v-b329ee4c");const If={class:"resize-observer",tabindex:"-1"};iu();const Af=Pf((e,t,n,s,o,i)=>(y(),ft("div",If)));ko.render=Af;ko.__scopeId="data-v-b329ee4c";ko.__file="src/components/ResizeObserver.vue";const Ga=(e="theme")=>({computed:{themeClass(){return xf(this[e])}}}),Lf=et({name:"VPopperContent",components:{ResizeObserver:ko},mixins:[Ga()],props:{popperId:String,theme:String,shown:Boolean,mounted:Boolean,skipTransition:Boolean,autoHide:Boolean,handleResize:Boolean,classes:Object,result:Object},emits:["hide","resize"],methods:{toPx(e){return e!=null&&!isNaN(e)?`${e}px`:null}}}),Of=["id","aria-hidden","tabindex","data-popper-placement"],Rf={ref:"inner",class:"v-popper__inner"},Df=u("div",{class:"v-popper__arrow-outer"},null,-1),Nf=u("div",{class:"v-popper__arrow-inner"},null,-1),Ff=[Df,Nf];function zf(e,t,n,s,o,i){const r=hs("ResizeObserver");return y(),b("div",{id:e.popperId,ref:"popover",class:he(["v-popper__popper",[e.themeClass,e.classes.popperClass,{"v-popper__popper--shown":e.shown,"v-popper__popper--hidden":!e.shown,"v-popper__popper--show-from":e.classes.showFrom,"v-popper__popper--show-to":e.classes.showTo,"v-popper__popper--hide-from":e.classes.hideFrom,"v-popper__popper--hide-to":e.classes.hideTo,"v-popper__popper--skip-transition":e.skipTransition,"v-popper__popper--arrow-overflow":e.result&&e.result.arrow.overflow,"v-popper__popper--no-positioning":!e.result}]]),style:Me(e.result?{position:e.result.strategy,transform:`translate3d(${Math.round(e.result.x)}px,${Math.round(e.result.y)}px,0)`}:void 0),"aria-hidden":e.shown?"false":"true",tabindex:e.autoHide?0:void 0,"data-popper-placement":e.result?e.result.placement:void 0,onKeyup:t[2]||(t[2]=Ta(l=>e.autoHide&&e.$emit("hide"),["esc"]))},[u("div",{class:"v-popper__backdrop",onClick:t[0]||(t[0]=l=>e.autoHide&&e.$emit("hide"))}),u("div",{class:"v-popper__wrapper",style:Me(e.result?{transformOrigin:e.result.transformOrigin}:void 0)},[u("div",Rf,[e.mounted?(y(),b(ve,{key:0},[u("div",null,[vs(e.$slots,"default")]),e.handleResize?(y(),ft(r,{key:0,onNotify:t[1]||(t[1]=l=>e.$emit("resize",l))})):le("",!0)],64)):le("",!0)],512),u("div",{ref:"arrow",class:"v-popper__arrow-container",style:Me(e.result?{left:e.toPx(e.result.arrow.x),top:e.toPx(e.result.arrow.y)}:void 0)},Ff,4)],4)],46,Of)}const Ja=wo(Lf,[["render",zf]]),Ya={methods:{show(...e){return this.$refs.popper.show(...e)},hide(...e){return this.$refs.popper.hide(...e)},dispose(...e){return this.$refs.popper.dispose(...e)},onResize(...e){return this.$refs.popper.onResize(...e)}}};let ci=function(){};typeof window<"u"&&(ci=window.Element);const Bf=et({name:"VPopperWrapper",components:{Popper:Mf,PopperContent:Ja},mixins:[Ya,Ga("finalTheme")],props:{theme:{type:String,default:null},referenceNode:{type:Function,default:null},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:void 0},positioningDisabled:{type:Boolean,default:void 0},placement:{type:String,default:void 0},delay:{type:[String,Number,Object],default:void 0},distance:{type:[Number,String],default:void 0},skidding:{type:[Number,String],default:void 0},triggers:{type:Array,default:void 0},showTriggers:{type:[Array,Function],default:void 0},hideTriggers:{type:[Array,Function],default:void 0},popperTriggers:{type:Array,default:void 0},popperShowTriggers:{type:[Array,Function],default:void 0},popperHideTriggers:{type:[Array,Function],default:void 0},container:{type:[String,Object,ci,Boolean],default:void 0},boundary:{type:[String,ci],default:void 0},strategy:{type:String,default:void 0},autoHide:{type:[Boolean,Function],default:void 0},handleResize:{type:Boolean,default:void 0},instantMove:{type:Boolean,default:void 0},eagerMount:{type:Boolean,default:void 0},popperClass:{type:[String,Array,Object],default:void 0},computeTransformOrigin:{type:Boolean,default:void 0},autoMinSize:{type:Boolean,default:void 0},autoSize:{type:[Boolean,String],default:void 0},autoMaxSize:{type:Boolean,default:void 0},autoBoundaryMaxSize:{type:Boolean,default:void 0},preventOverflow:{type:Boolean,default:void 0},overflowPadding:{type:[Number,String],default:void 0},arrowPadding:{type:[Number,String],default:void 0},arrowOverflow:{type:Boolean,default:void 0},flip:{type:Boolean,default:void 0},shift:{type:Boolean,default:void 0},shiftCrossAxis:{type:Boolean,default:void 0},noAutoFocus:{type:Boolean,default:void 0},disposeTimeout:{type:Number,default:void 0}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},computed:{finalTheme(){return this.theme??this.$options.vPopperTheme}},methods:{getTargetNodes(){return Array.from(this.$el.children).filter(e=>e!==this.$refs.popperContent.$el)}}});function Hf(e,t,n,s,o,i){const r=hs("PopperContent"),l=hs("Popper");return y(),ft(l,Oi({ref:"popper"},e.$props,{theme:e.finalTheme,"target-nodes":e.getTargetNodes,"popper-node":()=>e.$refs.popperContent.$el,class:[e.themeClass],onShow:t[0]||(t[0]=()=>e.$emit("show")),onHide:t[1]||(t[1]=()=>e.$emit("hide")),"onUpdate:shown":t[2]||(t[2]=c=>e.$emit("update:shown",c)),onApplyShow:t[3]||(t[3]=()=>e.$emit("apply-show")),onApplyHide:t[4]||(t[4]=()=>e.$emit("apply-hide")),onCloseGroup:t[5]||(t[5]=()=>e.$emit("close-group")),onCloseDirective:t[6]||(t[6]=()=>e.$emit("close-directive")),onAutoHide:t[7]||(t[7]=()=>e.$emit("auto-hide")),onResize:t[8]||(t[8]=()=>e.$emit("resize"))}),{default:pt(({popperId:c,isShown:p,shouldMountContent:d,skipTransition:m,autoHide:v,show:w,hide:I,handleResize:S,onResize:_,classes:T,result:z})=>[vs(e.$slots,"default",{shown:p,show:w,hide:I}),Re(r,{ref:"popperContent","popper-id":c,theme:e.finalTheme,shown:p,mounted:d,"skip-transition":m,"auto-hide":v,"handle-resize":S,classes:T,result:z,onHide:I,onResize:_},{default:pt(()=>[vs(e.$slots,"popper",{shown:p,hide:I})]),_:2},1032,["popper-id","theme","shown","mounted","skip-transition","auto-hide","handle-resize","classes","result","onHide","onResize"])]),_:3},16,["theme","target-nodes","popper-node","class"])}const zi=wo(Bf,[["render",Hf]]),jf={...zi,name:"VDropdown",vPopperTheme:"dropdown"},Vf={...zi,name:"VMenu",vPopperTheme:"menu"},Uf={...zi,name:"VTooltip",vPopperTheme:"tooltip"},Kf=et({name:"VTooltipDirective",components:{Popper:Wa(),PopperContent:Ja},mixins:[Ya],inheritAttrs:!1,props:{theme:{type:String,default:"tooltip"},html:{type:Boolean,default:e=>xs(e.theme,"html")},content:{type:[String,Number,Function],default:null},loadingContent:{type:String,default:e=>xs(e.theme,"loadingContent")},targetNodes:{type:Function,required:!0}},data(){return{asyncContent:null}},computed:{isContentAsync(){return typeof this.content=="function"},loading(){return this.isContentAsync&&this.asyncContent==null},finalContent(){return this.isContentAsync?this.loading?this.loadingContent:this.asyncContent:this.content}},watch:{content:{handler(){this.fetchContent(!0)},immediate:!0},async finalContent(){await this.$nextTick(),this.$refs.popper.onResize()}},created(){this.$_fetchId=0},methods:{fetchContent(e){if(typeof this.content=="function"&&this.$_isShown&&(e||!this.$_loading&&this.asyncContent==null)){this.asyncContent=null,this.$_loading=!0;const t=++this.$_fetchId,n=this.content(this);n.then?n.then(s=>this.onResult(t,s)):this.onResult(t,n)}},onResult(e,t){e===this.$_fetchId&&(this.$_loading=!1,this.asyncContent=t)},onShow(){this.$_isShown=!0,this.fetchContent()},onHide(){this.$_isShown=!1}}}),Wf=["innerHTML"],qf=["textContent"];function Gf(e,t,n,s,o,i){const r=hs("PopperContent"),l=hs("Popper");return y(),ft(l,Oi({ref:"popper"},e.$attrs,{theme:e.theme,"target-nodes":e.targetNodes,"popper-node":()=>e.$refs.popperContent.$el,onApplyShow:e.onShow,onApplyHide:e.onHide}),{default:pt(({popperId:c,isShown:p,shouldMountContent:d,skipTransition:m,autoHide:v,hide:w,handleResize:I,onResize:S,classes:_,result:T})=>[Re(r,{ref:"popperContent",class:he({"v-popper--tooltip-loading":e.loading}),"popper-id":c,theme:e.theme,shown:p,mounted:d,"skip-transition":m,"auto-hide":v,"handle-resize":I,classes:_,result:T,onHide:w,onResize:S},{default:pt(()=>[e.html?(y(),b("div",{key:0,innerHTML:e.finalContent},null,8,Wf)):(y(),b("div",{key:1,textContent:M(e.finalContent)},null,8,qf))]),_:2},1032,["class","popper-id","theme","shown","mounted","skip-transition","auto-hide","handle-resize","classes","result","onHide","onResize"])]),_:1},16,["theme","target-nodes","popper-node","onApplyShow","onApplyHide"])}const Jf=wo(Kf,[["render",Gf]]),Xa="v-popper--has-tooltip";function Yf(e,t){let n=e.placement;if(!n&&t)for(const s of Ka)t[s]&&(n=s);return n||(n=xs(e.theme||"tooltip","placement")),n}function Za(e,t,n){let s;const o=typeof t;return o==="string"?s={content:t}:t&&o==="object"?s=t:s={content:!1},s.placement=Yf(s,n),s.targetNodes=()=>[e],s.referenceNode=()=>e,s}let Bo,$s,Xf=0;function Zf(){if(Bo)return;$s=me([]),Bo=Ca({name:"VTooltipDirectiveApp",setup(){return{directives:$s}},render(){return this.directives.map(t=>Ri(Jf,{...t.options,shown:t.shown||t.options.shown,key:t.id}))},devtools:{hide:!0}});const e=document.createElement("div");document.body.appendChild(e),Bo.mount(e)}function Qf(e,t,n){Zf();const s=me(Za(e,t,n)),o=me(!1),i={id:Xf++,options:s,shown:o};return $s.value.push(i),e.classList&&e.classList.add(Xa),e.$_popper={options:s,item:i,show(){o.value=!0},hide(){o.value=!1}}}function Qa(e){if(e.$_popper){const t=$s.value.indexOf(e.$_popper.item);t!==-1&&$s.value.splice(t,1),delete e.$_popper,delete e.$_popperOldShown,delete e.$_popperMountTarget}e.classList&&e.classList.remove(Xa)}function qr(e,{value:t,modifiers:n}){const s=Za(e,t,n);if(!s.content||xs(s.theme||"tooltip","disabled"))Qa(e);else{let o;e.$_popper?(o=e.$_popper,o.options.value=s):o=Qf(e,t,n),typeof t.shown<"u"&&t.shown!==e.$_popperOldShown&&(e.$_popperOldShown=t.shown,t.shown?o.show():o.hide())}}const ep={beforeMount:qr,updated:qr,beforeUnmount(e){Qa(e)}};function Gr(e){e.addEventListener("mousedown",Qs),e.addEventListener("click",Qs),e.addEventListener("touchstart",ec,Hn?{passive:!0}:!1)}function Jr(e){e.removeEventListener("mousedown",Qs),e.removeEventListener("click",Qs),e.removeEventListener("touchstart",ec),e.removeEventListener("touchend",tc),e.removeEventListener("touchcancel",nc)}function Qs(e){const t=e.currentTarget;e.closePopover=!t.$_vclosepopover_touch,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}function ec(e){if(e.changedTouches.length===1){const t=e.currentTarget;t.$_vclosepopover_touch=!0;const n=e.changedTouches[0];t.$_vclosepopover_touchPoint=n,t.addEventListener("touchend",tc),t.addEventListener("touchcancel",nc)}}function tc(e){const t=e.currentTarget;if(t.$_vclosepopover_touch=!1,e.changedTouches.length===1){const n=e.changedTouches[0],s=t.$_vclosepopover_touchPoint;e.closePopover=Math.abs(n.screenY-s.screenY)<20&&Math.abs(n.screenX-s.screenX)<20,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}}function nc(e){const t=e.currentTarget;t.$_vclosepopover_touch=!1}const tp={beforeMount(e,{value:t,modifiers:n}){e.$_closePopoverModifiers=n,(typeof t>"u"||t)&&Gr(e)},updated(e,{value:t,oldValue:n,modifiers:s}){e.$_closePopoverModifiers=s,t!==n&&(typeof t>"u"||t?Gr(e):Jr(e))},beforeUnmount(e){Jr(e)}};function np(e,t={}){e.$_vTooltipInstalled||(e.$_vTooltipInstalled=!0,Va(Et,t),e.directive("tooltip",ep),e.directive("close-popper",tp),e.component("VTooltip",Uf),e.component("VDropdown",jf),e.component("VMenu",Vf))}const sp={version:"5.2.2",install:np,options:Et},Vn="";async function op(){const e=await fetch(`${Vn}/api/requests?summary=true`);if(!e.ok)throw new Error(`GET /api/requests?summary=true failed: ${e.status}`);return e.json()}async function ip(e){const t=await fetch(`${Vn}/api/conversations/${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`GET /api/conversations/${e} failed: ${t.status}`);return t.json()}async function rp(e){const t=await fetch(`${Vn}/api/entries/${e}/detail`);if(t.status===404)return null;if(!t.ok)throw new Error(`GET /api/entries/${e}/detail failed: ${t.status}`);return(await t.json()).contextInfo??null}async function lp(e){const t=await fetch(`${Vn}/api/conversations/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`DELETE conversation failed: ${t.status}`)}async function ap(){const e=await fetch(`${Vn}/api/reset`,{method:"POST"});if(!e.ok)throw new Error(`POST /api/reset failed: ${e.status}`)}function cp(e,t,n){const s=new URLSearchParams;t&&s.set("conversation",t);const o=s.toString();return`${Vn}/api/export/${e}${o?`?${o}`:""}`}const Xe={system_prompt:{label:"System prompt",color:"#2563eb"},tool_definitions:{label:"Tool definitions",color:"#db2777"},tool_results:{label:"Tool results",color:"#059669"},tool_calls:{label:"Tool calls",color:"#ec4899"},assistant_text:{label:"Assistant text",color:"#d97706"},user_text:{label:"User text",color:"#10b981"},thinking:{label:"Thinking",color:"#8b5cf6"},system_injections:{label:"System injections",color:"#6366f1"},images:{label:"Images",color:"#4b5563"},cache_markers:{label:"Cache markers",color:"#6b7280"},other:{label:"Other",color:"#4b5563"}};function up(e){var t;return((t=Xe[e])==null?void 0:t.label)??e}function dp(e,t="#475569"){var n;return((n=Xe[e])==null?void 0:n.color)??t}const jn={system:["system_prompt","system_injections"],tools:["tool_definitions","tool_calls"],results:["tool_results"],conversation:["assistant_text","user_text","thinking"],other:["images","cache_markers","other"]},gt={system:{label:"System",color:"#2563eb"},tools:{label:"Tools",color:"#db2777"},results:{label:"Results",color:"#059669"},conversation:{label:"Conversation",color:"#d97706"},other:{label:"Other",color:"#4b5563"}};function Tt(e){const t=e.role||"user",n=e.content||"",s=e.contentBlocks;if(s&&Array.isArray(s)){const o=s.some(l=>l.type==="tool_use"),i=s.some(l=>l.type==="tool_result"),r=s.some(l=>l.type==="thinking");if(i)return"tool_results";if(o)return"tool_calls";if(r)return"thinking"}return typeof n=="string"&&n.includes("<system-reminder>")?"system_injections":t==="assistant"?"assistant_text":t==="user"?"user_text":"other"}function xo(e){const t={};for(const n of e)if(n.contentBlocks)for(const s of n.contentBlocks)s.type==="tool_use"&&s.id&&s.name&&(t[s.id]=s.name);return t}function Ho(e,t={}){const n=e.contentBlocks;if(n&&Array.isArray(n))for(const s of n){if(s.type==="tool_use")return(s.name||"tool")+"("+(s.input?JSON.stringify(s.input).slice(0,60):"")+")";if(s.type==="tool_result"){const i=s.tool_use_id?t[s.tool_use_id]:null,r=typeof s.content=="string"?s.content:JSON.stringify(s.content||""),l=i?i+": ":"";return l+r.slice(0,80-l.length)}const o=s;if(o.type==="thinking")return(o.thinking||o.text||"").slice(0,80);if(s.type==="text"||s.type==="input_text")return(s.text||"").slice(0,80)}return(e.content||"").slice(0,80)}function fp(e){return e.contentBlocks&&e.contentBlocks.length>0?e.contentBlocks.map(t=>{if(t.type==="tool_use")return t.name+"("+JSON.stringify(t.input,null,2)+")";if(t.type==="tool_result")return typeof t.content=="string"?t.content:JSON.stringify(t.content,null,2);const n=t;return n.type==="thinking"?n.thinking||n.text||"":t.type==="text"||t.type==="input_text"?t.text||"":JSON.stringify(t,null,2)}).join(`
23
23
 
24
24
  `):e.content||""}function jo(e){const t={role:e.role};if(e.contentBlocks&&e.contentBlocks.length>0)t.content=e.contentBlocks;else try{t.content=JSON.parse(e.content)}catch{t.content=e.content}return t._tokens=e.tokens,t}const pp=["tool_results","system_injections","tool_calls","thinking","assistant_text","user_text"];function sc(e){const t=new Map;for(let s=e.length-1;s>=0;s--){const o=e[s],i=Tt(o);t.has(i)||t.set(i,{items:[],tokens:0});const r=t.get(i);r.items.push({msg:o,origIdx:s}),r.tokens+=o.tokens||0}const n=[...pp];for(const s of t.keys())n.includes(s)||n.push(s);return n.filter(s=>t.has(s)).map(s=>({category:s,...t.get(s)}))}function Xt(e){if(e.length===0)return[];const t=new Map;for(const o of e){const i=o.agentKey||"_default";t.set(i,(t.get(i)||0)+1)}let n="_default",s=0;for(const[o,i]of t)i>s&&(n=o,s=i);return e.map(o=>({entry:o,isMain:(o.agentKey||"_default")===n}))}const Yr="context-lens-density",Lt=Yd("session",()=>{const e=me(0),t=me([]),n=me(new Map),s=me(0),o=me(!1),i=me(null),r=me(null),l=me(!1),c=me("dashboard"),p=me("overview"),d=me(null),m=me("live"),v=me(null),w=me(""),I=me(""),S=me("comfortable"),_=me(null),T=me(0),z=me(null),K=me(null),V=me(!1),Q=me(null),D=me(new Set),ae=me(!1),ue=me("main"),O=me("main"),R=me("absolute"),de=me(new Set),F=me(!0),te=me(!1),ce=me(new Set),B=new Map;function se(x){const X=new Set(ce.value);X.add(x),ce.value=X;const be=B.get(x);be&&clearTimeout(be),B.set(x,setTimeout(()=>{B.delete(x);const Se=new Set(ce.value);Se.delete(x),ce.value=Se},1500))}const oe=new Map,W=me(null),re=me(0),we=A(()=>t.value.map(x=>{const X=n.value.get(x.id);return X||{...x,agents:[],entries:[]}})),H=A(()=>[]),C=A(()=>{let x=we.value;return w.value&&(x=x.filter(X=>X.source===w.value)),I.value&&(x=x.filter(X=>{const be=n.value.get(X.id);if(be&&be.entries.length>0)return be.entries[0].contextInfo.model.includes(I.value);const Se=t.value.find(nt=>nt.id===X.id);return Se==null?void 0:Se.latestModel.includes(I.value)})),x}),P=A(()=>w.value?t.value.filter(x=>x.source===w.value):t.value),ee=A(()=>{const x=new Set;for(const X of t.value)X.source&&x.add(X.source);return Array.from(x).sort()}),ne=A(()=>{const x=new Set;for(const X of t.value)X.latestModel&&x.add(X.latestModel);return Array.from(x).sort()}),$=A(()=>d.value?n.value.get(d.value)??null:null),L=A(()=>{const x=$.value;if(!x||x.entries.length===0)return null;if(m.value==="live"){const Se=[...Xt([...x.entries].reverse())].reverse().find(nt=>nt.isMain);return(Se==null?void 0:Se.entry)??x.entries[0]}return x.entries.find(be=>be.id===v.value)??x.entries[0]}),G=A(()=>{let x=0;for(const X of t.value)x+=X.totalCost??0;return x}),k=A(()=>{let x=0;for(const X of t.value)x+=X.entryCount;return x+s.value});async function g(){o.value=!0,r.value=null;try{const x=await op();e.value=x.revision,t.value=x.conversations,s.value=x.ungroupedCount;const X=new Set(x.conversations.map(be=>be.id));for(const be of n.value.keys())X.has(be)||n.value.delete(be);!d.value&&x.conversations.length>0&&c.value==="inspector"&&await f(x.conversations[0].id),d.value&&!X.has(d.value)&&(d.value=null,m.value="live",v.value=null,c.value==="inspector"&&(c.value="dashboard")),d.value&&X.has(d.value)&&await h(d.value)}catch(x){r.value=x instanceof Error?x.message:String(x)}finally{o.value=!1}}async function h(x){i.value=x;try{const X=await ip(x),be=new Map(n.value);be.set(x,X),n.value=be}catch(X){console.warn(`Failed to load conversation ${x}:`,X)}finally{i.value=null}}function a(x){if(x.type==="connected"){l.value=!0,x.revision!==e.value&&g();return}x.conversationId&&se(x.conversationId),g(),x.conversationId&&d.value===x.conversationId&&h(x.conversationId)}async function f(x){d.value=x,m.value="live",v.value=null,n.value.has(x)||await h(x)}function E(){m.value="live",v.value=null}function q(x){m.value="pinned",v.value=x}function N(x){c.value=x}function J(x){p.value=x}function pe(x){w.value=x}function fe(x){I.value=x}function ie(x,X=!1){_.value=x,z.value=null,K.value=null,Q.value=null,V.value=X,T.value+=1}function Z(x,X){_.value=x,z.value=X,K.value=null,Q.value=null,T.value+=1}function ke(x){_.value=null,z.value=null,K.value=x,Q.value=null,T.value+=1}function ge(x){_.value="tool_results",z.value=null,K.value=null,Q.value=x,T.value+=1}function $e(x){const X=new Set(D.value);X.has(x)?X.delete(x):X.add(x),D.value=X}async function Te(x){const X=x??D.value;if(X.size<2)return;D.value=new Set(X),ae.value=!0,c.value="compare";const be=[];for(const Se of X)n.value.has(Se)||be.push(h(Se));await Promise.all(be)}function Ie(x="dashboard"){ae.value=!1,D.value=new Set,c.value=x}function Fe(){_.value=null,z.value=null,K.value=null,V.value=!1,Q.value=null}async function Ae(x){if(oe.has(x))return oe.get(x);W.value=x;try{const X=await rp(x);if(X&&(oe.set(x,X),re.value++,oe.size>50)){const be=oe.keys().next().value;be!==void 0&&oe.delete(be)}return X}catch{return null}finally{W.value=null}}function Ye(x){return oe.get(x)??null}async function tt(x){try{await lp(x),t.value=t.value.filter(X=>X.id!==x),n.value.delete(x),d.value===x&&(t.value.length>0?await f(t.value[0].id):(d.value=null,m.value="live",v.value=null))}catch(X){r.value=X instanceof Error?X.message:String(X)}}async function ht(){try{await ap(),t.value=[],n.value=new Map,s.value=0,d.value=null,m.value="live",v.value=null,e.value=0}catch(x){r.value=x instanceof Error?x.message:String(x)}}function U(x){typeof document>"u"||document.documentElement.setAttribute("data-density",x)}function j(){if(typeof window>"u")return;const x=window.localStorage.getItem(Yr);x==="comfortable"||x==="compact"?S.value=x:S.value="comfortable",U(S.value)}function ye(x){S.value=x,typeof window<"u"&&window.localStorage.setItem(Yr,x),U(x)}return{revision:e,summaries:t,loadedConversations:n,conversations:we,ungrouped:H,loading:o,loadingSession:i,error:r,connected:l,view:c,inspectorTab:p,selectedSessionId:d,selectionMode:m,selectedEntryId:v,sourceFilter:w,modelFilter:I,density:S,messageFocusCategory:_,messageFocusToken:T,messageFocusTool:z,messageFocusIndex:K,messageFocusOpenDetail:V,messageFocusFile:Q,messagesMode:ue,timelineMode:O,timelineStackMode:R,timelineHiddenLegendKeys:de,timelineShowLimitOverlay:F,timelineShowCacheOverlay:te,recentlyUpdated:ce,compareSessionIds:D,compareMode:ae,filteredConversations:C,filteredSummaries:P,sources:ee,models:ne,selectedSession:$,selectedEntry:L,totalCost:G,totalRequests:k,load:g,loadConversationEntries:h,handleSSEEvent:a,selectSession:f,followLive:E,pinEntry:q,setView:N,setInspectorTab:J,setSourceFilter:pe,setModelFilter:fe,focusMessageCategory:ie,focusMessageTool:Z,focusMessageByIndex:ke,focusMessageFile:ge,clearMessageFocus:Fe,toggleCompareSession:$e,enterCompare:Te,exitCompare:Ie,loadEntryDetail:Ae,getEntryDetail:Ye,entryDetailLoading:W,entryDetailVersion:re,initializeDensity:j,setDensity:ye,deleteSession:tt,reset:ht}});function hp(e,t){const n=me(!1);let s=null,o=null;function i(){s&&s.close(),s=new EventSource(e),s.onopen=()=>{n.value=!0},s.onmessage=l=>{try{const c=JSON.parse(l.data);t(c)}catch{}},s.onerror=()=>{n.value=!1,s==null||s.close(),s=null,o&&clearTimeout(o),o=setTimeout(i,2e3)}}function r(){o&&(clearTimeout(o),o=null),s&&(s.close(),s=null),n.value=!1}return i(),ho(r),{connected:n,disconnect:r,reconnect:i}}function _e(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":String(e)}function bt(e){return e==null?"--":"$"+e.toFixed(2)}function ui(e){return e>=1e3?(e/1e3).toFixed(1)+"s":Math.round(e)+"ms"}function di(e,t=!1){return(t?e:e*100).toFixed(1)+"%"}function tn(e){if(!e)return"?";const t=e.match(/(opus|sonnet|haiku)-(\d+(?:\.\d+)?)/);if(t)return t[1]+"-"+t[2];const n=e.match(/(gpt-4o(?:-mini)?|gpt-4|gpt-3\.5)/);if(n)return n[1];const s=e.match(/(o[134](?:-mini)?)/);if(s)return s[1];const o=e.match(/(gemini-[\d.]+-(?:pro|flash)(?:-\w+)?)/);if(o)return o[1];const i=e.split(/[-_]/);return i.length>2?i.slice(0,3).join("-"):e}function Ss(e){const t=(e||"").toLowerCase();return t.includes("claude")?"badge-claude":t.includes("codex")?"badge-codex":t.includes("aider")?"badge-aider":t.includes("kimi")?"badge-kimi":t==="pi"||t.startsWith("pi-")?"badge-pi":"badge-unknown"}function fi(e){switch(e){case"good":return"#10b981";case"needs-work":return"#f59e0b";case"poor":return"#ef4444";default:return"#64748b"}}const vp={class:"toolbar"},mp={class:"session-model"},gp=["title"],yp=["title","aria-label"],_p={key:0,class:"session-id-toast"},bp={key:2,class:"toolbar-sep"},wp={class:"session-stat"},kp={class:"session-stat cost"},xp={key:3,class:"session-stat"},$p={class:"compare-label"},Sp={class:"toolbar-right"},Tp={class:"toolbar-stat"},Cp={class:"toolbar-stat"},Mp={class:"toolbar-stat cost"},Ep={key:1,class:"toolbar-dropdown"},Pp={key:2,class:"toolbar-dropdown"},Ip=["disabled"],Ap=et({__name:"AppToolbar",setup(e){const t=Lt(),n=me(!1),s=me(!1),o=me(!1),i=A(()=>t.view==="inspector"&&!!t.selectedSession),r=A(()=>t.selectedSession),l=A(()=>t.totalRequests>0),c=A(()=>i.value&&!!t.selectedSessionId),p=A(()=>{const O=t.selectedSessionId;return O?t.summaries.find(R=>R.id===O)??null:null});function d(O){if(!O)return"";let R=O;/^\/home\/[^/]+(\/|$)/.test(R)?R=R.replace(/^\/home\/[^/]+/,"~"):/^\/Users\/[^/]+(\/|$)/.test(R)&&(R=R.replace(/^\/Users\/[^/]+/,"~"));const de=R.split("/");return de.length>3?de.slice(-3).join("/"):R}const m=A(()=>t.selectedSessionId??"");function v(O){return String(O).trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,80)||"unknown"}function w(O,R){const de=O==="lhar"?"lhar":"lhar.json";return`context-lens-export-${`session-${v(R||"all")}`}-privacy-standard.${de}`}async function I(O,R){const de=await fetch(O);if(!de.ok)throw new Error(`Download failed: ${de.status}`);const F=await de.blob(),te=URL.createObjectURL(F);try{const ce=document.createElement("a");ce.href=te,ce.download=R,ce.style.display="none",document.body.appendChild(ce),ce.click(),document.body.removeChild(ce)}finally{URL.revokeObjectURL(te)}}async function S(O,R){const de=R==="session"?t.selectedSessionId??void 0:void 0,F=cp(O,de),te=w(O,de);try{await I(F,te)}catch{window.open(F,"_blank")}n.value=!1}function _(){n.value=!n.value,n.value&&(s.value=!1)}function T(){s.value=!s.value,s.value&&(n.value=!1)}function z(){confirm("Clear all captured data?")&&t.reset(),s.value=!1}function K(){const O=t.selectedSessionId;!O||!c.value||(confirm("Remove this session?")&&t.deleteSession(O),s.value=!1)}function V(){t.setView("dashboard")}async function Q(){const O=m.value;if(O){try{await navigator.clipboard.writeText(O),o.value=!0}catch{}setTimeout(()=>{o.value=!1},1400)}}function D(O){return O.length<=18?O:`${O.slice(0,8)}…${O.slice(-8)}`}function ae(O){return o.value?`Copied: ${O}`:`Session ID: ${O} (click to copy)`}function ue(O){(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),Q())}return(O,R)=>{var de,F,te,ce;return y(),b("header",vp,[u("a",{class:"toolbar-brand toolbar-brand-btn",href:"#sessions",onClick:fn(V,["prevent"])},[...R[7]||(R[7]=[_a('<svg class="logo-mark" width="18" height="18" viewBox="0 0 18 18" aria-hidden="true" data-v-12cb5120><circle cx="9" cy="9" r="7.5" fill="none" stroke="var(--accent-blue)" stroke-width="1" opacity="0.35" data-v-12cb5120></circle><circle cx="9" cy="9" r="4" fill="none" stroke="var(--accent-blue)" stroke-width="1" opacity="0.6" data-v-12cb5120></circle><circle cx="9" cy="9" r="1.5" fill="var(--accent-blue)" data-v-12cb5120></circle></svg><span class="brand-text" data-v-12cb5120>Context Lens</span>',2)])]),i.value&&r.value?(y(),b(ve,{key:0},[R[9]||(R[9]=u("span",{class:"toolbar-sep"},null,-1)),u("span",{class:he(["session-badge",Y(Ss)(r.value.source)])},M(r.value.source||"?"),3),u("span",mp,M(Y(tn)(((de=p.value)==null?void 0:de.latestModel)??"")),1),r.value.workingDirectory?(y(),b("span",{key:0,class:"session-dir",title:r.value.workingDirectory},M(d(r.value.workingDirectory)),9,gp)):le("",!0),R[10]||(R[10]=u("span",{class:"toolbar-sep"},null,-1)),m.value?(y(),b("span",{key:1,class:he(["session-id",{copied:o.value}]),title:ae(m.value),role:"button",tabindex:"0","aria-label":ae(m.value),onClick:Q,onKeydown:ue},[xe(" SID "+M(D(m.value))+" ",1),o.value?(y(),b("span",_p,"Copied")):le("",!0)],42,yp)):le("",!0),m.value?(y(),b("span",bp)):le("",!0),u("span",wp,M(((F=p.value)==null?void 0:F.entryCount)??r.value.entries.length)+" turns",1),u("span",kp,M(Y(bt)(((te=p.value)==null?void 0:te.totalCost)??0)),1),(ce=p.value)!=null&&ce.healthScore?(y(),b("span",xp,[R[8]||(R[8]=xe(" Latest health ",-1)),u("span",{class:he(["session-health",{good:p.value.healthScore.rating==="good",warn:p.value.healthScore.rating==="needs-work",bad:p.value.healthScore.rating==="poor"}])},M(p.value.healthScore.overall),3)])):le("",!0)],64)):le("",!0),Y(t).compareMode?(y(),b(ve,{key:1},[R[13]||(R[13]=u("span",{class:"toolbar-sep"},null,-1)),u("span",$p,[R[11]||(R[11]=u("i",{class:"i-carbon-compare"},null,-1)),xe(" Comparing "+M(Y(t).compareSessionIds.size)+" sessions ",1)]),u("button",{class:"compare-exit-btn",onClick:R[0]||(R[0]=B=>Y(t).exitCompare())},[...R[12]||(R[12]=[u("i",{class:"i-carbon-close"},null,-1),xe(" Exit ",-1)])])],64)):le("",!0),u("div",Sp,[u("span",{class:he(["connection",{live:Y(t).connected}])},[R[14]||(R[14]=u("span",{class:"connection-dot"},null,-1)),xe(" "+M(Y(t).connected?"Live":"Offline"),1)],2),i.value?le("",!0):(y(),b(ve,{key:0},[u("span",Tp,M(Y(t).conversations.length)+" session"+M(Y(t).conversations.length!==1?"s":""),1),u("span",Cp,M(Y(t).totalRequests)+" req"+M(Y(t).totalRequests!==1?"s":""),1),u("span",Mp,M(Y(bt)(Y(t).totalCost)),1)],64)),l.value?(y(),b("div",Ep,[u("button",{class:"toolbar-control",onClick:_},[...R[15]||(R[15]=[u("i",{class:"i-carbon-download"},null,-1),xe(" Export ",-1)])]),Re(Bn,{name:"dropdown"},{default:pt(()=>[n.value?(y(),b("div",{key:0,class:"dropdown-menu",onMouseleave:R[5]||(R[5]=B=>n.value=!1)},[u("button",{class:"dropdown-item",onClick:R[1]||(R[1]=B=>S("lhar.json","all"))},[...R[16]||(R[16]=[u("i",{class:"i-carbon-document"},null,-1),xe(" All (.lhar.json)",-1)])]),u("button",{class:"dropdown-item",onClick:R[2]||(R[2]=B=>S("lhar","all"))},[...R[17]||(R[17]=[u("i",{class:"i-carbon-document"},null,-1),xe(" All (.lhar)",-1)])]),Y(t).selectedSessionId?(y(),b(ve,{key:0},[R[20]||(R[20]=u("div",{class:"dropdown-sep"},null,-1)),u("button",{class:"dropdown-item",onClick:R[3]||(R[3]=B=>S("lhar.json","session"))},[...R[18]||(R[18]=[u("i",{class:"i-carbon-document"},null,-1),xe(" Session (.lhar.json)",-1)])]),u("button",{class:"dropdown-item",onClick:R[4]||(R[4]=B=>S("lhar","session"))},[...R[19]||(R[19]=[u("i",{class:"i-carbon-document"},null,-1),xe(" Session (.lhar)",-1)])])],64)):le("",!0)],32)):le("",!0)]),_:1})])):le("",!0),l.value?(y(),b("div",Pp,[u("button",{class:"toolbar-control",onClick:T},[...R[21]||(R[21]=[u("i",{class:"i-carbon-overflow-menu-horizontal"},null,-1),xe(" Menu ",-1)])]),Re(Bn,{name:"dropdown"},{default:pt(()=>[s.value?(y(),b("div",{key:0,class:"dropdown-menu",onMouseleave:R[6]||(R[6]=B=>s.value=!1)},[u("button",{class:"dropdown-item dropdown-item--danger",onClick:z},[...R[22]||(R[22]=[u("i",{class:"i-carbon-trash-can"},null,-1),xe(" Reset all ",-1)])]),u("button",{class:he(["dropdown-item dropdown-item--danger",{"dropdown-item--disabled":!c.value}]),disabled:!c.value,onClick:K},[...R[23]||(R[23]=[u("i",{class:"i-carbon-subtract-alt"},null,-1),xe(" Remove this session ",-1)])],10,Ip)],32)):le("",!0)]),_:1})])):le("",!0)])])}}}),ct=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},Lp=ct(Ap,[["__scopeId","data-v-12cb5120"]]),Op=["value","placeholder"],Rp=et({__name:"SearchInput",props:{modelValue:{},placeholder:{default:"Search…"},autoFocus:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,s=t,o=me(!1),i=me();function r(){var c;s("update:modelValue",""),(c=i.value)==null||c.focus()}function l(){var c;n.modelValue?s("update:modelValue",""):(c=i.value)==null||c.blur()}return uu(()=>{var c;n.autoFocus&&((c=i.value)==null||c.focus())}),(c,p)=>(y(),b("div",{class:he(["search-input-root",{focused:o.value,active:e.modelValue.length>0}]),onClick:p[3]||(p[3]=d=>{var m;return(m=i.value)==null?void 0:m.focus()})},[p[5]||(p[5]=u("i",{class:"i-carbon-search search-input-icon"},null,-1)),u("input",{ref_key:"inputRef",ref:i,value:e.modelValue,type:"text",class:"search-input-field",placeholder:e.placeholder,onInput:p[0]||(p[0]=d=>s("update:modelValue",d.target.value)),onFocus:p[1]||(p[1]=d=>o.value=!0),onBlur:p[2]||(p[2]=d=>o.value=!1),onKeydown:Ta(l,["escape"])},null,40,Op),e.modelValue.length>0?(y(),b("button",{key:0,class:"search-input-clear",tabindex:"-1",title:"Clear",onClick:fn(r,["stop"])},[...p[4]||(p[4]=[u("i",{class:"i-carbon-close"},null,-1)])])):le("",!0),p[6]||(p[6]=u("div",{class:"search-input-accent"},null,-1))],2))}}),Dp=ct(Rp,[["__scopeId","data-v-70f5ee93"]]);function Jn(e){return e<=0?0:e>=1?1:e}function Np(e,t){const n=e.healthScore,s=n?Jn((100-n.overall)/100):null,o=e.contextLimit?Jn(e.latestTotalTokens/e.contextLimit):0,i=s===null?o:Jn(s*.7+o*.3),r=t>0?Jn(e.totalCost/t):0,l=Jn(i*.7+r*.3);let c="Healthy",p="priority-healthy",d="prio-healthy";l>=.7?(c="Critical",p="priority-critical",d="prio-critical"):l>=.45&&(c="Warning",p="priority-warning",d="prio-warning");const m=`Priority ${Math.round(l*100)} = 0.7×risk(${Math.round(i*100)}) + 0.3×cost(${Math.round(r*100)}).`;return{risk:i,normalizedCost:r,score:l,label:c,toneClass:p,barClass:d,tooltip:m}}function oc(e,t,n){var w,I;const s=[],o=e.contextInfo,i=e.composition||[],r=i.reduce((S,_)=>S+_.tokens,0),l=xo(o.messages||[]),c=i.find(S=>S.category==="tool_results");if(c&&r>0&&c.pct>25){let S=0,_="";for(const T of o.messages||[])if(Tt(T)==="tool_results"&&T.tokens>S&&(S=T.tokens,T.contentBlocks)){for(const z of T.contentBlocks)if(z.type==="tool_result"&&z.tool_use_id&&l[z.tool_use_id]){_=l[z.tool_use_id];break}}if(S>2e3){const T=Math.round(S/r*100);s.push({severity:"high",title:`Large tool result${_?": "+_:""} (${_e(S)} tokens, ${T}% of context)`,detail:"This single result reduces space for conversation history and is re-sent every turn. You may want to truncate output or use summary flags.",impact:`${_e(S)} tok`})}}const p=i.find(S=>S.category==="tool_definitions");if(p&&p.pct>30){const S=new Set;for(const K of t)for(const V of K.contextInfo.messages||[])if(V.contentBlocks)for(const Q of V.contentBlocks)Q.type==="tool_use"&&Q.name&&S.add(Q.name);const _=[];if(o.tools)for(const K of o.tools){const V="name"in K?K.name:(w=K.function)==null?void 0:w.name;V&&_.push(V)}const T=_.filter(K=>!S.has(K)),z=_.length;if(z>S.size+3){const K=T.slice(0,5).join(", ")+(T.length>5?` +${T.length-5} more`:""),V=Math.round(p.tokens*T.length/z);s.push({severity:"high",title:`${S.size}/${z} tools used, ${T.length} idle`,detail:`Unused: ${K}. Definitions cost ~${_e(V)} tokens and are re-sent every turn. You may want to remove unused tools to free context.`,impact:`~${_e(V)} tok`})}}if(c&&c.pct>60){const S=i.find(K=>K.category==="user_text"),_=S?S.pct:0,T=new Map;for(const K of o.messages||[])if(Tt(K)==="tool_results"&&K.contentBlocks){for(const V of K.contentBlocks)if(V.type==="tool_result"&&V.tool_use_id){const Q=l[V.tool_use_id]||"unknown";T.set(Q,(T.get(Q)||0)+(K.tokens||0))}}const z=Array.from(T.entries()).sort((K,V)=>V[1]-K[1]).slice(0,3).map(([K,V])=>`${K} (${_e(V)})`).join(", ");s.push({severity:"med",title:`Tool results dominate: ${c.pct}% of context`,detail:`Top tools: ${z}. User text is only ${_}%. Large results crowd out conversation history.`,impact:"Structural"})}const d=e.contextLimit>0?Math.round(o.totalTokens/e.contextLimit*100):0;d>80?s.push({severity:"high",title:`Context utilization critical: ${d}%`,detail:`${_e(o.totalTokens)} of ${_e(e.contextLimit)} tokens. Overflow risk is elevated, and older messages may be dropped or summarized.`,impact:"Critical"}):d>60&&s.push({severity:"med",title:`Context utilization high: ${d}%`,detail:`${_e(o.totalTokens)} of ${_e(e.contextLimit)} tokens used.`,impact:"Monitor"});const m=t.indexOf(e);if(m>0){let S=-1;for(let _=m-1;_>=0;_--)if((I=n[_])!=null&&I.isMain){S=_;break}if(S>=0){const _=t[S].contextInfo.totalTokens;o.totalTokens<_*.7&&s.push({severity:"med",title:"Compaction detected",detail:`Tokens dropped ${_e(_)} → ${_e(o.totalTokens)}. Context was summarized or truncated — older details may be lost.`,impact:`-${_e(_-o.totalTokens)} tok`})}}const v=i.find(S=>S.category==="system_injections");v&&v.pct>5&&s.push({severity:"med",title:`System injections: ${v.pct}% of context`,detail:`${_e(v.tokens)} tokens of system-reminder blocks injected into messages. These are re-sent every turn, reducing space for actual conversation.`,impact:`${_e(v.tokens)} tok`});for(const S of e.securityAlerts||[]){const _=S.severity==="high"?"high":S.severity==="medium"?"med":"low",T=S.toolName?`tool result: ${S.toolName}`:`${S.role} message`;s.push({severity:_,title:`⚠ ${S.pattern.replace(/_/g," ")} in ${T} (msg ${S.messageIndex+1})`,detail:S.match,impact:S.severity,messageIndex:S.messageIndex,highlight:S.match})}return s}const Fp={class:"kpi-row"},zp={class:"kpi-card"},Bp={class:"kpi-value"},Hp={class:"kpi-card"},jp={class:"kpi-value accent-blue"},Vp={class:"kpi-card"},Up={class:"kpi-value"},Kp={class:"kpi-card"},Wp={class:"kpi-value accent-green"},qp={class:"kpi-card"},Gp={class:"kpi-value accent-amber"},Jp={class:"section-head"},Yp={class:"section-count"},Xp={class:"filter-group"},Zp={key:0,class:"filter-dropdown"},Qp=["onClick"],eh={class:"sort-group"},th={class:"table-wrap"},nh={class:"ledger"},sh={key:0,class:"col-select"},oh=["onClick"],ih={key:0,class:"col-select"},rh={class:"col-priority"},lh={class:"col-source"},ah={class:"col-model"},ch={class:"model-text"},uh={class:"col-dir"},dh=["title"],fh={class:"col-turns"},ph={class:"num"},hh={class:"col-context"},vh={class:"col-cost"},mh={class:"num green"},gh={class:"col-health"},yh={class:"health-cell"},_h={key:0,class:"health-tooltip"},bh={class:"health-tooltip-title"},wh={class:"health-audit-name"},kh={class:"col-spark"},xh=["innerHTML"],$h={class:"col-time"},Sh=["title"],Th={class:"col-arrow"},Ch=["href","onClick"],Mh=["colspan"],Eh={class:"expand-content"},Ph={class:"expand-inner"},Ih={key:0,class:"expand-loading"},Ah={key:0,class:"expand-section"},Lh={class:"expand-section-label"},Oh={class:"comp-tape"},Rh=["title"],Dh={key:0,class:"comp-seg-label"},Nh={class:"expand-section"},Fh={class:"finding-text"},zh={key:1,class:"finding"},Bh={key:0,class:"compare-bar"},Hh={class:"compare-bar-text"},jh={key:0,class:"dashboard-empty"},Vh={key:1,class:"dashboard-empty"},Uh=et({__name:"DashboardView",setup(e){const t=Lt(),n=me("recent"),s=me(new Set),o=me(!1),i=me(""),r=me(!1);We(()=>t.compareSessionIds.size,h=>{h===0&&r.value&&(r.value=!1)});function l(){r.value=!r.value,r.value||(t.compareSessionIds=new Set)}function c(h){return t.compareSessionIds.has(h)}function p(h){r.value?t.toggleCompareSession(h):ne(h)}const d=A(()=>t.compareSessionIds.size),m=me(null),v=A(()=>{const h=new Set;for(const a of t.summaries)a.source&&h.add(a.source);return Array.from(h).sort()});function w(h){return m.value?m.value.has(h):!0}function I(h){if(!m.value){const f=new Set(v.value);f.delete(h),f.size>0&&(m.value=f);return}const a=new Set(m.value);if(a.has(h)){if(a.delete(h),a.size===0)return}else a.add(h);a.size===v.value.length?m.value=null:m.value=a}const S=A(()=>m.value!==null),_=A(()=>m.value?`Source (${m.value.size})`:"Source"),T=A(()=>{let h=t.summaries;m.value&&(h=h.filter(f=>m.value.has(f.source)));const a=i.value.trim().toLowerCase();return a&&(h=h.filter(f=>[f.id,f.source,f.label,f.workingDirectory??"",f.latestModel].join("\0").toLowerCase().includes(a))),h}),z=A(()=>{let h=0;for(const a of T.value)h=Math.max(h,a.totalCost);return h}),K=A(()=>{const h=new Map;for(const a of T.value)h.set(a.id,Np(a,z.value));return h}),V=A(()=>{const h=[...T.value];return n.value==="priority"?h.sort((a,f)=>{var N,J;const E=((N=K.value.get(a.id))==null?void 0:N.score)??0;return(((J=K.value.get(f.id))==null?void 0:J.score)??0)-E}):n.value==="cost"&&h.sort((a,f)=>f.totalCost-a.totalCost),h}),Q=A(()=>T.value.length),D=A(()=>T.value.reduce((h,a)=>h+a.entryCount,0)),ae=A(()=>T.value.reduce((h,a)=>h+a.latestTotalTokens,0)),ue=A(()=>T.value.reduce((h,a)=>h+a.totalCost,0)),O=A(()=>{const h=T.value.filter(f=>{var E;return((E=f.healthScore)==null?void 0:E.overall)!=null});if(h.length===0)return 0;const a=h.reduce((f,E)=>{var q;return f+(((q=E.healthScore)==null?void 0:q.overall)??0)},0);return Math.round(a/h.length)});function R(h){return K.value.get(h)??{score:0,label:"Healthy",toneClass:"priority-healthy",barClass:"prio-healthy",risk:0,normalizedCost:0,tooltip:""}}function de(h){return h.contextLimit?h.latestTotalTokens/h.contextLimit:0}function F(h){return h>=.8?"util-high":h>=.6?"util-mid":"util-low"}function te(h){var f;const a=(f=h.healthScore)==null?void 0:f.rating;return a==="poor"?"health-bad":a==="needs-work"?"health-warn":"health-good"}function ce(h){return h>=90?"health-good":h>=50?"health-warn":"health-bad"}function B(h){const a=Date.now()-new Date(h).getTime();return a<6e4?"just now":a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:`${Math.floor(a/864e5)}d ago`}function se(h){const a=new Date(h),f=a.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),E=a.toLocaleDateString("en-CA");return`${f} on ${E}`}function oe(h){if(!h)return"";let a=h;/^\/home\/[^/]+(\/|$)/.test(a)?a=a.replace(/^\/home\/[^/]+/,"~"):/^\/Users\/[^/]+(\/|$)/.test(a)&&(a=a.replace(/^\/Users\/[^/]+/,"~"));const f=a.split("/");return f.length>2?f.slice(-2).join("/"):a}function W(h){return h==="prio-critical"?"#ef4444":h==="prio-warning"?"#f59e0b":"#0ea5e9"}function re(h,a){if(h.length===0)return"";const f=72,E=22,q=Math.max(...h);if(q===0)return"";const N=h.map((fe,ie)=>{const Z=h.length<=1?f/2:ie/(h.length-1)*f,ke=E-fe/q*(E-4)-2;return`${Z.toFixed(1)},${ke.toFixed(1)}`}),J=N.join(" ")+` ${f},${E} 0,${E}`,pe="sg"+a.replace("#","");return`<svg viewBox="0 0 ${f} ${E}" preserveAspectRatio="none" style="display:block;width:100%;height:100%"><defs><linearGradient id="${pe}" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="${a}" stop-opacity="0.15"/><stop offset="100%" stop-color="${a}" stop-opacity="0.02"/></linearGradient></defs><polygon points="${J}" fill="url(#${pe})"/><polyline points="${N.join(" ")}" fill="none" stroke="${a}" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/><circle cx="${N[N.length-1].split(",")[0]}" cy="${N[N.length-1].split(",")[1]}" r="2" fill="${a}"/></svg>`}function we(h){const a=h.tokenHistory;if(!a||a.length<2)return"";const f=R(h.id);return re(a,W(f.barClass))}const H=[{key:"system_prompt",label:"System",color:"var(--cat-system, #3b82f6)"},{key:"tool_definitions",label:"Tool defs",color:"var(--cat-tools, #ec4899)"},{key:"tool_results",label:"Tool results",color:"var(--cat-tool-results, #10b981)"},{key:"assistant_text",label:"Assistant",color:"var(--cat-assistant, #f59e0b)"},{key:"user_text",label:"User",color:"var(--cat-user, #06b6d4)"},{key:"thinking",label:"Thinking",color:"var(--cat-thinking, #8b5cf6)"},{key:"system_injections",label:"Injections",color:"var(--cat-injections, #6366f1)"}];function C(h){const a=t.loadedConversations.get(h.id);return!a||a.entries.length===0?[]:a.entries[0].composition||[]}function P(h){const a=t.loadedConversations.get(h.id);if(!a||a.entries.length===0)return[];const f=a.entries[0],E=[...a.entries].reverse(),q=Xt(E);return oc(f,E,q)}function ee(h){return s.value.has(h)}async function ne(h){const a=new Set(s.value);a.has(h)?a.delete(h):(a.add(h),t.loadedConversations.has(h)||await t.loadConversationEntries(h)),s.value=a}function $(){s.value=new Set}function L(h){return`#session/${encodeURIComponent(h)}?tab=overview`}function G(h){t.setInspectorTab("overview"),t.selectSession(h),t.setView("inspector")}function k(){o.value=!1}function g(h){h.key==="Escape"&&$()}return(h,a)=>(y(),b("div",{class:"dashboard",onKeydown:g,tabindex:"-1",onClick:k},[u("div",Fp,[u("div",zp,[u("div",Bp,M(Q.value),1),a[7]||(a[7]=u("div",{class:"kpi-label"},"Sessions",-1))]),u("div",Hp,[u("div",jp,M(D.value),1),a[8]||(a[8]=u("div",{class:"kpi-label"},"Requests",-1))]),u("div",Vp,[u("div",Up,M(Y(_e)(ae.value)),1),a[9]||(a[9]=u("div",{class:"kpi-label"},"Total Tokens",-1))]),u("div",Kp,[u("div",Wp,M(Y(bt)(ue.value)),1),a[10]||(a[10]=u("div",{class:"kpi-label"},"Total Cost",-1))]),u("div",qp,[u("div",Gp,M(O.value),1),a[11]||(a[11]=u("div",{class:"kpi-label"},"Avg Health",-1))])]),u("div",Jp,[a[15]||(a[15]=u("span",{class:"section-title"},"Sessions",-1)),u("span",Yp,M(T.value.length),1),Re(Dp,{modelValue:i.value,"onUpdate:modelValue":a[0]||(a[0]=f=>i.value=f),placeholder:"Filter by ID, directory, model…"},null,8,["modelValue"]),u("div",Xp,[u("button",{class:he(["compare-toggle",{active:r.value}]),onClick:l,title:"Select sessions to compare"},[...a[12]||(a[12]=[u("i",{class:"i-carbon-compare"},null,-1),xe(" Compare ",-1)])],2),v.value.length>1?(y(),b("div",Zp,[u("button",{class:he(["filter-btn",{"has-filter":S.value}]),onClick:a[1]||(a[1]=fn(f=>o.value=!o.value,["stop"]))},[xe(M(_.value)+" ",1),a[13]||(a[13]=u("span",{class:"caret"},null,-1))],2),o.value?(y(),b("div",{key:0,class:"filter-menu",onClick:a[2]||(a[2]=fn(()=>{},["stop"]))},[(y(!0),b(ve,null,Ce(v.value,f=>(y(),b("div",{key:f,class:he(["filter-option",{checked:w(f)}]),onClick:E=>I(f)},[a[14]||(a[14]=u("span",{class:"check"},[u("i",{class:"i-carbon-checkmark"})],-1)),u("span",{class:he(["source-badge",Y(Ss)(f)])},M(f),3)],10,Qp))),128))])):le("",!0)])):le("",!0),u("div",eh,[u("button",{class:he(["sort-btn",{active:n.value==="recent"}]),onClick:a[3]||(a[3]=f=>n.value="recent")},"Recent",2),u("button",{class:he(["sort-btn",{active:n.value==="priority"}]),onClick:a[4]||(a[4]=f=>n.value="priority")},"Priority",2),u("button",{class:he(["sort-btn",{active:n.value==="cost"}]),onClick:a[5]||(a[5]=f=>n.value="cost")},"Cost",2)])])]),u("div",th,[u("table",nh,[u("thead",null,[u("tr",null,[r.value?(y(),b("th",sh)):le("",!0),a[16]||(a[16]=u("th",{class:"col-priority"},null,-1)),a[17]||(a[17]=u("th",{class:"col-source"},"Source",-1)),a[18]||(a[18]=u("th",{class:"col-model"},"Model",-1)),a[19]||(a[19]=u("th",{class:"col-dir"},"Directory",-1)),a[20]||(a[20]=u("th",{class:"col-turns"},"Turns",-1)),a[21]||(a[21]=u("th",{class:"col-context sorted"},"Context",-1)),a[22]||(a[22]=u("th",{class:"col-cost"},"Cost",-1)),a[23]||(a[23]=u("th",{class:"col-health"},"Health",-1)),a[24]||(a[24]=u("th",{class:"col-spark"},"Trend",-1)),a[25]||(a[25]=u("th",{class:"col-time"},"Time",-1)),a[26]||(a[26]=u("th",{class:"col-arrow"},null,-1))])]),u("tbody",null,[(y(!0),b(ve,null,Ce(V.value,f=>{var E,q;return y(),b(ve,{key:f.id},[u("tr",{class:he(["main-row",{expanded:ee(f.id),selected:ee(f.id)||c(f.id),pulse:Y(t).recentlyUpdated.has(f.id)}]),onClick:N=>p(f.id)},[r.value?(y(),b("td",ih,[u("span",{class:he(["compare-check",{checked:c(f.id)}])},[...a[27]||(a[27]=[u("i",{class:"i-carbon-checkmark"},null,-1)])],2)])):le("",!0),u("td",rh,[u("div",{class:he(["priority-bar",R(f.id).barClass])},null,2)]),u("td",lh,[u("span",{class:he(["source-badge",Y(Ss)(f.source)])},M(f.source||"?"),3)]),u("td",ah,[u("span",ch,M(Y(tn)(f.latestModel)),1)]),u("td",uh,[u("span",{class:"dir-text",title:f.workingDirectory??""},M(oe(f.workingDirectory)),9,dh)]),u("td",fh,[u("span",ph,M(f.entryCount),1)]),u("td",hh,[u("span",{class:he(["util-chip",F(de(f))])},M(Math.round(de(f)*100))+"% ",3)]),u("td",vh,[u("span",mh,M(Y(bt)(f.totalCost)),1)]),u("td",gh,[u("div",yh,[u("span",{class:he(["health-num",te(f)])},M(((E=f.healthScore)==null?void 0:E.overall)??"—"),3),(q=f.healthScore)!=null&&q.audits?(y(),b("div",_h,[u("div",bh,"Health Score: "+M(f.healthScore.overall),1),(y(!0),b(ve,null,Ce(f.healthScore.audits,N=>(y(),b("div",{key:N.id,class:"health-audit-line"},[u("span",wh,M(N.name),1),u("span",{class:he(["health-audit-score",ce(N.score)])},M(N.score),3)]))),128))])):le("",!0)])]),u("td",kh,[u("div",{class:"inline-spark",innerHTML:we(f)},null,8,xh)]),u("td",$h,[u("span",{class:"time-text",title:se(f.latestTimestamp)},M(B(f.latestTimestamp)),9,Sh)]),u("td",Th,[u("a",{class:"inspect-btn",title:"Open in inspector",href:L(f.id),onClick:fn(N=>G(f.id),["prevent","stop"])},[...a[28]||(a[28]=[u("i",{class:"i-carbon-arrow-right"},null,-1)])],8,Ch)])],10,oh),u("tr",{class:he(["expand-row",{open:ee(f.id)}])},[u("td",{colspan:r.value?12:11},[u("div",Eh,[u("div",Ph,[Y(t).loadingSession===f.id?(y(),b("div",Ih," Loading… ")):(y(),b(ve,{key:1},[C(f).length>0?(y(),b("div",Ah,[u("div",Lh," Composition · "+M(Y(_e)(C(f).reduce((N,J)=>N+J.tokens,0)))+" tokens ",1),u("div",Oh,[(y(),b(ve,null,Ce(H,N=>{var J,pe,fe,ie;return He(u("div",{key:N.key,class:"comp-seg",style:Me({flex:((J=C(f).find(Z=>Z.category===N.key))==null?void 0:J.tokens)??0,background:N.color}),title:`${N.label}: ${((pe=C(f).find(Z=>Z.category===N.key))==null?void 0:pe.pct)??0}%`},[(((fe=C(f).find(Z=>Z.category===N.key))==null?void 0:fe.pct)??0)>=12?(y(),b("span",Dh,M(N.label),1)):le("",!0)],12,Rh),[[kd,(((ie=C(f).find(Z=>Z.category===N.key))==null?void 0:ie.tokens)??0)>0]])}),64))])])):le("",!0),u("div",Nh,[a[30]||(a[30]=u("div",{class:"expand-section-label"},"Findings",-1)),u("div",{class:he(["expand-findings",{"expand-findings--scroll":P(f).length>5}])},[P(f).length>0?(y(!0),b(ve,{key:0},Ce(P(f),(N,J)=>(y(),b("div",{key:J,class:"finding"},[u("i",{class:he(["finding-icon",[`sev-${N.severity}`,N.severity==="high"?"i-carbon-warning-alt":N.severity==="med"?"i-carbon-information":"i-carbon-checkmark"]])},null,2),u("span",Fh,[xe(M(N.title)+" ",1),N.impact?(y(),b("span",{key:0,class:he(["finding-impact",`sev-${N.severity}`])},M(N.impact),3)):le("",!0)])]))),128)):(y(),b("div",zh,[...a[29]||(a[29]=[u("i",{class:"finding-icon sev-low i-carbon-checkmark"},null,-1),u("span",{class:"finding-text muted"},"No issues detected.",-1)])]))],2)])],64))])])],8,Mh)],2)],64)}),128))])])]),Re(Bn,{name:"compare-bar"},{default:pt(()=>[r.value&&d.value>=2?(y(),b("div",Bh,[u("span",Hh,M(d.value)+" sessions selected",1),u("button",{class:"compare-bar-btn",onClick:a[6]||(a[6]=f=>Y(t).enterCompare())},[...a[31]||(a[31]=[u("i",{class:"i-carbon-compare"},null,-1),xe(" Compare ",-1)])])])):le("",!0)]),_:1}),V.value.length===0&&(i.value||m.value)?(y(),b("div",jh,[...a[32]||(a[32]=[u("div",{class:"empty-title"},"No matching sessions",-1),u("div",{class:"empty-sub"},"Try adjusting your search or filters",-1)])])):Y(t).summaries.length===0?(y(),b("div",Vh,[...a[33]||(a[33]=[u("div",{class:"empty-title"},"No requests captured",-1),u("div",{class:"empty-sub"},[xe("Point API calls to "),u("code",null,"localhost:4040")],-1)])])):le("",!0)],32))}}),Kh=ct(Uh,[["__scopeId","data-v-9ff64b6a"]]);function Bi(e){var i,r;const t=e.composition||[],n=t.reduce((l,c)=>l+c.tokens,0),s=new Map(t.map(l=>[l.category,l.tokens])),o=[];for(const[l,c]of Object.entries(jn)){let p=0;for(const d of c)p+=s.get(d)??0;p>0&&o.push({key:l,label:((i=gt[l])==null?void 0:i.label)??l,color:((r=gt[l])==null?void 0:r.color)??"#4b5563",tokens:p,pct:n>0?p/n*100:0})}return o.sort((l,c)=>c.tokens-l.tokens)}function Wh(e,t){const n=Bi(e);if(t.size===0)return n;const s=n.filter(i=>!t.has(i.key)),o=s.reduce((i,r)=>i+r.tokens,0);return s.map(i=>({...i,pct:o>0?i.tokens/o*100:0}))}function Vo(e,t){return t.size===0?e.contextInfo.totalTokens:Bi(e).filter(s=>!t.has(s.key)).reduce((s,o)=>s+o.tokens,0)}function qh(e,t){const n=t.findIndex(s=>s.entry.id===e);if(n<=0)return null;for(let s=n-1;s>=0;s--)if(t[s].isMain)return t[s].entry;return null}function Gh(e,t){const n=t.findIndex(i=>i.entry.id===e);if(n<0)return 0;let s=n;for(let i=n;i>=0;i--)if(t[i].isMain){s=i;break}let o=0;for(let i=s+1;i<t.length&&!t[i].isMain;i++)o++;return o}function Jh(e,t){var o,i;const n=new Map,s=1800;for(const r of e){const l=[],c=qh(r.entry.id,t);if(c&&r.isMain){const p=c.contextInfo.totalTokens,d=r.entry.contextInfo.totalTokens;p>0&&d<p*.75&&l.push({type:"compaction",label:"Compaction",detail:`${_e(p)} → ${_e(d)} total tokens`});const m=hi(c),v=hi(r.entry),w=m>0&&c.usage?c.usage.cacheReadTokens/m:null,I=v>0&&r.entry.usage?r.entry.usage.cacheReadTokens/v:null;if(w!==null&&I!==null){const T=I-w;Math.abs(T)>=.2&&l.push({type:"cache-shift",label:"Cache shift",detail:`${Math.round(w*100)}% → ${Math.round(I*100)}% hit rate`})}const S=((o=c.composition.find(T=>T.category==="tool_results"))==null?void 0:o.tokens)??0,_=((i=r.entry.composition.find(T=>T.category==="tool_results"))==null?void 0:i.tokens)??0;_-S>=s&&l.push({type:"tool-jump",label:"Tool jump",detail:`tool results +${_e(_-S)}`})}if(r.isMain){const p=Gh(r.entry.id,t);p>=3&&l.push({type:"subagent-burst",label:"Subagent burst",detail:`${p} subagent calls in this turn`})}l.length>0&&n.set(r.entry.id,l)}return n}function Yh(e){return e==="compaction"?"C":e==="cache-shift"?"H":e==="subagent-burst"?"S":"T"}function Xh(e,t){const n=e.map(s=>`${s.label}: ${s.detail}`).join(" | ");return`Turn ${t}: ${n}`}function ic(e,t){const n=t.findIndex(D=>D.entry.id===e.id);if(n<0)return null;const s=e.agentKey||"_default";let o=null;for(let D=n-1;D>=0;D--){const ae=t[D].entry;if((ae.agentKey||"_default")===s){o=ae;break}}if(!o)return null;const i=o.composition||[],r=e.composition||[],l=o.contextInfo.totalTokens,p=e.contextInfo.totalTokens-l,d=new Set;for(const D of i)d.add(D.category);for(const D of r)d.add(D.category);const m=[];for(const D of d){const ae=i.find(te=>te.category===D),ue=r.find(te=>te.category===D),O=ae?ae.tokens:0,R=ue?ue.tokens:0,de=R-O,F=Xe[D]||{label:D};m.push({category:D,label:F.label,delta:de,prevTokens:O,currTokens:R})}const v=[];for(const D of[...m].sort((ae,ue)=>Math.abs(ue.delta)-Math.abs(ae.delta)))D.delta===0?v.push({type:"same",text:` ${D.label}: ${_e(D.currTokens)} (unchanged)`,category:D.category,delta:D.delta}):D.prevTokens===0?v.push({type:"add",text:`+ ${D.label}: ${_e(D.currTokens)} (new)`,category:D.category,delta:D.delta}):D.currTokens===0?v.push({type:"remove",text:`- ${D.label}: ${_e(D.prevTokens)} (removed)`,category:D.category,delta:D.delta}):D.delta>0?v.push({type:"add",text:`+ ${D.label}: ${_e(D.prevTokens)} → ${_e(D.currTokens)} (+${_e(D.delta)})`,category:D.category,delta:D.delta}):v.push({type:"remove",text:`- ${D.label}: ${_e(D.prevTokens)} → ${_e(D.currTokens)} (${_e(D.delta)})`,category:D.category,delta:D.delta});const w=new Map;for(const[D,ae]of Object.entries(jn))for(const ue of ae)w.set(ue,D);const I=new Map,S=new Map;for(const D of m){const ae=w.get(D.category)??"other";I.set(ae,(I.get(ae)??0)+D.delta);const ue=S.get(ae);(!ue||Math.abs(D.delta)>ue.absDelta)&&S.set(ae,{category:D.category,absDelta:Math.abs(D.delta)})}const _=Array.from(I.entries()).map(([D,ae])=>{var ue,O;return{group:D,label:((ue=gt[D])==null?void 0:ue.label)??D,delta:ae,category:((O=S.get(D))==null?void 0:O.category)??""}}).filter(D=>D.delta!==0).sort((D,ae)=>Math.abs(ae.delta)-Math.abs(D.delta)),T=_.filter(D=>D.delta>0).slice(0,3),z=_.filter(D=>D.delta<0).slice(0,3);let K=0,V=0,Q=0;for(const D of t)(D.entry.agentKey||"_default")===s&&Q++,D.entry.id===o.id&&(K=Q),D.entry.id===e.id&&(V=Q);return{prevTurnNum:K,currTurnNum:V,delta:p,lines:v,topIncreases:T,topDecreases:z}}function Xr(e,t){const n=t?"0.85":"0.35";return/opus/i.test(e)?`rgba(251, 146, 60, ${n})`:/sonnet/i.test(e)?`rgba(96, 165, 250, ${n})`:/haiku/i.test(e)?`rgba(167, 139, 250, ${n})`:/gpt/i.test(e)?`rgba(16, 185, 129, ${n})`:`rgba(148, 163, 184, ${n})`}function Uo(e,t,n=3){return t===0?n:Math.max(n,Math.round(e/t*100))}function Ko(e,t=4){if(e===0)return[0];const n=e/t,s=Math.pow(10,Math.floor(Math.log10(n))),o=Math.ceil(n/s)*s,i=[];for(let r=0;r<=t;r++){const l=r*o;l<=e*1.1&&i.push(l)}return i}function Zh(e){return e>30?Math.ceil(e/15):1}function Qh(e){let t=0;return e.map(n=>(n.isMain&&t++,n.isMain?t:0))}function ev(e,t){return`${t?"":"Sub "}${tn(e.contextInfo.model)}: ${_e(e.contextInfo.totalTokens)} / ${bt(e.costUsd)}`}function tv(e,t){const n=Bi(e),s=e.contextInfo.totalTokens,o=n.map(i=>`${i.key===t.key?"▸ ":" "}${i.label}: ${_e(i.tokens)} (${i.pct.toFixed(1)}%)`);return o.push(` Total: ${_e(s)}`),o.join(`
25
25
  `)}function Zr(e,t){return t==="cost"?bt(e):_e(e)}function pi(e){if(!e.usage)return null;const t=hi(e);return t===0?null:e.usage.cacheReadTokens/t}function hi(e){return e.usage?e.usage.inputTokens+e.usage.cacheReadTokens+e.usage.cacheWriteTokens:0}function rc(e){const t={turnsRemaining:null,growthPerTurn:0,sinceCompaction:0,contextLimit:0,currentTokens:0};if(e.length===0)return t;const n=e.filter(S=>S.isMain).map(S=>S.entry);if(n.length<2)return t;const o=n[n.length-1].contextLimit;if(o<=0)return t;let i=0;for(let S=1;S<n.length;S++){const _=n[S-1].contextInfo.totalTokens,T=n[S].contextInfo.totalTokens;_>0&&T<_*.75&&(i=S)}const r=n.slice(i);if(r.length<2)return t;const l=r[0].contextInfo.totalTokens,c=r[r.length-1].contextInfo.totalTokens,p=c-l,d=r.length-1,m=p/d,v=c,w=o-v;let I=null;return m>0&&(I=Math.floor(w/m),I<0&&(I=0)),{turnsRemaining:I,growthPerTurn:m,sinceCompaction:r.length,contextLimit:o,currentTokens:v}}function nv(e){var c,p;const t=Math.round(e.utilization*100),n=e.healthScore,s=[...e.composition].sort((d,m)=>m.tokens-d.tokens)[0],o=e.topDelta;let i="narrative-neutral",r=`Context is at ${t}% utilization.`;(n==null?void 0:n.rating)==="poor"||t>=85?(i="narrative-advisory",r=`Turn health is elevated risk (${n?n.overall+"/100":t+"% utilization"}).`):(n==null?void 0:n.rating)==="needs-work"||t>=65?(i="narrative-advisory",r=`Turn health shows moderate pressure (${n?n.overall+"/100":t+"% utilization"}).`):n&&(r=`Turn health is stable at ${n.overall}/100.`);const l=[];if(s&&l.push(`${((c=Xe[s.category])==null?void 0:c.label)??s.category} is the largest share (${Math.round(s.pct)}%).`),o){const d=((p=Xe[o.category])==null?void 0:p.label)??o.category,m=o.delta>0?"grew":"shrank";l.push(`${d} ${m} most vs previous main turn (${_e(Math.abs(o.delta))}).`)}return{toneClass:i,headline:r,detail:l.join(" ")}}const sv={Read:{paramKeys:["file_path","path"],kind:"read"},Write:{paramKeys:["file_path","path"],kind:"write"},Edit:{paramKeys:["file_path","path"],kind:"write"},MultiEdit:{paramKeys:["file_path","path"],kind:"write"},read_file:{paramKeys:["path","file_path"],kind:"read"},write_file:{paramKeys:["path","file_path"],kind:"write"},read:{paramKeys:["path","file_path"],kind:"read"},write:{paramKeys:["path","file_path"],kind:"write"},edit:{paramKeys:["path","file_path"],kind:"write"},replace:{paramKeys:["file_path","path"],kind:"write"},readFile:{paramKeys:["path","filePath","file_path"],kind:"read"},writeFile:{paramKeys:["path","filePath","file_path"],kind:"write"},editFile:{paramKeys:["path","filePath","file_path"],kind:"write"},create_file:{paramKeys:["path","file_path"],kind:"write"},patch:{paramKeys:["path","file_path"],kind:"write"}};function ov(e){const t=sv[e.name];if(!t)return null;const n=e.input;if(!n||typeof n!="object")return null;for(const s of t.paramKeys){const o=n[s];if(typeof o=="string"&&o.length>0)return{path:iv(o),kind:t.kind}}return null}function iv(e){let t=e.replace(/\/+/g,"/");return t.startsWith("./")&&(t=t.slice(2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t}function lc(e,t){if(!t)return e;const n=t.endsWith("/")?t:t+"/";if(e.startsWith(n))return e.slice(n.length);const s=rv(e);return s?"~/"+e.slice(s.length):e}function rv(e){const t=e.match(/^(\/(?:home|Users)\/[^/]+\/)/);return t?t[1]:null}function lv(e,t){const n=new Map;for(const s of e){if(!s.contentBlocks)continue;const i=s.contentBlocks.filter(r=>r.type==="tool_use").length>0?(s.tokens||0)/s.contentBlocks.length:0;for(const r of s.contentBlocks){if(r.type!=="tool_use")continue;const l=r,c=ov(l);if(c&&l.id){const p=lc(c.path,t);n.set(l.id,{path:p,kind:c.kind,tokens:Math.round(i)})}}}return n}function ac(e,t){const n=new Set,s=new Map;function o(i){let r=s.get(i);return r||(r={path:i,tokens:0,reads:0,writes:0,toolResultTokens:0,toolCallTokens:0},s.set(i,r)),r}for(const i of e){const r=i.contextInfo.messages??[];if(r.length===0)continue;const l=lv(r,t);for(const[c,p]of l){if(n.has(c))continue;n.add(c);const d=o(p.path);d.toolCallTokens+=p.tokens,d.tokens+=p.tokens,p.kind==="read"?d.reads++:d.writes++}for(const c of r){if(!c.contentBlocks)continue;const p=c.contentBlocks.filter(m=>m.type==="tool_result");if(p.length===0)continue;const d=p.length>0?(c.tokens||0)/p.length:0;for(const m of p){if(m.type!=="tool_result")continue;const v=m.tool_use_id,w=l.get(v);if(!w||!n.has(v))continue;const I=o(w.path),S=Math.round(d);I.toolResultTokens+=S,I.tokens+=S}}}return Array.from(s.values()).filter(i=>i.tokens>0).sort((i,r)=>r.tokens-i.tokens)}function Hi(e){const t=e.split("/");return t[t.length-1]||e}function Qr(e){const t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}const el=["#3b82f6","#8b5cf6","#06b6d4","#10b981","#f59e0b","#ef4444","#ec4899","#14b8a6","#6366f1","#84cc16"];function vi(e){return el[e%el.length]}function av(e){var t=0,n=e.children,s=n&&n.length;if(!s)t=1;else for(;--s>=0;)t+=n[s].value;e.value=t}function cv(){return this.eachAfter(av)}function uv(e,t){let n=-1;for(const s of this)e.call(t,s,++n,this);return this}function dv(e,t){for(var n=this,s=[n],o,i,r=-1;n=s.pop();)if(e.call(t,n,++r,this),o=n.children)for(i=o.length-1;i>=0;--i)s.push(o[i]);return this}function fv(e,t){for(var n=this,s=[n],o=[],i,r,l,c=-1;n=s.pop();)if(o.push(n),i=n.children)for(r=0,l=i.length;r<l;++r)s.push(i[r]);for(;n=o.pop();)e.call(t,n,++c,this);return this}function pv(e,t){let n=-1;for(const s of this)if(e.call(t,s,++n,this))return s}function hv(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,s=t.children,o=s&&s.length;--o>=0;)n+=s[o].value;t.value=n})}function vv(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function mv(e){for(var t=this,n=gv(t,e),s=[t];t!==n;)t=t.parent,s.push(t);for(var o=s.length;e!==n;)s.splice(o,0,e),e=e.parent;return s}function gv(e,t){if(e===t)return e;var n=e.ancestors(),s=t.ancestors(),o=null;for(e=n.pop(),t=s.pop();e===t;)o=e,e=n.pop(),t=s.pop();return o}function yv(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function _v(){return Array.from(this)}function bv(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function wv(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*kv(){var e=this,t,n=[e],s,o,i;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,s=e.children)for(o=0,i=s.length;o<i;++o)n.push(s[o]);while(n.length)}function ji(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Sv)):t===void 0&&(t=$v);for(var n=new eo(e),s,o=[n],i,r,l,c;s=o.pop();)if((r=t(s.data))&&(c=(r=Array.from(r)).length))for(s.children=r,l=c-1;l>=0;--l)o.push(i=r[l]=new eo(r[l])),i.parent=s,i.depth=s.depth+1;return n.eachBefore(Cv)}function xv(){return ji(this).eachBefore(Tv)}function $v(e){return e.children}function Sv(e){return Array.isArray(e)?e[1]:null}function Tv(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Cv(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function eo(e){this.data=e,this.depth=this.height=0,this.parent=null}eo.prototype=ji.prototype={constructor:eo,count:cv,each:uv,eachAfter:fv,eachBefore:dv,find:pv,sum:hv,sort:vv,path:mv,ancestors:yv,descendants:_v,leaves:bv,links:wv,copy:xv,[Symbol.iterator]:kv};function Mv(e){if(typeof e!="function")throw new Error;return e}function Yn(){return 0}function Xn(e){return function(){return e}}function Ev(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Pv(e,t,n,s,o){for(var i=e.children,r,l=-1,c=i.length,p=e.value&&(s-t)/e.value;++l<c;)r=i[l],r.y0=n,r.y1=o,r.x0=t,r.x1=t+=r.value*p}function Iv(e,t,n,s,o){for(var i=e.children,r,l=-1,c=i.length,p=e.value&&(o-n)/e.value;++l<c;)r=i[l],r.x0=t,r.x1=s,r.y0=n,r.y1=n+=r.value*p}var Av=(1+Math.sqrt(5))/2;function Lv(e,t,n,s,o,i){for(var r=[],l=t.children,c,p,d=0,m=0,v=l.length,w,I,S=t.value,_,T,z,K,V,Q,D;d<v;){w=o-n,I=i-s;do _=l[m++].value;while(!_&&m<v);for(T=z=_,Q=Math.max(I/w,w/I)/(S*e),D=_*_*Q,V=Math.max(z/D,D/T);m<v;++m){if(_+=p=l[m].value,p<T&&(T=p),p>z&&(z=p),D=_*_*Q,K=Math.max(z/D,D/T),K>V){_-=p;break}V=K}r.push(c={value:_,dice:w<I,children:l.slice(d,m)}),c.dice?Pv(c,n,s,o,S?s+=I*_/S:i):Iv(c,n,s,S?n+=w*_/S:o,i),S-=_,d=m}return r}const Ov=(function e(t){function n(s,o,i,r,l){Lv(t,s,o,i,r,l)}return n.ratio=function(s){return e((s=+s)>1?s:1)},n})(Av);function Rv(){var e=Ov,t=!1,n=1,s=1,o=[0],i=Yn,r=Yn,l=Yn,c=Yn,p=Yn;function d(v){return v.x0=v.y0=0,v.x1=n,v.y1=s,v.eachBefore(m),o=[0],t&&v.eachBefore(Ev),v}function m(v){var w=o[v.depth],I=v.x0+w,S=v.y0+w,_=v.x1-w,T=v.y1-w;_<I&&(I=_=(I+_)/2),T<S&&(S=T=(S+T)/2),v.x0=I,v.y0=S,v.x1=_,v.y1=T,v.children&&(w=o[v.depth+1]=i(v)/2,I+=p(v)-w,S+=r(v)-w,_-=l(v)-w,T-=c(v)-w,_<I&&(I=_=(I+_)/2),T<S&&(S=T=(S+T)/2),e(v,I,S,_,T))}return d.round=function(v){return arguments.length?(t=!!v,d):t},d.size=function(v){return arguments.length?(n=+v[0],s=+v[1],d):[n,s]},d.tile=function(v){return arguments.length?(e=Mv(v),d):e},d.padding=function(v){return arguments.length?d.paddingInner(v).paddingOuter(v):d.paddingInner()},d.paddingInner=function(v){return arguments.length?(i=typeof v=="function"?v:Xn(+v),d):i},d.paddingOuter=function(v){return arguments.length?d.paddingTop(v).paddingRight(v).paddingBottom(v).paddingLeft(v):d.paddingTop()},d.paddingTop=function(v){return arguments.length?(r=typeof v=="function"?v:Xn(+v),d):r},d.paddingRight=function(v){return arguments.length?(l=typeof v=="function"?v:Xn(+v),d):l},d.paddingBottom=function(v){return arguments.length?(c=typeof v=="function"?v:Xn(+v),d):c},d.paddingLeft=function(v){return arguments.length?(p=typeof v=="function"?v:Xn(+v),d):p},d}const Dv={key:0,class:"panel panel--hero"},Nv={class:"panel-head"},Fv={class:"panel-sub"},zv={class:"mode-toggle"},Bv={class:"panel-body"},Hv={key:0,class:"treemap"},jv=["onClick"],Vv={class:"tm-label"},Uv={class:"tm-val"},Kv={key:1,class:"tm-label-compact"},Wv={key:2,class:"tm-pct"},qv={key:1,class:"treemap treemap-simple"},Gv=["onClick"],Jv={class:"tm-label"},Yv={class:"tm-val"},Xv={key:2,class:"treemap"},Zv=["onClick"],Qv={class:"tm-label"},em={class:"tm-val"},tm={key:1,class:"tm-label-compact"},nm={key:2,class:"tm-pct"},sm={class:"legend"},om={class:"legend-pct"},im={key:0,class:"legend-item"},rm={class:"legend-file-path"},lm={class:"legend-pct"},am={key:0,class:"legend-item"},cm={class:"legend-pct"},tl=5,nl=6,um=et({__name:"CompositionTreemap",props:{entry:{},turnNum:{}},emits:["categoryClick","toolClick","fileClick"],setup(e,{emit:t}){const n=e,s=Lt(),o=t,i=me("detailed"),r=me(null),l=A(()=>{var ce;const F=((ce=n.entry)==null?void 0:ce.composition)||[],te=[];for(const[B,se]of Object.entries(jn)){let oe=0;for(const W of se){const re=F.find(we=>we.category===W);re&&(oe+=re.tokens)}if(oe>0){const W=gt[B];te.push({key:B,label:W.label,color:W.color,tokens:oe})}}return te}),c=A(()=>{const F=n.entry;return F?F.composition.filter(te=>te.tokens>0).map(te=>{var ce,B;return{key:te.category,label:((ce=Xe[te.category])==null?void 0:ce.label)??te.category,color:((B=Xe[te.category])==null?void 0:B.color)??"#4b5563",tokens:te.tokens,category:te.category}}):[]});function p(F){const te=["#10b981","#34d399","#14b8a6","#2dd4bf","#10b981","#06b6d4","#0ea5e9"];return te[F%te.length]}const d=A(()=>{const F=n.entry;if(!F)return[];const te=F.contextInfo.messages||[],ce=xo(te),B=new Map;for(const se of te){if(Tt(se)!=="tool_results")continue;const oe=(se.contentBlocks||[]).filter(re=>re.type==="tool_result");if(oe.length===0)continue;const W=(se.tokens||0)/oe.length;for(const re of oe){const we=re.tool_use_id||"unknown",H=ce[we]||`tool:${we.slice(0,8)}`;B.set(H,(B.get(H)||0)+W)}}return Array.from(B.entries()).sort((se,oe)=>oe[1]-se[1]).map(([se,oe],W)=>({key:`tool-${se}-${W}`,label:se,color:p(W),tokens:Math.max(1,Math.round(oe)),category:"tool_results",toolName:se}))}),m=A(()=>r.value==="tool_results"&&d.value.length>0?d.value:c.value),v=A(()=>{const F=s.selectedSession;if(!F||F.entries.length===0)return[];const te=F.workingDirectory;return ac(F.entries,te).map((B,se)=>({key:`file-${B.path}-${se}`,label:Hi(B.path),color:vi(se),tokens:B.tokens,category:"files",toolName:B.path}))}),w=A(()=>V(v.value)),I=A(()=>v.value.length>0),S=A(()=>m.value.slice(0,tl)),_=A(()=>m.value.slice(tl)),T=A(()=>_.value.map(F=>`${F.label}: ${de(F.tokens)}`).join(`
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com">
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
10
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <script type="module" crossorigin src="/assets/index-BoiD5DJ2.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-JtXLWNzT.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-D1eb5Vsp.css">
13
13
  </head>
14
14
  <body>