opencode-rag-plugin 2.12.3 → 2.13.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.
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScatterPlot3D-CJpVHNv-.js","assets/vendor-Dg8wMT7C.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./vendor-Dg8wMT7C.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function p(){let e=location.hash.slice(1)||`dashboard`,t=e.indexOf(`?`),n=t>=0?e.slice(0,t):e,r={};if(t>=0){let n=e.slice(t+1);for(let e of n.split(`&`)){let t=e.indexOf(`=`);if(t>=0)try{r[decodeURIComponent(e.slice(0,t))]=decodeURIComponent(e.slice(t+1))}catch{}}}return{view:n||`dashboard`,params:r}}function m(){let[e,t]=s(p);return u(()=>{let e=()=>t(p());return addEventListener(`hashchange`,e),()=>removeEventListener(`hashchange`,e)},[]),e}var h=Symbol.for(`preact-signals`);function g(){if(S>1)S--;else{var e,t=!1;for((function(){var e=T;for(T=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();x!==void 0;){var n=x;for(x=void 0,C++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&O(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(C=0,S--,t)throw e}}function _(e){if(S>0)return e();w=++ee,S++;try{return e()}finally{g()}}var v,y=void 0;function b(e){var t=y,n=v;y=void 0,v=void 0;try{return e()}finally{y=t,v=n}}var x=void 0,S=0,C=0,ee=0,w=0,T=void 0,te=0;function ne(e){if(y!==void 0){var t=e.n;if(t===void 0||t.t!==y)return t={i:0,S:e,p:y.s,n:void 0,t:y,e:void 0,x:void 0,r:t},y.s!==void 0&&(y.s.n=t),y.s=t,e.n=t,32&y.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=y.s,t.n=void 0,y.s.n=t,y.s=t),t}}function E(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}E.prototype.brand=h,E.prototype.h=function(){return!0},E.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?b(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},E.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&b(function(){var e;(e=t.Z)==null||e.call(t)}))}},E.prototype.subscribe=function(e){var t=this;return j(function(){var n=t.value;b(function(){return e(n)})},{name:`sub`})},E.prototype.valueOf=function(){return this.value},E.prototype.toString=function(){return this.value+``},E.prototype.toJSON=function(){return this.value},E.prototype.peek=function(){var e=this;return b(function(){return e.value})},Object.defineProperty(E.prototype,"value",{get:function(){var e=ne(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(C>100)throw Error(`Cycle detected`);(function(e){S!==0&&C===0&&e.l!==w&&(e.l=w,T={S:e,v:e.v,i:e.i,o:T})})(this),this.v=e,this.i++,te++,S++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{g()}}}});function D(e,t){return new E(e,t)}function O(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function re(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ie(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function k(e,t){E.call(this,void 0,t),this.x=e,this.s=void 0,this.g=te-1,this.f=4}k.prototype=new E,k.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===te))return!0;if(this.g=te,this.f|=1,this.i>0&&!O(this))return this.f&=-2,!0;var e=y;try{re(this),y=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return y=e,ie(this),this.f&=-2,!0},k.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}E.prototype.S.call(this,e)},k.prototype.U=function(e){if(this.t!==void 0&&(E.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},k.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(k.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=ne(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ae(e,t){return new k(e,t)}function oe(e){var t=e.m;if(e.m=void 0,typeof t==`function`){S++;var n=y;y=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,se(e),t}finally{y=n,g()}}}function se(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,oe(e)}function ce(e){if(y!==this)throw Error(`Out-of-order effect`);ie(this),y=e,this.f&=-2,8&this.f&&se(this),g()}function A(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,v&&v.push(this)}A.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},A.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,oe(this),re(this),S++;var e=y;return y=this,ce.bind(this,e)},A.prototype.N=function(){2&this.f||(this.f|=2,this.u=x,x=this)},A.prototype.d=function(){this.f|=8,1&this.f||se(this)},A.prototype.dispose=function(){this.d()};function j(e,t){var n=new A(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var le,ue,M=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,de=[],fe=[];j(function(){le=this.N})();function N(e,t){r[e]=t.bind(null,r[e]||function(){})}function P(e){if(ue){var t=ue;ue=void 0,t()}ue=e&&e.S()}function pe(t){var n=this,r=t.data,i=he(r);i.name=`ReactiveDom`,i.value=r;var a=e(function(){for(var e=n,t=n.__v;t=t.__;)if(t.__c){t.__c.__$f|=4;break}var r=ae(function(){var e=i.value.value;return e===0?0:!0===e?``:e||``}),a=ae(function(){return!Array.isArray(r.value)&&!c(r.value)}),o=j(function(){if(this.N=xe,a.value){var t=r.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=n.__$u.d;return n.__$u.d=function(){o(),s.call(this)},[a,r]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}pe.displayName=`ReactiveTextNode`,Object.defineProperties(E.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:pe},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),N(`__b`,function(e,t){if(typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof E&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),N(`__r`,function(e,t){if(e(t),t.type!==n){P();var r,i=t.__c;i&&(i.__$f&=-2,(r=i.__$u)===void 0&&(i.__$u=r=function(e,t){var n;return j(function(){n=this},{name:t}),n.c=e,n}(function(){var e;M&&((e=r.y)==null||e.call(r)),i.__$f|=1,i.setState({})},typeof t.type==`function`?t.type.displayName||t.type.name:``))),P(r)}}),N(`__e`,function(e,t,n,r){P(),e(t,n,r)}),N(`diffed`,function(e,t){P();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=me(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function me(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=D(n);return{o:function(e,t){a.value=e,r=t},d:j(function(){this.N=xe;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}N(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),N(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),a.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function he(t,n){return e(function(){return D(t,n)},[])}var ge=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},_e=function(e){queueMicrotask(function(){queueMicrotask(e)})};function ve(){_(function(){for(var e;e=de.shift();)le.call(e)})}function ye(){de.push(this)===1&&(r.requestAnimationFrame||ge)(ve)}function be(){_(function(){for(var e;e=fe.shift();)le.call(e)})}function xe(){fe.push(this)===1&&(r.requestAnimationFrame||_e)(be)}function Se(e,t){var n=i(e);n.current=e,u(function(){return j(function(){return this.N=ye,n.current()},t)},[])}var Ce=D(`dashboard`),we=D(null),Te=D(null),Ee=D(null),De=D(0),Oe=D(50),F=D(new Set),ke=D(new Set),I=D(``),L=D({topK:10,minScore:.35,keywordWeight:.4,hybrid:!0,pathFilter:``,langFilter:``,extFilter:``}),Ae=D([]),je=D([]);D(!1),D(null),D([]),D(new Set),D(null),D(null);function Me(){if(typeof localStorage>`u`)return`dark`;let e=localStorage.getItem(`theme`);return e===`light`||e===`plasma`||e===`drama`?e:`dark`}var R=D(Me()),Ne=[`dark`,`plasma`,`drama`,`light`];function Pe(e){return Ne[(Ne.indexOf(e)+1)%Ne.length]??`dark`}var Fe=D(!0);function Ie(e){return Math.min(560,Math.max(180,Math.round(e)))}function Le(){if(typeof localStorage>`u`)return 256;let e=Number(localStorage.getItem(`sidebarWidth`));return Number.isFinite(e)&&e>0?Ie(e):256}var Re=D(Le());function ze(e){Re.value=Ie(e)}function Be(){try{localStorage.setItem(`sidebarWidth`,String(Re.value))}catch{}}var Ve=.62,He=.25,Ue=.85,We=.04;function Ge(e){return Number.isFinite(e)?Math.min(Ue,Math.max(He,e)):Ve}function Ke(){if(typeof localStorage>`u`)return Ve;let e=Number(localStorage.getItem(`embedPlotFrac`));return Number.isFinite(e)&&e>0?Ge(e):Ve}var qe=D(Ke());function Je(e){qe.value=Ge(e)}function Ye(){try{localStorage.setItem(`embedPlotFrac`,String(qe.value))}catch{}}var Xe=D([]),Ze=0;function z(e,t,n=4e3){let r=Ze++;Xe.value=[...Xe.value,{id:r,type:e,message:t,duration:n}],setTimeout(()=>{Xe.value=Xe.value.filter(e=>e.id!==r)},n)}function B(e){window.location.hash=e}function Qe(){return u(()=>{let e=document.documentElement;e.classList.toggle(`dark`,R.value===`dark`),e.classList.toggle(`theme-plasma`,R.value===`plasma`),e.classList.toggle(`theme-drama`,R.value===`drama`);try{localStorage.setItem(`theme`,R.value)}catch{}},[R.value]),{theme:R.value,toggle:()=>{R.value=Pe(R.value)}}}function $e(){u(()=>{let e=null,t=null,n=()=>{e&&=(clearTimeout(e),null),t&&=(window.removeEventListener(`keydown`,t),null)},r=r=>{let i=r.target,a=i.tagName===`INPUT`||i.tagName===`TEXTAREA`||i.isContentEditable;if((r.metaKey||r.ctrlKey)&&r.key===`,`)r.preventDefault(),B(`config`);else if((r.metaKey||r.ctrlKey)&&r.key===`k`)r.preventDefault(),B(`search`),setTimeout(()=>{document.querySelector(`.global-search-input`)?.focus()},0);else if(!a&&r.key===`g`){let r={d:()=>B(`dashboard`),s:()=>B(`search`),c:()=>B(`chunks`),f:()=>B(`files`),e:()=>B(`evaluate`),q:()=>B(`quirks`)};n();let i=e=>{r[e.key]?.(),n()};t=i,window.addEventListener(`keydown`,i),e=setTimeout(n,500)}};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),n()}},[])}function et(){return l(`div`,{className:`fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none`,children:Xe.value.map(e=>l(`div`,{className:`pointer-events-auto px-4 py-2.5 rounded-lg shadow-lg text-sm font-medium transition-all duration-300 animate-slide-in ${e.type===`success`?`bg-green-600 text-white`:e.type===`error`?`bg-red-600 text-white`:`bg-brand-600 text-white`}`,children:e.message},e.id))})}var tt=`/api`,nt=`opencode-rag-token`;function rt(){let e=new URLSearchParams(window.location.search).get(`token`);if(e){sessionStorage.setItem(nt,e);let t=window.location.pathname+window.location.hash;return window.history.replaceState(null,``,t),e}return sessionStorage.getItem(nt)}function it(){let e=rt();return e?{Authorization:`Bearer ${e}`}:{}}function at(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.toString()}var ot=class extends Error{status;code;fieldErrors;constructor(e,t,n={}){super(e),this.name=`ConfigApiError`,this.status=t,this.code=n.code,this.fieldErrors=n.fieldErrors}};async function V(e,t){let n={...t?.headers??{},...it()},r=await fetch(tt+e,{...t,headers:n}),i=await r.json();if(!r.ok)throw new ot(typeof i?.error==`string`?i.error:r.statusText,r.status,{code:typeof i?.code==`string`?i.code:void 0,fieldErrors:i?.fieldErrors&&typeof i.fieldErrors==`object`?i.fieldErrors:void 0});return i}var H={stats:()=>V(`/stats`),files:()=>V(`/files`),chunks:e=>V(`/chunks?${at(e)}`),chunk:e=>V(`/chunks/${encodeURIComponent(e)}`),search:(e,t=20)=>V(`/search?q=${encodeURIComponent(e)}&topK=${t}`),compare:e=>V(`/compare?ids=${e.join(`,`)}`),retrieve:e=>V(`/retrieve?${at(e)}`),evalSessions:()=>V(`/eval/sessions`),evalSession:e=>V(`/eval/sessions/${encodeURIComponent(e)}`),evalDeleteSession:e=>V(`/eval/sessions/${encodeURIComponent(e)}`,{method:`DELETE`}),evalCompare:(e,t)=>V(`/eval/compare?a=${e}&b=${t}`),evalTokenCompare:(e,t)=>V(`/eval/token-compare?a=${e}&b=${t}`),evalAnalysis:e=>V(`/eval/sessions/${encodeURIComponent(e)}/analysis`),evalProjectSavings:e=>V(`/eval/project-savings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),quirks:()=>V(`/quirks`),quirkLint:()=>V(`/quirks/lint`),deleteQuirk:e=>V(`/quirks/${encodeURIComponent(e)}`,{method:`DELETE`}),indexStatus:()=>V(`/indexing/status`),triggerReindex:()=>V(`/indexing/reindex`,{method:`POST`}),config:()=>V(`/config`),configLayers:()=>V(`/config`),patchConfig:e=>V(`/config`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),updateConfig:e=>V(`/config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),tree:()=>V(`/tree`),embeddingProj:(e=5e3,t=2)=>V(`/embeddings/projection?maxChunks=${e}&dims=${t}`)};function U(e){return e.join(`.`)}function st(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=n[e]}return n}function ct(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return!1;n=n[e]}return!0}function lt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>lt(e,t[n]));if(typeof e==`object`&&e&&t!==null){let n=e,r=t,i=Object.keys(n),a=Object.keys(r);return i.length===a.length&&i.every(e=>Object.hasOwn(r,e)&&lt(n[e],r[e]))}return!1}function ut(e){if(e===void 0)return`—`;if(e===null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`string`)return e.length>160?`${e.slice(0,157)}…`:e;if(Array.isArray(e)){let t=e.map(e=>String(e)).join(`, `);return t.length>160?`${t.slice(0,157)}…`:t||`(empty)`}let t=JSON.stringify(e);return t.length>160?`${t.slice(0,157)}…`:t}function dt(e,t){if(t!==void 0)switch(e.type){case`boolean`:return typeof t==`boolean`?void 0:`Must be true or false`;case`number`:return typeof t!=`number`||!Number.isFinite(t)?`Must be a number`:e.minimum!==void 0&&t<e.minimum?`Must be at least ${e.minimum}`:e.maximum!==void 0&&t>e.maximum?`Must be at most ${e.maximum}`:void 0;case`string`:return typeof t==`string`?void 0:`Must be text`;case`enum`:return typeof t==`string`?e.enumValues&&!e.enumValues.includes(t)?`Must be one of: ${e.enumValues.join(`, `)}`:void 0:`Must be text`;case`string[]`:return Array.isArray(t)&&t.every(e=>typeof e==`string`)?void 0:`Must be a list of strings`;case`stringMap`:return typeof t!=`object`||!t||Array.isArray(t)?`Must be an object mapping names to strings`:Object.values(t).every(e=>typeof e==`string`)?void 0:`Every value must be a string`;case`stringArrayMap`:return typeof t!=`object`||!t||Array.isArray(t)?`Must be an object mapping names to lists`:Object.values(t).every(e=>Array.isArray(e)&&e.every(e=>typeof e==`string`))?void 0:`Every value must be a list of strings`;case`json`:return}}function ft(e){switch(e){case`runtime`:return`Runtime`;case`project`:return`Project`;case`global`:return`Global`;case`default`:return`Default`;default:return`Unknown`}}var pt={set:{},unset:{}};function mt(){return typeof localStorage>`u`?!1:localStorage.getItem(`rag-config-advanced`)===`1`}var W=D(null),ht=D(!0),gt=D(null),_t=D(`project`),vt=D(mt()),yt=D(``),G=D({project:pt,global:pt}),K=D({}),bt=D(!1),xt=D(`idle`),St=D(null),Ct=D(null);function wt(e){vt.value=e;try{localStorage.setItem(`rag-config-advanced`,e?`1`:`0`)}catch{}}function Tt(e){G.value=e?{...G.value,[e]:pt}:{project:pt,global:pt}}async function Et(e=!0){e&&(ht.value=!0),gt.value=null;try{let e=await H.configLayers();W.value=e,Ot(e),Tt(),K.value={},xt.value=`idle`}catch(e){gt.value=e.message}finally{ht.value=!1}}var Dt=[`dark`,`light`,`plasma`,`drama`];function Ot(e){let t=e.config.ui,n=typeof t==`object`&&t?t.theme:void 0;typeof n==`string`&&Dt.includes(n)&&n!==R.value&&(R.value=n)}async function kt(e){try{W.value=await H.patchConfig({layer:`global`,operations:[{op:`set`,path:[`ui`,`theme`],value:e}]})}catch(e){z(`error`,`Theme applied locally — could not save to global config: ${e.message}`,6e3)}}function At(e,t,n){if(e)return st(e.layers[t].values,n)}function jt(e,t,n){if(!e)return;let r=U(n.path),i=G.value[t];if(Object.hasOwn(i.set,r))return i.set[r];if(n.secret)return;let a=st(e.layers[t].values,n.path);return a===void 0?st(e.config,n.path):a}function Mt(e,t,n){return e?ct(e.layers[t].values,n.path)?!0:n.secret===!0&&e.layers[t].secretSet[U(n.path)]===!0:!1}function Nt(e,t,n){if(!e||n.secret!==!0)return!1;let r=U(n.path),i=G.value[t];if(i.unset[r])return!1;let a=i.set[r];return typeof a==`string`&&a!==`***`||e.layers[t].secretSet[r]===!0}function Pt(e,t,n){let r=U(t.path),i=G.value[e],a={...i.set},o={...i.unset},s=W.value?At(W.value,e,t.path):void 0;if(n===void 0?(delete a[r],Mt(W.value,e,t)?o[r]=!0:delete o[r]):lt(n,s)?(delete a[r],delete o[r]):(a[r]=n,delete o[r]),G.value={...G.value,[e]:{set:a,unset:o}},K.value[r]){let e={...K.value};delete e[r],K.value=e}}function Ft(e,t){let n=U(t.path),r=G.value[e],i={...r.set},a={...r.unset};delete i[n],delete a[n],G.value={...G.value,[e]:{set:i,unset:a}}}function It(e,t){let n=U(t.path),r=G.value[e],i={...r.set},a={...r.unset};if(delete i[n],Mt(W.value,e,t)?a[n]=!0:delete a[n],G.value={...G.value,[e]:{set:i,unset:a}},K.value[n]){let e={...K.value};delete e[n],K.value=e}}function Lt(e,t){let n=W.value;if(!n)return[];let r=new Map(t.map(e=>[U(e.path),e])),i=G.value[e],a=[];for(let[t,o]of Object.entries(i.set)){let i=r.get(t);i&&(lt(At(n,e,i.path),o)||a.push({op:`set`,path:i.path,value:o}))}for(let t of Object.keys(i.unset)){let i=r.get(t);i&&Mt(n,e,i)&&a.push({op:`unset`,path:i.path})}return a}function Rt(e,t){return Lt(e,t).length}function zt(e,t){let n={...K.value};t?n[e]=t:delete n[e],K.value=n}async function Bt(e,t){let n=W.value;if(!n)return!1;let r=Lt(e,t);if(r.length===0)return z(`info`,`No changes to save`),!0;bt.value=!0,xt.value=`saving`,St.value=`Saving…`,K.value={};try{let t=await H.patchConfig({layer:e,operations:r,base:{[e]:{mtimeMs:n.layers[e].mtimeMs}}});return W.value=t,Tt(e),Ct.value=t.saved?.impact??`live`,xt.value=`saved`,St.value=`${r.length} change${r.length===1?``:`s`} saved`,z(`success`,`Configuration saved`),!0}catch(e){return e instanceof ot&&e.fieldErrors&&(K.value=e.fieldErrors),xt.value=`error`,St.value=e.message,z(`error`,e.message,6e3),!1}finally{bt.value=!1}}async function Vt(e){try{W.value=await H.patchConfig({layer:`runtime`,operations:[{op:`unset`,path:e}]}),z(`success`,`Runtime override cleared`)}catch(e){z(`error`,e.message,6e3)}}function Ht(e){let t=G.value.project,n={...t.unset},r={...t.set};for(let t of e){let e=t.split(`.`);delete r[t];let i=Ut(e);(i?Mt(W.value,`project`,i):ct(W.value?.layers.project.values??{},e))&&(n[t]=!0)}G.value={...G.value,project:{set:r,unset:n}},z(`info`,`${e.length} removal${e.length===1?``:`s`} queued — review and save the Project layer.`)}function Ut(e){let t=U(e);for(let e of W.value?.schema.sections??[])for(let n of e.fields)if(U(n.path)===t)return n}function Wt(e,t){if(e)return st(e.config,t.path)}var Gt={dark:{action:`Switch to dark mode`,title:`Dark mode`,color:`#64748b`},plasma:{action:`Switch to plasma mode`,title:`Plasma theme`,color:`#e879f9`},drama:{action:`Switch to drama mode`,title:`Drama theme`,color:`#fb923c`},light:{action:`Switch to light mode`,title:`Light mode`,color:`#fbbf24`}};function Kt(){let e=Pe(R.value),t=Gt[e];return l(`button`,{className:`p-2 rounded-lg transition-colors shrink-0`,style:{color:t.color},onClick:()=>{R.value=e,kt(e)},"aria-label":t.action,title:t.title,children:[l(`span`,{className:`sr-only`,children:t.action}),R.value===`dark`?l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z`})}):R.value===`plasma`?l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3zM19 15l.9 2.1L22 18l-2.1.9L19 21l-.9-2.1L16 18l2.1-.9L19 15z`})}):R.value===`drama`?l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 22c4.4 0 7.5-3 7.5-7 0-3-2-5.5-3.5-7C14.5 6.5 13 5 13 2c-3 2-5 4.5-5.5 7C6 10 4.5 12 4.5 15c0 4 3.1 7 7.5 7z`})}):l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z`})})]})}function qt(){let e=Ce.value===`config`;return l(`button`,{className:`p-2 rounded-lg transition-colors shrink-0`,style:{color:e?`var(--accent)`:`var(--text-muted)`,background:e?`var(--bg-tertiary)`:`transparent`},onClick:()=>{window.location.hash=`config`},"aria-label":`Configuration`,"aria-current":e?`page`:void 0,title:`Configuration (Ctrl/Cmd+,)`,children:l(`svg`,{className:`w-5 h-5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:[l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),l(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]})})}function Jt(e,t){let[n,r]=s(e);return u(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Yt={typescript:`text-blue-400`,javascript:`text-yellow-400`,python:`text-green-400`,java:`text-red-400`,go:`text-cyan-400`,rust:`text-orange-400`,ruby:`text-pink-400`,csharp:`text-purple-400`,cpp:`text-indigo-400`,c:`text-gray-400`,markdown:`text-gray-300`,html:`text-orange-300`,css:`text-blue-300`,json:`text-yellow-300`,kotlin:`text-purple-300`,swift:`text-orange-400`,tex:`text-emerald-400`,sql:`text-cyan-300`};function Xt(e){return Yt[e]??`text-slate-400`}function Zt(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${Xt(e)} bg-slate-800">${Qt(e)}</span>`}function Qt(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function q(e){return typeof e==`string`?e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`):``}function $t(e,t=80){let n=typeof e==`string`?e:String(e??``);return n.length>t?n.slice(0,t)+`...`:n}function en(){let[e,t]=s(``),[n,r]=s([]),[a,o]=s(!1),c=i(null),d=i(null),f=Jt(e,300);u(()=>{if(!f.trim()){r([]),o(!1);return}let e=!1;return H.search(f,10).then(t=>{e||(r(t?.results??[]),o(!0))}).catch(()=>{e||o(!1)}),()=>{e=!0}},[f]),u(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&o(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[]);let p=e=>{e.key===`Escape`&&o(!1)},m=async e=>{o(!1),t(``),B(`chunks`)};return l(`div`,{ref:d,className:`relative`,children:[l(`input`,{ref:c,type:`text`,placeholder:`Search codebase...`,value:e,onInput:e=>t(e.target.value),onKeyDown:p,className:`global-search-input w-56 px-3 py-1.5 bg-slate-800 border border-slate-600 rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Global search`,role:`combobox`,"aria-expanded":a}),a&&n.length>0&&l(`div`,{className:`absolute top-full right-0 mt-1 w-96 bg-slate-800 border border-slate-600 rounded-lg shadow-xl z-50 max-h-80 overflow-y-auto`,role:`listbox`,children:n.map(e=>l(`div`,{className:`search-result p-2 hover:bg-slate-700 cursor-pointer border-b border-slate-700 last:border-0`,onClick:()=>m(e.chunk.id),role:`option`,children:[l(`div`,{className:`flex items-center gap-2 text-xs`,children:[l(`span`,{className:`text-yellow-400 font-mono`,children:[q(e.chunk.filePath),`:`,e.chunk.startLine,`-`,e.chunk.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:Zt(e.chunk.language)}}),l(`span`,{className:`ml-auto text-slate-500`,children:e.score})]}),l(`div`,{className:`text-xs text-slate-400 mt-1 truncate`,children:q(e.chunk.content??``).slice(0,80)})]},e.chunk.id))}),a&&e.trim()&&n.length===0&&l(`div`,{className:`absolute top-full right-0 mt-1 w-96 bg-slate-800 border border-slate-600 rounded-lg shadow-xl z-50 p-3 text-sm text-slate-500`,children:`No results`})]})}function J(e,t=[]){let[n,r]=s(null),[i,a]=s(!0),[o,c]=s(null),[l,d]=s(0);return u(()=>{let t=!1;return a(!0),c(null),e().then(e=>{t||(r(e),a(!1))}).catch(e=>{t||(c(e.message),a(!1))}),()=>{t=!0}},[...t,l]),{data:n,isLoading:i,error:o,refresh:()=>d(e=>e+1)}}function tn(){let{data:e}=J(()=>H.files()),t=e??[],[n,r]=s(``),i=Jt(n,300),a=i?t.filter(e=>e.filePath.toLowerCase().includes(i.toLowerCase())):t;return l(`div`,{className:`flex flex-col h-full`,children:[l(`div`,{className:`flex items-center justify-between mb-2 px-3 pt-3`,children:[l(`h2`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wide`,children:`Files`}),l(`span`,{className:`text-xs text-slate-500`,children:a.length})]}),l(`div`,{className:`px-3 mb-2`,children:l(`input`,{type:`text`,placeholder:`Filter files...`,value:n,onInput:e=>r(e.target.value),className:`w-full px-2 py-1 bg-slate-900 border border-slate-700 rounded text-xs focus:outline-none focus:border-brand-400 text-slate-200 placeholder-slate-500`})}),l(`div`,{className:`flex-1 overflow-y-auto px-1`,children:l(nn,{files:a})})]})}function nn({files:e}){let t={};for(let n of e){let e=n.filePath.split(`/`),r=t;for(let t=0;t<e.length-1;t++)r[e[t]]||(r[e[t]]={}),r=r[e[t]];r.__files||(r.__files=[]),r.__files.push(n)}return l(an,{obj:t,depth:0,parentPath:``})}function rn(e){let t=(e.__files||[]).length;for(let[n,r]of Object.entries(e))n!==`__files`&&(t+=rn(r));return t}function an({obj:e,depth:t,parentPath:r}){let i=Object.entries(e).filter(([e])=>e!==`__files`).sort(([e],[t])=>e.localeCompare(t)),a=e.__files||[];return l(n,{children:[i.map(([e,n])=>{let i=r?`${r}/${e}`:e,a=rn(n),o=ke.value.has(i),s=o?`▸`:`▾`;return l(`div`,{children:[l(`div`,{className:`file-item flex items-center gap-1 py-0.5 px-2 rounded cursor-pointer text-slate-400 hover:text-white`,style:{paddingLeft:`${t*12+8}px`},onClick:()=>{let e=new Set(ke.value);e.has(i)?e.delete(i):e.add(i),ke.value=e},role:`treeitem`,"aria-expanded":!o,children:[l(`span`,{className:`text-xs`,children:s}),l(`span`,{className:`text-xs`,children:`📁`}),l(`span`,{className:`text-xs`,children:q(e)}),l(`span`,{className:`text-xs text-slate-600 ml-auto`,children:a})]}),!o&&l(`div`,{className:`dir-children`,children:l(an,{obj:n,depth:t+1,parentPath:i})})]},i)}),a.map(e=>{let n=e.filePath.split(`/`).pop()??e.filePath,r=we.value===e.filePath;return l(`div`,{className:`file-item flex items-center gap-1 py-0.5 px-2 rounded cursor-pointer ${r?`active text-white`:`text-slate-400 hover:text-white`}`,style:{paddingLeft:`${t*12+8}px`},onClick:()=>{we.value=e.filePath,B(`chunks?file=${encodeURIComponent(e.filePath)}`)},role:`treeitem`,tabIndex:0,children:[l(`span`,{className:`text-xs ${Xt(e.language)}`,children:`♦`}),l(`span`,{className:`text-xs truncate`,children:q(n)}),l(`span`,{className:`text-xs text-slate-600 ml-auto`,children:e.chunkCount})]},e.filePath)})]})}function on(e){let t=[...e].sort(),n=[];for(let e of t)n.some(t=>e.startsWith(`${t}/`))||n.push(e);return n}function sn(e,t){return t.includes(e)?`checked`:t.some(t=>t.startsWith(`${e}/`))?`partial`:`unchecked`}function cn(){let e=J(()=>H.tree()),t=J(()=>H.config()),[r,i]=s(!1),[a,o]=s([]),[c,d]=s([]),[f,p]=s(!1),[m,h]=s(!1),[g,_]=s(!1),v=t.data?.body?.config??t.data?.config,y=e.data?.body?.tree??e.data?.tree;u(()=>{if(v&&!f){let e=v.indexing?.includeDirs??[];o(e),d(e),p(!0)}},[v,f]);let b=on(a),x=on(c).join(`|`)!==b.join(`|`),S=b.length===0;function C(e){let t=new Set(a);if(sn(e,a)===`checked`)for(let n of a)(n===e||n.startsWith(`${e}/`))&&t.delete(n);else{t.add(e);for(let n of a)n.startsWith(`${e}/`)&&t.delete(n)}o([...t])}function ee(){o([])}async function w(){if(!m){h(!0);try{await H.updateConfig({indexing:{includeDirs:b}}),o(b),d(b),_(!0)}catch(e){z(`error`,`Failed to save scope: ${e.message}`)}finally{h(!1)}}}async function T(){_(!1),z(`info`,`Scope saved — starting reindex…`);try{await H.triggerReindex(),z(`success`,`Reindex started in the background.`)}catch(e){z(`error`,`Reindex failed to start: ${e.message}`)}}return l(`div`,{className:`border-b`,style:{borderColor:`var(--border)`},children:[l(`button`,{type:`button`,className:`w-full flex items-center gap-1 px-3 py-2 text-xs font-semibold text-slate-400 uppercase tracking-wide hover:text-white`,onClick:()=>i(e=>!e),"aria-expanded":r,children:[l(`span`,{className:`text-xs`,children:r?`▾`:`▸`}),l(`span`,{children:`Indexing scope`}),b.length>0&&l(`span`,{className:`ml-auto text-xs text-slate-500`,children:[b.length,` folder`,b.length===1?``:`s`]})]}),r&&l(`div`,{className:`px-2 pb-3 text-xs`,children:[e.error&&l(`p`,{className:`text-red-400 px-2 py-1`,children:[`Could not load workspace tree: `,e.error,l(`button`,{type:`button`,className:`ml-2 underline`,onClick:e.refresh,children:`Retry`})]}),!e.error&&!y&&l(`p`,{className:`px-2 py-1 text-slate-500`,children:`Loading folders…`}),y&&l(n,{children:[l(`label`,{className:`flex items-center gap-1.5 py-1 px-2 rounded cursor-pointer text-slate-300 hover:text-white`,children:[l(`input`,{type:`checkbox`,checked:S,onChange:ee}),l(`span`,{children:`Whole workspace`}),!S&&l(`span`,{className:`text-slate-500`,children:`(include all folders)`})]}),l(`p`,{className:`px-2 py-1 text-slate-600`,children:`Selecting a folder includes all of its subfolders. Files directly in the workspace root are only indexed with "Whole workspace".`}),l(`div`,{className:`max-h-48 overflow-y-auto border rounded`,style:{borderColor:`var(--border)`},children:l(ln,{dirs:y,depth:0,selection:a,onToggle:C})}),l(`button`,{type:`button`,disabled:!x||m,className:`mt-2 w-full px-3 py-1.5 rounded font-semibold disabled:opacity-40 disabled:cursor-not-allowed`,style:{background:`var(--accent)`,color:`#fff`},onClick:w,children:m?`Saving…`:x?`Save scope`:`Saved`}),l(`p`,{className:`mt-1.5 px-2 text-slate-600`,children:[`Saved to `,l(`code`,{children:`opencode-rag.json`}),`. The background watcher applies the new scope after an OpenCode restart.`]})]})]}),g&&l(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:l(`div`,{className:`rounded-lg p-5 max-w-sm w-full shadow-xl`,style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`},children:[l(`h3`,{className:`text-base font-bold mb-2`,children:`Scope saved`}),l(`p`,{className:`text-sm mb-4`,style:{color:`var(--text-muted)`},children:`The includeDirs setting was written to opencode-rag.json. Reindex now so the index matches the new scope?`}),l(`div`,{className:`flex justify-end gap-2`,children:[l(`button`,{type:`button`,className:`px-3 py-1.5 rounded text-sm`,style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`},onClick:()=>{_(!1),z(`success`,`Scope saved — applies on the next index pass.`)},children:`Later`}),l(`button`,{type:`button`,className:`px-3 py-1.5 rounded text-sm font-semibold text-white`,style:{background:`var(--accent)`},onClick:T,children:`Reindex now`})]})]})})]})}function ln({dirs:e,depth:t,selection:r,onToggle:i}){return l(n,{children:e.map(e=>{let n=sn(e.path,r);return l(`div`,{children:[l(`label`,{className:`flex items-center gap-1.5 py-0.5 px-2 rounded cursor-pointer text-slate-400 hover:text-white`,style:{paddingLeft:`${t*12+8}px`},children:[l(`input`,{type:`checkbox`,checked:n===`checked`,ref:e=>{e&&(e.indeterminate=n===`partial`)},onChange:()=>i(e.path)}),l(`span`,{className:`text-xs`,children:`📁`}),l(`span`,{className:`text-xs truncate`,children:e.name})]}),e.children.length>0&&l(ln,{dirs:e.children,depth:t+1,selection:r,onToggle:i})]},e.path)})})}function un(e){let t=i(null),[n,r]=s(!1);Se(()=>{let t=e.current;t&&(t.style.width=`${Re.value}px`)});let a=()=>{t.current=null,r(!1),document.body.style.cursor=``,document.body.style.userSelect=``},o=e=>{if(e.button===0){try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}t.current={pointerId:e.pointerId,startX:e.clientX,startWidth:Re.peek()},r(!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`}},c=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&ze(n.startWidth+(e.clientX-n.startX))},l=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&(a(),Be())};return{dragging:n,handleProps:{onPointerDown:o,onPointerMove:c,onPointerUp:l,onPointerCancel:l,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowLeft`?-16:16;ze(Re.peek()+t),Be()},onDblClick:()=>{ze(256),Be()}}}}function dn({targetRef:e}){let{dragging:t,handleProps:n}=un(e);return l(`div`,{className:`sidebar-resizer hidden lg:block ${t?`dragging`:``}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize file tree`,"aria-valuemin":180,"aria-valuemax":560,"aria-valuenow":Re.value,tabIndex:0,title:`Drag to resize · double-click to reset`,...n})}var Y=`bg-gradient-to-r from-slate-700 via-slate-600 to-slate-700 bg-[length:200%_100%]`;function X({type:e=`card`}){return l(`div`,{className:`animate-pulse space-y-4`,children:[l(`div`,{className:`h-8 ${Y} rounded w-48`}),e===`card`&&l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[1,2,3,4].map(e=>l(`div`,{className:`h-24 bg-slate-800 rounded-lg border border-slate-700 p-4`,children:[l(`div`,{className:`h-3 ${Y} rounded w-16 mb-2`}),l(`div`,{className:`h-6 ${Y} rounded w-24`})]},e))}),e===`table`&&l(`div`,{className:`space-y-2`,children:[l(`div`,{className:`h-10 ${Y} rounded w-full`}),[1,2,3,4,5].map(e=>l(`div`,{className:`h-8 ${Y} rounded w-full`},e))]}),e===`chart`&&l(`div`,{className:`h-64 ${Y} rounded-lg`}),e===`detail`&&l(`div`,{className:`flex gap-4`,children:[l(`div`,{className:`flex-1 space-y-3`,children:[l(`div`,{className:`h-6 ${Y} rounded w-48`}),l(`div`,{className:`h-4 ${Y} rounded w-32`}),l(`div`,{className:`h-32 ${Y} rounded-lg`})]}),l(`div`,{className:`flex-1 space-y-3`,children:[l(`div`,{className:`h-6 ${Y} rounded w-48`}),l(`div`,{className:`h-4 ${Y} rounded w-32`}),l(`div`,{className:`h-32 ${Y} rounded-lg`})]})]})]})}function Z({message:e,onRetry:t}){return l(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,role:`alert`,children:[l(`span`,{className:`text-4xl mb-3`,children:`⚠️`}),l(`p`,{className:`text-slate-400 mb-4`,children:e}),t&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors`,onClick:t,children:`Retry`})]})}function fn({icon:e,message:t,action:n}){return l(`div`,{className:`flex flex-col items-center justify-center py-16 text-center`,role:`status`,children:[l(`span`,{className:`text-5xl mb-4`,role:`img`,"aria-label":e,children:e}),l(`p`,{className:`text-slate-400 mb-4`,children:t}),n&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors`,onClick:n.onClick,children:n.label})]})}function Q({label:e,value:t,icon:n}){return l(`div`,{className:`kpi-card p-4`,children:[n&&l(`span`,{className:`text-lg mb-1 block`,children:n}),l(`div`,{className:`text-slate-400 text-xs mb-1`,children:e}),l(`div`,{className:`text-3xl font-bold text-white`,children:t})]})}function $(e){return e>=1e6?(e/1e6).toFixed(1)+`M`:e>=1e3?(e/1e3).toFixed(1)+`k`:String(e)}function pn(e){return e===0?`$0.00`:e<.01?`$`+e.toFixed(4):`$`+e.toFixed(2)}function mn(e){return e>=6e4?(e/6e4).toFixed(1)+`m`:e>=1e3?(e/1e3).toFixed(1)+`s`:e+`ms`}function hn(e){if(!e)return`-`;let t=new Date(e);return t.toLocaleDateString()+` `+t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function gn(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function _n(){let[e,t]=s(null),[n,r]=s(!0),[a,o]=s(!1),c=i(null),d=async()=>{try{let e=await H.indexStatus();t(e.body??e)}catch{}r(!1)};u(()=>{d()},[]),u(()=>()=>{c.current&&clearInterval(c.current)},[]);let f=async()=>{o(!0);try{await H.triggerReindex(),z(`info`,`Reindex started in background`);let n=e?.manifest?.lastIndexedAt,r=Date.now();c.current=setInterval(async()=>{if(Date.now()-r>6e5)c.current&&clearInterval(c.current),c.current=null,o(!1),z(`info`,`Reindex is still running — check back later`);else try{let e=await H.indexStatus(),r=e.body??e;r.manifest?.lastIndexedAt!==n&&(c.current&&clearInterval(c.current),c.current=null,t(r),o(!1),z(`success`,`Reindex complete!`))}catch{}},2e3)}catch(e){let t=e.message??``;z(`error`,/already running/i.test(t)?`A reindex is already running`:`Reindex failed: ${t}`),o(!1)}};if(n)return null;let p=e?.manifest?.lastIndexedAt?gn(e.manifest.lastIndexedAt):`Never`,m=e?.staleFileCount??0,h=m===0?`text-green-400`:m<50?`text-amber-400`:`text-red-400`;return l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`div`,{className:`flex items-center justify-between mb-3`,children:l(`h2`,{className:`text-lg font-semibold`,children:`Index Status`})}),e?.manifest?l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4`,children:[l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Last Indexed`}),l(`span`,{className:`text-sm font-mono`,children:p})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Total Chunks`}),l(`span`,{className:`text-sm font-mono`,children:$(e.manifest.totalChunks)})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Total Files`}),l(`span`,{className:`text-sm font-mono`,children:$(e.manifest.totalFiles)})]}),l(`div`,{children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Schema Version`}),l(`span`,{className:`text-sm font-mono`,children:e.manifest.schemaVersion})]}),l(`div`,{className:`col-span-2`,children:[l(`span`,{className:`text-xs text-slate-500 block`,children:`Index Freshness`}),l(`span`,{className:`text-sm font-mono ${h}`,children:m===0?`✓ Up to date`:`⚠ ${m} file${m===1?``:`s`} modified since last index`})]}),l(`div`,{className:`col-span-2 flex items-end`,children:a?l(`div`,{className:`flex items-center gap-2`,children:[l(`span`,{className:`animate-spin`,children:`⟳`}),l(`span`,{className:`text-sm text-amber-400`,children:`Reindexing...`})]}):l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-4 py-1.5 rounded text-sm transition-colors`,onClick:f,children:`Reindex Now`})})]}):l(`div`,{className:`text-sm text-slate-400`,children:[`No index found. Run `,l(`code`,{className:`text-brand-400`,children:`opencode-rag index`}),` first.`]})]})}function vn(){let{data:e,isLoading:t,error:n,refresh:r}=J(()=>H.stats()),{data:i}=J(()=>H.files());if(t)return l(X,{type:`card`});if(n)return l(Z,{message:n,onRetry:r});if(!e)return l(fn,{icon:`📊`,message:`No dashboard data available.`});let a=e,o=i?.body?.length??a.totalFiles??0,s=a.totalChunks??0,c=a.languages?.length??0,u=o>0?(s/o).toFixed(1):`0`,d=(a.languages??[]).slice(0,8),f=d[0]?.count??1;return l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-6`,children:`Dashboard`}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8`,children:[l(Q,{label:`Total Chunks`,value:s.toLocaleString(),icon:`🧩`}),l(Q,{label:`Total Files`,value:o.toLocaleString(),icon:`📄`}),l(Q,{label:`Languages`,value:c,icon:`🔤`}),l(Q,{label:`Avg Chunks/File`,value:u,icon:`📊`})]}),l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Language Distribution`}),l(`div`,{className:`space-y-2`,children:d.map(e=>l(`div`,{className:`flex items-center gap-3`,children:[l(`span`,{className:`w-24 text-xs text-right ${Xt(e.language)}`,children:e.language}),l(`div`,{className:`flex-1 bg-slate-800 rounded-full h-5 overflow-hidden`,children:l(`div`,{className:`h-full rounded-full bg-brand-500 flex items-center pl-2`,style:{width:`${Math.max(8,e.count/f*100)}%`},children:l(`span`,{className:`text-xs font-medium text-white`,children:e.count})})}),l(`span`,{className:`text-xs text-slate-500 w-12 text-right`,children:[(e.count/s*100).toFixed(0),`%`]})]},e.language))})]}),l(_n,{}),l(`div`,{className:`mt-6`,children:l(`h2`,{className:`text-lg font-semibold mb-3`,children:l(`a`,{href:`#config`,className:`hover:text-brand-400 transition-colors`,children:`Configuration`})})})]})}function yn({text:e,color:t,onDismiss:n}){return l(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-mono bg-slate-800 ${t??`text-slate-400`}`,children:[e,n&&l(`button`,{className:`ml-0.5 text-slate-500 hover:text-white`,onClick:n,"aria-label":`Dismiss ${e} filter`,children:`×`})]})}function bn(){let e=m();u(()=>{e.params.file&&(we.value=e.params.file),e.params.lang&&(Te.value=e.params.lang)},[e.params.file,e.params.lang]);let t=De.value,n=Oe.value,r=we.value,i=Te.value,{data:a,isLoading:o,error:s,refresh:c}=J(()=>H.chunks({offset:t,limit:n,lang:i??``,file:r??``}),[t,n,r,i]);if(o)return l(X,{type:`detail`});if(s)return l(Z,{message:s,onRetry:c});let d=a?.chunks??[],f=a?.total??d.length,p=Math.ceil(f/n),h=Math.floor(t/n)+1;return l(`div`,{className:`flex gap-4 h-full`,children:[l(`div`,{className:`w-1/2 flex flex-col`,children:[l(`div`,{className:`flex items-center gap-3 mb-3 flex-wrap`,children:[l(`h2`,{className:`text-lg font-semibold text-white`,children:`Chunks`}),l(`span`,{className:`text-sm text-slate-400`,children:[f,` total`]}),Te.value&&l(yn,{text:Te.value,color:Xt(Te.value),onDismiss:()=>{Te.value=null,Ee.value=null,De.value=0}}),we.value&&l(yn,{text:we.value,onDismiss:()=>{we.value=null,Ee.value=null,De.value=0}})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden flex-1`,children:l(`table`,{className:`w-full text-sm`,role:`table`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-2 py-2 w-8`,children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:d.length>0&&d.every(e=>F.value.has(e.id||`chunk-${d.indexOf(e)}`)),onChange:()=>{let e=d.map((e,t)=>e.id||`chunk-${t}`),t=e.every(e=>F.value.has(e)),n=new Set(F.value);for(let r of e)t?n.delete(r):n.add(r);F.value=n},"aria-label":`Select all chunks on this page`})}),l(`th`,{className:`px-3 py-2 text-left`,children:`File`}),l(`th`,{className:`px-3 py-2 text-left w-20`,children:`Lang`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Description`})]})}),l(`tbody`,{children:d.length===0?l(`tr`,{children:l(`td`,{colSpan:4,className:`px-3 py-8 text-center text-slate-500`,children:[l(`span`,{className:`text-2xl block mb-2`,children:`🔍`}),`No chunks found`]})}):d.map((e,t)=>{let n=e.id||`chunk-${t}`,r=Ee.value===n,i=F.value.has(n);return l(`tr`,{className:`chunk-row border-t border-slate-800 cursor-pointer ${r?`selected`:``}`,onClick:()=>{Ee.value=n},role:`row`,tabIndex:0,children:[l(`td`,{className:`px-2 py-2`,onClick:e=>e.stopPropagation(),children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:i,onChange:()=>{let e=new Set(F.value);e.has(n)?e.delete(n):e.add(n),F.value=e},"aria-label":`Select chunk ${n}`})}),l(`td`,{className:`px-3 py-2 text-yellow-400 font-mono text-xs`,children:[q(e.filePath),`:`,e.startLine,`-`,e.endLine]}),l(`td`,{className:`px-3 py-2`,dangerouslySetInnerHTML:{__html:Zt(e.language)}}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:q(e.description??``).slice(0,50)})]},n)})})]})}),l(`div`,{className:`flex items-center justify-between mt-3`,children:[l(`button`,{className:`px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50`,disabled:h<=1,onClick:()=>{De.value=Math.max(0,t-n)},children:`Previous`}),l(`span`,{className:`text-sm text-slate-400`,children:[`Page `,h,` of `,p||1]}),l(`button`,{className:`px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50`,disabled:h>=p,onClick:()=>{De.value+=n},children:`Next`})]}),F.value.size>=2&&F.value.size<=3&&l(`div`,{className:`fixed bottom-6 right-6 z-50`,children:l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-6 py-3 rounded-full shadow-lg font-bold transition-all transform hover:scale-105`,onClick:()=>{let e=[...F.value];F.value=new Set,B(`compare?ids=${e.join(`,`)}`)},children:[`Compare (`,F.value.size,`)`]})})]}),l(`div`,{className:`w-1/2 overflow-y-auto`,children:Ee.value?l(xn,{chunkId:Ee.value,chunks:d}):l(`div`,{className:`flex items-center justify-center h-full text-slate-500`,children:l(`div`,{className:`text-center`,children:[l(`div`,{className:`text-4xl mb-2`,children:`📄`}),l(`div`,{className:`text-sm`,children:`Select a chunk to view details`})]})})})]})}function xn({chunkId:e,chunks:t}){let[n,r]=s(null),[a,o]=s(!1),c=i(null);if(u(()=>{let n=!1,i=t.find(t=>t.id===e);return i?r(i):H.chunk(e).then(e=>{n||r(e)}).catch(()=>{n||r({id:e,content:``,filePath:`not found`,language:``,startLine:0,endLine:0,description:``})}),()=>{n=!0}},[e,t]),u(()=>()=>{c.current&&clearTimeout(c.current)},[]),!n)return l(X,{type:`detail`});let d=n,f=d.language===`image`;return l(`div`,{children:[l(`div`,{className:`mb-3`,children:[l(`div`,{className:`flex items-center gap-3 mb-1`,children:l(`span`,{className:`text-yellow-400 font-mono text-sm`,children:q(d.filePath)})}),l(`div`,{className:`flex items-center gap-3 text-sm text-slate-400`,children:[l(`span`,{children:[`Lines `,d.startLine,`-`,d.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:Zt(d.language)}}),d.id&&l(`span`,{className:`text-xs text-slate-600 font-mono`,children:d.id})]})]}),d.description&&l(`div`,{className:`kpi-card p-3 mb-3`,children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Description`}),l(`p`,{className:`text-sm text-slate-300`,children:q(d.description)})]}),f&&l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden mb-3`,children:[l(`div`,{className:`px-3 py-1.5 bg-slate-800 border-b border-slate-700`,children:l(`span`,{className:`text-xs text-slate-400`,children:`Image Preview`})}),l(`div`,{className:`p-3 flex items-center justify-center bg-slate-950`,children:l(`img`,{src:`/api/file?path=${encodeURIComponent(d.filePath)}`,alt:d.filePath,className:`max-w-full max-h-[60vh] object-contain rounded`,onError:e=>{let t=e.currentTarget;t.style.display=`none`,t.parentElement.innerHTML=`<span class="text-slate-500 text-sm">Image not available</span>`}})})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden`,children:[l(`div`,{className:`px-3 py-1.5 bg-slate-800 border-b border-slate-700 flex items-center justify-between`,children:[l(`span`,{className:`text-xs text-slate-400`,children:f?`Vision Analysis`:`Source Code`}),l(`button`,{className:`text-xs text-slate-500 hover:text-white transition-colors`,onClick:()=>{navigator.clipboard.writeText(d.content).then(()=>{o(!0),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>o(!1),1500)})},children:a?`Copied!`:`Copy`})]}),l(`pre`,{className:`p-3 overflow-x-auto text-sm max-h-[calc(100vh-220px)]`,children:l(`code`,{className:`language-${f?`text`:d.language}`,children:q(d.content)})})]})]})}function Sn(){let{data:e,isLoading:t,error:n,refresh:r}=J(()=>H.files());if(t)return l(X,{type:`table`});if(n)return l(Z,{message:n,onRetry:r});let i=e??[];if(i.length===0)return l(fn,{icon:`📂`,message:`No files indexed yet.`});let a=i.reduce((e,t)=>e+t.chunkCount,0);return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Files`}),l(`span`,{className:`text-sm text-slate-400`,children:[i.length,` files, `,a,` chunks`]})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-hidden`,children:l(`table`,{className:`w-full text-sm`,role:`table`,"aria-label":`Indexed files`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-3 py-2 text-left`,children:`File`}),l(`th`,{className:`px-3 py-2 text-left w-28`,children:`Language`}),l(`th`,{className:`px-3 py-2 text-left w-20`,children:`Chunks`}),l(`th`,{className:`px-3 py-2 text-left w-24`})]})}),l(`tbody`,{children:i.map(e=>l(`tr`,{className:`border-t border-slate-800 hover:bg-slate-800 cursor-pointer`,onClick:()=>B(`chunks?file=${encodeURIComponent(e.filePath)}`),role:`row`,tabIndex:0,onKeyDown:t=>{t.key===`Enter`&&B(`chunks?file=${encodeURIComponent(e.filePath)}`)},children:[l(`td`,{className:`px-3 py-2 text-yellow-400 font-mono text-xs`,children:e.filePath}),l(`td`,{className:`px-3 py-2`,dangerouslySetInnerHTML:{__html:Zt(e.language)}}),l(`td`,{className:`px-3 py-2 text-slate-300`,children:e.chunkCount}),l(`td`,{className:`px-3 py-2 text-slate-500 text-xs`,children:l(`span`,{className:`hover:text-white transition-colors`,children:`View chunks`})})]},e.filePath))})]})})]})}function Cn({segments:e,size:t=180,innerRadius:n,centerLabel:r}){let i=t/2,a=t/2,o=t/2-10,s=n??o*.6,c=e.reduce((e,t)=>e+t.value,0);if(c===0)return l(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,children:[l(`circle`,{cx:i,cy:a,r:o,fill:`none`,stroke:`#334155`,"stroke-width":o-s}),l(`circle`,{cx:i,cy:a,r:s,fill:`#0f172a`})]});let u=0,d=e.map(e=>{let t=e.value/c*360,n=u,r=u+t;return u+=t,`<path d="${wn(i,a,o,n,r,s)}" fill="${e.color}" />`}).join(``),f=r??``;return l(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`chart-svg`,children:[l(`g`,{dangerouslySetInnerHTML:{__html:d}}),l(`text`,{x:i,y:a-6,"text-anchor":`middle`,fill:`white`,"font-size":`22`,"font-weight":`bold`,children:f}),l(`text`,{x:i,y:a+14,"text-anchor":`middle`,fill:`#64748b`,"font-size":`11`,children:`tokens`})]})}function wn(e,t,n,r,i,a){let o=i-r;if(o>=359.99)return`M${e},${t-n} A${n},${n} 0 1,1 ${e-.01},${t-n} L${e-.01},${t-a} A${a},${a} 0 1,0 ${e},${t-a} Z`;let s=e=>(e-90)*Math.PI/180,c=e+n*Math.cos(s(r)),l=t+n*Math.sin(s(r)),u=e+n*Math.cos(s(i)),d=t+n*Math.sin(s(i)),f=e+a*Math.cos(s(i)),p=t+a*Math.sin(s(i)),m=e+a*Math.cos(s(r)),h=t+a*Math.sin(s(r)),g=+(o>180);return[`M${c},${l}`,`A${n},${n} 0 ${g} 1 ${u},${d}`,`L${f},${p}`,`A${a},${a} 0 ${g} 0 ${m},${h}`,`Z`].join(` `)}function Tn(){let e=m();return e.params.compare?l(On,{ids:[e.params.a??``,e.params.b??``]}):e.params.session?l(Dn,{sessionId:e.params.session}):l(En,{})}function En(){let{data:e,isLoading:t,error:n,refresh:r}=J(()=>H.evalSessions()),[i,a]=s(new Set);if(t)return l(X,{type:`table`});if(n)return l(Z,{message:n,onRetry:r});let o=e?.sessions??[];if(o.length===0)return l(fn,{icon:`📊`,message:`No sessions recorded yet.`});let c=e=>{let t=new Set(i);t.has(e)?t.delete(e):t.add(e),a(t)};return l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Evaluate`}),l(`div`,{className:`flex gap-2`,children:[i.size===2&&l(`button`,{className:`bg-brand-600 hover:bg-brand-500 text-white px-3 py-1 rounded text-sm transition-colors`,onClick:()=>{let[e,t]=[...i];B(`evaluate?compare&a=${encodeURIComponent(e)}&b=${encodeURIComponent(t)}`)},children:`Compare Selected`}),i.size>0&&l(`button`,{className:`text-xs text-slate-400 hover:text-white`,onClick:()=>a(new Set),children:[`Clear (`,i.size,`)`]})]})]}),l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 overflow-x-auto`,children:l(`table`,{className:`w-full text-sm`,role:`table`,children:[l(`thead`,{children:l(`tr`,{className:`bg-slate-800 text-slate-400 text-xs`,children:[l(`th`,{className:`px-2 py-2 w-8`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Session`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Last Activity`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Messages`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Input Tokens`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Output Tokens`}),l(`th`,{className:`px-3 py-2 text-right`,children:`Cost`}),l(`th`,{className:`px-3 py-2 text-right`,children:`RAG Calls`}),l(`th`,{className:`px-3 py-2 text-right`,children:`RAG Tokens`}),l(`th`,{className:`px-3 py-2 text-left`,children:`Model`}),l(`th`,{className:`px-3 py-2 w-8`})]})}),l(`tbody`,{children:o.map(e=>l(`tr`,{className:`border-t border-slate-800 hover:bg-slate-800 cursor-pointer`,onClick:()=>B(`evaluate?session=${encodeURIComponent(e.sessionID)}`),children:[l(`td`,{className:`px-2 py-2`,onClick:e=>e.stopPropagation(),children:l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:i.has(e.sessionID),onChange:()=>c(e.sessionID),"aria-label":`Select session ${e.title??e.sessionID}`})}),l(`td`,{className:`px-3 py-2 text-slate-200 font-mono text-xs`,children:e.title??e.sessionID.slice(0,8)}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:hn(e.lastEventAt)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:e.messageCount}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$((e.totalTokens?.input??0)+(e.totalTokens?.cacheRead??0))}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$(e.totalTokens?.output??0)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:pn(e.totalCost??0)}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:e.ragContextCount??0}),l(`td`,{className:`px-3 py-2 text-slate-300 text-right`,children:$(e.ragContextTokens??0)}),l(`td`,{className:`px-3 py-2 text-slate-400 text-xs`,children:e.models?.[0]??`-`}),l(`td`,{className:`px-3 py-2`,onClick:e=>e.stopPropagation(),children:l(`button`,{className:`text-slate-600 hover:text-red-400 text-xs`,onClick:async()=>{if(confirm(`Delete this session?`))try{await H.evalDeleteSession(e.sessionID),z(`success`,`Session deleted`),r()}catch(e){z(`error`,`Delete failed: ${e.message}`)}},"aria-label":`Delete session`,children:`🗑`})})]},e.sessionID))})]})})]})}function Dn({sessionId:e}){let{data:t,isLoading:n,error:r,refresh:i}=J(()=>H.evalSession(e));if(n)return l(X,{type:`detail`});if(r)return l(Z,{message:r,onRetry:i});let a=t?.summary??t,o=t?.events??[],s=a.toolCallCounts??{};[`search_semantic`,`get_file_skeleton`,`find_usages`,`describe_image`].reduce((e,t)=>e+(s[t]??0),0);let c=[{label:`Input`,value:(a.totalTokens?.input??0)+(a.totalTokens?.cacheRead??0),color:`#3b82f6`},{label:`Output`,value:a.totalTokens?.output??0,color:`#a855f7`},{label:`RAG`,value:a.ragContextTokens??0,color:`#06b6d4`},{label:`Reasoning`,value:a.totalTokens?.reasoning??0,color:`#f59e0b`}].filter(e=>e.value>0),u=c.reduce((e,t)=>e+t.value,0);return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`button`,{className:`text-sm text-slate-400 hover:text-white`,onClick:()=>B(`evaluate`),children:`← Back`}),l(`h1`,{className:`text-xl font-bold`,children:a.title??a.sessionID?.slice(0,12)})]}),l(`div`,{className:`grid grid-cols-3 lg:grid-cols-5 gap-3 mb-6`,children:[l(Q,{label:`Total Tokens`,value:$(u)}),l(Q,{label:`Input`,value:$((a.totalTokens?.input??0)+(a.totalTokens?.cacheRead??0))}),l(Q,{label:`Output`,value:$(a.totalTokens?.output??0)}),l(Q,{label:`Cost`,value:pn(a.totalCost??0)}),l(Q,{label:`RAG Context`,value:$(a.ragContextTokens??0)})]}),l(`div`,{className:`flex items-center gap-6 mb-6`,children:[l(Cn,{segments:c,centerLabel:$(u)}),l(`div`,{className:`flex flex-wrap gap-3`,children:c.map(e=>l(`div`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`span`,{className:`inline-block w-3 h-3 rounded-sm`,style:{background:e.color}}),e.label,`: `,$(e.value),` (`,(e.value/u*100).toFixed(1),`%)`]},e.label))})]}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6`,children:[l(Q,{label:`Messages`,value:a.messageCount??0}),l(Q,{label:`Steps`,value:a.totalSteps??0}),l(Q,{label:`RAG Injections`,value:a.ragContextCount??0}),l(Q,{label:`Avg Response`,value:mn(a.avgResponseTimeMs??0)})]}),Object.keys(s).length>0&&l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Tool Calls`}),l(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-2`,children:Object.entries(s).map(([e,t])=>l(`div`,{className:`flex justify-between text-xs text-slate-400`,children:[l(`span`,{className:`font-mono`,children:e}),l(`span`,{className:`text-white`,children:String(t)})]},e))})]}),a.models&&a.models.length>0&&l(`div`,{className:`kpi-card p-4 mb-6`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:`Models`}),l(`div`,{className:`flex flex-wrap gap-2`,children:a.models.map(e=>l(`span`,{className:`px-2 py-0.5 rounded text-xs font-mono bg-slate-800 text-slate-300`,children:e},e))})]}),o.length>0&&l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-3`,children:`Event Timeline`}),l(`div`,{className:`space-y-1 max-h-64 overflow-y-auto`,children:o.map((e,t)=>l(`div`,{className:`flex gap-2 text-xs border-b border-slate-700/50 py-1`,children:[l(`span`,{className:`text-slate-500 shrink-0 w-16`,children:hn(e.ts)}),l(`span`,{className:`text-slate-400`,children:e.event}),e.tool&&l(`span`,{className:`text-slate-500 font-mono`,children:e.tool}),e.toolStatus&&l(`span`,{className:`text-xs ${e.toolStatus===`completed`?`text-green-400`:e.toolStatus===`running`?`text-amber-400`:`text-slate-500`}`,children:e.toolStatus})]},t))})]})]})}function On({ids:e}){let[t,n]=e,{data:r,isLoading:i,error:a}=J(()=>Promise.all([H.evalCompare(t,n),H.evalTokenCompare(t,n)]),[t,n]);if(i)return l(X,{type:`chart`});if(a)return l(Z,{message:a});if(!r)return null;let o=r[0],s=r[1],c=s.sessionA?.savings??0,u=s.sessionB?.savings??0;return l(`div`,{children:[l(`div`,{className:`flex items-center gap-3 mb-4`,children:[l(`button`,{className:`text-sm text-slate-400 hover:text-white`,onClick:()=>B(`evaluate`),children:`← Back`}),l(`h1`,{className:`text-xl font-bold`,children:`Session Comparison`})]}),l(`div`,{className:`px-4 py-3 rounded-lg mb-4 font-semibold text-sm ${c>0&&u>0?`bg-green-900/50 text-green-300 border border-green-700`:`bg-amber-900/50 text-amber-300 border border-amber-700`}`,children:c>0&&u>0?`RAG saves tokens`:`Mixed results`}),l(`div`,{className:`grid grid-cols-2 gap-4`,children:[l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:o.sessionA?.title??`Session A`}),l(`div`,{className:`space-y-1 text-sm`,children:[l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Total Tokens`}),l(`span`,{children:$(o.sessionA?.totalTokens??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Cost`}),l(`span`,{children:pn(o.sessionA?.totalCost??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`RAG Savings`}),l(`span`,{className:c>0?`text-green-400`:`text-red-400`,children:[$(Math.abs(c)),` (`,c>0?`+`:``,c>0?`+`:``,`)`]})]})]})]}),l(`div`,{className:`kpi-card p-4`,children:[l(`h3`,{className:`text-sm font-semibold text-slate-300 mb-2`,children:o.sessionB?.title??`Session B`}),l(`div`,{className:`space-y-1 text-sm`,children:[l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Total Tokens`}),l(`span`,{children:$(o.sessionB?.totalTokens??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`Cost`}),l(`span`,{children:pn(o.sessionB?.totalCost??0)})]}),l(`div`,{className:`flex justify-between`,children:[l(`span`,{className:`text-slate-400`,children:`RAG Savings`}),l(`span`,{className:u>0?`text-green-400`:`text-red-400`,children:$(Math.abs(u))})]})]})]})]})]})}var kn={gotcha:`text-amber-400 bg-amber-900/20`,preference:`text-emerald-400 bg-emerald-900/20`,decision:`text-sky-400 bg-sky-900/20`,"environment-constraint":`text-rose-400 bg-rose-900/20`};function An(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${kn[e]??`text-slate-400 bg-slate-800`}">${q(e||`general`)}</span>`}function jn(){let{data:e,isLoading:t,error:n,refresh:r}=J(()=>H.quirks()),[i,a]=s(null),[o,c]=s(null),[u,d]=s(!1);if(t)return l(X,{type:`card`});if(n)return l(Z,{message:n,onRetry:r});let f=e?.quirks??[],p=[...new Set(f.map(e=>e.type||`general`))],m=i?f.filter(e=>(e.type||`general`)===i):f,h=async e=>{if(confirm(`Delete this quirk?`))try{await H.deleteQuirk(e),z(`success`,`Quirk deleted`),r()}catch(e){z(`error`,`Delete failed: ${e.message}`)}};return l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Quirks`}),l(`button`,{className:`bg-slate-700 hover:bg-slate-600 text-white px-3 py-1 rounded text-sm transition-colors`,onClick:async()=>{d(!0);try{let e=await H.quirkLint();c(e)}catch(e){c({error:e.message})}d(!1)},disabled:u,children:u?`Linting...`:`Lint`})]}),l(`div`,{className:`flex gap-2 mb-4 flex-wrap`,children:[l(`button`,{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${i===null?`bg-brand-600 text-white`:`bg-slate-700 text-slate-300 hover:bg-slate-600`}`,onClick:()=>a(null),children:`All`}),p.map(e=>l(`button`,{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${i===e?`bg-brand-600 text-white`:`bg-slate-700 text-slate-300 hover:bg-slate-600`}`,onClick:()=>a(e),children:e},e))]}),o&&l(`div`,{className:`mb-4 p-3 rounded-lg border text-sm ${o.success?`bg-green-900/30 border-green-700 text-green-300`:o.error?`bg-red-900/30 border-red-700 text-red-300`:`bg-amber-900/30 border-amber-700 text-amber-300`}`,children:l(`pre`,{className:`text-xs whitespace-pre-wrap`,children:JSON.stringify(o,null,2)})}),m.length===0?l(fn,{icon:`💡`,message:`No quirks stored yet.`}):l(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-3`,children:m.map(e=>l(`div`,{className:`bg-slate-900 rounded-lg border border-slate-700 p-3 flex flex-col`,children:[l(`div`,{className:`flex items-center justify-between mb-2`,children:[l(`span`,{dangerouslySetInnerHTML:{__html:An(e.type)}}),l(`span`,{className:`text-xs font-mono ${e.confidence>.7?`text-green-400`:e.confidence>.4?`text-amber-400`:`text-red-400`}`,children:[(e.confidence*100).toFixed(0),`%`]})]}),l(`p`,{className:`text-sm text-slate-200 mb-2 flex-1`,children:q(e.content)}),e.tags&&e.tags.length>0&&l(`div`,{className:`flex gap-1 flex-wrap mb-2`,children:e.tags.map(e=>l(`span`,{className:`text-xs bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded`,children:[`#`,e]},e))}),l(`div`,{className:`flex items-center justify-between text-xs text-slate-600 mt-auto`,children:[e.sourceRef&&l(`span`,{className:`font-mono`,children:q(e.sourceRef)}),l(`span`,{className:`font-mono`,children:e.id})]}),l(`button`,{className:`self-end mt-2 text-xs text-slate-600 hover:text-red-400 transition-colors`,onClick:()=>h(e.id),"aria-label":`Delete quirk`,children:`Delete`})]},e.id))})]})}function Mn(){let[e,t]=s([]),[n,r]=s(!1),[i,a]=s(null),[o,c]=s(!1),l=Jt(L.value,300);return u(()=>{let e=I.value.trim();if(!e){t([]),a(null),r(!1),Ae.value=[];return}let n=!1;return(async()=>{r(!0),a(null);try{let i=await H.retrieve({q:e,topK:l.topK,minScore:l.minScore,keywordWeight:l.keywordWeight,hybrid:l.hybrid?`true`:`false`,path:l.pathFilter||void 0,lang:l.langFilter||void 0,ext:l.extFilter||void 0,explain:`true`});if(n)return;if(i.status===503){a(i.body?.error??`Embedding model unavailable`),r(!1);return}c(!1);let o=i.body?.results??i.results??[];t(o),Ae.value=o,je.value=[{query:e,params:{...l}},...je.value.filter(t=>t.query!==e).slice(0,19)]}catch(e){n||a(e.message)}finally{n||r(!1)}})(),()=>{n=!0}},[I.value,l]),{results:e,isLoading:n,isInitializing:o,error:i,setResults:t}}function Nn({explanation:e}){let{vectorScore:t,keywordScore:n,rawVectorScore:r,rawKeywordScore:i,keywordWeight:a,vectorRank:o,keywordRank:s}=e.scoreBreakdown,c=Math.max(t+n,.001),u=(t/c*100).toFixed(0),d=(n/c*100).toFixed(0);return l(`div`,{className:`mb-2`,children:[l(`div`,{className:`flex items-center gap-2 text-xs mb-1`,children:[l(`span`,{className:`text-cyan-400`,title:`Vector: ${r.toFixed(3)}${o===void 0?``:`, rank #${o+1}`}`,children:[`Vector `,u,`%`]}),l(`span`,{className:`text-amber-400`,title:`Keyword: ${i.toFixed(3)}${s===void 0?``:`, rank #${s+1}`}`,children:[`Keyword `,d,`%`]}),l(`span`,{className:`text-slate-500 ml-auto`,children:[`kw=`,a.toFixed(1)]})]}),l(`div`,{className:`h-2 bg-slate-700 rounded-full overflow-hidden flex`,children:[l(`div`,{className:`h-full bg-cyan-500 transition-all duration-200`,style:{width:`${u}%`}}),l(`div`,{className:`h-full bg-amber-500 transition-all duration-200`,style:{width:`${d}%`}})]})]})}function Pn(){let e=m(),{results:t,isLoading:n,isInitializing:r,error:i}=Mn();return u(()=>{e.params.query&&(I.value=e.params.query,L.value={...L.value,topK:parseInt(e.params.topK??`10`,10),minScore:parseFloat(e.params.minScore??`0.35`),keywordWeight:parseFloat(e.params.keywordWeight??`0.4`),hybrid:e.params.hybrid!==`false`,pathFilter:e.params.path??``,langFilter:e.params.lang??``,extFilter:e.params.ext??``})},[]),u(()=>{if(I.value.trim()){let e=new URLSearchParams({query:I.value,topK:String(L.value.topK),minScore:String(L.value.minScore),keywordWeight:String(L.value.keywordWeight),hybrid:String(L.value.hybrid)});L.value.pathFilter&&e.set(`path`,L.value.pathFilter),L.value.langFilter&&e.set(`lang`,L.value.langFilter),L.value.extFilter&&e.set(`ext`,L.value.extFilter);let t=`search?${e.toString()}`;location.hash!==`#${t}`&&history.replaceState(null,``,`#${t}`)}},[I.value,L.value]),l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-4`,children:`Semantic Search`}),l(`div`,{className:`flex gap-3 mb-4`,children:l(`input`,{type:`text`,value:I.value,onInput:e=>{I.value=e.target.value,Ae.value=[]},onKeyDown:e=>{e.key===`Enter`&&I.value.trim()},placeholder:`Search your codebase semantically... (e.g., 'how does authentication work?')`,className:`flex-1 px-4 py-2 bg-slate-800 border border-slate-600 rounded-lg text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,autoFocus:!0,"aria-label":`Semantic search query`})}),l(`details`,{className:`mb-4 bg-slate-800 rounded-lg border border-slate-700`,children:[l(`summary`,{className:`px-3 py-2 text-xs text-slate-400 cursor-pointer hover:text-white font-medium`,children:`Search Parameters`}),l(`div`,{className:`px-3 pb-3 space-y-3`,children:[l(Ln,{label:`topK`,min:1,max:25,step:1,value:L.value.topK,onChange:e=>{L.value={...L.value,topK:e}}}),l(Ln,{label:`minScore`,min:0,max:1,step:.05,value:L.value.minScore,onChange:e=>{L.value={...L.value,minScore:e}}}),l(Ln,{label:`keywordWeight`,min:0,max:1,step:.1,value:L.value.keywordWeight,onChange:e=>{L.value={...L.value,keywordWeight:e}}}),l(`div`,{className:`flex items-center gap-2`,children:[l(`label`,{className:`text-xs text-slate-400 w-28`,children:`Hybrid mode`}),l(`input`,{type:`checkbox`,checked:L.value.hybrid,onChange:e=>{L.value={...L.value,hybrid:e.target.checked}},className:`accent-brand-500`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Extensions`}),l(`input`,{type:`text`,value:L.value.extFilter,onInput:e=>{L.value={...L.value,extFilter:e.target.value}},placeholder:`.ts, .py (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`File extension filter`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Languages`}),l(`input`,{type:`text`,value:L.value.langFilter,onInput:e=>{L.value={...L.value,langFilter:e.target.value}},placeholder:`typescript, python (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Language filter`})]}),l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:`Path`}),l(`input`,{type:`text`,value:L.value.pathFilter,onInput:e=>{L.value={...L.value,pathFilter:e.target.value}},placeholder:`src/** (comma-separated)`,className:`flex-1 px-2 py-1 bg-slate-900 border border-slate-600 rounded text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-brand-400`,"aria-label":`Path filter`})]})]})]}),r&&l(`div`,{className:`text-center py-10 text-slate-400`,children:[l(`span`,{className:`animate-spin inline-block mr-2`,children:`⟳`}),`Initializing embedding model...`]}),i&&l(Z,{message:i}),!n&&!i&&I.value.trim()&&t.length===0&&l(`div`,{className:`text-center py-16 text-slate-500`,children:[l(`div`,{className:`text-4xl mb-2`,children:`🔍`}),l(`div`,{children:[`No results found for "`,q(I.value),`"`]})]}),!n&&!i&&!I.value.trim()&&l(`div`,{className:`text-center py-16 text-slate-500`,children:[l(`div`,{className:`text-4xl mb-2`,children:`🔍`}),l(`div`,{children:`Enter a query to search your codebase`}),je.value.length>0&&l(`div`,{className:`mt-6`,children:[l(`p`,{className:`text-xs text-slate-600 mb-2`,children:`Recent queries:`}),l(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:je.value.slice(0,10).map((e,t)=>l(`button`,{className:`px-2 py-1 bg-slate-800 rounded text-xs text-slate-400 hover:text-white hover:bg-slate-700 transition-colors`,onClick:()=>{I.value=e.query},children:q(e.query)},t))})]})]}),t.length>0&&l(`div`,{className:`space-y-3`,children:[l(`div`,{className:`flex items-center justify-between text-sm text-slate-400 mb-2`,children:[l(`span`,{children:[t.length,` result`,t.length===1?``:`s`]}),n&&l(`span`,{className:`text-xs text-brand-400 animate-pulse`,children:`Searching...`})]}),t.map(e=>l(Fn,{result:e},e.chunk.id))]}),n&&t.length===0&&l(`div`,{className:`text-center py-10 text-slate-400`,children:[l(`span`,{className:`animate-spin inline-block mr-2`,children:`⟳`}),`Searching...`]})]})}function Fn({result:e}){let t=e.chunk,n=e.score;return l(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700 hover:border-brand-500/50 transition-colors cursor-pointer`,onClick:()=>B(`chunks?id=${encodeURIComponent(t.id)}`),children:[l(`div`,{className:`flex items-center justify-between mb-2`,children:[l(`div`,{className:`flex items-center gap-2 min-w-0`,children:[l(`span`,{className:`text-sm text-yellow-400 font-mono truncate`,children:[q(t.filePath),`:`,t.startLine,`-`,t.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:Zt(t.language)}})]}),l(`span`,{className:`text-lg font-bold shrink-0 ml-2`,style:{color:In(n)},children:n.toFixed(2)})]}),e.explanation&&l(Nn,{explanation:e.explanation}),e.explanation?.matchedTerms?.length>0&&l(`div`,{className:`flex gap-1 flex-wrap mb-2`,children:e.explanation.matchedTerms.map(e=>l(`span`,{className:`text-xs bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded`,children:q(e)},e))}),t.description&&l(`p`,{className:`text-sm text-slate-400 mb-2 line-clamp-2`,children:q(t.description)}),l(`pre`,{className:`text-xs overflow-x-auto max-h-32 rounded bg-slate-900/50 p-2`,children:l(`code`,{children:q(t.content??``).slice(0,500)})})]})}function In(e){return e>=.8?`#22c55e`:e>=.6?`#06b6d4`:e>=.4?`#f59e0b`:`#ef4444`}function Ln({label:e,min:t,max:n,step:r,value:i,onChange:a}){return l(`div`,{className:`flex items-center gap-3`,children:[l(`label`,{className:`text-xs text-slate-400 w-28 shrink-0`,children:e}),l(`input`,{type:`range`,min:t,max:n,step:r,value:i,onInput:e=>a(parseFloat(e.target.value)),className:`flex-1 accent-brand-500`}),l(`span`,{className:`text-xs text-slate-300 font-mono w-12 text-right`,children:i})]})}function Rn(){let e=m().params.ids?.split(`,`).filter(Boolean)??[],[t,n]=s([]),[r,i]=s(!0),[a,o]=s(null);return u(()=>{let t=!1;if(e.length<2)o(`Select 2-3 chunks to compare.`),i(!1);else return H.compare(e).then(e=>{t||(n(e?.body?.chunks??e?.chunks??[]),i(!1))}).catch(e=>{t||(o(e.message),i(!1))}),()=>{t=!0}},[e.join(`,`)]),r?l(X,{type:`detail`}):a?l(Z,{message:a}):t.length<2?l(fn,{icon:`📋`,message:`Select 2-3 chunks from the Chunks view to compare them.`}):l(`div`,{children:[l(`div`,{className:`flex items-center justify-between mb-4`,children:[l(`h1`,{className:`text-2xl font-bold`,children:`Chunk Comparison`}),l(`button`,{className:`text-sm text-slate-400 hover:text-white transition-colors`,onClick:()=>B(`chunks`),children:`← Back to Chunks`})]}),l(`div`,{className:`grid gap-4 ${t.length===2?`grid-cols-2`:`grid-cols-3`}`,children:t.map((e,n)=>l(zn,{chunk:e,index:n,baseChunk:n>0?t[0]:void 0},e.id))})]})}function zn({chunk:e,index:t,baseChunk:n}){let r=e.content.split(`
3
+ `),i=n?.content.split(`
4
+ `)??[];return l(`div`,{className:`bg-slate-800 rounded-lg border border-slate-700 overflow-hidden flex flex-col`,children:[l(`div`,{className:`p-3 border-b border-slate-700 bg-slate-800/80`,children:[l(`div`,{className:`flex items-center justify-between mb-1`,children:[l(`span`,{className:`text-sm font-mono text-brand-400 truncate mr-2`,children:[q(e.filePath),`:`,e.startLine,`-`,e.endLine]}),l(`span`,{className:`shrink-0`,dangerouslySetInnerHTML:{__html:Zt(e.language)}})]}),e.description&&l(`p`,{className:`text-xs text-slate-400 truncate`,children:q(e.description)})]}),l(`div`,{className:`overflow-x-auto flex-1 max-h-[70vh]`,children:l(`table`,{className:`w-full text-xs font-mono border-collapse`,children:l(`tbody`,{children:r.map((t,n)=>{let r=(e.startLine??1)+n,a=i[n]===void 0?`bg-green-900/30`:t===``&&i[n]!==``?`bg-red-900/30`:t===i[n]?``:`bg-amber-900/20`;return l(`tr`,{className:a,children:[l(`td`,{className:`text-right text-slate-600 select-none px-2 w-10 border-r border-slate-700 align-top`,children:r}),l(`td`,{className:`px-3 py-0 whitespace-pre-wrap break-all`,children:q(t)||`\xA0`})]},n)})})})}),l(`div`,{className:`px-3 py-1.5 bg-slate-900 border-t border-slate-700 text-xs text-slate-500`,children:[`Chunk `,t+1,t===0&&l(`span`,{className:`text-slate-600 ml-1`,children:`(reference)`})]})]})}function Bn({id:e,values:t,onChange:n,onBlur:r,describedBy:i,invalid:a,placeholder:o,disabled:c}){let[u,d]=s(``),f=e=>{let r=e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean);if(r.length===0)return;let i=[...t];for(let e of r)i.includes(e)||i.push(e);n(i),d(``)},p=e=>{n(t.filter(t=>t!==e))};return l(`div`,{className:`flex flex-wrap items-center gap-1.5 rounded-lg border px-2 py-1.5 min-h-10`,style:{background:`var(--bg-secondary)`,borderColor:a?`#dc2626`:`var(--border)`},children:[t.map(e=>l(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-mono`,style:{background:`var(--bg-tertiary)`,color:`var(--text-secondary)`},children:[l(`span`,{className:`max-w-[22rem] truncate`,title:e,children:e}),l(`button`,{type:`button`,className:`shrink-0 rounded px-0.5`,style:{color:`var(--text-muted)`},onClick:()=>p(e),"aria-label":`Remove ${e}`,disabled:c,children:`×`})]},e)),l(`input`,{id:e,className:`flex-1 min-w-[8rem] bg-transparent border-0 p-0 text-sm outline-none`,style:{color:`var(--text-primary)`},value:u,placeholder:t.length===0?o:`Add…`,disabled:c,"aria-describedby":i,"aria-invalid":a?`true`:void 0,onInput:e=>d(e.currentTarget.value),onPaste:e=>{let t=e.clipboardData?.getData(`text`)??``;/[\n,]/.test(t)&&(e.preventDefault(),f(`${u}${t}`))},onKeyDown:e=>{e.key===`Enter`||e.key===`,`?(e.preventDefault(),f(u)):e.key===`Backspace`&&u===``&&t.length>0&&(e.preventDefault(),p(t[t.length-1]))},onBlur:()=>{u.trim()&&f(u),r?.()}})]})}function Vn({id:e,mode:t,values:n,onChange:r,onBlur:i,describedBy:a,invalid:o,disabled:c,keyPlaceholder:u=`Name`,valuePlaceholder:d=`Value`}){let[f,p]=s(``),[m,h]=s(!1),g=Object.entries(n??{}),_=()=>{let e=f.trim();e&&(Object.hasOwn(n,e)?h(!0):(r({...n,[e]:t===`string[]`?[]:``}),p(``),h(!1)))},v=(e,t)=>{r({...n,[e]:t})},y=e=>{let t={...n};delete t[e],r(t)},b={background:`var(--bg-primary)`,borderColor:o?`#dc2626`:`var(--border)`,color:`var(--text-primary)`};return l(`div`,{className:`space-y-2`,children:[g.length===0&&l(`p`,{className:`text-xs`,style:{color:`var(--text-muted)`},children:`No entries. Inherited values still apply.`}),g.map(([n,r])=>l(`div`,{className:`flex items-start gap-2`,children:[l(`code`,{className:`mt-2 shrink-0 max-w-[10rem] truncate text-xs font-mono`,style:{color:`var(--text-secondary)`},title:n,children:n}),l(`div`,{className:`flex-1 min-w-0`,children:t===`string[]`?l(Bn,{id:`${e}-${n}`,values:Array.isArray(r)?r:[],onChange:e=>v(n,e),onBlur:i,placeholder:d,disabled:c}):l(`input`,{id:`${e}-${n}`,type:`text`,className:`w-full rounded border px-2 py-1.5 text-sm font-mono`,style:b,value:String(r??``),placeholder:d,disabled:c,"aria-describedby":a,onInput:e=>v(n,e.currentTarget.value),onBlur:i})}),l(`button`,{type:`button`,className:`mt-1.5 shrink-0 rounded px-1.5 py-0.5 text-sm`,style:{color:`var(--text-muted)`},onClick:()=>y(n),disabled:c,"aria-label":`Remove ${n}`,title:`Remove ${n}`,children:`×`})]},n)),l(`div`,{className:`flex items-start gap-2 pt-1`,children:[l(`input`,{id:e,type:`text`,className:`flex-1 min-w-0 rounded border px-2 py-1.5 text-sm font-mono`,style:b,value:f,placeholder:u,disabled:c,"aria-describedby":a,"aria-invalid":m||o?`true`:void 0,onInput:e=>{p(e.currentTarget.value),h(!1)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())},onBlur:i}),l(`button`,{type:`button`,className:`shrink-0 rounded border px-3 py-1.5 text-sm`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:_,disabled:c||f.trim()===``,children:`Add`})]}),m&&l(`p`,{className:`text-xs`,style:{color:`#dc2626`},role:`alert`,children:[`An entry named “`,f.trim(),`” already exists.`]})]})}var Hn={runtime:`#d97706`,project:`#0891b2`,global:`#7c3aed`,default:`var(--text-muted)`};function Un(e){return`setting-${e.join(`.`)}`}function Wn({field:e,value:t,provenance:n,isSetHere:r,secretSet:i,runtimeOverridden:a,readOnly:o,disabled:s,disabledReason:c,onEditElsewhere:u,error:d,onChange:f,onClearOverride:p,onRevert:m}){let h=Un(e.path),g=`${h}-control`,_=e.description?`${h}-description`:void 0,v=d?`${h}-error`:void 0,y=[_,v].filter(Boolean).join(` `)||void 0,b=o===!0||s===!0;return l(`div`,{id:h,className:`py-3.5 grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,24rem)] md:gap-6 md:items-start border-b last:border-b-0`,style:{borderColor:`var(--border)`},children:[l(`div`,{className:`min-w-0`,children:[l(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l(`label`,{htmlFor:g,className:`text-sm font-medium`,style:{color:b&&!o?`var(--text-muted)`:`var(--text-primary)`},children:e.label}),e.secret&&l(`span`,{className:`text-[10px] uppercase tracking-wide`,style:{color:`var(--text-muted)`},children:`secret`}),r&&l(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-medium`,style:{background:`color-mix(in srgb, var(--accent) 18%, transparent)`,color:`var(--accent)`},children:`Set here`}),r&&!o&&p&&l(`button`,{type:`button`,className:`text-[11px] underline underline-offset-2`,style:{color:`var(--text-muted)`},onClick:p,title:`Remove this layer's value so the setting is inherited again`,children:`Reset`}),n&&l(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-medium font-mono`,style:{color:Hn[n]??`var(--text-muted)`,border:`1px solid ${Hn[n]??`var(--border)`}`},title:`Effective value comes from the ${ft(n).toLowerCase()} layer`,children:ft(n)}),s&&c&&l(`span`,{className:`text-[10px]`,style:{color:`var(--text-muted)`},children:c}),u&&l(`button`,{type:`button`,className:`text-[11px] underline underline-offset-2`,style:{color:`var(--accent)`},onClick:u,children:`Edit in Global`})]}),e.description&&l(`p`,{id:_,className:`mt-1 text-xs leading-relaxed`,style:{color:`var(--text-muted)`},children:e.description}),e.advanced&&!o&&l(`code`,{className:`mt-1 inline-block text-[10px] font-mono`,style:{color:`var(--text-muted)`},children:e.path.join(`.`)})]}),l(`div`,{className:`min-w-0`,children:[o?l(Jn,{field:e,value:t,secretSet:i,runtimeOverridden:a,onClearOverride:p}):l(Gn,{id:g,field:e,value:t,secretSet:i,disabled:b,describedBy:y,invalid:d!==void 0,onChange:f,onClearOverride:p,onRevert:m}),d&&l(`p`,{id:v,role:`alert`,className:`mt-1 text-xs`,style:{color:`#dc2626`},children:d})]})]})}function Gn({id:e,field:t,value:n,secretSet:r,disabled:i,describedBy:a,invalid:o,onChange:s,onClearOverride:c,onRevert:u}){let d={background:`var(--bg-secondary)`,borderColor:o?`#dc2626`:`var(--border)`,color:`var(--text-primary)`,opacity:i?.6:1};switch(t.type){case`boolean`:{let r=n===!0;return l(`div`,{className:`flex items-center gap-2`,children:[l(`button`,{id:e,type:`button`,role:`switch`,"aria-checked":r,"aria-label":t.label,"aria-describedby":a,disabled:i,className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors`,style:{background:r?`var(--accent)`:`var(--bg-tertiary)`,border:`1px solid ${r?`var(--accent)`:`var(--border)`}`,opacity:i?.6:1},onClick:()=>s(!r),children:l(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform`,style:{transform:r?`translateX(24px)`:`translateX(3px)`}})}),l(`span`,{className:`text-sm`,style:{color:`var(--text-secondary)`},children:r?`Enabled`:`Disabled`})]})}case`number`:return l(Kn,{id:e,field:t,value:n,disabled:i,describedBy:a,invalid:o,onChange:s});case`enum`:return l(`select`,{id:e,className:`w-full rounded border px-2.5 py-1.5 text-sm`,style:d,value:typeof n==`string`?n:``,disabled:i,"aria-describedby":a,"aria-invalid":o?`true`:void 0,onChange:e=>{let t=e.currentTarget.value;s(t===``?void 0:t)},children:[l(`option`,{value:``,children:`Inherit`}),(t.enumValues??[]).map(e=>l(`option`,{value:e,children:e},e))]});case`string[]`:return l(Bn,{id:e,values:Array.isArray(n)?n:[],onChange:e=>s(e),describedBy:a,invalid:o,placeholder:t.placeholder??`Add value…`,disabled:i});case`stringMap`:case`stringArrayMap`:{let r=typeof n==`object`&&n&&!Array.isArray(n)?n:{};return l(Vn,{id:e,mode:t.type===`stringArrayMap`?`string[]`:`string`,values:r,onChange:e=>s(e),describedBy:a,invalid:o,disabled:i,keyPlaceholder:t.type===`stringArrayMap`?`Language`:`Extension`})}case`json`:return l(qn,{id:e,value:n,disabled:i,describedBy:a,invalid:o,onChange:s});default:return t.secret?l(`div`,{className:`flex items-center gap-2`,children:[l(`input`,{id:e,type:`password`,className:`w-full rounded border px-2.5 py-1.5 text-sm font-mono`,style:d,value:typeof n==`string`?n:``,placeholder:r?`•••••••• (set — type to replace)`:`(not set)`,autoComplete:`new-password`,disabled:i,"aria-describedby":a,"aria-invalid":o?`true`:void 0,onInput:e=>{let t=e.currentTarget.value;t===``?r?u?.():s(void 0):s(t)}}),r&&c&&l(`button`,{type:`button`,className:`shrink-0 rounded border px-2 py-1.5 text-xs`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:c,disabled:i,children:`Clear`})]}):t.multiline?l(`textarea`,{id:e,className:`w-full rounded border px-2.5 py-1.5 text-sm font-mono`,style:{...d,minHeight:`6rem`},rows:5,value:typeof n==`string`?n:``,placeholder:t.placeholder??`Inherit`,disabled:i,"aria-describedby":a,"aria-invalid":o?`true`:void 0,onInput:e=>{let t=e.currentTarget.value;s(t===``?void 0:t)}}):l(`input`,{id:e,type:`text`,className:`w-full rounded border px-2.5 py-1.5 text-sm font-mono`,style:d,value:typeof n==`string`?n:``,placeholder:t.placeholder??`Inherit`,disabled:i,"aria-describedby":a,"aria-invalid":o?`true`:void 0,onInput:e=>{let t=e.currentTarget.value;s(t===``?void 0:t)}})}}function Kn({id:e,field:t,value:n,disabled:r,describedBy:a,invalid:o,onChange:c}){let d=e=>typeof e==`number`?String(e):``,[f,p]=s(()=>d(n)),m=i(!1);return u(()=>{m.current||p(d(n))},[n]),l(`input`,{id:e,type:`number`,className:`w-full rounded border px-2.5 py-1.5 text-sm`,style:{background:`var(--bg-secondary)`,borderColor:o?`#dc2626`:`var(--border)`,color:`var(--text-primary)`,opacity:r?.6:1},value:f,min:t.minimum,max:t.maximum,step:t.step??1,placeholder:t.placeholder??`Inherit`,disabled:r,"aria-describedby":a,"aria-invalid":o?`true`:void 0,onInput:e=>{m.current=!0;let t=e.currentTarget.value;p(t),t!==``&&Number.isFinite(Number(t))&&c(Number(t))},onBlur:e=>{let t=e.currentTarget.value;if(m.current=!1,t.trim()===``){c(void 0);return}let n=Number(t);Number.isFinite(n)&&c(n)}})}function qn({id:e,value:t,disabled:n,describedBy:r,invalid:a,onChange:o}){let c=e=>e===void 0?``:JSON.stringify(e,null,2),[d,f]=s(()=>c(t)),[p,m]=s(null),h=i(!1);u(()=>{h.current||f(c(t))},[t]);let g=e=>{if(e.trim()===``)m(null),h.current=!1,o(void 0);else try{let t=JSON.parse(e);m(null),h.current=!1,o(t)}catch(e){m(e.message)}};return l(`div`,{children:[l(`textarea`,{id:e,className:`w-full rounded border px-2.5 py-1.5 text-xs font-mono`,style:{background:`var(--bg-secondary)`,borderColor:p||a?`#dc2626`:`var(--border)`,color:`var(--text-primary)`,minHeight:`6rem`,opacity:n?.6:1},rows:5,value:d,spellcheck:!1,disabled:n,"aria-describedby":r,"aria-invalid":p||a?`true`:void 0,onInput:e=>{h.current=!0,f(e.currentTarget.value),m(null)},onBlur:e=>g(e.currentTarget.value)}),p&&l(`p`,{className:`mt-1 text-xs`,style:{color:`#dc2626`},role:`alert`,children:[`Invalid JSON: `,p]})]})}function Jn({field:e,value:t,secretSet:n,runtimeOverridden:r,onClearOverride:i}){let a=e.secret&&n?`••••••••`:ut(t);return l(`div`,{className:`flex items-start gap-2`,children:[l(`span`,{className:`min-w-0 break-words text-sm font-mono`,style:{color:t===void 0?`var(--text-muted)`:`var(--text-secondary)`},children:a}),r&&i&&l(`button`,{type:`button`,className:`ml-auto shrink-0 rounded border px-2 py-0.5 text-[11px]`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:i,title:`Delete the runtime override so the file value applies again`,children:`Clear override`})]})}function Yn({errors:e,labels:t}){let n=i(null),r=Object.entries(e);if(u(()=>{r.length>0&&n.current?.focus()},[r.length]),r.length===0)return null;let a=e=>{let t=document.getElementById(Un(e.split(`.`)));t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.querySelector(`input, select, textarea, button[role='switch']`)?.focus())};return l(`div`,{ref:n,role:`alert`,tabIndex:-1,className:`mb-4 rounded-lg border p-3`,style:{borderColor:`#dc2626`,background:`color-mix(in srgb, #dc2626 8%, transparent)`},children:[l(`p`,{className:`text-sm font-medium mb-2`,style:{color:`#dc2626`},children:[r.length,` setting`,r.length===1?``:`s`,` could not be saved`]}),l(`ul`,{className:`space-y-1`,children:r.map(([e,n])=>l(`li`,{className:`text-xs`,children:[l(`button`,{type:`button`,className:`underline underline-offset-2`,style:{color:`var(--text-primary)`},onClick:()=>a(e),children:t[e]??e}),l(`span`,{style:{color:`var(--text-muted)`},children:[` — `,n]})]},e))})]})}var Xn=[{id:`project`,label:`Project`},{id:`global`,label:`Global`},{id:`effective`,label:`Effective`}],Zn={live:{tone:`ok`,message:`Applied. The plugin picks up file changes automatically.`},reindex:{tone:`warn`,message:`Saved. Run a reindex for the change to affect the stored index.`},restart:{tone:`warn`,message:`Saved. Restart OpenCode (and this UI) for the change to take effect.`}};function Qn(){let t=W.value,n=ht.value,r=gt.value,i=_t.value,a=yt.value.trim().toLowerCase(),o=vt.value,[c,d]=s(``);u(()=>{Et()},[]);let f=t?.schema.sections??[],p=e(()=>f.flatMap(e=>e.fields),[f]),m=i===`effective`?null:i,h=m?t?.layers[m]?.exists===!0:!1,g=m?t?.layers[m]?.error:void 0,_=m&&t?Rt(m,p):0,v=t?Rt(`project`,p)+Rt(`global`,p):0;if(u(()=>{if(v===0)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[v]),u(()=>{if(!t)return;let e=document.getElementById(`main-content`);if(!e)return;let n=0,r=()=>{n=0;let e=f[0]?.id??``;for(let t of f){let n=document.getElementById(`section-${t.id}`);n&&n.getBoundingClientRect().top<=140&&(e=t.id)}d(e)},i=()=>{n===0&&(n=requestAnimationFrame(r))};return e.addEventListener(`scroll`,i,{passive:!0}),r(),()=>{e.removeEventListener(`scroll`,i),n!==0&&cancelAnimationFrame(n)}},[t,i,o,a,f]),n&&!t)return l(X,{type:`card`});if(r&&!t)return l(Z,{message:r,onRetry:()=>void Et()});if(!t)return l(fn,{icon:`⚙`,message:`No configuration available.`});let y=p.filter(e=>t.provenance[U(e.path)]===`runtime`).map(e=>U(e.path)),b=(e,t)=>{if(!a)return o||!t.advanced;let n=`${e.label} ${t.label} ${t.path.join(`.`)} ${t.description??``}`.toLowerCase();return a.split(/\s+/).every(e=>n.includes(e))},x=f.map(e=>({section:e,fields:e.fields.filter(t=>b(e,t))})).filter(({fields:e,section:t})=>e.length>0||!a&&t.fields.length===0),S=p.filter(e=>e.advanced).length,C=Object.fromEntries(p.map(e=>[U(e.path),e.label])),ee=m?t.layers[m].path:`<effective configuration>`,w=e=>{document.getElementById(`section-${e}`)?.scrollIntoView({behavior:`smooth`,block:`start`})},T=e=>{setTimeout(()=>{let t=document.getElementById(Un(e.path));t?.scrollIntoView({behavior:`smooth`,block:`center`}),t?.querySelector(`input, select, textarea, button[role='switch']`)?.focus()},0)},te=()=>{m&&(Tt(m),K.value={},xt.value=`idle`,St.value=null)},ne=()=>{v>0&&!window.confirm(`Discard unsaved changes and reload the configuration from disk?`)||(St.value=null,Ct.value=null,Et(!1))},E=async()=>{m&&await Bt(m,p)},D=xt.value===`saved`?Ct.value:null,O=D?Zn[D]:null;return l(`div`,{className:`pb-24`,children:[l(`div`,{className:`mb-4 flex flex-wrap items-start justify-between gap-4`,children:[l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold`,children:`Configuration`}),l(`p`,{className:`mt-1 text-sm`,style:{color:`var(--text-muted)`},children:`Edit the project and machine-global layers, then inspect the merged result.`})]}),l(`div`,{className:`flex flex-wrap items-center gap-3`,children:[l(`div`,{className:`relative`,children:[l(`label`,{htmlFor:`config-search`,className:`sr-only`,children:`Search settings`}),l(`input`,{id:`config-search`,type:`search`,className:`w-56 rounded-lg border px-2.5 py-1.5 text-sm`,style:{background:`var(--bg-secondary)`,borderColor:`var(--border)`,color:`var(--text-primary)`},placeholder:`Search settings…`,value:yt.value,onInput:e=>yt.value=e.currentTarget.value})]}),l(`button`,{type:`button`,role:`switch`,"aria-checked":o,className:`inline-flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-sm`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:()=>wt(!o),title:o?`Hide rarely used settings`:`Show all ${S} advanced settings`,children:[l(`span`,{className:`relative inline-flex h-4 w-7 shrink-0 items-center rounded-full`,style:{background:o?`var(--accent)`:`var(--bg-tertiary)`},children:l(`span`,{className:`inline-block h-3 w-3 rounded-full bg-white transition-transform`,style:{transform:o?`translateX(14px)`:`translateX(2px)`}})}),`Advanced`,l(`span`,{className:`text-[10px]`,style:{color:`var(--text-muted)`},children:S})]})]})]}),l(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 border-b pb-2`,style:{borderColor:`var(--border)`},children:[l(`div`,{role:`tablist`,"aria-label":`Configuration layer`,className:`flex gap-1 rounded-lg p-1`,style:{background:`var(--bg-secondary)`},children:Xn.map(e=>{let t=i===e.id,n=e.id===`effective`?0:Rt(e.id,p);return l(`button`,{id:`config-tab-${e.id}`,role:`tab`,type:`button`,"aria-selected":t,"aria-controls":`config-panel`,className:`rounded-md px-3 py-1.5 text-sm transition-colors`,style:t?{background:`var(--bg-primary)`,color:`var(--text-primary)`,boxShadow:`0 1px 2px rgba(0,0,0,0.12)`}:{color:`var(--text-muted)`},onClick:()=>{_t.value=e.id,K.value={}},children:[e.label,n>0&&l(`span`,{className:`ml-1.5 rounded-full px-1.5 py-0.5 text-[10px] font-medium`,style:{background:`var(--accent)`,color:`#fff`},children:n})]},e.id)})}),l(`p`,{className:`min-w-0 flex-1 truncate text-xs font-mono`,style:{color:`var(--text-muted)`},title:ee,children:ee}),l(`button`,{type:`button`,className:`rounded border px-2 py-1 text-xs`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:ne,disabled:n||bt.value,children:n?`Reloading…`:`Reload`})]}),t.warnings.map(e=>{let t=e.code===`invalid-json`;return l(`div`,{className:`mb-3 rounded-lg border p-3 text-sm`,role:t?`alert`:`status`,style:{borderColor:t?`#dc2626`:`#d97706`,background:t?`color-mix(in srgb, #dc2626 8%, transparent)`:`color-mix(in srgb, #d97706 8%, transparent)`},children:l(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[l(`div`,{children:[l(`p`,{style:{color:t?`#dc2626`:`#b45309`},children:e.message}),e.paths&&e.paths.length>0&&l(`p`,{className:`mt-1 text-xs font-mono break-all`,style:{color:`var(--text-muted)`},children:e.paths.join(`, `)})]}),e.code===`provider-shadowed`&&e.paths&&l(`button`,{type:`button`,className:`shrink-0 rounded border px-2 py-1 text-xs`,style:{borderColor:`#d97706`,color:`#b45309`},onClick:()=>{Ht(e.paths??[]),_t.value=`project`},children:`Remove from project`})]})},`${e.code}-${e.paths?.join(`,`)??``}`)}),y.length>0&&l(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-2 rounded-lg border p-3 text-sm`,style:{borderColor:`#d97706`,background:`color-mix(in srgb, #d97706 8%, transparent)`},role:`status`,children:[l(`div`,{children:[l(`p`,{style:{color:`#b45309`},children:[y.length,` setting`,y.length===1?` is`:`s are`,` overridden at runtime and shadow the file value.`]}),l(`p`,{className:`mt-1 text-xs font-mono break-all`,style:{color:`var(--text-muted)`},children:y.join(`, `)})]}),l(`div`,{className:`flex shrink-0 gap-2`,children:[l(`button`,{type:`button`,className:`rounded border px-2 py-1 text-xs`,style:{borderColor:`#d97706`,color:`#b45309`},onClick:()=>_t.value=`effective`,children:`Review`}),l(`button`,{type:`button`,className:`rounded border px-2 py-1 text-xs`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:()=>y.forEach(e=>void Vt(e.split(`.`))),children:`Clear all`})]})]}),g&&l(`div`,{className:`mb-3 rounded-lg border p-3 text-sm`,role:`alert`,style:{borderColor:`#dc2626`,background:`color-mix(in srgb, #dc2626 8%, transparent)`,color:`#dc2626`},children:[`This layer cannot be parsed: `,g,`. Fix the file on disk before editing it here.`]}),O&&l(`div`,{className:`mb-3 rounded-lg border p-3 text-sm`,role:`status`,style:{borderColor:O.tone===`ok`?`var(--accent)`:`#d97706`,background:O.tone===`ok`?`color-mix(in srgb, var(--accent) 8%, transparent)`:`color-mix(in srgb, #d97706 8%, transparent)`,color:O.tone===`ok`?`var(--text-primary)`:`#b45309`},children:O.message}),l(Yn,{errors:K.value,labels:C}),a&&x.length===0&&l(`p`,{className:`mb-4 text-sm`,style:{color:`var(--text-muted)`},children:[`No settings match “`,yt.value,`”.`]}),l(`div`,{className:`lg:grid lg:grid-cols-[13rem_minmax(0,1fr)] lg:gap-6`,children:[l(`nav`,{"aria-label":`Configuration sections`,className:`mb-3 lg:mb-0`,children:l(`div`,{className:`flex gap-1 overflow-x-auto pb-2 lg:sticky lg:top-0 lg:max-h-[calc(100vh-14rem)] lg:flex-col lg:overflow-y-auto lg:pb-0`,children:x.map(({section:e,fields:t})=>{let n=c===e.id,r=m?Rt(m,t):0;return l(`button`,{type:`button`,className:`shrink-0 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors lg:w-full`,style:n?{background:`color-mix(in srgb, var(--accent) 14%, transparent)`,color:`var(--accent)`}:{color:`var(--text-secondary)`},"aria-current":n?`true`:void 0,onClick:()=>w(e.id),children:l(`span`,{className:`flex items-center justify-between gap-2`,children:[l(`span`,{className:`truncate`,children:e.label}),r>0&&l(`span`,{className:`text-[10px] font-medium`,style:{color:`var(--accent)`},children:r})]})},e.id)})})}),l(`div`,{id:`config-panel`,role:`tabpanel`,"aria-labelledby":`config-tab-${i}`,className:`min-w-0`,children:[x.map(({section:e,fields:n})=>l(`section`,{id:`section-${e.id}`,className:`mb-5 scroll-mt-4 rounded-lg border`,style:{borderColor:`var(--border)`,background:`var(--bg-card)`},children:[l(`header`,{className:`border-b px-4 py-3`,style:{borderColor:`var(--border)`},children:[l(`h2`,{className:`text-base font-semibold`,children:e.label}),e.description&&l(`p`,{className:`mt-0.5 text-xs`,style:{color:`var(--text-muted)`},children:e.description})]}),l(`div`,{className:`px-4`,children:[n.map(e=>{let n=U(e.path),r=e.scope===`global`,i=m===`project`&&r;return l(Wn,{field:e,value:m?jt(t,m,e):Wt(t,e),provenance:m?void 0:t.provenance[n],isSetHere:m?Mt(t,m,e):void 0,secretSet:m?Nt(t,m,e):Wt(t,e)===`***`,runtimeOverridden:!m&&t.provenance[n]===`runtime`,readOnly:!m,disabled:i,disabledReason:i?`Global only`:void 0,onEditElsewhere:i?()=>{_t.value=`global`,T(e)}:void 0,error:K.value[n],onClearOverride:m?()=>{It(m,e),zt(n,void 0)}:()=>void Vt(e.path),onRevert:()=>{m&&Ft(m,e)},onChange:t=>{m&&(Pt(m,e,t),zt(n,dt(e,t)))}},n)}),n.length===0&&l(`p`,{className:`py-4 text-sm`,style:{color:`var(--text-muted)`},children:`No settings match the current search.`})]})]},e.id)),l($n,{title:m?`Raw JSON — ${m} layer`:`Raw JSON — effective configuration`,path:ee,value:m?t.layers[m].values:t.config,exists:!m||h,note:m?`Secret values are omitted from this preview. A saved secret is reported as set.`:`Secrets are shown as *** — their values never leave the server.`}),t.runtimeOverrides.values&&Object.keys(t.runtimeOverrides.values).length>0&&l($n,{title:`Raw JSON — runtime overrides`,path:t.runtimeOverrides.path,value:t.runtimeOverrides.values,exists:!0,note:`Created by the TUI settings dialog. A file save clears matching entries.`})]})]}),m&&l(`div`,{className:`sticky bottom-0 z-10 -mx-6 mt-4 flex flex-wrap items-center gap-3 border-t px-6 py-3`,style:{borderColor:`var(--border)`,background:`var(--bg-primary)`},role:`region`,"aria-label":`Save configuration changes`,children:[l(`p`,{className:`text-sm`,"aria-live":`polite`,style:{color:xt.value===`error`?`#dc2626`:`var(--text-secondary)`},children:xt.value===`error`?St.value:_>0?`${_} unsaved change${_===1?``:`s`} in the ${m} layer`:St.value??`No unsaved changes`}),l(`div`,{className:`ml-auto flex items-center gap-2`,children:[l(`button`,{type:`button`,className:`rounded-lg border px-3 py-1.5 text-sm disabled:opacity-50`,style:{borderColor:`var(--border)`,color:`var(--text-secondary)`},onClick:te,disabled:bt.value||_===0,children:`Discard`}),l(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-sm font-medium text-white disabled:opacity-50`,style:{background:`var(--accent)`},onClick:()=>void E(),disabled:bt.value||_===0,children:bt.value?`Saving…`:`Save ${m}`})]})]})]})}function $n({title:t,path:r,value:a,exists:o,note:s}){let c=e(()=>JSON.stringify(a??{},null,2),[a]),u=i(null);return l(`details`,{ref:u,className:`mb-5 rounded-lg border`,style:{borderColor:`var(--border)`,background:`var(--bg-card)`},children:[l(`summary`,{className:`cursor-pointer px-4 py-3 text-sm font-medium`,children:l(`span`,{className:`flex flex-wrap items-center gap-2`,children:[l(`span`,{children:t}),l(`code`,{className:`text-[11px] font-mono`,style:{color:`var(--text-muted)`},children:r})]})}),l(`div`,{className:`border-t px-4 py-3`,style:{borderColor:`var(--border)`},children:o?l(n,{children:[l(`pre`,{className:`max-h-96 overflow-auto rounded p-3 text-xs`,style:{background:`var(--bg-code)`,color:`var(--text-secondary)`},children:c}),l(`p`,{className:`mt-2 text-xs`,style:{color:`var(--text-muted)`},children:s})]}):l(`p`,{className:`text-sm`,style:{color:`var(--text-muted)`},children:`This file does not exist yet. Saving a setting creates it.`})})]})}var er=10;function tr({points:e,width:n=800,height:r=600,onPointClick:a,renderTooltip:o}){let c=i(null),[d,f]=s({x:0,y:0,scale:1}),[p,m]=s(null),[h,g]=s(!1),_=i({x:0,y:0}),v=i(null),y=i(null),b=i(e);b.current=e;let x=t(e=>{v.current=e(v.current??d),y.current===null&&(y.current=requestAnimationFrame(()=>{y.current=null,v.current&&=(f(v.current),null)}))},[d]);u(()=>()=>{y.current!==null&&cancelAnimationFrame(y.current)},[]);let S=t((e,t)=>{let i=c.current;if(!i)return null;let a=i.getBoundingClientRect(),o=v.current??d,s=e-a.left,l=t-a.top,u=null,f=er;for(let e of b.current){let t=e.x*n*o.scale+o.x,i=e.y*r*o.scale+o.y,a=s-t,c=l-i,d=Math.sqrt(a*a+c*c);d<=f&&(f=d,u=e)}return u},[d,n,r]);u(()=>{let t=c.current;if(!t)return;let i=t.getContext(`2d`);if(!i)return;let a=window.devicePixelRatio||1;t.width=n*a,t.height=r*a,i.scale(a,a),i.clearRect(0,0,n,r),i.save(),i.translate(d.x,d.y),i.scale(d.scale,d.scale);for(let t of e){let e=t.x*n,a=t.y*r,o=(t.radius??3)*(t.highlighted?2:1);i.beginPath(),i.arc(e,a,o,0,Math.PI*2),i.fillStyle=t.color,i.globalAlpha=t.highlighted?1:.6,i.fill(),t.highlighted&&(i.strokeStyle=`#22d3ee`,i.lineWidth=2,i.stroke())}i.restore()},[e,d,n,r]);let C=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;x(e=>({...e,scale:Math.max(.5,Math.min(10,e.scale*t))}))},ee=e=>{g(!0),_.current={x:e.clientX-d.x,y:e.clientY-d.y}},w=e=>{if(h){x(t=>({...t,x:e.clientX-_.current.x,y:e.clientY-_.current.y}));return}let t=S(e.clientX,e.clientY);m(e=>e?.id===t?.id?e:t)},T=()=>g(!1);return l(`div`,{className:`relative overflow-hidden rounded-lg border border-slate-700 bg-slate-900`,style:{width:n,height:r},children:[l(`canvas`,{ref:c,className:`absolute inset-0 cursor-grab active:cursor-grabbing`,onMouseDown:ee,onMouseMove:w,onMouseUp:T,onMouseLeave:T,onClick:e=>{if(h)return;let t=S(e.clientX,e.clientY);t&&a?.(t.id)},onWheel:C}),p&&o&&l(`div`,{className:`absolute bg-slate-800 border border-slate-600 rounded-lg p-3 shadow-xl text-sm z-10 pointer-events-none`,style:{left:Math.min(p.x*n*d.scale+d.x+12,n-200),top:Math.min(p.y*r*d.scale+d.y-12,r-80)},children:o(p)}),d.scale!==1&&l(`button`,{className:`absolute bottom-3 right-3 px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors z-20`,onClick:()=>{f({x:0,y:0,scale:1}),v.current=null},children:`Reset zoom`})]})}function nr({containerRef:e}){let t=i(null),[n,r]=s(!1);Se(()=>{e.current?.style.setProperty(`--embed-plot-w`,`${Math.round(qe.value*100)}%`)});let a=()=>{t.current=null,r(!1),document.body.style.cursor=``,document.body.style.userSelect=``},o=n=>{if(n.button!==0)return;let i=e.current;if(i){try{n.currentTarget.setPointerCapture(n.pointerId)}catch{}t.current={pointerId:n.pointerId,startX:n.clientX,startFrac:qe.peek(),containerWidth:Math.max(1,i.getBoundingClientRect().width)},r(!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`}},c=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&Je(n.startFrac+(e.clientX-n.startX)/n.containerWidth)},u=e=>{let n=t.current;n&&n.pointerId===e.pointerId&&(a(),Ye())};return l(`div`,{className:`splitter-v hidden lg:block${n?` dragging`:``}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize plot and details`,"aria-valuemin":Math.round(He*100),"aria-valuemax":Math.round(Ue*100),"aria-valuenow":Math.round(qe.value*100),tabIndex:0,title:`Drag to resize · double-click to reset`,onPointerDown:o,onPointerMove:c,onPointerUp:u,onPointerCancel:u,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowLeft`?-We:We;Je(qe.peek()+t),Ye()},onDblClick:()=>{Je(Ve),Ye()}})}function rr(e,t){let n=e.x-t.x,r=e.y-t.y,i=(e.z??0)-(t.z??0);return Math.sqrt(n*n+r*r+i*i)}function ir(e,t=8,n=20){let r=e.length;if(r<=t)return e.map((e,t)=>t);let i=Array(r).fill(0),a=[];a.push(e[Math.floor(Math.random()*r)]);for(let n=1;n<t;n++){let t=e.map(e=>Math.min(...a.map(t=>rr(e,t)))),n=t.reduce((e,t)=>e+t*t,0),i=Math.random()*n;for(let n=0;n<r;n++)if(i-=t[n]*t[n],i<=0){a.push(e[n]);break}}for(let t=0;t<n;t++){for(let t=0;t<r;t++){let n=0,r=rr(e[t],a[0]);for(let i=1;i<a.length;i++){let o=rr(e[t],a[i]);o<r&&(r=o,n=i)}i[t]=n}let t=a.map(()=>({x:0,y:0,z:0,count:0}));for(let n=0;n<r;n++){let r=i[n];t[r].x+=e[n].x,t[r].y+=e[n].y,t[r].z+=e[n].z??0,t[r].count++}a.forEach((e,n)=>{t[n].count>0&&(e.x=t[n].x/t[n].count,e.y=t[n].y/t[n].count,e.z!==void 0&&(e.z=t[n].z/t[n].count))})}return i}function ar(e,t,n){let r=n.map((n,r)=>{let i=e.filter((e,n)=>t[n]===r).map(e=>rr(e,n)),a=i.reduce((e,t)=>e+t,0)/i.length,o=i.reduce((e,t)=>e+(t-a)**2,0)/i.length;return Math.sqrt(o)}),i=new Set;for(let a=0;a<e.length;a++){let o=t[a];rr(e[a],n[o])>2*(r[o]??0)&&i.add(a)}return i}var or=`modulepreload`,sr=function(e){return`/ui/`+e},cr={},lr=function(e){return e.pathname.endsWith(`.css`)},ur=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},dr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=sr(t,n);let r=s(t),i=lr(r);return ur(cr,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:or,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},fr=o(()=>dr(()=>import(`./ScatterPlot3D-CJpVHNv-.js`).then(e=>({default:e.ScatterPlot3D})),__vite__mapDeps([0,1]))),pr=[`#3b82f6`,`#ef4444`,`#22c55e`,`#f59e0b`,`#a855f7`,`#06b6d4`,`#ec4899`,`#84cc16`,`#f97316`,`#14b8a6`,`#8b5cf6`,`#e11d48`,`#65a30d`,`#0ea5e9`,`#d946ef`,`#ca8a04`,`#64748b`,`#4ade80`,`#fb7185`,`#38bdf8`],mr=2,hr=50,gr=5,_r=200,vr=20,yr=12;function br(){let{data:t,isLoading:r,error:a,refresh:o}=J(()=>H.embeddingProj(5e3,3)),[c,f]=s(`language`),[p,m]=s(`3d`),[h,g]=s(!1),[_,v]=s(8),[y,b]=s(20),[x,S]=s(!1),[C,ee]=s(new Set),[w,T]=s(5),[te,ne]=s(0),[E,D]=s(null),[O,re]=s(!1),ie=i(0),k=i(null),ae=i(null),[oe,se]=s(900),ce=E!==null||O;u(()=>{if(!ce||p!==`2d`)return;let e=ae.current;if(!e)return;let t=0,n=new ResizeObserver(()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>{let t=Math.round(e.clientWidth);se(e=>Math.abs(e-t)>=4?Math.max(320,t):e)})});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[ce,p]);let[A,j]=s(null),[le,ue]=s(new Set),M=t?.body?.points??t?.points??[],de=t?.body?.totalChunks??t?.totalChunks??0;if(u(()=>{if(c===`cluster`&&M.length>0){let e=Math.max(mr,Math.min(_,M.length)),t=ir(M,e,y);if(j(t),h){let n=[];for(let r=0;r<e;r++){let e=M.filter((e,n)=>t[n]===r);if(e.length>0){let t=e[0]?.z!==void 0;n.push({x:e.reduce((e,t)=>e+t.x,0)/e.length,y:e.reduce((e,t)=>e+t.y,0)/e.length,...t?{z:e.reduce((e,t)=>e+(t.z??0),0)/e.length}:{}})}}ue(ar(M,t,n))}}else j(null),ue(new Set)},[c,h,_,y,M]),u(()=>{x&&Ae.value.length>0?ee(new Set(Ae.value.map(e=>e.chunk.id))):ee(new Set)},[x,Ae.value]),r)return l(X,{type:`chart`});if(a)return l(Z,{message:a,onRetry:o});if(M.length===0)return l(fn,{icon:`🌐`,message:`No embedding data available. Index some files first.`});let fe=e(()=>Cr(M),[M]),N=e(()=>M.map((e,t)=>{let n;n=c===`language`?Xt(e.language)===`text-slate-400`?`#94a3b8`:wr(e.language):c===`file`?fe.get(e.filePath)??`#94a3b8`:pr[(A?.[t]??0)%pr.length];let r=le.has(t),i=C.has(e.id);return{id:e.id,x:e.x,y:e.y,z:e.z??.5,color:i?`#22d3ee`:r?`#f97316`:n,label:`${e.filePath}:${e.startLine}-${e.endLine} [${e.language}]`,radius:i?6:r?5:3,highlighted:i}}),[M,c,A,le,C,fe]),P=e(()=>{if(c!==`file`)return[];let e=Sr(M.map(e=>e.filePath)),t=new Map;for(let e of M)t.set(e.filePath,(t.get(e.filePath)??0)+1);return[...t.entries()].sort((e,t)=>t[1]-e[1]).slice(0,yr).map(([t,n])=>({label:t.slice(e.length)||t,count:n,color:fe.get(t)??`#94a3b8`}))},[c,M,fe]),pe=e(()=>c===`file`?new Set(M.map(e=>e.filePath)).size-P.length:0,[c,M,P]),me=e=>{let t=++ie.current;D(null),re(!0),H.chunk(e).then(e=>{t===ie.current&&(D(e),re(!1))}).catch(()=>{t===ie.current&&(D({id:e,content:``,filePath:`not found`,language:``,startLine:0,endLine:0,description:`Error loading chunk details.`}),re(!1))})},he=E?l(n,{children:[l(`div`,{className:`flex items-center gap-3 mb-1 flex-wrap`,children:[l(`span`,{className:`text-yellow-400 font-mono text-sm`,children:q(E.filePath)}),l(`span`,{className:`text-slate-400 text-xs`,children:[`Lines `,E.startLine,`-`,E.endLine]}),l(`span`,{dangerouslySetInnerHTML:{__html:Zt(E.language)}}),E.id&&l(`span`,{className:`text-xs text-slate-600 font-mono`,children:E.id}),l(`button`,{className:`ml-auto px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors`,onClick:()=>B(`chunks?id=${encodeURIComponent(E.id)}`),children:`Open in Chunks`})]}),E.description&&l(`div`,{className:`mb-3`,children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Description`}),l(`p`,{className:`text-sm text-slate-300`,children:q(E.description)})]}),E.content&&l(`div`,{children:[l(`h3`,{className:`text-xs font-semibold text-slate-400 mb-1`,children:`Content`}),l(`pre`,{className:`text-xs text-slate-300 bg-slate-900 border border-slate-700 rounded p-3 overflow-auto max-h-64 font-mono whitespace-pre`,children:q(E.content)})]})]}):null;return l(`div`,{children:[l(`h1`,{className:`text-2xl font-bold mb-4`,children:`Embedding Space Explorer`}),l(`div`,{className:`flex flex-wrap gap-3 mb-4 items-center`,children:[l(`div`,{className:`flex items-center gap-1 bg-slate-800 border border-slate-600 rounded-lg p-0.5`,children:[`2d`,`3d`].map(e=>l(`button`,{className:`px-2 py-0.5 rounded text-xs transition-colors ${p===e?`bg-slate-600 text-white`:`text-slate-400 hover:text-slate-200`}`,onClick:()=>m(e),children:e.toUpperCase()},e))}),l(`label`,{className:`text-xs text-slate-400`,children:`Color by:`}),l(`select`,{className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1`,value:c,onChange:e=>f(e.target.value),children:[l(`option`,{value:`language`,children:`Language`}),l(`option`,{value:`file`,children:`File`}),l(`option`,{value:`cluster`,children:`Cluster`})]}),c===`cluster`&&l(n,{children:[l(`label`,{className:`text-xs text-slate-400`,children:`K:`}),l(`input`,{type:`number`,min:mr,max:hr,value:_,onChange:e=>v(xr(e.target,mr,hr,8)),className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1 w-16`,title:`Number of clusters`}),l(`label`,{className:`text-xs text-slate-400`,children:`Iterations:`}),l(`input`,{type:`number`,min:gr,max:_r,value:y,onChange:e=>b(xr(e.target,gr,_r,20)),className:`bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1 w-20`,title:`Maximum k-means iterations`})]}),l(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:h,onChange:e=>g(e.target.checked)}),`Outliers`]}),Ae.value.length>0&&l(`label`,{className:`flex items-center gap-1.5 text-xs text-slate-400`,children:[l(`input`,{type:`checkbox`,className:`accent-brand-500`,checked:x,onChange:e=>S(e.target.checked)}),`Search overlay (`,Ae.value.length,` results)`]}),p===`3d`&&l(n,{children:[l(`label`,{className:`text-xs text-slate-400`,children:`Point size:`}),l(`input`,{type:`range`,min:1,max:20,value:w,onChange:e=>T(Number(e.target.value)),className:`w-24 accent-brand-500`}),l(`button`,{className:`px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors`,onClick:()=>ne(e=>e+1),children:`Reset camera`})]})]}),c===`cluster`&&A&&l(`div`,{className:`flex flex-wrap gap-2 mb-3 text-xs`,children:(()=>{let e=Array.from(new Set(A)).sort((e,t)=>e-t),t=e.slice(0,vr),r=e.length-t.length;return l(n,{children:[t.map(e=>l(`span`,{className:`flex items-center gap-1 text-slate-400`,children:[l(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:pr[e%pr.length]}}),`Cluster `,e+1]},e)),r>0&&l(`span`,{className:`text-slate-500`,children:[`+`,r,` more`]})]})})()}),c===`file`&&P.length>0&&l(`div`,{className:`flex flex-wrap gap-2 mb-3 text-xs`,children:[P.map(({label:e,count:t,color:n})=>l(`span`,{className:`flex items-center gap-1 text-slate-400`,title:e,children:[l(`span`,{className:`inline-block w-2 h-2 rounded-full`,style:{background:n}}),q($t(e,40)),` (`,t,`)`]},e)),pe>0&&l(`span`,{className:`text-slate-500`,children:[`+`,pe,` more files`]})]}),ce?l(`div`,{ref:k,className:`embed-split`,children:[l(`div`,{ref:ae,className:`embed-plot`,children:p===`3d`?l(d,{fallback:l(X,{type:`chart`}),children:l(fr,{points:N,width:900,height:600,onPointClick:me,pointSize:w,resetKey:te,selectedId:E?.id??null})}):l(tr,{points:N,width:oe,height:600,onPointClick:me,renderTooltip:e=>{let t=M.find(t=>t.id===e.id);return l(`div`,{children:[l(`div`,{className:`text-yellow-400 font-mono text-xs`,children:q(e.label)}),t?.description&&l(`div`,{className:`text-slate-400 text-xs mt-1`,children:q($t(t.description,80))})]})}})}),l(nr,{containerRef:k}),l(`div`,{className:`embed-details mt-4 lg:mt-0`,children:[O&&l(X,{type:`detail`}),E&&!O&&l(`div`,{className:`kpi-card p-4`,children:he})]})]}):l(n,{children:[p===`3d`?l(d,{fallback:l(X,{type:`chart`}),children:l(fr,{points:N,width:900,height:600,onPointClick:me,pointSize:w,resetKey:te,selectedId:null})}):l(tr,{points:N,width:900,height:600,onPointClick:me,renderTooltip:e=>{let t=M.find(t=>t.id===e.id);return l(`div`,{children:[l(`div`,{className:`text-yellow-400 font-mono text-xs`,children:q(e.label)}),t?.description&&l(`div`,{className:`text-slate-400 text-xs mt-1`,children:q($t(t.description,80))})]})}}),O&&l(X,{type:`detail`}),E&&!O&&l(`div`,{className:`kpi-card p-4 mt-4`,children:he})]}),l(`p`,{className:`text-xs text-slate-500 mt-2`,children:[N.length,` of `,de,` chunks displayed`,N.length<de&&` (chunks without embeddings omitted)`]})]})}function xr(e,t,n,r){let i=parseInt(e?.value??``,10);return Number.isNaN(i)?r:Math.max(t,Math.min(n,i))}function Sr(e){if(e.length===0)return``;let t=e[0]??``;for(let n of e)for(;n&&t&&!n.startsWith(t);)t=t.slice(0,-1);let n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n+1):``}function Cr(e){let t=new Map;for(let n of e){let e=t.get(n.filePath)??{x:0,y:0,z:0,n:0};e.x+=n.x,e.y+=n.y,e.z+=n.z??0,e.n++,t.set(n.filePath,e)}let n=[];for(let[e,r]of t)n.push({file:e,x:r.x/r.n,y:r.y/r.n,z:r.z/r.n});let r=n.reduce((e,t)=>e+t.x,0)/n.length,i=n.reduce((e,t)=>e+t.y,0)/n.length,a=n.reduce((e,t)=>e+t.z,0)/n.length,o=n.reduce((e,t)=>e+(t.x-r)**2,0),s=n.reduce((e,t)=>e+(t.y-i)**2,0),c=n.reduce((e,t)=>e+(t.z-a)**2,0),l=o>=s&&o>=c?`x`:s>=c?`y`:`z`,u=[`x`,`y`,`z`].filter(e=>e!==l);n.sort((e,t)=>e[l]-t[l]||e[u[0]]-t[u[0]]||e[u[1]]-t[u[1]]);let d=new Map;for(let e=0;e<n.length;e++){let t=e*137.508%360,r=e%2==0?55:40;d.set(n[e].file,`hsl(${t.toFixed(1)}, 80%, ${r}%)`)}return d}function wr(e){return{typescript:`#60a5fa`,javascript:`#facc15`,python:`#4ade80`,java:`#f87171`,go:`#22d3ee`,rust:`#fb923c`,ruby:`#f472b6`,csharp:`#a78bfa`,cpp:`#818cf8`,c:`#9ca3af`,markdown:`#d1d5db`,html:`#fdba74`,css:`#60a5fa`,json:`#fde047`,kotlin:`#c084fc`,swift:`#fb923c`,tex:`#34d399`,sql:`#67e8f9`,text:`#94a3b8`,image:`#a78bfa`,quirk:`#fbbf24`}[e]??`#94a3b8`}var Tr=[{view:`dashboard`,label:`Dashboard`,icon:`📊`},{view:`search`,label:`Search`,icon:`🔍`},{view:`embeddings`,label:`Embeddings`,icon:`🌐`},{view:`chunks`,label:`Chunks`,icon:`🧩`},{view:`files`,label:`Files`,icon:`📄`},{view:`evaluate`,label:`Evaluate`,icon:`📈`},{view:`quirks`,label:`Quirks`,icon:`💡`}];function Er(){Qe(),$e();let e=m(),t=i(null);Ce.value=e.view;let r=()=>{Fe.value=!Fe.value};return l(`div`,{className:`h-screen flex flex-col overflow-hidden`,children:[l(`header`,{className:`flex items-center gap-3 px-4 py-2 border-b shrink-0`,style:{borderColor:`var(--border)`},children:[l(`h1`,{className:`text-lg font-bold shrink-0`,style:{color:`var(--accent)`},children:`OpenCodeRAG`}),l(`nav`,{className:`flex gap-1 flex-1`,role:`navigation`,"aria-label":`Main navigation`,children:Tr.map(e=>l(`button`,{id:`nav-${e.view}`,className:`nav-btn ${Ce.value===e.view?`active`:``}`,onClick:()=>window.location.hash=e.view,role:`tab`,"aria-selected":Ce.value===e.view,children:[e.icon,` `,e.label]},e.view))}),l(en,{}),l(qt,{}),l(Kt,{}),l(`button`,{className:`p-2 rounded-lg transition-colors hidden lg:block`,style:{color:`var(--text-muted)`},onClick:r,"aria-label":`Toggle file tree`,title:`Toggle file tree`,children:`☰`}),l(`button`,{className:`p-2 rounded-lg transition-colors lg:hidden`,style:{color:`var(--text-muted)`},onClick:r,"aria-label":`Toggle file tree`,title:`Toggle file tree`,children:`☰`})]}),l(`div`,{className:`flex flex-1 overflow-hidden`,children:[Fe.value&&l(n,{children:[l(`div`,{className:`fixed inset-0 z-30 lg:hidden`,style:{background:`rgba(0,0,0,0.5)`},onClick:()=>{Fe.value=!1}}),l(`aside`,{ref:t,className:`shrink-0 border-r z-40 fixed lg:relative inset-y-0 left-0 flex flex-col max-w-[85vw] lg:max-w-none`,style:{background:`var(--bg-secondary)`,borderColor:`var(--border)`,width:`${Re.peek()}px`},children:[l(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,role:`tree`,"aria-label":`File tree`,children:[l(cn,{}),l(tn,{})]}),l(dn,{targetRef:t})]})]}),l(`main`,{className:`flex-1 overflow-y-auto p-6`,id:`main-content`,tabIndex:-1,children:[e.view===`dashboard`&&l(vn,{}),e.view===`search`&&l(Pn,{}),e.view===`embeddings`&&l(br,{}),e.view===`compare`&&l(Rn,{}),e.view===`chunks`&&l(bn,{}),e.view===`files`&&l(Sn,{}),e.view===`evaluate`&&l(Tn,{}),e.view===`quirks`&&l(jn,{}),e.view===`config`&&l(Qn,{})]})]}),l(et,{})]})}f(l(Er,{}),document.getElementById(`app`));
@@ -3,13 +3,30 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="theme-color" content="#070b16" />
7
+ <script>
8
+ // Apply the stored theme before first paint so there is no flash.
9
+ try {
10
+ var t = localStorage.getItem("theme");
11
+ var root = document.documentElement;
12
+ root.classList.toggle("dark", t !== "light" && t !== "plasma" && t !== "drama");
13
+ root.classList.toggle("theme-plasma", t === "plasma");
14
+ root.classList.toggle("theme-drama", t === "drama");
15
+ } catch (e) {}
16
+ </script>
6
17
  <title>OpenCodeRAG</title>
