opencode-rag-plugin 1.21.2 → 1.22.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.
- package/dist/cli/commands/ui.js +5 -1
- package/dist/content/reader.d.ts +2 -2
- package/dist/content/reader.js +8 -6
- package/dist/core/config.d.ts +29 -0
- package/dist/core/config.js +34 -0
- package/dist/core/exclude.d.ts +14 -0
- package/dist/core/exclude.js +37 -0
- package/dist/core/runtime-overrides.d.ts +1 -0
- package/dist/core/runtime-overrides.js +1 -0
- package/dist/indexer/watch.d.ts +3 -1
- package/dist/indexer/watch.js +6 -3
- package/dist/retriever/context-optimizer.js +9 -2
- package/dist/tui.js +20 -32
- package/dist/web/api.d.ts +5 -2
- package/dist/web/api.js +126 -7
- package/dist/web/server.d.ts +2 -1
- package/dist/web/server.js +3 -2
- package/dist/web/ui/assets/{ScatterPlot3D-CzbmvDSQ.js → ScatterPlot3D-DQLl3sKN.js} +1 -1
- package/dist/web/ui/assets/index-BZh9MitV.js +4 -0
- package/dist/web/ui/assets/index-DKhjGsql.css +1 -0
- package/dist/web/ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/ui/assets/index-BLzCza1W.css +0 -1
- package/dist/web/ui/assets/index-DOSfQsyL.js +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}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;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media (min-width: 640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media (min-width: 768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media (min-width: 1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media (min-width: 1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media (min-width: 1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.chunk-row.selected{background:color-mix(in srgb,var(--accent) 10%,transparent);border-left:2px solid var(--accent)}.chunk-row:hover{background:var(--bg-tertiary)}.file-item.active{background:color-mix(in srgb,var(--accent) 20%,transparent);color:var(--text-primary)}.file-item:hover{background:var(--bg-tertiary)}.kpi-card{background:var(--bg-card);border:1px solid var(--border);border-radius:.75rem}.nav-btn{padding:.375rem .75rem;border-radius:.25rem;font-size:.875rem;color:var(--text-muted);transition:color .15s,background-color .15s}.nav-btn:hover{background:var(--bg-tertiary);color:var(--text-primary)}.nav-btn.active{background:color-mix(in srgb,var(--accent) 20%,transparent);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,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}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.bottom-3{bottom:.75rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.right-0{right:0}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-4{top:1rem}.top-full{top:100%}.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}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[60vh\]{max-height:60vh}.max-h-\[70vh\]{max-height:70vh}.max-h-\[calc\(100vh-220px\)\]{max-height:calc(100vh - 220px)}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-32{width:8rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-64{width:16rem}.w-8{width:2rem}.w-96{width:24rem}.w-full{width:100%}.min-w-0{min-width:0px}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.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-end{align-items:flex-end}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.self-end{align-self:flex-end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity: 1;border-color:rgb(180 83 9 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-red-700{--tw-border-opacity: 1;border-color:rgb(185 28 28 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-900\/20{background-color:#78350f33}.bg-amber-900\/30{background-color:#78350f4d}.bg-amber-900\/50{background-color:#78350f80}.bg-brand-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-brand-600{--tw-bg-opacity: 1;background-color:rgb(8 145 178 / var(--tw-bg-opacity, 1))}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.bg-emerald-900\/20{background-color:#064e3b33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-green-900\/30{background-color:#14532d4d}.bg-green-900\/50{background-color:#14532d80}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-900\/20{background-color:#88133733}.bg-sky-900\/20{background-color:#0c4a6e33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-slate-700{--tw-gradient-from: #334155 var(--tw-gradient-from-position);--tw-gradient-to: rgb(51 65 85 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-slate-600{--tw-gradient-to: rgb(71 85 105 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #475569 var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.bg-\[length\:200\%_100\%\]{background-size:200% 100%}.object-contain{-o-object-fit:contain;object-fit:contain}.p-0\.5{padding:.125rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-3{padding-bottom:.75rem}.pl-2{padding-left:.5rem}.pt-3{padding-top:.75rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.tracking-wide{letter-spacing:.025em}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-brand-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.accent-brand-500{accent-color:#06b6d4}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.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-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}:root{--bg-primary: #ffffff;--bg-secondary: #f8fafc;--bg-tertiary: #f1f5f9;--bg-card: #ffffff;--bg-code: #f8fafc;--bg-surface: #ffffff;--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;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;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:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--text-muted);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}:focus-visible{outline:2px solid var(--accent);outline-offset:2px}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%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .2s ease-out}@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:shimmer 1.5s ease-in-out infinite}@media (max-width: 768px){.kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sidebar-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;background:#00000080}}@media (max-width: 640px){.kpi-grid{grid-template-columns:repeat(1,minmax(0,1fr))}}.last\:border-0:last-child{border-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-brand-500\/50:hover{border-color:#06b6d480}.hover\:bg-brand-500:hover{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:text-brand-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.focus\:border-brand-400:focus{--tw-border-opacity: 1;border-color:rgb(34 211 238 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:opacity-50:disabled{opacity:.5}@media (min-width: 1024px){.lg\:relative{position:relative}.lg\:block{display:block}.lg\:hidden{display: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))}}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ScatterPlot3D-CzbmvDSQ.js","assets/vendor-Dy7HKFCY.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{l as D,S as ie,C as Ne,t as cn,k as rt,F as it,R as dn}from"./vendor-Dy7HKFCY.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))l(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&l(i)}).observe(document,{childList:!0,subtree:!0});function s(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(r){if(r.ep)return;r.ep=!0;const a=s(r);fetch(r.href,a)}})();var un=0;function t(e,n,s,l,r,a){n||(n={});var i,o,c=n;if("ref"in c)for(o in c={},n)o=="ref"?i=n[o]:c[o]=n[o];var d={type:e,props:c,key:s,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--un,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(o in i)c[o]===void 0&&(c[o]=i[o]);return D.vnode&&D.vnode(d),d}var Fe,E,tt,pt,Ae=0,Kt=[],A=D,xt=A.__b,vt=A.__r,gt=A.diffed,bt=A.__c,_t=A.unmount,yt=A.__;function dt(e,n){A.__h&&A.__h(E,e,Ae||n),Ae=0;var s=E.__H||(E.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({}),s.__[e]}function g(e){return Ae=1,hn(Wt,e)}function hn(e,n,s){var l=dt(Fe++,2);if(l.t=e,!l.__c&&(l.__=[s?s(n):Wt(void 0,n),function(o){var c=l.__N?l.__N[0]:l.__[0],d=l.t(c,o);c!==d&&(l.__N=[d,l.__[1]],l.__c.setState({}))}],l.__c=E,!E.__f)){var r=function(o,c,d){if(!l.__c.__H)return!0;var u=!1,f=l.__c.props!==o;if(l.__c.__H.__.some(function(h){if(h.__N){u=!0;var p=h.__[0];h.__=h.__N,h.__N=void 0,p!==h.__[0]&&(f=!0)}}),a){var x=a.call(this,o,c,d);return u?x||f:x}return!u||f};E.__f=!0;var a=E.shouldComponentUpdate,i=E.componentWillUpdate;E.componentWillUpdate=function(o,c,d){if(this.__e){var u=a;a=void 0,r(o,c,d),a=u}i&&i.call(this,o,c,d)},E.shouldComponentUpdate=r}return l.__N||l.__}function O(e,n){var s=dt(Fe++,3);!A.__s&&Bt(s.__H,n)&&(s.__=e,s.u=n,E.__H.__h.push(s))}function te(e){return Ae=5,le(function(){return{current:e}},[])}function le(e,n){var s=dt(Fe++,7);return Bt(s.__H,n)&&(s.__=e(),s.__H=n,s.__h=e),s.__}function Nt(e,n){return Ae=8,le(function(){return e},n)}function fn(){for(var e;e=Kt.shift();){var n=e.__H;if(e.__P&&n)try{n.__h.some(Be),n.__h.some(ot),n.__h=[]}catch(s){n.__h=[],A.__e(s,e.__v)}}}A.__b=function(e){E=null,xt&&xt(e)},A.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),yt&&yt(e,n)},A.__r=function(e){vt&&vt(e),Fe=0;var n=(E=e.__c).__H;n&&(tt===E?(n.__h=[],E.__h=[],n.__.some(function(s){s.__N&&(s.__=s.__N),s.u=s.__N=void 0})):(n.__h.some(Be),n.__h.some(ot),n.__h=[],Fe=0)),tt=E},A.diffed=function(e){gt&>(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(Kt.push(n)!==1&&pt===A.requestAnimationFrame||((pt=A.requestAnimationFrame)||mn)(fn)),n.__H.__.some(function(s){s.u&&(s.__H=s.u,s.u=void 0)})),tt=E=null},A.__c=function(e,n){n.some(function(s){try{s.__h.some(Be),s.__h=s.__h.filter(function(l){return!l.__||ot(l)})}catch(l){n.some(function(r){r.__h&&(r.__h=[])}),n=[],A.__e(l,s.__v)}}),bt&&bt(e,n)},A.unmount=function(e){_t&&_t(e);var n,s=e.__c;s&&s.__H&&(s.__H.__.some(function(l){try{Be(l)}catch(r){n=r}}),s.__H=void 0,n&&A.__e(n,s.__v))};var wt=typeof requestAnimationFrame=="function";function mn(e){var n,s=function(){clearTimeout(l),wt&&cancelAnimationFrame(n),setTimeout(e)},l=setTimeout(s,35);wt&&(n=requestAnimationFrame(s))}function Be(e){var n=E,s=e.__c;typeof s=="function"&&(e.__c=void 0,s()),E=n}function ot(e){var n=E;e.__c=e.__(),E=n}function Bt(e,n){return!e||e.length!==n.length||n.some(function(s,l){return s!==e[l]})}function Wt(e,n){return typeof n=="function"?n(e):n}function kt(){const e=location.hash.slice(1)||"dashboard",n=e.indexOf("?"),s=n>=0?e.slice(0,n):e,l={};if(n>=0){const r=e.slice(n+1);for(const a of r.split("&")){const i=a.indexOf("=");if(i>=0)try{l[decodeURIComponent(a.slice(0,i))]=decodeURIComponent(a.slice(i+1))}catch{}}}return{view:s||"dashboard",params:l}}function De(){const[e,n]=g(kt);return O(()=>{const s=()=>n(kt());return addEventListener("hashchange",s),()=>removeEventListener("hashchange",s)},[]),e}var pn=Symbol.for("preact-signals");function Je(){if(ne>1)ne--;else{var e,n=!1;for(function(){var r=Ge;for(Ge=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var i=a.t;i!==void 0;i=i.x)i.i===r.i&&(i.i=a.i);r=r.o}}();Ee!==void 0;){var s=Ee;for(Ee=void 0,Ve++;s!==void 0;){var l=s.u;if(s.u=void 0,s.f&=-3,!(8&s.f)&&Gt(s))try{s.c()}catch(r){n||(e=r,n=!0)}s=l}}if(Ve=0,ne--,n)throw e}}function xn(e){if(ne>0)return e();ct=++vn,ne++;try{return e()}finally{Je()}}var Re,C=void 0;function et(e){var n=C,s=Re;C=void 0,Re=void 0;try{return e()}finally{C=n,Re=s}}var Ee=void 0,ne=0,Ve=0,vn=0,ct=0,Ge=void 0,Qe=0;function Vt(e){if(C!==void 0){var n=e.n;if(n===void 0||n.t!==C)return n={i:0,S:e,p:C.s,n:void 0,t:C,e:void 0,x:void 0,r:n},C.s!==void 0&&(C.s.n=n),C.s=n,e.n=n,32&C.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=C.s,n.n=void 0,C.s.n=n,C.s=n),n}}function U(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=n==null?void 0:n.watched,this.Z=n==null?void 0:n.unwatched,this.name=n==null?void 0:n.name}U.prototype.brand=pn;U.prototype.h=function(){return!0};U.prototype.S=function(e){var n=this,s=this.t;s!==e&&e.e===void 0&&(e.x=s,this.t=e,s!==void 0?s.e=e:et(function(){var l;(l=n.W)==null||l.call(n)}))};U.prototype.U=function(e){var n=this;if(this.t!==void 0){var s=e.e,l=e.x;s!==void 0&&(s.x=l,e.e=void 0),l!==void 0&&(l.e=s,e.x=void 0),e===this.t&&(this.t=l,l===void 0&&et(function(){var r;(r=n.Z)==null||r.call(n)}))}};U.prototype.subscribe=function(e){var n=this;return Oe(function(){var s=n.value;et(function(){return e(s)})},{name:"sub"})};U.prototype.valueOf=function(){return this.value};U.prototype.toString=function(){return this.value+""};U.prototype.toJSON=function(){return this.value};U.prototype.peek=function(){var e=this;return et(function(){return e.value})};Object.defineProperty(U.prototype,"value",{get:function(){var e=Vt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ve>100)throw new Error("Cycle detected");(function(s){ne!==0&&Ve===0&&s.l!==ct&&(s.l=ct,Ge={S:s,v:s.v,i:s.i,o:Ge})})(this),this.v=e,this.i++,Qe++,ne++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{Je()}}}});function L(e,n){return new U(e,n)}function Gt(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function Qt(e){for(var n=e.s;n!==void 0;n=n.n){var s=n.S.n;if(s!==void 0&&(n.r=s),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function Xt(e){for(var n=e.s,s=void 0;n!==void 0;){var l=n.p;n.i===-1?(n.S.U(n),l!==void 0&&(l.n=n.n),n.n!==void 0&&(n.n.p=l)):s=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=l}e.s=s}function ue(e,n){U.call(this,void 0,n),this.x=e,this.s=void 0,this.g=Qe-1,this.f=4}ue.prototype=new U;ue.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Qe))return!0;if(this.g=Qe,this.f|=1,this.i>0&&!Gt(this))return this.f&=-2,!0;var e=C;try{Qt(this),C=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(s){this.v=s,this.f|=16,this.i++}return C=e,Xt(this),this.f&=-2,!0};ue.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}U.prototype.S.call(this,e)};ue.prototype.U=function(e){if(this.t!==void 0&&(U.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};ue.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(ue.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Vt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function St(e,n){return new ue(e,n)}function Zt(e){var n=e.m;if(e.m=void 0,typeof n=="function"){ne++;var s=C;C=void 0;try{n()}catch(l){throw e.f&=-2,e.f|=8,ut(e),l}finally{C=s,Je()}}}function ut(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,Zt(e)}function gn(e){if(C!==this)throw new Error("Out-of-order effect");Xt(this),C=e,this.f&=-2,8&this.f&&ut(this),Je()}function we(e,n){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=n==null?void 0:n.name,Re&&Re.push(this)}we.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.m=n)}finally{e()}};we.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Zt(this),Qt(this),ne++;var e=C;return C=this,gn.bind(this,e)};we.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ee,Ee=this)};we.prototype.d=function(){this.f|=8,1&this.f||ut(this)};we.prototype.dispose=function(){this.d()};function Oe(e,n){var s=new we(e,n);try{s.c()}catch(r){throw s.d(),r}var l=s.d.bind(s);return l[Symbol.dispose]=l,l}var Yt,ze,bn=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Jt=[];Oe(function(){Yt=this.N})();function ke(e,n){D[e]=n.bind(null,D[e]||function(){})}function Xe(e){if(ze){var n=ze;ze=void 0,n()}ze=e&&e.S()}function en(e){var n=this,s=e.data,l=yn(s);l.name="ReactiveDom",l.value=s;var r=le(function(){for(var o=n,c=n.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=St(function(){var h=l.value.value;return h===0?0:h===!0?"":h||""}),u=St(function(){return!Array.isArray(d.value)&&!cn(d.value)}),f=Oe(function(){if(this.N=tn,u.value){var h=d.value;o.__v&&o.__v.__e&&o.__v.__e.nodeType===3&&(o.__v.__e.data=h)}}),x=n.__$u.d;return n.__$u.d=function(){f(),x.call(this)},[u,d]},[]),a=r[0],i=r[1];return a.value?i.peek():i.value}en.displayName="ReactiveTextNode";Object.defineProperties(U.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:en},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});ke("__b",function(e,n){if(typeof n.type=="string"){var s,l=n.props;for(var r in l)if(r!=="children"){var a=l[r];a instanceof U&&(s||(n.__np=s={}),s[r]=a,l[r]=a.peek())}}e(n)});ke("__r",function(e,n){if(e(n),n.type!==ie){Xe();var s,l=n.__c;l&&(l.__$f&=-2,(s=l.__$u)===void 0&&(l.__$u=s=function(r,a){var i;return Oe(function(){i=this},{name:a}),i.c=r,i}(function(){var r;bn&&((r=s.y)==null||r.call(s)),l.__$f|=1,l.setState({})},typeof n.type=="function"?n.type.displayName||n.type.name:""))),Xe(s)}});ke("__e",function(e,n,s,l){Xe(),e(n,s,l)});ke("diffed",function(e,n){Xe();var s;if(typeof n.type=="string"&&(s=n.__e)){var l=n.__np,r=n.props,a=s.U;if(a)for(var i in a){var o=a[i];o===void 0||l&&i in l||(o.d(),a[i]=void 0)}if(l){a||(a={},s.U=a);for(var c in l){var d=a[c],u=l[c];d===void 0?(d=_n(s,c,u,r),a[c]=d):d.o(u,r)}}}e(n)});function _n(e,n,s,l){var r=n in e&&e.ownerSVGElement===void 0,a=L(s);return{o:function(i,o){a.value=i,l=o},d:Oe(function(){this.N=tn;var i=a.value.value;l[n]!==i&&(l[n]=i,r?e[n]=i:i!=null&&(i!==!1||n[4]==="-")?e.setAttribute(n,i):e.removeAttribute(n))})}}ke("unmount",function(e,n){if(typeof n.type=="string"){var s=n.__e;if(s){var l=s.U;if(l){s.U=void 0;for(var r in l){var a=l[r];a&&a.d()}}}var i=n.__np;if(i){var o=n.props;for(var c in i)o[c]=i[c]}n.__np=void 0}else{var d=n.__c;if(d){var u=d.__$u;u&&(d.__$u=void 0,u.d())}}e(n)});ke("__h",function(e,n,s,l){l<3&&(n.__$f|=2),e(n,s,l)});Ne.prototype.shouldComponentUpdate=function(e,n){if(this.__R)return!0;var s=this.__$u,l=s&&s.s!==void 0;for(var r in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(l||a||4&this.__$f)||1&this.__$f)return!0}else if(!(l||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var o in this.props)if(!(o in e))return!0;return!1};function yn(e,n){return le(function(){return L(e,n)},[])}var Nn=function(e){queueMicrotask(function(){queueMicrotask(e)})};function wn(){xn(function(){for(var e;e=Jt.shift();)Yt.call(e)})}function tn(){Jt.push(this)===1&&(D.requestAnimationFrame||Nn)(wn)}const nt=L("dashboard"),de=L(null),_e=L(null),ye=L(null),Pe=L(0),kn=L(50),X=L(new Set),st=L(new Set),W=L(""),b=L({topK:10,minScore:.35,keywordWeight:.4,hybrid:!0,pathFilter:"",langFilter:"",extFilter:""}),ae=L([]),Ze=L([]);L(!1);L(null);L([]);L(new Set);L(null);L(null);const se=L(typeof localStorage<"u"?localStorage.getItem("theme")??"dark":"dark"),qe=L(!0),Ie=L([]);let Sn=0;function re(e,n,s=4e3){const l=Sn++;Ie.value=[...Ie.value,{id:l,type:e,message:n,duration:s}],setTimeout(()=>{Ie.value=Ie.value.filter(r=>r.id!==l)},s)}function j(e){window.location.hash=e}function Cn(){O(()=>{document.documentElement.classList.toggle("dark",se.value==="dark"),localStorage.setItem("theme",se.value)},[se.value]);const e=()=>{se.value=se.value==="dark"?"light":"dark"};return{theme:se.value,toggle:e}}function $n(){O(()=>{let e=null,n=null;const s=()=>{e&&(clearTimeout(e),e=null),n&&(window.removeEventListener("keydown",n),n=null)},l=r=>{const a=r.target,i=a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable;if((r.metaKey||r.ctrlKey)&&r.key==="k"){r.preventDefault(),j("search"),setTimeout(()=>{var o;(o=document.querySelector(".global-search-input"))==null||o.focus()},0);return}if(!i&&r.key==="g"){const o={d:()=>j("dashboard"),s:()=>j("search"),c:()=>j("chunks"),f:()=>j("files"),e:()=>j("evaluate"),q:()=>j("quirks")};s();const c=d=>{var u;(u=o[d.key])==null||u.call(o),s()};n=c,window.addEventListener("keydown",c),e=setTimeout(s,500);return}};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),s()}},[])}function Ln(){return t("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:Ie.value.map(e=>t("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))})}function Tn(){const e=se.value==="dark";return t("button",{className:"p-2 rounded-lg transition-colors",style:{color:"var(--text-muted)"},onClick:()=>{se.value=e?"light":"dark"},"aria-label":e?"Switch to light mode":"Switch to dark mode",title:e?"Light mode":"Dark mode",children:[t("span",{className:"sr-only",children:e?"Switch to light mode":"Switch to dark mode"}),e?t("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:t("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"})}):t("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:t("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 ht(e,n){const[s,l]=g(e);return O(()=>{const r=setTimeout(()=>l(e),n);return()=>clearTimeout(r)},[e,n]),s}const Pn="/api",Ct="opencode-rag-token";function In(){const e=new URLSearchParams(window.location.search).get("token");if(e){sessionStorage.setItem(Ct,e);const n=window.location.pathname+window.location.hash;return window.history.replaceState(null,"",n),e}return sessionStorage.getItem(Ct)}function Rn(){const e=In();return e?{Authorization:`Bearer ${e}`}:{}}function $t(e){const n=new URLSearchParams;for(const[s,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(s,String(l));return n.toString()}async function R(e,n){const s={...(n==null?void 0:n.headers)??{},...Rn()},l=await fetch(Pn+e,{...n,headers:s}),r=await l.json();if(!l.ok)throw new Error(r.error??l.statusText);return r}const $={stats:()=>R("/stats"),files:()=>R("/files"),chunks:e=>R(`/chunks?${$t(e)}`),chunk:e=>R(`/chunks/${encodeURIComponent(e)}`),search:(e,n=20)=>R(`/search?q=${encodeURIComponent(e)}&topK=${n}`),compare:e=>R(`/compare?ids=${e.join(",")}`),retrieve:e=>R(`/retrieve?${$t(e)}`),evalSessions:()=>R("/eval/sessions"),evalSession:e=>R(`/eval/sessions/${encodeURIComponent(e)}`),evalDeleteSession:e=>R(`/eval/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),evalCompare:(e,n)=>R(`/eval/compare?a=${e}&b=${n}`),evalTokenCompare:(e,n)=>R(`/eval/token-compare?a=${e}&b=${n}`),evalAnalysis:e=>R(`/eval/sessions/${encodeURIComponent(e)}/analysis`),evalProjectSavings:e=>R("/eval/project-savings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),quirks:()=>R("/quirks"),quirkLint:()=>R("/quirks/lint"),deleteQuirk:e=>R(`/quirks/${encodeURIComponent(e)}`,{method:"DELETE"}),indexStatus:()=>R("/indexing/status"),triggerReindex:()=>R("/indexing/reindex",{method:"POST"}),config:()=>R("/config"),embeddingProj:(e=5e3,n=2)=>R(`/embeddings/projection?maxChunks=${e}&dims=${n}`)},En={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 je(e){return En[e]??"text-slate-400"}function he(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${je(e)} bg-slate-800">${Mn(e)}</span>`}function Mn(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function k(e){return typeof e!="string"?"":e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Lt(e,n=80){const s=typeof e=="string"?e:String(e??"");return s.length>n?s.slice(0,n)+"...":s}function Fn(){const[e,n]=g(""),[s,l]=g([]),[r,a]=g(!1),i=te(null),o=te(null),c=ht(e,300);O(()=>{if(!c.trim()){l([]),a(!1);return}let f=!1;return $.search(c,10).then(x=>{f||(l((x==null?void 0:x.results)??[]),a(!0))}).catch(()=>{f||a(!1)}),()=>{f=!0}},[c]),O(()=>{const f=x=>{o.current&&!o.current.contains(x.target)&&a(!1)};return document.addEventListener("click",f),()=>document.removeEventListener("click",f)},[]);const d=f=>{f.key==="Escape"&&a(!1)},u=async f=>{a(!1),n(""),j("chunks")};return t("div",{ref:o,className:"relative",children:[t("input",{ref:i,type:"text",placeholder:"Search codebase...",value:e,onInput:f=>n(f.target.value),onKeyDown:d,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":r}),r&&s.length>0&&t("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:s.map(f=>t("div",{className:"search-result p-2 hover:bg-slate-700 cursor-pointer border-b border-slate-700 last:border-0",onClick:()=>u(f.chunk.id),role:"option",children:[t("div",{className:"flex items-center gap-2 text-xs",children:[t("span",{className:"text-yellow-400 font-mono",children:[k(f.chunk.filePath),":",f.chunk.startLine,"-",f.chunk.endLine]}),t("span",{dangerouslySetInnerHTML:{__html:he(f.chunk.language)}}),t("span",{className:"ml-auto text-slate-500",children:f.score})]}),t("div",{className:"text-xs text-slate-400 mt-1 truncate",children:k(f.chunk.content??"").slice(0,80)})]},f.chunk.id))}),r&&e.trim()&&s.length===0&&t("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,n=[]){const[s,l]=g(null),[r,a]=g(!0),[i,o]=g(null),[c,d]=g(0);return O(()=>{let u=!1;return a(!0),o(null),e().then(f=>{u||(l(f),a(!1))}).catch(f=>{u||(o(f.message),a(!1))}),()=>{u=!0}},[...n,c]),{data:s,isLoading:r,error:i,refresh:()=>d(u=>u+1)}}function An(){const{data:e}=J(()=>$.files()),n=e??[],[s,l]=g(""),r=ht(s,300),a=r?n.filter(i=>i.filePath.toLowerCase().includes(r.toLowerCase())):n;return t("div",{className:"flex flex-col h-full",children:[t("div",{className:"flex items-center justify-between mb-2 px-3 pt-3",children:[t("h2",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wide",children:"Files"}),t("span",{className:"text-xs text-slate-500",children:a.length})]}),t("div",{className:"px-3 mb-2",children:t("input",{type:"text",placeholder:"Filter files...",value:s,onInput:i=>l(i.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"})}),t("div",{className:"flex-1 overflow-y-auto px-1",children:t(Dn,{files:a})})]})}function Dn({files:e}){const n={};for(const s of e){const l=s.filePath.split("/");let r=n;for(let a=0;a<l.length-1;a++)r[l[a]]||(r[l[a]]={}),r=r[l[a]];r.__files||(r.__files=[]),r.__files.push(s)}return t(sn,{obj:n,depth:0,parentPath:""})}function nn(e){let n=(e.__files||[]).length;for(const[s,l]of Object.entries(e))s!=="__files"&&(n+=nn(l));return n}function sn({obj:e,depth:n,parentPath:s}){const l=Object.entries(e).filter(([a])=>a!=="__files").sort(([a],[i])=>a.localeCompare(i)),r=e.__files||[];return t(ie,{children:[l.map(([a,i])=>{const o=s?`${s}/${a}`:a,c=nn(i),d=st.value.has(o),u=d?"▸":"▾";return t("div",{children:[t("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:`${n*12+8}px`},onClick:()=>{const f=new Set(st.value);f.has(o)?f.delete(o):f.add(o),st.value=f},role:"treeitem","aria-expanded":!d,children:[t("span",{className:"text-xs",children:u}),t("span",{className:"text-xs",children:"📁"}),t("span",{className:"text-xs",children:k(a)}),t("span",{className:"text-xs text-slate-600 ml-auto",children:c})]}),!d&&t("div",{className:"dir-children",children:t(sn,{obj:i,depth:n+1,parentPath:o})})]},o)}),r.map(a=>{const i=a.filePath.split("/").pop()??a.filePath,o=de.value===a.filePath;return t("div",{className:`file-item flex items-center gap-1 py-0.5 px-2 rounded cursor-pointer ${o?"active text-white":"text-slate-400 hover:text-white"}`,style:{paddingLeft:`${n*12+8}px`},onClick:()=>{de.value=a.filePath,j(`chunks?file=${encodeURIComponent(a.filePath)}`)},role:"treeitem",tabIndex:0,children:[t("span",{className:`text-xs ${je(a.language)}`,children:"♦"}),t("span",{className:"text-xs truncate",children:k(i)}),t("span",{className:"text-xs text-slate-600 ml-auto",children:a.chunkCount})]},a.filePath)})]})}const Z="bg-gradient-to-r from-slate-700 via-slate-600 to-slate-700 bg-[length:200%_100%]";function G({type:e="card"}){return t("div",{className:"animate-pulse space-y-4",children:[t("div",{className:`h-8 ${Z} rounded w-48`}),e==="card"&&t("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[1,2,3,4].map(n=>t("div",{className:"h-24 bg-slate-800 rounded-lg border border-slate-700 p-4",children:[t("div",{className:`h-3 ${Z} rounded w-16 mb-2`}),t("div",{className:`h-6 ${Z} rounded w-24`})]},n))}),e==="table"&&t("div",{className:"space-y-2",children:[t("div",{className:`h-10 ${Z} rounded w-full`}),[1,2,3,4,5].map(n=>t("div",{className:`h-8 ${Z} rounded w-full`},n))]}),e==="chart"&&t("div",{className:`h-64 ${Z} rounded-lg`}),e==="detail"&&t("div",{className:"flex gap-4",children:[t("div",{className:"flex-1 space-y-3",children:[t("div",{className:`h-6 ${Z} rounded w-48`}),t("div",{className:`h-4 ${Z} rounded w-32`}),t("div",{className:`h-32 ${Z} rounded-lg`})]}),t("div",{className:"flex-1 space-y-3",children:[t("div",{className:`h-6 ${Z} rounded w-48`}),t("div",{className:`h-4 ${Z} rounded w-32`}),t("div",{className:`h-32 ${Z} rounded-lg`})]})]})]})}function ee({message:e,onRetry:n}){return t("div",{className:"flex flex-col items-center justify-center py-12 text-center",role:"alert",children:[t("span",{className:"text-4xl mb-3",children:"⚠️"}),t("p",{className:"text-slate-400 mb-4",children:e}),n&&t("button",{className:"bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors",onClick:n,children:"Retry"})]})}function fe({icon:e,message:n,action:s}){return t("div",{className:"flex flex-col items-center justify-center py-16 text-center",role:"status",children:[t("span",{className:"text-5xl mb-4",role:"img","aria-label":e,children:e}),t("p",{className:"text-slate-400 mb-4",children:n}),s&&t("button",{className:"bg-brand-600 hover:bg-brand-500 text-white px-4 py-2 rounded transition-colors",onClick:s.onClick,children:s.label})]})}function V({label:e,value:n,icon:s}){return t("div",{className:"kpi-card p-4",children:[s&&t("span",{className:"text-lg mb-1 block",children:s}),t("div",{className:"text-slate-400 text-xs mb-1",children:e}),t("div",{className:"text-3xl font-bold text-white",children:n})]})}function H(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"k":String(e)}function Ye(e){return e===0?"$0.00":e<.01?"$"+e.toFixed(4):"$"+e.toFixed(2)}function On(e){return e>=6e4?(e/6e4).toFixed(1)+"m":e>=1e3?(e/1e3).toFixed(1)+"s":e+"ms"}function an(e){if(!e)return"-";const n=new Date(e);return n.toLocaleDateString()+" "+n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function jn(e){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const l=Math.floor(s/60);return l<24?`${l}h ago`:`${Math.floor(l/24)}d ago`}function Un(){var x;const[e,n]=g(null),[s,l]=g(!0),[r,a]=g(!1),i=te(null),o=async()=>{try{const h=await $.indexStatus();n(h.body??h)}catch{}l(!1)};O(()=>{o()},[]),O(()=>()=>{i.current&&clearInterval(i.current)},[]);const c=async()=>{var h;a(!0);try{await $.triggerReindex(),re("info","Reindex started in background");const p=(h=e==null?void 0:e.manifest)==null?void 0:h.lastIndexedAt,m=Date.now();i.current=setInterval(async()=>{var _;if(Date.now()-m>10*6e4){i.current&&clearInterval(i.current),i.current=null,a(!1),re("info","Reindex is still running — check back later");return}try{const T=await $.indexStatus(),M=T.body??T;((_=M.manifest)==null?void 0:_.lastIndexedAt)!==p&&(i.current&&clearInterval(i.current),i.current=null,n(M),a(!1),re("success","Reindex complete!"))}catch{}},2e3)}catch(p){const m=p.message??"";re("error",/already running/i.test(m)?"A reindex is already running":`Reindex failed: ${m}`),a(!1)}};if(s)return null;const d=(x=e==null?void 0:e.manifest)!=null&&x.lastIndexedAt?jn(e.manifest.lastIndexedAt):"Never",u=(e==null?void 0:e.staleFileCount)??0,f=u===0?"text-green-400":u<50?"text-amber-400":"text-red-400";return t("div",{className:"kpi-card p-4 mb-6",children:[t("div",{className:"flex items-center justify-between mb-3",children:t("h2",{className:"text-lg font-semibold",children:"Index Status"})}),e!=null&&e.manifest?t("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[t("div",{children:[t("span",{className:"text-xs text-slate-500 block",children:"Last Indexed"}),t("span",{className:"text-sm font-mono",children:d})]}),t("div",{children:[t("span",{className:"text-xs text-slate-500 block",children:"Total Chunks"}),t("span",{className:"text-sm font-mono",children:H(e.manifest.totalChunks)})]}),t("div",{children:[t("span",{className:"text-xs text-slate-500 block",children:"Total Files"}),t("span",{className:"text-sm font-mono",children:H(e.manifest.totalFiles)})]}),t("div",{children:[t("span",{className:"text-xs text-slate-500 block",children:"Schema Version"}),t("span",{className:"text-sm font-mono",children:e.manifest.schemaVersion})]}),t("div",{className:"col-span-2",children:[t("span",{className:"text-xs text-slate-500 block",children:"Index Freshness"}),t("span",{className:`text-sm font-mono ${f}`,children:u===0?"✓ Up to date":`⚠ ${u} file${u!==1?"s":""} modified since last index`})]}),t("div",{className:"col-span-2 flex items-end",children:r?t("div",{className:"flex items-center gap-2",children:[t("span",{className:"animate-spin",children:"⟳"}),t("span",{className:"text-sm text-amber-400",children:"Reindexing..."})]}):t("button",{className:"bg-brand-600 hover:bg-brand-500 text-white px-4 py-1.5 rounded text-sm transition-colors",onClick:c,children:"Reindex Now"})})]}):t("div",{className:"text-sm text-slate-400",children:["No index found. Run ",t("code",{className:"text-brand-400",children:"opencode-rag index"})," first."]})]})}function zn(){var x,h,p;const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.stats()),{data:r}=J(()=>$.files());if(n)return t(G,{type:"card"});if(s)return t(ee,{message:s,onRetry:l});if(!e)return t(fe,{icon:"📊",message:"No dashboard data available."});const a=e,i=((x=r==null?void 0:r.body)==null?void 0:x.length)??a.totalFiles??0,o=a.totalChunks??0,c=((h=a.languages)==null?void 0:h.length)??0,d=i>0?(o/i).toFixed(1):"0",u=(a.languages??[]).slice(0,8),f=((p=u[0])==null?void 0:p.count)??1;return t("div",{children:[t("h1",{className:"text-2xl font-bold mb-6",children:"Dashboard"}),t("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8",children:[t(V,{label:"Total Chunks",value:o.toLocaleString(),icon:"🧩"}),t(V,{label:"Total Files",value:i.toLocaleString(),icon:"📄"}),t(V,{label:"Languages",value:c,icon:"🔤"}),t(V,{label:"Avg Chunks/File",value:d,icon:"📊"})]}),t("div",{className:"kpi-card p-4",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-3",children:"Language Distribution"}),t("div",{className:"space-y-2",children:u.map(m=>t("div",{className:"flex items-center gap-3",children:[t("span",{className:`w-24 text-xs text-right ${je(m.language)}`,children:m.language}),t("div",{className:"flex-1 bg-slate-800 rounded-full h-5 overflow-hidden",children:t("div",{className:"h-full rounded-full bg-brand-500 flex items-center pl-2",style:{width:`${Math.max(8,m.count/f*100)}%`},children:t("span",{className:"text-xs font-medium text-white",children:m.count})})}),t("span",{className:"text-xs text-slate-500 w-12 text-right",children:[(m.count/o*100).toFixed(0),"%"]})]},m.language))})]}),t(Un,{}),t("div",{className:"mt-6",children:t("h2",{className:"text-lg font-semibold mb-3",children:t("a",{href:"#config",className:"hover:text-brand-400 transition-colors",children:"Configuration"})})})]})}function Tt({text:e,color:n,onDismiss:s}){return t("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-mono bg-slate-800 ${n??"text-slate-400"}`,children:[e,s&&t("button",{className:"ml-0.5 text-slate-500 hover:text-white",onClick:s,"aria-label":`Dismiss ${e} filter`,children:"×"})]})}function qn(){const e=De();O(()=>{e.params.file&&(de.value=e.params.file),e.params.lang&&(_e.value=e.params.lang)},[e.params.file,e.params.lang]);const n=Pe.value,s=kn.value,l=de.value,r=_e.value,{data:a,isLoading:i,error:o,refresh:c}=J(()=>$.chunks({offset:n,limit:s,lang:r??"",file:l??""}),[n,s,l,r]);if(i)return t(G,{type:"detail"});if(o)return t(ee,{message:o,onRetry:c});const d=(a==null?void 0:a.chunks)??[],u=(a==null?void 0:a.total)??d.length,f=Math.ceil(u/s),x=Math.floor(n/s)+1;return t("div",{className:"flex gap-4 h-full",children:[t("div",{className:"w-1/2 flex flex-col",children:[t("div",{className:"flex items-center gap-3 mb-3 flex-wrap",children:[t("h2",{className:"text-lg font-semibold text-white",children:"Chunks"}),t("span",{className:"text-sm text-slate-400",children:[u," total"]}),_e.value&&t(Tt,{text:_e.value,color:je(_e.value),onDismiss:()=>{_e.value=null,ye.value=null,Pe.value=0}}),de.value&&t(Tt,{text:de.value,onDismiss:()=>{de.value=null,ye.value=null,Pe.value=0}})]}),t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 overflow-hidden flex-1",children:t("table",{className:"w-full text-sm",role:"table",children:[t("thead",{children:t("tr",{className:"bg-slate-800 text-slate-400 text-xs",children:[t("th",{className:"px-2 py-2 w-8",children:t("input",{type:"checkbox",className:"accent-brand-500",checked:d.length>0&&d.every(h=>X.value.has(h.id||`chunk-${d.indexOf(h)}`)),onChange:()=>{const h=d.map((_,T)=>_.id||`chunk-${T}`),p=h.every(_=>X.value.has(_)),m=new Set(X.value);for(const _ of h)p?m.delete(_):m.add(_);X.value=m},"aria-label":"Select all chunks on this page"})}),t("th",{className:"px-3 py-2 text-left",children:"File"}),t("th",{className:"px-3 py-2 text-left w-20",children:"Lang"}),t("th",{className:"px-3 py-2 text-left",children:"Description"})]})}),t("tbody",{children:d.length===0?t("tr",{children:t("td",{colSpan:4,className:"px-3 py-8 text-center text-slate-500",children:[t("span",{className:"text-2xl block mb-2",children:"🔍"}),"No chunks found"]})}):d.map((h,p)=>{const m=h.id||`chunk-${p}`,_=ye.value===m,T=X.value.has(m);return t("tr",{className:`chunk-row border-t border-slate-800 cursor-pointer ${_?"selected":""}`,onClick:()=>{ye.value=m},role:"row",tabIndex:0,children:[t("td",{className:"px-2 py-2",onClick:M=>M.stopPropagation(),children:t("input",{type:"checkbox",className:"accent-brand-500",checked:T,onChange:()=>{const M=new Set(X.value);M.has(m)?M.delete(m):M.add(m),X.value=M},"aria-label":`Select chunk ${m}`})}),t("td",{className:"px-3 py-2 text-yellow-400 font-mono text-xs",children:[k(h.filePath),":",h.startLine,"-",h.endLine]}),t("td",{className:"px-3 py-2",dangerouslySetInnerHTML:{__html:he(h.language)}}),t("td",{className:"px-3 py-2 text-slate-400 text-xs",children:k(h.description??"").slice(0,50)})]},m)})})]})}),t("div",{className:"flex items-center justify-between mt-3",children:[t("button",{className:"px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50",disabled:x<=1,onClick:()=>{Pe.value=Math.max(0,n-s)},children:"Previous"}),t("span",{className:"text-sm text-slate-400",children:["Page ",x," of ",f||1]}),t("button",{className:"px-3 py-1 bg-slate-700 rounded text-sm hover:bg-slate-600 disabled:opacity-50",disabled:x>=f,onClick:()=>{Pe.value+=s},children:"Next"})]}),X.value.size>=2&&X.value.size<=3&&t("div",{className:"fixed bottom-6 right-6 z-50",children:t("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:()=>{const h=[...X.value];X.value=new Set,j(`compare?ids=${h.join(",")}`)},children:["Compare (",X.value.size,")"]})})]}),t("div",{className:"w-1/2 overflow-y-auto",children:ye.value?t(Hn,{chunkId:ye.value,chunks:d}):t("div",{className:"flex items-center justify-center h-full text-slate-500",children:t("div",{className:"text-center",children:[t("div",{className:"text-4xl mb-2",children:"📄"}),t("div",{className:"text-sm",children:"Select a chunk to view details"})]})})})]})}function Hn({chunkId:e,chunks:n}){const[s,l]=g(null),[r,a]=g(!1),i=te(null);if(O(()=>{let u=!1;const f=n.find(x=>x.id===e);return f?l(f):$.chunk(e).then(x=>{u||l(x)}).catch(()=>{u||l({id:e,content:"",filePath:"not found",language:"",startLine:0,endLine:0,description:""})}),()=>{u=!0}},[e,n]),O(()=>()=>{i.current&&clearTimeout(i.current)},[]),!s)return t(G,{type:"detail"});const o=s,c=o.language==="image",d=()=>{navigator.clipboard.writeText(o.content).then(()=>{a(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>a(!1),1500)})};return t("div",{children:[t("div",{className:"mb-3",children:[t("div",{className:"flex items-center gap-3 mb-1",children:t("span",{className:"text-yellow-400 font-mono text-sm",children:k(o.filePath)})}),t("div",{className:"flex items-center gap-3 text-sm text-slate-400",children:[t("span",{children:["Lines ",o.startLine,"-",o.endLine]}),t("span",{dangerouslySetInnerHTML:{__html:he(o.language)}}),o.id&&t("span",{className:"text-xs text-slate-600 font-mono",children:o.id})]})]}),o.description&&t("div",{className:"kpi-card p-3 mb-3",children:[t("h3",{className:"text-xs font-semibold text-slate-400 mb-1",children:"Description"}),t("p",{className:"text-sm text-slate-300",children:k(o.description)})]}),c&&t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 overflow-hidden mb-3",children:[t("div",{className:"px-3 py-1.5 bg-slate-800 border-b border-slate-700",children:t("span",{className:"text-xs text-slate-400",children:"Image Preview"})}),t("div",{className:"p-3 flex items-center justify-center bg-slate-950",children:t("img",{src:`/api/file?path=${encodeURIComponent(o.filePath)}`,alt:o.filePath,className:"max-w-full max-h-[60vh] object-contain rounded",onError:u=>{const f=u.currentTarget;f.style.display="none",f.parentElement.innerHTML='<span class="text-slate-500 text-sm">Image not available</span>'}})})]}),t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 overflow-hidden",children:[t("div",{className:"px-3 py-1.5 bg-slate-800 border-b border-slate-700 flex items-center justify-between",children:[t("span",{className:"text-xs text-slate-400",children:c?"Vision Analysis":"Source Code"}),t("button",{className:"text-xs text-slate-500 hover:text-white transition-colors",onClick:d,children:r?"Copied!":"Copy"})]}),t("pre",{className:"p-3 overflow-x-auto text-sm max-h-[calc(100vh-220px)]",children:t("code",{className:`language-${c?"text":o.language}`,children:k(o.content)})})]})]})}function Kn(){const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.files());if(n)return t(G,{type:"table"});if(s)return t(ee,{message:s,onRetry:l});const r=e??[];if(r.length===0)return t(fe,{icon:"📂",message:"No files indexed yet."});const a=r.reduce((i,o)=>i+o.chunkCount,0);return t("div",{children:[t("div",{className:"flex items-center gap-3 mb-4",children:[t("h1",{className:"text-2xl font-bold",children:"Files"}),t("span",{className:"text-sm text-slate-400",children:[r.length," files, ",a," chunks"]})]}),t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 overflow-hidden",children:t("table",{className:"w-full text-sm",role:"table","aria-label":"Indexed files",children:[t("thead",{children:t("tr",{className:"bg-slate-800 text-slate-400 text-xs",children:[t("th",{className:"px-3 py-2 text-left",children:"File"}),t("th",{className:"px-3 py-2 text-left w-28",children:"Language"}),t("th",{className:"px-3 py-2 text-left w-20",children:"Chunks"}),t("th",{className:"px-3 py-2 text-left w-24"})]})}),t("tbody",{children:r.map(i=>t("tr",{className:"border-t border-slate-800 hover:bg-slate-800 cursor-pointer",onClick:()=>j(`chunks?file=${encodeURIComponent(i.filePath)}`),role:"row",tabIndex:0,onKeyDown:o=>{o.key==="Enter"&&j(`chunks?file=${encodeURIComponent(i.filePath)}`)},children:[t("td",{className:"px-3 py-2 text-yellow-400 font-mono text-xs",children:i.filePath}),t("td",{className:"px-3 py-2",dangerouslySetInnerHTML:{__html:he(i.language)}}),t("td",{className:"px-3 py-2 text-slate-300",children:i.chunkCount}),t("td",{className:"px-3 py-2 text-slate-500 text-xs",children:t("span",{className:"hover:text-white transition-colors",children:"View chunks"})})]},i.filePath))})]})})]})}function Bn({segments:e,size:n=180,innerRadius:s,centerLabel:l}){const r=n/2,a=n/2,i=n/2-10,o=s??i*.6,c=e.reduce((x,h)=>x+h.value,0);if(c===0)return t("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,children:[t("circle",{cx:r,cy:a,r:i,fill:"none",stroke:"#334155","stroke-width":i-o}),t("circle",{cx:r,cy:a,r:o,fill:"#0f172a"})]});let d=0;const u=e.map(x=>{const h=x.value/c*360,p=d,m=d+h;return d+=h,`<path d="${Wn(r,a,i,p,m,o)}" fill="${x.color}" />`}).join(""),f=l??"";return t("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,className:"chart-svg",children:[t("g",{dangerouslySetInnerHTML:{__html:u}}),t("text",{x:r,y:a-6,"text-anchor":"middle",fill:"white","font-size":"22","font-weight":"bold",children:f}),t("text",{x:r,y:a+14,"text-anchor":"middle",fill:"#64748b","font-size":"11",children:"tokens"})]})}function Wn(e,n,s,l,r,a){const i=r-l;if(i>=359.99)return`M${e},${n-s} A${s},${s} 0 1,1 ${e-.01},${n-s} L${e-.01},${n-a} A${a},${a} 0 1,0 ${e},${n-a} Z`;const o=T=>(T-90)*Math.PI/180,c=e+s*Math.cos(o(l)),d=n+s*Math.sin(o(l)),u=e+s*Math.cos(o(r)),f=n+s*Math.sin(o(r)),x=e+a*Math.cos(o(r)),h=n+a*Math.sin(o(r)),p=e+a*Math.cos(o(l)),m=n+a*Math.sin(o(l)),_=i>180?1:0;return[`M${c},${d}`,`A${s},${s} 0 ${_} 1 ${u},${f}`,`L${x},${h}`,`A${a},${a} 0 ${_} 0 ${p},${m}`,"Z"].join(" ")}function Vn(){const e=De();return e.params.compare?t(Xn,{ids:[e.params.a??"",e.params.b??""]}):e.params.session?t(Qn,{sessionId:e.params.session}):t(Gn,{})}function Gn(){const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.evalSessions()),[r,a]=g(new Set);if(n)return t(G,{type:"table"});if(s)return t(ee,{message:s,onRetry:l});const i=(e==null?void 0:e.sessions)??[];if(i.length===0)return t(fe,{icon:"📊",message:"No sessions recorded yet."});const o=c=>{const d=new Set(r);d.has(c)?d.delete(c):d.add(c),a(d)};return t("div",{children:[t("div",{className:"flex items-center justify-between mb-4",children:[t("h1",{className:"text-2xl font-bold",children:"Evaluate"}),t("div",{className:"flex gap-2",children:[r.size===2&&t("button",{className:"bg-brand-600 hover:bg-brand-500 text-white px-3 py-1 rounded text-sm transition-colors",onClick:()=>{const[c,d]=[...r];j(`evaluate?compare&a=${encodeURIComponent(c)}&b=${encodeURIComponent(d)}`)},children:"Compare Selected"}),r.size>0&&t("button",{className:"text-xs text-slate-400 hover:text-white",onClick:()=>a(new Set),children:["Clear (",r.size,")"]})]})]}),t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 overflow-x-auto",children:t("table",{className:"w-full text-sm",role:"table",children:[t("thead",{children:t("tr",{className:"bg-slate-800 text-slate-400 text-xs",children:[t("th",{className:"px-2 py-2 w-8"}),t("th",{className:"px-3 py-2 text-left",children:"Session"}),t("th",{className:"px-3 py-2 text-left",children:"Last Activity"}),t("th",{className:"px-3 py-2 text-right",children:"Messages"}),t("th",{className:"px-3 py-2 text-right",children:"Input Tokens"}),t("th",{className:"px-3 py-2 text-right",children:"Output Tokens"}),t("th",{className:"px-3 py-2 text-right",children:"Cost"}),t("th",{className:"px-3 py-2 text-right",children:"RAG Calls"}),t("th",{className:"px-3 py-2 text-right",children:"RAG Tokens"}),t("th",{className:"px-3 py-2 text-left",children:"Model"}),t("th",{className:"px-3 py-2 w-8"})]})}),t("tbody",{children:i.map(c=>{var d,u,f,x;return t("tr",{className:"border-t border-slate-800 hover:bg-slate-800 cursor-pointer",onClick:()=>j(`evaluate?session=${encodeURIComponent(c.sessionID)}`),children:[t("td",{className:"px-2 py-2",onClick:h=>h.stopPropagation(),children:t("input",{type:"checkbox",className:"accent-brand-500",checked:r.has(c.sessionID),onChange:()=>o(c.sessionID),"aria-label":`Select session ${c.title??c.sessionID}`})}),t("td",{className:"px-3 py-2 text-slate-200 font-mono text-xs",children:c.title??c.sessionID.slice(0,8)}),t("td",{className:"px-3 py-2 text-slate-400 text-xs",children:an(c.lastEventAt)}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:c.messageCount}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:H((((d=c.totalTokens)==null?void 0:d.input)??0)+(((u=c.totalTokens)==null?void 0:u.cacheRead)??0))}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:H(((f=c.totalTokens)==null?void 0:f.output)??0)}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:Ye(c.totalCost??0)}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:c.ragContextCount??0}),t("td",{className:"px-3 py-2 text-slate-300 text-right",children:H(c.ragContextTokens??0)}),t("td",{className:"px-3 py-2 text-slate-400 text-xs",children:((x=c.models)==null?void 0:x[0])??"-"}),t("td",{className:"px-3 py-2",onClick:h=>h.stopPropagation(),children:t("button",{className:"text-slate-600 hover:text-red-400 text-xs",onClick:async()=>{if(confirm("Delete this session?"))try{await $.evalDeleteSession(c.sessionID),re("success","Session deleted"),l()}catch(h){re("error",`Delete failed: ${h.message}`)}},"aria-label":"Delete session",children:"🗑"})})]},c.sessionID)})})]})})]})}function Qn({sessionId:e}){var f,x,h,p,m,_,T,M;const{data:n,isLoading:s,error:l,refresh:r}=J(()=>$.evalSession(e));if(s)return t(G,{type:"detail"});if(l)return t(ee,{message:l,onRetry:r});const a=(n==null?void 0:n.summary)??n,i=(n==null?void 0:n.events)??[],o=a.toolCallCounts??{};["search_semantic","get_file_skeleton","find_usages","describe_image"].reduce((y,Y)=>y+(o[Y]??0),0);const d=[{label:"Input",value:(((f=a.totalTokens)==null?void 0:f.input)??0)+(((x=a.totalTokens)==null?void 0:x.cacheRead)??0),color:"#3b82f6"},{label:"Output",value:((h=a.totalTokens)==null?void 0:h.output)??0,color:"#a855f7"},{label:"RAG",value:a.ragContextTokens??0,color:"#06b6d4"},{label:"Reasoning",value:((p=a.totalTokens)==null?void 0:p.reasoning)??0,color:"#f59e0b"}].filter(y=>y.value>0),u=d.reduce((y,Y)=>y+Y.value,0);return t("div",{children:[t("div",{className:"flex items-center gap-3 mb-4",children:[t("button",{className:"text-sm text-slate-400 hover:text-white",onClick:()=>j("evaluate"),children:"← Back"}),t("h1",{className:"text-xl font-bold",children:a.title??((m=a.sessionID)==null?void 0:m.slice(0,12))})]}),t("div",{className:"grid grid-cols-3 lg:grid-cols-5 gap-3 mb-6",children:[t(V,{label:"Total Tokens",value:H(u)}),t(V,{label:"Input",value:H((((_=a.totalTokens)==null?void 0:_.input)??0)+(((T=a.totalTokens)==null?void 0:T.cacheRead)??0))}),t(V,{label:"Output",value:H(((M=a.totalTokens)==null?void 0:M.output)??0)}),t(V,{label:"Cost",value:Ye(a.totalCost??0)}),t(V,{label:"RAG Context",value:H(a.ragContextTokens??0)})]}),t("div",{className:"flex items-center gap-6 mb-6",children:[t(Bn,{segments:d,centerLabel:H(u)}),t("div",{className:"flex flex-wrap gap-3",children:d.map(y=>t("div",{className:"flex items-center gap-1.5 text-xs text-slate-400",children:[t("span",{className:"inline-block w-3 h-3 rounded-sm",style:{background:y.color}}),y.label,": ",H(y.value)," (",(y.value/u*100).toFixed(1),"%)"]},y.label))})]}),t("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:[t(V,{label:"Messages",value:a.messageCount??0}),t(V,{label:"Steps",value:a.totalSteps??0}),t(V,{label:"RAG Injections",value:a.ragContextCount??0}),t(V,{label:"Avg Response",value:On(a.avgResponseTimeMs??0)})]}),Object.keys(o).length>0&&t("div",{className:"kpi-card p-4 mb-6",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-3",children:"Tool Calls"}),t("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2",children:Object.entries(o).map(([y,Y])=>t("div",{className:"flex justify-between text-xs text-slate-400",children:[t("span",{className:"font-mono",children:y}),t("span",{className:"text-white",children:String(Y)})]},y))})]}),a.models&&a.models.length>0&&t("div",{className:"kpi-card p-4 mb-6",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-2",children:"Models"}),t("div",{className:"flex flex-wrap gap-2",children:a.models.map(y=>t("span",{className:"px-2 py-0.5 rounded text-xs font-mono bg-slate-800 text-slate-300",children:y},y))})]}),i.length>0&&t("div",{className:"kpi-card p-4",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-3",children:"Event Timeline"}),t("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:i.map((y,Y)=>t("div",{className:"flex gap-2 text-xs border-b border-slate-700/50 py-1",children:[t("span",{className:"text-slate-500 shrink-0 w-16",children:an(y.ts)}),t("span",{className:"text-slate-400",children:y.event}),y.tool&&t("span",{className:"text-slate-500 font-mono",children:y.tool}),y.toolStatus&&t("span",{className:`text-xs ${y.toolStatus==="completed"?"text-green-400":y.toolStatus==="running"?"text-amber-400":"text-slate-500"}`,children:y.toolStatus})]},Y))})]})]})}function Xn({ids:e}){var f,x,h,p,m,_,T,M;const[n,s]=e,{data:l,isLoading:r,error:a}=J(()=>Promise.all([$.evalCompare(n,s),$.evalTokenCompare(n,s)]),[n,s]);if(r)return t(G,{type:"chart"});if(a)return t(ee,{message:a});if(!l)return null;const i=l[0],o=l[1],c=((f=o.sessionA)==null?void 0:f.savings)??0,d=((x=o.sessionB)==null?void 0:x.savings)??0,u=c>0&&d>0?"RAG saves tokens":"Mixed results";return t("div",{children:[t("div",{className:"flex items-center gap-3 mb-4",children:[t("button",{className:"text-sm text-slate-400 hover:text-white",onClick:()=>j("evaluate"),children:"← Back"}),t("h1",{className:"text-xl font-bold",children:"Session Comparison"})]}),t("div",{className:`px-4 py-3 rounded-lg mb-4 font-semibold text-sm ${c>0&&d>0?"bg-green-900/50 text-green-300 border border-green-700":"bg-amber-900/50 text-amber-300 border border-amber-700"}`,children:u}),t("div",{className:"grid grid-cols-2 gap-4",children:[t("div",{className:"kpi-card p-4",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-2",children:((h=i.sessionA)==null?void 0:h.title)??"Session A"}),t("div",{className:"space-y-1 text-sm",children:[t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"Total Tokens"}),t("span",{children:H(((p=i.sessionA)==null?void 0:p.totalTokens)??0)})]}),t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"Cost"}),t("span",{children:Ye(((m=i.sessionA)==null?void 0:m.totalCost)??0)})]}),t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"RAG Savings"}),t("span",{className:c>0?"text-green-400":"text-red-400",children:[H(Math.abs(c))," (",c>0?"+":"",c>0?"+":"",")"]})]})]})]}),t("div",{className:"kpi-card p-4",children:[t("h3",{className:"text-sm font-semibold text-slate-300 mb-2",children:((_=i.sessionB)==null?void 0:_.title)??"Session B"}),t("div",{className:"space-y-1 text-sm",children:[t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"Total Tokens"}),t("span",{children:H(((T=i.sessionB)==null?void 0:T.totalTokens)??0)})]}),t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"Cost"}),t("span",{children:Ye(((M=i.sessionB)==null?void 0:M.totalCost)??0)})]}),t("div",{className:"flex justify-between",children:[t("span",{className:"text-slate-400",children:"RAG Savings"}),t("span",{className:d>0?"text-green-400":"text-red-400",children:H(Math.abs(d))})]})]})]})]})]})}const Zn={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 Yn(e){return`<span class="inline-block px-1.5 py-0.5 rounded text-xs font-mono ${Zn[e]??"text-slate-400 bg-slate-800"}">${k(e||"general")}</span>`}function Jn(){const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.quirks()),[r,a]=g(null),[i,o]=g(null),[c,d]=g(!1);if(n)return t(G,{type:"card"});if(s)return t(ee,{message:s,onRetry:l});const u=(e==null?void 0:e.quirks)??[],f=[...new Set(u.map(m=>m.type||"general"))],x=r?u.filter(m=>(m.type||"general")===r):u,h=async m=>{if(confirm("Delete this quirk?"))try{await $.deleteQuirk(m),re("success","Quirk deleted"),l()}catch(_){re("error",`Delete failed: ${_.message}`)}};return t("div",{children:[t("div",{className:"flex items-center justify-between mb-4",children:[t("h1",{className:"text-2xl font-bold",children:"Quirks"}),t("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{const m=await $.quirkLint();o(m)}catch(m){o({error:m.message})}d(!1)},disabled:c,children:c?"Linting...":"Lint"})]}),t("div",{className:"flex gap-2 mb-4 flex-wrap",children:[t("button",{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${r===null?"bg-brand-600 text-white":"bg-slate-700 text-slate-300 hover:bg-slate-600"}`,onClick:()=>a(null),children:"All"}),f.map(m=>t("button",{className:`px-2 py-1 rounded text-xs font-medium transition-colors ${r===m?"bg-brand-600 text-white":"bg-slate-700 text-slate-300 hover:bg-slate-600"}`,onClick:()=>a(m),children:m},m))]}),i&&t("div",{className:`mb-4 p-3 rounded-lg border text-sm ${i.success?"bg-green-900/30 border-green-700 text-green-300":i.error?"bg-red-900/30 border-red-700 text-red-300":"bg-amber-900/30 border-amber-700 text-amber-300"}`,children:t("pre",{className:"text-xs whitespace-pre-wrap",children:JSON.stringify(i,null,2)})}),x.length===0?t(fe,{icon:"💡",message:"No quirks stored yet."}):t("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3",children:x.map(m=>t("div",{className:"bg-slate-900 rounded-lg border border-slate-700 p-3 flex flex-col",children:[t("div",{className:"flex items-center justify-between mb-2",children:[t("span",{dangerouslySetInnerHTML:{__html:Yn(m.type)}}),t("span",{className:`text-xs font-mono ${m.confidence>.7?"text-green-400":m.confidence>.4?"text-amber-400":"text-red-400"}`,children:[(m.confidence*100).toFixed(0),"%"]})]}),t("p",{className:"text-sm text-slate-200 mb-2 flex-1",children:k(m.content)}),m.tags&&m.tags.length>0&&t("div",{className:"flex gap-1 flex-wrap mb-2",children:m.tags.map(_=>t("span",{className:"text-xs bg-slate-800 text-slate-400 px-1.5 py-0.5 rounded",children:["#",_]},_))}),t("div",{className:"flex items-center justify-between text-xs text-slate-600 mt-auto",children:[m.sourceRef&&t("span",{className:"font-mono",children:k(m.sourceRef)}),t("span",{className:"font-mono",children:m.id})]}),t("button",{className:"self-end mt-2 text-xs text-slate-600 hover:text-red-400 transition-colors",onClick:()=>h(m.id),"aria-label":"Delete quirk",children:"Delete"})]},m.id))})]})}function es(){const[e,n]=g([]),[s,l]=g(!1),[r,a]=g(null),[i,o]=g(!1),c=ht(b.value,300);return O(()=>{const d=W.value.trim();if(!d){n([]),a(null),l(!1),ae.value=[];return}let u=!1;return(async()=>{var x,h;l(!0),a(null);try{const p=await $.retrieve({q:d,topK:c.topK,minScore:c.minScore,keywordWeight:c.keywordWeight,hybrid:c.hybrid?"true":"false",path:c.pathFilter||void 0,lang:c.langFilter||void 0,ext:c.extFilter||void 0,explain:"true"});if(u)return;if(p.status===503){a(((x=p.body)==null?void 0:x.error)??"Embedding model unavailable"),l(!1);return}o(!1);const m=((h=p.body)==null?void 0:h.results)??p.results??[];n(m),ae.value=m;const _={query:d,params:{...c}};Ze.value=[_,...Ze.value.filter(T=>T.query!==d).slice(0,19)]}catch(p){u||a(p.message)}finally{u||l(!1)}})(),()=>{u=!0}},[W.value,c]),{results:e,isLoading:s,isInitializing:i,error:r,setResults:n}}function ts({explanation:e}){const{vectorScore:n,keywordScore:s,rawVectorScore:l,rawKeywordScore:r,keywordWeight:a,vectorRank:i,keywordRank:o}=e.scoreBreakdown,c=Math.max(n+s,.001),d=(n/c*100).toFixed(0),u=(s/c*100).toFixed(0);return t("div",{className:"mb-2",children:[t("div",{className:"flex items-center gap-2 text-xs mb-1",children:[t("span",{className:"text-cyan-400",title:`Vector: ${l.toFixed(3)}${i!==void 0?`, rank #${i+1}`:""}`,children:["Vector ",d,"%"]}),t("span",{className:"text-amber-400",title:`Keyword: ${r.toFixed(3)}${o!==void 0?`, rank #${o+1}`:""}`,children:["Keyword ",u,"%"]}),t("span",{className:"text-slate-500 ml-auto",children:["kw=",a.toFixed(1)]})]}),t("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden flex",children:[t("div",{className:"h-full bg-cyan-500 transition-all duration-200",style:{width:`${d}%`}}),t("div",{className:"h-full bg-amber-500 transition-all duration-200",style:{width:`${u}%`}})]})]})}function ns(){const e=De(),{results:n,isLoading:s,isInitializing:l,error:r}=es();return O(()=>{e.params.query&&(W.value=e.params.query,b.value={...b.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??""})},[]),O(()=>{if(W.value.trim()){const a=new URLSearchParams({query:W.value,topK:String(b.value.topK),minScore:String(b.value.minScore),keywordWeight:String(b.value.keywordWeight),hybrid:String(b.value.hybrid)});b.value.pathFilter&&a.set("path",b.value.pathFilter),b.value.langFilter&&a.set("lang",b.value.langFilter),b.value.extFilter&&a.set("ext",b.value.extFilter);const i=`search?${a.toString()}`;location.hash!==`#${i}`&&history.replaceState(null,"",`#${i}`)}},[W.value,b.value]),t("div",{children:[t("h1",{className:"text-2xl font-bold mb-4",children:"Semantic Search"}),t("div",{className:"flex gap-3 mb-4",children:t("input",{type:"text",value:W.value,onInput:a=>{W.value=a.target.value,ae.value=[]},onKeyDown:a=>{a.key==="Enter"&&W.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"})}),t("details",{className:"mb-4 bg-slate-800 rounded-lg border border-slate-700",children:[t("summary",{className:"px-3 py-2 text-xs text-slate-400 cursor-pointer hover:text-white font-medium",children:"Search Parameters"}),t("div",{className:"px-3 pb-3 space-y-3",children:[t(at,{label:"topK",min:1,max:25,step:1,value:b.value.topK,onChange:a=>{b.value={...b.value,topK:a}}}),t(at,{label:"minScore",min:0,max:1,step:.05,value:b.value.minScore,onChange:a=>{b.value={...b.value,minScore:a}}}),t(at,{label:"keywordWeight",min:0,max:1,step:.1,value:b.value.keywordWeight,onChange:a=>{b.value={...b.value,keywordWeight:a}}}),t("div",{className:"flex items-center gap-2",children:[t("label",{className:"text-xs text-slate-400 w-28",children:"Hybrid mode"}),t("input",{type:"checkbox",checked:b.value.hybrid,onChange:a=>{b.value={...b.value,hybrid:a.target.checked}},className:"accent-brand-500"})]}),t("div",{className:"flex items-center gap-3",children:[t("label",{className:"text-xs text-slate-400 w-28 shrink-0",children:"Extensions"}),t("input",{type:"text",value:b.value.extFilter,onInput:a=>{b.value={...b.value,extFilter:a.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"})]}),t("div",{className:"flex items-center gap-3",children:[t("label",{className:"text-xs text-slate-400 w-28 shrink-0",children:"Languages"}),t("input",{type:"text",value:b.value.langFilter,onInput:a=>{b.value={...b.value,langFilter:a.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"})]}),t("div",{className:"flex items-center gap-3",children:[t("label",{className:"text-xs text-slate-400 w-28 shrink-0",children:"Path"}),t("input",{type:"text",value:b.value.pathFilter,onInput:a=>{b.value={...b.value,pathFilter:a.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"})]})]})]}),l&&t("div",{className:"text-center py-10 text-slate-400",children:[t("span",{className:"animate-spin inline-block mr-2",children:"⟳"}),"Initializing embedding model..."]}),r&&t(ee,{message:r}),!s&&!r&&W.value.trim()&&n.length===0&&t("div",{className:"text-center py-16 text-slate-500",children:[t("div",{className:"text-4xl mb-2",children:"🔍"}),t("div",{children:['No results found for "',k(W.value),'"']})]}),!s&&!r&&!W.value.trim()&&t("div",{className:"text-center py-16 text-slate-500",children:[t("div",{className:"text-4xl mb-2",children:"🔍"}),t("div",{children:"Enter a query to search your codebase"}),Ze.value.length>0&&t("div",{className:"mt-6",children:[t("p",{className:"text-xs text-slate-600 mb-2",children:"Recent queries:"}),t("div",{className:"flex flex-wrap gap-2 justify-center",children:Ze.value.slice(0,10).map((a,i)=>t("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:()=>{W.value=a.query},children:k(a.query)},i))})]})]}),n.length>0&&t("div",{className:"space-y-3",children:[t("div",{className:"flex items-center justify-between text-sm text-slate-400 mb-2",children:[t("span",{children:[n.length," result",n.length!==1?"s":""]}),s&&t("span",{className:"text-xs text-brand-400 animate-pulse",children:"Searching..."})]}),n.map(a=>t(ss,{result:a},a.chunk.id))]}),s&&n.length===0&&t("div",{className:"text-center py-10 text-slate-400",children:[t("span",{className:"animate-spin inline-block mr-2",children:"⟳"}),"Searching..."]})]})}function ss({result:e}){var l,r;const n=e.chunk,s=e.score;return t("div",{className:"bg-slate-800 rounded-lg p-4 border border-slate-700 hover:border-brand-500/50 transition-colors cursor-pointer",onClick:()=>j(`chunks?id=${encodeURIComponent(n.id)}`),children:[t("div",{className:"flex items-center justify-between mb-2",children:[t("div",{className:"flex items-center gap-2 min-w-0",children:[t("span",{className:"text-sm text-yellow-400 font-mono truncate",children:[k(n.filePath),":",n.startLine,"-",n.endLine]}),t("span",{dangerouslySetInnerHTML:{__html:he(n.language)}})]}),t("span",{className:"text-lg font-bold shrink-0 ml-2",style:{color:as(s)},children:s.toFixed(2)})]}),e.explanation&&t(ts,{explanation:e.explanation}),((r=(l=e.explanation)==null?void 0:l.matchedTerms)==null?void 0:r.length)>0&&t("div",{className:"flex gap-1 flex-wrap mb-2",children:e.explanation.matchedTerms.map(a=>t("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-1.5 py-0.5 rounded",children:k(a)},a))}),n.description&&t("p",{className:"text-sm text-slate-400 mb-2 line-clamp-2",children:k(n.description)}),t("pre",{className:"text-xs overflow-x-auto max-h-32 rounded bg-slate-900/50 p-2",children:t("code",{children:k(n.content??"").slice(0,500)})})]})}function as(e){return e>=.8?"#22c55e":e>=.6?"#06b6d4":e>=.4?"#f59e0b":"#ef4444"}function at({label:e,min:n,max:s,step:l,value:r,onChange:a}){return t("div",{className:"flex items-center gap-3",children:[t("label",{className:"text-xs text-slate-400 w-28 shrink-0",children:e}),t("input",{type:"range",min:n,max:s,step:l,value:r,onInput:i=>a(parseFloat(i.target.value)),className:"flex-1 accent-brand-500"}),t("span",{className:"text-xs text-slate-300 font-mono w-12 text-right",children:r})]})}function ls(){var c;const n=((c=De().params.ids)==null?void 0:c.split(",").filter(Boolean))??[],[s,l]=g([]),[r,a]=g(!0),[i,o]=g(null);return O(()=>{let d=!1;if(n.length<2){o("Select 2-3 chunks to compare."),a(!1);return}return $.compare(n).then(u=>{var f;d||(l(((f=u==null?void 0:u.body)==null?void 0:f.chunks)??(u==null?void 0:u.chunks)??[]),a(!1))}).catch(u=>{d||(o(u.message),a(!1))}),()=>{d=!0}},[n.join(",")]),r?t(G,{type:"detail"}):i?t(ee,{message:i}):s.length<2?t(fe,{icon:"📋",message:"Select 2-3 chunks from the Chunks view to compare them."}):t("div",{children:[t("div",{className:"flex items-center justify-between mb-4",children:[t("h1",{className:"text-2xl font-bold",children:"Chunk Comparison"}),t("button",{className:"text-sm text-slate-400 hover:text-white transition-colors",onClick:()=>j("chunks"),children:"← Back to Chunks"})]}),t("div",{className:`grid gap-4 ${s.length===2?"grid-cols-2":"grid-cols-3"}`,children:s.map((d,u)=>t(rs,{chunk:d,index:u,baseChunk:u>0?s[0]:void 0},d.id))})]})}function rs({chunk:e,index:n,baseChunk:s}){const l=e.content.split(`
|
|
3
|
-
`),r=(s==null?void 0:s.content.split(`
|
|
4
|
-
`))??[];return t("div",{className:"bg-slate-800 rounded-lg border border-slate-700 overflow-hidden flex flex-col",children:[t("div",{className:"p-3 border-b border-slate-700 bg-slate-800/80",children:[t("div",{className:"flex items-center justify-between mb-1",children:[t("span",{className:"text-sm font-mono text-brand-400 truncate mr-2",children:[k(e.filePath),":",e.startLine,"-",e.endLine]}),t("span",{className:"shrink-0",dangerouslySetInnerHTML:{__html:he(e.language)}})]}),e.description&&t("p",{className:"text-xs text-slate-400 truncate",children:k(e.description)})]}),t("div",{className:"overflow-x-auto flex-1 max-h-[70vh]",children:t("table",{className:"w-full text-xs font-mono border-collapse",children:t("tbody",{children:l.map((a,i)=>{const o=(e.startLine??1)+i,c=r[i]===void 0?"bg-green-900/30":a===""&&r[i]!==""?"bg-red-900/30":a!==r[i]?"bg-amber-900/20":"";return t("tr",{className:c,children:[t("td",{className:"text-right text-slate-600 select-none px-2 w-10 border-r border-slate-700 align-top",children:o}),t("td",{className:"px-3 py-0 whitespace-pre-wrap break-all",children:k(a)||" "})]},i)})})})}),t("div",{className:"px-3 py-1.5 bg-slate-900 border-t border-slate-700 text-xs text-slate-500",children:["Chunk ",n+1,n===0&&t("span",{className:"text-slate-600 ml-1",children:"(reference)"})]})]})}function is(){var a;const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.config());if(n)return t(G,{type:"card"});if(s)return t(ee,{message:s,onRetry:l});const r=((a=e==null?void 0:e.body)==null?void 0:a.config)??(e==null?void 0:e.config);return r?t("div",{children:[t("h1",{className:"text-2xl font-bold mb-6",children:"Configuration"}),t("p",{className:"text-sm text-slate-400 mb-4",children:["Effective configuration from ",t("code",{className:"text-brand-400",children:"opencode-rag.json"}),". API keys are redacted."]}),t("div",{className:"space-y-4",children:Object.entries(r).map(([i,o])=>t("details",{className:"bg-slate-800 rounded-lg border border-slate-700",open:!0,children:[t("summary",{className:"px-4 py-2 cursor-pointer hover:bg-slate-700 font-mono text-sm font-semibold capitalize text-slate-300",children:i.replace(/([A-Z])/g," $1")}),t("div",{className:"px-4 pb-3",children:typeof o=="object"&&o!==null?Object.entries(o).map(([c,d])=>t("div",{className:"flex justify-between py-1 border-b border-slate-700/50 text-sm",children:[t("span",{className:"text-slate-400 font-mono",children:c}),t("span",{className:"text-slate-200 font-mono text-xs text-right ml-4",children:os(d)})]},c)):t("div",{className:"flex justify-between py-1 text-sm",children:t("span",{className:"text-slate-200 font-mono",children:String(o)})})})]},i))})]}):t(fe,{icon:"⚙",message:"No configuration available."})}function os(e){return e===null?"null":e===void 0?"undefined":typeof e=="boolean"?e?"true":"false":Array.isArray(e)?`[${e.join(", ")}]`:typeof e=="object"?JSON.stringify(e).slice(0,150):String(e)}const cs="modulepreload",ds=function(e){return"/ui/"+e},Pt={},us=function(n,s,l){let r=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),o=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=Promise.allSettled(s.map(c=>{if(c=ds(c),c in Pt)return;Pt[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":cs,d||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),d)return new Promise((x,h)=>{f.addEventListener("load",x),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=i,window.dispatchEvent(o),!o.defaultPrevented)throw i}return r.then(i=>{for(const o of i||[])o.status==="rejected"&&a(o.reason);return n().catch(a)})};function hs(e,n){for(var s in n)e[s]=n[s];return e}function It(e,n){for(var s in e)if(s!=="__source"&&!(s in n))return!0;for(var l in n)if(l!=="__source"&&e[l]!==n[l])return!0;return!1}function Rt(e,n){this.props=e,this.context=n}(Rt.prototype=new Ne).isPureReactComponent=!0,Rt.prototype.shouldComponentUpdate=function(e,n){return It(this.props,e)||It(this.state,n)};var Et=D.__b;D.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Et&&Et(e)};var fs=D.__e;D.__e=function(e,n,s,l){if(e.then){for(var r,a=n;a=a.__;)if((r=a.__c)&&r.__c)return n.__e==null&&(n.__e=s.__e,n.__k=s.__k||[]),r.__c(e,n)}fs(e,n,s,l)};var Mt=D.unmount;function ln(e,n,s){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(l){typeof l.__c=="function"&&l.__c()}),e.__c.__H=null),(e=hs({},e)).__c!=null&&(e.__c.__P===s&&(e.__c.__P=n),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(l){return ln(l,n,s)})),e}function rn(e,n,s){return e&&s&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(l){return rn(l,n,s)}),e.__c&&e.__c.__P===n&&(e.__e&&s.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=s)),e}function We(){this.__u=0,this.o=null,this.__b=null}function on(e){var n=e.__&&e.__.__c;return n&&n.__a&&n.__a(e)}function ms(e){var n,s,l,r=null;function a(i){if(n||(n=e()).then(function(o){o&&(r=o.default||o),l=!0},function(o){s=o,l=!0}),s)throw s;if(!l)throw n;return r?rt(r,i):null}return a.displayName="Lazy",a.__f=!0,a}function He(){this.i=null,this.l=null}D.unmount=function(e){var n=e.__c;n&&(n.__z=!0),n&&n.__R&&n.__R(),n&&32&e.__u&&(e.type=null),Mt&&Mt(e)},(We.prototype=new Ne).__c=function(e,n){var s=n.__c,l=this;l.o==null&&(l.o=[]),l.o.push(s);var r=on(l.__v),a=!1,i=function(){a||l.__z||(a=!0,s.__R=null,r?r(c):c())};s.__R=i;var o=s.__P;s.__P=null;var c=function(){if(!--l.__u){if(l.state.__a){var d=l.state.__a;l.__v.__k[0]=rn(d,d.__c.__P,d.__c.__O)}var u;for(l.setState({__a:l.__b=null});u=l.o.pop();)u.__P=o,u.forceUpdate()}};l.__u++||32&n.__u||l.setState({__a:l.__b=l.__v.__k[0]}),e.then(i,i)},We.prototype.componentWillUnmount=function(){this.o=[]},We.prototype.render=function(e,n){if(this.__b){if(this.__v.__k){var s=document.createElement("div"),l=this.__v.__k[0].__c;this.__v.__k[0]=ln(this.__b,s,l.__O=l.__P)}this.__b=null}var r=n.__a&&rt(ie,null,e.fallback);return r&&(r.__u&=-33),[rt(ie,null,n.__a?null:e.children),r]};var Ft=function(e,n,s){if(++s[1]===s[0]&&e.l.delete(n),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(s=e.i;s;){for(;s.length>3;)s.pop()();if(s[1]<s[0])break;e.i=s=s[2]}};(He.prototype=new Ne).__a=function(e){var n=this,s=on(n.__v),l=n.l.get(e);return l[0]++,function(r){var a=function(){n.props.revealOrder?(l.push(r),Ft(n,e,l)):r()};s?s(a):a()}},He.prototype.render=function(e){this.i=null,this.l=new Map;var n=it(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&n.reverse();for(var s=n.length;s--;)this.l.set(n[s],this.i=[1,0,this.i]);return e.children},He.prototype.componentDidUpdate=He.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(n,s){Ft(e,s,n)})};var ps=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,xs=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,vs=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,gs=/[A-Z0-9]/g,bs=typeof document<"u",_s=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};Ne.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ne.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(n){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:n})}})});var At=D.event;D.event=function(e){return At&&(e=At(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var ys={configurable:!0,get:function(){return this.class}},Dt=D.vnode;D.vnode=function(e){typeof e.type=="string"&&function(n){var s=n.props,l=n.type,r={},a=l.indexOf("-")==-1;for(var i in s){var o=s[i];if(!(i==="value"&&"defaultValue"in s&&o==null||bs&&i==="children"&&l==="noscript"||i==="class"||i==="className")){var c=i.toLowerCase();i==="defaultValue"&&"value"in s&&s.value==null?i="value":i==="download"&&o===!0?o="":c==="translate"&&o==="no"?o=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?i="ondblclick":c!=="onchange"||l!=="input"&&l!=="textarea"||_s(s.type)?c==="onfocus"?i="onfocusin":c==="onblur"?i="onfocusout":vs.test(i)&&(i=c):c=i="oninput":a&&xs.test(i)?i=i.replace(gs,"-$&").toLowerCase():o===null&&(o=void 0),c==="oninput"&&r[i=c]&&(i="oninputCapture"),r[i]=o}}l=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=it(s.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=it(s.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),s.class&&!s.className?(r.class=s.class,Object.defineProperty(r,"className",ys)):s.className&&(r.class=r.className=s.className),n.props=r}(e),e.$$typeof=ps,Dt&&Dt(e)};var Ot=D.__r;D.__r=function(e){Ot&&Ot(e),e.__c};var jt=D.diffed;D.diffed=function(e){jt&&jt(e);var n=e.props,s=e.__e;s!=null&&e.type==="textarea"&&"value"in n&&n.value!==s.value&&(s.value=n.value==null?"":n.value)};const Ns=10;function ws({points:e,width:n=800,height:s=600,onPointClick:l,renderTooltip:r}){const a=te(null),[i,o]=g({x:0,y:0,scale:1}),[c,d]=g(null),[u,f]=g(!1),x=te({x:0,y:0}),h=te(null),p=te(null),m=te(e);m.current=e;const _=Nt(S=>{h.current=S(h.current??i),p.current===null&&(p.current=requestAnimationFrame(()=>{p.current=null,h.current&&(o(h.current),h.current=null)}))},[i]);O(()=>()=>{p.current!==null&&cancelAnimationFrame(p.current)},[]);const T=Nt((S,N)=>{const I=a.current;if(!I)return null;const K=I.getBoundingClientRect(),B=h.current??i,me=S-K.left,pe=N-K.top;let Se=null,F=Ns;for(const xe of m.current){const ve=xe.x*n*B.scale+B.x,ge=xe.y*s*B.scale+B.y,oe=me-ve,Ce=pe-ge,$e=Math.sqrt(oe*oe+Ce*Ce);$e<=F&&(F=$e,Se=xe)}return Se},[i,n,s]);O(()=>{const S=a.current;if(!S)return;const N=S.getContext("2d");if(!N)return;const I=window.devicePixelRatio||1;S.width=n*I,S.height=s*I,N.scale(I,I),N.clearRect(0,0,n,s),N.save(),N.translate(i.x,i.y),N.scale(i.scale,i.scale);for(const K of e){const B=K.x*n,me=K.y*s,pe=(K.radius??3)*(K.highlighted?2:1);N.beginPath(),N.arc(B,me,pe,0,Math.PI*2),N.fillStyle=K.color,N.globalAlpha=K.highlighted?1:.6,N.fill(),K.highlighted&&(N.strokeStyle="#22d3ee",N.lineWidth=2,N.stroke())}N.restore()},[e,i,n,s]);const M=S=>{S.preventDefault();const N=S.deltaY>0?.9:1.1;_(I=>({...I,scale:Math.max(.5,Math.min(10,I.scale*N))}))},y=S=>{f(!0),x.current={x:S.clientX-i.x,y:S.clientY-i.y}},Y=S=>{if(u){_(I=>({...I,x:S.clientX-x.current.x,y:S.clientY-x.current.y}));return}const N=T(S.clientX,S.clientY);d(I=>(I==null?void 0:I.id)===(N==null?void 0:N.id)?I:N)},Ue=()=>f(!1);return t("div",{className:"relative overflow-hidden rounded-lg border border-slate-700 bg-slate-900",style:{width:n,height:s},children:[t("canvas",{ref:a,className:"absolute inset-0 cursor-grab active:cursor-grabbing",onMouseDown:y,onMouseMove:Y,onMouseUp:Ue,onMouseLeave:Ue,onClick:S=>{if(u)return;const N=T(S.clientX,S.clientY);N&&(l==null||l(N.id))},onWheel:M}),c&&r&&t("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(c.x*n*i.scale+i.x+12,n-200),top:Math.min(c.y*s*i.scale+i.y-12,s-80)},children:r(c)}),i.scale!==1&&t("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:()=>{o({x:0,y:0,scale:1}),h.current=null},children:"Reset zoom"})]})}function Me(e,n){const s=e.x-n.x,l=e.y-n.y,r=(e.z??0)-(n.z??0);return Math.sqrt(s*s+l*l+r*r)}function ks(e,n=8,s=20){const l=e.length;if(l<=n)return e.map((i,o)=>o);const r=new Array(l).fill(0),a=[];a.push(e[Math.floor(Math.random()*l)]);for(let i=1;i<n;i++){const o=e.map(u=>Math.min(...a.map(f=>Me(u,f)))),c=o.reduce((u,f)=>u+f*f,0);let d=Math.random()*c;for(let u=0;u<l;u++)if(d-=o[u]*o[u],d<=0){a.push(e[u]);break}}for(let i=0;i<s;i++){for(let c=0;c<l;c++){let d=0,u=Me(e[c],a[0]);for(let f=1;f<a.length;f++){const x=Me(e[c],a[f]);x<u&&(u=x,d=f)}r[c]=d}const o=a.map(()=>({x:0,y:0,z:0,count:0}));for(let c=0;c<l;c++){const d=r[c];o[d].x+=e[c].x,o[d].y+=e[c].y,o[d].z+=e[c].z??0,o[d].count++}a.forEach((c,d)=>{o[d].count>0&&(c.x=o[d].x/o[d].count,c.y=o[d].y/o[d].count,c.z!==void 0&&(c.z=o[d].z/o[d].count))})}return r}function Ss(e,n,s){const l=s.map((a,i)=>{const c=e.filter((f,x)=>n[x]===i).map(f=>Me(f,a)),d=c.reduce((f,x)=>f+x,0)/c.length,u=c.reduce((f,x)=>f+(x-d)**2,0)/c.length;return Math.sqrt(u)}),r=new Set;for(let a=0;a<e.length;a++){const i=n[a];Me(e[a],s[i])>2*(l[i]??0)&&r.add(a)}return r}const Cs=ms(()=>us(()=>import("./ScatterPlot3D-CzbmvDSQ.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ScatterPlot3D}))),Ke=["#3b82f6","#ef4444","#22c55e","#f59e0b","#a855f7","#06b6d4","#ec4899","#84cc16","#f97316","#14b8a6","#8b5cf6","#e11d48","#65a30d","#0ea5e9","#d946ef","#ca8a04","#64748b","#4ade80","#fb7185","#38bdf8"],lt=2,Ut=50,zt=5,qt=200,$s=20,Ls=12;function Ts(){var ft,mt;const{data:e,isLoading:n,error:s,refresh:l}=J(()=>$.embeddingProj(5e3,3)),[r,a]=g("language"),[i,o]=g("3d"),[c,d]=g(!1),[u,f]=g(8),[x,h]=g(20),[p,m]=g(!1),[_,T]=g(new Set),[M,y]=g(5),[Y,Ue]=g(0),[z,S]=g(null),[N,I]=g(!1),K=te(0),[B,me]=g(null),[pe,Se]=g(new Set),F=((ft=e==null?void 0:e.body)==null?void 0:ft.points)??(e==null?void 0:e.points)??[],xe=((mt=e==null?void 0:e.body)==null?void 0:mt.totalChunks)??(e==null?void 0:e.totalChunks)??0;if(O(()=>{var v;if(r==="cluster"&&F.length>0){const P=Math.max(lt,Math.min(u,F.length)),w=ks(F,P,x);if(me(w),c){const q=[];for(let be=0;be<P;be++){const Q=F.filter((Le,ce)=>w[ce]===be);if(Q.length>0){const Le=((v=Q[0])==null?void 0:v.z)!==void 0;q.push({x:Q.reduce((ce,Te)=>ce+Te.x,0)/Q.length,y:Q.reduce((ce,Te)=>ce+Te.y,0)/Q.length,...Le?{z:Q.reduce((ce,Te)=>ce+(Te.z??0),0)/Q.length}:{}})}}Se(Ss(F,w,q))}}else me(null),Se(new Set)},[r,c,u,x,F]),O(()=>{p&&ae.value.length>0?T(new Set(ae.value.map(v=>v.chunk.id))):T(new Set)},[p,ae.value]),n)return t(G,{type:"chart"});if(s)return t(ee,{message:s,onRetry:l});if(F.length===0)return t(fe,{icon:"🌐",message:"No embedding data available. Index some files first."});const ve=le(()=>Is(F),[F]),ge=le(()=>F.map((v,P)=>{let w;if(r==="language")w=je(v.language)==="text-slate-400"?"#94a3b8":Rs(v.language);else if(r==="file")w=ve.get(v.filePath)??"#94a3b8";else{const Le=(B==null?void 0:B[P])??0;w=Ke[Le%Ke.length]}const q=pe.has(P),Q=_.has(v.id);return{id:v.id,x:v.x,y:v.y,z:v.z??.5,color:Q?"#22d3ee":q?"#f97316":w,label:`${v.filePath}:${v.startLine}-${v.endLine} [${v.language}]`,radius:Q?6:q?5:3,highlighted:Q}}),[F,r,B,pe,_,ve]),oe=le(()=>{if(r!=="file")return[];const v=Ps(F.map(w=>w.filePath)),P=new Map;for(const w of F)P.set(w.filePath,(P.get(w.filePath)??0)+1);return[...P.entries()].sort((w,q)=>q[1]-w[1]).slice(0,Ls).map(([w,q])=>({label:w.slice(v.length)||w,count:q,color:ve.get(w)??"#94a3b8"}))},[r,F,ve]),Ce=le(()=>r!=="file"?0:new Set(F.map(v=>v.filePath)).size-oe.length,[r,F,oe]),$e=v=>{const P=++K.current;S(null),I(!0),$.chunk(v).then(w=>{P===K.current&&(S(w),I(!1))}).catch(()=>{P===K.current&&(S({id:v,content:"",filePath:"not found",language:"",startLine:0,endLine:0,description:"Error loading chunk details."}),I(!1))})};return t("div",{children:[t("h1",{className:"text-2xl font-bold mb-4",children:"Embedding Space Explorer"}),t("div",{className:"flex flex-wrap gap-3 mb-4 items-center",children:[t("div",{className:"flex items-center gap-1 bg-slate-800 border border-slate-600 rounded-lg p-0.5",children:["2d","3d"].map(v=>t("button",{className:`px-2 py-0.5 rounded text-xs transition-colors ${i===v?"bg-slate-600 text-white":"text-slate-400 hover:text-slate-200"}`,onClick:()=>o(v),children:v.toUpperCase()},v))}),t("label",{className:"text-xs text-slate-400",children:"Color by:"}),t("select",{className:"bg-slate-800 border border-slate-600 rounded text-xs text-slate-200 px-2 py-1",value:r,onChange:v=>a(v.target.value),children:[t("option",{value:"language",children:"Language"}),t("option",{value:"file",children:"File"}),t("option",{value:"cluster",children:"Cluster"})]}),r==="cluster"&&t(ie,{children:[t("label",{className:"text-xs text-slate-400",children:"K:"}),t("input",{type:"number",min:lt,max:Ut,value:u,onChange:v=>f(Ht(v.target,lt,Ut,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"}),t("label",{className:"text-xs text-slate-400",children:"Iterations:"}),t("input",{type:"number",min:zt,max:qt,value:x,onChange:v=>h(Ht(v.target,zt,qt,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"})]}),t("label",{className:"flex items-center gap-1.5 text-xs text-slate-400",children:[t("input",{type:"checkbox",className:"accent-brand-500",checked:c,onChange:v=>d(v.target.checked)}),"Outliers"]}),ae.value.length>0&&t("label",{className:"flex items-center gap-1.5 text-xs text-slate-400",children:[t("input",{type:"checkbox",className:"accent-brand-500",checked:p,onChange:v=>m(v.target.checked)}),"Search overlay (",ae.value.length," results)"]}),i==="3d"&&t(ie,{children:[t("label",{className:"text-xs text-slate-400",children:"Point size:"}),t("input",{type:"range",min:1,max:20,value:M,onChange:v=>y(Number(v.target.value)),className:"w-24 accent-brand-500"}),t("button",{className:"px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors",onClick:()=>Ue(v=>v+1),children:"Reset camera"})]})]}),r==="cluster"&&B&&t("div",{className:"flex flex-wrap gap-2 mb-3 text-xs",children:(()=>{const v=Array.from(new Set(B)).sort((q,be)=>q-be),P=v.slice(0,$s),w=v.length-P.length;return t(ie,{children:[P.map(q=>t("span",{className:"flex items-center gap-1 text-slate-400",children:[t("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:Ke[q%Ke.length]}}),"Cluster ",q+1]},q)),w>0&&t("span",{className:"text-slate-500",children:["+",w," more"]})]})})()}),r==="file"&&oe.length>0&&t("div",{className:"flex flex-wrap gap-2 mb-3 text-xs",children:[oe.map(({label:v,count:P,color:w})=>t("span",{className:"flex items-center gap-1 text-slate-400",title:v,children:[t("span",{className:"inline-block w-2 h-2 rounded-full",style:{background:w}}),k(Lt(v,40))," (",P,")"]},v)),Ce>0&&t("span",{className:"text-slate-500",children:["+",Ce," more files"]})]}),i==="3d"?t(We,{fallback:t(G,{type:"chart"}),children:t(Cs,{points:ge,width:900,height:600,onPointClick:$e,pointSize:M,resetKey:Y,selectedId:(z==null?void 0:z.id)??null})}):t(ws,{points:ge,width:900,height:600,onPointClick:$e,renderTooltip:v=>{const P=F.find(w=>w.id===v.id);return t("div",{children:[t("div",{className:"text-yellow-400 font-mono text-xs",children:k(v.label)}),(P==null?void 0:P.description)&&t("div",{className:"text-slate-400 text-xs mt-1",children:k(Lt(P.description,80))})]})}}),N&&t(G,{type:"detail"}),z&&!N&&t("div",{className:"kpi-card p-4 mt-4",children:[t("div",{className:"flex items-center gap-3 mb-1 flex-wrap",children:[t("span",{className:"text-yellow-400 font-mono text-sm",children:k(z.filePath)}),t("span",{className:"text-slate-400 text-xs",children:["Lines ",z.startLine,"-",z.endLine]}),t("span",{dangerouslySetInnerHTML:{__html:he(z.language)}}),z.id&&t("span",{className:"text-xs text-slate-600 font-mono",children:z.id}),t("button",{className:"ml-auto px-2 py-1 bg-slate-700 hover:bg-slate-600 rounded text-xs text-white transition-colors",onClick:()=>j(`chunks?id=${encodeURIComponent(z.id)}`),children:"Open in Chunks"})]}),z.description&&t("div",{className:"mb-3",children:[t("h3",{className:"text-xs font-semibold text-slate-400 mb-1",children:"Description"}),t("p",{className:"text-sm text-slate-300",children:k(z.description)})]}),z.content&&t("div",{children:[t("h3",{className:"text-xs font-semibold text-slate-400 mb-1",children:"Content"}),t("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:k(z.content)})]})]}),t("p",{className:"text-xs text-slate-500 mt-2",children:[ge.length," of ",xe," chunks displayed",ge.length<xe&&" (chunks without embeddings omitted)"]})]})}function Ht(e,n,s,l){const r=parseInt((e==null?void 0:e.value)??"",10);return Number.isNaN(r)?l:Math.max(n,Math.min(s,r))}function Ps(e){if(e.length===0)return"";let n=e[0]??"";for(const l of e)for(;l&&n&&!l.startsWith(n);)n=n.slice(0,-1);const s=n.lastIndexOf("/");return s>=0?n.slice(0,s+1):""}function Is(e){const n=new Map;for(const h of e){const p=n.get(h.filePath)??{x:0,y:0,z:0,n:0};p.x+=h.x,p.y+=h.y,p.z+=h.z??0,p.n++,n.set(h.filePath,p)}const s=[];for(const[h,p]of n)s.push({file:h,x:p.x/p.n,y:p.y/p.n,z:p.z/p.n});const l=s.reduce((h,p)=>h+p.x,0)/s.length,r=s.reduce((h,p)=>h+p.y,0)/s.length,a=s.reduce((h,p)=>h+p.z,0)/s.length,i=s.reduce((h,p)=>h+(p.x-l)**2,0),o=s.reduce((h,p)=>h+(p.y-r)**2,0),c=s.reduce((h,p)=>h+(p.z-a)**2,0),d=i>=o&&i>=c?"x":o>=c?"y":"z",u=["x","y","z"].filter(h=>h!==d);s.sort((h,p)=>h[d]-p[d]||h[u[0]]-p[u[0]]||h[u[1]]-p[u[1]]);const f=new Map,x=137.508;for(let h=0;h<s.length;h++){const p=h*x%360,m=h%2===0?55:40;f.set(s[h].file,`hsl(${p.toFixed(1)}, 80%, ${m}%)`)}return f}function Rs(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"}const Es=[{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 Ms(){Cn(),$n();const e=De();nt.value=e.view;const n=()=>{qe.value=!qe.value};return t("div",{className:"h-screen flex flex-col overflow-hidden",children:[t("header",{className:"flex items-center gap-3 px-4 py-2 border-b shrink-0",style:{borderColor:"var(--border)"},children:[t("h1",{className:"text-lg font-bold shrink-0",style:{color:"var(--accent)"},children:"OpenCodeRAG"}),t("nav",{className:"flex gap-1 flex-1",role:"navigation","aria-label":"Main navigation",children:Es.map(s=>t("button",{id:`nav-${s.view}`,className:`nav-btn ${nt.value===s.view?"active":""}`,onClick:()=>window.location.hash=s.view,role:"tab","aria-selected":nt.value===s.view,children:[s.icon," ",s.label]},s.view))}),t(Fn,{}),t(Tn,{}),t("button",{className:"p-2 rounded-lg transition-colors hidden lg:block",style:{color:"var(--text-muted)"},onClick:n,"aria-label":"Toggle file tree",title:"Toggle file tree",children:"☰"}),t("button",{className:"p-2 rounded-lg transition-colors lg:hidden",style:{color:"var(--text-muted)"},onClick:n,"aria-label":"Toggle file tree",title:"Toggle file tree",children:"☰"})]}),t("div",{className:"flex flex-1 overflow-hidden",children:[qe.value&&t(ie,{children:[t("div",{className:"fixed inset-0 z-30 lg:hidden",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>{qe.value=!1}}),t("aside",{className:"w-64 overflow-y-auto shrink-0 border-r z-40 fixed lg:relative inset-y-0 left-0",style:{background:"var(--bg-secondary)",borderColor:"var(--border)"},role:"tree","aria-label":"File tree",children:t(An,{})})]}),t("main",{className:"flex-1 overflow-y-auto p-6",id:"main-content",tabIndex:-1,children:[e.view==="dashboard"&&t(zn,{}),e.view==="search"&&t(ns,{}),e.view==="embeddings"&&t(Ts,{}),e.view==="compare"&&t(ls,{}),e.view==="chunks"&&t(qn,{}),e.view==="files"&&t(Kn,{}),e.view==="evaluate"&&t(Vn,{}),e.view==="quirks"&&t(Jn,{}),e.view==="config"&&t(is,{})]})]}),t(Ln,{})]})}dn(t(Ms,{}),document.getElementById("app"));export{te as A,O as h,t as u};
|