lens-engine 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js
CHANGED
|
@@ -4368,7 +4368,7 @@ async function logoutCommand() {
|
|
|
4368
4368
|
}
|
|
4369
4369
|
|
|
4370
4370
|
// packages/cli/src/index.ts
|
|
4371
|
-
var program2 = new Command().name("lens").description("LENS \u2014 Local-first repo context engine").version("0.1.
|
|
4371
|
+
var program2 = new Command().name("lens").description("LENS \u2014 Local-first repo context engine").version("0.1.9");
|
|
4372
4372
|
function trackCommand(name) {
|
|
4373
4373
|
if (!isTelemetryEnabled()) return;
|
|
4374
4374
|
const BASE_URL2 = process.env.LENS_HOST ?? "http://127.0.0.1:4111";
|
package/daemon.js
CHANGED
|
@@ -35248,6 +35248,10 @@ function createApp(db, dashboardDist, initialCaps, initialPlanData) {
|
|
|
35248
35248
|
quota: data.quota ?? {},
|
|
35249
35249
|
fetchedAt: Date.now()
|
|
35250
35250
|
};
|
|
35251
|
+
if (caps && data.plan !== "pro") {
|
|
35252
|
+
caps = void 0;
|
|
35253
|
+
console.error("[LENS] Cloud capabilities disabled (plan changed to free)");
|
|
35254
|
+
}
|
|
35251
35255
|
if (!caps && data.plan === "pro") {
|
|
35252
35256
|
const apiKey = await readApiKey();
|
|
35253
35257
|
if (apiKey) {
|
|
@@ -227,6 +227,6 @@ Error generating stack: `+l.message+`
|
|
|
227
227
|
*
|
|
228
228
|
* This source code is licensed under the ISC license.
|
|
229
229
|
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const o_=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],c_=Be("trash-2",o_);function Gb(a){var s,i,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(s=0;s<u;s++)a[s]&&(i=Gb(a[s]))&&(r&&(r+=" "),r+=i)}else for(i in a)a[i]&&(r&&(r+=" "),r+=i);return r}function Vb(){for(var a,s,i=0,r="",u=arguments.length;i<u;i++)(a=arguments[i])&&(s=Gb(a))&&(r&&(r+=" "),r+=s);return r}const u_=(a,s)=>{const i=new Array(a.length+s.length);for(let r=0;r<a.length;r++)i[r]=a[r];for(let r=0;r<s.length;r++)i[a.length+r]=s[r];return i},f_=(a,s)=>({classGroupId:a,validator:s}),Yb=(a=new Map,s=null,i)=>({nextPart:a,validators:s,classGroupId:i}),lc="-",My=[],d_="arbitrary..",h_=a=>{const s=p_(a),{conflictingClassGroups:i,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return m_(m);const p=m.split(lc),g=p[0]===""&&p.length>1?1:0;return Kb(p,g,s)},getConflictingClassGroupIds:(m,p)=>{if(p){const g=r[m],y=i[m];return g?y?u_(y,g):g:y||My}return i[m]||My}}},Kb=(a,s,i)=>{if(a.length-s===0)return i.classGroupId;const u=a[s],f=i.nextPart.get(u);if(f){const y=Kb(a,s+1,f);if(y)return y}const m=i.validators;if(m===null)return;const p=s===0?a.join(lc):a.slice(s).join(lc),g=m.length;for(let y=0;y<g;y++){const v=m[y];if(v.validator(p))return v.classGroupId}},m_=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=a.slice(1,-1),i=s.indexOf(":"),r=s.slice(0,i);return r?d_+r:void 0})(),p_=a=>{const{theme:s,classGroups:i}=a;return g_(i,s)},g_=(a,s)=>{const i=Yb();for(const r in a){const u=a[r];Dd(u,i,r,s)}return i},Dd=(a,s,i,r)=>{const u=a.length;for(let f=0;f<u;f++){const m=a[f];y_(m,s,i,r)}},y_=(a,s,i,r)=>{if(typeof a=="string"){b_(a,s,i);return}if(typeof a=="function"){v_(a,s,i,r);return}x_(a,s,i,r)},b_=(a,s,i)=>{const r=a===""?s:Xb(s,a);r.classGroupId=i},v_=(a,s,i,r)=>{if(S_(a)){Dd(a(r),s,i,r);return}s.validators===null&&(s.validators=[]),s.validators.push(f_(i,a))},x_=(a,s,i,r)=>{const u=Object.entries(a),f=u.length;for(let m=0;m<f;m++){const[p,g]=u[m];Dd(g,Xb(s,p),i,r)}},Xb=(a,s)=>{let i=a;const r=s.split(lc),u=r.length;for(let f=0;f<u;f++){const m=r[f];let p=i.nextPart.get(m);p||(p=Yb(),i.nextPart.set(m,p)),i=p}return i},S_=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,__=a=>{if(a<1)return{get:()=>{},set:()=>{}};let s=0,i=Object.create(null),r=Object.create(null);const u=(f,m)=>{i[f]=m,s++,s>a&&(s=0,r=i,i=Object.create(null))};return{get(f){let m=i[f];if(m!==void 0)return m;if((m=r[f])!==void 0)return u(f,m),m},set(f,m){f in i?i[f]=m:u(f,m)}}},gd="!",Ay=":",j_=[],Oy=(a,s,i,r,u)=>({modifiers:a,hasImportantModifier:s,baseClassName:i,maybePostfixModifierPosition:r,isExternal:u}),N_=a=>{const{prefix:s,experimentalParseClassName:i}=a;let r=u=>{const f=[];let m=0,p=0,g=0,y;const v=u.length;for(let N=0;N<v;N++){const M=u[N];if(m===0&&p===0){if(M===Ay){f.push(u.slice(g,N)),g=N+1;continue}if(M==="/"){y=N;continue}}M==="["?m++:M==="]"?m--:M==="("?p++:M===")"&&p--}const b=f.length===0?u:u.slice(g);let S=b,_=!1;b.endsWith(gd)?(S=b.slice(0,-1),_=!0):b.startsWith(gd)&&(S=b.slice(1),_=!0);const j=y&&y>g?y-g:void 0;return Oy(f,_,S,j)};if(s){const u=s+Ay,f=r;r=m=>m.startsWith(u)?f(m.slice(u.length)):Oy(j_,!1,m,void 0,!0)}if(i){const u=r;r=f=>i({className:f,parseClassName:u})}return r},R_=a=>{const s=new Map;return a.orderSensitiveModifiers.forEach((i,r)=>{s.set(i,1e6+r)}),i=>{const r=[];let u=[];for(let f=0;f<i.length;f++){const m=i[f],p=m[0]==="[",g=s.has(m);p||g?(u.length>0&&(u.sort(),r.push(...u),u=[]),r.push(m)):u.push(m)}return u.length>0&&(u.sort(),r.push(...u)),r}},w_=a=>({cache:__(a.cacheSize),parseClassName:N_(a),sortModifiers:R_(a),...h_(a)}),C_=/\s+/,E_=(a,s)=>{const{parseClassName:i,getClassGroupId:r,getConflictingClassGroupIds:u,sortModifiers:f}=s,m=[],p=a.trim().split(C_);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:b,modifiers:S,hasImportantModifier:_,baseClassName:j,maybePostfixModifierPosition:N}=i(v);if(b){g=v+(g.length>0?" "+g:g);continue}let M=!!N,z=r(M?j.substring(0,N):j);if(!z){if(!M){g=v+(g.length>0?" "+g:g);continue}if(z=r(j),!z){g=v+(g.length>0?" "+g:g);continue}M=!1}const B=S.length===0?"":S.length===1?S[0]:f(S).join(":"),P=_?B+gd:B,T=P+z;if(m.indexOf(T)>-1)continue;m.push(T);const J=u(z,M);for(let te=0;te<J.length;++te){const V=J[te];m.push(P+V)}g=v+(g.length>0?" "+g:g)}return g},T_=(...a)=>{let s=0,i,r,u="";for(;s<a.length;)(i=a[s++])&&(r=Pb(i))&&(u&&(u+=" "),u+=r);return u},Pb=a=>{if(typeof a=="string")return a;let s,i="";for(let r=0;r<a.length;r++)a[r]&&(s=Pb(a[r]))&&(i&&(i+=" "),i+=s);return i},M_=(a,...s)=>{let i,r,u,f;const m=g=>{const y=s.reduce((v,b)=>b(v),a());return i=w_(y),r=i.cache.get,u=i.cache.set,f=p,p(g)},p=g=>{const y=r(g);if(y)return y;const v=E_(g,i);return u(g,v),v};return f=m,(...g)=>f(T_(...g))},A_=[],it=a=>{const s=i=>i[a]||A_;return s.isThemeGetter=!0,s},Zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,O_=/^\d+\/\d+$/,z_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,D_=/\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$/,L_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,k_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,U_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,js=a=>O_.test(a),je=a=>!!a&&!Number.isNaN(Number(a)),Aa=a=>!!a&&Number.isInteger(Number(a)),Zf=a=>a.endsWith("%")&&je(a.slice(0,-1)),Xn=a=>z_.test(a),B_=()=>!0,q_=a=>D_.test(a)&&!L_.test(a),Jb=()=>!1,H_=a=>k_.test(a),Q_=a=>U_.test(a),G_=a=>!le(a)&&!se(a),V_=a=>Ks(a,Ib,Jb),le=a=>Zb.test(a),pl=a=>Ks(a,ev,q_),Ff=a=>Ks(a,Z_,je),zy=a=>Ks(a,$b,Jb),Y_=a=>Ks(a,Wb,Q_),Bo=a=>Ks(a,tv,H_),se=a=>Fb.test(a),Fi=a=>Xs(a,ev),K_=a=>Xs(a,F_),Dy=a=>Xs(a,$b),X_=a=>Xs(a,Ib),P_=a=>Xs(a,Wb),qo=a=>Xs(a,tv,!0),Ks=(a,s,i)=>{const r=Zb.exec(a);return r?r[1]?s(r[1]):i(r[2]):!1},Xs=(a,s,i=!1)=>{const r=Fb.exec(a);return r?r[1]?s(r[1]):i:!1},$b=a=>a==="position"||a==="percentage",Wb=a=>a==="image"||a==="url",Ib=a=>a==="length"||a==="size"||a==="bg-size",ev=a=>a==="length",Z_=a=>a==="number",F_=a=>a==="family-name",tv=a=>a==="shadow",J_=()=>{const a=it("color"),s=it("font"),i=it("text"),r=it("font-weight"),u=it("tracking"),f=it("leading"),m=it("breakpoint"),p=it("container"),g=it("spacing"),y=it("radius"),v=it("shadow"),b=it("inset-shadow"),S=it("text-shadow"),_=it("drop-shadow"),j=it("blur"),N=it("perspective"),M=it("aspect"),z=it("ease"),B=it("animate"),P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],J=()=>[...T(),se,le],te=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],H=()=>[se,le,g],W=()=>[js,"full","auto",...H()],G=()=>[Aa,"none","subgrid",se,le],I=()=>["auto",{span:["full",Aa,se,le]},Aa,se,le],oe=()=>[Aa,"auto",se,le],pe=()=>["auto","min","max","fr",se,le],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...H()],F=()=>[js,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],Y=()=>[a,se,le],me=()=>[...T(),Dy,zy,{position:[se,le]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],C=()=>["auto","cover","contain",X_,V_,{size:[se,le]}],X=()=>[Zf,Fi,pl],$=()=>["","none","full",y,se,le],ee=()=>["",je,Fi,pl],he=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[je,Zf,Dy,zy],Ze=()=>["","none",j,se,le],ze=()=>["none",je,se,le],_t=()=>["none",je,se,le],kt=()=>[je,se,le],dn=()=>[js,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xn],breakpoint:[Xn],color:[B_],container:[Xn],"drop-shadow":[Xn],ease:["in","out","in-out"],font:[G_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xn],shadow:[Xn],spacing:["px",je],text:[Xn],"text-shadow":[Xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",js,le,se,M]}],container:["container"],columns:[{columns:[je,le,se,p]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"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"],sr:["sr-only","not-sr-only"],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:J()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{start:W()}],end:[{end:W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Aa,"auto",se,le]}],basis:[{basis:[js,"full","auto",p,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[je,js,"auto","initial","none",le]}],grow:[{grow:["",je,se,le]}],shrink:[{shrink:["",je,se,le]}],order:[{order:[Aa,"first","last","none",se,le]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":oe()}],"col-end":[{"col-end":oe()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":oe()}],"row-end":[{"row-end":oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[p,"screen",...F()]}],"min-w":[{"min-w":[p,"screen","none",...F()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",i,Fi,pl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,se,Ff]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zf,le]}],"font-family":[{font:[K_,le,s]}],"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:[u,se,le]}],"line-clamp":[{"line-clamp":[je,"none",se,Ff]}],leading:[{leading:[f,...H()]}],"list-image":[{"list-image":["none",se,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[je,"from-font","auto",se,pl]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[je,"auto",se,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:C()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Aa,se,le],radial:["",se,le],conic:[Aa,se,le]},P_,Y_]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[je,se,le]}],"outline-w":[{outline:["",je,Fi,pl]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",v,qo,Bo]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",b,qo,Bo]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[je,pl]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",S,qo,Bo]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[je,se,le]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[je]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[se,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[je]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:me()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:C()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,le]}],filter:[{filter:["","none",se,le]}],blur:[{blur:Ze()}],brightness:[{brightness:[je,se,le]}],contrast:[{contrast:[je,se,le]}],"drop-shadow":[{"drop-shadow":["","none",_,qo,Bo]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",je,se,le]}],"hue-rotate":[{"hue-rotate":[je,se,le]}],invert:[{invert:["",je,se,le]}],saturate:[{saturate:[je,se,le]}],sepia:[{sepia:["",je,se,le]}],"backdrop-filter":[{"backdrop-filter":["","none",se,le]}],"backdrop-blur":[{"backdrop-blur":Ze()}],"backdrop-brightness":[{"backdrop-brightness":[je,se,le]}],"backdrop-contrast":[{"backdrop-contrast":[je,se,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",je,se,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[je,se,le]}],"backdrop-invert":[{"backdrop-invert":["",je,se,le]}],"backdrop-opacity":[{"backdrop-opacity":[je,se,le]}],"backdrop-saturate":[{"backdrop-saturate":[je,se,le]}],"backdrop-sepia":[{"backdrop-sepia":["",je,se,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[je,"initial",se,le]}],ease:[{ease:["linear","initial",z,se,le]}],delay:[{delay:[je,se,le]}],animate:[{animate:["none",B,se,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,se,le]}],"perspective-origin":[{"perspective-origin":J()}],rotate:[{rotate:ze()}],"rotate-x":[{"rotate-x":ze()}],"rotate-y":[{"rotate-y":ze()}],"rotate-z":[{"rotate-z":ze()}],scale:[{scale:_t()}],"scale-x":[{"scale-x":_t()}],"scale-y":[{"scale-y":_t()}],"scale-z":[{"scale-z":_t()}],"scale-3d":["scale-3d"],skew:[{skew:kt()}],"skew-x":[{"skew-x":kt()}],"skew-y":[{"skew-y":kt()}],transform:[{transform:[se,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:J()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:dn()}],"translate-x":[{"translate-x":dn()}],"translate-y":[{"translate-y":dn()}],"translate-z":[{"translate-z":dn()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",se,le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",se,le]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[je,Fi,pl,Ff]}],stroke:[{stroke:["none",...Y()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$_=M_(J_);function Ye(...a){return $_(Vb(a))}function W_({healthy:a,title:s="LENS",subtitle:i="Workspace"}){return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:Ye("flex size-8! shrink-0 items-center justify-center rounded-lg text-xs font-semibold text-primary-foreground",a===!1?"bg-destructive":"bg-primary"),children:"L"}),d.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[d.jsx("span",{className:"truncate font-semibold",children:s}),d.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i})]})]})}const Ly=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,ky=Vb,nv=(a,s)=>i=>{var r;if((s==null?void 0:s.variants)==null)return ky(a,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:u,defaultVariants:f}=s,m=Object.keys(u).map(y=>{const v=i==null?void 0:i[y],b=f==null?void 0:f[y];if(v===null)return null;const S=Ly(v)||Ly(b);return u[y][S]}),p=i&&Object.entries(i).reduce((y,v)=>{let[b,S]=v;return S===void 0||(y[b]=S),y},{}),g=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((y,v)=>{let{class:b,className:S,..._}=v;return Object.entries(_).every(j=>{let[N,M]=j;return Array.isArray(M)?M.includes({...f,...p}[N]):{...f,...p}[N]===M})?[...y,b,S]:y},[]);return ky(a,m,g,i==null?void 0:i.class,i==null?void 0:i.className)},I_=nv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function yt({className:a,variant:s="default",size:i="default",...r}){return d.jsx("button",{"data-slot":"button","data-variant":s,"data-size":i,className:Ye(I_({variant:s,size:i,className:a})),...r})}function ej({className:a,orientation:s="horizontal",...i}){return d.jsx("div",{"data-slot":"separator","data-orientation":s,role:"separator",className:Ye("bg-border shrink-0",s==="horizontal"?"h-px w-full":"h-full w-px",a),...i})}const tj="16rem",nj="3rem",aj="b",av=U.createContext(null);function lv(){const a=U.useContext(av);if(!a)throw new Error("useSidebar must be used within SidebarProvider.");return a}function lj({defaultOpen:a=!0,className:s,style:i,children:r,...u}){const[f,m]=U.useState(a),p=U.useCallback(()=>m(v=>!v),[]);U.useEffect(()=>{const v=b=>{b.key===aj&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p]);const g=f?"expanded":"collapsed",y=U.useMemo(()=>({state:g,open:f,setOpen:m,toggleSidebar:p}),[g,f,p]);return d.jsx(av.Provider,{value:y,children:d.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":tj,"--sidebar-width-icon":nj,...i},className:Ye("group/sidebar-wrapper flex min-h-svh w-full",s),...u,children:r})})}function sj({side:a="left",collapsible:s="icon",variant:i="default",className:r,children:u,...f}){const{state:m}=lv();return s==="none"?d.jsx("div",{"data-slot":"sidebar",className:Ye("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...f,children:u}):d.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?s:"","data-side":a,"data-variant":i,"data-slot":"sidebar",children:[d.jsx("div",{"data-slot":"sidebar-gap",className:Ye("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),d.jsx("div",{"data-slot":"sidebar-container",className:Ye("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",a==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",i==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",r),...f,children:d.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-transparent flex h-full w-full flex-col py-2",children:u})})]})}function ij({className:a,onClick:s,...i}){const{toggleSidebar:r}=lv();return d.jsxs(yt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:Ye("size-7",a),onClick:u=>{s==null||s(u),r()},...i,children:[d.jsx(I2,{}),d.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function rj({className:a,...s}){return d.jsx("main",{"data-slot":"sidebar-inset",className:Ye("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",a),...s})}function oj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ye("flex flex-col gap-2 p-2",a),...s})}function cj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ye("flex flex-col gap-2 p-2",a),...s})}function uj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ye("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",a),...s})}function Jf({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ye("relative flex w-full min-w-0 flex-col p-2",a),...s})}function fj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:Ye("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",a),...s})}function $f({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Ye("w-full text-sm",a),...s})}function Ii({className:a,...s}){return d.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ye("flex w-full min-w-0 flex-col gap-1",a),...s})}function er({className:a,...s}){return d.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ye("group/menu-item relative",a),...s})}function ar({as:a="button",isActive:s=!1,size:i="default",className:r,children:u,...f}){return d.jsx(a,{...a==="button"?{type:"button"}:{},"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":s,className:Ye("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] duration-200 ease-linear","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","disabled:pointer-events-none disabled:opacity-50","data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground","group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2","[&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",i==="sm"&&"h-7 text-xs",i==="default"&&"h-8 text-sm",i==="lg"&&"h-12 text-sm group-data-[collapsible=icon]:!p-0",r),...f,children:u})}function dj(){const[a,s]=U.useState(()=>{if(typeof window>"u")return!1;const i=localStorage.getItem("theme");return i==="dark"?!0:i==="light"?!1:document.documentElement.classList.contains("dark")});return U.useEffect(()=>{document.documentElement.classList.toggle("dark",a),localStorage.setItem("theme",a?"dark":"light")},[a]),[a,()=>s(i=>!i)]}function hj({variant:a="sidebar"}){const[s,i]=dj();return a==="button"?d.jsxs(yt,{variant:"ghost",size:"icon",className:"size-7",onClick:i,children:[s?d.jsx(Ty,{}):d.jsx(Cy,{}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]}):d.jsxs(ar,{onClick:i,children:[s?d.jsx(Ty,{}):d.jsx(Cy,{}),d.jsx("span",{children:s?"Light mode":"Dark mode"})]})}function mj({navItems:a,navGroups:s,currentPath:i,renderLink:r,brand:u={title:"LENS",subtitle:"Workspace"},healthy:f,footer:m,...p}){return d.jsxs(sj,{collapsible:"icon",className:"shadow-none",...p,children:[d.jsx(oj,{children:d.jsx(Ii,{children:d.jsx(er,{children:d.jsx(ar,{size:"lg",className:"hover:bg-transparent",children:d.jsx(W_,{healthy:f,title:u.title,subtitle:u.subtitle})})})})}),d.jsxs(uj,{children:[d.jsx(Jf,{children:d.jsx($f,{children:d.jsx(Ii,{children:a.map(({href:g,icon:y,label:v})=>{const b=g==="/"||g==="/dashboard"?i===g:i.startsWith(g);return d.jsx(er,{children:r({href:g,children:d.jsxs(ar,{isActive:b,children:[d.jsx(y,{}),d.jsx("span",{children:v})]})})},g)})})})}),s==null?void 0:s.map(g=>d.jsxs(Jf,{children:[d.jsx(fj,{children:g.label}),d.jsx($f,{children:d.jsx(Ii,{children:g.items.map(({href:y,icon:v,label:b})=>{const S=i.startsWith(y);return d.jsx(er,{children:r({href:y,children:d.jsxs(ar,{isActive:S,children:[d.jsx(v,{}),d.jsx("span",{children:b})]})})},y)})})})]},g.label)),d.jsx(Jf,{className:"mt-auto",children:d.jsx($f,{children:d.jsx(Ii,{children:d.jsx(er,{children:d.jsx(hj,{variant:"sidebar"})})})})})]}),m&&d.jsx(cj,{children:m})]})}function pj({user:a,onSignOut:s}){return d.jsx(Ii,{children:d.jsx(er,{children:d.jsxs(ar,{as:"div",size:"lg",children:[d.jsx(A2,{className:"!size-8 text-muted-foreground"}),d.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[d.jsx("span",{className:"truncate font-medium",children:a.name}),d.jsx("span",{className:"text-muted-foreground truncate text-xs",children:a.email})]}),s?d.jsx("button",{type:"button",onClick:s,className:"ml-auto rounded-md p-1 text-muted-foreground hover:text-foreground hover:bg-sidebar-accent",children:d.jsx(X2,{className:"size-4"})}):d.jsx(U2,{className:"ml-auto"})]})})})}function na({children:a}){return d.jsx("header",{className:"flex h-12 shrink-0 items-center border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/70",children:d.jsxs("div",{className:"flex w-full items-center gap-2 px-3",children:[d.jsx(ij,{}),d.jsx(ej,{orientation:"vertical",className:"data-[orientation=vertical]:h-4"}),d.jsx("div",{className:"flex flex-1 items-center gap-2 min-w-0",children:a})]})})}const gj=nv("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-white dark:bg-destructive/60",outline:"border-border text-foreground"}},defaultVariants:{variant:"default"}});function yj({className:a,variant:s="default",...i}){return d.jsx("span",{"data-slot":"badge","data-variant":s,className:Ye(gj({variant:s}),a),...i})}function Pa({className:a,...s}){return d.jsx("div",{"data-slot":"card",className:Ye("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...s})}function Za({className:a,...s}){return d.jsx("div",{"data-slot":"card-header",className:Ye("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...s})}function Al({className:a,...s}){return d.jsx("div",{"data-slot":"card-title",className:Ye("leading-none font-semibold",a),...s})}function Fa({className:a,...s}){return d.jsx("div",{"data-slot":"card-content",className:Ye("px-6",a),...s})}function Uy(a,s){if(typeof a=="function")return a(s);a!=null&&(a.current=s)}function sv(...a){return s=>{let i=!1;const r=a.map(u=>{const f=Uy(u,s);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let u=0;u<r.length;u++){const f=r[u];typeof f=="function"?f():Uy(a[u],null)}}}}function Ld(...a){return U.useCallback(sv(...a),a)}function bj(a,s=[]){let i=[];function r(f,m){const p=U.createContext(m),g=i.length;i=[...i,m];const y=b=>{var z;const{scope:S,children:_,...j}=b,N=((z=S==null?void 0:S[a])==null?void 0:z[g])||p,M=U.useMemo(()=>j,Object.values(j));return d.jsx(N.Provider,{value:M,children:_})};y.displayName=f+"Provider";function v(b,S){var N;const _=((N=S==null?void 0:S[a])==null?void 0:N[g])||p,j=U.useContext(_);if(j)return j;if(m!==void 0)return m;throw new Error(`\`${b}\` must be used within \`${f}\``)}return[y,v]}const u=()=>{const f=i.map(m=>U.createContext(m));return function(p){const g=(p==null?void 0:p[a])||f;return U.useMemo(()=>({[`__scope${a}`]:{...p,[a]:g}}),[p,g])}};return u.scopeName=a,[r,vj(u,...s)]}function vj(...a){const s=a[0];if(a.length===1)return s;const i=()=>{const r=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=r.reduce((p,{useScope:g,scopeName:y})=>{const b=g(f)[`__scope${y}`];return{...p,...b}},{});return U.useMemo(()=>({[`__scope${s.scopeName}`]:m}),[m])}};return i.scopeName=s.scopeName,i}function By(a,s,{checkForDefaultPrevented:i=!0}={}){return function(u){if(a==null||a(u),i===!1||!u.defaultPrevented)return s==null?void 0:s(u)}}var sc=globalThis!=null&&globalThis.document?U.useLayoutEffect:()=>{},xj=B0[" useInsertionEffect ".trim().toString()]||sc;function Sj({prop:a,defaultProp:s,onChange:i=()=>{},caller:r}){const[u,f,m]=_j({defaultProp:s,onChange:i}),p=a!==void 0,g=p?a:u;{const v=U.useRef(a!==void 0);U.useEffect(()=>{const b=v.current;b!==p&&console.warn(`${r} is changing from ${b?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=p},[p,r])}const y=U.useCallback(v=>{var b;if(p){const S=jj(v)?v(a):v;S!==a&&((b=m.current)==null||b.call(m,S))}else f(v)},[p,a,f,m]);return[g,y]}function _j({defaultProp:a,onChange:s}){const[i,r]=U.useState(a),u=U.useRef(i),f=U.useRef(s);return xj(()=>{f.current=s},[s]),U.useEffect(()=>{var m;u.current!==i&&((m=f.current)==null||m.call(f,i),u.current=i)},[i,u]),[i,r,f]}function jj(a){return typeof a=="function"}function Nj(a){const s=U.useRef({value:a,previous:a});return U.useMemo(()=>(s.current.value!==a&&(s.current.previous=s.current.value,s.current.value=a),s.current.previous),[a])}function Rj(a){const[s,i]=U.useState(void 0);return sc(()=>{if(a){i({width:a.offsetWidth,height:a.offsetHeight});const r=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const f=u[0];let m,p;if("borderBoxSize"in f){const g=f.borderBoxSize,y=Array.isArray(g)?g[0]:g;m=y.inlineSize,p=y.blockSize}else m=a.offsetWidth,p=a.offsetHeight;i({width:m,height:p})});return r.observe(a,{box:"border-box"}),()=>r.unobserve(a)}else i(void 0)},[a]),s}function wj(a,s){return U.useReducer((i,r)=>s[i][r]??i,a)}var iv=a=>{const{present:s,children:i}=a,r=Cj(s),u=typeof i=="function"?i({present:r.isPresent}):U.Children.only(i),f=Ld(r.ref,Ej(u));return typeof i=="function"||r.isPresent?U.cloneElement(u,{ref:f}):null};iv.displayName="Presence";function Cj(a){const[s,i]=U.useState(),r=U.useRef(null),u=U.useRef(a),f=U.useRef("none"),m=a?"mounted":"unmounted",[p,g]=wj(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U.useEffect(()=>{const y=Ho(r.current);f.current=p==="mounted"?y:"none"},[p]),sc(()=>{const y=r.current,v=u.current;if(v!==a){const S=f.current,_=Ho(y);a?g("MOUNT"):_==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(v&&S!==_?"ANIMATION_OUT":"UNMOUNT"),u.current=a}},[a,g]),sc(()=>{if(s){let y;const v=s.ownerDocument.defaultView??window,b=_=>{const N=Ho(r.current).includes(CSS.escape(_.animationName));if(_.target===s&&N&&(g("ANIMATION_END"),!u.current)){const M=s.style.animationFillMode;s.style.animationFillMode="forwards",y=v.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=M)})}},S=_=>{_.target===s&&(f.current=Ho(r.current))};return s.addEventListener("animationstart",S),s.addEventListener("animationcancel",b),s.addEventListener("animationend",b),()=>{v.clearTimeout(y),s.removeEventListener("animationstart",S),s.removeEventListener("animationcancel",b),s.removeEventListener("animationend",b)}}else g("ANIMATION_END")},[s,g]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:U.useCallback(y=>{r.current=y?getComputedStyle(y):null,i(y)},[])}}function Ho(a){return(a==null?void 0:a.animationName)||"none"}function Ej(a){var r,u;let s=(r=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:r.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?a.ref:(s=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}function Tj(a){const s=Mj(a),i=U.forwardRef((r,u)=>{const{children:f,...m}=r,p=U.Children.toArray(f),g=p.find(Oj);if(g){const y=g.props.children,v=p.map(b=>b===g?U.Children.count(y)>1?U.Children.only(null):U.isValidElement(y)?y.props.children:null:b);return d.jsx(s,{...m,ref:u,children:U.isValidElement(y)?U.cloneElement(y,void 0,v):null})}return d.jsx(s,{...m,ref:u,children:f})});return i.displayName=`${a}.Slot`,i}function Mj(a){const s=U.forwardRef((i,r)=>{const{children:u,...f}=i;if(U.isValidElement(u)){const m=Dj(u),p=zj(f,u.props);return u.type!==U.Fragment&&(p.ref=r?sv(r,m):m),U.cloneElement(u,p)}return U.Children.count(u)>1?U.Children.only(null):null});return s.displayName=`${a}.SlotClone`,s}var Aj=Symbol("radix.slottable");function Oj(a){return U.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===Aj}function zj(a,s){const i={...s};for(const r in s){const u=a[r],f=s[r];/^on[A-Z]/.test(r)?u&&f?i[r]=(...p)=>{const g=f(...p);return u(...p),g}:u&&(i[r]=u):r==="style"?i[r]={...u,...f}:r==="className"&&(i[r]=[u,f].filter(Boolean).join(" "))}return{...a,...i}}function Dj(a){var r,u;let s=(r=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:r.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?a.ref:(s=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}var Lj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kd=Lj.reduce((a,s)=>{const i=Tj(`Primitive.${s}`),r=U.forwardRef((u,f)=>{const{asChild:m,...p}=u,g=m?i:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(g,{...p,ref:f})});return r.displayName=`Primitive.${s}`,{...a,[s]:r}},{}),fc="Checkbox",[kj]=bj(fc),[Uj,Ud]=kj(fc);function Bj(a){const{__scopeCheckbox:s,checked:i,children:r,defaultChecked:u,disabled:f,form:m,name:p,onCheckedChange:g,required:y,value:v="on",internal_do_not_use_render:b}=a,[S,_]=Sj({prop:i,defaultProp:u??!1,onChange:g,caller:fc}),[j,N]=U.useState(null),[M,z]=U.useState(null),B=U.useRef(!1),P=j?!!m||!!j.closest("form"):!0,T={checked:S,disabled:f,setChecked:_,control:j,setControl:N,name:p,form:m,value:v,hasConsumerStoppedPropagationRef:B,required:y,defaultChecked:Ja(u)?!1:u,isFormControl:P,bubbleInput:M,setBubbleInput:z};return d.jsx(Uj,{scope:s,...T,children:qj(b)?b(T):r})}var rv="CheckboxTrigger",ov=U.forwardRef(({__scopeCheckbox:a,onKeyDown:s,onClick:i,...r},u)=>{const{control:f,value:m,disabled:p,checked:g,required:y,setControl:v,setChecked:b,hasConsumerStoppedPropagationRef:S,isFormControl:_,bubbleInput:j}=Ud(rv,a),N=Ld(u,v),M=U.useRef(g);return U.useEffect(()=>{const z=f==null?void 0:f.form;if(z){const B=()=>b(M.current);return z.addEventListener("reset",B),()=>z.removeEventListener("reset",B)}},[f,b]),d.jsx(kd.button,{type:"button",role:"checkbox","aria-checked":Ja(g)?"mixed":g,"aria-required":y,"data-state":hv(g),"data-disabled":p?"":void 0,disabled:p,value:m,...r,ref:N,onKeyDown:By(s,z=>{z.key==="Enter"&&z.preventDefault()}),onClick:By(i,z=>{b(B=>Ja(B)?!0:!B),j&&_&&(S.current=z.isPropagationStopped(),S.current||z.stopPropagation())})})});ov.displayName=rv;var Bd=U.forwardRef((a,s)=>{const{__scopeCheckbox:i,name:r,checked:u,defaultChecked:f,required:m,disabled:p,value:g,onCheckedChange:y,form:v,...b}=a;return d.jsx(Bj,{__scopeCheckbox:i,checked:u,defaultChecked:f,disabled:p,required:m,onCheckedChange:y,name:r,form:v,value:g,internal_do_not_use_render:({isFormControl:S})=>d.jsxs(d.Fragment,{children:[d.jsx(ov,{...b,ref:s,__scopeCheckbox:i}),S&&d.jsx(dv,{__scopeCheckbox:i})]})})});Bd.displayName=fc;var cv="CheckboxIndicator",uv=U.forwardRef((a,s)=>{const{__scopeCheckbox:i,forceMount:r,...u}=a,f=Ud(cv,i);return d.jsx(iv,{present:r||Ja(f.checked)||f.checked===!0,children:d.jsx(kd.span,{"data-state":hv(f.checked),"data-disabled":f.disabled?"":void 0,...u,ref:s,style:{pointerEvents:"none",...a.style}})})});uv.displayName=cv;var fv="CheckboxBubbleInput",dv=U.forwardRef(({__scopeCheckbox:a,...s},i)=>{const{control:r,hasConsumerStoppedPropagationRef:u,checked:f,defaultChecked:m,required:p,disabled:g,name:y,value:v,form:b,bubbleInput:S,setBubbleInput:_}=Ud(fv,a),j=Ld(i,_),N=Nj(f),M=Rj(r);U.useEffect(()=>{const B=S;if(!B)return;const P=window.HTMLInputElement.prototype,J=Object.getOwnPropertyDescriptor(P,"checked").set,te=!u.current;if(N!==f&&J){const V=new Event("click",{bubbles:te});B.indeterminate=Ja(f),J.call(B,Ja(f)?!1:f),B.dispatchEvent(V)}},[S,N,f,u]);const z=U.useRef(Ja(f)?!1:f);return d.jsx(kd.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??z.current,required:p,disabled:g,name:y,value:v,form:b,...s,tabIndex:-1,ref:j,style:{...s.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});dv.displayName=fv;function qj(a){return typeof a=="function"}function Ja(a){return a==="indeterminate"}function hv(a){return Ja(a)?"indeterminate":a?"checked":"unchecked"}const Hj=U.forwardRef(({className:a,...s},i)=>d.jsx(Bd,{ref:i,"data-slot":"checkbox",className:Ye("peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary size-4 shrink-0 rounded-[4px] border shadow-xs cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...s,children:d.jsx(uv,{className:"flex items-center justify-center text-current",children:d.jsx(Xo,{className:"h-3.5 w-3.5"})})}));Hj.displayName=Bd.displayName;U.createContext({value:"",onChange:()=>{}});const Qj="";async function $e(a,s){const i=await fetch(`${Qj}${a}`,s);if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}const Ue={health:()=>$e("/health"),stats:()=>$e("/api/dashboard/stats"),repos:()=>$e("/api/dashboard/repos"),repo:a=>$e(`/api/dashboard/repos/${a}`),logs:a=>{const s=new URLSearchParams;a!=null&&a.limit&&s.set("limit",String(a.limit)),a!=null&&a.offset&&s.set("offset",String(a.offset)),a!=null&&a.method&&s.set("method",a.method),a!=null&&a.path&&s.set("path",a.path),a!=null&&a.status&&s.set("status",String(a.status)),a!=null&&a.source&&s.set("source",a.source);const i=s.toString();return $e(`/api/dashboard/logs${i?`?${i}`:""}`)},tables:()=>$e("/api/dashboard/tables"),tableRows:(a,s=50,i=0)=>$e(`/api/dashboard/tables/${encodeURIComponent(a)}?limit=${s}&offset=${i}`),jobs:()=>$e("/api/dashboard/jobs"),routes:()=>$e("/api/dashboard/routes"),reindex:a=>$e("/index/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a,force:!1})}),startWatcher:a=>$e("/index/watch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a})}),stopWatcher:a=>$e("/index/unwatch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a})}),buildContext:(a,s)=>$e("/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a,goal:s})}),registerRepo:(a,s)=>$e("/repo/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root_path:a,name:s})}),removeRepo:a=>$e(`/repo/${a}`,{method:"DELETE"}),localUsage:()=>$e("/api/dashboard/usage"),authStatus:()=>$e("/api/auth/status"),cloudUsageRange:(a,s)=>$e(`/api/cloud/usage?start=${a}&end=${s}`),cloudSubscription:()=>$e("/api/cloud/subscription"),cloudCheckout:(a="monthly")=>$e("/api/cloud/billing/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interval:a,return_url:window.location.href})}),cloudPortal:()=>$e(`/api/cloud/billing/portal?return_url=${encodeURIComponent(window.location.href)}`),refreshPlan:()=>$e("/api/dashboard/refresh-plan",{method:"POST"})},Gj=[{href:"/",icon:Y2,label:"Overview"},{href:"/repos",icon:Hb,label:"Repos"},{href:"/requests",icon:Db,label:"Requests"},{href:"/data",icon:ac,label:"Data"},{href:"/jobs",icon:Ub,label:"Jobs"},{href:"/context",icon:pd,label:"Context"}],Vj=[{label:"Cloud",items:[{href:"/usage",icon:w2,label:"Usage"},{href:"/billing",icon:D2,label:"Billing"}]}];function Yj(){var p,g;const s=Zt().location.pathname,r=((p=St({queryKey:["health"],queryFn:Ue.health,refetchInterval:1e4,placeholderData:un}).data)==null?void 0:p.status)==="ok",u=Ys(),f=St({queryKey:["auth-status"],queryFn:Ue.authStatus,placeholderData:un});U.useEffect(()=>{const y=new EventSource("/api/auth/events");return y.onmessage=()=>{u.invalidateQueries({queryKey:["auth-status"]}),Ue.refreshPlan().then(()=>{u.invalidateQueries({queryKey:["dashboard-usage"]}),u.invalidateQueries({queryKey:["cloud-subscription"]})}).catch(()=>{})},()=>y.close()},[u]),U.useEffect(()=>{const y=new EventSource("/api/repo/events");let v;return y.onmessage=()=>{clearTimeout(v),v=setTimeout(()=>{u.invalidateQueries({queryKey:["dashboard-repos"]}),u.invalidateQueries({queryKey:["dashboard-stats"]}),u.invalidateQueries({queryKey:["dashboard-jobs"]})},300)},()=>{clearTimeout(v),y.close()}},[u]);const m=(g=f.data)!=null&&g.authenticated?{name:f.data.email??"User",email:f.data.email??""}:{name:"Guest",email:"Run: lens login"};return d.jsxs(lj,{className:"bg-muted h-svh",children:[d.jsx(mj,{navItems:Gj,navGroups:Vj,currentPath:s,renderLink:({href:y,children:v})=>d.jsx(zd,{to:y,children:v}),healthy:r,footer:d.jsx(pj,{user:m})}),d.jsx(rj,{className:"bg-background rounded-xl overflow-hidden md:my-2 md:mr-2 md:border",children:d.jsx("div",{className:"@container/main flex min-h-0 flex-1 flex-col",children:d.jsx(Ob,{})})})]})}const qy={ready:"bg-success/15 text-success border-success/25",indexed:"bg-success/15 text-success border-success/25",indexing:"bg-warning/15 text-warning border-warning/25",pending:"bg-muted text-muted-foreground border-border",error:"bg-destructive/15 text-destructive border-destructive/25",active:"bg-success/15 text-success border-success/25",inactive:"bg-muted text-muted-foreground border-border"};function Cs({status:a,className:s}){const i=qy[a]??qy.pending;return d.jsx(yj,{variant:"outline",className:Ye("rounded-md px-2 py-0.5 text-[11px]",i,s),children:a})}function Kj(a){return a<1?"<1ms":a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(2)}s`}function ic(a){if(!a)return"never";const s=Date.now()-new Date(a+"Z").getTime(),i=Math.floor(s/1e3);if(i<60)return`${i}s ago`;const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const u=Math.floor(r/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}function mv(){const a=uc(),{data:s,isLoading:i}=St({queryKey:["dashboard-stats"],queryFn:Ue.stats,refetchInterval:3e4,placeholderData:un}),{data:r}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,refetchInterval:3e4,placeholderData:un}),{data:u}=St({queryKey:["dashboard-usage"],queryFn:Ue.localUsage,refetchInterval:3e4}),f=((u==null?void 0:u.plan)??"free")==="pro"||(u==null?void 0:u.has_capabilities)===!0;if(!s&&i)return d.jsx(Xj,{});const m=(s==null?void 0:s.uptime_seconds)??0,p=m<60?`${m}s`:m<3600?`${Math.floor(m/60)}m`:`${Math.floor(m/3600)}h ${Math.floor(m%3600/60)}m`,g="border-border/80 bg-muted/35 text-foreground/80",y=[{label:"Repos",value:(s==null?void 0:s.repos_count)??0,description:"Registered repositories",icon:Hb,iconClassName:g},{label:"Chunks",value:((s==null?void 0:s.total_chunks)??0).toLocaleString(),description:"Code segments across all repos",icon:i_,iconClassName:g},{label:"Embeddings",value:((s==null?void 0:s.total_embeddings)??0).toLocaleString(),description:"Chunks with vector embeddings stored locally",icon:Ub,iconClassName:g,pro:!0},{label:"Summaries",value:((s==null?void 0:s.total_summaries)??0).toLocaleString(),description:"Files with a purpose summary in local DB",icon:N2,iconClassName:g,pro:!0},{label:"Vocab",value:((s==null?void 0:s.total_vocab_clusters)??0).toLocaleString(),description:"Term clusters for concept expansion",icon:$2,iconClassName:g,pro:!0},{label:"DB Size",value:`${(s==null?void 0:s.db_size_mb)??0} MB`,description:"SQLite database",icon:ac,iconClassName:g},{label:"Uptime",value:p,description:"Daemon process",icon:Db,iconClassName:g}];return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Overview"})}),d.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto py-4 md:gap-6 md:py-6",children:[d.jsx("section",{className:"px-4 lg:px-6",children:d.jsxs("div",{className:"rounded-xl border border-border bg-background p-4",children:[d.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"System snapshot"}),d.jsx("p",{className:"mt-1 text-sm",children:"Live operational metrics for repositories and indexing throughput."})]})}),d.jsx("section",{className:"grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @3xl/main:grid-cols-4",children:y.map(v=>{const b=v.icon,S=v.pro&&!f;return d.jsxs(Pa,{className:`border-border bg-background py-4 shadow-none ${S?"opacity-60":""}`,children:[d.jsx(Za,{className:"pb-1",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:v.label}),S&&d.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"Pro"})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:S?"—":v.value})]}),d.jsx("span",{className:`rounded-md border p-1.5 ${v.iconClassName}`,children:d.jsx(b,{className:"h-4 w-4"})})]})}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-sm text-muted-foreground",children:v.description})})]},v.label)})}),(r==null?void 0:r.repos)&&r.repos.length>0&&d.jsxs("section",{className:"space-y-3 px-4 lg:px-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-sm font-semibold",children:"Repositories"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Tracked codebases and index status"})]}),d.jsx(yt,{variant:"outline",size:"sm",onClick:()=>a({to:"/repos"}),children:"View all"})]}),d.jsx("div",{className:"grid gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-3",children:r.repos.map(v=>d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsx(Za,{className:"pb-2",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx(Al,{className:"truncate text-sm",children:v.name}),d.jsx("p",{className:"truncate text-xs text-muted-foreground",children:v.root_path})]}),d.jsx(Cs,{status:v.index_status,className:"border-border bg-muted text-foreground"})]})}),d.jsxs(Fa,{className:"space-y-2",children:[d.jsxs("div",{className:"grid grid-cols-5 gap-2 text-xs",children:[d.jsxs("div",{className:"rounded-md border border-border bg-background px-2 py-1.5",children:[d.jsx("p",{className:"text-muted-foreground",children:"Files"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:v.files_indexed})]}),d.jsxs("div",{className:"rounded-md border border-border bg-background px-2 py-1.5",children:[d.jsx("p",{className:"text-muted-foreground",children:"Chunks"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:v.chunk_count})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Embed"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?`${v.embedded_pct}%`:"—"})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Summaries"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?`${v.purpose_count}/${v.purpose_total}`:"—"})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Vocab"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?v.vocab_cluster_count:"—"})]})]}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Indexed ",ic(v.last_indexed_at)]})]})]},v.id))})]})]})]})}function Xj(){return d.jsx("div",{className:"flex items-center justify-center py-20",children:d.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function lr({value:a,max:s,label:i,className:r}){const u=s>0?Math.round(a/s*100):0;return d.jsxs("div",{className:Ye("space-y-1",r),children:[i&&d.jsxs("div",{className:"flex items-center justify-between text-xs",children:[d.jsx("span",{className:"text-muted-foreground",children:i}),d.jsxs("span",{className:"font-mono text-muted-foreground",children:[a,"/",s," (",u,"%)"]})]}),d.jsx("div",{className:"h-2.5 w-full overflow-hidden rounded-full bg-muted",children:d.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${u}%`}})})]})}function Pj(){var J,te;const[a,s]=U.useState(null),[i,r]=U.useState(!1),[u,f]=U.useState(""),[m,p]=U.useState(null),g=Ys(),y=St({queryKey:["auth-status"],queryFn:Ue.authStatus}),{data:v}=St({queryKey:["cloud-usage-current"],queryFn:Ue.cloudUsageCurrent,enabled:!!((J=y.data)!=null&&J.authenticated)}),b=((v==null?void 0:v.plan)??"free")==="pro",{data:S,isLoading:_}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,refetchInterval:3e4,placeholderData:un}),j=Wn({mutationFn:Ue.reindex,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),N=Wn({mutationFn:Ue.startWatcher,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),M=Wn({mutationFn:Ue.stopWatcher,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),z=Wn({mutationFn:V=>Ue.registerRepo(V),onSuccess:()=>{g.invalidateQueries({queryKey:["dashboard-repos"]}),r(!1),f("")}}),B=Wn({mutationFn:Ue.removeRepo,onSuccess:()=>{g.invalidateQueries({queryKey:["dashboard-repos"]}),p(null),s(null)}}),P=(S==null?void 0:S.repos)??[],T=a?P.find(V=>V.id===a):null;return T?d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsxs(yt,{variant:"ghost",size:"sm",onClick:()=>s(null),className:"gap-1 -ml-2",children:[d.jsx(_2,{className:"h-3.5 w-3.5"})," Back"]}),d.jsx("span",{className:"text-sm font-medium",children:T.name}),d.jsx("span",{className:"text-xs text-muted-foreground truncate hidden md:inline",children:T.root_path}),d.jsxs("div",{className:"ml-auto flex gap-2",children:[d.jsx(Qo,{onClick:()=>j.mutate(T.id),icon:Qb,label:"Re-index",loading:j.isPending}),T.watcher.active?d.jsx(Qo,{onClick:()=>M.mutate(T.id),icon:Bb,label:"Stop watcher"}):d.jsx(Qo,{onClick:()=>N.mutate(T.id),icon:qb,label:"Start watcher"}),m===T.id?d.jsxs(d.Fragment,{children:[d.jsx(yt,{variant:"destructive",size:"sm",onClick:()=>B.mutate(T.id),disabled:B.isPending,children:B.isPending?"Removing...":"Confirm"}),d.jsx(yt,{variant:"outline",size:"sm",onClick:()=>p(null),children:"Cancel"})]}):d.jsx(Qo,{onClick:()=>p(T.id),icon:c_,label:"Remove"})]})]}),d.jsxs("div",{className:"flex-1 min-h-0 overflow-auto grid gap-4 p-4 lg:p-6 @xl/main:grid-cols-2 content-start",children:[d.jsxs(Pa,{children:[d.jsx(Za,{className:"pb-2",children:d.jsx(Al,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Index"})}),d.jsx(Fa,{children:d.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[d.jsx(gl,{label:"Status",value:d.jsx(Cs,{status:T.index_status})}),d.jsx(gl,{label:"Last commit",value:((te=T.last_indexed_commit)==null?void 0:te.slice(0,8))??"—",mono:!0}),d.jsx(gl,{label:"Files",value:T.files_indexed}),d.jsx(gl,{label:"Chunks",value:T.chunk_count}),d.jsx(gl,{label:"Import depth",value:T.max_import_depth}),d.jsx(gl,{label:"Indexed",value:ic(T.last_indexed_at)})]})})]}),d.jsxs(Pa,{children:[d.jsx(Za,{className:"pb-2",children:d.jsx(Al,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Enrichment"})}),d.jsxs(Fa,{className:"space-y-3",children:[T.has_capabilities?d.jsxs(d.Fragment,{children:[d.jsx(lr,{label:"Embeddings",value:T.embedded_count,max:T.embeddable_count}),d.jsx(lr,{label:"Vocab clusters",value:T.vocab_cluster_count,max:T.vocab_cluster_count||1}),d.jsx(lr,{label:"Purpose",value:T.purpose_count,max:T.purpose_total})]}):d.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:[d.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"⚡ Pro — Embeddings · Vocab clusters · Summaries"}),d.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[d.jsx("code",{className:"text-[10px]",children:"lens login"})," → upgrade to enable"]})]}),d.jsxs("div",{className:"pt-1",children:[d.jsx(gl,{label:"Watcher",value:d.jsx(Cs,{status:T.watcher.active?"active":"inactive"})}),T.watcher.active&&T.watcher.changed_files>0&&d.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[T.watcher.changed_files," changed files pending"]})]})]})]})]})]}):d.jsxs(d.Fragment,{children:[d.jsx(na,{children:i?d.jsxs("form",{onSubmit:V=>{V.preventDefault(),u.trim()&&z.mutate(u.trim())},className:"flex flex-1 items-center gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(G2,{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),d.jsx("input",{type:"text",value:u,onChange:V=>f(V.target.value),placeholder:"/absolute/path/to/repo",className:"h-7 w-full rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0})]}),d.jsx(yt,{type:"submit",size:"sm",className:"h-7 text-xs",disabled:!u.trim()||z.isPending,children:z.isPending?"Registering...":"Register"}),d.jsx(yt,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{r(!1),f("")},children:"Cancel"}),z.isError&&d.jsx("span",{className:"text-xs text-destructive",children:z.error.message})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Repositories"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[P.length," total"]}),d.jsx("div",{className:"ml-auto",children:d.jsxs(yt,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>r(!0),children:[d.jsx(t_,{className:"h-3.5 w-3.5"}),"Register"]})})]})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Name"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Status"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Files"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Chunks"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Embed%"}),d.jsx("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Indexed"})]})}),d.jsx("tbody",{children:P.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:7,className:"py-12 text-center text-muted-foreground",children:"No repos registered. Run: lens repo register"})}):P.map((V,H)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:H+1}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx("button",{type:"button",onClick:()=>s(V.id),className:"text-primary hover:underline font-medium",children:V.name})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx(Cs,{status:V.index_status})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums",children:V.files_indexed}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums",children:V.chunk_count}),d.jsx("td",{className:`border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums ${b?"":"opacity-40"}`,children:b?`${V.embedded_pct}%`:"—"}),d.jsx("td",{className:"border-b border-border px-3 py-1.5 text-muted-foreground",children:ic(V.last_indexed_at)})]},V.id))})]})})]})}function gl({label:a,value:s,mono:i}){return d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-muted-foreground",children:a}),d.jsx("div",{className:`text-sm font-medium ${i?"font-mono":""}`,children:s})]})}function Qo({onClick:a,icon:s,label:i,loading:r}){return d.jsxs(yt,{variant:"outline",size:"sm",onClick:a,disabled:r,className:"gap-1.5",children:[d.jsx(s,{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`}),i]})}const Zj={2:"text-success",3:"text-warning",4:"text-warning",5:"text-destructive"},Hy={cli:"bg-blue-500/15 text-blue-400",mcp:"bg-purple-500/15 text-purple-400",api:"bg-emerald-500/15 text-emerald-400",dashboard:"bg-amber-500/15 text-amber-400"};function Fj(){const[a,s]=U.useState(0),[i,r]=U.useState(""),u=100,{data:f,isLoading:m}=St({queryKey:["dashboard-logs",a,i],queryFn:()=>Ue.logs({limit:u,offset:a*u,source:i||void 0}),refetchInterval:15e3,placeholderData:un}),p=(f==null?void 0:f.total)??0,g=Math.max(1,Math.ceil(p/u)),y=(f==null?void 0:f.rows)??[];return d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Requests"}),(f==null?void 0:f.summary)&&d.jsxs("div",{className:"hidden items-center gap-2 text-xs text-muted-foreground md:flex",children:[d.jsxs("span",{className:"tabular-nums",children:[f.summary.total_today," today"]}),f.summary.by_source.map(v=>d.jsxs("span",{className:"tabular-nums",children:[d.jsx("span",{className:`inline-block rounded px-1 py-0.5 ${Hy[v.source]??""}`,children:v.source})," ",v.count]},v.source))]}),d.jsx("div",{className:"ml-auto",children:d.jsxs("select",{value:i,onChange:v=>{r(v.target.value),s(0)},className:"h-7 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring",children:[d.jsx("option",{value:"",children:"All sources"}),d.jsx("option",{value:"cli",children:"CLI"}),d.jsx("option",{value:"mcp",children:"MCP"}),d.jsx("option",{value:"api",children:"API"}),d.jsx("option",{value:"dashboard",children:"Dashboard"})]})})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:m&&!f?d.jsx(Jj,{}):d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Time"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Source"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Method"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Path"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Status"}),d.jsx("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Duration"})]})}),d.jsx("tbody",{children:y.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:7,className:"py-12 text-center text-muted-foreground",children:"No requests logged yet"})}):y.map((v,b)=>{const S=new Date(v.created_at+"Z"),_=Zj[String(v.status)[0]]??"",j=Hy[v.source]??"";return d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:a*u+b+1}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-muted-foreground tabular-nums",children:S.toLocaleTimeString()}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx("span",{className:`inline-block rounded px-1.5 py-0.5 font-medium ${j}`,children:v.source})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:v.method}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono max-w-xs truncate",children:v.path}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:d.jsx("span",{className:`font-medium ${_}`,children:v.status})}),d.jsx("td",{className:"border-b border-border px-3 py-1.5 font-mono text-right text-muted-foreground tabular-nums",children:Kj(v.duration_ms)})]},v.id)})})]})}),p>u&&d.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground",children:[d.jsxs("span",{className:"tabular-nums",children:[a*u+1,"–",Math.min((a+1)*u,p)," of"," ",p.toLocaleString()]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>s(a-1),disabled:a===0,children:d.jsx(Lb,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"px-1.5 tabular-nums",children:[a+1," / ",g]}),d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>s(a+1),disabled:a>=g-1,children:d.jsx(kb,{className:"h-3.5 w-3.5"})})]})]})]})}function Jj(){return d.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function $j(){const[a,s]=U.useState(null),[i,r]=U.useState(0),[u,f]=U.useState(""),[m,p]=U.useState(""),g=100,{data:y,isLoading:v}=St({queryKey:["dashboard-tables"],queryFn:Ue.tables,placeholderData:un}),{data:b,isLoading:S}=St({queryKey:["dashboard-table-rows",a,i],queryFn:()=>Ue.tableRows(a,g,i*g),enabled:!!a,placeholderData:un}),_=U.useMemo(()=>{const B=(y==null?void 0:y.tables)??[];if(!m)return B;const P=m.toLowerCase();return B.filter(T=>T.name.toLowerCase().includes(P))},[y,m]),j=U.useMemo(()=>{const B=(b==null?void 0:b.rows)??[];if(!u)return B;const P=u.toLowerCase();return B.filter(T=>Object.values(T).some(J=>J!=null&&String(J).toLowerCase().includes(P)))},[b,u]),N=u?j.length:(b==null?void 0:b.total)??0,M=Math.max(1,Math.ceil(N/g)),z=(b==null?void 0:b.columns)??[];return!y&&v?d.jsx(Qy,{}):d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Data"}),a&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-xs text-muted-foreground",children:a}),d.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[N.toLocaleString()," row",N!==1?"s":""]})]}),d.jsxs("select",{value:a??"",onChange:B=>{s(B.target.value||null),r(0),f("")},className:"h-7 rounded-md border border-border bg-background px-2 text-xs md:hidden",children:[d.jsx("option",{value:"",children:"Select table..."}),((y==null?void 0:y.tables)??[]).map(B=>d.jsxs("option",{value:B.name,children:[B.name," (",B.count,")"]},B.name))]}),a&&d.jsxs("div",{className:"ml-auto relative",children:[d.jsx(Ey,{className:"pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),d.jsx("input",{type:"search",value:u,onChange:B=>f(B.target.value),placeholder:"Filter rows...",className:"h-7 w-40 rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),d.jsxs("div",{className:"flex flex-1 min-h-0",children:[d.jsxs("div",{className:"hidden w-56 shrink-0 flex-col border-r border-border bg-muted/30 md:flex",children:[d.jsx("div",{className:"border-b px-3 py-2.5",children:d.jsxs("div",{className:"relative",children:[d.jsx(Ey,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),d.jsx("input",{type:"search",value:m,onChange:B=>p(B.target.value),placeholder:"Search tables...",className:"h-7 w-full rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:_.map(B=>d.jsxs("button",{type:"button",onClick:()=>{s(B.name),r(0),f("")},className:`flex w-full items-center justify-between px-3 py-1.5 text-xs transition-colors ${a===B.name?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[d.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[d.jsx(ac,{className:"h-3 w-3 shrink-0 opacity-50"}),d.jsx("span",{className:"truncate",children:B.name})]}),d.jsx("span",{className:"ml-2 shrink-0 font-mono text-[10px] tabular-nums opacity-60",children:B.count})]},B.name))})]}),d.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:a?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:S&&!b?d.jsx(Qy,{}):d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),z.map(B=>d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:B},B))]})}),d.jsx("tbody",{children:j.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:z.length+1,className:"py-12 text-center text-muted-foreground",children:u?"No matching rows":"Empty table"})}):j.map((B,P)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:i*g+P+1}),z.map(T=>d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:d.jsx(Wj,{value:B[T]})},T))]},P))})]})}),N>g&&d.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground",children:[d.jsxs("span",{className:"tabular-nums",children:[i*g+1,"–",Math.min((i+1)*g,N)," of"," ",N.toLocaleString()]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>r(i-1),disabled:i===0,children:d.jsx(Lb,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"px-1.5 tabular-nums",children:[i+1," / ",M]}),d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>r(i+1),disabled:i>=M-1,children:d.jsx(kb,{className:"h-3.5 w-3.5"})})]})]})]}):d.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:d.jsxs("div",{className:"text-center",children:[d.jsx(ac,{className:"mx-auto mb-2 h-8 w-8 opacity-30"}),d.jsx("p",{children:"Select a table to browse rows"})]})})})]})]})}function Wj({value:a}){if(a==null)return d.jsx("span",{className:"italic text-muted-foreground/40",children:"NULL"});const s=String(a);if(typeof a=="string"&&(s.startsWith("{")||s.startsWith("[")))try{const i=JSON.parse(s),r=Array.isArray(i)?`[${i.length}]`:`{${Object.keys(i).length}}`;return d.jsxs("details",{className:"cursor-pointer",children:[d.jsx("summary",{className:"text-muted-foreground hover:text-foreground",children:r}),d.jsx("pre",{className:"mt-1 max-h-48 overflow-auto rounded bg-muted p-2 text-[10px] leading-relaxed",children:JSON.stringify(i,null,2)})]})}catch{}return s.startsWith("<blob ")?d.jsx("span",{className:"italic text-muted-foreground/50",children:s}):s.length>120?d.jsxs("span",{className:"cursor-help",title:s,children:[s.slice(0,120),d.jsx("span",{className:"text-muted-foreground",children:"..."})]}):d.jsx(d.Fragment,{children:s})}function Qy(){return d.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function Ij(){const a=Ys(),{data:s,isLoading:i}=St({queryKey:["dashboard-jobs"],queryFn:Ue.jobs,refetchInterval:15e3,placeholderData:un}),r=Wn({mutationFn:Ue.reindex,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),u=Wn({mutationFn:Ue.startWatcher,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),f=Wn({mutationFn:Ue.stopWatcher,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),m=(s==null?void 0:s.repos)??[];return d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Jobs"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," repos"]})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col gap-4 py-4 md:gap-6 md:py-6",children:m.length===0?d.jsx("p",{className:"text-sm text-muted-foreground py-10 text-center",children:"No repos registered"}):d.jsx("div",{className:"grid gap-4 px-4 lg:px-6 @xl/main:grid-cols-2",children:m.map(p=>{var g;return d.jsxs(Pa,{children:[d.jsxs(Za,{className:"flex flex-row items-start justify-between pb-2",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium",children:p.name}),d.jsx("p",{className:"text-xs text-muted-foreground",children:ic(p.last_indexed_at)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{variant:"outline",size:"icon-xs",onClick:()=>r.mutate(p.id),disabled:r.isPending,title:"Re-index",children:d.jsx(Qb,{className:`h-3.5 w-3.5 ${r.isPending?"animate-spin":""}`})}),d.jsx(yt,{variant:"outline",size:"icon-xs",onClick:()=>(p.watcher.active?f:u).mutate(p.id),title:p.watcher.active?"Stop watcher":"Start watcher",children:p.watcher.active?d.jsx(Bb,{className:"h-3.5 w-3.5"}):d.jsx(qb,{className:"h-3.5 w-3.5"})})]})]}),d.jsxs(Fa,{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-muted-foreground",children:"Index"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Cs,{status:p.index_status}),p.is_stale&&d.jsx("span",{className:"text-xs text-warning font-medium",children:"stale"})]})]}),d.jsxs("p",{className:"text-xs font-mono text-muted-foreground",children:[((g=p.last_indexed_commit)==null?void 0:g.slice(0,8))??"—",p.current_head&&p.last_indexed_commit!==p.current_head&&d.jsxs("span",{children:[" → ",p.current_head.slice(0,8)]})]})]}),d.jsx(lr,{label:"Embeddings",value:p.embedded_count,max:p.embeddable_count}),d.jsx(lr,{label:"Purpose",value:p.purpose_count,max:p.purpose_total}),d.jsxs("div",{className:"flex items-center justify-between text-xs",children:[d.jsx("span",{className:"text-muted-foreground",children:"Watcher"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Cs,{status:p.watcher.active?"active":"inactive"}),p.watcher.changed_files>0&&d.jsxs("span",{className:"text-muted-foreground",children:[p.watcher.changed_files," pending"]})]})]})]})]},p.id)})})})]})}function eN(){var y;const[a,s]=U.useState(""),[i,r]=U.useState(""),{data:u}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,placeholderData:un}),f=Wn({mutationFn:()=>Ue.buildContext(a,i)}),m=(u==null?void 0:u.repos)??[];U.useEffect(()=>{!a&&m.length>0&&s(m[0].id)},[a,m]);const p=v=>{v.preventDefault(),!(!a||!i.trim())&&f.mutate()},g=(y=f.data)==null?void 0:y.stats;return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Context"})}),d.jsxs("div",{className:"flex flex-1 min-h-0 flex-col gap-3 py-3",children:[d.jsxs("form",{onSubmit:p,className:"shrink-0 flex flex-col gap-2 px-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("select",{value:a,onChange:v=>s(v.target.value),className:"h-8 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring",children:[d.jsx("option",{value:"",children:"Select repo..."}),m.map(v=>d.jsx("option",{value:v.id,children:v.name},v.id))]}),d.jsx("input",{type:"text",value:i,onChange:v=>r(v.target.value),placeholder:"Describe your goal... e.g. 'add user authentication'",className:"h-8 flex-1 rounded-md border border-border bg-background px-3 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),d.jsxs(yt,{type:"submit",size:"sm",className:"h-8 gap-1.5 text-xs",disabled:!a||!i.trim()||f.isPending,children:[f.isPending?d.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}):d.jsx(pd,{className:"h-3 w-3"}),"Query"]})]}),g&&d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[d.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 tabular-nums",children:[g.files_in_context," files"]}),d.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 tabular-nums",children:[g.duration_ms,"ms"]}),d.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5",children:g.cached?"cached":"fresh"}),!g.index_fresh&&d.jsx("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 text-destructive",children:"stale"})]})]}),f.isError&&d.jsx("div",{className:"shrink-0 mx-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f.error.message}),f.isPending?d.jsx("div",{className:"flex items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):f.data?d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsxs("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:["Context Pack",d.jsxs("span",{className:"ml-2 font-normal text-muted-foreground/60",children:[f.data.context_pack.split(`
|
|
230
|
+
*/const o_=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],c_=Be("trash-2",o_);function Gb(a){var s,i,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(s=0;s<u;s++)a[s]&&(i=Gb(a[s]))&&(r&&(r+=" "),r+=i)}else for(i in a)a[i]&&(r&&(r+=" "),r+=i);return r}function Vb(){for(var a,s,i=0,r="",u=arguments.length;i<u;i++)(a=arguments[i])&&(s=Gb(a))&&(r&&(r+=" "),r+=s);return r}const u_=(a,s)=>{const i=new Array(a.length+s.length);for(let r=0;r<a.length;r++)i[r]=a[r];for(let r=0;r<s.length;r++)i[a.length+r]=s[r];return i},f_=(a,s)=>({classGroupId:a,validator:s}),Yb=(a=new Map,s=null,i)=>({nextPart:a,validators:s,classGroupId:i}),lc="-",My=[],d_="arbitrary..",h_=a=>{const s=p_(a),{conflictingClassGroups:i,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return m_(m);const p=m.split(lc),g=p[0]===""&&p.length>1?1:0;return Kb(p,g,s)},getConflictingClassGroupIds:(m,p)=>{if(p){const g=r[m],y=i[m];return g?y?u_(y,g):g:y||My}return i[m]||My}}},Kb=(a,s,i)=>{if(a.length-s===0)return i.classGroupId;const u=a[s],f=i.nextPart.get(u);if(f){const y=Kb(a,s+1,f);if(y)return y}const m=i.validators;if(m===null)return;const p=s===0?a.join(lc):a.slice(s).join(lc),g=m.length;for(let y=0;y<g;y++){const v=m[y];if(v.validator(p))return v.classGroupId}},m_=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=a.slice(1,-1),i=s.indexOf(":"),r=s.slice(0,i);return r?d_+r:void 0})(),p_=a=>{const{theme:s,classGroups:i}=a;return g_(i,s)},g_=(a,s)=>{const i=Yb();for(const r in a){const u=a[r];Dd(u,i,r,s)}return i},Dd=(a,s,i,r)=>{const u=a.length;for(let f=0;f<u;f++){const m=a[f];y_(m,s,i,r)}},y_=(a,s,i,r)=>{if(typeof a=="string"){b_(a,s,i);return}if(typeof a=="function"){v_(a,s,i,r);return}x_(a,s,i,r)},b_=(a,s,i)=>{const r=a===""?s:Xb(s,a);r.classGroupId=i},v_=(a,s,i,r)=>{if(S_(a)){Dd(a(r),s,i,r);return}s.validators===null&&(s.validators=[]),s.validators.push(f_(i,a))},x_=(a,s,i,r)=>{const u=Object.entries(a),f=u.length;for(let m=0;m<f;m++){const[p,g]=u[m];Dd(g,Xb(s,p),i,r)}},Xb=(a,s)=>{let i=a;const r=s.split(lc),u=r.length;for(let f=0;f<u;f++){const m=r[f];let p=i.nextPart.get(m);p||(p=Yb(),i.nextPart.set(m,p)),i=p}return i},S_=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,__=a=>{if(a<1)return{get:()=>{},set:()=>{}};let s=0,i=Object.create(null),r=Object.create(null);const u=(f,m)=>{i[f]=m,s++,s>a&&(s=0,r=i,i=Object.create(null))};return{get(f){let m=i[f];if(m!==void 0)return m;if((m=r[f])!==void 0)return u(f,m),m},set(f,m){f in i?i[f]=m:u(f,m)}}},gd="!",Ay=":",j_=[],Oy=(a,s,i,r,u)=>({modifiers:a,hasImportantModifier:s,baseClassName:i,maybePostfixModifierPosition:r,isExternal:u}),N_=a=>{const{prefix:s,experimentalParseClassName:i}=a;let r=u=>{const f=[];let m=0,p=0,g=0,y;const v=u.length;for(let N=0;N<v;N++){const M=u[N];if(m===0&&p===0){if(M===Ay){f.push(u.slice(g,N)),g=N+1;continue}if(M==="/"){y=N;continue}}M==="["?m++:M==="]"?m--:M==="("?p++:M===")"&&p--}const b=f.length===0?u:u.slice(g);let S=b,_=!1;b.endsWith(gd)?(S=b.slice(0,-1),_=!0):b.startsWith(gd)&&(S=b.slice(1),_=!0);const j=y&&y>g?y-g:void 0;return Oy(f,_,S,j)};if(s){const u=s+Ay,f=r;r=m=>m.startsWith(u)?f(m.slice(u.length)):Oy(j_,!1,m,void 0,!0)}if(i){const u=r;r=f=>i({className:f,parseClassName:u})}return r},R_=a=>{const s=new Map;return a.orderSensitiveModifiers.forEach((i,r)=>{s.set(i,1e6+r)}),i=>{const r=[];let u=[];for(let f=0;f<i.length;f++){const m=i[f],p=m[0]==="[",g=s.has(m);p||g?(u.length>0&&(u.sort(),r.push(...u),u=[]),r.push(m)):u.push(m)}return u.length>0&&(u.sort(),r.push(...u)),r}},w_=a=>({cache:__(a.cacheSize),parseClassName:N_(a),sortModifiers:R_(a),...h_(a)}),C_=/\s+/,E_=(a,s)=>{const{parseClassName:i,getClassGroupId:r,getConflictingClassGroupIds:u,sortModifiers:f}=s,m=[],p=a.trim().split(C_);let g="";for(let y=p.length-1;y>=0;y-=1){const v=p[y],{isExternal:b,modifiers:S,hasImportantModifier:_,baseClassName:j,maybePostfixModifierPosition:N}=i(v);if(b){g=v+(g.length>0?" "+g:g);continue}let M=!!N,z=r(M?j.substring(0,N):j);if(!z){if(!M){g=v+(g.length>0?" "+g:g);continue}if(z=r(j),!z){g=v+(g.length>0?" "+g:g);continue}M=!1}const B=S.length===0?"":S.length===1?S[0]:f(S).join(":"),P=_?B+gd:B,T=P+z;if(m.indexOf(T)>-1)continue;m.push(T);const J=u(z,M);for(let te=0;te<J.length;++te){const V=J[te];m.push(P+V)}g=v+(g.length>0?" "+g:g)}return g},T_=(...a)=>{let s=0,i,r,u="";for(;s<a.length;)(i=a[s++])&&(r=Pb(i))&&(u&&(u+=" "),u+=r);return u},Pb=a=>{if(typeof a=="string")return a;let s,i="";for(let r=0;r<a.length;r++)a[r]&&(s=Pb(a[r]))&&(i&&(i+=" "),i+=s);return i},M_=(a,...s)=>{let i,r,u,f;const m=g=>{const y=s.reduce((v,b)=>b(v),a());return i=w_(y),r=i.cache.get,u=i.cache.set,f=p,p(g)},p=g=>{const y=r(g);if(y)return y;const v=E_(g,i);return u(g,v),v};return f=m,(...g)=>f(T_(...g))},A_=[],it=a=>{const s=i=>i[a]||A_;return s.isThemeGetter=!0,s},Zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,O_=/^\d+\/\d+$/,z_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,D_=/\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$/,L_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,k_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,U_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,js=a=>O_.test(a),je=a=>!!a&&!Number.isNaN(Number(a)),Aa=a=>!!a&&Number.isInteger(Number(a)),Zf=a=>a.endsWith("%")&&je(a.slice(0,-1)),Xn=a=>z_.test(a),B_=()=>!0,q_=a=>D_.test(a)&&!L_.test(a),Jb=()=>!1,H_=a=>k_.test(a),Q_=a=>U_.test(a),G_=a=>!le(a)&&!se(a),V_=a=>Ks(a,Ib,Jb),le=a=>Zb.test(a),pl=a=>Ks(a,ev,q_),Ff=a=>Ks(a,Z_,je),zy=a=>Ks(a,$b,Jb),Y_=a=>Ks(a,Wb,Q_),Bo=a=>Ks(a,tv,H_),se=a=>Fb.test(a),Fi=a=>Xs(a,ev),K_=a=>Xs(a,F_),Dy=a=>Xs(a,$b),X_=a=>Xs(a,Ib),P_=a=>Xs(a,Wb),qo=a=>Xs(a,tv,!0),Ks=(a,s,i)=>{const r=Zb.exec(a);return r?r[1]?s(r[1]):i(r[2]):!1},Xs=(a,s,i=!1)=>{const r=Fb.exec(a);return r?r[1]?s(r[1]):i:!1},$b=a=>a==="position"||a==="percentage",Wb=a=>a==="image"||a==="url",Ib=a=>a==="length"||a==="size"||a==="bg-size",ev=a=>a==="length",Z_=a=>a==="number",F_=a=>a==="family-name",tv=a=>a==="shadow",J_=()=>{const a=it("color"),s=it("font"),i=it("text"),r=it("font-weight"),u=it("tracking"),f=it("leading"),m=it("breakpoint"),p=it("container"),g=it("spacing"),y=it("radius"),v=it("shadow"),b=it("inset-shadow"),S=it("text-shadow"),_=it("drop-shadow"),j=it("blur"),N=it("perspective"),M=it("aspect"),z=it("ease"),B=it("animate"),P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],J=()=>[...T(),se,le],te=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],H=()=>[se,le,g],W=()=>[js,"full","auto",...H()],G=()=>[Aa,"none","subgrid",se,le],I=()=>["auto",{span:["full",Aa,se,le]},Aa,se,le],oe=()=>[Aa,"auto",se,le],pe=()=>["auto","min","max","fr",se,le],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...H()],F=()=>[js,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],Y=()=>[a,se,le],me=()=>[...T(),Dy,zy,{position:[se,le]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],C=()=>["auto","cover","contain",X_,V_,{size:[se,le]}],X=()=>[Zf,Fi,pl],$=()=>["","none","full",y,se,le],ee=()=>["",je,Fi,pl],he=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>[je,Zf,Dy,zy],Ze=()=>["","none",j,se,le],ze=()=>["none",je,se,le],_t=()=>["none",je,se,le],kt=()=>[je,se,le],dn=()=>[js,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xn],breakpoint:[Xn],color:[B_],container:[Xn],"drop-shadow":[Xn],ease:["in","out","in-out"],font:[G_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xn],shadow:[Xn],spacing:["px",je],text:[Xn],"text-shadow":[Xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",js,le,se,M]}],container:["container"],columns:[{columns:[je,le,se,p]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"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"],sr:["sr-only","not-sr-only"],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:J()}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:W()}],"inset-x":[{"inset-x":W()}],"inset-y":[{"inset-y":W()}],start:[{start:W()}],end:[{end:W()}],top:[{top:W()}],right:[{right:W()}],bottom:[{bottom:W()}],left:[{left:W()}],visibility:["visible","invisible","collapse"],z:[{z:[Aa,"auto",se,le]}],basis:[{basis:[js,"full","auto",p,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[je,js,"auto","initial","none",le]}],grow:[{grow:["",je,se,le]}],shrink:[{shrink:["",je,se,le]}],order:[{order:[Aa,"first","last","none",se,le]}],"grid-cols":[{"grid-cols":G()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":oe()}],"col-end":[{"col-end":oe()}],"grid-rows":[{"grid-rows":G()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":oe()}],"row-end":[{"row-end":oe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[p,"screen",...F()]}],"min-w":[{"min-w":[p,"screen","none",...F()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[m]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",i,Fi,pl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,se,Ff]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zf,le]}],"font-family":[{font:[K_,le,s]}],"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:[u,se,le]}],"line-clamp":[{"line-clamp":[je,"none",se,Ff]}],leading:[{leading:[f,...H()]}],"list-image":[{"list-image":["none",se,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[je,"from-font","auto",se,pl]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[je,"auto",se,le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:C()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Aa,se,le],radial:["",se,le],conic:[Aa,se,le]},P_,Y_]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[je,se,le]}],"outline-w":[{outline:["",je,Fi,pl]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",v,qo,Bo]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",b,qo,Bo]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[je,pl]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",S,qo,Bo]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[je,se,le]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[je]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[se,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[je]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:me()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:C()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,le]}],filter:[{filter:["","none",se,le]}],blur:[{blur:Ze()}],brightness:[{brightness:[je,se,le]}],contrast:[{contrast:[je,se,le]}],"drop-shadow":[{"drop-shadow":["","none",_,qo,Bo]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",je,se,le]}],"hue-rotate":[{"hue-rotate":[je,se,le]}],invert:[{invert:["",je,se,le]}],saturate:[{saturate:[je,se,le]}],sepia:[{sepia:["",je,se,le]}],"backdrop-filter":[{"backdrop-filter":["","none",se,le]}],"backdrop-blur":[{"backdrop-blur":Ze()}],"backdrop-brightness":[{"backdrop-brightness":[je,se,le]}],"backdrop-contrast":[{"backdrop-contrast":[je,se,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",je,se,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[je,se,le]}],"backdrop-invert":[{"backdrop-invert":["",je,se,le]}],"backdrop-opacity":[{"backdrop-opacity":[je,se,le]}],"backdrop-saturate":[{"backdrop-saturate":[je,se,le]}],"backdrop-sepia":[{"backdrop-sepia":["",je,se,le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[je,"initial",se,le]}],ease:[{ease:["linear","initial",z,se,le]}],delay:[{delay:[je,se,le]}],animate:[{animate:["none",B,se,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,se,le]}],"perspective-origin":[{"perspective-origin":J()}],rotate:[{rotate:ze()}],"rotate-x":[{"rotate-x":ze()}],"rotate-y":[{"rotate-y":ze()}],"rotate-z":[{"rotate-z":ze()}],scale:[{scale:_t()}],"scale-x":[{"scale-x":_t()}],"scale-y":[{"scale-y":_t()}],"scale-z":[{"scale-z":_t()}],"scale-3d":["scale-3d"],skew:[{skew:kt()}],"skew-x":[{"skew-x":kt()}],"skew-y":[{"skew-y":kt()}],transform:[{transform:[se,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:J()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:dn()}],"translate-x":[{"translate-x":dn()}],"translate-y":[{"translate-y":dn()}],"translate-z":[{"translate-z":dn()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",se,le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",se,le]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[je,Fi,pl,Ff]}],stroke:[{stroke:["none",...Y()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},$_=M_(J_);function Ye(...a){return $_(Vb(a))}function W_({healthy:a,title:s="LENS",subtitle:i="Workspace"}){return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:Ye("flex size-8! shrink-0 items-center justify-center rounded-lg text-xs font-semibold text-primary-foreground",a===!1?"bg-destructive":"bg-primary"),children:"L"}),d.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[d.jsx("span",{className:"truncate font-semibold",children:s}),d.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i})]})]})}const Ly=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,ky=Vb,nv=(a,s)=>i=>{var r;if((s==null?void 0:s.variants)==null)return ky(a,i==null?void 0:i.class,i==null?void 0:i.className);const{variants:u,defaultVariants:f}=s,m=Object.keys(u).map(y=>{const v=i==null?void 0:i[y],b=f==null?void 0:f[y];if(v===null)return null;const S=Ly(v)||Ly(b);return u[y][S]}),p=i&&Object.entries(i).reduce((y,v)=>{let[b,S]=v;return S===void 0||(y[b]=S),y},{}),g=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((y,v)=>{let{class:b,className:S,..._}=v;return Object.entries(_).every(j=>{let[N,M]=j;return Array.isArray(M)?M.includes({...f,...p}[N]):{...f,...p}[N]===M})?[...y,b,S]:y},[]);return ky(a,m,g,i==null?void 0:i.class,i==null?void 0:i.className)},I_=nv("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function yt({className:a,variant:s="default",size:i="default",...r}){return d.jsx("button",{"data-slot":"button","data-variant":s,"data-size":i,className:Ye(I_({variant:s,size:i,className:a})),...r})}function ej({className:a,orientation:s="horizontal",...i}){return d.jsx("div",{"data-slot":"separator","data-orientation":s,role:"separator",className:Ye("bg-border shrink-0",s==="horizontal"?"h-px w-full":"h-full w-px",a),...i})}const tj="16rem",nj="3rem",aj="b",av=U.createContext(null);function lv(){const a=U.useContext(av);if(!a)throw new Error("useSidebar must be used within SidebarProvider.");return a}function lj({defaultOpen:a=!0,className:s,style:i,children:r,...u}){const[f,m]=U.useState(a),p=U.useCallback(()=>m(v=>!v),[]);U.useEffect(()=>{const v=b=>{b.key===aj&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[p]);const g=f?"expanded":"collapsed",y=U.useMemo(()=>({state:g,open:f,setOpen:m,toggleSidebar:p}),[g,f,p]);return d.jsx(av.Provider,{value:y,children:d.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":tj,"--sidebar-width-icon":nj,...i},className:Ye("group/sidebar-wrapper flex min-h-svh w-full",s),...u,children:r})})}function sj({side:a="left",collapsible:s="icon",variant:i="default",className:r,children:u,...f}){const{state:m}=lv();return s==="none"?d.jsx("div",{"data-slot":"sidebar",className:Ye("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",r),...f,children:u}):d.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?s:"","data-side":a,"data-variant":i,"data-slot":"sidebar",children:[d.jsx("div",{"data-slot":"sidebar-gap",className:Ye("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),d.jsx("div",{"data-slot":"sidebar-container",className:Ye("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",a==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",i==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",r),...f,children:d.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-transparent flex h-full w-full flex-col py-2",children:u})})]})}function ij({className:a,onClick:s,...i}){const{toggleSidebar:r}=lv();return d.jsxs(yt,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:Ye("size-7",a),onClick:u=>{s==null||s(u),r()},...i,children:[d.jsx(I2,{}),d.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function rj({className:a,...s}){return d.jsx("main",{"data-slot":"sidebar-inset",className:Ye("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",a),...s})}function oj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Ye("flex flex-col gap-2 p-2",a),...s})}function cj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Ye("flex flex-col gap-2 p-2",a),...s})}function uj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Ye("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",a),...s})}function Jf({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Ye("relative flex w-full min-w-0 flex-col p-2",a),...s})}function fj({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:Ye("text-sidebar-foreground/70 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",a),...s})}function $f({className:a,...s}){return d.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Ye("w-full text-sm",a),...s})}function Ii({className:a,...s}){return d.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Ye("flex w-full min-w-0 flex-col gap-1",a),...s})}function er({className:a,...s}){return d.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Ye("group/menu-item relative",a),...s})}function ar({as:a="button",isActive:s=!1,size:i="default",className:r,children:u,...f}){return d.jsx(a,{...a==="button"?{type:"button"}:{},"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":s,className:Ye("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] duration-200 ease-linear","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground","disabled:pointer-events-none disabled:opacity-50","data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground","group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2","[&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",i==="sm"&&"h-7 text-xs",i==="default"&&"h-8 text-sm",i==="lg"&&"h-12 text-sm group-data-[collapsible=icon]:!p-0",r),...f,children:u})}function dj(){const[a,s]=U.useState(()=>{if(typeof window>"u")return!1;const i=localStorage.getItem("theme");return i==="dark"?!0:i==="light"?!1:document.documentElement.classList.contains("dark")});return U.useEffect(()=>{document.documentElement.classList.toggle("dark",a),localStorage.setItem("theme",a?"dark":"light")},[a]),[a,()=>s(i=>!i)]}function hj({variant:a="sidebar"}){const[s,i]=dj();return a==="button"?d.jsxs(yt,{variant:"ghost",size:"icon",className:"size-7",onClick:i,children:[s?d.jsx(Ty,{}):d.jsx(Cy,{}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]}):d.jsxs(ar,{onClick:i,children:[s?d.jsx(Ty,{}):d.jsx(Cy,{}),d.jsx("span",{children:s?"Light mode":"Dark mode"})]})}function mj({navItems:a,navGroups:s,currentPath:i,renderLink:r,brand:u={title:"LENS",subtitle:"Workspace"},healthy:f,footer:m,...p}){return d.jsxs(sj,{collapsible:"icon",className:"shadow-none",...p,children:[d.jsx(oj,{children:d.jsx(Ii,{children:d.jsx(er,{children:d.jsx(ar,{size:"lg",className:"hover:bg-transparent",children:d.jsx(W_,{healthy:f,title:u.title,subtitle:u.subtitle})})})})}),d.jsxs(uj,{children:[d.jsx(Jf,{children:d.jsx($f,{children:d.jsx(Ii,{children:a.map(({href:g,icon:y,label:v})=>{const b=g==="/"||g==="/dashboard"?i===g:i.startsWith(g);return d.jsx(er,{children:r({href:g,children:d.jsxs(ar,{isActive:b,children:[d.jsx(y,{}),d.jsx("span",{children:v})]})})},g)})})})}),s==null?void 0:s.map(g=>d.jsxs(Jf,{children:[d.jsx(fj,{children:g.label}),d.jsx($f,{children:d.jsx(Ii,{children:g.items.map(({href:y,icon:v,label:b})=>{const S=i.startsWith(y);return d.jsx(er,{children:r({href:y,children:d.jsxs(ar,{isActive:S,children:[d.jsx(v,{}),d.jsx("span",{children:b})]})})},y)})})})]},g.label)),d.jsx(Jf,{className:"mt-auto",children:d.jsx($f,{children:d.jsx(Ii,{children:d.jsx(er,{children:d.jsx(hj,{variant:"sidebar"})})})})})]}),m&&d.jsx(cj,{children:m})]})}function pj({user:a,onSignOut:s}){return d.jsx(Ii,{children:d.jsx(er,{children:d.jsxs(ar,{as:"div",size:"lg",children:[d.jsx(A2,{className:"!size-8 text-muted-foreground"}),d.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[d.jsx("span",{className:"truncate font-medium",children:a.name}),d.jsx("span",{className:"text-muted-foreground truncate text-xs",children:a.email})]}),s?d.jsx("button",{type:"button",onClick:s,className:"ml-auto rounded-md p-1 text-muted-foreground hover:text-foreground hover:bg-sidebar-accent",children:d.jsx(X2,{className:"size-4"})}):d.jsx(U2,{className:"ml-auto"})]})})})}function na({children:a}){return d.jsx("header",{className:"flex h-12 shrink-0 items-center border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/70",children:d.jsxs("div",{className:"flex w-full items-center gap-2 px-3",children:[d.jsx(ij,{}),d.jsx(ej,{orientation:"vertical",className:"data-[orientation=vertical]:h-4"}),d.jsx("div",{className:"flex flex-1 items-center gap-2 min-w-0",children:a})]})})}const gj=nv("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground",secondary:"bg-secondary text-secondary-foreground",destructive:"bg-destructive text-white dark:bg-destructive/60",outline:"border-border text-foreground"}},defaultVariants:{variant:"default"}});function yj({className:a,variant:s="default",...i}){return d.jsx("span",{"data-slot":"badge","data-variant":s,className:Ye(gj({variant:s}),a),...i})}function Pa({className:a,...s}){return d.jsx("div",{"data-slot":"card",className:Ye("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...s})}function Za({className:a,...s}){return d.jsx("div",{"data-slot":"card-header",className:Ye("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...s})}function Al({className:a,...s}){return d.jsx("div",{"data-slot":"card-title",className:Ye("leading-none font-semibold",a),...s})}function Fa({className:a,...s}){return d.jsx("div",{"data-slot":"card-content",className:Ye("px-6",a),...s})}function Uy(a,s){if(typeof a=="function")return a(s);a!=null&&(a.current=s)}function sv(...a){return s=>{let i=!1;const r=a.map(u=>{const f=Uy(u,s);return!i&&typeof f=="function"&&(i=!0),f});if(i)return()=>{for(let u=0;u<r.length;u++){const f=r[u];typeof f=="function"?f():Uy(a[u],null)}}}}function Ld(...a){return U.useCallback(sv(...a),a)}function bj(a,s=[]){let i=[];function r(f,m){const p=U.createContext(m),g=i.length;i=[...i,m];const y=b=>{var z;const{scope:S,children:_,...j}=b,N=((z=S==null?void 0:S[a])==null?void 0:z[g])||p,M=U.useMemo(()=>j,Object.values(j));return d.jsx(N.Provider,{value:M,children:_})};y.displayName=f+"Provider";function v(b,S){var N;const _=((N=S==null?void 0:S[a])==null?void 0:N[g])||p,j=U.useContext(_);if(j)return j;if(m!==void 0)return m;throw new Error(`\`${b}\` must be used within \`${f}\``)}return[y,v]}const u=()=>{const f=i.map(m=>U.createContext(m));return function(p){const g=(p==null?void 0:p[a])||f;return U.useMemo(()=>({[`__scope${a}`]:{...p,[a]:g}}),[p,g])}};return u.scopeName=a,[r,vj(u,...s)]}function vj(...a){const s=a[0];if(a.length===1)return s;const i=()=>{const r=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(f){const m=r.reduce((p,{useScope:g,scopeName:y})=>{const b=g(f)[`__scope${y}`];return{...p,...b}},{});return U.useMemo(()=>({[`__scope${s.scopeName}`]:m}),[m])}};return i.scopeName=s.scopeName,i}function By(a,s,{checkForDefaultPrevented:i=!0}={}){return function(u){if(a==null||a(u),i===!1||!u.defaultPrevented)return s==null?void 0:s(u)}}var sc=globalThis!=null&&globalThis.document?U.useLayoutEffect:()=>{},xj=B0[" useInsertionEffect ".trim().toString()]||sc;function Sj({prop:a,defaultProp:s,onChange:i=()=>{},caller:r}){const[u,f,m]=_j({defaultProp:s,onChange:i}),p=a!==void 0,g=p?a:u;{const v=U.useRef(a!==void 0);U.useEffect(()=>{const b=v.current;b!==p&&console.warn(`${r} is changing from ${b?"controlled":"uncontrolled"} to ${p?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=p},[p,r])}const y=U.useCallback(v=>{var b;if(p){const S=jj(v)?v(a):v;S!==a&&((b=m.current)==null||b.call(m,S))}else f(v)},[p,a,f,m]);return[g,y]}function _j({defaultProp:a,onChange:s}){const[i,r]=U.useState(a),u=U.useRef(i),f=U.useRef(s);return xj(()=>{f.current=s},[s]),U.useEffect(()=>{var m;u.current!==i&&((m=f.current)==null||m.call(f,i),u.current=i)},[i,u]),[i,r,f]}function jj(a){return typeof a=="function"}function Nj(a){const s=U.useRef({value:a,previous:a});return U.useMemo(()=>(s.current.value!==a&&(s.current.previous=s.current.value,s.current.value=a),s.current.previous),[a])}function Rj(a){const[s,i]=U.useState(void 0);return sc(()=>{if(a){i({width:a.offsetWidth,height:a.offsetHeight});const r=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const f=u[0];let m,p;if("borderBoxSize"in f){const g=f.borderBoxSize,y=Array.isArray(g)?g[0]:g;m=y.inlineSize,p=y.blockSize}else m=a.offsetWidth,p=a.offsetHeight;i({width:m,height:p})});return r.observe(a,{box:"border-box"}),()=>r.unobserve(a)}else i(void 0)},[a]),s}function wj(a,s){return U.useReducer((i,r)=>s[i][r]??i,a)}var iv=a=>{const{present:s,children:i}=a,r=Cj(s),u=typeof i=="function"?i({present:r.isPresent}):U.Children.only(i),f=Ld(r.ref,Ej(u));return typeof i=="function"||r.isPresent?U.cloneElement(u,{ref:f}):null};iv.displayName="Presence";function Cj(a){const[s,i]=U.useState(),r=U.useRef(null),u=U.useRef(a),f=U.useRef("none"),m=a?"mounted":"unmounted",[p,g]=wj(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U.useEffect(()=>{const y=Ho(r.current);f.current=p==="mounted"?y:"none"},[p]),sc(()=>{const y=r.current,v=u.current;if(v!==a){const S=f.current,_=Ho(y);a?g("MOUNT"):_==="none"||(y==null?void 0:y.display)==="none"?g("UNMOUNT"):g(v&&S!==_?"ANIMATION_OUT":"UNMOUNT"),u.current=a}},[a,g]),sc(()=>{if(s){let y;const v=s.ownerDocument.defaultView??window,b=_=>{const N=Ho(r.current).includes(CSS.escape(_.animationName));if(_.target===s&&N&&(g("ANIMATION_END"),!u.current)){const M=s.style.animationFillMode;s.style.animationFillMode="forwards",y=v.setTimeout(()=>{s.style.animationFillMode==="forwards"&&(s.style.animationFillMode=M)})}},S=_=>{_.target===s&&(f.current=Ho(r.current))};return s.addEventListener("animationstart",S),s.addEventListener("animationcancel",b),s.addEventListener("animationend",b),()=>{v.clearTimeout(y),s.removeEventListener("animationstart",S),s.removeEventListener("animationcancel",b),s.removeEventListener("animationend",b)}}else g("ANIMATION_END")},[s,g]),{isPresent:["mounted","unmountSuspended"].includes(p),ref:U.useCallback(y=>{r.current=y?getComputedStyle(y):null,i(y)},[])}}function Ho(a){return(a==null?void 0:a.animationName)||"none"}function Ej(a){var r,u;let s=(r=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:r.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?a.ref:(s=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}function Tj(a){const s=Mj(a),i=U.forwardRef((r,u)=>{const{children:f,...m}=r,p=U.Children.toArray(f),g=p.find(Oj);if(g){const y=g.props.children,v=p.map(b=>b===g?U.Children.count(y)>1?U.Children.only(null):U.isValidElement(y)?y.props.children:null:b);return d.jsx(s,{...m,ref:u,children:U.isValidElement(y)?U.cloneElement(y,void 0,v):null})}return d.jsx(s,{...m,ref:u,children:f})});return i.displayName=`${a}.Slot`,i}function Mj(a){const s=U.forwardRef((i,r)=>{const{children:u,...f}=i;if(U.isValidElement(u)){const m=Dj(u),p=zj(f,u.props);return u.type!==U.Fragment&&(p.ref=r?sv(r,m):m),U.cloneElement(u,p)}return U.Children.count(u)>1?U.Children.only(null):null});return s.displayName=`${a}.SlotClone`,s}var Aj=Symbol("radix.slottable");function Oj(a){return U.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===Aj}function zj(a,s){const i={...s};for(const r in s){const u=a[r],f=s[r];/^on[A-Z]/.test(r)?u&&f?i[r]=(...p)=>{const g=f(...p);return u(...p),g}:u&&(i[r]=u):r==="style"?i[r]={...u,...f}:r==="className"&&(i[r]=[u,f].filter(Boolean).join(" "))}return{...a,...i}}function Dj(a){var r,u;let s=(r=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:r.get,i=s&&"isReactWarning"in s&&s.isReactWarning;return i?a.ref:(s=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,i=s&&"isReactWarning"in s&&s.isReactWarning,i?a.props.ref:a.props.ref||a.ref)}var Lj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kd=Lj.reduce((a,s)=>{const i=Tj(`Primitive.${s}`),r=U.forwardRef((u,f)=>{const{asChild:m,...p}=u,g=m?i:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(g,{...p,ref:f})});return r.displayName=`Primitive.${s}`,{...a,[s]:r}},{}),fc="Checkbox",[kj]=bj(fc),[Uj,Ud]=kj(fc);function Bj(a){const{__scopeCheckbox:s,checked:i,children:r,defaultChecked:u,disabled:f,form:m,name:p,onCheckedChange:g,required:y,value:v="on",internal_do_not_use_render:b}=a,[S,_]=Sj({prop:i,defaultProp:u??!1,onChange:g,caller:fc}),[j,N]=U.useState(null),[M,z]=U.useState(null),B=U.useRef(!1),P=j?!!m||!!j.closest("form"):!0,T={checked:S,disabled:f,setChecked:_,control:j,setControl:N,name:p,form:m,value:v,hasConsumerStoppedPropagationRef:B,required:y,defaultChecked:Ja(u)?!1:u,isFormControl:P,bubbleInput:M,setBubbleInput:z};return d.jsx(Uj,{scope:s,...T,children:qj(b)?b(T):r})}var rv="CheckboxTrigger",ov=U.forwardRef(({__scopeCheckbox:a,onKeyDown:s,onClick:i,...r},u)=>{const{control:f,value:m,disabled:p,checked:g,required:y,setControl:v,setChecked:b,hasConsumerStoppedPropagationRef:S,isFormControl:_,bubbleInput:j}=Ud(rv,a),N=Ld(u,v),M=U.useRef(g);return U.useEffect(()=>{const z=f==null?void 0:f.form;if(z){const B=()=>b(M.current);return z.addEventListener("reset",B),()=>z.removeEventListener("reset",B)}},[f,b]),d.jsx(kd.button,{type:"button",role:"checkbox","aria-checked":Ja(g)?"mixed":g,"aria-required":y,"data-state":hv(g),"data-disabled":p?"":void 0,disabled:p,value:m,...r,ref:N,onKeyDown:By(s,z=>{z.key==="Enter"&&z.preventDefault()}),onClick:By(i,z=>{b(B=>Ja(B)?!0:!B),j&&_&&(S.current=z.isPropagationStopped(),S.current||z.stopPropagation())})})});ov.displayName=rv;var Bd=U.forwardRef((a,s)=>{const{__scopeCheckbox:i,name:r,checked:u,defaultChecked:f,required:m,disabled:p,value:g,onCheckedChange:y,form:v,...b}=a;return d.jsx(Bj,{__scopeCheckbox:i,checked:u,defaultChecked:f,disabled:p,required:m,onCheckedChange:y,name:r,form:v,value:g,internal_do_not_use_render:({isFormControl:S})=>d.jsxs(d.Fragment,{children:[d.jsx(ov,{...b,ref:s,__scopeCheckbox:i}),S&&d.jsx(dv,{__scopeCheckbox:i})]})})});Bd.displayName=fc;var cv="CheckboxIndicator",uv=U.forwardRef((a,s)=>{const{__scopeCheckbox:i,forceMount:r,...u}=a,f=Ud(cv,i);return d.jsx(iv,{present:r||Ja(f.checked)||f.checked===!0,children:d.jsx(kd.span,{"data-state":hv(f.checked),"data-disabled":f.disabled?"":void 0,...u,ref:s,style:{pointerEvents:"none",...a.style}})})});uv.displayName=cv;var fv="CheckboxBubbleInput",dv=U.forwardRef(({__scopeCheckbox:a,...s},i)=>{const{control:r,hasConsumerStoppedPropagationRef:u,checked:f,defaultChecked:m,required:p,disabled:g,name:y,value:v,form:b,bubbleInput:S,setBubbleInput:_}=Ud(fv,a),j=Ld(i,_),N=Nj(f),M=Rj(r);U.useEffect(()=>{const B=S;if(!B)return;const P=window.HTMLInputElement.prototype,J=Object.getOwnPropertyDescriptor(P,"checked").set,te=!u.current;if(N!==f&&J){const V=new Event("click",{bubbles:te});B.indeterminate=Ja(f),J.call(B,Ja(f)?!1:f),B.dispatchEvent(V)}},[S,N,f,u]);const z=U.useRef(Ja(f)?!1:f);return d.jsx(kd.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??z.current,required:p,disabled:g,name:y,value:v,form:b,...s,tabIndex:-1,ref:j,style:{...s.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});dv.displayName=fv;function qj(a){return typeof a=="function"}function Ja(a){return a==="indeterminate"}function hv(a){return Ja(a)?"indeterminate":a?"checked":"unchecked"}const Hj=U.forwardRef(({className:a,...s},i)=>d.jsx(Bd,{ref:i,"data-slot":"checkbox",className:Ye("peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary size-4 shrink-0 rounded-[4px] border shadow-xs cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...s,children:d.jsx(uv,{className:"flex items-center justify-center text-current",children:d.jsx(Xo,{className:"h-3.5 w-3.5"})})}));Hj.displayName=Bd.displayName;U.createContext({value:"",onChange:()=>{}});const Qj="";async function $e(a,s){const i=await fetch(`${Qj}${a}`,s);if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}const Ue={health:()=>$e("/health"),stats:()=>$e("/api/dashboard/stats"),repos:()=>$e("/api/dashboard/repos"),repo:a=>$e(`/api/dashboard/repos/${a}`),logs:a=>{const s=new URLSearchParams;a!=null&&a.limit&&s.set("limit",String(a.limit)),a!=null&&a.offset&&s.set("offset",String(a.offset)),a!=null&&a.method&&s.set("method",a.method),a!=null&&a.path&&s.set("path",a.path),a!=null&&a.status&&s.set("status",String(a.status)),a!=null&&a.source&&s.set("source",a.source);const i=s.toString();return $e(`/api/dashboard/logs${i?`?${i}`:""}`)},tables:()=>$e("/api/dashboard/tables"),tableRows:(a,s=50,i=0)=>$e(`/api/dashboard/tables/${encodeURIComponent(a)}?limit=${s}&offset=${i}`),jobs:()=>$e("/api/dashboard/jobs"),routes:()=>$e("/api/dashboard/routes"),reindex:a=>$e("/index/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a,force:!1})}),startWatcher:a=>$e("/index/watch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a})}),stopWatcher:a=>$e("/index/unwatch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a})}),buildContext:(a,s)=>$e("/context",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo_id:a,goal:s})}),registerRepo:(a,s)=>$e("/repo/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root_path:a,name:s})}),removeRepo:a=>$e(`/repo/${a}`,{method:"DELETE"}),localUsage:()=>$e("/api/dashboard/usage"),authStatus:()=>$e("/api/auth/status"),cloudUsageRange:(a,s)=>$e(`/api/cloud/usage?start=${a}&end=${s}`),cloudSubscription:()=>$e("/api/cloud/subscription"),cloudCheckout:(a="monthly")=>$e("/api/cloud/billing/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interval:a,return_url:window.location.href})}),cloudPortal:()=>$e(`/api/cloud/billing/portal?return_url=${encodeURIComponent(window.location.href)}`),refreshPlan:()=>$e("/api/dashboard/refresh-plan",{method:"POST"})},Gj=[{href:"/",icon:Y2,label:"Overview"},{href:"/repos",icon:Hb,label:"Repos"},{href:"/requests",icon:Db,label:"Requests"},{href:"/data",icon:ac,label:"Data"},{href:"/jobs",icon:Ub,label:"Jobs"},{href:"/context",icon:pd,label:"Context"}],Vj=[{label:"Cloud",items:[{href:"/usage",icon:w2,label:"Usage"},{href:"/billing",icon:D2,label:"Billing"}]}];function Yj(){var p,g;const s=Zt().location.pathname,r=((p=St({queryKey:["health"],queryFn:Ue.health,refetchInterval:1e4,placeholderData:un}).data)==null?void 0:p.status)==="ok",u=Ys(),f=St({queryKey:["auth-status"],queryFn:Ue.authStatus,placeholderData:un});U.useEffect(()=>{const y=new EventSource("/api/auth/events");return y.onmessage=()=>{u.invalidateQueries({queryKey:["auth-status"]}),Ue.refreshPlan().then(()=>{u.invalidateQueries({queryKey:["dashboard-usage"]}),u.invalidateQueries({queryKey:["cloud-subscription"]})}).catch(()=>{})},()=>y.close()},[u]),U.useEffect(()=>{const y=new EventSource("/api/repo/events");let v;return y.onmessage=()=>{clearTimeout(v),v=setTimeout(()=>{u.invalidateQueries({queryKey:["dashboard-repos"]}),u.invalidateQueries({queryKey:["dashboard-stats"]}),u.invalidateQueries({queryKey:["dashboard-jobs"]})},300)},()=>{clearTimeout(v),y.close()}},[u]);const m=(g=f.data)!=null&&g.authenticated?{name:f.data.email??"User",email:f.data.email??""}:{name:"Guest",email:"Run: lens login"};return d.jsxs(lj,{className:"bg-muted h-svh",children:[d.jsx(mj,{navItems:Gj,navGroups:Vj,currentPath:s,renderLink:({href:y,children:v})=>d.jsx(zd,{to:y,children:v}),healthy:r,footer:d.jsx(pj,{user:m})}),d.jsx(rj,{className:"bg-background rounded-xl overflow-hidden md:my-2 md:mr-2 md:border",children:d.jsx("div",{className:"@container/main flex min-h-0 flex-1 flex-col",children:d.jsx(Ob,{})})})]})}const qy={ready:"bg-success/15 text-success border-success/25",indexed:"bg-success/15 text-success border-success/25",indexing:"bg-warning/15 text-warning border-warning/25",pending:"bg-muted text-muted-foreground border-border",error:"bg-destructive/15 text-destructive border-destructive/25",active:"bg-success/15 text-success border-success/25",inactive:"bg-muted text-muted-foreground border-border"};function Cs({status:a,className:s}){const i=qy[a]??qy.pending;return d.jsx(yj,{variant:"outline",className:Ye("rounded-md px-2 py-0.5 text-[11px]",i,s),children:a})}function Kj(a){return a<1?"<1ms":a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(2)}s`}function ic(a){if(!a)return"never";const s=Date.now()-new Date(a+"Z").getTime(),i=Math.floor(s/1e3);if(i<60)return`${i}s ago`;const r=Math.floor(i/60);if(r<60)return`${r}m ago`;const u=Math.floor(r/60);return u<24?`${u}h ago`:`${Math.floor(u/24)}d ago`}function mv(){const a=uc(),{data:s,isLoading:i}=St({queryKey:["dashboard-stats"],queryFn:Ue.stats,refetchInterval:3e4,placeholderData:un}),{data:r}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,refetchInterval:3e4,placeholderData:un}),{data:u}=St({queryKey:["dashboard-usage"],queryFn:Ue.localUsage,refetchInterval:3e4}),f=((u==null?void 0:u.plan)??"free")==="pro";if(!s&&i)return d.jsx(Xj,{});const m=(s==null?void 0:s.uptime_seconds)??0,p=m<60?`${m}s`:m<3600?`${Math.floor(m/60)}m`:`${Math.floor(m/3600)}h ${Math.floor(m%3600/60)}m`,g="border-border/80 bg-muted/35 text-foreground/80",y=[{label:"Repos",value:(s==null?void 0:s.repos_count)??0,description:"Registered repositories",icon:Hb,iconClassName:g},{label:"Chunks",value:((s==null?void 0:s.total_chunks)??0).toLocaleString(),description:"Code segments across all repos",icon:i_,iconClassName:g},{label:"Embeddings",value:((s==null?void 0:s.total_embeddings)??0).toLocaleString(),description:"Chunks with vector embeddings stored locally",icon:Ub,iconClassName:g,pro:!0},{label:"Summaries",value:((s==null?void 0:s.total_summaries)??0).toLocaleString(),description:"Files with a purpose summary in local DB",icon:N2,iconClassName:g,pro:!0},{label:"Vocab",value:((s==null?void 0:s.total_vocab_clusters)??0).toLocaleString(),description:"Term clusters for concept expansion",icon:$2,iconClassName:g,pro:!0},{label:"DB Size",value:`${(s==null?void 0:s.db_size_mb)??0} MB`,description:"SQLite database",icon:ac,iconClassName:g},{label:"Uptime",value:p,description:"Daemon process",icon:Db,iconClassName:g}];return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Overview"})}),d.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto py-4 md:gap-6 md:py-6",children:[d.jsx("section",{className:"px-4 lg:px-6",children:d.jsxs("div",{className:"rounded-xl border border-border bg-background p-4",children:[d.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"System snapshot"}),d.jsx("p",{className:"mt-1 text-sm",children:"Live operational metrics for repositories and indexing throughput."})]})}),d.jsx("section",{className:"grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @3xl/main:grid-cols-4",children:y.map(v=>{const b=v.icon,S=v.pro&&!f;return d.jsxs(Pa,{className:`border-border bg-background py-4 shadow-none ${S?"opacity-60":""}`,children:[d.jsx(Za,{className:"pb-1",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:v.label}),S&&d.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"Pro"})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:S?"—":v.value})]}),d.jsx("span",{className:`rounded-md border p-1.5 ${v.iconClassName}`,children:d.jsx(b,{className:"h-4 w-4"})})]})}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-sm text-muted-foreground",children:v.description})})]},v.label)})}),(r==null?void 0:r.repos)&&r.repos.length>0&&d.jsxs("section",{className:"space-y-3 px-4 lg:px-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-sm font-semibold",children:"Repositories"}),d.jsx("p",{className:"text-xs text-muted-foreground",children:"Tracked codebases and index status"})]}),d.jsx(yt,{variant:"outline",size:"sm",onClick:()=>a({to:"/repos"}),children:"View all"})]}),d.jsx("div",{className:"grid gap-3 @xl/main:grid-cols-2 @5xl/main:grid-cols-3",children:r.repos.map(v=>d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsx(Za,{className:"pb-2",children:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx(Al,{className:"truncate text-sm",children:v.name}),d.jsx("p",{className:"truncate text-xs text-muted-foreground",children:v.root_path})]}),d.jsx(Cs,{status:v.index_status,className:"border-border bg-muted text-foreground"})]})}),d.jsxs(Fa,{className:"space-y-2",children:[d.jsxs("div",{className:"grid grid-cols-5 gap-2 text-xs",children:[d.jsxs("div",{className:"rounded-md border border-border bg-background px-2 py-1.5",children:[d.jsx("p",{className:"text-muted-foreground",children:"Files"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:v.files_indexed})]}),d.jsxs("div",{className:"rounded-md border border-border bg-background px-2 py-1.5",children:[d.jsx("p",{className:"text-muted-foreground",children:"Chunks"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:v.chunk_count})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Embed"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?`${v.embedded_pct}%`:"—"})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Summaries"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?`${v.purpose_count}/${v.purpose_total}`:"—"})]}),d.jsxs("div",{className:`rounded-md border border-border bg-background px-2 py-1.5 ${f?"":"opacity-40"}`,children:[d.jsx("p",{className:"text-muted-foreground",children:"Vocab"}),d.jsx("p",{className:"font-mono font-medium tabular-nums",children:f?v.vocab_cluster_count:"—"})]})]}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Indexed ",ic(v.last_indexed_at)]})]})]},v.id))})]})]})]})}function Xj(){return d.jsx("div",{className:"flex items-center justify-center py-20",children:d.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function lr({value:a,max:s,label:i,className:r}){const u=s>0?Math.round(a/s*100):0;return d.jsxs("div",{className:Ye("space-y-1",r),children:[i&&d.jsxs("div",{className:"flex items-center justify-between text-xs",children:[d.jsx("span",{className:"text-muted-foreground",children:i}),d.jsxs("span",{className:"font-mono text-muted-foreground",children:[a,"/",s," (",u,"%)"]})]}),d.jsx("div",{className:"h-2.5 w-full overflow-hidden rounded-full bg-muted",children:d.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${u}%`}})})]})}function Pj(){var J,te;const[a,s]=U.useState(null),[i,r]=U.useState(!1),[u,f]=U.useState(""),[m,p]=U.useState(null),g=Ys(),y=St({queryKey:["auth-status"],queryFn:Ue.authStatus}),{data:v}=St({queryKey:["cloud-usage-current"],queryFn:Ue.cloudUsageCurrent,enabled:!!((J=y.data)!=null&&J.authenticated)}),b=((v==null?void 0:v.plan)??"free")==="pro",{data:S,isLoading:_}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,refetchInterval:3e4,placeholderData:un}),j=Wn({mutationFn:Ue.reindex,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),N=Wn({mutationFn:Ue.startWatcher,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),M=Wn({mutationFn:Ue.stopWatcher,onSuccess:()=>g.invalidateQueries({queryKey:["dashboard-repos"]})}),z=Wn({mutationFn:V=>Ue.registerRepo(V),onSuccess:()=>{g.invalidateQueries({queryKey:["dashboard-repos"]}),r(!1),f("")}}),B=Wn({mutationFn:Ue.removeRepo,onSuccess:()=>{g.invalidateQueries({queryKey:["dashboard-repos"]}),p(null),s(null)}}),P=(S==null?void 0:S.repos)??[],T=a?P.find(V=>V.id===a):null;return T?d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsxs(yt,{variant:"ghost",size:"sm",onClick:()=>s(null),className:"gap-1 -ml-2",children:[d.jsx(_2,{className:"h-3.5 w-3.5"})," Back"]}),d.jsx("span",{className:"text-sm font-medium",children:T.name}),d.jsx("span",{className:"text-xs text-muted-foreground truncate hidden md:inline",children:T.root_path}),d.jsxs("div",{className:"ml-auto flex gap-2",children:[d.jsx(Qo,{onClick:()=>j.mutate(T.id),icon:Qb,label:"Re-index",loading:j.isPending}),T.watcher.active?d.jsx(Qo,{onClick:()=>M.mutate(T.id),icon:Bb,label:"Stop watcher"}):d.jsx(Qo,{onClick:()=>N.mutate(T.id),icon:qb,label:"Start watcher"}),m===T.id?d.jsxs(d.Fragment,{children:[d.jsx(yt,{variant:"destructive",size:"sm",onClick:()=>B.mutate(T.id),disabled:B.isPending,children:B.isPending?"Removing...":"Confirm"}),d.jsx(yt,{variant:"outline",size:"sm",onClick:()=>p(null),children:"Cancel"})]}):d.jsx(Qo,{onClick:()=>p(T.id),icon:c_,label:"Remove"})]})]}),d.jsxs("div",{className:"flex-1 min-h-0 overflow-auto grid gap-4 p-4 lg:p-6 @xl/main:grid-cols-2 content-start",children:[d.jsxs(Pa,{children:[d.jsx(Za,{className:"pb-2",children:d.jsx(Al,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Index"})}),d.jsx(Fa,{children:d.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[d.jsx(gl,{label:"Status",value:d.jsx(Cs,{status:T.index_status})}),d.jsx(gl,{label:"Last commit",value:((te=T.last_indexed_commit)==null?void 0:te.slice(0,8))??"—",mono:!0}),d.jsx(gl,{label:"Files",value:T.files_indexed}),d.jsx(gl,{label:"Chunks",value:T.chunk_count}),d.jsx(gl,{label:"Import depth",value:T.max_import_depth}),d.jsx(gl,{label:"Indexed",value:ic(T.last_indexed_at)})]})})]}),d.jsxs(Pa,{children:[d.jsx(Za,{className:"pb-2",children:d.jsx(Al,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Enrichment"})}),d.jsxs(Fa,{className:"space-y-3",children:[T.has_capabilities?d.jsxs(d.Fragment,{children:[d.jsx(lr,{label:"Embeddings",value:T.embedded_count,max:T.embeddable_count}),d.jsx(lr,{label:"Vocab clusters",value:T.vocab_cluster_count,max:T.vocab_cluster_count||1}),d.jsx(lr,{label:"Purpose",value:T.purpose_count,max:T.purpose_total})]}):d.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:[d.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"⚡ Pro — Embeddings · Vocab clusters · Summaries"}),d.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[d.jsx("code",{className:"text-[10px]",children:"lens login"})," → upgrade to enable"]})]}),d.jsxs("div",{className:"pt-1",children:[d.jsx(gl,{label:"Watcher",value:d.jsx(Cs,{status:T.watcher.active?"active":"inactive"})}),T.watcher.active&&T.watcher.changed_files>0&&d.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[T.watcher.changed_files," changed files pending"]})]})]})]})]})]}):d.jsxs(d.Fragment,{children:[d.jsx(na,{children:i?d.jsxs("form",{onSubmit:V=>{V.preventDefault(),u.trim()&&z.mutate(u.trim())},className:"flex flex-1 items-center gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(G2,{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),d.jsx("input",{type:"text",value:u,onChange:V=>f(V.target.value),placeholder:"/absolute/path/to/repo",className:"h-7 w-full rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0})]}),d.jsx(yt,{type:"submit",size:"sm",className:"h-7 text-xs",disabled:!u.trim()||z.isPending,children:z.isPending?"Registering...":"Register"}),d.jsx(yt,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{r(!1),f("")},children:"Cancel"}),z.isError&&d.jsx("span",{className:"text-xs text-destructive",children:z.error.message})]}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Repositories"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[P.length," total"]}),d.jsx("div",{className:"ml-auto",children:d.jsxs(yt,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>r(!0),children:[d.jsx(t_,{className:"h-3.5 w-3.5"}),"Register"]})})]})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Name"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Status"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Files"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Chunks"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Embed%"}),d.jsx("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Indexed"})]})}),d.jsx("tbody",{children:P.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:7,className:"py-12 text-center text-muted-foreground",children:"No repos registered. Run: lens repo register"})}):P.map((V,H)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:H+1}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx("button",{type:"button",onClick:()=>s(V.id),className:"text-primary hover:underline font-medium",children:V.name})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx(Cs,{status:V.index_status})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums",children:V.files_indexed}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums",children:V.chunk_count}),d.jsx("td",{className:`border-b border-r border-border px-3 py-1.5 font-mono text-right tabular-nums ${b?"":"opacity-40"}`,children:b?`${V.embedded_pct}%`:"—"}),d.jsx("td",{className:"border-b border-border px-3 py-1.5 text-muted-foreground",children:ic(V.last_indexed_at)})]},V.id))})]})})]})}function gl({label:a,value:s,mono:i}){return d.jsxs("div",{children:[d.jsx("p",{className:"text-xs text-muted-foreground",children:a}),d.jsx("div",{className:`text-sm font-medium ${i?"font-mono":""}`,children:s})]})}function Qo({onClick:a,icon:s,label:i,loading:r}){return d.jsxs(yt,{variant:"outline",size:"sm",onClick:a,disabled:r,className:"gap-1.5",children:[d.jsx(s,{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`}),i]})}const Zj={2:"text-success",3:"text-warning",4:"text-warning",5:"text-destructive"},Hy={cli:"bg-blue-500/15 text-blue-400",mcp:"bg-purple-500/15 text-purple-400",api:"bg-emerald-500/15 text-emerald-400",dashboard:"bg-amber-500/15 text-amber-400"};function Fj(){const[a,s]=U.useState(0),[i,r]=U.useState(""),u=100,{data:f,isLoading:m}=St({queryKey:["dashboard-logs",a,i],queryFn:()=>Ue.logs({limit:u,offset:a*u,source:i||void 0}),refetchInterval:15e3,placeholderData:un}),p=(f==null?void 0:f.total)??0,g=Math.max(1,Math.ceil(p/u)),y=(f==null?void 0:f.rows)??[];return d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Requests"}),(f==null?void 0:f.summary)&&d.jsxs("div",{className:"hidden items-center gap-2 text-xs text-muted-foreground md:flex",children:[d.jsxs("span",{className:"tabular-nums",children:[f.summary.total_today," today"]}),f.summary.by_source.map(v=>d.jsxs("span",{className:"tabular-nums",children:[d.jsx("span",{className:`inline-block rounded px-1 py-0.5 ${Hy[v.source]??""}`,children:v.source})," ",v.count]},v.source))]}),d.jsx("div",{className:"ml-auto",children:d.jsxs("select",{value:i,onChange:v=>{r(v.target.value),s(0)},className:"h-7 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring",children:[d.jsx("option",{value:"",children:"All sources"}),d.jsx("option",{value:"cli",children:"CLI"}),d.jsx("option",{value:"mcp",children:"MCP"}),d.jsx("option",{value:"api",children:"API"}),d.jsx("option",{value:"dashboard",children:"Dashboard"})]})})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:m&&!f?d.jsx(Jj,{}):d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Time"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Source"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Method"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Path"}),d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:"Status"}),d.jsx("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground text-right",children:"Duration"})]})}),d.jsx("tbody",{children:y.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:7,className:"py-12 text-center text-muted-foreground",children:"No requests logged yet"})}):y.map((v,b)=>{const S=new Date(v.created_at+"Z"),_=Zj[String(v.status)[0]]??"",j=Hy[v.source]??"";return d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:a*u+b+1}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono text-muted-foreground tabular-nums",children:S.toLocaleTimeString()}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5",children:d.jsx("span",{className:`inline-block rounded px-1.5 py-0.5 font-medium ${j}`,children:v.source})}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:v.method}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono max-w-xs truncate",children:v.path}),d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:d.jsx("span",{className:`font-medium ${_}`,children:v.status})}),d.jsx("td",{className:"border-b border-border px-3 py-1.5 font-mono text-right text-muted-foreground tabular-nums",children:Kj(v.duration_ms)})]},v.id)})})]})}),p>u&&d.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground",children:[d.jsxs("span",{className:"tabular-nums",children:[a*u+1,"–",Math.min((a+1)*u,p)," of"," ",p.toLocaleString()]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>s(a-1),disabled:a===0,children:d.jsx(Lb,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"px-1.5 tabular-nums",children:[a+1," / ",g]}),d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>s(a+1),disabled:a>=g-1,children:d.jsx(kb,{className:"h-3.5 w-3.5"})})]})]})]})}function Jj(){return d.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function $j(){const[a,s]=U.useState(null),[i,r]=U.useState(0),[u,f]=U.useState(""),[m,p]=U.useState(""),g=100,{data:y,isLoading:v}=St({queryKey:["dashboard-tables"],queryFn:Ue.tables,placeholderData:un}),{data:b,isLoading:S}=St({queryKey:["dashboard-table-rows",a,i],queryFn:()=>Ue.tableRows(a,g,i*g),enabled:!!a,placeholderData:un}),_=U.useMemo(()=>{const B=(y==null?void 0:y.tables)??[];if(!m)return B;const P=m.toLowerCase();return B.filter(T=>T.name.toLowerCase().includes(P))},[y,m]),j=U.useMemo(()=>{const B=(b==null?void 0:b.rows)??[];if(!u)return B;const P=u.toLowerCase();return B.filter(T=>Object.values(T).some(J=>J!=null&&String(J).toLowerCase().includes(P)))},[b,u]),N=u?j.length:(b==null?void 0:b.total)??0,M=Math.max(1,Math.ceil(N/g)),z=(b==null?void 0:b.columns)??[];return!y&&v?d.jsx(Qy,{}):d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Data"}),a&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-xs text-muted-foreground",children:a}),d.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:[N.toLocaleString()," row",N!==1?"s":""]})]}),d.jsxs("select",{value:a??"",onChange:B=>{s(B.target.value||null),r(0),f("")},className:"h-7 rounded-md border border-border bg-background px-2 text-xs md:hidden",children:[d.jsx("option",{value:"",children:"Select table..."}),((y==null?void 0:y.tables)??[]).map(B=>d.jsxs("option",{value:B.name,children:[B.name," (",B.count,")"]},B.name))]}),a&&d.jsxs("div",{className:"ml-auto relative",children:[d.jsx(Ey,{className:"pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),d.jsx("input",{type:"search",value:u,onChange:B=>f(B.target.value),placeholder:"Filter rows...",className:"h-7 w-40 rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),d.jsxs("div",{className:"flex flex-1 min-h-0",children:[d.jsxs("div",{className:"hidden w-56 shrink-0 flex-col border-r border-border bg-muted/30 md:flex",children:[d.jsx("div",{className:"border-b px-3 py-2.5",children:d.jsxs("div",{className:"relative",children:[d.jsx(Ey,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),d.jsx("input",{type:"search",value:m,onChange:B=>p(B.target.value),placeholder:"Search tables...",className:"h-7 w-full rounded-md border border-border bg-background pl-7 pr-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto py-1",children:_.map(B=>d.jsxs("button",{type:"button",onClick:()=>{s(B.name),r(0),f("")},className:`flex w-full items-center justify-between px-3 py-1.5 text-xs transition-colors ${a===B.name?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[d.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[d.jsx(ac,{className:"h-3 w-3 shrink-0 opacity-50"}),d.jsx("span",{className:"truncate",children:B.name})]}),d.jsx("span",{className:"ml-2 shrink-0 font-mono text-[10px] tabular-nums opacity-60",children:B.count})]},B.name))})]}),d.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:a?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:S&&!b?d.jsx(Qy,{}):d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),z.map(B=>d.jsx("th",{className:"border-b border-r border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:B},B))]})}),d.jsx("tbody",{children:j.length===0?d.jsx("tr",{children:d.jsx("td",{colSpan:z.length+1,className:"py-12 text-center text-muted-foreground",children:u?"No matching rows":"Empty table"})}):j.map((B,P)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-1.5 text-center font-mono text-[10px] text-muted-foreground tabular-nums",children:i*g+P+1}),z.map(T=>d.jsx("td",{className:"border-b border-r border-border px-3 py-1.5 font-mono",children:d.jsx(Wj,{value:B[T]})},T))]},P))})]})}),N>g&&d.jsxs("div",{className:"flex items-center justify-between border-t bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground",children:[d.jsxs("span",{className:"tabular-nums",children:[i*g+1,"–",Math.min((i+1)*g,N)," of"," ",N.toLocaleString()]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>r(i-1),disabled:i===0,children:d.jsx(Lb,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"px-1.5 tabular-nums",children:[i+1," / ",M]}),d.jsx(yt,{variant:"ghost",size:"icon-xs",onClick:()=>r(i+1),disabled:i>=M-1,children:d.jsx(kb,{className:"h-3.5 w-3.5"})})]})]})]}):d.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:d.jsxs("div",{className:"text-center",children:[d.jsx(ac,{className:"mx-auto mb-2 h-8 w-8 opacity-30"}),d.jsx("p",{children:"Select a table to browse rows"})]})})})]})]})}function Wj({value:a}){if(a==null)return d.jsx("span",{className:"italic text-muted-foreground/40",children:"NULL"});const s=String(a);if(typeof a=="string"&&(s.startsWith("{")||s.startsWith("[")))try{const i=JSON.parse(s),r=Array.isArray(i)?`[${i.length}]`:`{${Object.keys(i).length}}`;return d.jsxs("details",{className:"cursor-pointer",children:[d.jsx("summary",{className:"text-muted-foreground hover:text-foreground",children:r}),d.jsx("pre",{className:"mt-1 max-h-48 overflow-auto rounded bg-muted p-2 text-[10px] leading-relaxed",children:JSON.stringify(i,null,2)})]})}catch{}return s.startsWith("<blob ")?d.jsx("span",{className:"italic text-muted-foreground/50",children:s}):s.length>120?d.jsxs("span",{className:"cursor-help",title:s,children:[s.slice(0,120),d.jsx("span",{className:"text-muted-foreground",children:"..."})]}):d.jsx(d.Fragment,{children:s})}function Qy(){return d.jsx("div",{className:"flex flex-1 items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})})}function Ij(){const a=Ys(),{data:s,isLoading:i}=St({queryKey:["dashboard-jobs"],queryFn:Ue.jobs,refetchInterval:15e3,placeholderData:un}),r=Wn({mutationFn:Ue.reindex,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),u=Wn({mutationFn:Ue.startWatcher,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),f=Wn({mutationFn:Ue.stopWatcher,onSuccess:()=>a.invalidateQueries({queryKey:["dashboard-jobs"]})}),m=(s==null?void 0:s.repos)??[];return d.jsxs(d.Fragment,{children:[d.jsxs(na,{children:[d.jsx("span",{className:"text-sm font-medium",children:"Jobs"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," repos"]})]}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto flex flex-col gap-4 py-4 md:gap-6 md:py-6",children:m.length===0?d.jsx("p",{className:"text-sm text-muted-foreground py-10 text-center",children:"No repos registered"}):d.jsx("div",{className:"grid gap-4 px-4 lg:px-6 @xl/main:grid-cols-2",children:m.map(p=>{var g;return d.jsxs(Pa,{children:[d.jsxs(Za,{className:"flex flex-row items-start justify-between pb-2",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-medium",children:p.name}),d.jsx("p",{className:"text-xs text-muted-foreground",children:ic(p.last_indexed_at)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{variant:"outline",size:"icon-xs",onClick:()=>r.mutate(p.id),disabled:r.isPending,title:"Re-index",children:d.jsx(Qb,{className:`h-3.5 w-3.5 ${r.isPending?"animate-spin":""}`})}),d.jsx(yt,{variant:"outline",size:"icon-xs",onClick:()=>(p.watcher.active?f:u).mutate(p.id),title:p.watcher.active?"Stop watcher":"Start watcher",children:p.watcher.active?d.jsx(Bb,{className:"h-3.5 w-3.5"}):d.jsx(qb,{className:"h-3.5 w-3.5"})})]})]}),d.jsxs(Fa,{className:"space-y-4",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-xs text-muted-foreground",children:"Index"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Cs,{status:p.index_status}),p.is_stale&&d.jsx("span",{className:"text-xs text-warning font-medium",children:"stale"})]})]}),d.jsxs("p",{className:"text-xs font-mono text-muted-foreground",children:[((g=p.last_indexed_commit)==null?void 0:g.slice(0,8))??"—",p.current_head&&p.last_indexed_commit!==p.current_head&&d.jsxs("span",{children:[" → ",p.current_head.slice(0,8)]})]})]}),d.jsx(lr,{label:"Embeddings",value:p.embedded_count,max:p.embeddable_count}),d.jsx(lr,{label:"Purpose",value:p.purpose_count,max:p.purpose_total}),d.jsxs("div",{className:"flex items-center justify-between text-xs",children:[d.jsx("span",{className:"text-muted-foreground",children:"Watcher"}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Cs,{status:p.watcher.active?"active":"inactive"}),p.watcher.changed_files>0&&d.jsxs("span",{className:"text-muted-foreground",children:[p.watcher.changed_files," pending"]})]})]})]})]},p.id)})})})]})}function eN(){var y;const[a,s]=U.useState(""),[i,r]=U.useState(""),{data:u}=St({queryKey:["dashboard-repos"],queryFn:Ue.repos,placeholderData:un}),f=Wn({mutationFn:()=>Ue.buildContext(a,i)}),m=(u==null?void 0:u.repos)??[];U.useEffect(()=>{!a&&m.length>0&&s(m[0].id)},[a,m]);const p=v=>{v.preventDefault(),!(!a||!i.trim())&&f.mutate()},g=(y=f.data)==null?void 0:y.stats;return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Context"})}),d.jsxs("div",{className:"flex flex-1 min-h-0 flex-col gap-3 py-3",children:[d.jsxs("form",{onSubmit:p,className:"shrink-0 flex flex-col gap-2 px-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("select",{value:a,onChange:v=>s(v.target.value),className:"h-8 rounded-md border border-border bg-background px-2 text-xs focus:outline-none focus:ring-1 focus:ring-ring",children:[d.jsx("option",{value:"",children:"Select repo..."}),m.map(v=>d.jsx("option",{value:v.id,children:v.name},v.id))]}),d.jsx("input",{type:"text",value:i,onChange:v=>r(v.target.value),placeholder:"Describe your goal... e.g. 'add user authentication'",className:"h-8 flex-1 rounded-md border border-border bg-background px-3 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),d.jsxs(yt,{type:"submit",size:"sm",className:"h-8 gap-1.5 text-xs",disabled:!a||!i.trim()||f.isPending,children:[f.isPending?d.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}):d.jsx(pd,{className:"h-3 w-3"}),"Query"]})]}),g&&d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground",children:[d.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 tabular-nums",children:[g.files_in_context," files"]}),d.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 tabular-nums",children:[g.duration_ms,"ms"]}),d.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5",children:g.cached?"cached":"fresh"}),!g.index_fresh&&d.jsx("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 text-destructive",children:"stale"})]})]}),f.isError&&d.jsx("div",{className:"shrink-0 mx-3 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f.error.message}),f.isPending?d.jsx("div",{className:"flex items-center justify-center py-20",children:d.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):f.data?d.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:d.jsxs("table",{className:"w-full border-collapse text-xs",children:[d.jsx("thead",{className:"sticky top-0 z-10",children:d.jsxs("tr",{className:"bg-muted/60 text-left",children:[d.jsx("th",{className:"w-12 border-b border-r border-border bg-muted/60 px-2 py-2 text-center font-medium text-muted-foreground",children:"#"}),d.jsxs("th",{className:"border-b border-border bg-muted/60 px-3 py-2 font-medium text-muted-foreground",children:["Context Pack",d.jsxs("span",{className:"ml-2 font-normal text-muted-foreground/60",children:[f.data.context_pack.split(`
|
|
231
231
|
`).length," lines"]})]})]})}),d.jsx("tbody",{children:f.data.context_pack.split(`
|
|
232
|
-
`).map((v,b)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-0 text-center font-mono text-[10px] text-muted-foreground/50 tabular-nums select-none align-top leading-5",children:b+1}),d.jsx("td",{className:"border-b border-border px-3 py-0 font-mono leading-5 whitespace-pre-wrap break-all",children:v||" "})]},b))})]})}):d.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[d.jsx(pd,{className:"mb-2 h-6 w-6 opacity-30"}),d.jsx("p",{className:"text-xs",children:"Select a repo and describe your goal"})]})]})]})}function Ji({label:a,used:s,limit:i,locked:r,description:u}){if(r)return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none opacity-60",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"Pro"})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:"—"})]}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-xs text-muted-foreground",children:"Upgrade to Pro"})})]});if(!i||i<=0)return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:s.toLocaleString()})]}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-xs text-muted-foreground",children:"No quota (local only)"})})]});const f=Math.min(s/i*100,100),m=f>90?"bg-destructive":f>70?"bg-yellow-500":"bg-primary";return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsxs("p",{className:"text-xs text-muted-foreground/70 tabular-nums",children:[s.toLocaleString()," / ",i.toLocaleString()]})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:s.toLocaleString()})]}),d.jsxs(Fa,{className:"pt-0",children:[d.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:d.jsx("div",{className:`h-full rounded-full ${m}`,style:{width:`${f}%`}})}),u&&d.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground/60",children:u})]})]})}function tN(){const{data:a,isLoading:s}=St({queryKey:["dashboard-usage"],queryFn:Ue.localUsage,refetchInterval:1e4,placeholderData:un}),r=((a==null?void 0:a.plan)??"free")==="pro"||(a==null?void 0:a.has_capabilities)===!0,u=a==null?void 0:a.quota,f=a==null?void 0:a.today;return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Usage"})}),d.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto py-4 md:gap-6 md:py-6",children:[d.jsx("section",{className:"px-4 lg:px-6",children:d.jsxs("div",{className:"rounded-xl border border-border bg-background p-4",children:[d.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Today's usage"}),d.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Local counters",a!=null&&a.synced_at?` · last synced ${new Date(a.synced_at).toLocaleTimeString()}`:" · not synced"]})]})}),s||!f?d.jsx("div",{className:"flex items-center justify-center py-16",children:d.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):d.jsxs("section",{className:"grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @3xl/main:grid-cols-3",children:[d.jsx(Ji,{label:"Context Queries",used:f.context_queries}),d.jsx(Ji,{label:"Repos Indexed",used:f.repos_indexed}),d.jsx(Ji,{label:"Embedding Requests",used:f.embedding_requests,limit:u==null?void 0:u.embeddingRequests,locked:!r,description:"API calls to Voyage. Each batch = 1 request."}),d.jsx(Ji,{label:"Embedding Chunks",used:f.embedding_chunks,limit:u==null?void 0:u.embeddingChunks,locked:!r,description:"Code chunks sent for vector embedding."}),d.jsx(Ji,{label:"Purpose Summaries",used:f.purpose_requests,limit:u==null?void 0:u.purposeRequests,locked:!r,description:"API calls to generate file summaries. Re-indexing re-counts."})]})]})]})}function nN({children:a}){var i;const s=St({queryKey:["auth-status"],queryFn:Ue.authStatus,placeholderData:un});return!s.isLoading&&!((i=s.data)!=null&&i.authenticated)?d.jsx("div",{className:"flex flex-col items-center justify-center py-16 gap-4",children:d.jsxs("div",{className:"rounded-xl border bg-card p-8 text-center max-w-sm",children:[d.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Cloud Not Connected"}),d.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Authenticate with the LENS cloud to manage API keys, usage, and billing."}),d.jsx("code",{className:"mt-4 block rounded-lg bg-muted px-4 py-2 text-sm font-mono",children:"lens login"})]})}):d.jsx(d.Fragment,{children:a})}const Gy=["Everything in Free","Voyage embeddings","Purpose summaries","Vocab clusters"];function aN(){const[a,s]=U.useState(null),i=Ys();U.useEffect(()=>{new URLSearchParams(window.location.search).get("success")==="true"&&(Ue.refreshPlan().then(()=>{i.invalidateQueries({queryKey:["cloud-subscription"]}),i.invalidateQueries({queryKey:["dashboard-usage"]})}).catch(()=>{}),window.history.replaceState({},"",window.location.pathname))},[i]);const{data:r,isLoading:u}=St({queryKey:["cloud-subscription"],queryFn:Ue.cloudSubscription});if(u)return d.jsxs("div",{className:"space-y-8 animate-pulse",children:[d.jsxs("div",{children:[d.jsx("div",{className:"h-7 w-32 rounded bg-muted"}),d.jsx("div",{className:"mt-2 h-4 w-64 rounded bg-muted"})]}),d.jsx("div",{className:"rounded-xl border bg-card p-6",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("div",{className:"h-4 w-24 rounded bg-muted"}),d.jsx("div",{className:"mt-2 h-6 w-20 rounded bg-muted"})]}),d.jsx("div",{className:"h-7 w-16 rounded-full bg-muted"})]})}),d.jsxs("div",{children:[d.jsx("div",{className:"mb-4 h-4 w-28 rounded bg-muted"}),d.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[0,1,2].map(_=>d.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[d.jsx("div",{className:"h-5 w-20 rounded bg-muted"}),d.jsx("div",{className:"mt-3 h-8 w-16 rounded bg-muted"}),d.jsx("div",{className:"mt-4 space-y-2",children:[0,1,2].map(j=>d.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"},j))})]},_))})]})]});const f=r==null?void 0:r.subscription,m=(f==null?void 0:f.plan)??"free",p=(f==null?void 0:f.status)==="active",g=f!=null&&f.currentPeriodEnd?new Date(f.currentPeriodEnd).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):null;async function y(_){s(_);try{const j=await Ue.cloudCheckout(_);j.url&&(window.location.href=j.url)}finally{s(null)}}async function v(){s("portal");try{const _=await Ue.cloudPortal();_.url&&(window.location.href=_.url)}finally{s(null)}}const b=m==="free",S=m==="pro";return d.jsxs("div",{className:"space-y-8",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Billing"}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Manage your subscription and payment method."})]}),d.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Plan"}),d.jsxs("p",{className:"mt-1 text-xl font-bold capitalize",children:[m," ",S&&d.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"— $9/mo"})]})]}),d.jsx("div",{className:`inline-flex items-center rounded-full border px-3 py-1 ${p?"border-success/30 bg-success/10":"border-border bg-muted"}`,children:d.jsx("span",{className:`text-xs font-medium ${p?"text-success":"text-muted-foreground"}`,children:f!=null&&f.status?f.status.charAt(0).toUpperCase()+f.status.slice(1):"Active"})})]}),g&&d.jsx("div",{className:"mt-4 flex items-center gap-4 border-t pt-4",children:d.jsxs("p",{className:"text-sm text-muted-foreground",children:[f!=null&&f.cancelAtPeriodEnd?"Access until: ":"Next billing date: ",d.jsx("span",{className:"text-foreground",children:g})]})}),S&&(f==null?void 0:f.stripeCustomerId)&&d.jsx("div",{className:"mt-4 flex gap-3",children:d.jsx("button",{onClick:v,disabled:a!==null,className:"rounded-lg bg-secondary px-4 py-2 text-sm hover:bg-accent disabled:opacity-50",children:a==="portal"?"Loading...":"Manage Subscription"})})]}),d.jsxs("div",{children:[d.jsx("h3",{className:"mb-4 text-sm font-semibold",children:"Available Plans"}),d.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[d.jsxs("div",{className:`rounded-xl border p-6 ${b?"border-primary/50 ring-1 ring-primary/20":"border-border"} bg-card`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Free"}),b&&d.jsx("span",{className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary",children:"Current"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$0"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"forever"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:["Unlimited local context queries","TF-IDF + Import graph","MCP integration"].map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),S&&d.jsx("button",{onClick:v,disabled:a!==null,className:"mt-6 w-full rounded-lg bg-secondary py-2.5 text-sm font-medium hover:bg-accent disabled:opacity-50",children:a==="portal"?"Loading...":"Downgrade to Free"})]}),d.jsxs("div",{className:`rounded-xl border p-6 ${S?"border-primary/50 ring-1 ring-primary/20":"border-border"} bg-card`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Pro"}),S&&d.jsx("span",{className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary",children:"Current"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$9"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:Gy.map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),b&&d.jsx("button",{onClick:()=>y("monthly"),disabled:a!==null,className:"mt-6 w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:a==="monthly"?"Loading...":"Go Monthly"})]}),d.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Pro Yearly"}),d.jsx("span",{className:"rounded-full bg-success/15 px-2.5 py-0.5 text-xs font-semibold text-success",children:"Save 17%"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$90"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"/yr"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:Gy.map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),b&&d.jsx("button",{onClick:()=>y("yearly"),disabled:a!==null,className:"mt-6 w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:a==="yearly"?"Loading...":"Go Yearly"})]})]})]}),d.jsxs("a",{href:"mailto:support@lens.dev?subject=LENS Enterprise Inquiry",className:"flex items-center justify-between rounded-xl border border-border bg-card p-5 transition-colors hover:bg-accent",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold",children:"Enterprise"}),d.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Dedicated support, custom integrations, SLA guarantee"})]}),d.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[d.jsx(Z2,{className:"size-4"})," Contact Sales"]})]})]})}function lN(){return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("h1",{className:"text-sm font-semibold",children:"Billing"})}),d.jsx("main",{className:"flex-1 overflow-auto p-4 lg:p-6",children:d.jsx(nN,{children:d.jsx(aN,{})})})]})}const la=a2({component:Yj}),sN=aa({getParentRoute:()=>la,path:"/",component:mv}),iN=aa({getParentRoute:()=>la,path:"/repos",component:Pj}),rN=aa({getParentRoute:()=>la,path:"/requests",component:Fj}),oN=aa({getParentRoute:()=>la,path:"/data",component:$j}),cN=aa({getParentRoute:()=>la,path:"/jobs",component:Ij}),uN=aa({getParentRoute:()=>la,path:"/context",component:eN}),fN=aa({getParentRoute:()=>la,path:"/usage",component:tN}),dN=aa({getParentRoute:()=>la,path:"/billing",component:lN}),hN=la.addChildren([sN,iN,rN,oN,cN,uN,fN,dN]),mN=f2({routeTree:hN,basepath:"/dashboard",defaultNotFoundComponent:()=>d.jsx(mv,{})}),pN=new m1({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});Y0.createRoot(document.getElementById("root")).render(d.jsx(U.StrictMode,{children:d.jsx(p1,{client:pN,children:d.jsx(m2,{router:mN})})}));
|
|
232
|
+
`).map((v,b)=>d.jsxs("tr",{className:"group hover:bg-accent/30",children:[d.jsx("td",{className:"border-b border-r border-border bg-muted/20 px-2 py-0 text-center font-mono text-[10px] text-muted-foreground/50 tabular-nums select-none align-top leading-5",children:b+1}),d.jsx("td",{className:"border-b border-border px-3 py-0 font-mono leading-5 whitespace-pre-wrap break-all",children:v||" "})]},b))})]})}):d.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-muted-foreground",children:[d.jsx(pd,{className:"mb-2 h-6 w-6 opacity-30"}),d.jsx("p",{className:"text-xs",children:"Select a repo and describe your goal"})]})]})]})}function Ji({label:a,used:s,limit:i,locked:r,description:u}){if(r)return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none opacity-60",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"Pro"})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:"—"})]}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-xs text-muted-foreground",children:"Upgrade to Pro"})})]});if(!i||i<=0)return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:s.toLocaleString()})]}),d.jsx(Fa,{className:"pt-0",children:d.jsx("p",{className:"text-xs text-muted-foreground",children:"No quota (local only)"})})]});const f=Math.min(s/i*100,100),m=f>90?"bg-destructive":f>70?"bg-yellow-500":"bg-primary";return d.jsxs(Pa,{className:"border-border bg-background py-4 shadow-none",children:[d.jsxs(Za,{className:"pb-1",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a}),d.jsxs("p",{className:"text-xs text-muted-foreground/70 tabular-nums",children:[s.toLocaleString()," / ",i.toLocaleString()]})]}),d.jsx(Al,{className:"mt-1 text-2xl font-semibold tabular-nums",children:s.toLocaleString()})]}),d.jsxs(Fa,{className:"pt-0",children:[d.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-muted",children:d.jsx("div",{className:`h-full rounded-full ${m}`,style:{width:`${f}%`}})}),u&&d.jsx("p",{className:"mt-1.5 text-[10px] text-muted-foreground/60",children:u})]})]})}function tN(){const{data:a,isLoading:s}=St({queryKey:["dashboard-usage"],queryFn:Ue.localUsage,refetchInterval:1e4,placeholderData:un}),r=((a==null?void 0:a.plan)??"free")==="pro",u=a==null?void 0:a.quota,f=a==null?void 0:a.today;return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("span",{className:"text-sm font-medium",children:"Usage"})}),d.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-auto py-4 md:gap-6 md:py-6",children:[d.jsx("section",{className:"px-4 lg:px-6",children:d.jsxs("div",{className:"rounded-xl border border-border bg-background p-4",children:[d.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Today's usage"}),d.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Local counters",a!=null&&a.synced_at?` · last synced ${new Date(a.synced_at).toLocaleTimeString()}`:" · not synced"]})]})}),s||!f?d.jsx("div",{className:"flex items-center justify-center py-16",children:d.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):d.jsxs("section",{className:"grid grid-cols-1 gap-4 px-4 lg:px-6 @xl/main:grid-cols-2 @3xl/main:grid-cols-3",children:[d.jsx(Ji,{label:"Context Queries",used:f.context_queries}),d.jsx(Ji,{label:"Repos Indexed",used:f.repos_indexed}),d.jsx(Ji,{label:"Embedding Requests",used:f.embedding_requests,limit:u==null?void 0:u.embeddingRequests,locked:!r,description:"API calls to Voyage. Each batch = 1 request."}),d.jsx(Ji,{label:"Embedding Chunks",used:f.embedding_chunks,limit:u==null?void 0:u.embeddingChunks,locked:!r,description:"Code chunks sent for vector embedding."}),d.jsx(Ji,{label:"Purpose Summaries",used:f.purpose_requests,limit:u==null?void 0:u.purposeRequests,locked:!r,description:"API calls to generate file summaries. Re-indexing re-counts."})]})]})]})}function nN({children:a}){var i;const s=St({queryKey:["auth-status"],queryFn:Ue.authStatus,placeholderData:un});return!s.isLoading&&!((i=s.data)!=null&&i.authenticated)?d.jsx("div",{className:"flex flex-col items-center justify-center py-16 gap-4",children:d.jsxs("div",{className:"rounded-xl border bg-card p-8 text-center max-w-sm",children:[d.jsx("h2",{className:"text-lg font-semibold text-card-foreground",children:"Cloud Not Connected"}),d.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Authenticate with the LENS cloud to manage API keys, usage, and billing."}),d.jsx("code",{className:"mt-4 block rounded-lg bg-muted px-4 py-2 text-sm font-mono",children:"lens login"})]})}):d.jsx(d.Fragment,{children:a})}const Gy=["Everything in Free","Voyage embeddings","Purpose summaries","Vocab clusters"];function aN(){const[a,s]=U.useState(null),i=Ys();U.useEffect(()=>{new URLSearchParams(window.location.search).get("success")==="true"&&(Ue.refreshPlan().then(()=>{i.invalidateQueries({queryKey:["cloud-subscription"]}),i.invalidateQueries({queryKey:["dashboard-usage"]})}).catch(()=>{}),window.history.replaceState({},"",window.location.pathname))},[i]);const{data:r,isLoading:u}=St({queryKey:["cloud-subscription"],queryFn:Ue.cloudSubscription});if(u)return d.jsxs("div",{className:"space-y-8 animate-pulse",children:[d.jsxs("div",{children:[d.jsx("div",{className:"h-7 w-32 rounded bg-muted"}),d.jsx("div",{className:"mt-2 h-4 w-64 rounded bg-muted"})]}),d.jsx("div",{className:"rounded-xl border bg-card p-6",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("div",{className:"h-4 w-24 rounded bg-muted"}),d.jsx("div",{className:"mt-2 h-6 w-20 rounded bg-muted"})]}),d.jsx("div",{className:"h-7 w-16 rounded-full bg-muted"})]})}),d.jsxs("div",{children:[d.jsx("div",{className:"mb-4 h-4 w-28 rounded bg-muted"}),d.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[0,1,2].map(_=>d.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[d.jsx("div",{className:"h-5 w-20 rounded bg-muted"}),d.jsx("div",{className:"mt-3 h-8 w-16 rounded bg-muted"}),d.jsx("div",{className:"mt-4 space-y-2",children:[0,1,2].map(j=>d.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"},j))})]},_))})]})]});const f=r==null?void 0:r.subscription,m=(f==null?void 0:f.plan)??"free",p=(f==null?void 0:f.status)==="active",g=f!=null&&f.currentPeriodEnd?new Date(f.currentPeriodEnd).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}):null;async function y(_){s(_);try{const j=await Ue.cloudCheckout(_);j.url&&(window.location.href=j.url)}finally{s(null)}}async function v(){s("portal");try{const _=await Ue.cloudPortal();_.url&&(window.location.href=_.url)}finally{s(null)}}const b=m==="free",S=m==="pro";return d.jsxs("div",{className:"space-y-8",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Billing"}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Manage your subscription and payment method."})]}),d.jsxs("div",{className:"rounded-xl border bg-card p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Plan"}),d.jsxs("p",{className:"mt-1 text-xl font-bold capitalize",children:[m," ",S&&d.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"— $9/mo"})]})]}),d.jsx("div",{className:`inline-flex items-center rounded-full border px-3 py-1 ${p?"border-success/30 bg-success/10":"border-border bg-muted"}`,children:d.jsx("span",{className:`text-xs font-medium ${p?"text-success":"text-muted-foreground"}`,children:f!=null&&f.status?f.status.charAt(0).toUpperCase()+f.status.slice(1):"Active"})})]}),g&&d.jsx("div",{className:"mt-4 flex items-center gap-4 border-t pt-4",children:d.jsxs("p",{className:"text-sm text-muted-foreground",children:[f!=null&&f.cancelAtPeriodEnd?"Access until: ":"Next billing date: ",d.jsx("span",{className:"text-foreground",children:g})]})}),S&&(f==null?void 0:f.stripeCustomerId)&&d.jsx("div",{className:"mt-4 flex gap-3",children:d.jsx("button",{onClick:v,disabled:a!==null,className:"rounded-lg bg-secondary px-4 py-2 text-sm hover:bg-accent disabled:opacity-50",children:a==="portal"?"Loading...":"Manage Subscription"})})]}),d.jsxs("div",{children:[d.jsx("h3",{className:"mb-4 text-sm font-semibold",children:"Available Plans"}),d.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[d.jsxs("div",{className:`rounded-xl border p-6 ${b?"border-primary/50 ring-1 ring-primary/20":"border-border"} bg-card`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Free"}),b&&d.jsx("span",{className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary",children:"Current"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$0"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"forever"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:["Unlimited local context queries","TF-IDF + Import graph","MCP integration"].map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),S&&d.jsx("button",{onClick:v,disabled:a!==null,className:"mt-6 w-full rounded-lg bg-secondary py-2.5 text-sm font-medium hover:bg-accent disabled:opacity-50",children:a==="portal"?"Loading...":"Downgrade to Free"})]}),d.jsxs("div",{className:`rounded-xl border p-6 ${S?"border-primary/50 ring-1 ring-primary/20":"border-border"} bg-card`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Pro"}),S&&d.jsx("span",{className:"rounded-full bg-primary/10 px-2.5 py-0.5 text-xs font-medium text-primary",children:"Current"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$9"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:Gy.map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),b&&d.jsx("button",{onClick:()=>y("monthly"),disabled:a!==null,className:"mt-6 w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:a==="monthly"?"Loading...":"Go Monthly"})]}),d.jsxs("div",{className:"rounded-xl border border-border bg-card p-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h4",{className:"font-semibold",children:"Pro Yearly"}),d.jsx("span",{className:"rounded-full bg-success/15 px-2.5 py-0.5 text-xs font-semibold text-success",children:"Save 17%"})]}),d.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[d.jsx("span",{className:"text-3xl font-bold",children:"$90"}),d.jsx("span",{className:"text-sm text-muted-foreground",children:"/yr"})]}),d.jsx("ul",{className:"mt-4 space-y-2",children:Gy.map(_=>d.jsxs("li",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[d.jsx(Xo,{className:"size-4 text-success"})," ",_]},_))}),b&&d.jsx("button",{onClick:()=>y("yearly"),disabled:a!==null,className:"mt-6 w-full rounded-lg bg-primary py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:a==="yearly"?"Loading...":"Go Yearly"})]})]})]}),d.jsxs("a",{href:"mailto:support@lens.dev?subject=LENS Enterprise Inquiry",className:"flex items-center justify-between rounded-xl border border-border bg-card p-5 transition-colors hover:bg-accent",children:[d.jsxs("div",{children:[d.jsx("p",{className:"text-sm font-semibold",children:"Enterprise"}),d.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Dedicated support, custom integrations, SLA guarantee"})]}),d.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[d.jsx(Z2,{className:"size-4"})," Contact Sales"]})]})]})}function lN(){return d.jsxs(d.Fragment,{children:[d.jsx(na,{children:d.jsx("h1",{className:"text-sm font-semibold",children:"Billing"})}),d.jsx("main",{className:"flex-1 overflow-auto p-4 lg:p-6",children:d.jsx(nN,{children:d.jsx(aN,{})})})]})}const la=a2({component:Yj}),sN=aa({getParentRoute:()=>la,path:"/",component:mv}),iN=aa({getParentRoute:()=>la,path:"/repos",component:Pj}),rN=aa({getParentRoute:()=>la,path:"/requests",component:Fj}),oN=aa({getParentRoute:()=>la,path:"/data",component:$j}),cN=aa({getParentRoute:()=>la,path:"/jobs",component:Ij}),uN=aa({getParentRoute:()=>la,path:"/context",component:eN}),fN=aa({getParentRoute:()=>la,path:"/usage",component:tN}),dN=aa({getParentRoute:()=>la,path:"/billing",component:lN}),hN=la.addChildren([sN,iN,rN,oN,cN,uN,fN,dN]),mN=f2({routeTree:hN,basepath:"/dashboard",defaultNotFoundComponent:()=>d.jsx(mv,{})}),pN=new m1({defaultOptions:{queries:{refetchOnWindowFocus:!0,staleTime:5e3,retry:1}}});Y0.createRoot(document.getElementById("root")).render(d.jsx(U.StrictMode,{children:d.jsx(p1,{client:pN,children:d.jsx(m2,{router:mN})})}));
|
package/dashboard/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>LENS Dashboard</title>
|
|
7
|
-
<script type="module" crossorigin src="/dashboard/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/dashboard/assets/index-C5yTVR0F.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/dashboard/assets/index-DBbhNVGs.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="bg-background text-foreground antialiased">
|