const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Landing-CsdlurXX.js","assets/query-Bw69rE6b.js","assets/react-CQKYBN-P.js","assets/StatusPill-DBEWzsQ3.js","assets/Badge-DwoQNRW3.js","assets/runDisplay-BnzArzDk.js","assets/circle-play-BX3na9-o.js","assets/scroll-text-R1lDgqtW.js","assets/Home--n7AkS7C.js","assets/PageHeader-qtVByY5c.js","assets/Card-nuKO-lKR.js","assets/EmptyState-CgO0CCgi.js","assets/arrow-down-to-line-CCt3pyba.js","assets/Profile-CXRCfHrk.js","assets/Database-giqCaFVU.js","assets/GenerateScopeDialog-DxVi8XyM.js","assets/code-xml-CnSqwYLd.js","assets/InlineEditText-BpIisHVz.js","assets/pencil-ByuKsEO5.js","assets/Schema-A2mHW0Pi.js","assets/table-BgcaxH7z.js","assets/Table-CkawCKG5.js","assets/Modal-t7k2CeNu.js","assets/RunsList-CKHZaZ8_.js","assets/AlertDialog-IkMNJ6QG.js","assets/circle-pause-BD9iFI5E.js","assets/database-zap-B6uW5qG_.js","assets/git-compare-BvCMK5Lg.js","assets/RunDetail-C6Y9W2PC.js","assets/JobProgress-CArMtskB.js","assets/InsightBadges-Cf20HBne.js","assets/AdvancedLLMOverrides-BR8rzUMx.js","assets/RouteState-Cu5M7yS-.js","assets/rotate-ccw-CDH4c_fo.js","assets/RunNew-CWnWDKMQ.js","assets/ScopeTree-DPQLnpdo.js","assets/RunsCompare-BSkbqsES.js","assets/download-C1IJ2Fiw.js","assets/Ask-DVY5dmPf.js","assets/Pending-GowaWGfG.js","assets/eye-DjFgzw_3.js","assets/Settings-D3jfE-7N.js","assets/Field-8f_CfRxg.js","assets/users-jdZTWVcJ.js","assets/code-zqIp-0hD.js","assets/System-C6wTq28x.js","assets/Audit-N-baEPlR.js","assets/Schedules-BAvDBbUn.js","assets/calendar-plus-BnEwnONa.js","assets/Pricing-DURaBMzf.js","assets/DbCache-BhXiqdpy.js","assets/Lineage-BZdUbmzF.js","assets/with-selector-DmmuW8RZ.js","assets/upload-DvIhupK8.js","assets/Lineage-s_qXryiZ.css","assets/LineageRedirect-Be2tW-vE.js","assets/Pages-CLO10elY.js","assets/usePages-D5h-FCve.js","assets/PageNew-BG9o7gYR.js","assets/SourceAttacher-D2Hyd3T_.js","assets/PageEdit-CxXSht5s.js"])))=>i.map(i=>d[i]);
var Ut=Object.defineProperty;var Ft=(e,t,s)=>t in e?Ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var K=(e,t,s)=>Ft(e,typeof t!="symbol"?t+"":t,s);import{r as f,a as de,j as n,u as q,b as Y,c as Ne,Q as qt,M as Bt,d as Vt,e as Kt}from"./query-Bw69rE6b.js";import{r as Te,u as se,a as me,b as he,L as ue,N as ut,O as Ht,R as Qt,c as _,d as ie,B as Wt}from"./react-CQKYBN-P.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function s(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=s(o);fetch(o.href,a)}})();var Re={},Fe=Te;Re.createRoot=Fe.createRoot,Re.hydrateRoot=Fe.hydrateRoot;const Jt="modulepreload",Gt=function(e){return"/"+e},qe={},P=function(t,s,r){let o=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=i?.nonce||i?.getAttribute("nonce");o=Promise.allSettled(s.map(c=>{if(c=Gt(c),c in qe)return;qe[c]=!0;const p=c.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${x}`))return;const d=document.createElement("link");if(d.rel=p?"stylesheet":Jt,p||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),p)return new Promise((m,b)=>{d.addEventListener("load",m),d.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return o.then(i=>{for(const l of i||[])l.status==="rejected"&&a(l.reason);return t().catch(a)})};/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pt=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Be=e=>{const t=Zt(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var en={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tn=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nn=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:a,iconNode:i,...l},c)=>f.createElement("svg",{ref:c,...en,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:pt("lucide",o),...!a&&!tn(l)&&{"aria-hidden":"true"},...l},[...i.map(([p,x])=>f.createElement(p,x)),...Array.isArray(a)?a:[a]]));/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S=(e,t)=>{const s=f.forwardRef(({className:r,...o},a)=>f.createElement(nn,{ref:a,iconNode:t,className:pt(`lucide-${Yt(Be(e))}`,`lucide-${e}`,r),...o}));return s.displayName=Be(e),s};/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sn=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],rn=S("activity",sn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const on=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],an=S("arrow-down",on);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ln=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],cn=S("arrow-right",ln);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dn=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],un=S("arrow-up-down",dn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pn=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],fn=S("arrow-up-right",pn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mn=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],hn=S("arrow-up",mn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xn=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],bn=S("chart-column",xn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ft=S("check",gn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],te=S("chevron-down",yn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_e=S("chevron-right",vn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],mt=S("circle-alert",wn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kn=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],jn=S("circle-check-big",kn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_n=S("circle-check",Nn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sn=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ht=S("database",Sn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cn=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],En=S("ellipsis-vertical",Cn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $n=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],xt=S("external-link",$n);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rn=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mn=S("file-text",Rn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pn=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],An=S("folder-tree",Pn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ln=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],In=S("hard-drive",Ln);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tn=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],On=S("history",Tn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],bt=S("info",zn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xn=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Dn=S("layers",Xn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Un=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],re=S("loader-circle",Un);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fn=[["path",{d:"M5 12h14",key:"1ays0h"}]],qn=S("minus",Fn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Vn=S("panel-left",Bn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kn=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Hn=S("pin",Kn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Wn=S("plus",Qn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jn=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Se=S("refresh-cw",Jn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gn=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],gt=S("search",Gn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yn=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Zn=S("settings",Yn);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const es=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ts=S("sparkles",es);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ns=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ss=S("trash-2",ns);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rs=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],os=S("triangle-alert",rs);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const as=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],is=S("workflow",as);/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ls=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],J=S("x",ls),Ve=e=>{let t;const s=new Set,r=(p,x)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const m=t;t=x??(typeof d!="object"||d===null)?d:Object.assign({},t,d),s.forEach(b=>b(t,m))}},o=()=>t,l={setState:r,getState:o,getInitialState:()=>c,subscribe:p=>(s.add(p),()=>s.delete(p))},c=t=e(r,o,l);return l},cs=e=>e?Ve(e):Ve,ds=e=>e;function us(e,t=ds){const s=de.useSyncExternalStore(e.subscribe,de.useCallback(()=>t(e.getState()),[e,t]),de.useCallback(()=>t(e.getInitialState()),[e,t]));return de.useDebugValue(s),s}const ps=e=>{const t=cs(e),s=r=>us(t,r);return Object.assign(s,t),s},fs=e=>ps;function yt(e,t){let s;try{s=e()}catch{return}return{getItem:o=>{var a;const i=c=>c===null?null:JSON.parse(c,void 0),l=(a=s.getItem(o))!=null?a:null;return l instanceof Promise?l.then(i):i(l)},setItem:(o,a)=>s.setItem(o,JSON.stringify(a,void 0)),removeItem:o=>s.removeItem(o)}}const Me=e=>t=>{try{const s=e(t);return s instanceof Promise?s:{then(r){return Me(r)(s)},catch(r){return this}}}catch(s){return{then(r){return this},catch(r){return Me(r)(s)}}}},ms=(e,t)=>(s,r,o)=>{let a={storage:yt(()=>window.localStorage),partialize:h=>h,version:0,merge:(h,w)=>({...w,...h}),...t},i=!1,l=0;const c=new Set,p=new Set;let x=a.storage;if(!x)return e((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),s(...h)},r,o);const d=()=>{const h=a.partialize({...r()});return x.setItem(a.name,{state:h,version:a.version})},m=o.setState;o.setState=(h,w)=>(m(h,w),d());const b=e((...h)=>(s(...h),d()),r,o);o.getInitialState=()=>b;let v;const u=()=>{var h,w;if(!x)return;const C=++l;i=!1,c.forEach(N=>{var M;return N((M=r())!=null?M:b)});const L=((w=a.onRehydrateStorage)==null?void 0:w.call(a,(h=r())!=null?h:b))||void 0;return Me(x.getItem.bind(x))(a.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==a.version){if(a.migrate){const M=a.migrate(N.state,N.version);return M instanceof Promise?M.then(O=>[!0,O]):[!0,M]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var M;if(C!==l)return;const[O,D]=N;if(v=a.merge(D,(M=r())!=null?M:b),s(v,!0),O)return d()}).then(()=>{C===l&&(L?.(r(),void 0),v=r(),i=!0,p.forEach(N=>N(v)))}).catch(N=>{C===l&&L?.(void 0,N)})};return o.persist={setOptions:h=>{a={...a,...h},h.storage&&(x=h.storage)},clearStorage:()=>{x?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>u(),hasHydrated:()=>i,onHydrate:h=>(c.add(h),()=>{c.delete(h)}),onFinishHydration:h=>(p.add(h),()=>{p.delete(h)})},a.skipHydration||u(),v||b},hs=ms,ne=fs()(hs(e=>({sidebarCollapsed:!1,toggleSidebar:()=>e(t=>({sidebarCollapsed:!t.sidebarCollapsed})),setSidebarCollapsed:t=>e({sidebarCollapsed:t}),mobileSidebarOpen:!1,setMobileSidebarOpen:t=>e({mobileSidebarOpen:t}),lastOpenedSchema:null,lastOpenedTable:null,lastOpened:null,rememberOpenedTable:(t,s)=>e({lastOpenedSchema:t,lastOpenedTable:s}),rememberOpenedScope:t=>e({lastOpened:t,lastOpenedSchema:t.schema,lastOpenedTable:t.table}),askScopeBySession:{},setAskScope:(t,s)=>e(r=>({askScopeBySession:{...r.askScopeBySession,[t]:s}})),clearAskScope:t=>e(s=>{const r={...s.askScopeBySession};return delete r[t],{askScopeBySession:r}}),askActiveJobBySession:{},setAskActiveJob:(t,s)=>e(r=>({askActiveJobBySession:{...r.askActiveJobBySession,[t]:s}})),clearAskActiveJob:t=>e(s=>{const r={...s.askActiveJobBySession};return delete r[t],{askActiveJobBySession:r}})}),{name:"amx-studio-ui",storage:yt(()=>localStorage),partialize:e=>({askActiveJobBySession:e.askActiveJobBySession})})),Ke="(max-width: 639px)";function xs(){const[e,t]=f.useState(()=>typeof window>"u"?!1:window.matchMedia(Ke).matches);return f.useEffect(()=>{if(typeof window>"u")return;const s=window.matchMedia(Ke),r=o=>t(o.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[]),e}function vt(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(s=vt(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function bs(){for(var e,t,s=0,r="",o=arguments.length;s<o;s++)(e=arguments[s])&&(t=vt(e))&&(r&&(r+=" "),r+=t);return r}const Oe="-",gs=e=>{const t=vs(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Oe);return l[0]===""&&l.length!==1&&l.shift(),wt(l,t)||ys(i)},getConflictingClassGroupIds:(i,l)=>{const c=s[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},wt=(e,t)=>{if(e.length===0)return t.classGroupId;const s=e[0],r=t.nextPart.get(s),o=r?wt(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const a=e.join(Oe);return t.validators.find(({validator:i})=>i(a))?.classGroupId},He=/^\[(.+)\]$/,ys=e=>{if(He.test(e)){const t=He.exec(e)[1],s=t?.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},vs=e=>{const{theme:t,prefix:s}=e,r={nextPart:new Map,validators:[]};return ks(Object.entries(e.classGroups),s).forEach(([a,i])=>{Pe(i,r,a,t)}),r},Pe=(e,t,s,r)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:Qe(t,o);a.classGroupId=s;return}if(typeof o=="function"){if(ws(o)){Pe(o(r),t,s,r);return}t.validators.push({validator:o,classGroupId:s});return}Object.entries(o).forEach(([a,i])=>{Pe(i,Qe(t,a),s,r)})})},Qe=(e,t)=>{let s=e;return t.split(Oe).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},ws=e=>e.isThemeGetter,ks=(e,t)=>t?e.map(([s,r])=>{const o=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,l])=>[t+i,l])):a);return[s,o]}):e,js=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,r=new Map;const o=(a,i)=>{s.set(a,i),t++,t>e&&(t=0,r=s,s=new Map)};return{get(a){let i=s.get(a);if(i!==void 0)return i;if((i=r.get(a))!==void 0)return o(a,i),i},set(a,i){s.has(a)?s.set(a,i):o(a,i)}}},kt="!",Ns=e=>{const{separator:t,experimentalParseClassName:s}=e,r=t.length===1,o=t[0],a=t.length,i=l=>{const c=[];let p=0,x=0,d;for(let h=0;h<l.length;h++){let w=l[h];if(p===0){if(w===o&&(r||l.slice(h,h+a)===t)){c.push(l.slice(x,h)),x=h+a;continue}if(w==="/"){d=h;continue}}w==="["?p++:w==="]"&&p--}const m=c.length===0?l:l.substring(x),b=m.startsWith(kt),v=b?m.substring(1):m,u=d&&d>x?d-x:void 0;return{modifiers:c,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:u}};return s?l=>s({className:l,parseClassName:i}):i},_s=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(r=>{r[0]==="["?(t.push(...s.sort(),r),s=[]):s.push(r)}),t.push(...s.sort()),t},Ss=e=>({cache:js(e.cacheSize),parseClassName:Ns(e),...gs(e)}),Cs=/\s+/,Es=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:o}=t,a=[],i=e.trim().split(Cs);let l="";for(let c=i.length-1;c>=0;c-=1){const p=i[c],{modifiers:x,hasImportantModifier:d,baseClassName:m,maybePostfixModifierPosition:b}=s(p);let v=!!b,u=r(v?m.substring(0,b):m);if(!u){if(!v){l=p+(l.length>0?" "+l:l);continue}if(u=r(m),!u){l=p+(l.length>0?" "+l:l);continue}v=!1}const h=_s(x).join(":"),w=d?h+kt:h,C=w+u;if(a.includes(C))continue;a.push(C);const L=o(u,v);for(let N=0;N<L.length;++N){const M=L[N];a.push(w+M)}l=p+(l.length>0?" "+l:l)}return l};function $s(){let e=0,t,s,r="";for(;e<arguments.length;)(t=arguments[e++])&&(s=jt(t))&&(r&&(r+=" "),r+=s);return r}const jt=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=jt(e[r]))&&(s&&(s+=" "),s+=t);return s};function Rs(e,...t){let s,r,o,a=i;function i(c){const p=t.reduce((x,d)=>d(x),e());return s=Ss(p),r=s.cache.get,o=s.cache.set,a=l,l(c)}function l(c){const p=r(c);if(p)return p;const x=Es(c,s);return o(c,x),x}return function(){return a($s.apply(null,arguments))}}const R=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},Nt=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ms=/^\d+\/\d+$/,Ps=new Set(["px","full","screen"]),As=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ls=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Is=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ts=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Os=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,H=e=>ee(e)||Ps.has(e)||Ms.test(e),Q=e=>oe(e,"length",Vs),ee=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>oe(e,"number",ee),le=e=>!!e&&Number.isInteger(Number(e)),zs=e=>e.endsWith("%")&&ee(e.slice(0,-1)),j=e=>Nt.test(e),W=e=>As.test(e),Xs=new Set(["length","size","percentage"]),Ds=e=>oe(e,Xs,_t),Us=e=>oe(e,"position",_t),Fs=new Set(["image","url"]),qs=e=>oe(e,Fs,Hs),Bs=e=>oe(e,"",Ks),ce=()=>!0,oe=(e,t,s)=>{const r=Nt.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):s(r[2]):!1},Vs=e=>Ls.test(e)&&!Is.test(e),_t=()=>!1,Ks=e=>Ts.test(e),Hs=e=>Os.test(e),Qs=()=>{const e=R("colors"),t=R("spacing"),s=R("blur"),r=R("brightness"),o=R("borderColor"),a=R("borderRadius"),i=R("borderSpacing"),l=R("borderWidth"),c=R("contrast"),p=R("grayscale"),x=R("hueRotate"),d=R("invert"),m=R("gap"),b=R("gradientColorStops"),v=R("gradientColorStopPositions"),u=R("inset"),h=R("margin"),w=R("opacity"),C=R("padding"),L=R("saturate"),N=R("scale"),M=R("sepia"),O=R("skew"),D=R("space"),V=R("translate"),I=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto",j,t],E=()=>[j,t],xe=()=>["",H,Q],Z=()=>["auto",ee,j],ae=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],k=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],A=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",j],be=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[ee,j];return{cacheSize:500,separator:":",theme:{colors:[ce],spacing:[H,Q],blur:["none","",W,j],brightness:U(),borderColor:[e],borderRadius:["none","","full",W,j],borderSpacing:E(),borderWidth:xe(),contrast:U(),grayscale:G(),hueRotate:U(),invert:G(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[zs,Q],inset:z(),margin:z(),opacity:U(),padding:E(),saturate:U(),scale:U(),sepia:G(),skew:U(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",j]}],container:["container"],columns:[{columns:[W]}],"break-after":[{"break-after":be()}],"break-before":[{"break-before":be()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ae(),j]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[u]}],"inset-x":[{"inset-x":[u]}],"inset-y":[{"inset-y":[u]}],start:[{start:[u]}],end:[{end:[u]}],top:[{top:[u]}],right:[{right:[u]}],bottom:[{bottom:[u]}],left:[{left:[u]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",le,j]}],basis:[{basis:z()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",j]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",le,j]}],"grid-cols":[{"grid-cols":[ce]}],"col-start-end":[{col:["auto",{span:["full",le,j]},j]}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":[ce]}],"row-start-end":[{row:["auto",{span:[le,j]},j]}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",j]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",j]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...A()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...A(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...A(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",j,t]}],"min-w":[{"min-w":[j,t,"min","max","fit"]}],"max-w":[{"max-w":[j,t,"none","full","min","max","fit","prose",{screen:[W]},W]}],h:[{h:[j,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[j,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[j,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[j,t,"auto","min","max","fit"]}],"font-size":[{text:["base",W,Q]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$e]}],"font-family":[{font:[ce]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",j]}],"line-clamp":[{"line-clamp":["none",ee,$e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",H,j]}],"list-image":[{"list-image":["none",j]}],"list-style-type":[{list:["none","disc","decimal",j]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",H,Q]}],"underline-offset":[{"underline-offset":["auto",H,j]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",j]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",j]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ae(),Us]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ds]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},qs]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...k(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:k()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...k()]}],"outline-offset":[{"outline-offset":[H,j]}],"outline-w":[{outline:[H,Q]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[H,Q]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",W,Bs]}],"shadow-color":[{shadow:[ce]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",W,j]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[d]}],saturate:[{saturate:[L]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[L]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",j]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",j]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",j]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[le,j]}],"translate-x":[{"translate-x":[V]}],"translate-y":[{"translate-y":[V]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",j]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",j]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",j]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[H,Q,$e]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Ws=Rs(Qs);function y(...e){return Ws(bs(e))}const ke="amx.compare.pinnedCells.";function St(e){const t=(e||"").trim()||"__global";return`${ke}${t}`}function Ct(e){if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>s&&typeof s=="object"&&typeof s.run_id=="number"&&typeof s.schema=="string"&&typeof s.table=="string"):[]}catch{return[]}}function Ce(e){return typeof window>"u"?[]:Ct(window.localStorage.getItem(St(e)))}function Et(e,t){typeof window>"u"||window.localStorage.setItem(St(e),JSON.stringify(t))}function ze(e,t){return e.run_id===t.run_id&&e.schema===t.schema&&e.table===t.table&&(e.column??null)===(t.column??null)}function Ko(e,t){const s=Ce(e);if(s.some(o=>ze(o,t)))return s;const r=[...s,t];return Et(e,r),r}function Js(e,t){const r=Ce(e).filter(o=>!ze(o,t));return Et(e,r),r}function Ho(e,t){return Ce(e).some(s=>ze(s,t))}function Gs(e){const t=[e.schema,e.table];return e.column&&t.push(e.column),`${t.join(".")}:${e.run_id}`}function ye(){if(typeof window>"u")return[];const e=[];for(let t=0;t<window.localStorage.length;t++){const s=window.localStorage.key(t);if(!s||!s.startsWith(ke))continue;const r=s.slice(ke.length),o=Ct(window.localStorage.getItem(s));for(const a of o)e.push({...a,bucket:r})}return e}function Ys(e,t){if(typeof window>"u")return;const s=e||"__global";Js(s==="__global"?null:s,t)}function Zs(){if(typeof window>"u")return;const e=[];for(let t=0;t<window.localStorage.length;t++){const s=window.localStorage.key(t);s&&s.startsWith(ke)&&e.push(s)}for(const t of e)window.localStorage.removeItem(t)}const er={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},tr={ghost:"bg-transparent text-ink-muted hover:bg-surface-subtle hover:text-ink",subtle:"bg-surface-subtle text-ink-muted hover:bg-border hover:text-ink",primary:"bg-accent text-white hover:bg-accent-ink",danger:"bg-critical text-white hover:opacity-90"},Xe=f.forwardRef(function({icon:t,label:s,variant:r="ghost",size:o="md",className:a,...i},l){return n.jsx("button",{ref:l,type:"button","aria-label":s,title:s,className:y("inline-flex shrink-0 items-center justify-center rounded-md transition-colors duration-fast","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 focus-visible:ring-offset-bg","disabled:cursor-not-allowed disabled:opacity-50",er[o],tr[r],a),...i,children:t})}),nr={S:[".XXXX","X....","X....",".XXX.","....X","....X","XXXX."],T:["XXXXX","..X..","..X..","..X..","..X..","..X..","..X.."],U:["X...X","X...X","X...X","X...X","X...X","X...X","XXXXX"],D:["XXXX.","X...X","X...X","X...X","X...X","X...X","XXXX."],I:["XXXXX","..X..","..X..","..X..","..X..","..X..","XXXXX"],O:[".XXX.","X...X","X...X","X...X","X...X","X...X",".XXX."],C:[".XXXX","X....","X....","X....","X....","X....",".XXXX"],L:["X....","X....","X....","X....","X....","X....","XXXXX"]},$t=5,We=7,Rt=1;function sr(e){return e.length===0?0:e.length*$t+(e.length-1)*Rt}function Mt({size:e=14,className:t,suffix:s}){const r=(s??"").toUpperCase(),o=sr(r),a=Math.max(7,Math.round(e*.78)),i=o===0?0:Math.max(1,Math.round(a*o/We)),l=Math.max(2,Math.round(e*.18)),c=r?`AMX ${r}`:"AMX",p=[];if(o>0){let x=0;for(let d=0;d<r.length;d+=1){const m=r[d],b=nr[m];if(b)for(let v=0;v<b.length;v+=1){const u=b[v];for(let h=0;h<u.length;h+=1)u[h]==="X"&&p.push(n.jsx("rect",{x:x+h,y:v,width:1,height:1},`${d}-${h}-${v}`))}x+=$t+Rt}}return n.jsxs("span",{role:"img","aria-label":c,className:y("inline-flex items-end",t),style:{gap:l},children:[n.jsx("img",{src:"/amx-logo.png",alt:"","aria-hidden":"true",draggable:!1,style:{height:e,width:"auto",imageRendering:"pixelated",display:"block"}}),o>0&&n.jsx("svg",{width:i,height:a,viewBox:`0 0 ${o} ${We}`,shapeRendering:"crispEdges",fill:"currentColor","aria-hidden":"true",className:"text-ink",style:{display:"block"},children:p})]})}function rr({open:e,onClose:t}){const s=se(),[r,o]=f.useState(()=>ye());if(f.useEffect(()=>{if(!e)return;o(ye());const c=()=>o(ye());return window.addEventListener("amx:pinned-cells-changed",c),()=>window.removeEventListener("amx:pinned-cells-changed",c)},[e]),!e)return null;function a(c){Ys(c.bucket,c),o(ye()),window.dispatchEvent(new CustomEvent("amx:pinned-cells-changed"))}function i(){Zs(),o([]),window.dispatchEvent(new CustomEvent("amx:pinned-cells-changed"))}function l(){if(r.length===0)return;const c=r.map(Gs).join(",");s(`/runs/compare?mode=cell&cells=${encodeURIComponent(c)}`),t()}return n.jsxs(n.Fragment,{children:[n.jsx("div",{"aria-hidden":!0,onClick:t,className:"fixed inset-0 z-40 bg-ink/30 transition-opacity"}),n.jsxs("aside",{role:"dialog","aria-label":"Pinned for comparison",className:y("fixed right-0 top-0 z-50 flex h-full w-full max-w-[24rem] flex-col border-l border-border bg-surface shadow-xl"),children:[n.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-semibold text-ink",children:"Pinned for comparison"}),n.jsxs("p",{className:"text-xs text-ink-dim",children:[r.length," cell",r.length===1?"":"s"," ready to compare"]})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":"Close pinned cells drawer",className:"rounded p-1 text-ink-muted hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:16})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:r.length===0?n.jsx("div",{className:"px-4 py-8 text-center text-xs text-ink-dim",children:"No pinned cells yet. Open a run, click the pin icon on any suggestion, and it lands here."}):n.jsx("ul",{className:"divide-y divide-border",children:r.map((c,p)=>{const x=[c.schema,c.table,c.column].filter(Boolean).join(".");return n.jsxs("li",{className:"flex items-start gap-2 px-4 py-2.5",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate font-mono text-xs text-ink",title:x,children:x}),n.jsxs("div",{className:"mt-0.5 text-[10px] uppercase tracking-wider text-ink-dim",children:["from run #",c.run_id,c.column?" · column":" · table-level",c.bucket!=="__global"?` · ${c.bucket}`:""]})]}),n.jsx("button",{type:"button","aria-label":`Unpin ${x}`,onClick:()=>a(c),className:"rounded p-1 text-ink-dim hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:14})})]},`${c.bucket}-${c.run_id}-${x}-${p}`)})})}),n.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-4 py-3",children:[n.jsxs("button",{type:"button",onClick:i,disabled:r.length===0,className:"inline-flex items-center gap-1 text-xs text-ink-dim hover:text-ink disabled:opacity-40",children:[n.jsx(ss,{size:12}),"Clear all"]}),n.jsx("button",{type:"button",onClick:l,disabled:r.length===0,className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-accent-soft transition hover:opacity-90 disabled:opacity-40",children:"Compare pinned cells"})]})]})]})}const De="amx.studio.token",je="amx.studio.deeplink";function or(){try{const e=new URL(window.location.href),t=e.searchParams.get("t");if(!t)return Ee();window.localStorage.setItem(De,t),e.searchParams.delete("t");const s=e.pathname+(e.search||"")+(e.hash||"");return window.history.replaceState({},document.title,s),t}catch{return new URLSearchParams(window.location.search).get("t")}}function Ee(){try{return window.localStorage.getItem(De)}catch{return null}}function ar(){try{window.localStorage.removeItem(De)}catch{}}function ir(){const e=Ee();return e?`t=${encodeURIComponent(e)}`:""}function lr(e){try{const t=window.location.pathname+window.location.search+window.location.hash,s=(e??t).trim();if(!s||s==="/"){window.sessionStorage.removeItem(je);return}window.sessionStorage.setItem(je,s)}catch{}}function cr(){try{const e=window.sessionStorage.getItem(je);return window.sessionStorage.removeItem(je),!e||!e.startsWith("/")||e.startsWith("//")?null:e}catch{return null}}function Qo(){const e=me(),s=he().pathname;if(s.startsWith("/cat/")){const r=e.profile,o=e.catalog;return r?o?{scope:{profile:r,catalog:o,kind:"catalog",schema:e.schema,table:e.table},reason:null}:{scope:null,reason:"missing catalog in /cat URL"}:{scope:null,reason:"missing profile in /cat URL"}}if(s.startsWith("/db/")){const r=e.profile,o=e.database;return r?o?{scope:{profile:r,database:o,kind:"database",schema:e.schema,table:e.table},reason:null}:{scope:null,reason:"missing database in /db URL"}:{scope:null,reason:"missing profile in /db URL"}}return{scope:null,reason:"not a browse page"}}function dr(e){const t=[];return t.push(`profile=${encodeURIComponent(e.profile)}`),e.database&&t.push(`database=${encodeURIComponent(e.database)}`),e.catalog&&t.push(`catalog=${encodeURIComponent(e.catalog)}`),t.join("&")}function pe(e,t,s){const r=[];return e.catalog?r.push("cat",encodeURIComponent(e.profile),encodeURIComponent(e.catalog)):e.database?r.push("db",encodeURIComponent(e.profile),encodeURIComponent(e.database)):r.push("db",encodeURIComponent(e.profile)),t&&r.push(encodeURIComponent(t)),s&&r.push(encodeURIComponent(s)),"/"+r.join("/")}let Je=!1;class fe extends Error{constructor(s,r,o,a){super(r);K(this,"status");K(this,"detail");K(this,"hint");K(this,"data");this.status=s,this.detail=r,this.hint=o,this.data=a}}async function g(e,t={}){const s=Ee(),r=new Headers(t.headers||{});s&&r.set("Authorization",`Bearer ${s}`),t.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json"),r.set("Accept","application/json");const o=await fetch(e,{...t,headers:r});if(!o.ok){const i=await o.text();if(o.status===401&&!Je&&typeof window<"u"&&/AMX Studio token/i.test(i)){Je=!0;try{return ar(),lr(),window.location.replace("/"),await new Promise(()=>{})}catch{}}let l=i,c,p;try{const x=JSON.parse(i),d=x.detail;if(d&&typeof d=="object"){p=d;const m=d.message,b=d.hint;l=typeof m=="string"&&m?m:JSON.stringify(d),typeof b=="string"&&b&&(c=b)}else d!=null&&(l=String(d));!c&&x.hint&&(c=String(x.hint))}catch{}throw new fe(o.status,l||o.statusText,c,p)}if(o.status===204)return;const a=o.headers.get("content-type")||"";if(!a.toLowerCase().includes("json"))throw new fe(o.status,`Expected JSON from ${e} but got ${a||"no content-type"}.`,"The backend route is probably missing. Restart the Studio server or check the route mount.");return await o.json()}function F(e,t,s){const r=dr(t)+"",o=e.includes("?")?"&":"?";return`${e}${o}${r}`}const B={health:()=>g("/api/health"),context:()=>g("/api/context"),liveCatalogs:e=>g(`/api/live/catalogs?profile=${encodeURIComponent(e.profile)}`),liveDatabases:e=>g(`/api/live/databases?profile=${encodeURIComponent(e.profile)}`),liveSchemas:e=>g(F("/api/live/schemas",e)),liveAssets:(e,t)=>g(F(`/api/live/schemas/${encodeURIComponent(t)}/assets`,e)),refreshSchemaMetadata:(e,t)=>g(F(`/api/live/schemas/${encodeURIComponent(t)}/refresh`,e),{method:"POST"}),liveColumns:(e,t,s)=>g(F(`/api/live/schemas/${encodeURIComponent(t)}/tables/${encodeURIComponent(s)}/columns`,e)),dbCacheSearch:(e,t,s)=>{const r=new URLSearchParams({q:e});return t&&r.set("profile",t),typeof s=="number"&&r.set("limit",String(s)),g(`/api/db/cache/search?${r.toString()}`)},dbCacheTreeDatabases:e=>g(`/api/db/cache/tree/databases?profile=${encodeURIComponent(e)}`),dbCacheTreeSchemas:(e,t)=>g(`/api/db/cache/tree/schemas?profile=${encodeURIComponent(e)}&database=${encodeURIComponent(t)}`),dbCacheTreeTables:(e,t,s)=>g(`/api/db/cache/tree/tables?profile=${encodeURIComponent(e)}&database=${encodeURIComponent(t)}&schema=${encodeURIComponent(s)}`),dbCacheTreeColumns:(e,t,s,r)=>g(`/api/db/cache/tree/columns?profile=${encodeURIComponent(e)}&database=${encodeURIComponent(t)}&schema=${encodeURIComponent(s)}&table=${encodeURIComponent(r)}`),liveSnapshot:(e,t,s)=>g(F(`/api/live/schemas/${encodeURIComponent(t)}/tables/${encodeURIComponent(s)}/snapshot`,e)),recentRuns:(e=20,t="analyze.run")=>{const s=new URLSearchParams({limit:String(e)});return t&&s.set("command",t),g(`/api/history/runs?${s.toString()}`)},runDeepAnalysis:(e,t)=>g("/api/history/compare/deep-analysis",{method:"POST",body:JSON.stringify({run_ids:e,quality_tier:2,ground_truth_run_id:t?.groundTruthRunId??null})}),compareAsPdf:async(e,t)=>{const s=Ee(),r={"Content-Type":"application/json",Accept:"application/pdf"};s&&(r.Authorization=`Bearer ${s}`);const o=await fetch("/api/history/compare/pdf",{method:"POST",headers:r,body:JSON.stringify({run_ids:e,quality_tier:t?.qualityTier??1,ground_truth_run_id:t?.groundTruthRunId??null})});if(!o.ok){const a=await o.text();let i=a;try{const l=JSON.parse(a);l?.detail&&(i=String(l.detail))}catch{}throw new fe(o.status,i||o.statusText)}return o.blob()},applyEvents:(e={})=>{const t=new URLSearchParams;return e.runId!=null&&t.set("run_id",String(e.runId)),e.profileName&&t.set("profile_name",e.profileName),t.set("limit",String(e.limit??100)),g(`/api/history/apply-events?${t.toString()}`)},setDatabaseComment:(e,t)=>g(F("/api/comments/database",e),{method:"PUT",body:JSON.stringify({comment:t})}),restorePending:e=>g("/api/pending/restore",{method:"POST",body:JSON.stringify(e)}),enableHistoryStore:e=>g("/api/admin/history-store/enable",{method:"POST",body:JSON.stringify(e)}),disableHistoryStore:()=>g("/api/admin/history-store/disable",{method:"POST"}),generateDatabaseDescription:e=>g(F("/api/generate/database",e),{method:"POST"}),generateSchemaDescription:(e,t)=>g(F(`/api/generate/schema/${encodeURIComponent(t)}`,e),{method:"POST"}),generateTableDescription:(e,t,s)=>g(F(`/api/generate/table/${encodeURIComponent(t)}/${encodeURIComponent(s)}`,e),{method:"POST"}),generateColumnDescription:(e,t,s,r)=>g(F(`/api/generate/column/${encodeURIComponent(t)}/${encodeURIComponent(s)}/${encodeURIComponent(r)}`,e),{method:"POST"}),setSchemaComment:(e,t,s)=>g(F(`/api/comments/schemas/${encodeURIComponent(t)}`,e),{method:"PUT",body:JSON.stringify({comment:s})}),setTableComment:(e,t,s,r)=>g(F(`/api/comments/schemas/${encodeURIComponent(t)}/tables/${encodeURIComponent(s)}`,e),{method:"PUT",body:JSON.stringify({comment:r})}),setColumnComment:(e,t,s,r,o)=>g(F(`/api/comments/schemas/${encodeURIComponent(t)}/tables/${encodeURIComponent(s)}/columns/${encodeURIComponent(r)}`,e),{method:"PUT",body:JSON.stringify({comment:o})}),stats:(e="analyze.run")=>{const t=new URLSearchParams;e&&t.set("command",e);const s=t.toString();return g(s?`/api/history/stats?${s}`:"/api/history/stats")},submitRun:e=>g("/api/runs",{method:"POST",body:JSON.stringify({scope:e.scope,column_overrides:e.column_overrides,apply:!!e.apply,missing_only:!!e.missing_only,batch_mode:!!e.batch_mode,db_profile:e.db_profile,database:e.database,catalog:e.catalog,llm_overrides:e.llm_overrides,doc_profiles:e.doc_profiles,code_profiles:e.code_profiles,cache_override_assets:e.cache_override_assets})}),preflightRun:e=>g("/api/runs/preflight",{method:"POST",body:JSON.stringify({scope:e.scope,db_profile:e.db_profile,database:e.database,catalog:e.catalog})}),cancelRun:e=>g(`/api/runs/${encodeURIComponent(e)}/cancel`,{method:"POST"}),rerunItems:e=>g("/api/runs/rerun-item",{method:"POST",body:JSON.stringify({result_ids:e.result_ids,user_instructions:e.user_instructions??null,temperature_override:e.temperature_override??null,llm_overrides:e.llm_overrides??null})}),generateVariations:e=>g("/api/runs/variations",{method:"POST",body:JSON.stringify({original_run_id:e.original_run_id,result_id:e.result_id,alternative_index:e.alternative_index,seed_text:e.seed_text,mode:e.mode,user_instructions:e.user_instructions??null,llm_overrides:e.llm_overrides??null})}),llmCapabilities:(e,t)=>{const s=new URLSearchParams({provider:e,model:t});return g(`/api/llm/capabilities?${s.toString()}`)},resultHistory:e=>g(`/api/history/results/${e}/history`),lookupPrice:(e,t,s)=>{const r=new URLSearchParams({provider:e,model:t});return s&&r.set("profile_name",s),g(`/api/pricing/model?${r.toString()}`)},refreshPrices:()=>g("/api/pricing/refresh",{method:"POST"}),pricingCacheInfo:()=>g("/api/pricing/cache-info"),listModelPrices:()=>g("/api/pricing/models"),listSchedules:(e={})=>{const t=new URLSearchParams;return e.status&&t.set("status_filter",e.status),e.db_profile&&t.set("db_profile",e.db_profile),e.kind&&t.set("kind",e.kind),g(`/api/schedules${t.toString()?`?${t.toString()}`:""}`)},createSchedule:e=>g("/api/schedules",{method:"POST",body:JSON.stringify(e)}),getSchedule:e=>g(`/api/schedules/${e}`),patchSchedule:(e,t)=>g(`/api/schedules/${e}`,{method:"PATCH",body:JSON.stringify(t)}),pauseSchedule:e=>g(`/api/schedules/${e}/pause`,{method:"POST"}),resumeSchedule:e=>g(`/api/schedules/${e}/resume`,{method:"POST"}),runScheduleNow:e=>g(`/api/schedules/${e}/run-now`,{method:"POST"}),deleteSchedule:e=>g(`/api/schedules/${e}`,{method:"DELETE"}),schedulerStatus:()=>g("/api/scheduler/status"),schedulerBootstrapReport:()=>g("/api/scheduler/bootstrap-report"),installDaemon:()=>g("/api/scheduler/install-daemon",{method:"POST"}),uninstallDaemon:()=>g("/api/scheduler/uninstall-daemon",{method:"POST"}),refreshCatalogScope:e=>g("/api/catalog/refresh",{method:"POST",body:JSON.stringify(e)})};async function Wo(e){const t=e?`?profile=${encodeURIComponent(e)}`:"";return g(`/api/lineage${t}`)}async function Jo(e){const t=new URLSearchParams({profile:e.profile,database:e.database??"",schema:e.schema??"",table:e.table});return g(`/api/lineage/artifacts-with-table?${t.toString()}`)}async function Go(e){await g(`/api/lineage/by-id/${e}`,{method:"DELETE"})}async function Yo(e){return g("/api/lineage/edges/among",{method:"POST",body:JSON.stringify({entity_ids:e.entityIds??[],tables:e.tables??[]})})}async function Zo(e,t){return g(`/api/lineage/edges/${e}/style`,{method:"PATCH",body:JSON.stringify(t)})}async function ea(e){await g(`/api/lineage/edges/${e}`,{method:"DELETE"})}function ur(e){return e==null?"never":e<60?"just now":e<3600?`${Math.floor(e/60)} min ago`:e<86400?`${Math.floor(e/3600)} h ago`:`${Math.floor(e/86400)} d ago`}function pr(){const[e,t]=f.useState(!1),s=f.useRef(null),r=se(),o=()=>{t(!1),r("/db-cache")};f.useEffect(()=>{if(!e)return;function u(w){s.current&&(s.current.contains(w.target)||t(!1))}function h(w){w.key==="Escape"&&t(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[e]);const i=q({queryKey:["catalog-freshness"],queryFn:()=>g("/api/catalog/freshness"),refetchInterval:u=>{const h=u.state.data;return h&&h.syncing_profile_count>0?2e3:3e4},retry:!1}).data,l=i?.syncing_profile_count??0,c=i?.stale_profile_count??0,p=(i?.profiles??[]).filter(u=>u.state==="failed").length,x=i?.profiles.length??0,d=l>0,m=d?"syncing":x===0?"neutral":p>0||c>0?"warning":"positive",b=d?"Syncing…":"Catalog",v=p>0?p:!d&&c>0?c:0;return n.jsxs("div",{className:"relative",ref:s,children:[n.jsxs("button",{type:"button",onClick:()=>t(u=>!u),title:d?`${l} profile(s) syncing in background`:x===0?"No catalog data yet — click to sync":p>0?`${p} profile(s) failed to sync`:c>0?`${c} of ${x} profile(s) stale (>24h)`:`${x} profile(s) synced within 24h`,className:y("inline-flex h-7 items-center gap-1.5 rounded-md border px-2 text-[11px] font-medium transition-colors duration-fast",m==="positive"&&"border-positive/30 bg-positive-soft/40 text-positive hover:bg-positive-soft/60",m==="warning"&&"border-warning/40 bg-warning-soft/50 text-warning hover:bg-warning-soft/70",m==="neutral"&&"border-border bg-surface-subtle text-ink-dim hover:bg-surface-border",m==="syncing"&&"border-accent/30 bg-accent-soft/40 text-accent-ink hover:bg-accent-soft/60"),children:[m==="syncing"?n.jsx(Se,{size:12,className:"animate-spin"}):n.jsx(ht,{size:12}),n.jsx("span",{children:b}),v>0&&n.jsx("span",{className:y("rounded-full px-1.5 text-[9px] font-bold",p>0?"bg-critical text-critical-soft":"bg-warning text-warning-soft"),children:v})]}),e&&n.jsxs("div",{className:"absolute right-0 top-8 z-30 w-80 rounded-md border border-border bg-surface-raised p-3 shadow-md animate-fade-in",children:[n.jsx("div",{className:"mb-2 flex items-center justify-between",children:n.jsx("span",{className:"text-xs font-semibold text-ink",children:"Catalog freshness"})}),x===0?n.jsxs("p",{className:"text-[11px] text-ink-dim",children:["No profile has been indexed yet. Open"," ",n.jsx("strong",{children:"Catalog refreshes"})," to sync."]}):n.jsx("ul",{className:"space-y-1.5",children:(i?.profiles??[]).map(u=>{const h=u.total_tables>0?Math.min(100,Math.round(u.processed_tables/u.total_tables*100)):0;return n.jsxs("li",{className:"rounded border border-border/40 bg-surface-subtle/30 px-2 py-1.5 text-[11px]",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"truncate font-mono text-ink",children:u.profile}),n.jsx("span",{className:y("shrink-0",u.state==="failed"?"text-critical":u.state==="syncing"?"text-accent-ink":u.stale?"text-warning":"text-ink-dim"),children:u.state==="syncing"?`${u.processed_tables} / ${u.total_tables||"…"}`:u.state==="failed"?"failed":ur(u.age_seconds)+(u.stale?" · stale":"")})]}),u.state==="syncing"&&n.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded-full bg-surface-subtle",children:n.jsx("div",{className:"h-full bg-accent transition-all",style:{width:u.total_tables>0?`${h}%`:"30%"}})}),u.state==="failed"&&u.last_error&&n.jsxs("p",{className:"mt-1 break-words text-[10.5px] text-critical",children:["⚠ ",u.last_error]})]},u.profile)})}),n.jsxs("button",{type:"button",onClick:o,className:"mt-3 inline-flex w-full items-center justify-center gap-1.5 rounded-md bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-ink hover:bg-accent-soft/80",children:["Manage refreshes",n.jsx(cn,{size:11})]}),n.jsx("p",{className:"mt-2 text-[10px] text-ink-dim",children:"All manual sync, retry, and scheduled refresh management lives on the Catalog cache page."})]})]})}const fr={sm:"max-w-sm max-h-[92vh] flex flex-col",md:"max-w-md max-h-[92vh] flex flex-col",lg:"max-w-2xl max-h-[92vh] flex flex-col",xl:"max-w-[min(1200px,95vw)] max-h-[92vh] flex flex-col"};function mr({open:e,onClose:t,title:s,description:r,footer:o,preventBackdropClose:a,hideCloseButton:i,size:l="md",className:c,children:p}){const x=f.useRef(null),d=f.useRef(null);if(f.useEffect(()=>{if(!e)return;d.current=document.activeElement;const b=setTimeout(()=>{(x.current?.querySelector("[autofocus], button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")??x.current)?.focus()},0);return document.body.style.overflow="hidden",()=>{clearTimeout(b),document.body.style.overflow="",d.current?.focus?.()}},[e]),f.useEffect(()=>{if(!e)return;function b(v){if(v.key==="Escape")v.stopPropagation(),t();else if(v.key==="Tab"){const u=x.current?.querySelectorAll("button, [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])");if(!u||u.length===0)return;const h=u[0],w=u[u.length-1];v.shiftKey&&document.activeElement===h?(w.focus(),v.preventDefault()):!v.shiftKey&&document.activeElement===w&&(h.focus(),v.preventDefault())}}return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[e,t]),!e)return null;const m=n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-4 py-8 animate-fade-in",role:"presentation",onMouseDown:b=>{b.target===b.currentTarget&&!a&&t()},children:[n.jsx("div",{className:"absolute inset-0 bg-ink/40 backdrop-blur-sm","aria-hidden":"true"}),n.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":s?"amx-dialog-title":void 0,"aria-describedby":r?"amx-dialog-desc":void 0,tabIndex:-1,className:y("relative w-full overflow-hidden rounded-2xl border border-border bg-surface-raised shadow-lg animate-scale-in",fr[l],c),children:[(s||!i)&&n.jsxs("header",{className:y("flex items-start justify-between gap-4 px-5 pt-5","shrink-0"),children:[n.jsxs("div",{className:"min-w-0",children:[s&&n.jsx("h2",{id:"amx-dialog-title",className:"text-base font-semibold text-ink",children:s}),r&&n.jsx("p",{id:"amx-dialog-desc",className:"mt-1 text-sm text-ink-muted",children:r})]}),!i&&n.jsx(Xe,{icon:n.jsx(J,{size:16}),label:"Close",size:"sm",onClick:t,className:"-mr-1 -mt-1"})]}),p&&n.jsx("div",{className:y("px-5 py-4 text-sm text-ink","min-h-0 flex-1 overflow-auto overscroll-contain"),children:p}),o&&n.jsx("footer",{className:y("flex items-center justify-end gap-2 border-t border-border bg-surface-subtle/40 px-5 py-3","shrink-0"),children:o})]})]});return Te.createPortal(m,document.body)}function hr({className:e,shape:t="line"}){const s=t==="circle"?"rounded-full":t==="block"?"rounded-lg":"rounded";return n.jsx("span",{"aria-hidden":"true",className:y("amx-skeleton block",s,e)})}function xr({columns:e,rows:t,rowKey:s,onRowClick:r,searchable:o,searchPlaceholder:a="Search…",searchAccessor:i,filters:l,isLoading:c,error:p,errorTone:x="critical",emptyState:d,pageSize:m=50,className:b,initialSort:v,toolbar:u}){const[h,w]=f.useState(""),[C,L]=f.useState("__all"),[N,M]=f.useState(v??null),[O,D]=f.useState(0),V=f.useMemo(()=>{if(!o||!h)return null;const k=h.trim().toLowerCase();return k||null},[o,h]),I=f.useMemo(()=>{let k=t;if(l&&C!=="__all"){const $=l.find(A=>A.id===C);$&&(k=k.filter($.predicate))}if(V){const $=i??(A=>{try{return JSON.stringify(A).toLowerCase()}catch{return""}});k=k.filter(A=>$(A).toLowerCase().includes(V))}if(N){const $=e.find(A=>A.id===N.id);if($?.sortValue){const A=N.direction==="asc"?1:-1;k=[...k].sort((G,be)=>{const U=$.sortValue(G),ge=$.sortValue(be);return U==null&&ge==null?0:U==null?1:ge==null?-1:U<ge?-1*A:U>ge?1*A:0})}}return k},[t,l,C,V,N,e,i]),T=m>0?Math.max(1,Math.ceil(I.length/m)):1,z=Math.min(O,T-1),E=m>0?I.slice(z*m,(z+1)*m):I;function xe(k){M($=>!$||$.id!==k?{id:k,direction:"desc"}:$.direction==="desc"?{id:k,direction:"asc"}:null),D(0)}function Z(k){w(k.target.value),D(0)}function ae(k){L(k),D(0)}return n.jsxs("div",{className:y("flex flex-col gap-3",b),children:[(o||l||u)&&n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o&&n.jsxs("div",{className:"relative flex h-8 min-w-[14rem] items-center rounded-md border border-border bg-surface-raised pl-2.5 pr-2 focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",children:[n.jsx(gt,{size:13,className:"text-ink-dim"}),n.jsx("input",{type:"search",value:h,onChange:Z,placeholder:a,className:"ml-1.5 h-full flex-1 bg-transparent text-sm text-ink placeholder:text-ink-dim focus:outline-none"}),h&&n.jsx("button",{type:"button",onClick:()=>w(""),"aria-label":"Clear search",className:"ml-1 rounded p-0.5 text-ink-dim hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:12})})]}),l&&l.length>0&&n.jsxs("div",{role:"tablist","aria-label":"Filters",className:"inline-flex items-center gap-1 rounded-md bg-surface-subtle p-1",children:[n.jsx(Ge,{label:"All",isActive:C==="__all",onClick:()=>ae("__all"),badge:t.length}),l.map(k=>n.jsx(Ge,{label:k.label,isActive:C===k.id,onClick:()=>ae(k.id),badge:k.badge},k.id))]}),u&&n.jsx("div",{className:"ml-auto flex items-center gap-2",children:u})]}),n.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-surface-raised shadow-xs",children:[n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"border-b border-border bg-surface-subtle/60 text-[10.5px] uppercase tracking-wider text-ink-dim",children:n.jsx("tr",{children:e.map(k=>{const $=!!k.sortValue,A=N?.id===k.id;return n.jsx("th",{scope:"col",className:y("px-4 py-2 text-left font-semibold",k.align==="right"&&"text-right",k.align==="center"&&"text-center",k.width,k.hideOnMobile&&"hidden md:table-cell"),children:$?n.jsxs("button",{type:"button",onClick:()=>xe(k.id),className:"inline-flex items-center gap-1 rounded text-ink-dim hover:text-ink",children:[k.header,A?N.direction==="asc"?n.jsx(hn,{size:11}):n.jsx(an,{size:11}):n.jsx(un,{size:11,className:"opacity-40"})]}):k.header},k.id)})})}),n.jsx("tbody",{className:"divide-y divide-border",children:c?Array.from({length:6}).map((k,$)=>n.jsx("tr",{children:e.map(A=>n.jsx("td",{className:y("px-4 py-2.5",A.hideOnMobile&&"hidden md:table-cell"),children:n.jsx(hr,{className:"h-3 w-3/4"})},A.id))},`sk-${$}`)):p?n.jsx("tr",{children:n.jsx("td",{colSpan:e.length,className:x==="warning"?"px-4 py-6 text-center text-sm text-warning":"px-4 py-6 text-center text-sm text-critical",children:p})}):E.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:e.length,className:"px-4 py-10 text-center",children:(!!V||C!=="__all")&&t.length>0?n.jsxs("div",{className:"flex flex-col items-center gap-2 text-sm",children:[n.jsx("span",{className:"text-ink-muted",children:"No rows match the active filters."}),n.jsx("button",{type:"button",onClick:()=>{w(""),L("__all"),D(0)},className:"rounded-md border border-border px-2.5 py-1 text-xs text-ink-muted transition-colors duration-fast hover:border-accent/40 hover:text-ink",children:"Clear filters"})]}):d??n.jsx("span",{className:"text-sm text-ink-dim",children:"No rows."})})}):E.map(k=>n.jsx("tr",{onClick:r?()=>r(k):void 0,className:y(r&&"cursor-pointer transition-colors duration-fast hover:bg-surface-subtle/50"),children:e.map($=>{const A=$.cell?$.cell(k):String(k[$.id]??"");return n.jsx("td",{className:y("px-4 py-2.5 align-middle text-ink",$.align==="right"&&"text-right",$.align==="center"&&"text-center",$.mono&&"font-mono text-xs",$.hideOnMobile&&"hidden md:table-cell"),children:A},$.id)})},s(k)))})]})}),m>0&&T>1&&n.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border bg-surface-subtle/40 px-4 py-2 text-xs text-ink-dim",children:[n.jsxs("span",{children:["Showing"," ",n.jsxs("span",{className:"font-medium text-ink",children:[z*m+1,"–",Math.min((z+1)*m,I.length)]})," ","of ",n.jsx("span",{className:"font-medium text-ink",children:I.length})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>D(k=>Math.max(0,k-1)),disabled:z===0,className:"rounded px-2 py-1 hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-40",children:"Prev"}),n.jsxs("span",{className:"px-1 text-ink-muted",children:[z+1," / ",T]}),n.jsx("button",{type:"button",onClick:()=>D(k=>Math.min(T-1,k+1)),disabled:z===T-1,className:"rounded px-2 py-1 hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-40",children:"Next"})]})]})]})]})}function Ge({label:e,isActive:t,onClick:s,badge:r}){return n.jsxs("button",{type:"button",role:"tab","aria-selected":t,onClick:s,className:y("inline-flex h-6 items-center gap-1.5 rounded px-2 text-xs font-medium transition-colors duration-fast",t?"bg-surface-raised text-ink shadow-xs":"text-ink-muted hover:text-ink"),children:[e,r!=null&&n.jsx("span",{className:y("rounded-full px-1 text-[10px]",t?"bg-accent-soft text-accent-ink":"bg-surface-raised text-ink-dim"),children:r})]})}const br=["pricing","models"];function Ye(e){return e===0?"$0.0000":`$${e.toFixed(4)}`}function Pt(e){if(e==null)return"—";const t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${(t/3600).toFixed(1)}h ago`:`${(t/86400).toFixed(1)}d ago`}const gr=[{id:"model_id",header:"Model",cell:e=>e.model_id,sortValue:e=>e.model_id,mono:!0},{id:"provider_hint",header:"Provider",cell:e=>e.provider_hint||"—",sortValue:e=>e.provider_hint,width:"w-32"},{id:"input_per_mtok",header:"Input $/Mtok",cell:e=>Ye(e.input_per_mtok),sortValue:e=>e.input_per_mtok,align:"right",width:"w-32"},{id:"output_per_mtok",header:"Output $/Mtok",cell:e=>Ye(e.output_per_mtok),sortValue:e=>e.output_per_mtok,align:"right",width:"w-32"},{id:"source",header:"Source",cell:e=>e.source,sortValue:e=>e.source,width:"w-28",hideOnMobile:!0},{id:"fetched_at",header:"Fetched",cell:e=>Pt(e.fetched_at),sortValue:e=>e.fetched_at??0,width:"w-24",hideOnMobile:!0}],yr=[{id:"litellm",label:"LiteLLM",predicate:e=>e.source==="litellm"},{id:"openrouter",label:"OpenRouter",predicate:e=>e.source==="openrouter"},{id:"fallback",label:"Bundled",predicate:e=>e.source==="fallback"}];function vr({open:e,onClose:t}){const s=q({queryKey:br,queryFn:()=>B.listModelPrices(),enabled:e,refetchOnWindowFocus:!1}),r=s.data?.models??[],o=s.data?.is_stale??!1,a=s.data?.fetched_at??null;return n.jsx(mr,{open:e,onClose:t,size:"xl",title:"LLM model prices",description:a!=null?`Cache snapshot from ${Pt(a)} — ${r.length} models.`:`${r.length} models loaded.`,children:n.jsxs("div",{className:"flex flex-col gap-3",children:[o&&n.jsx("div",{className:"rounded-md border border-warning/40 bg-warning-soft/40 px-3 py-2 text-[12px] text-warning",children:"These prices are more than 24h old. Click the refresh icon in the topbar to pull fresh data from LiteLLM and OpenRouter."}),n.jsx(xr,{columns:gr,rows:r,rowKey:i=>i.model_id,searchable:!0,searchPlaceholder:"Search by model id…",searchAccessor:i=>`${i.model_id} ${i.provider_hint} ${i.source}`,filters:yr,isLoading:s.isLoading,error:s.error?s.error.message:null,emptyState:n.jsx("div",{className:"px-4 py-6 text-center text-[13px] text-ink-dim",children:"No price data loaded yet. Click the refresh icon in the topbar to populate the catalog from LiteLLM and OpenRouter."}),initialSort:{id:"model_id",direction:"asc"},pageSize:20,toolbar:n.jsxs(ue,{to:"/pricing",onClick:t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-[12px] font-medium text-ink-muted hover:bg-surface-border hover:text-ink",children:[n.jsx(xt,{size:12}),"Open full pricing page",n.jsx(fn,{size:11})]})})]})})}const wr={sm:"h-7 px-2.5 text-xs gap-1.5",md:"h-8 px-3 text-sm gap-2",lg:"h-10 px-4 text-[15px] gap-2"},kr={primary:"bg-accent text-white hover:bg-accent-ink active:bg-accent-ink shadow-xs disabled:bg-ink-dim disabled:text-white",secondary:"bg-surface-raised text-ink border border-border hover:bg-surface-subtle active:bg-surface-subtle disabled:text-ink-dim",ghost:"bg-transparent text-ink-muted hover:bg-surface-subtle hover:text-ink active:bg-surface-subtle disabled:text-ink-dim",danger:"bg-critical text-white hover:opacity-90 active:opacity-95 shadow-xs disabled:opacity-50",subtle:"bg-surface-subtle text-ink-muted hover:bg-border hover:text-ink active:bg-border disabled:text-ink-dim"},ta=f.forwardRef(function({variant:t="secondary",size:s="md",loading:r=!1,leadingIcon:o,trailingIcon:a,fullWidth:i,className:l,disabled:c,children:p,type:x="button",...d},m){const b=c||r;return n.jsxs("button",{ref:m,type:x,disabled:b,className:y("inline-flex shrink-0 items-center justify-center rounded-md font-medium transition-colors duration-fast","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 focus-visible:ring-offset-bg","disabled:cursor-not-allowed",wr[s],kr[t],i&&"w-full",l),...d,children:[r?n.jsx(re,{className:"h-3.5 w-3.5 animate-spin"}):o,p,a]})}),na=f.forwardRef(function({className:t,invalid:s,leadingIcon:r,trailingIcon:o,...a},i){return r||o?n.jsxs("div",{className:y("flex h-9 items-center gap-2 rounded-md border bg-surface-raised px-3 transition-colors duration-fast","focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",s?"border-critical focus-within:border-critical focus-within:ring-critical/20":"border-border",t),children:[r&&n.jsx("span",{className:"text-ink-dim",children:r}),n.jsx("input",{ref:i,className:"h-full flex-1 bg-transparent text-sm text-ink placeholder:text-ink-dim focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",...a}),o&&n.jsx("span",{className:"text-ink-dim",children:o})]}):n.jsx("input",{ref:i,className:y("h-9 w-full rounded-md border bg-surface-raised px-3 text-sm text-ink transition-colors duration-fast","placeholder:text-ink-dim","focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20","disabled:cursor-not-allowed disabled:opacity-60",s?"border-critical focus:border-critical focus:ring-critical/20":"border-border",t),...a})}),sa=f.forwardRef(function({className:t,invalid:s,rows:r=4,...o},a){return n.jsx("textarea",{ref:a,rows:r,className:y("block w-full resize-y rounded-md border bg-surface-raised px-3 py-2 text-sm text-ink transition-colors duration-fast","placeholder:text-ink-dim","focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20","disabled:cursor-not-allowed disabled:opacity-60",s?"border-critical focus:border-critical focus:ring-critical/20":"border-border",t),...o})}),ra=f.forwardRef(function({className:t,invalid:s,children:r,...o},a){return n.jsxs("div",{className:"relative inline-flex w-full",children:[n.jsx("select",{ref:a,className:y("h-9 w-full appearance-none rounded-md border bg-surface-raised pl-3 pr-8 text-sm text-ink transition-colors duration-fast","focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20","disabled:cursor-not-allowed disabled:opacity-60",s?"border-critical focus:border-critical focus:ring-critical/20":"border-border",t),...o,children:r}),n.jsx(te,{size:14,className:"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-ink-dim"})]})}),oa=f.forwardRef(function({label:t,description:s,indeterminate:r,className:o,checked:a,disabled:i,...l},c){return n.jsxs("label",{className:y("group inline-flex cursor-pointer items-start gap-2.5",i&&"cursor-not-allowed opacity-60",o),children:[n.jsxs("span",{className:"relative mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center",children:[n.jsx("input",{ref:c,type:"checkbox",checked:a,disabled:i,className:"peer absolute inset-0 h-full w-full cursor-pointer opacity-0",...l}),n.jsx("span",{"aria-hidden":"true",className:y("h-4 w-4 rounded border bg-surface-raised transition-colors duration-fast","peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-bg",a||r?"border-accent bg-accent":"border-border-strong group-hover:border-ink-muted")}),(a||r)&&n.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center text-white",children:r?n.jsx(qn,{size:11,strokeWidth:3}):n.jsx(ft,{size:11,strokeWidth:3})})]}),(t||s)&&n.jsxs("span",{className:"flex flex-col gap-0.5 leading-tight",children:[t&&n.jsx("span",{className:"text-sm text-ink",children:t}),s&&n.jsx("span",{className:"text-xs text-ink-dim",children:s})]})]})}),aa=f.forwardRef(function({label:t,description:s,className:r,checked:o,disabled:a,...i},l){return n.jsxs("label",{className:y("group inline-flex cursor-pointer items-start gap-3",a&&"cursor-not-allowed opacity-60",r),children:[n.jsxs("span",{className:"relative inline-flex h-5 w-9 shrink-0 items-center",children:[n.jsx("input",{ref:l,type:"checkbox",role:"switch",checked:o,disabled:a,className:"peer absolute inset-0 h-full w-full cursor-pointer opacity-0",...i}),n.jsx("span",{"aria-hidden":"true",className:y("h-5 w-9 rounded-full border transition-colors duration-fast","peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-bg",o?"border-accent bg-accent":"border-border-strong bg-surface-subtle group-hover:border-ink-muted")}),n.jsx("span",{"aria-hidden":"true",className:y("pointer-events-none absolute top-0.5 h-4 w-4 rounded-full bg-white shadow-xs transition-all duration-fast",o?"left-[18px]":"left-0.5")})]}),(t||s)&&n.jsxs("span",{className:"flex flex-col gap-0.5 leading-tight",children:[t&&n.jsx("span",{className:"text-sm text-ink",children:t}),s&&n.jsx("span",{className:"text-xs text-ink-dim",children:s})]})]})});function jr({content:e,placement:t="top",delay:s=250,disabled:r,className:o,children:a}){const[i,l]=f.useState(!1),c=f.useRef(null),p=f.useId();f.useEffect(()=>{function u(h){h.key==="Escape"&&l(!1)}if(i)return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[i]);function x(){r||!e||(c.current&&clearTimeout(c.current),c.current=setTimeout(()=>l(!0),s))}function d(){c.current&&clearTimeout(c.current),l(!1)}const m={top:"bottom-full left-1/2 mb-1.5 -translate-x-1/2",bottom:"top-full left-1/2 mt-1.5 -translate-x-1/2",left:"right-full top-1/2 mr-1.5 -translate-y-1/2",right:"left-full top-1/2 ml-1.5 -translate-y-1/2"};if(!f.isValidElement(a))return a;const b=a.props,v=f.cloneElement(a,{onMouseEnter:u=>{x();const h=b.onMouseEnter;h?.(u)},onMouseLeave:u=>{d();const h=b.onMouseLeave;h?.(u)},onFocus:u=>{x();const h=b.onFocus;h?.(u)},onBlur:u=>{d();const h=b.onBlur;h?.(u)},"aria-describedby":i?p:void 0});return n.jsxs("span",{className:"relative inline-flex",children:[v,i&&n.jsx("span",{id:p,role:"tooltip",className:y("pointer-events-none absolute z-50 w-max max-w-xs whitespace-normal break-words rounded-md bg-ink px-2 py-1 text-left text-[11px] font-medium leading-snug text-bg shadow-md animate-fade-in",m[t],o),children:e})]})}const At=f.createContext(null),Nr={success:jn,error:mt,warning:os,info:bt},_r={success:"border-positive/40 bg-positive-soft text-ink",error:"border-critical/40 bg-critical-soft text-ink",warning:"border-warning/40 bg-warning-soft text-ink",info:"border-info/40 bg-info-soft text-ink"},Sr={success:"text-positive",error:"text-critical",warning:"text-warning",info:"text-info"};function Cr({children:e}){const[t,s]=f.useState([]),r=f.useRef(0),o=f.useRef(new Map),a=f.useCallback(c=>{s(x=>x.filter(d=>d.id!==c));const p=o.current.get(c);p&&(clearTimeout(p),o.current.delete(c))},[]),i=f.useCallback(c=>{r.current+=1;const p=r.current,x={...c,id:p,tone:c.tone??"info"};s(m=>[...m,x]);const d=c.duration??4500;if(d>0){const m=setTimeout(()=>a(p),d);o.current.set(p,m)}return p},[a]);f.useEffect(()=>{const c=o.current;return()=>{c.forEach(p=>clearTimeout(p)),c.clear()}},[]);const l=f.useMemo(()=>({push:i,dismiss:a}),[i,a]);return n.jsxs(At.Provider,{value:l,children:[e,Te.createPortal(n.jsx("div",{className:"pointer-events-none fixed right-4 top-4 z-[60] flex w-80 flex-col gap-2","aria-live":"polite",children:t.map(c=>{const p=Nr[c.tone??"info"];return n.jsxs("div",{role:"status",className:y("pointer-events-auto flex items-start gap-2.5 rounded-lg border bg-surface-raised px-3 py-2.5 shadow-md animate-slide-in-up",_r[c.tone??"info"]),children:[n.jsx(p,{size:16,className:y("mt-0.5 shrink-0",Sr[c.tone??"info"])}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-ink",children:c.title}),c.description&&n.jsx("div",{className:"mt-0.5 text-xs text-ink-muted",children:c.description})]}),n.jsx("button",{type:"button",onClick:()=>a(c.id),"aria-label":"Dismiss",className:"-mr-1 -mt-1 rounded p-1 text-ink-dim hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:13})})]},c.id)})}),document.body)]})}function Lt(){const e=f.useContext(At);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}const It=f.createContext(null);function Tt(){const e=f.useContext(It);if(!e)throw new Error("Tabs.* must be rendered inside <Tabs>");return e}function ia({value:e,onValueChange:t,children:s,className:r}){const o=f.useId();return n.jsx(It.Provider,{value:{value:e,onChange:t,baseId:o},children:n.jsx("div",{className:y("flex flex-col gap-4",r),children:s})})}function la({children:e,className:t,variant:s="underline"}){const r=s==="underline"?"flex items-center gap-4 border-b border-border":"inline-flex items-center gap-1 rounded-md bg-surface-subtle p-1";return n.jsx("div",{role:"tablist",className:y(r,t),onKeyDown:o=>{if(o.key!=="ArrowLeft"&&o.key!=="ArrowRight")return;const a=Array.from(o.currentTarget.querySelectorAll("[role='tab']")),i=a.findIndex(p=>p===document.activeElement);if(i<0)return;const l=o.key==="ArrowRight"?1:-1,c=a[(i+l+a.length)%a.length];c?.focus(),c?.click(),o.preventDefault()},children:e})}function ca({value:e,children:t,icon:s,className:r,variant:o="underline",badge:a}){const{value:i,onChange:l,baseId:c}=Tt(),p=i===e,x=o==="underline"?y("relative -mb-px inline-flex items-center gap-1.5 border-b-2 px-1 pb-2 pt-1 text-sm font-medium transition-colors duration-fast",p?"border-accent text-ink":"border-transparent text-ink-muted hover:text-ink"):y("inline-flex items-center gap-1.5 rounded px-2.5 py-1 text-xs font-medium transition-colors duration-fast",p?"bg-surface-raised text-ink shadow-xs":"text-ink-muted hover:text-ink");return n.jsxs("button",{type:"button",role:"tab",id:`${c}-tab-${e}`,"aria-selected":p,"aria-controls":`${c}-panel-${e}`,tabIndex:p?0:-1,onClick:()=>l(e),className:y(x,"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-1 focus-visible:ring-offset-bg",r),children:[s,t,a]})}function da({value:e,children:t,className:s}){const{value:r,baseId:o}=Tt();return r!==e?null:n.jsx("div",{role:"tabpanel",id:`${o}-panel-${e}`,"aria-labelledby":`${o}-tab-${e}`,tabIndex:0,className:y("focus:outline-none",s),children:t})}function Er({text:e,placement:t="top",className:s,size:r=11}){return n.jsx(jr,{content:e,placement:t,children:n.jsx("span",{role:"button",tabIndex:0,"aria-label":typeof e=="string"?e:"More info",className:y("inline-flex items-center justify-center rounded-full text-ink-dim transition-colors duration-fast hover:text-ink-muted focus:text-ink-muted focus:outline-none",s),children:n.jsx(bt,{size:r,"aria-hidden":"true"})})})}const Ze=["pricing","cache-info"],$r=5*60*1e3;function Rr(e){return e==null?"never fetched":e<60?`${Math.floor(e)}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${(e/3600).toFixed(1)}h ago`:`${(e/86400).toFixed(1)}d ago`}function Mr(){const{push:e}=Lt(),t=Y(),[s,r]=f.useState(!1),o=q({queryKey:Ze,queryFn:()=>B.pricingCacheInfo(),refetchInterval:$r,refetchOnWindowFocus:!1,retry:!1}),a=Ne({mutationFn:()=>B.refreshPrices(),onSuccess:p=>{const{litellm:x,openrouter:d,errors:m,skipped:b}=p;b?e({tone:"info",title:"Prices already fresh",description:`${x} LiteLLM + ${d} OpenRouter models loaded.`,duration:1800}):m.length>0?e({tone:"warning",title:"Prices partially refreshed",description:m.join("; "),duration:4e3}):e({tone:"success",title:"Prices refreshed",description:`${x} LiteLLM + ${d} OpenRouter models. Cache valid for 24h.`,duration:2400}),t.invalidateQueries({queryKey:Ze})},onError:p=>{e({tone:"error",title:"Price refresh failed",description:p.message,duration:4e3})}}),i=o.data;if(!i)return null;const l=i.is_stale?"warning":"info",c=i.fetched_at==null?"Prices: never fetched":`Prices: ${Rr(i.age_seconds)}`;return n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:y("hidden h-7 items-center gap-1.5 rounded-md border pl-2 pr-1 text-[11px] font-medium md:inline-flex",l==="warning"?"border-warning/40 bg-warning-soft/40 text-warning":"border-border bg-surface-subtle/60 text-ink-muted"),children:[n.jsx("button",{type:"button",onClick:()=>r(!0),title:"Browse model prices","aria-label":"Browse model prices",className:y("inline-flex h-full items-center rounded-sm pr-1 transition-colors","hover:text-ink"),children:c}),n.jsx("button",{type:"button",onClick:()=>a.mutate(),disabled:a.isPending,"aria-label":"Refresh LLM price cache",title:i.is_stale?`Price cache is older than ${Math.floor(i.ttl_seconds/3600)}h. Click to refresh.`:"Refresh price cache",className:y("inline-flex h-5 w-5 items-center justify-center rounded text-ink-muted transition-colors","hover:bg-surface-border hover:text-ink","disabled:cursor-wait disabled:opacity-60"),children:a.isPending?n.jsx(re,{size:11,className:"animate-spin"}):n.jsx(Se,{size:11})})]}),n.jsx(vr,{open:s,onClose:()=>r(!1)})]})}function Pr({items:e}){const[t,s]=f.useState(!1),r=f.useRef(null),o=he();return f.useEffect(()=>{s(!1)},[o.pathname]),f.useEffect(()=>{if(!t)return;function a(l){r.current&&(r.current.contains(l.target)||s(!1))}function i(l){l.key==="Escape"&&s(!1)}return window.addEventListener("mousedown",a),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",a),window.removeEventListener("keydown",i)}},[t]),n.jsxs("div",{ref:r,className:"relative sm:hidden",children:[n.jsx(Xe,{icon:n.jsx(En,{size:16}),label:"Open navigation menu",size:"sm",onClick:()=>s(a=>!a)}),t&&n.jsx("nav",{role:"menu","aria-label":"Primary navigation",className:"absolute right-0 top-full z-50 mt-1 w-48 rounded-md border border-border bg-surface-raised shadow-lg",children:n.jsx("ul",{className:"py-1",children:e.map(a=>n.jsx("li",{children:n.jsxs(ut,{to:a.to,role:"menuitem",className:({isActive:i})=>y("flex items-center gap-2 px-3 py-2 text-sm",i?"bg-accent-soft text-accent-ink":"text-ink hover:bg-surface-subtle"),children:[n.jsx(a.icon,{size:14}),a.label]})},a.to))})})]})}const Ar=[{to:"/overview",label:"Overview",icon:bn,match:["/overview"]},{to:"/runs",label:"Runs",icon:On,match:["/runs","/runs/schedules"]},{to:"/ask",label:"Ask",icon:ts,match:["/ask"]},{to:"/lineage",label:"Lineage",icon:is,match:["/lineage"]},{to:"/pages",label:"Pages",icon:Mn,match:["/pages"]},{to:"/settings",label:"Settings",icon:Zn,match:["/settings"]},{to:"/system",label:"System",icon:rn,match:["/system"]}];function Lr(){const e=ne(m=>m.toggleSidebar),t=ne(m=>m.setMobileSidebarOpen),s=xs(),r=he(),o=me(),a=Ar;function i(){s?t(!0):e()}const[l,c]=f.useState(!1),[p,x]=f.useState(0);f.useEffect(()=>{function m(){if(typeof window>"u")return;let b=0;for(let v=0;v<window.localStorage.length;v++){const u=window.localStorage.key(v);if(!u||!u.startsWith("amx.compare.pinnedCells."))continue;const h=u.slice(24);b+=Ce(h==="__global"?null:h).length}x(b)}return m(),window.addEventListener("amx:pinned-cells-changed",m),()=>window.removeEventListener("amx:pinned-cells-changed",m)},[]);const d=f.useMemo(()=>Ir(r.pathname,o),[r.pathname,o]);return n.jsxs("header",{className:"border-b border-border bg-surface-raised",children:[n.jsxs("div",{className:"flex h-12 items-center gap-3 px-4",children:[n.jsx(Xe,{icon:n.jsx(Vn,{size:16}),label:"Toggle sidebar",size:"sm",onClick:i}),n.jsx(ue,{to:"/","aria-label":"AMX Studio home",className:"group flex items-center rounded-md px-1.5 py-1 -mx-1 hover:bg-surface-subtle",children:n.jsx(Mt,{size:22,suffix:"Studio"})}),d.length>0&&n.jsx("nav",{"aria-label":"Breadcrumb",className:"hidden md:flex",children:n.jsx("ol",{className:"flex items-center gap-1 text-xs text-ink-dim",children:d.map((m,b)=>n.jsxs("li",{className:"flex items-center gap-1",children:[n.jsx(_e,{size:14,strokeWidth:2.5,className:"text-ink-muted","aria-hidden":"true"}),m.to&&b<d.length-1?n.jsx(ue,{to:m.to,className:"rounded text-ink-muted hover:text-ink",children:m.label}):n.jsx("span",{"aria-current":b===d.length-1?"page":void 0,className:b===d.length-1?"max-w-[16rem] truncate font-medium text-ink":"max-w-[10rem] truncate",title:typeof m.label=="string"?m.label:void 0,children:m.label})]},b))})}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsxs("button",{type:"button",onClick:()=>c(!0),"aria-label":`Open pinned-cells drawer (${p} pinned)`,className:y("relative inline-flex h-7 items-center gap-1 rounded-md px-2 text-xs font-medium transition-colors",p>0?"text-accent hover:bg-surface-subtle":"text-ink-muted hover:bg-surface-subtle hover:text-ink"),children:[n.jsx(Hn,{size:13}),p>0&&n.jsx("span",{className:"rounded-full bg-accent px-1.5 text-[10px] font-bold text-accent-soft",children:p})]}),n.jsx(pr,{}),n.jsx(Mr,{}),n.jsx("nav",{className:"hidden sm:flex items-center gap-0.5",children:a.map(m=>n.jsxs(ut,{to:m.to,className:({isActive:b})=>y("flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors duration-fast",b?"bg-accent-soft text-accent-ink":"text-ink-muted hover:bg-surface-subtle hover:text-ink"),children:[n.jsx(m.icon,{size:13}),m.label]},m.to))}),n.jsx(Pr,{items:a})]})]}),n.jsx(rr,{open:l,onClose:()=>c(!1)})]})}function Ir(e,t){if(e==="/"||e==="")return[];const s=e.split("/").filter(Boolean),r=s[0];if(r==="db"||r==="cat"){const a=[{label:"Browse",to:"/"}],i=t.database??t.catalog;return t.profile&&i&&(a.push({label:t.profile,to:`/${r}/${t.profile}`}),a.push({label:i,to:`/${r}/${t.profile}/${i}`})),t.schema&&i&&t.profile&&a.push({label:t.schema,to:`/${r}/${t.profile}/${i}/${t.schema}`}),t.table&&a.push({label:t.table}),a}if(r==="runs"){const a=[{label:"Runs",to:"/runs"}];return s[1]==="new"?a.push({label:"New run"}):s[1]==="compare"?a.push({label:"Compare"}):t.runId&&a.push({label:`#${t.runId}`}),a}const o={ask:"Ask",pending:"Pending",settings:"Settings",system:"System"};return r&&o[r]?[{label:o[r]}]:[]}function et(e){return e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Tr({provider:e,model:t,isActive:s=!1,density:r="default",className:o}){const a=!!(e&&t),i=q({queryKey:["pricing","model",e,t],queryFn:()=>B.lookupPrice(e,t),enabled:a,refetchOnWindowFocus:!1,retry:!1});if(!a)return null;const l=r==="compact"?"text-[10.5px]":"text-[11px]",c=s?"text-ink":"text-ink-muted";if(i.isLoading)return n.jsx("div",{className:y(l,"text-ink-dim",o),children:"Loading price…"});const p=i.data;return!p||p.source==="unknown"?n.jsx("div",{className:y(l,"text-ink-dim",o),children:"no price data — refresh in topbar"}):r==="compact"?n.jsxs("div",{className:y(l,c,"tabular-nums",o),children:[n.jsx("span",{className:"text-ink-dim",children:"in"})," ",et(p.input_per_mtok),n.jsx("span",{className:"px-1.5 text-ink-dim",children:"·"}),n.jsx("span",{className:"text-ink-dim",children:"out"})," ",et(p.output_per_mtok),n.jsx("span",{className:"ml-1 text-ink-dim",children:"/1M"})]}):n.jsxs("div",{className:y(l,c,o),children:["$",p.input_per_mtok.toFixed(4)," / $",p.output_per_mtok.toFixed(4)," per 1M"," ",n.jsxs("span",{className:"text-ink-dim",children:["(",p.source,")"]})]})}function Or({kind:e,label:t,activeName:s,tooltip:r,variant:o="pill",placement:a="bottom"}){const[i,l]=f.useState(!1),c=f.useRef(null),p=Y(),x=se(),d=q({queryKey:["profiles",e,"list"],queryFn:()=>g(`/api/profiles/${e}`),enabled:i,retry:!1,staleTime:3e4}),m=Ne({mutationFn:u=>g(`/api/profiles/${e}/${encodeURIComponent(u)}/activate`,{method:"POST"}),onMutate:async u=>{await p.cancelQueries({queryKey:["context"]}),await p.cancelQueries({queryKey:["profiles",e,"list"]});const h=p.getQueryData(["context"]),w=p.getQueryData(["profiles",e,"list"]);if(h){const C={...h};if(e==="llm"){C.active_llm_profile=u;const L=w?.profiles.find(N=>N.name===u);L?.provider&&(C.llm_provider=L.provider),L?.model&&(C.llm_model=L.model)}else C.active_db_profile=u;p.setQueryData(["context"],C)}return w&&p.setQueryData(["profiles",e,"list"],{...w,profiles:w.profiles.map(C=>({...C,is_active:C.name===u}))}),l(!1),{ctxSnapshot:h,listSnapshot:w}},onError:(u,h,w)=>{w?.ctxSnapshot&&p.setQueryData(["context"],w.ctxSnapshot),w?.listSnapshot&&p.setQueryData(["profiles",e,"list"],w.listSnapshot)},onSettled:()=>{p.invalidateQueries({queryKey:["context"]}),p.invalidateQueries({queryKey:["profiles",e]}),p.invalidateQueries({queryKey:["live-catalogs"]}),p.invalidateQueries({queryKey:["live-databases"]}),p.invalidateQueries({queryKey:["live-schemas"]}),p.invalidateQueries({queryKey:["live-assets"]}),p.invalidateQueries({queryKey:["recent-runs"]})}});f.useEffect(()=>{if(!i)return;function u(w){c.current&&(c.current.contains(w.target)||l(!1))}function h(w){w.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[i]);const b=s||`Select ${t.toLowerCase()}`,v=d.data?.profiles??[];return n.jsxs("div",{className:"relative",ref:c,children:[o==="row"?n.jsxs("button",{type:"button",onClick:()=>l(u=>!u),title:r,"aria-haspopup":"listbox","aria-expanded":i,className:"flex w-full items-center justify-between gap-2 rounded px-2 py-0.5 text-left transition-colors duration-fast hover:bg-surface-subtle",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider text-ink-dim",children:t}),n.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[n.jsx("span",{className:y("max-w-[10rem] truncate font-mono text-[11px]",s?"text-ink":"text-warning"),children:b}),n.jsx(te,{size:11,className:"text-ink-dim"})]})]}):n.jsxs("button",{type:"button",onClick:()=>l(u=>!u),title:r,className:y("inline-flex h-7 items-center gap-1.5 rounded-md border px-2 font-medium transition-colors duration-fast",s?"border-accent/20 bg-accent-soft text-accent-ink hover:bg-accent-soft/80":"border-warning/40 bg-warning-soft text-warning hover:bg-warning-soft/80",m.isPending&&"opacity-80"),children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider opacity-70",children:t}),n.jsx("span",{className:"max-w-[8rem] truncate font-mono text-[11px]",children:b}),m.isPending?n.jsx("span",{"aria-label":"Activating",className:"inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-current"}):n.jsx(te,{size:12,className:"opacity-70"})]}),i&&n.jsxs("div",{className:y("absolute z-30 w-72 overflow-hidden rounded-md border border-border bg-surface-raised shadow-md animate-fade-in",o==="row"?"left-0":"right-0",a==="top"?"bottom-full mb-1":"mt-1"),children:[n.jsxs("button",{type:"button",onClick:()=>{l(!1),x(`/settings?tab=${e}`)},className:"flex w-full items-center gap-2 border-b border-border px-3 py-2 text-left text-xs font-medium text-accent-ink hover:bg-accent-soft/40",children:[n.jsx(Wn,{size:13}),"Add ",t.toLowerCase()," profile"]}),d.isLoading?n.jsx("div",{className:"px-3 py-3 text-xs text-ink-dim",children:"Loading profiles…"}):d.error?n.jsx("div",{className:"px-3 py-3 text-xs text-critical",children:d.error.message}):v.length===0?n.jsxs("div",{className:"px-3 py-3 text-xs text-ink-dim",children:["No ",t.toLowerCase()," profiles saved yet."]}):n.jsx("ul",{className:"max-h-72 overflow-y-auto py-1",children:v.map(u=>{const h=u.is_active||u.name===s,w=zr(e,u);return n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>m.mutate(u.name),disabled:m.isPending||h,className:y("flex w-full items-start justify-between gap-2 px-3 py-1.5 text-left text-xs hover:bg-surface-subtle disabled:cursor-default",h&&"bg-surface-subtle/60"),children:[n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate font-mono text-ink",children:u.name}),w&&n.jsx("span",{className:"block truncate text-[10.5px] text-ink-dim",children:w})]}),h&&n.jsx(ft,{size:12,className:"mt-0.5 text-accent"})]})},u.name)})}),m.isError&&n.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[11px] text-critical",children:m.error instanceof Error?m.error.message:"Activation failed."})]})]})}function zr(e,t){return e==="db"?[t.backend,t.host,t.database||t.catalog].filter(Boolean).join(" · "):[t.provider,t.model].filter(Boolean).join(" · ")}function Ot({collapsed:e}){return e?n.jsx(Xr,{}):n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"px-3 pt-3",children:[n.jsx(nt,{hint:"Active LLM profile. Manage from Settings.",children:"LLM Profile"}),n.jsx(Vr,{}),n.jsx(nt,{className:"mt-4",hint:"Every saved DB profile, expandable independently. Click any node to navigate.",children:"DB Profiles"}),n.jsxs(ue,{to:"/db-cache",title:"Inspect and flush AMX's DB metadata caches",className:y("mb-1 mt-1 flex items-center gap-1.5 rounded px-2 py-1 text-[12px]","text-ink-dim transition-colors duration-fast hover:bg-surface-subtle hover:text-ink"),children:[n.jsx(In,{size:12}),n.jsx("span",{children:"DB cache"})]}),n.jsx(Dr,{})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:n.jsx(Qr,{})})]})}function Xr(){const e=ne(s=>s.toggleSidebar),t=[{Icon:ht,label:"Expand sidebar — DB profiles"},{Icon:An,label:"Expand sidebar — profile tree"},{Icon:Dn,label:"Expand sidebar — LLM profile"}];return n.jsx("div",{className:"flex h-full flex-col items-center gap-1 py-3 text-ink-dim",children:t.map(({Icon:s,label:r})=>n.jsx("button",{type:"button",onClick:e,"aria-label":r,"aria-expanded":!1,className:"flex h-8 w-8 items-center justify-center rounded-md transition-colors duration-fast hover:bg-surface-subtle hover:text-ink focus:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:n.jsx(s,{size:16})},r))})}function Dr(){const{query:e,setQuery:t}=Ue();return n.jsxs("div",{className:"mb-1.5 mt-1 flex items-center gap-1.5 rounded-md border border-surface-border bg-surface px-2 py-1 focus-within:border-accent/40",children:[n.jsx(gt,{size:12,className:"shrink-0 text-ink-dim"}),n.jsx("input",{type:"text",value:e,onChange:s=>t(s.target.value),placeholder:"Search schemas, tables, columns…","aria-label":"Search DB profiles, schemas, tables, columns",className:"w-full bg-transparent text-xs text-ink outline-none placeholder:text-ink-dim"}),e&&n.jsx("button",{type:"button",onClick:()=>t(""),"aria-label":"Clear search",className:"shrink-0 rounded p-0.5 text-ink-dim hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:11})})]})}const Ae=new Set;let Le="";function Ur(e){return Ae.add(e),()=>Ae.delete(e)}function tt(){return Le}function Fr(e){Le!==e&&(Le=e,Ae.forEach(t=>t()))}function Ue(){return{query:f.useSyncExternalStore(Ur,tt,tt),setQuery:Fr}}function X(e,t){return t?e.toLowerCase().includes(t.toLowerCase()):!0}function qr(e,t,s){if(!s)return!1;const r=e.getQueryData(["live-catalogs",t]);return!!(r?.supports_catalogs&&r.catalogs.some(a=>X(a,s))||e.getQueryData(["live-databases",t])?.databases?.some(a=>X(a,s)))}function Br(e,t,s,r){return r?!!e.getQueryData(["live-assets",t.profile,t.database??"",t.catalog??"",s])?.assets?.some(a=>X(a.name,r)):!1}function nt({children:e,className:t,hint:s}){return n.jsxs("div",{className:y("flex items-center gap-1 px-2 pb-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-ink-dim",t),children:[e,s&&n.jsx(Er,{text:s})]})}function Vr(){const{data:e}=q({queryKey:["context"],queryFn:()=>B.context()}),t=e?.llm_provider??"",s=e?.llm_model??"";return n.jsxs("div",{className:"space-y-0.5 text-sm",children:[n.jsx(Or,{kind:"llm",label:"LLM",variant:"row",activeName:e?.active_llm_profile??null,tooltip:e?.llm_model??void 0}),t&&s&&n.jsx(Tr,{provider:t,model:s,isActive:!0,density:"compact",className:"px-1.5 pt-0.5"})]})}const zt=2,Kr=200;function Hr(e,t){const[s,r]=f.useState(e);return f.useEffect(()=>{const o=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(o)},[e,t]),s}function Qr(){const e=Y(),{query:t}=Ue(),s=q({queryKey:["db-profiles","list"],queryFn:()=>g("/api/profiles/db"),retry:!1});if(s.isLoading)return n.jsx("div",{className:"px-2 py-1 text-xs text-ink-dim",children:"Loading profiles…"});if(s.error)return n.jsx("div",{className:"px-2 py-1 text-xs text-critical",children:s.error.message});const r=s.data?.profiles??[];if(r.length===0)return n.jsx("div",{className:"px-2 py-1 text-xs text-ink-dim",children:"No DB profiles yet — add one under Settings."});if(t.length>=zt)return n.jsx(Wr,{query:t,profiles:r});const o=t?r.filter(a=>X(a.name,t)||X(a.backend??"",t)?!0:qr(e,a.name,t)):r;return o.length===0?n.jsxs("div",{className:"px-2 py-1 text-xs text-ink-dim",children:["No profiles match “",t,"”."]}):n.jsx("div",{className:"space-y-0.5",children:o.map(a=>{const i=!!t&&(X(a.name,t)||X(a.backend??"",t));return n.jsx(Yr,{profile:a,query:t,profileNameMatched:i},a.name)})})}function Wr({query:e,profiles:t}){const s=Y(),r=se(),{setQuery:o}=Ue(),a=Hr(e,Kr),i=q({queryKey:["db-cache-search",a],queryFn:()=>B.dbCacheSearch(a),enabled:a.length>=zt,retry:!1,staleTime:3e4});if(i.isLoading||a!==e)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"Searching…"});if(i.error)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-critical",children:i.error.message});const l=i.data?.results??[];if(l.length===0){const d=t.length>0;return n.jsxs("div",{className:"space-y-1 px-2 py-1 text-[11px] text-ink-dim",children:[n.jsxs("div",{children:["No matches for “",e,"”."]}),d&&n.jsxs("div",{className:"text-ink-dim",children:["Tip: column search requires"," ",n.jsx(ue,{to:"/db-cache",className:"underline hover:text-ink",children:"a synced catalog"}),"."]})]})}const c=new Map;for(const d of l){const m=c.get(d.profile);m?m.push(d):c.set(d.profile,[d])}const p=d=>!!s.getQueryData(["live-catalogs",d])?.supports_catalogs,x=d=>{const m=p(d.profile),b={profile:d.profile,database:m?void 0:d.database,catalog:m?d.database:void 0},v=d.table?pe(b,d.schema,d.table):pe(b,d.schema);o(""),r(v)};return n.jsxs("div",{className:"space-y-2",children:[Array.from(c.entries()).map(([d,m])=>n.jsxs("div",{children:[n.jsx("div",{className:"px-2 pb-0.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-ink-dim",children:d}),n.jsx("div",{className:"space-y-0.5",children:m.map((b,v)=>n.jsx(Jr,{row:b,query:e,onSelect:()=>x(b)},`${d}-${v}-${b.schema}-${b.table??""}-${b.column??""}`))})]},d)),i.data?.truncated&&n.jsxs("div",{className:"px-2 pt-1 text-[10px] italic text-ink-dim",children:["Showing first ",l.length," matches — refine your search to narrow."]})]})}function Jr({row:e,query:t,onSelect:s}){const r=e.match_field==="column"?e.column??"":e.match_field==="table"?e.table??"":e.schema;return n.jsxs("button",{type:"button",onClick:s,title:`${e.profile} · ${e.database} · ${e.schema}${e.table?" · "+e.table:""}${e.column?" · "+e.column:""}`,className:y("flex w-full min-w-0 flex-col items-start gap-0.5 rounded px-2 py-1 text-left","text-[11px] text-ink hover:bg-surface-subtle"),children:[n.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[n.jsx("span",{className:"truncate font-mono text-ink",children:n.jsx(Gr,{text:r,needle:t})}),n.jsx("span",{className:"ml-auto shrink-0 rounded bg-surface-subtle px-1 py-px text-[9px] uppercase tracking-wide text-ink-dim",children:e.match_field})]}),n.jsxs("div",{className:"w-full truncate text-[10px] text-ink-dim",children:[e.schema,e.table&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"px-0.5",children:"›"}),e.table]}),e.column&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"px-0.5",children:"›"}),e.column]})]})]})}function Gr({text:e,needle:t}){if(!t)return n.jsx(n.Fragment,{children:e});const s=e.toLowerCase(),r=t.toLowerCase(),o=s.indexOf(r);return o<0?n.jsx(n.Fragment,{children:e}):n.jsxs(n.Fragment,{children:[e.slice(0,o),n.jsx("span",{className:"font-semibold text-accent-ink",children:e.slice(o,o+t.length)}),e.slice(o+t.length)]})}function Xt({profile:e,database:t,invalidateKeys:s,title:r}){const o=Y(),a=Ne({mutationFn:()=>{const i=new URLSearchParams({profile:e});return t&&i.set("database",t),g(`/api/catalog/sync?${i.toString()}`,{method:"POST"})},onSettled:()=>{o.invalidateQueries({queryKey:["catalog-freshness"]});for(const i of s)o.invalidateQueries({queryKey:i});window.setTimeout(()=>{o.invalidateQueries({queryKey:["catalog-freshness"]});for(const i of s)o.invalidateQueries({queryKey:i})},3e3)}});return n.jsx("button",{type:"button","aria-label":r,title:r,onClick:i=>{i.stopPropagation(),a.isPending||a.mutate()},className:y("ml-1 inline-flex h-5 w-5 items-center justify-center rounded text-ink-dim","hover:bg-surface-subtle hover:text-ink",a.isPending&&"text-ink"),children:a.isPending?n.jsx(re,{size:12,className:"animate-spin"}):n.jsx(Se,{size:12})})}function Yr({profile:e,query:t,profileNameMatched:s}){const r=me(),[o,a]=f.useState(r.profile===e.name),i=o||!!t;return n.jsxs("div",{children:[n.jsxs("div",{className:"flex w-full items-center",children:[n.jsxs("button",{type:"button",onClick:()=>a(l=>!l),title:e.backend||"",className:y("flex min-w-0 flex-1 items-center gap-1 rounded px-2 py-1 text-left transition-colors duration-fast","text-[13px] font-bold uppercase tracking-wide",r.profile===e.name?"bg-accent-soft text-accent-ink":"text-ink hover:bg-surface-subtle"),children:[i?n.jsx(te,{size:14}):n.jsx(_e,{size:14}),n.jsx("span",{className:"truncate",children:e.name}),e.backend&&n.jsx("span",{className:"ml-auto text-[9px] font-normal normal-case tracking-normal text-ink-dim",children:e.backend})]}),n.jsx(Xt,{profile:e.name,title:`Refresh catalog for ${e.name}`,invalidateKeys:[["live-catalogs",e.name],["live-databases",e.name],["live-schemas",e.name]]})]}),i&&n.jsx("div",{className:"ml-3 mt-0.5 border-l border-border pl-2",children:n.jsx(Zr,{profile:e.name,query:t,parentMatched:s})})]})}function Zr({profile:e,query:t,parentMatched:s}){const r=q({queryKey:["live-catalogs",e],queryFn:()=>B.liveCatalogs({profile:e}),retry:!1}),o=q({queryKey:["live-databases",e],queryFn:()=>B.liveDatabases({profile:e}),retry:!1,enabled:r.data?!r.data.supports_catalogs:!1}),a=d=>!t||s||X(d,t);if(r.isLoading)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"Loading…"});if(r.error)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-critical",children:r.error.message});if(r.data?.supports_catalogs){const d=(r.data.active_catalog||r.data.active_project||"").trim(),m=d&&!r.data.catalogs.includes(d),v=(d&&!m?r.data.catalogs.filter(u=>u===d):r.data.catalogs).filter(a);return r.data.catalogs.length===0?n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"(no catalogs visible)"}):m?n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"px-2 py-1 text-[11px] text-warning",children:['Pinned catalog "',d,'" not visible. Edit the profile via /db to re-pin.']}),v.map(u=>n.jsx(ve,{scope:{profile:e,catalog:u,kind:"catalog"},label:u,query:t,parentMatched:s||X(u,t)},u))]}):v.length===0?n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"No catalogs match."}):n.jsx("div",{className:"space-y-0.5",children:v.map(u=>n.jsx(ve,{scope:{profile:e,catalog:u,kind:"catalog"},label:u,query:t,parentMatched:s||X(u,t)},u))})}if(o.isLoading)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"Loading databases…"});if(o.error)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-critical",children:o.error.message});const i=o.data?.databases??[],l=(o.data?.active_database||"").trim(),c=l&&!i.includes(l),p=l&&!c?i.filter(d=>d===l):i,x=p.filter(a);return c?n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"px-2 py-1 text-[11px] text-warning",children:['Pinned database "',l,'" not visible. Edit the profile via /db to re-pin.']}),x.map(d=>n.jsx(ve,{scope:{profile:e,database:d,kind:"database"},label:d,query:t,parentMatched:s||X(d,t)},d))]}):p.length===0?n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"(no databases reachable)"}):x.length===0?n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"No databases match."}):n.jsx("div",{className:"space-y-0.5",children:x.map(d=>n.jsx(ve,{scope:{profile:e,database:d,kind:"database"},label:d,query:t,parentMatched:s||X(d,t)},d))})}function ve({scope:e,label:t,query:s,parentMatched:r}){const o=me(),a=se(),i=o.profile===e.profile&&(e.database?o.database===e.database:o.catalog===e.catalog),[l,c]=f.useState(i),p=l||!!s,x=e.database??e.catalog??"";return n.jsxs("div",{children:[n.jsxs("div",{className:"flex w-full items-center",children:[n.jsxs("button",{type:"button",onClick:()=>{c(d=>!d),a(pe(e))},className:y("flex min-w-0 flex-1 items-center gap-1 rounded px-2 py-1 text-left text-[13px] transition-colors duration-fast",i?"bg-accent-soft text-accent-ink":"text-ink-muted hover:bg-surface-subtle hover:text-ink"),children:[p?n.jsx(te,{size:13}):n.jsx(_e,{size:13}),n.jsx("span",{className:"truncate",children:t})]}),x&&n.jsx(Xt,{profile:e.profile,database:x,title:`Refresh catalog for ${t}`,invalidateKeys:[["live-schemas",e.profile,e.database??"",e.catalog??""]]})]}),p&&n.jsx("div",{className:"ml-3 mt-0.5 border-l border-border pl-2",children:n.jsx(eo,{scope:e,query:s,parentMatched:r})})]})}function eo({scope:e,query:t,parentMatched:s}){const r=Y(),{data:o,error:a,isLoading:i}=q({queryKey:["live-schemas",e.profile,e.database??"",e.catalog??""],queryFn:()=>B.liveSchemas(e),retry:!1});if(i)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"Loading schemas…"});if(a instanceof fe)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-critical",children:a.message});if(a)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-critical",children:a.message});if(!o||o.schemas.length===0)return n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"(no schemas)"});const l=(o.active_schema||o.active_dataset||"").trim(),c=l&&!o.schemas.includes(l),p=l&&!c?o.schemas.filter(d=>d===l):o.schemas,x=t?p.filter(d=>s||X(d,t)||Br(r,e,d,t)):p;return x.length===0?n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:"No schemas match."}):n.jsxs("div",{className:"space-y-0.5",children:[c&&n.jsxs("div",{className:"px-2 py-1 text-[11px] text-warning",children:['Pinned schema "',l,'" not visible. Edit the profile via /db to re-pin.']}),x.map(d=>n.jsx(to,{scope:e,schema:d,query:t,parentMatched:s||X(d,t)},d))]})}function to({scope:e,schema:t,query:s,parentMatched:r}){const o=me(),a=se(),i=o.profile===e.profile&&(e.database?o.database===e.database:o.catalog===e.catalog)&&o.schema===t,[l,c]=f.useState(i),p=l||!!s,x=["live-assets",e.profile,e.database??"",e.catalog??"",t],{data:d}=q({queryKey:x,queryFn:()=>B.liveAssets(e,t),enabled:p}),m=Y(),b=Ne({mutationFn:()=>B.refreshSchemaMetadata(e,t),onSuccess:u=>{m.setQueryData(x,u)}}),v=d?.assets&&s&&!r?d.assets.filter(u=>X(u.name,s)):d?.assets;return n.jsxs("div",{className:"group/row",children:[n.jsxs("div",{className:"flex w-full items-center",children:[n.jsxs("button",{type:"button",onClick:()=>{c(u=>!u),a(pe(e,t))},className:y("flex min-w-0 flex-1 items-center gap-1 rounded px-2 py-1 text-left text-[12px] transition-colors duration-fast",i?"bg-accent-soft text-accent-ink":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),children:[p?n.jsx(te,{size:12}):n.jsx(_e,{size:12}),n.jsx("span",{className:"truncate",children:t})]}),n.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),b.mutate()},disabled:b.isPending,"aria-label":`Refresh ${t}`,title:"Refresh column descriptions for this schema",className:y("ml-1 shrink-0 rounded p-1 text-ink-dim transition-opacity",b.isPending?"opacity-100":"opacity-0 group-hover/row:opacity-100","hover:bg-surface-subtle hover:text-ink"),children:b.isPending?n.jsx(re,{size:11,className:"animate-spin"}):n.jsx(Se,{size:11})})]}),p&&n.jsx("div",{className:"ml-3 border-l border-border pl-2",children:v?.length?v.map(u=>n.jsx("button",{type:"button",onClick:()=>a(pe(e,t,u.name)),className:y("block w-full truncate rounded px-2 py-0.5 text-left text-[11px] transition-colors duration-fast",o.table===u.name&&o.schema===t&&o.profile===e.profile?"bg-accent-soft text-accent-ink":"text-ink-dim hover:bg-surface-subtle hover:text-ink"),title:u.kind,children:u.name},`${t}.${u.name}`)):n.jsx("div",{className:"px-2 py-1 text-[11px] text-ink-dim",children:d?s&&!r?"No tables match.":"(empty)":"Loading…"})})]})}function no(){return n.jsx("footer",{className:"border-t border-border pt-3 pb-2 text-xs text-ink-dim",children:n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Mt,{size:11}),n.jsx("span",{children:"Agentic Metadata Extractor — open source under Apache 2.0."})]}),n.jsxs("a",{href:"https://amxcli.com",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded text-ink-muted transition-colors duration-fast hover:text-accent",children:["amxcli.com",n.jsx(xt,{size:11,"aria-hidden":"true"})]})]})})}function so(){const e=ne(r=>r.mobileSidebarOpen),t=ne(r=>r.setMobileSidebarOpen),s=he();return f.useEffect(()=>{if(!e)return;function r(o){o.key==="Escape"&&t(!1)}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t]),f.useEffect(()=>{if(!e)return;const r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=r}},[e]),f.useEffect(()=>{e&&t(!1)},[s.pathname]),e?n.jsxs(n.Fragment,{children:[n.jsx("div",{"aria-hidden":!0,onClick:()=>t(!1),className:"fixed inset-0 z-40 bg-ink/30 sm:hidden"}),n.jsxs("aside",{role:"dialog","aria-label":"Navigation drawer",className:y("fixed left-0 top-0 z-50 flex h-full w-72 max-w-[85vw] flex-col border-r border-border bg-surface shadow-xl sm:hidden"),children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-ink-dim",children:"Browse"}),n.jsx("button",{type:"button",onClick:()=>t(!1),"aria-label":"Close navigation drawer",className:"rounded p-1 text-ink-muted hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:16})})]}),n.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:n.jsx(Ot,{collapsed:!1})})]})]}):null}function ro(e){return Object.values(e).some(t=>t==="running")}function oo(e){return Object.keys(e).length===0?!1:Object.values(e).every(t=>t==="done")}function ao(){const[e,t]=f.useState(!1),[s,r]=f.useState(null),a=q({queryKey:["history-status"],queryFn:()=>g("/api/history/status"),refetchInterval:1e4,retry:!1,meta:{silentError:!0}}).data,i=a?.backfill??{},l=ro(i),c=oo(i);return f.useEffect(()=>{c&&s===null&&r(Date.now())},[c,s]),e||!a?.enabled||!l&&!c||c&&s!==null&&Date.now()-s>4e3?null:n.jsxs("div",{className:`flex items-center gap-3 border-b border-accent/30 bg-accent-soft/20 px-4 py-2 text-sm transition-opacity duration-700 ${c?"opacity-0":"opacity-100"}`,role:"status","aria-live":"polite",children:[l?n.jsx(re,{size:14,className:"shrink-0 animate-spin text-accent"}):n.jsx("span",{className:"h-3 w-3 shrink-0 rounded-full bg-positive"}),n.jsx("span",{className:"flex-1 text-ink-muted",children:l?"Migrating your local lineage and pages to the team workspace…":"Migration to team workspace complete."}),!l&&n.jsx("button",{type:"button",onClick:()=>t(!0),"aria-label":"Dismiss",className:"rounded p-1 text-ink-dim hover:bg-surface-subtle hover:text-ink",children:n.jsx(J,{size:13})})]})}function io(){const e=ne(t=>t.sidebarCollapsed);return n.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-bg text-ink",children:[n.jsx(Lr,{}),n.jsx(ao,{}),n.jsxs("div",{className:"flex flex-1 min-h-0",children:[n.jsx("aside",{className:y("hidden sm:block min-h-0 overflow-hidden border-r border-border bg-surface-subtle/50 transition-all duration-fast",e?"w-12":"w-64"),children:n.jsx(Ot,{collapsed:e})}),n.jsx(so,{}),n.jsxs("div",{className:"flex flex-1 min-w-0 flex-col",children:[n.jsx("main",{className:"flex-1 min-h-0 overflow-y-auto",children:n.jsx("div",{className:"mx-auto w-full max-w-[1280px] px-4 py-4 sm:px-6 sm:py-6 md:px-8 md:py-7",children:n.jsx(Ht,{})})}),n.jsx("div",{className:"mx-auto w-full max-w-[1280px] px-4 sm:px-6 md:px-8",children:n.jsx(no,{})})]})]})]})}class lo extends f.Component{constructor(){super(...arguments);K(this,"state",{error:null,errorInfo:null});K(this,"handleTryAgain",()=>{this.setState({error:null,errorInfo:null})});K(this,"handleReload",()=>{window.location.reload()});K(this,"handleCopyDetails",async()=>{const{error:s,errorInfo:r}=this.state;if(!s)return;const o=["AMX Studio crash report",`Time: ${new Date().toISOString()}`,`URL: ${window.location.href}`,`User-Agent: ${navigator.userAgent}`,"",`Error: ${s.name}: ${s.message}`,s.stack??"(no stack)","","Component stack:",r?.componentStack??"(none)"].join(`
`);try{await navigator.clipboard.writeText(o)}catch{}})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error("[amx-studio] crashed:",s,r),this.setState({errorInfo:r})}componentDidUpdate(s){this.state.error&&s.resetKey!==this.props.resetKey&&this.setState({error:null,errorInfo:null})}render(){const{error:s}=this.state;return s?n.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem",background:"#0f0f0e",color:"#f5f4f2",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:n.jsxs("div",{style:{maxWidth:"44rem",padding:"2rem 2.5rem",borderRadius:"14px",background:"#1a1918",border:"1px solid rgba(245,244,242,0.08)",boxShadow:"0 12px 32px rgba(0,0,0,0.35)"},children:[n.jsx("h1",{style:{marginTop:0,fontSize:"1.4rem",letterSpacing:"-0.01em"},children:"AMX Studio hit an unexpected error"}),n.jsx("p",{style:{opacity:.85,lineHeight:1.55},children:"The page above this message stopped rendering. Your data on the server is unaffected — the run history, pending review queue, and applied descriptions are stored independently of this UI."}),n.jsxs("pre",{style:{background:"rgba(255,255,255,0.04)",padding:"0.75rem 1rem",borderRadius:"8px",overflow:"auto",maxHeight:"12rem",fontSize:"0.85rem",lineHeight:1.5,margin:"1rem 0"},children:[s.name,": ",s.message]}),n.jsxs("div",{style:{display:"flex",gap:"0.75rem",flexWrap:"wrap"},children:[n.jsx("button",{type:"button",onClick:this.handleTryAgain,style:{background:"#f5f4f2",color:"#0f0f0e",border:"none",padding:"0.55rem 1rem",borderRadius:"8px",fontWeight:600,cursor:"pointer"},children:"Try again"}),n.jsx("button",{type:"button",onClick:this.handleReload,style:{background:"transparent",color:"#f5f4f2",border:"1px solid rgba(245,244,242,0.25)",padding:"0.55rem 1rem",borderRadius:"8px",fontWeight:600,cursor:"pointer"},children:"Reload page"}),n.jsx("button",{type:"button",onClick:this.handleCopyDetails,style:{background:"transparent",color:"#f5f4f2",border:"1px solid rgba(245,244,242,0.25)",padding:"0.55rem 1rem",borderRadius:"8px",fontWeight:600,cursor:"pointer"},children:"Copy details to clipboard"})]})]})}):this.props.children}}const co=["job.done","job.cancelled","job.failed"],st=5e3,rt=5,ot=[1e3,2e3,4e3,8e3,16e3,3e4],uo=["activity.added","activity.begin","activity.complete","activity.fail","writeback.progress","thinking.delta","thinking.stop","tool.call","tool.started","tool.result","answer.delta","answer.final","llm.round.started","llm.round.heartbeat","llm.round.finished","tokens","tokens.snapshot","step.added","step.begin","step.update","step.complete","step.fail","step.detail","step.thinking","step.thinking_done","tokens.delta","pip.install.begin","pip.install.progress","pip.install.done","pip.install.failed"];function po({path:e,enabled:t=!0,terminalTypes:s=co}){const[r,o]=f.useState([]),[a,i]=f.useState(!1),[l,c]=f.useState(null),[p,x]=f.useState(0),[d,m]=f.useState(!1),[b,v]=f.useState(0),u=f.useRef(null),h=f.useCallback(()=>{v(w=>w+1)},[]);return f.useEffect(()=>{if(!t)return;o([]),i(!1),c(null),x(0),m(!1);const w=ir(),C=e.includes("?")?"&":"?",L=w?`${e}${C}${w}`:e;let N=!1,M=0,O=null;const D=I=>{if(!N)try{const T=JSON.parse(I.data);M=0,x(0),c(null),o(z=>z.length>=st?[...z.slice(z.length-st+1),T]:[...z,T]),s.includes(T.type)&&(N=!0,O!==null&&(clearTimeout(O),O=null),u.current&&(u.current.close(),u.current=null),i(!0))}catch{}},V=()=>{if(N)return;const I=new EventSource(L);u.current=I,I.onmessage=D,[...s,...uo].forEach(T=>{I.addEventListener(T,D)}),I.onerror=()=>{if(N)return;try{I.close()}catch{}if(u.current===I&&(u.current=null),M>=rt){c("Connection lost. Click Reconnect to retry."),m(!0),N=!0;return}const T=ot[Math.min(M,ot.length-1)];M+=1,x(M),c(`Connection lost. Reconnecting (attempt ${M}/${rt})…`),O=setTimeout(V,T)}};return V(),()=>{N=!0,O!==null&&(clearTimeout(O),O=null),u.current&&(u.current.close(),u.current=null)}},[t,e,s,b]),{events:r,closed:a,error:l,retryAttempt:p,exhausted:d,reconnect:h}}const fo={collecting:"Resolving",downloading:"Downloading",installing:"Installing",installed:"Finalizing",tail:"Working"},mo=[];function ho(e){if(e<1e3)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const s=Math.floor(t/60),r=t%60;return`${s}m ${r}s`}function xo(e,t){const s=String(t.install_id??"");if(!s)return e;const r=new Map(e),o=r.get(s);switch(t.type){case"pip.install.begin":{r.set(s,{installId:s,feature:String(t.feature??"extras"),packages:Array.isArray(t.packages)?t.packages:[],phase:"starting",detail:"",startedAt:Date.now(),status:"running"});break}case"pip.install.progress":{if(!o)break;const a=String(t.phase??o.phase);let i=o.detail;a==="collecting"?i=String(t.package??""):a==="downloading"?(i=String(t.artifact??""),t.size&&(i+=` (${t.size})`)):a==="installing"?i=String(t.packages??""):a==="installed"&&(i=String(t.installed??"")),r.set(s,{...o,phase:a,detail:i});break}case"pip.install.done":{if(!o)break;r.set(s,{...o,status:"done",phase:"done",detail:"",closingAt:Date.now()+2e3});break}case"pip.install.failed":{if(!o)break;r.set(s,{...o,status:"failed",phase:"failed",detail:`pip exited ${t.returncode??"?"}`,tail:Array.isArray(t.tail)?t.tail:void 0,closingAt:Date.now()+1e4});break}}return r}function bo(){const{events:e}=po({path:"/api/installs/events",terminalTypes:mo}),[t,s]=f.useState(new Map),[,r]=f.useState(0);return f.useEffect(()=>{s(o=>{let a=o;for(const i of e)a=xo(a,i);return a})},[e]),f.useEffect(()=>{if(t.size===0)return;const o=setInterval(()=>{const a=Date.now();let i=!1;const l=new Map(t);for(const[c,p]of t)p.closingAt&&a>=p.closingAt&&(l.delete(c),i=!0);i?s(l):r(c=>c+1)},500);return()=>clearInterval(o)},[t]),t.size===0?null:n.jsx("div",{className:"fixed right-4 top-4 z-40 flex w-80 flex-col gap-2",role:"status","aria-live":"polite",children:Array.from(t.values()).map(o=>n.jsx(go,{state:o},o.installId))})}function go({state:e}){const t=ho(Date.now()-e.startedAt),s=e.status==="running",r=e.status==="done",o=e.status==="failed";return n.jsx("div",{className:y("rounded-md border bg-surface-raised shadow-md transition-all",s&&"border-accent/40",r&&"border-positive/40",o&&"border-critical/40"),children:n.jsxs("div",{className:"flex items-start gap-2 p-3",children:[n.jsxs("div",{className:"mt-0.5 shrink-0",children:[s&&n.jsx(re,{size:16,className:"animate-spin text-accent"}),r&&n.jsx(_n,{size:16,className:"text-positive"}),o&&n.jsx(mt,{size:16,className:"text-critical"})]}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"truncate text-xs font-medium text-ink",children:[s&&`Installing libraries for ${e.feature}`,r&&`Installed libraries for ${e.feature}`,o&&`Install failed for ${e.feature}`]}),n.jsx("div",{className:"shrink-0 text-[10px] tabular-nums text-muted",children:t})]}),s&&(e.detail||e.phase)&&n.jsxs("div",{className:"mt-1 truncate text-[11px] text-muted",children:[fo[e.phase]??e.phase,e.detail?` · ${e.detail}`:""]}),o&&e.tail&&e.tail.length>0&&n.jsx("pre",{className:"mt-2 max-h-32 overflow-auto rounded bg-surface-subtle p-2 text-[10px] text-muted",children:e.tail.slice(-6).join(`
`)})]})]})})}const Ie=new Set;function yo(e){return Ie.add(e),()=>{Ie.delete(e)}}function at(e){for(const t of Ie)try{t(e)}catch(s){console.error("[amx] query error listener threw:",s)}}function vo(e){return e instanceof fe?{title:`Request failed (${e.status})`,description:e.detail||e.message,hint:e.hint}:e instanceof Error?{title:"Request failed",description:e.message}:{title:"Request failed",description:String(e)}}function wo(){const e=Lt();return f.useEffect(()=>yo(t=>{const{title:s,description:r,hint:o}=vo(t.error);e.push({tone:"error",title:s,description:o?`${r} — ${o}`:r,duration:6e3})}),[e]),null}const ko=f.lazy(()=>P(()=>import("./Landing-CsdlurXX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),jo=f.lazy(()=>P(()=>import("./Home--n7AkS7C.js"),__vite__mapDeps([8,1,2,9,10,11,3,4,5,6,12]))),it=f.lazy(()=>P(()=>import("./Profile-CXRCfHrk.js"),__vite__mapDeps([13,1,2,9,10,11]))),lt=f.lazy(()=>P(()=>import("./Database-giqCaFVU.js"),__vite__mapDeps([14,1,2,9,10,11,15,16,17,18]))),ct=f.lazy(()=>P(()=>import("./Schema-A2mHW0Pi.js"),__vite__mapDeps([19,1,2,9,10,11,15,16,3,4,17,18,20]))),dt=f.lazy(()=>P(()=>import("./Table-CkawCKG5.js"),__vite__mapDeps([21,1,2,9,10,11,15,16,22,3,4,17,18]))),No=f.lazy(()=>P(()=>import("./RunsList-CKHZaZ8_.js"),__vite__mapDeps([23,1,2,9,11,4,24,5,25,26,27,7,6]))),_o=f.lazy(()=>P(()=>import("./RunDetail-C6Y9W2PC.js"),__vite__mapDeps([28,1,2,9,10,29,3,4,30,31,24,17,18,32,11,33,25,6]))),So=f.lazy(()=>P(()=>import("./RunNew-CWnWDKMQ.js"),__vite__mapDeps([34,1,2,9,10,31,35,6]))),Co=f.lazy(()=>P(()=>import("./RunsCompare-BSkbqsES.js"),__vite__mapDeps([36,1,2,9,10,11,3,4,32,33,30,5,27,37]))),Eo=f.lazy(()=>P(()=>import("./Ask-DVY5dmPf.js"),__vite__mapDeps([38,1,2,9,10,24]))),$o=f.lazy(()=>P(()=>import("./Pending-GowaWGfG.js"),__vite__mapDeps([39,1,9,2,11,29,3,4,10,24,40]))),Ro=f.lazy(()=>P(()=>import("./Settings-D3jfE-7N.js"),__vite__mapDeps([41,1,2,9,10,3,4,11,22,29,24,32,33,42,43,40,44,18]))),Mo=f.lazy(()=>P(()=>import("./System-C6wTq28x.js"),__vite__mapDeps([45,1,9,2,10,3,4,11]))),Po=f.lazy(()=>P(()=>import("./Audit-N-baEPlR.js"),__vite__mapDeps([46,1,9,2,10,11,4]))),Ao=f.lazy(()=>P(()=>import("./Schedules-BAvDBbUn.js"),__vite__mapDeps([47,1,9,2,42,4,35,18,25,6,37,48]))),Lo=f.lazy(()=>P(()=>import("./Pricing-DURaBMzf.js"),__vite__mapDeps([49,1,10,9,2,3,4]))),Io=f.lazy(()=>P(()=>import("./DbCache-BhXiqdpy.js"),__vite__mapDeps([50,1,10,9,2,22,4,42,35,18,25,6,26,48]))),we=f.lazy(()=>P(()=>import("./Lineage-BZdUbmzF.js"),__vite__mapDeps([51,1,2,9,22,52,24,20,37,53,12,16,54]))),To=f.lazy(()=>P(()=>import("./LineageRedirect-Be2tW-vE.js"),__vite__mapDeps([55,1,2]))),Oo=f.lazy(()=>P(()=>import("./Pages-CLO10elY.js"),__vite__mapDeps([56,1,9,2,11,43,4,57]))),zo=f.lazy(()=>P(()=>import("./PageNew-BG9o7gYR.js"),__vite__mapDeps([58,1,9,2,59,57,53,42]))),Xo=f.lazy(()=>P(()=>import("./PageEdit-CxXSht5s.js"),__vite__mapDeps([60,1,52,44,20,40,16,2,37,59,57,53,33,4]))),Do=()=>n.jsx("div",{"aria-hidden":"true"});function Uo(){const e=he();return n.jsx(lo,{resetKey:e.pathname,children:n.jsxs(Cr,{children:[n.jsx(wo,{}),n.jsx(bo,{}),n.jsx(f.Suspense,{fallback:n.jsx(Do,{}),children:n.jsx(Qt,{children:n.jsxs(_,{element:n.jsx(io,{}),children:[n.jsx(_,{index:!0,element:n.jsx(ko,{})}),n.jsx(_,{path:"overview",element:n.jsx(jo,{})}),n.jsx(_,{path:"db",element:n.jsx(ie,{to:"/",replace:!0})}),n.jsx(_,{path:"db/:profile",element:n.jsx(it,{})}),n.jsx(_,{path:"db/:profile/:database",element:n.jsx(lt,{})}),n.jsx(_,{path:"db/:profile/:database/:schema",element:n.jsx(ct,{})}),n.jsx(_,{path:"db/:profile/:database/:schema/:table",element:n.jsx(dt,{})}),n.jsx(_,{path:"cat",element:n.jsx(ie,{to:"/",replace:!0})}),n.jsx(_,{path:"cat/:profile",element:n.jsx(it,{})}),n.jsx(_,{path:"cat/:profile/:catalog",element:n.jsx(lt,{})}),n.jsx(_,{path:"cat/:profile/:catalog/:schema",element:n.jsx(ct,{})}),n.jsx(_,{path:"cat/:profile/:catalog/:schema/:table",element:n.jsx(dt,{})}),n.jsx(_,{path:"runs",element:n.jsx(No,{})}),n.jsx(_,{path:"runs/new",element:n.jsx(So,{})}),n.jsx(_,{path:"runs/compare",element:n.jsx(Co,{})}),n.jsx(_,{path:"runs/:runId",element:n.jsx(_o,{})}),n.jsx(_,{path:"ask",element:n.jsx(Eo,{})}),n.jsx(_,{path:"pending",element:n.jsx($o,{})}),n.jsx(_,{path:"audit",element:n.jsx(Po,{})}),n.jsx(_,{path:"settings",element:n.jsx(Ro,{})}),n.jsx(_,{path:"system",element:n.jsx(Mo,{})}),n.jsx(_,{path:"pricing",element:n.jsx(Lo,{})}),n.jsx(_,{path:"db-cache",element:n.jsx(Io,{})}),n.jsx(_,{path:"lineage",element:n.jsx(we,{})}),n.jsx(_,{path:"lineage/saved",element:n.jsx(we,{})}),n.jsx(_,{path:"lineage/new",element:n.jsx(we,{})}),n.jsx(_,{path:"lineage/share",element:n.jsx(we,{})}),n.jsx(_,{path:"lineage/:profile/:anchor",element:n.jsx(To,{})}),n.jsx(_,{path:"pages",element:n.jsx(Oo,{})}),n.jsx(_,{path:"pages/new",element:n.jsx(zo,{})}),n.jsx(_,{path:"pages/:pageId",element:n.jsx(Xo,{})}),n.jsx(_,{path:"runs/schedules",element:n.jsx(Ao,{})}),n.jsx(_,{path:"runs/catalog-refresh-schedules",element:n.jsx(ie,{to:"/db-cache",replace:!0})}),n.jsx(_,{path:"workspace-admin",element:n.jsx(ie,{to:"/settings?tab=team",replace:!0})}),n.jsx(_,{path:"*",element:n.jsx(ie,{to:"/",replace:!0})})]})})})]})})}or();(()=>{const e=cr();e&&(window.location.pathname!=="/"||window.location.search||window.history.replaceState({},document.title,e))})();(()=>{const e=new URLSearchParams(window.location.search);if(e.has("__amx_reload")){e.delete("__amx_reload"),sessionStorage.removeItem("amx-stale-reload-fired");const t=e.toString(),s=window.location.pathname+(t?`?${t}`:"")+window.location.hash;window.history.replaceState({},document.title,s)}})();function Dt(e){const t="amx-stale-reload-fired";if(sessionStorage.getItem(t))return;sessionStorage.setItem(t,"1"),console.warn("[amx] stale bundle detected (%s); reloading once",e);const s=new URL(window.location.href);s.searchParams.set("__amx_reload",String(Date.now())),window.location.replace(s.toString())}window.addEventListener("vite:preloadError",e=>{e.preventDefault(),Dt("vite:preloadError")});window.addEventListener("unhandledrejection",e=>{const t=String(e.reason?.message??e.reason??"");(t.includes("Failed to fetch dynamically imported module")||t.includes("error loading dynamically imported module"))&&(e.preventDefault(),Dt("dynamic import rejection"))});const Fo=new qt({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}},queryCache:new Vt({onError:(e,t)=>{t.meta?.silentError||at({error:e,source:"query",scope:Array.isArray(t.queryKey)?t.queryKey.map(s=>String(s)).join(":"):String(t.queryKey)})}}),mutationCache:new Bt({onError:(e,t,s,r)=>{r.meta?.silentError||at({error:e,source:"mutation"})}})});Re.createRoot(document.getElementById("root")).render(n.jsx(de.StrictMode,{children:n.jsx(Kt,{client:Fo,children:n.jsx(Wt,{children:n.jsx(Uo,{})})})}));"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.warn("[amx] service worker registration failed:",e)})});export{_n as $,cn as A,ta as B,ft as C,ht as D,Ko as E,An as F,oa as G,On as H,Er as I,Zn as J,aa as K,Mt as L,te as M,_e as N,Or as O,Hn as P,fe as Q,Se as R,ts as S,sa as T,Wn as U,jr as V,is as W,J as X,ss as Y,ra as Z,na as _,B as a,os as a0,jn as a1,mt as a2,Tr as a3,Ee as a4,xt as a5,qn as a6,bs as a7,Zo as a8,ea as a9,bt as aa,Go as ab,Wo as ac,Yo as ad,g as b,y as c,S as d,hr as e,rn as f,Dn as g,In as h,Qo as i,Lt as j,Mn as k,Jo as l,mr as m,Xe as n,xr as o,re as p,gt as q,po as r,pe as s,ia as t,ne as u,la as v,ca as w,da as x,Ho as y,Js as z};