18
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
19
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
20
+ <link
21
+ href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Archivo:wght@600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap"
22
+ rel="stylesheet"
23
+ />
7
24
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔎</text></svg>">
8
- <script type="module" crossorigin src="/ui/assets/index-FFPRbgLx.js"></script>
25
+ <script type="module" crossorigin src="/ui/assets/index-DDZPYJ4D.js"></script>
9
26
  <link rel="modulepreload" crossorigin href="/ui/assets/vendor-Dg8wMT7C.js">
10
- <link rel="stylesheet" crossorigin href="/ui/assets/index-B-RH6fko.css">
27
+ <link rel="stylesheet" crossorigin href="/ui/assets/index-BitHPGOk.css">
11
28
  </head>
12
- <body class="h-screen flex flex-col overflow-hidden bg-slate-900 text-slate-200">
29
+ <body class="h-screen flex flex-col overflow-hidden">
13
30
  <div id="app"></div>
14
31
  </body>
15
32
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-rag-plugin",
3
- "version": "2.12.3",
3
+ "version": "2.13.1",
4
4
  "description": "OpenCode plugin for local-first RAG-based semantic code search",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin-entry.js",
@@ -1,2 +0,0 @@
1
- /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-900:oklch(39.6% .141 25.723);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-900:oklch(37.8% .077 168.94);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-900:oklch(39.1% .09 240.876);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-indigo-400:oklch(67.3% .182 276.935);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-pink-400:oklch(71.8% .202 349.761);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-900:oklch(41% .159 10.272);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-slate-950:oklch(12.9% .042 264.695);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-wide:.025em;--radius-sm:.25rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-brand-400:#22d3ee;--color-brand-500:#06b6d4;--color-brand-600:#0891b2}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.chunk-row.selected{background:var(--accent)}@supports (color:color-mix(in lab, red, red)){.chunk-row.selected{background:color-mix(in srgb, var(--accent) 10%, transparent)}}.chunk-row.selected{border-left:2px solid var(--accent)}.chunk-row:hover{background:var(--bg-tertiary)}.file-item.active{background:var(--accent)}@supports (color:color-mix(in lab, red, red)){.file-item.active{background:color-mix(in srgb, var(--accent) 20%, transparent)}}.file-item.active{color:var(--text-primary)}.file-item:hover{background:var(--bg-tertiary)}.sidebar-resizer{cursor:col-resize;touch-action:none;background:0 0;width:7px;transition:background-color .15s;position:absolute;top:0;bottom:0;right:-3px}.sidebar-resizer:hover,.sidebar-resizer.dragging,.sidebar-resizer:focus-visible{background:var(--accent)}@supports (color:color-mix(in lab, red, red)){.sidebar-resizer:hover,.sidebar-resizer.dragging,.sidebar-resizer:focus-visible{background:color-mix(in srgb, var(--accent) 55%, transparent)}}.kpi-card{background:var(--bg-card);border:1px solid var(--border);border-radius:.75rem}.nav-btn{color:var(--text-muted);border-radius:.25rem;padding:.375rem .75rem;font-size:.875rem;transition:color .15s,background-color .15s}.nav-btn:hover{background:var(--bg-tertiary);color:var(--text-primary)}.nav-btn.active{background:var(--accent)}@supports (color:color-mix(in lab, red, red)){.nav-btn.active{background:color-mix(in srgb, var(--accent) 20%, transparent)}}.nav-btn.active{color:var(--accent)}pre,code{background:var(--bg-code)}table thead{background:var(--bg-secondary)}table tbody tr{border-top:1px solid var(--border)}table tbody tr:hover{background:var(--bg-tertiary)}input,select,textarea{background:var(--bg-secondary);border-color:var(--border);color:var(--text-primary)}input::-moz-placeholder{color:var(--text-muted)}textarea::-moz-placeholder{color:var(--text-muted)}input::placeholder,textarea::placeholder{color:var(--text-muted)}.chart-svg rect{transition:opacity .15s}.chart-svg rect:hover{opacity:.85}.chart-svg circle:hover{r:5}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-1{top:var(--spacing)}.top-3{top:calc(var(--spacing) * 3)}.top-4{top:calc(var(--spacing) * 4)}.top-5{top:calc(var(--spacing) * 5)}.top-full{top:100%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.right-6{right:calc(var(--spacing) * 6)}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-6{bottom:calc(var(--spacing) * 6)}.left-0{left:0}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[9999\]{z-index:9999}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-2{height:calc(var(--spacing) * 2)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-24{height:calc(var(--spacing) * 24)}.h-32{height:calc(var(--spacing) * 32)}.h-64{height:calc(var(--spacing) * 64)}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[calc\(100vh-220px\)\]{max-height:calc(100vh - 220px)}.min-h-0{min-height:0}.w-1\/2{width:50%}.w-2{width:calc(var(--spacing) * 2)}.w-3{width:calc(var(--spacing) * 3)}.w-5{width:calc(var(--spacing) * 5)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-96{width:calc(var(--spacing) * 96)}.w-full{width:100%}.max-w-\[85vw\]{max-width:85vw}.max-w-full{max-width:100%}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:0}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-amber-700{border-color:var(--color-amber-700)}.border-green-700{border-color:var(--color-green-700)}.border-red-700{border-color:var(--color-red-700)}.border-slate-600{border-color:var(--color-slate-600)}.border-slate-700{border-color:var(--color-slate-700)}.border-slate-700\/50{border-color:#31415880}@supports (color:color-mix(in lab, red, red)){.border-slate-700\/50{border-color:color-mix(in oklab, var(--color-slate-700) 50%, transparent)}}.border-slate-800{border-color:var(--color-slate-800)}.bg-\[var\(--bg-primary\)\]{background-color:var(--bg-primary)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.bg-amber-900\/20{background-color:#7b330633}@supports (color:color-mix(in lab, red, red)){.bg-amber-900\/20{background-color:color-mix(in oklab, var(--color-amber-900) 20%, transparent)}}.bg-amber-900\/30{background-color:#7b33064d}@supports (color:color-mix(in lab, red, red)){.bg-amber-900\/30{background-color:color-mix(in oklab, var(--color-amber-900) 30%, transparent)}}.bg-amber-900\/50{background-color:#7b330680}@supports (color:color-mix(in lab, red, red)){.bg-amber-900\/50{background-color:color-mix(in oklab, var(--color-amber-900) 50%, transparent)}}.bg-brand-500{background-color:var(--color-brand-500)}.bg-brand-600{background-color:var(--color-brand-600)}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-emerald-900\/20{background-color:#004e3b33}@supports (color:color-mix(in lab, red, red)){.bg-emerald-900\/20{background-color:color-mix(in oklab, var(--color-emerald-900) 20%, transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-green-900\/30{background-color:#0d542b4d}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/30{background-color:color-mix(in oklab, var(--color-green-900) 30%, transparent)}}.bg-green-900\/50{background-color:#0d542b80}@supports (color:color-mix(in lab, red, red)){.bg-green-900\/50{background-color:color-mix(in oklab, var(--color-green-900) 50%, transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-900\/30{background-color:#82181a4d}@supports (color:color-mix(in lab, red, red)){.bg-red-900\/30{background-color:color-mix(in oklab, var(--color-red-900) 30%, transparent)}}.bg-rose-900\/20{background-color:#8b083633}@supports (color:color-mix(in lab, red, red)){.bg-rose-900\/20{background-color:color-mix(in oklab, var(--color-rose-900) 20%, transparent)}}.bg-sky-900\/20{background-color:#024a7033}@supports (color:color-mix(in lab, red, red)){.bg-sky-900\/20{background-color:color-mix(in oklab, var(--color-sky-900) 20%, transparent)}}.bg-slate-600{background-color:var(--color-slate-600)}.bg-slate-700{background-color:var(--color-slate-700)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-slate-800\/80{background-color:#1d293dcc}@supports (color:color-mix(in lab, red, red)){.bg-slate-800\/80{background-color:color-mix(in oklab, var(--color-slate-800) 80%, transparent)}}.bg-slate-900{background-color:var(--color-slate-900)}.bg-slate-900\/50{background-color:#0f172b80}@supports (color:color-mix(in lab, red, red)){.bg-slate-900\/50{background-color:color-mix(in oklab, var(--color-slate-900) 50%, transparent)}}.bg-slate-950{background-color:var(--color-slate-950)}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-slate-700{--tw-gradient-from:var(--color-slate-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-slate-600{--tw-gradient-via:var(--color-slate-600);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-slate-700{--tw-gradient-to:var(--color-slate-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:0}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-2{padding-left:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-all{word-break:break-all}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[var\(--text-primary\)\]{color:var(--text-primary)}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-blue-300{color:var(--color-blue-300)}.text-blue-400{color:var(--color-blue-400)}.text-brand-400{color:var(--color-brand-400)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-indigo-400{color:var(--color-indigo-400)}.text-orange-300{color:var(--color-orange-300)}.text-orange-400{color:var(--color-orange-400)}.text-pink-400{color:var(--color-pink-400)}.text-purple-300{color:var(--color-purple-300)}.text-purple-400{color:var(--color-purple-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-200{color:var(--color-slate-200)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-white{color:var(--color-white)}.text-yellow-300{color:var(--color-yellow-300)}.text-yellow-400{color:var(--color-yellow-400)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.placeholder-slate-500::placeholder{color:var(--color-slate-500)}.accent-brand-500{accent-color:var(--color-brand-500)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.select-none{-webkit-user-select:none;user-select:none}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-brand-500\/50:hover{border-color:#06b6d480}@supports (color:color-mix(in lab, red, red)){.hover\:border-brand-500\/50:hover{border-color:color-mix(in oklab, var(--color-brand-500) 50%, transparent)}}.hover\:bg-brand-500:hover{background-color:var(--color-brand-500)}.hover\:bg-slate-600:hover{background-color:var(--color-slate-600)}.hover\:bg-slate-700:hover{background-color:var(--color-slate-700)}.hover\:bg-slate-800:hover{background-color:var(--color-slate-800)}.hover\:text-brand-400:hover{color:var(--color-brand-400)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-slate-200:hover{color:var(--color-slate-200)}.hover\:text-white:hover{color:var(--color-white)}}.focus\:border-brand-400:focus{border-color:var(--color-brand-400)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (width>=64rem){.lg\:relative{position:relative}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:max-w-none{max-width:none}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}}:root{--bg-primary:#fff;--bg-secondary:#f8fafc;--bg-tertiary:#f1f5f9;--bg-card:#fff;--bg-code:#f8fafc;--bg-surface:#fff;--text-primary:#0f172a;--text-secondary:#475569;--text-muted:#94a3b8;--border:#e2e8f0;--border-hover:#cbd5e1;--accent:#0891b2;--accent-hover:#0e7490;--chart-grid:#e2e8f0;--skeleton-from:#e2e8f0;--skeleton-to:#cbd5e1;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}.dark{--bg-primary:#0f172a;--bg-secondary:#1e293b;--bg-tertiary:#334155;--bg-card:#1e293b;--bg-code:#0f172a;--bg-surface:#0f172a;--text-primary:#e2e8f0;--text-secondary:#94a3b8;--text-muted:#64748b;--border:#334155;--border-hover:#475569;--accent:#06b6d4;--accent-hover:#22d3ee;--chart-grid:#334155;--skeleton-from:#334155;--skeleton-to:#475569;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}body{background:var(--bg-primary);color:var(--text-primary);transition:background-color .2s,color .2s}.scrollbar-thin::-webkit-scrollbar{width:6px}.scrollbar-thin::-webkit-scrollbar-track{background:0 0}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}:focus-visible,button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}@keyframes slide-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}.animate-slide-in{animation:.2s ease-out slide-in}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.animate-shimmer{background-size:200% 100%;background-image:linear-gradient(to right, var(--skeleton-from), var(--skeleton-to), var(--skeleton-from));animation:1.5s ease-in-out infinite shimmer}@media (width<=768px){.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sidebar-overlay{z-index:40;background:#00000080;position:fixed;inset:0}}@media (width<=640px){.kpi-grid{grid-template-columns:repeat(1,minmax(0,1fr))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}