@askdb/studio 0.2.0-beta.29 → 0.2.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{index-BgdvYJyR.js → index-1XBLPRR4.js} +9 -10
- package/dist/client/assets/index-D0tGkwqK.css +2 -0
- package/dist/client/index.html +2 -2
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/package.json +16 -16
- package/dist/client/assets/index-Bj6qGfT6.css +0 -2
|
@@ -52,7 +52,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
52
52
|
|
|
53
53
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
54
54
|
|
|
55
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return S.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Mc=`DialogDescriptionWarning`,Nc=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ac(Mc).contentName}}.`;return S.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Pc=ac,Fc=dc,Ic=pc,Lc=_c,Rc=Sc,zc=wc,Bc=Ec;function Vc(e){let[t,n]=S.useState(void 0);return Ea(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],a,o;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;n({width:a,height:o})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Hc=[`top`,`right`,`bottom`,`left`],Uc=Math.min,Wc=Math.max,Gc=Math.round,Kc=Math.floor,qc=e=>({x:e,y:e}),Jc={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Yc(e,t,n){return Wc(e,Uc(t,n))}function Xc(e,t){return typeof e==`function`?e(t):e}function Zc(e){return e.split(`-`)[0]}function Qc(e){return e.split(`-`)[1]}function $c(e){return e===`x`?`y`:`x`}function el(e){return e===`y`?`height`:`width`}function tl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function nl(e){return $c(tl(e))}function rl(e,t,n){n===void 0&&(n=!1);let r=Qc(e),a=nl(e),o=el(a),s=a===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[o]>t.floating[o]&&(s=fl(s)),[s,fl(s)]}function il(e){let t=fl(e);return[al(e),t,al(t)]}function al(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ol=[`left`,`right`],sl=[`right`,`left`],cl=[`top`,`bottom`],ll=[`bottom`,`top`];function ul(e,t,n){switch(e){case`top`:case`bottom`:return n?t?sl:ol:t?ol:sl;case`left`:case`right`:return t?cl:ll;default:return[]}}function dl(e,t,n,r){let a=Qc(e),o=ul(Zc(e),n===`start`,r);return a&&(o=o.map(e=>e+`-`+a),t&&(o=o.concat(o.map(al)))),o}function fl(e){let t=Zc(e);return Jc[t]+e.slice(t.length)}function pl(e){return{top:0,right:0,bottom:0,left:0,...e}}function ml(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pl(e)}function hl(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function gl(e,t,n){let{reference:r,floating:a}=e,o=tl(t),s=nl(t),c=el(s),l=Zc(t),u=o===`y`,d=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,p=r[c]/2-a[c]/2,m;switch(l){case`top`:m={x:d,y:r.y-a.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-a.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Qc(t)){case`start`:m[s]-=p*(n&&u?-1:1);break;case`end`:m[s]+=p*(n&&u?-1:1);break}return m}async function _l(e,t){t===void 0&&(t={});let{x:n,y:r,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=Xc(t,e),m=ml(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=hl(await a.getClippingRect({element:await(a.isElement==null?void 0:a.isElement(h))??!0?h:h.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:o.floating.width,height:o.floating.height}:o.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=hl(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var vl=50,yl=async(e,t,n)=>{let{placement:r=`bottom`,strategy:a=`absolute`,middleware:o=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:_l},l=await(s.isRTL==null?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=gl(u,r,l),p=r,m=0,h={};for(let n=0;n<o.length;n++){let g=o[n];if(!g)continue;let{name:_,fn:v}=g,{x:y,y:b,data:x,reset:S}=await v({x:d,y:f,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});d=y??d,f=b??f,h[_]={...h[_],...x},S&&m<vl&&(m++,typeof S==`object`&&(S.placement&&(p=S.placement),S.rects&&(u=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:d,y:f}=gl(u,p,l)),n=-1)}return{x:d,y:f,placement:p,strategy:a,middlewareData:h}},bl=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:s,elements:c,middlewareData:l}=t,{element:u,padding:d=0}=Xc(e,t)||{};if(u==null)return{};let f=ml(d),p={x:n,y:r},m=nl(a),h=el(m),g=await s.getDimensions(u),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=o.reference[h]+o.reference[m]-p[m]-o.floating[h],S=p[m]-o.reference[m],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u)),w=C?C[b]:0;(!w||!await(s.isElement==null?void 0:s.isElement(C)))&&(w=c.floating[b]||o.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Uc(f[v],E),ee=Uc(f[y],E),O=D,te=w-g[h]-ee,k=w/2-g[h]/2+T,A=Yc(O,k,te),ne=!l.arrow&&Qc(a)!=null&&k!==A&&o.reference[h]/2-(k<O?D:ee)-g[h]/2<0,j=ne?k<O?k-O:k-te:0;return{[m]:p[m]+j,data:{[m]:A,centerOffset:k-A-j,...ne&&{alignmentOffset:j}},reset:ne}}}),xl=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p=`bestFit`,fallbackAxisSideDirection:m=`none`,flipAlignment:h=!0,...g}=Xc(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let _=Zc(r),v=tl(s),y=Zc(s)===s,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=f||(y||!h?[fl(s)]:il(s)),S=m!==`none`;!f&&S&&x.push(...dl(s,h,m,b));let C=[s,...x],w=await c.detectOverflow(t,g),T=[],E=a.flip?.overflows||[];if(u&&T.push(w[_]),d){let e=rl(r,o,b);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=C[e];if(t&&(!(d===`alignment`&&v!==tl(t))||E.every(e=>tl(e.placement)===v?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(p){case`bestFit`:{let e=E.filter(e=>{if(S){let t=tl(e.placement);return t===v||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Sl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cl(e){return Hc.some(t=>e[t]>=0)}var wl=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:a=`referenceHidden`,...o}=Xc(e,t);switch(a){case`referenceHidden`:{let e=Sl(await r.detectOverflow(t,{...o,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cl(e)}}}case`escaped`:{let e=Sl(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cl(e)}}}default:return{}}}}},Tl=new Set([`left`,`top`]);async function El(e,t){let{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=Zc(n),c=Qc(n),l=tl(n)===`y`,u=Tl.has(s)?-1:1,d=o&&l?-1:1,f=Xc(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h==`number`&&(m=c===`end`?h*-1:h),l?{x:m*d,y:p*u}:{x:p*u,y:m*d}}var Dl=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:a,placement:o,middlewareData:s}=t,c=await El(t,e);return o===s.offset?.placement&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:r+c.x,y:a+c.y,data:{...c,placement:o}}}}},Ol=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:a,platform:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=Xc(e,t),d={x:n,y:r},f=await o.detectOverflow(t,u),p=tl(Zc(a)),m=$c(p),h=d[m],g=d[p];if(s){let e=m===`y`?`top`:`left`,t=m===`y`?`bottom`:`right`,n=h+f[e],r=h-f[t];h=Yc(n,h,r)}if(c){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=g+f[e],r=g-f[t];g=Yc(n,g,r)}let _=l.fn({...t,[m]:h,[p]:g});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[m]:s,[p]:c}}}}}},kl=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:a,rects:o,middlewareData:s}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Xc(e,t),d={x:n,y:r},f=tl(a),p=$c(f),m=d[p],h=d[f],g=Xc(c,t),_=typeof g==`number`?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){let e=p===`y`?`height`:`width`,t=o.reference[p]-o.floating[e]+_.mainAxis,n=o.reference[p]+o.reference[e]-_.mainAxis;m<t?m=t:m>n&&(m=n)}if(u){let e=p===`y`?`width`:`height`,t=Tl.has(Zc(a)),n=o.reference[f]-o.floating[e]+(t&&s.offset?.[f]||0)+(t?0:_.crossAxis),r=o.reference[f]+o.reference[e]+(t?0:s.offset?.[f]||0)-(t?_.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:m,[f]:h}}}},Al=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:a,rects:o,platform:s,elements:c}=t,{apply:l=()=>{},...u}=Xc(e,t),d=await s.detectOverflow(t,u),f=Zc(a),p=Qc(a),m=tl(a)===`y`,{width:h,height:g}=o.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=Uc(g-d[_],y),S=Uc(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=Wc(d.left,0),t=Wc(d.right,0),n=Wc(d.top,0),r=Wc(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:Wc(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:Wc(d.top,d.bottom))}await l({...t,availableWidth:T,availableHeight:w});let E=await s.getDimensions(c.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function jl(){return typeof window<`u`}function Ml(e){return Fl(e)?(e.nodeName||``).toLowerCase():`#document`}function Nl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pl(e){return((Fl(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fl(e){return jl()?e instanceof Node||e instanceof Nl(e).Node:!1}function Il(e){return jl()?e instanceof Element||e instanceof Nl(e).Element:!1}function Ll(e){return jl()?e instanceof HTMLElement||e instanceof Nl(e).HTMLElement:!1}function Rl(e){return!jl()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Nl(e).ShadowRoot}function zl(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=Kl(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!==`inline`&&a!==`contents`}function Bl(e){return/^(table|td|th)$/.test(Ml(e))}function Vl(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Hl=/transform|translate|scale|rotate|perspective|filter/,Ul=/paint|layout|strict|content/,H=e=>!!e&&e!==`none`,Wl;function U(e){let t=Il(e)?Kl(e):e;return H(t.transform)||H(t.translate)||H(t.scale)||H(t.rotate)||H(t.perspective)||!G()&&(H(t.backdropFilter)||H(t.filter))||Hl.test(t.willChange||``)||Ul.test(t.contain||``)}function W(e){let t=Jl(e);for(;Ll(t)&&!Gl(t);){if(U(t))return t;if(Vl(t))return null;t=Jl(t)}return null}function G(){return Wl??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Wl}function Gl(e){return/^(html|body|#document)$/.test(Ml(e))}function Kl(e){return Nl(e).getComputedStyle(e)}function ql(e){return Il(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jl(e){if(Ml(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Rl(e)&&e.host||Pl(e);return Rl(t)?t.host:t}function Yl(e){let t=Jl(e);return Gl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ll(t)&&zl(t)?t:Yl(t)}function Xl(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Yl(e),a=r===e.ownerDocument?.body,o=Nl(r);if(a){let e=Zl(o);return t.concat(o,o.visualViewport||[],zl(r)?r:[],e&&n?Xl(e):[])}else return t.concat(r,Xl(r,[],n))}function Zl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ql(e){let t=Kl(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=Ll(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:r,c=Gc(n)!==o||Gc(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function $l(e){return Il(e)?e:e.contextElement}function eu(e){let t=$l(e);if(!Ll(t))return qc(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=Ql(t),s=(o?Gc(n.width):n.width)/r,c=(o?Gc(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var tu=qc(0);function nu(e){let t=Nl(e);return!G()||!t.visualViewport?tu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ru(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nl(e)?!1:t}function iu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=$l(e),s=qc(1);t&&(r?Il(r)&&(s=eu(r)):s=eu(e));let c=ru(o,n,r)?nu(o):qc(0),l=(a.left+c.x)/s.x,u=(a.top+c.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){let e=Nl(o),t=r&&Il(r)?Nl(r):r,n=e,a=Zl(n);for(;a&&r&&t!==n;){let e=eu(a),t=a.getBoundingClientRect(),r=Kl(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=o,u+=s,n=Nl(a),a=Zl(n)}}return hl({width:d,height:f,x:l,y:u})}function au(e,t){let n=ql(e).scrollLeft;return t?t.left+n:iu(Pl(e)).left+n}function ou(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-au(e,n),y:n.top+t.scrollTop}}function su(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a===`fixed`,s=Pl(r),c=t?Vl(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=qc(1),d=qc(0),f=Ll(r);if((f||!f&&!o)&&((Ml(r)!==`body`||zl(s))&&(l=ql(r)),f)){let e=iu(r);u=eu(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=s&&!f&&!o?ou(s,l):qc(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function cu(e){return Array.from(e.getClientRects())}function lu(e){let t=Pl(e),n=ql(e),r=e.ownerDocument.body,a=Wc(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Wc(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+au(e),c=-n.scrollTop;return Kl(r).direction===`rtl`&&(s+=Wc(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:s,y:c}}var uu=25;function du(e,t){let n=Nl(e),r=Pl(e),a=n.visualViewport,o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(a){o=a.width,s=a.height;let e=G();(!e||e&&t===`fixed`)&&(c=a.offsetLeft,l=a.offsetTop)}let u=au(r);if(u<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),a=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-a);s<=uu&&(o-=s)}else u<=uu&&(o+=u);return{width:o,height:s,x:c,y:l}}function fu(e,t){let n=iu(e,!0,t===`fixed`),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Ll(e)?eu(e):qc(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:r*o.y}}function pu(e,t,n){let r;if(t===`viewport`)r=du(e,n);else if(t===`document`)r=lu(Pl(e));else if(Il(t))r=fu(t,n);else{let n=nu(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return hl(r)}function mu(e,t){let n=Jl(e);return n===t||!Il(n)||Gl(n)?!1:Kl(n).position===`fixed`||mu(n,t)}function hu(e,t){let n=t.get(e);if(n)return n;let r=Xl(e,[],!1).filter(e=>Il(e)&&Ml(e)!==`body`),a=null,o=Kl(e).position===`fixed`,s=o?Jl(e):e;for(;Il(s)&&!Gl(s);){let t=Kl(s),n=U(s);!n&&t.position===`fixed`&&(a=null),(o?!n&&!a:!n&&t.position===`static`&&a&&(a.position===`absolute`||a.position===`fixed`)||zl(s)&&!n&&mu(e,s))?r=r.filter(e=>e!==s):a=t,s=Jl(s)}return t.set(e,r),r}function gu(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,o=[...n===`clippingAncestors`?Vl(t)?[]:hu(t,this._c):[].concat(n),r],s=pu(t,o[0],a),c=s.top,l=s.right,u=s.bottom,d=s.left;for(let e=1;e<o.length;e++){let n=pu(t,o[e],a);c=Wc(n.top,c),l=Uc(n.right,l),u=Uc(n.bottom,u),d=Wc(n.left,d)}return{width:l-d,height:u-c,x:d,y:c}}function _u(e){let{width:t,height:n}=Ql(e);return{width:t,height:n}}function vu(e,t,n){let r=Ll(t),a=Pl(t),o=n===`fixed`,s=iu(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=qc(0);function u(){l.x=au(a)}if(r||!r&&!o)if((Ml(t)!==`body`||zl(a))&&(c=ql(t)),r){let e=iu(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&u();o&&!r&&a&&u();let d=a&&!r&&!o?ou(a,c):qc(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function yu(e){return Kl(e).position===`static`}function bu(e,t){if(!Ll(e)||Kl(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pl(e)===n&&(n=n.ownerDocument.body),n}function xu(e,t){let n=Nl(e);if(Vl(e))return n;if(!Ll(e)){let t=Jl(e);for(;t&&!Gl(t);){if(Il(t)&&!yu(t))return t;t=Jl(t)}return n}let r=bu(e,t);for(;r&&Bl(r)&&yu(r);)r=bu(r,t);return r&&Gl(r)&&yu(r)&&!U(r)?n:r||W(e)||n}var Su=async function(e){let t=this.getOffsetParent||xu,n=this.getDimensions,r=await n(e.floating);return{reference:vu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cu(e){return Kl(e).direction===`rtl`}var wu={convertOffsetParentRelativeRectToViewportRelativeRect:su,getDocumentElement:Pl,getClippingRect:gu,getOffsetParent:xu,getElementRects:Su,getClientRects:cu,getDimensions:_u,getScale:eu,isElement:Il,isRTL:Cu};function Tu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eu(e,t){let n=null,r,a=Pl(e);function o(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();let u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:m}=u;if(c||t(),!p||!m)return;let h=Kc(f),g=Kc(a.clientWidth-(d+p)),_=Kc(a.clientHeight-(f+m)),v=Kc(d),y={rootMargin:-h+`px `+-g+`px `+-_+`px `+-v+`px`,threshold:Wc(0,Uc(1,l))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==l){if(!b)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}n===1&&!Tu(u,e.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(x,{...y,root:a.ownerDocument})}catch{n=new IntersectionObserver(x,y)}n.observe(e)}return s(!0),o}function Du(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver==`function`,layoutShift:c=typeof IntersectionObserver==`function`,animationFrame:l=!1}=r,u=$l(e),d=a||o?[...u?Xl(u):[],...t?Xl(t):[]]:[];d.forEach(e=>{a&&e.addEventListener(`scroll`,n,{passive:!0}),o&&e.addEventListener(`resize`,n)});let f=u&&c?Eu(u,n):null,p=-1,m=null;s&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;(e=m)==null||e.observe(t)})),n()}),u&&!l&&m.observe(u),t&&m.observe(t));let h,g=l?iu(e):null;l&&_();function _(){let t=iu(e);g&&!Tu(g,t)&&n(),g=t,h=requestAnimationFrame(_)}return n(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener(`scroll`,n),o&&e.removeEventListener(`resize`,n)}),f?.(),(e=m)==null||e.disconnect(),m=null,l&&cancelAnimationFrame(h)}}var Ou=Dl,ku=Ol,Au=xl,ju=Al,Mu=wl,Nu=bl,Pu=kl,Fu=(e,t,n)=>{let r=new Map,a={platform:wu,...n},o={...a.platform,_c:r};return yl(e,t,{...a,platform:o})},Iu=typeof document<`u`?S.useLayoutEffect:function(){};function Lu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Lu(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){let n=a[r];if(!(n===`_owner`&&e.$$typeof)&&!Lu(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ru(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zu(e,t){let n=Ru(e);return Math.round(t*n)/n}function Bu(e){let t=S.useRef(e);return Iu(()=>{t.current=e}),t}function Vu(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:a,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=S.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=S.useState(r);Lu(p,r)||m(r);let[h,g]=S.useState(null),[_,v]=S.useState(null),y=S.useCallback(e=>{e!==w.current&&(w.current=e,g(e))},[]),b=S.useCallback(e=>{e!==T.current&&(T.current=e,v(e))},[]),x=o||h,C=s||_,w=S.useRef(null),T=S.useRef(null),E=S.useRef(d),D=l!=null,ee=Bu(l),O=Bu(a),te=Bu(u),k=S.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),Fu(w.current,T.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};A.current&&!Lu(E.current,t)&&(E.current=t,ha.flushSync(()=>{f(t)}))})},[p,t,n,O,te]);Iu(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let A=S.useRef(!1);Iu(()=>(A.current=!0,()=>{A.current=!1}),[]),Iu(()=>{if(x&&(w.current=x),C&&(T.current=C),x&&C){if(ee.current)return ee.current(x,C,k);k()}},[x,C,k,ee,D]);let ne=S.useMemo(()=>({reference:w,floating:T,setReference:y,setFloating:b}),[y,b]),j=S.useMemo(()=>({reference:x,floating:C}),[x,C]),re=S.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=zu(j.floating,d.x),r=zu(j.floating,d.y);return c?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ru(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,c,j.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:k,refs:ne,elements:j,floatingStyles:re}),[d,k,ne,j,re])}var Hu=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:a}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Nu({element:r.current,padding:a}).fn(n):r?Nu({element:r,padding:a}).fn(n):{}}}},Uu=(e,t)=>{let n=Ou(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wu=(e,t)=>{let n=ku(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gu=(e,t)=>({fn:Pu(e).fn,options:[e,t]}),Ku=(e,t)=>{let n=Au(e);return{name:n.name,fn:n.fn,options:[e,t]}},qu=(e,t)=>{let n=ju(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ju=(e,t)=>{let n=Mu(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yu=(e,t)=>{let n=Hu(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xu=`Arrow`,K=S.forwardRef((e,t)=>{let{children:n,width:r=10,height:a=5,...o}=e;return(0,L.jsx)(ga.svg,{...o,ref:t,width:r,height:a,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,L.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});K.displayName=Xu;var Zu=K,Qu=`Popper`,[$u,ed]=Ca(Qu),[td,nd]=$u(Qu),rd=e=>{let{__scopePopper:t,children:n}=e,[r,a]=S.useState(null),[o,s]=S.useState(void 0);return(0,L.jsx)(td,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:s,children:n})};rd.displayName=Qu;var id=`PopperAnchor`,ad=S.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=nd(id,n),s=S.useRef(null),c=o.onAnchorChange,l=ea(t,S.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=S.useRef(null);S.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&c(u.current)});let d=o.placementState&&hd(o.placementState),f=d?.[0],p=d?.[1];return r?null:(0,L.jsx)(ga.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});ad.displayName=id;var od=`PopperContent`,[sd,cd]=$u(od),ld=S.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u,collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=nd(od,n),[v,y]=S.useState(null),b=ea(t,e=>y(e)),[x,C]=S.useState(null),w=Vc(x),T=w?.width??0,E=w?.height??0,D=r+(o===`center`?``:`-`+o),ee=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=u?Array.isArray(u)?u:[u]:void 0,te=O!==void 0&&O.length>0,k={padding:ee,boundary:O?.filter(pd),altBoundary:te},{refs:A,floatingStyles:ne,placement:j,isPositioned:re,middlewareData:ie}=Vu({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Du(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[Uu({mainAxis:a+E,alignmentAxis:s}),l&&Wu({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Gu():void 0,...k}),l&&Ku({...k}),qu({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:a,height:o}=t.reference,s=e.floating.style;s.setProperty(`--radix-popper-available-width`,`${n}px`),s.setProperty(`--radix-popper-available-height`,`${r}px`),s.setProperty(`--radix-popper-anchor-width`,`${a}px`),s.setProperty(`--radix-popper-anchor-height`,`${o}px`)}}),x&&Yu({element:x,padding:c}),md({arrowWidth:T,arrowHeight:E}),p&&Ju({strategy:`referenceHidden`,...k})]}),M=_.setPlacementState;Ea(()=>(M(j),()=>{M(void 0)}),[j,M]);let[N,ae]=hd(j),oe=eo(h);Ea(()=>{re&&oe?.()},[re,oe]);let se=ie.arrow?.x,P=ie.arrow?.y,F=ie.arrow?.centerOffset!==0,[I,ce]=S.useState();return Ea(()=>{v&&ce(window.getComputedStyle(v).zIndex)},[v]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(sd,{scope:n,placedSide:N,placedAlign:ae,onArrowChange:C,arrowX:se,arrowY:P,shouldHideArrow:F,children:(0,L.jsx)(ga.div,{"data-side":N,"data-align":ae,...g,ref:b,style:{...g.style,animation:re?void 0:`none`}})})})});ld.displayName=od;var ud=`PopperArrow`,dd={top:`bottom`,right:`left`,bottom:`top`,left:`right`},fd=S.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,a=cd(ud,n),o=dd[a.placedSide];return(0,L.jsx)(`span`,{ref:a.onArrowChange,style:{position:`absolute`,left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[a.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[a.placedSide],visibility:a.shouldHideArrow?`hidden`:void 0},children:(0,L.jsx)(Zu,{...r,ref:t,style:{...r.style,display:`block`}})})});fd.displayName=ud;function pd(e){return e!==null}var md=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[l,u]=hd(n),d={start:`0%`,center:`50%`,end:`100%`}[u],f=(a.arrow?.x??0)+s/2,p=(a.arrow?.y??0)+c/2,m=``,h=``;return l===`bottom`?(m=o?d:`${f}px`,h=`${-c}px`):l===`top`?(m=o?d:`${f}px`,h=`${r.floating.height+c}px`):l===`right`?(m=`${-c}px`,h=o?d:`${p}px`):l===`left`&&(m=`${r.floating.width+c}px`,h=o?d:`${p}px`),{data:{x:m,y:h}}}});function hd(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var gd=rd,_d=ad,vd=ld,yd=fd,bd=`Separator`,xd=`horizontal`,Sd=[`horizontal`,`vertical`],Cd=S.forwardRef((e,t)=>{let{decorative:n,orientation:r=xd,...a}=e,o=wd(r)?r:xd,s=n?{role:`none`}:{"aria-orientation":o===`vertical`?o:void 0,role:`separator`};return(0,L.jsx)(ga.div,{"data-orientation":o,...s,...a,ref:t})});Cd.displayName=bd;function wd(e){return Sd.includes(e)}var Td=Cd,[q,Ed]=Ca(`Tooltip`,[ed]),Dd=ed(),Od=`TooltipProvider`,kd=700,Ad=`tooltip.open`,[jd,Md]=q(Od),Nd=e=>{let{__scopeTooltip:t,delayDuration:n=kd,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,s=S.useRef(!0),c=S.useRef(!1),l=S.useRef(0);return S.useEffect(()=>{let e=l.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(jd,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:S.useCallback(()=>{r<=0||(window.clearTimeout(l.current),s.current=!1)},[r]),onClose:S.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(e=>{c.current=e},[]),disableHoverableContent:a,children:o})};Nd.displayName=Od;var Pd=`Tooltip`,[Fd,Id]=q(Pd),Ld=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=Md(Pd,e.__scopeTooltip),u=Dd(t),[d,f]=S.useState(null),p=Ba(),m=S.useRef(0),h=s??l.disableHoverableContent,g=c??l.delayDuration,_=S.useRef(!1),[v,y]=Oa({prop:r,defaultProp:a??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ad))):l.onClose(),o?.(e)},caller:Pd}),b=S.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=S.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),C=S.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),w=S.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return S.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,L.jsx)(gd,{...u,children:(0,L.jsx)(Fd,{scope:t,contentId:p,open:v,stateAttribute:b,trigger:d,onTriggerChange:f,onTriggerEnter:S.useCallback(()=>{l.isOpenDelayedRef.current?w():x()},[l.isOpenDelayedRef,w,x]),onTriggerLeave:S.useCallback(()=>{h?C():(window.clearTimeout(m.current),m.current=0)},[C,h]),onOpen:x,onClose:C,disableHoverableContent:h,children:n})})};Ld.displayName=Pd;var Rd=`TooltipTrigger`,J=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=Id(Rd,n),o=Md(Rd,n),s=Dd(n),c=ea(t,S.useRef(null),a.onTriggerChange),l=S.useRef(!1),u=S.useRef(!1),d=S.useCallback(()=>l.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,L.jsx)(_d,{asChild:!0,...s,children:(0,L.jsx)(ga.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:Ta(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ta(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:Ta(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:Ta(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:Ta(e.onBlur,a.onClose),onClick:Ta(e.onClick,a.onClose)})})});J.displayName=Rd;var zd=`TooltipPortal`,[Bd,Vd]=q(zd,{forceMount:void 0}),Hd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=Id(zd,t);return(0,L.jsx)(Bd,{scope:t,forceMount:n,children:(0,L.jsx)(Ma,{present:n||o.open,children:(0,L.jsx)(jo,{asChild:!0,container:a,children:r})})})};Hd.displayName=zd;var Ud=`TooltipContent`,Wd=S.forwardRef((e,t)=>{let n=Vd(Ud,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a=`top`,...o}=e,s=Id(Ud,e.__scopeTooltip);return(0,L.jsx)(Ma,{present:r||s.open,children:s.disableHoverableContent?(0,L.jsx)(Yd,{side:a,...o,ref:t}):(0,L.jsx)(Gd,{side:a,...o,ref:t})})}),Gd=S.forwardRef((e,t)=>{let n=Id(Ud,e.__scopeTooltip),r=Md(Ud,e.__scopeTooltip),a=S.useRef(null),o=ea(t,a),[s,c]=S.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},a=$d(r,Qd(r,n.getBoundingClientRect())),o=ef(t.getBoundingClientRect());c(nf([...a,...o])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),a=!tf(n,s);r?p():a&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,L.jsx)(Yd,{...e,ref:o})}),[Kd,qd]=q(Pd,{isInside:!1}),Jd=ia(`TooltipContent`),Yd=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Id(Ud,n),u=Dd(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(Ad,d),()=>document.removeEventListener(Ad,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,L.jsx)(co,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(vd,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(Jd,{children:r}),(0,L.jsx)(Kd,{scope:n,isInside:!0,children:(0,L.jsx)(xa,{id:l.contentId,role:`tooltip`,children:a||r})})]})})});Wd.displayName=Ud;var Xd=`TooltipArrow`,Zd=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=Dd(n);return qd(Xd,n).isInside?null:(0,L.jsx)(yd,{...a,...r,ref:t})});Zd.displayName=Xd;function Qd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return`left`;case a:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function $d(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ef(e){let{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function tf(e,t){let{x:n,y:r}=e,a=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],c=t[o],l=s.x,u=s.y,d=c.x,f=c.y;u>r!=f>r&&n<(d-l)*(r-u)/(f-u)+l&&(a=!a)}return a}function nf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),rf(t)}function rf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var af=Nd,of=Ld,sf=J,cf=Hd,lf=Wd,uf=Zd,df=768;function ff(){let[e,t]=S.useState(()=>typeof window<`u`?window.innerWidth<df:void 0);return S.useEffect(()=>{let e=window.matchMedia(`(max-width: ${df-1}px)`),n=()=>{t(window.innerWidth<df)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),!!e}var pf=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},mf=(e,t)=>({classGroupId:e,validator:t}),hf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),gf=`-`,_f=[],vf=`arbitrary..`,yf=e=>{let t=Sf(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return xf(e);let n=e.split(gf);return bf(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];return t?a?pf(a,t):t:a||_f}return n[e]||_f}}},bf=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let n=bf(e,t+1,a);if(n)return n}let o=n.validators;if(o===null)return;let s=t===0?e.join(gf):e.slice(t).join(gf),c=o.length;for(let e=0;e<c;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},xf=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?vf+r:void 0})(),Sf=e=>{let{theme:t,classGroups:n}=e;return Cf(n,t)},Cf=(e,t)=>{let n=hf();for(let r in e){let a=e[r];wf(a,n,r,t)}return n},wf=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];Tf(a,t,n,r)}},Tf=(e,t,n,r)=>{if(typeof e==`string`){Ef(e,t,n);return}if(typeof e==`function`){Df(e,t,n,r);return}Of(e,t,n,r)},Ef=(e,t,n)=>{let r=e===``?t:kf(t,e);r.classGroupId=n},Df=(e,t,n,r)=>{if(Af(e)){wf(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(mf(n,e))},Of=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];wf(s,kf(t,o),n,r)}},kf=(e,t)=>{let n=e,r=t.split(gf),a=r.length;for(let e=0;e<a;e++){let t=r[e],a=n.nextPart.get(t);a||(a=hf(),n.nextPart.set(t,a)),n=a}return n},Af=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,jf=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return a(e,t),t},set(e,t){e in n?n[e]=t:a(e,t)}}},Mf=`!`,Nf=`:`,Pf=[],Ff=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),If=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,a=0,o,s=e.length;for(let c=0;c<s;c++){let s=e[c];if(n===0&&r===0){if(s===Nf){t.push(e.slice(a,c)),a=c+1;continue}if(s===`/`){o=c;continue}}s===`[`?n++:s===`]`?n--:s===`(`?r++:s===`)`&&r--}let c=t.length===0?e:e.slice(a),l=c,u=!1;c.endsWith(Mf)?(l=c.slice(0,-1),u=!0):c.startsWith(Mf)&&(l=c.slice(1),u=!0);let d=o&&o>a?o-a:void 0;return Ff(t,u,l,d)};if(t){let e=t+Nf,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ff(Pf,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Lf=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let a=0;a<e.length;a++){let o=e[a],s=o[0]===`[`,c=t.has(o);s||c?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(o)):r.push(o)}return r.length>0&&(r.sort(),n.push(...r)),n}},Rf=e=>({cache:jf(e.cacheSize),parseClassName:If(e),sortModifiers:Lf(e),postfixLookupClassGroupIds:zf(e),...yf(e)}),zf=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Bf=/\s+/,Vf=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:s}=t,c=[],l=e.trim().split(Bf),u=``;for(let e=l.length-1;e>=0;--e){let t=l[e],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}=n(t);if(d){u=t+(u.length>0?` `+u:u);continue}let g=!!h,_;if(g){_=r(m.substring(0,h));let e=_&&s[_]?r(m):void 0;e&&e!==_&&(_=e,g=!1)}else _=r(m);if(!_){if(!g){u=t+(u.length>0?` `+u:u);continue}if(_=r(m),!_){u=t+(u.length>0?` `+u:u);continue}g=!1}let v=f.length===0?``:f.length===1?f[0]:o(f).join(`:`),y=p?v+Mf:v,b=y+_;if(c.indexOf(b)>-1)continue;c.push(b);let x=a(_,g);for(let e=0;e<x.length;++e){let t=x[e];c.push(y+t)}u=t+(u.length>0?` `+u:u)}return u},Hf=(...e)=>{let t=0,n,r,a=``;for(;t<e.length;)(n=e[t++])&&(r=Uf(n))&&(a&&(a+=` `),a+=r);return a},Uf=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Uf(e[r]))&&(n&&(n+=` `),n+=t);return n},Wf=(e,...t)=>{let n,r,a,o,s=s=>(n=Rf(t.reduce((e,t)=>t(e),e())),r=n.cache.get,a=n.cache.set,o=c,c(s)),c=e=>{let t=r(e);if(t)return t;let o=Vf(e,n);return a(e,o),o};return o=s,(...e)=>o(Hf(...e))},Gf=[],Kf=e=>{let t=t=>t[e]||Gf;return t.isThemeGetter=!0,t},qf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Yf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xf=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zf=/\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$/,Qf=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$f=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ep=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tp=e=>Yf.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),np=e=>!!e&&Number.isInteger(Number(e)),rp=e=>e.endsWith(`%`)&&Y(e.slice(0,-1)),ip=e=>Xf.test(e),ap=()=>!0,op=e=>Zf.test(e)&&!Qf.test(e),sp=()=>!1,cp=e=>$f.test(e),lp=e=>ep.test(e),up=e=>!X(e)&&!Z(e),dp=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),fp=e=>Dp(e,jp,sp),X=e=>qf.test(e),pp=e=>Dp(e,Mp,op),mp=e=>Dp(e,Np,Y),hp=e=>Dp(e,Fp,ap),gp=e=>Dp(e,Pp,sp),_p=e=>Dp(e,kp,sp),vp=e=>Dp(e,Ap,lp),yp=e=>Dp(e,Ip,cp),Z=e=>Jf.test(e),bp=e=>Op(e,Mp),xp=e=>Op(e,Pp),Sp=e=>Op(e,kp),Cp=e=>Op(e,jp),wp=e=>Op(e,Ap),Tp=e=>Op(e,Ip,!0),Ep=e=>Op(e,Fp,!0),Dp=(e,t,n)=>{let r=qf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Op=(e,t,n=!1)=>{let r=Jf.exec(e);return r?r[1]?t(r[1]):n:!1},kp=e=>e===`position`||e===`percentage`,Ap=e=>e===`image`||e===`url`,jp=e=>e===`length`||e===`size`||e===`bg-size`,Mp=e=>e===`length`,Np=e=>e===`number`,Pp=e=>e===`family-name`,Fp=e=>e===`number`||e===`weight`,Ip=e=>e===`shadow`,Lp=Wf(()=>{let e=Kf(`color`),t=Kf(`font`),n=Kf(`text`),r=Kf(`font-weight`),a=Kf(`tracking`),o=Kf(`leading`),s=Kf(`breakpoint`),c=Kf(`container`),l=Kf(`spacing`),u=Kf(`radius`),d=Kf(`shadow`),f=Kf(`inset-shadow`),p=Kf(`text-shadow`),m=Kf(`drop-shadow`),h=Kf(`blur`),g=Kf(`perspective`),_=Kf(`aspect`),v=Kf(`ease`),y=Kf(`animate`),b=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],x=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],S=()=>[...x(),Z,X],C=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],w=()=>[`auto`,`contain`,`none`],T=()=>[Z,X,l],E=()=>[tp,`full`,`auto`,...T()],D=()=>[np,`none`,`subgrid`,Z,X],ee=()=>[`auto`,{span:[`full`,np,Z,X]},np,Z,X],O=()=>[np,`auto`,Z,X],te=()=>[`auto`,`min`,`max`,`fr`,Z,X],k=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ne=()=>[`auto`,...T()],j=()=>[tp,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...T()],re=()=>[tp,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...T()],ie=()=>[tp,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...T()],M=()=>[e,Z,X],N=()=>[...x(),Sp,_p,{position:[Z,X]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,Cp,fp,{size:[Z,X]}],se=()=>[rp,bp,pp],P=()=>[``,`none`,`full`,u,Z,X],F=()=>[``,Y,bp,pp],I=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[Y,rp,Sp,_p],ue=()=>[``,`none`,h,Z,X],de=()=>[`none`,Y,Z,X],fe=()=>[`none`,Y,Z,X],pe=()=>[Y,Z,X],me=()=>[tp,`full`,...T()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ip],breakpoint:[ip],color:[ap],container:[ip],"drop-shadow":[ip],ease:[`in`,`out`,`in-out`],font:[up],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ip],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ip],shadow:[ip],spacing:[`px`,Y],text:[ip],"text-shadow":[ip],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,tp,X,Z,_]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[dp],columns:[{columns:[Y,X,Z,c]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[np,`auto`,Z,X]}],basis:[{basis:[tp,`full`,`auto`,c,...T()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Y,tp,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,Y,Z,X]}],shrink:[{shrink:[``,Y,Z,X]}],order:[{order:[np,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...k(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...k()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:ne()}],mx:[{mx:ne()}],my:[{my:ne()}],ms:[{ms:ne()}],me:[{me:ne()}],mbs:[{mbs:ne()}],mbe:[{mbe:ne()}],mt:[{mt:ne()}],mr:[{mr:ne()}],mb:[{mb:ne()}],ml:[{ml:ne()}],"space-x":[{"space-x":T()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":T()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...re()]}],"min-inline-size":[{"min-inline":[`auto`,...re()]}],"max-inline-size":[{"max-inline":[`none`,...re()]}],"block-size":[{block:[`auto`,...ie()]}],"min-block-size":[{"min-block":[`auto`,...ie()]}],"max-block-size":[{"max-block":[`none`,...ie()]}],w:[{w:[c,`screen`,...j()]}],"min-w":[{"min-w":[c,`screen`,`none`,...j()]}],"max-w":[{"max-w":[c,`screen`,`none`,`prose`,{screen:[s]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,bp,pp]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ep,hp]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,rp,X]}],"font-family":[{font:[xp,gp,t]}],"font-features":[{"font-features":[X]}],"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:[a,Z,X]}],"line-clamp":[{"line-clamp":[Y,`none`,Z,mp]}],leading:[{leading:[o,...T()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[Y,`from-font`,`auto`,Z,pp]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Y,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:T()}],"tab-size":[{tab:[np,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],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`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},np,Z,X],radial:[``,Z,X],conic:[np,Z,X]},wp,vp]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Y,Z,X]}],"outline-w":[{outline:[``,Y,bp,pp]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,d,Tp,yp]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,f,Tp,yp]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Y,pp]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,p,Tp,yp]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Y,Z,X]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"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":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":x()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ue()}],brightness:[{brightness:[Y,Z,X]}],contrast:[{contrast:[Y,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,m,Tp,yp]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,Y,Z,X]}],"hue-rotate":[{"hue-rotate":[Y,Z,X]}],invert:[{invert:[``,Y,Z,X]}],saturate:[{saturate:[Y,Z,X]}],sepia:[{sepia:[``,Y,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Y,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[Y,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Y,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,Y,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[Y,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[Y,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,Y,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Y,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,v,Z,X]}],delay:[{delay:[Y,Z,X]}],animate:[{animate:[`none`,y,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[g,Z,X]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],zoom:[{zoom:[np,Z,X]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"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`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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`,Z,X]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[Y,bp,pp,mp]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return Lp(ii(e))}var Rp=si(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[1.5px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{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:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 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 gap-1.5 rounded-md 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 zp({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...a}){return(0,L.jsx)(r?na:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Q(Rp({variant:t,size:n,className:e})),...a})}function Bp({className:e,type:t,...n}){return(0,L.jsx)(`input`,{type:t,"data-slot":`input`,className:Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[1.5px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function Vp({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,L.jsx)(Td,{"data-slot":`separator`,decorative:n,orientation:t,className:Q(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function Hp({...e}){return(0,L.jsx)(Pc,{"data-slot":`sheet`,...e})}function Up({...e}){return(0,L.jsx)(Fc,{"data-slot":`sheet-portal`,...e})}function Wp({className:e,...t}){return(0,L.jsx)(Ic,{"data-slot":`sheet-overlay`,className:Q(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Gp({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...a}){return(0,L.jsxs)(Up,{children:[(0,L.jsx)(Wp,{}),(0,L.jsxs)(Lc,{"data-slot":`sheet-content`,className:Q(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,L.jsxs)(Bc,{className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,L.jsx)(Xi,{className:`size-4`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Kp({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sheet-header`,className:Q(`flex flex-col gap-1.5 p-4`,e),...t})}function qp({className:e,...t}){return(0,L.jsx)(Rc,{"data-slot":`sheet-title`,className:Q(`font-semibold text-foreground`,e),...t})}function Jp({className:e,...t}){return(0,L.jsx)(zc,{"data-slot":`sheet-description`,className:Q(`text-sm text-muted-foreground`,e),...t})}function Yp({delayDuration:e=0,...t}){return(0,L.jsx)(af,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Xp({...e}){return(0,L.jsx)(of,{"data-slot":`tooltip`,...e})}function Zp({...e}){return(0,L.jsx)(sf,{"data-slot":`tooltip-trigger`,...e})}function Qp({className:e,sideOffset:t=0,children:n,...r}){return(0,L.jsx)(cf,{children:(0,L.jsxs)(lf,{"data-slot":`tooltip-content`,sideOffset:t,className:Q(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,L.jsx)(uf,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var $p=`sidebar_state`,em=3600*24*7,tm=`16rem`,nm=`18rem`,rm=`3rem`,im=`b`,am=S.createContext(null);function om(){let e=S.use(am);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function sm({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:o,...s}){let c=ff(),[l,u]=S.useState(!1),[d,f]=S.useState(e),p=t??d,m=S.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${$p}=${t}; path=/; max-age=${em}`},[n,p]),h=S.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);S.useEffect(()=>{let e=e=>{e.key===im&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=S.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,L.jsx)(am.Provider,{value:_,children:(0,L.jsx)(Yp,{delayDuration:0,children:(0,L.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":tm,"--sidebar-width-icon":rm,...a},className:Q(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...s,children:o})})})}function cm({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=om();return n===`none`?(0,L.jsx)(`div`,{"data-slot":`sidebar`,className:Q(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:a}):s?(0,L.jsx)(Hp,{open:l,onOpenChange:u,...o,children:(0,L.jsxs)(Gp,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":nm},side:e,children:[(0,L.jsxs)(Kp,{className:`sr-only`,children:[(0,L.jsx)(qp,{children:`Sidebar`}),(0,L.jsx)(Jp,{children:`Displays the mobile sidebar.`})]}),(0,L.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:a})]})}):(0,L.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,L.jsx)(`div`,{"data-slot":`sidebar-gap`,className:Q(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,L.jsx)(`div`,{"data-slot":`sidebar-container`,className:Q(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`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)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,L.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm`,children:a})})]})}function lm({className:e,onClick:t,...n}){let{toggleSidebar:r}=om();return(0,L.jsxs)(zp,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon`,className:Q(`size-7`,e),onClick:e=>{t?.(e),r()},...n,children:[(0,L.jsx)(z,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function um({className:e,...t}){return(0,L.jsx)(`main`,{"data-slot":`sidebar-inset`,className:Q(`relative flex w-full flex-1 flex-col bg-background`,`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`,e),...t})}function dm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:Q(`flex flex-col gap-2 p-2`,e),...t})}function fm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:Q(`flex flex-col gap-2 p-2`,e),...t})}function pm({className:e,...t}){return(0,L.jsx)(Vp,{"data-slot":`sidebar-separator`,"data-sidebar":`separator`,className:Q(`mx-2 w-auto bg-sidebar-border`,e),...t})}function mm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:Q(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function hm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:Q(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function gm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:Q(`w-full text-sm`,e),...t})}function _m({className:e,...t}){return(0,L.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:Q(`flex w-full min-w-0 flex-col gap-1`,e),...t})}function vm({className:e,...t}){return(0,L.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:Q(`group/menu-item relative`,e),...t})}var ym=si(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function bm({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:a,className:o,...s}){let c=e?na:`button`,{isMobile:l,state:u}=om(),d=(0,L.jsx)(c,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:Q(ym({variant:n,size:r}),o),...s});return a?(typeof a==`string`&&(a={children:a}),(0,L.jsxs)(Xp,{children:[(0,L.jsx)(Zp,{asChild:!0,children:d}),(0,L.jsx)(Qp,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...a})]})):d}function xm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-menu-badge`,"data-sidebar":`menu-badge`,className:Q(`pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t})}function Sm(){let e=rt(),{workspace:t,dirty:n}=Or(),{ragStatus:r}=Vr(),a=Cm(e.pathname),o=r?.hasIndex&&!r.stale;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`crumbs`,children:[a.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0&&(0,L.jsx)(`span`,{className:`sep`,style:{marginRight:8},children:`/`}),(0,L.jsx)(`span`,{className:t===a.length-1?`crumb cur`:`crumb`,children:e})]},e)),n&&(0,L.jsxs)(`span`,{className:`pill warn`,style:{marginLeft:8},children:[(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--amber-500)`}}),`Unsaved changes`]}),!n&&t&&a.some(e=>e===`Enrichment`||e===`Schema`)&&(0,L.jsxs)(`span`,{className:`pill ok`,style:{marginLeft:8},children:[(0,L.jsx)(vi,{size:10}),`Saved`]})]}),(0,L.jsxs)(`div`,{className:`right`,children:[(0,L.jsxs)(`div`,{className:`cmd-palette`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`span`,{style:{flex:1},children:`Search tables, concepts, queries…`}),(0,L.jsx)(`span`,{className:`kbd`,children:`⌘K`})]}),r&&(0,L.jsxs)(`span`,{className:`pill ${o?`ok`:`warn`}`,children:[(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:o?`var(--green-500)`:`var(--amber-500)`}}),o?`Index fresh`:r.hasIndex?`Index stale`:`No index`]})]})]})}function Cm(e){let t=e.split(`/`).filter(Boolean);if(t.length===0)return[`Overview`];let n=t[0],r=[];switch(n){case`overview`:r.push(`Overview`);break;case`tables`:r.push(`Tables`),t[1]&&r.push(t[1]),t[2]&&r.push(t[2]),t[3]&&r.push(wm(t[3]));break;case`concepts`:r.push(`Concepts`);break;case`tenancy`:r.push(`Tenancy`),t[1]&&r.push(wm(t[1]));break;case`rag-index`:r.push(`RAG Index`),t[1]&&r.push(wm(t[1]));break;case`playground`:r.push(`Playground`),t[1]&&r.push(`Query`);break;case`settings`:r.push(`Settings`);break;default:r.push(wm(n))}return r}function wm(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Tm=[{to:`/overview`,label:`Overview`,icon:Mi},{to:`/tables`,label:`Tables`,icon:qi,badgeKey:`tables`},{to:`/concepts`,label:`Concepts`,icon:Ai,badgeKey:`concepts`},{to:`/tenancy`,label:`Tenancy`,icon:Wi},{to:`/rag-index`,label:`RAG Index`,icon:Gi},{to:`/playground`,label:`Playground`,icon:Li}];function Em(){let{workspace:e}=Or(),{theme:t,toggleTheme:n}=er();function r(t){if(!(!e||!t)){if(t===`tables`)return String(e.tables.length);if(t===`concepts`)return String(e.concepts.length)}}return(0,L.jsxs)(cm,{collapsible:`icon`,className:`border-r`,children:[(0,L.jsx)(dm,{className:`px-2 py-2`,children:(0,L.jsx)(_m,{children:(0,L.jsx)(vm,{children:(0,L.jsx)(bm,{size:`lg`,asChild:!0,tooltip:`AskDB Studio`,children:(0,L.jsxs)(`a`,{href:`/`,className:`no-underline`,children:[(0,L.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center shrink-0`,children:(0,L.jsx)(`img`,{src:t===`dark`?`/assets/brand/dark-icon.png`:`/assets/brand/light-icon.png`,alt:`AskDB`,className:`size-7`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 leading-none`,children:[(0,L.jsx)(`span`,{className:`font-semibold`,children:`AskDB`}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Studio`})]})]})})})})}),(0,L.jsx)(mm,{children:(0,L.jsx)(hm,{children:(0,L.jsx)(gm,{children:(0,L.jsx)(_m,{children:Tm.map(e=>{let t=e.icon,n=r(e.badgeKey);return(0,L.jsxs)(vm,{children:[(0,L.jsx)(bm,{asChild:!0,tooltip:e.label,children:(0,L.jsxs)(An,{to:e.to,children:[(0,L.jsx)(t,{}),(0,L.jsx)(`span`,{children:e.label})]})}),n&&(0,L.jsx)(xm,{children:n})]},e.to)})})})})}),(0,L.jsxs)(fm,{children:[(0,L.jsxs)(_m,{children:[(0,L.jsx)(vm,{children:(0,L.jsx)(bm,{asChild:!0,tooltip:`Settings`,children:(0,L.jsxs)(An,{to:`/settings`,children:[(0,L.jsx)(Ui,{}),(0,L.jsx)(`span`,{children:`Settings`})]})})}),(0,L.jsx)(vm,{children:(0,L.jsxs)(bm,{tooltip:t===`light`?`Dark mode`:`Light mode`,onClick:n,children:[t===`light`?(0,L.jsx)(Fi,{}):(0,L.jsx)(Ki,{}),(0,L.jsx)(`span`,{children:t===`light`?`Dark mode`:`Light mode`})]})})]}),(0,L.jsx)(pm,{}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0`,children:[(0,L.jsx)(Ei,{size:14,className:`shrink-0`}),(0,L.jsx)(`span`,{className:`truncate font-mono group-data-[collapsible=icon]:hidden`,children:e?`${e.aiProvider||`postgres`} · ${e.schemaId.split(`/`).pop()||e.schemaId}`:`connecting…`})]})]})]})}function Dm({dialog:e,onApply:t,onClose:n}){return(0,L.jsx)(`div`,{className:`dialog-overlay`,onClick:n,"aria-hidden":`true`,children:(0,L.jsxs)(`div`,{className:`dialog`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`dialog-hd`,children:[(0,L.jsxs)(`h3`,{children:[`Suggestions for `,e.label]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:n,"aria-label":`Close`,children:(0,L.jsx)(Xi,{size:14})})]}),(0,L.jsx)(`div`,{className:`dialog-bd`,children:e.candidates.map(e=>(0,L.jsxs)(`article`,{className:`candidate`,children:[(0,L.jsx)(`p`,{children:e.text}),(0,L.jsx)(`div`,{className:`candidate-actions`,children:(0,L.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>t(e.text),children:`Use`})})]},e.text))})]})})}function Om({status:e}){return(0,L.jsxs)(`div`,{className:`status-banner ${e.kind}`,children:[e.kind===`loading`&&(0,L.jsx)(Ni,{size:14,className:`animate-spin`}),e.kind===`success`&&(0,L.jsx)(vi,{size:14}),e.kind===`error`&&(0,L.jsx)(Ci,{size:14}),(0,L.jsx)(`span`,{children:e.text})]})}function km({status:e}){return(0,L.jsx)(`div`,{className:`inline-status ${e.kind}`,children:e.text})}function Am(){let e=ot(),{workspace:t,tables:n,load:r}=Or(),{ragStatus:a,refreshRagStatus:o}=Vr(),{historyEntries:s}=Jr(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),f=(0,S.useCallback)(async()=>{l(!0),d({kind:`loading`,text:`Re-introspecting…`});try{let e=await br();await r(),o(),d({kind:`success`,text:`Re-introspected ${e.tables} table${e.tables===1?``:`s`} from ${e.engine} — enrichment preserved.`})}catch(e){d({kind:`error`,text:e instanceof Error?e.message:String(e)})}finally{l(!1)}},[r,o]);if(!t)return null;let p=n.filter(e=>{let t=e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&r}).length,m=n.filter(e=>{let t=e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&!r}).length,h=!!t.tenantPolicy;return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsx)(`h1`,{children:`Overview`}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[t.aiProvider||`postgres`,` · `,t.schemaId]})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,disabled:c,title:`Re-run introspection with the connection from askdb.config.ts. Your enrichment is preserved.`,onClick:()=>void f(),children:[c?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(zi,{size:14}),` Resync schema`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>e(`/tables`),children:[(0,L.jsx)(Gi,{size:14}),` Draft enrichment`]})]})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,children:[u&&(0,L.jsx)(km,{status:u}),(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Tables`}),(0,L.jsx)(`div`,{className:`stat-num`,children:n.length}),(0,L.jsxs)(`div`,{className:`stat-hint`,children:[p,` enriched · `,m,` partial`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Concepts`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.concepts.length}),t.concepts.length>0&&(0,L.jsxs)(`div`,{className:`stat-hint`,children:[t.concepts.length,` defined`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Index health`}),(0,L.jsx)(`div`,{className:`stat-num`,children:a?.hasIndex?a.stale?`Stale`:`Fresh`:`None`}),a&&(0,L.jsxs)(`div`,{className:`stat-hint`,children:[a.chunksTotal,` chunks · `,a.dimensions,`d`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitivity coverage`}),(0,L.jsx)(`div`,{className:`stat-num`,children:a?`${Math.round((a.sensitiveExcluded+a.sensitiveIncluded)/Math.max(a.chunksTotal,1)*100)}%`:`—`})]})]}),(0,L.jsxs)(`div`,{className:`grid-2`,children:[(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Gi,{size:14}),` Pending enrichment`]}),(0,L.jsxs)(`span`,{className:`card-meta`,children:[n.length-p,` tables to go`]})]}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Table`}),(0,L.jsx)(`th`,{children:`Cols`}),(0,L.jsx)(`th`,{children:`Status`}),(0,L.jsx)(`th`,{"aria-label":`Actions`})]})}),(0,L.jsx)(`tbody`,{children:n.filter(e=>{let t=e.draft,n=Object.values(t.columns??{}).every(e=>e.description);return!(t.description&&n)}).slice(0,6).map(t=>{let n=t.draft.description||t.draft.aliases&&t.draft.aliases.length>0?`partial`:`none`;return(0,L.jsxs)(`tr`,{style:{cursor:`default`},onClick:()=>e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`),children:[(0,L.jsx)(`td`,{children:(0,L.jsxs)(`span`,{className:`mono`,children:[t.physical.schema,`.`,t.physical.name]})}),(0,L.jsx)(`td`,{className:`muted`,children:t.physical.columns.length}),(0,L.jsxs)(`td`,{children:[(0,L.jsx)(`span`,{className:`enrich-dot ${n}`}),(0,L.jsx)(`span`,{className:`muted tiny`,style:{marginLeft:6},children:n})]}),(0,L.jsx)(`td`,{style:{textAlign:`right`},children:(0,L.jsxs)(`span`,{className:`suggest-link`,children:[(0,L.jsx)(Gi,{size:12}),` Draft`]})})]},t.physical.id)})})]})})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(ji,{size:14}),` Recent playground queries`]}),(0,L.jsxs)(`span`,{className:`card-meta`,children:[`last `,s.length,` queries`]})]}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Question`}),(0,L.jsx)(`th`,{children:`Mode`}),(0,L.jsx)(`th`,{children:`Time`})]})}),(0,L.jsxs)(`tbody`,{children:[s.slice(0,5).map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{style:{maxWidth:300,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.question}),(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`chip ${e.mode===`rag`?`red`:``}`,children:e.mode})}),(0,L.jsx)(`td`,{className:`muted tiny`,children:new Date(e.timestamp).toLocaleString()})]},e.id)),s.length===0&&(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{colSpan:3,className:`muted tiny`,style:{textAlign:`center`,padding:16},children:`No queries yet`})})]})]})})]})]}),(0,L.jsxs)(`div`,{className:`grid-3`,children:[(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Gi,{size:14}),` RAG index`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid-2`,style:{gap:10},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Chunks`}),(0,L.jsx)(`div`,{style:{fontSize:18,fontWeight:600},children:Tr(a.chunksTotal)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Indexed`}),(0,L.jsx)(`div`,{style:{fontSize:18,fontWeight:600},children:Tr(a.chunksIndexed)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Dimensions`}),(0,L.jsx)(`div`,{className:`mono`,style:{fontSize:13},children:Tr(a.dimensions)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Model`}),(0,L.jsx)(`div`,{className:`mono`,style:{fontSize:12},children:a.embedder.label})]})]}),(0,L.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,L.jsx)(`i`,{style:{width:a.chunksTotal>0?`${Math.round(a.chunksIndexed/a.chunksTotal*100)}%`:`0%`}})}),(0,L.jsxs)(`div`,{className:`tiny muted`,style:{marginTop:6},children:[`Updated: `,a.updatedAt??`never`]})]}):(0,L.jsx)(`div`,{className:`muted tiny`,children:`RAG status unavailable`})})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Wi,{size:14}),` Tenancy`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`div`,{className:`row-h`,style:{marginBottom:10},children:(0,L.jsxs)(`span`,{className:`chip ${h?`green`:`amber`}`,children:[(0,L.jsx)(Zi,{size:11}),h?`Configured`:`Not configured`]})}),(0,L.jsx)(`div`,{className:`tiny muted`,style:{lineHeight:1.6},children:h?`${t.tenantPolicy.roots.length} root(s) configured, ${t.tenantPolicy.enforcement} mode.`:`Multi-tenant scoping isn't set. Generated SQL won't enforce row-level isolation.`}),!h&&(0,L.jsxs)(`button`,{type:`button`,className:`btn sm primary`,style:{marginTop:12},onClick:()=>e(`/tenancy`),children:[(0,L.jsx)(Gi,{size:12}),` Draft tenant policy`]})]})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Zi,{size:14}),` Suggested next actions`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[n.filter(e=>!e.draft.description).length>0&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--red-600)`,flexShrink:0}}),(0,L.jsxs)(`span`,{style:{fontSize:12.5},children:[`Add description to`,` `,(0,L.jsx)(`span`,{className:`mono`,children:n.find(e=>!e.draft.description)?.physical.name})]})]}),!a?.hasIndex&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--amber-500)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Build RAG index for retrieval-augmented queries`})]}),a?.stale&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Rebuild index — tables changed since last build`})]}),n.length>0&&p===0&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--amber-500)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Start enriching tables to improve SQL generation quality`})]})]})]})]})]})})]})}var jm=e=>(0,L.jsx)(Ja,{"data-slot":`collapsible-trigger`,...e}),Mm=e=>(0,L.jsx)(Xa,{"data-slot":`collapsible-content`,...e}),Nm=e=>(0,L.jsx)($a,{"data-slot":`collapsible`,...e}),Pm={enriched:`Complete`,partial:`Partial`,none:`Not started`};function Fm(){let e=ot(),t=ut(),{filteredTables:n,tables:r,selectedTable:a,setSelectedTableId:o,tableSearch:s,setTableSearch:c,drafts:l}=Or(),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),m=(0,S.useCallback)(e=>{let t=l[e.physical.id]??e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&r?`enriched`:n?`partial`:`none`},[l]),h=(0,S.useCallback)(e=>(l[e.physical.id]??e.draft).tracked!==!1,[l]),g=(0,S.useMemo)(()=>{let e={enriched:0,partial:0,none:0};for(let t of r)e[m(t)]++;return e},[r,m]),_=(0,S.useMemo)(()=>r.filter(e=>!h(e)).length,[r,h]),v=(0,S.useMemo)(()=>{let e=n;return u&&(e=e.filter(e=>u.has(m(e)))),f===`tracked`?e=e.filter(e=>h(e)):f===`untracked`&&(e=e.filter(e=>!h(e))),e},[n,u,f,m,h]),y=(0,S.useMemo)(()=>{let e=new Map;for(let t of v){let n=t.physical.schema;e.has(n)||e.set(n,[]),e.get(n).push(t)}return Array.from(e.entries()).sort(([e],[t])=>e.localeCompare(t))},[v]),b=(0,S.useMemo)(()=>y.map(([e])=>e),[y]),[x,C]=(0,S.useState)(new Set),w=(0,S.useMemo)(()=>new Set(b.filter(e=>!x.has(e))),[b,x]),T=x.size===0,E=()=>C(new Set(b)),D=()=>C(new Set);(0,S.useEffect)(()=>{s&&C(new Set)},[s]),(0,S.useEffect)(()=>{if(t.schema&&t.name)o(`table:${t.schema}.${t.name}`);else if(r.length>0&&!t.schema){let t=r[0];e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`,{replace:!0})}},[t.schema,t.name,r,e,o]);function ee(e){d(t=>{if(!t)return new Set([e]);let n=new Set(t);return n.has(e)?(n.delete(e),n.size===0?null:n):(n.add(e),n.size===3?null:n)})}let O=!!(t.schema&&t.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`sub-rail`,children:[(0,L.jsxs)(`div`,{className:`sub-rail-hd`,children:[(0,L.jsx)(`h2`,{children:`Tables`}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsxs)(`span`,{className:`muted tiny`,children:[r.length,` tables`]}),y.length>1&&(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:T?D:E,title:T?`Collapse all`:`Expand all`,style:{padding:2,height:20,width:20},children:T?(0,L.jsx)(xi,{size:13}):(0,L.jsx)(Si,{size:13})})]})]}),(0,L.jsxs)(`div`,{className:`sub-rail-search`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Search tables`,placeholder:`Search tables…`,value:s,onChange:e=>c(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`enrich-filter-bar`,children:[[`enriched`,`partial`,`none`].map(e=>{let t=!u||u.has(e);return(0,L.jsxs)(`button`,{type:`button`,className:`enrich-filter-chip ${e} ${t?`active`:``}`,onClick:()=>ee(e),title:`${t?`Hide`:`Show`} ${Pm[e].toLowerCase()} tables`,children:[(0,L.jsx)(`span`,{className:`enrich-dot ${e}`}),(0,L.jsx)(`span`,{className:`enrich-filter-label`,children:Pm[e]}),(0,L.jsx)(`span`,{className:`enrich-filter-count`,children:g[e]})]},e)}),_>0&&(0,L.jsxs)(`button`,{type:`button`,className:`enrich-filter-chip untracked ${f===`untracked`?`active`:``}`,onClick:()=>p(e=>e===`untracked`?null:`untracked`),title:f===`untracked`?`Show all tables`:`Show ${_} untracked table${_===1?``:`s`}`,children:[(0,L.jsx)(Di,{size:11}),(0,L.jsx)(`span`,{className:`enrich-filter-label`,children:`Untracked`}),(0,L.jsx)(`span`,{className:`enrich-filter-count`,children:_})]})]}),(0,L.jsxs)(`div`,{className:`sub-rail-list`,children:[y.map(([t,n])=>(0,L.jsx)(Nm,{open:w.has(t),onOpenChange:e=>{C(n=>{let r=new Set(n);return e?r.delete(t):r.add(t),r})},children:(0,L.jsxs)(`div`,{className:`schema-group`,children:[(0,L.jsx)(jm,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,className:`schema-group-hd`,children:[(0,L.jsx)(bi,{size:12,className:`schema-chevron`,style:{transform:w.has(t)?`rotate(90deg)`:void 0}}),(0,L.jsx)(ki,{size:13,className:`schema-icon`}),(0,L.jsx)(`span`,{className:`schema-name`,children:t}),(0,L.jsx)(`span`,{className:`schema-count`,children:n.length})]})}),(0,L.jsx)(Mm,{children:(0,L.jsx)(`div`,{className:`schema-group-bd`,children:n.map(t=>{let n=m(t),r=h(t);return(0,L.jsxs)(`button`,{type:`button`,className:`sub-rail-row table-leaf ${a?.physical.id===t.physical.id?`active`:``}${r?``:` untracked`}`,onClick:()=>e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`),title:r?void 0:`Untracked — excluded from LLM context`,children:[r?(0,L.jsx)(`span`,{className:`enrich-dot ${n}`}):(0,L.jsx)(Di,{size:10,style:{color:`var(--amber-500)`,flex:`none`}}),(0,L.jsx)(`span`,{className:`row-name mono`,children:t.physical.name}),(0,L.jsxs)(`span`,{className:`row-meta`,children:[t.physical.columns.length,` cols`]})]},t.physical.id)})})})]})},t)),v.length===0&&(0,L.jsx)(`div`,{className:`muted tiny`,style:{padding:`16px`,textAlign:`center`},children:f===`untracked`?`No untracked tables`:u?`No tables match this filter`:`No tables match your search`})]})]}),O?(0,L.jsx)(Ft,{}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(`div`,{className:`main-body`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(`div`,{style:{textAlign:`center`,color:`var(--ink-400)`},children:[(0,L.jsx)(Gi,{size:24,style:{margin:`0 auto 8px`}}),(0,L.jsx)(`p`,{style:{fontSize:13},children:`Select a table to start enriching`})]})})})]})}function Im(){let{selectedTable:e,selectedDraft:t,dirty:n,saveStatus:r,saveSelectedTable:a,resetSelectedDraft:o,busy:s}=Or(),{refreshRagStatus:c}=Vr();if(!e||!t)return null;async function l(){await a(),c()}let u=e,d=t.description||t.aliases&&t.aliases.length>0,f=Object.values(t.columns??{}).every(e=>e.description);return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(`span`,{className:`enrich-dot ${d&&f?`enriched`:d?`partial`:`none`}`,style:{marginRight:8}}),u.physical.schema,`.`,u.physical.name]}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[u.physical.columns.length,` columns`,u.physical.relationships&&u.physical.relationships.length>0?` · ${u.physical.relationships.length} relationships`:``,u.missingColumnIds.length>0?` · ${u.missingColumnIds.length} missing`:``]})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:o,disabled:!n||s.has(`save`),children:[(0,L.jsx)(Bi,{size:14}),` Revert`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void l(),disabled:!n||s.has(`save`),children:[s.has(`save`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),`Save`]})]})]}),r&&(0,L.jsx)(Om,{status:r}),(0,L.jsxs)(`div`,{className:`sub-tabs`,children:[(0,L.jsx)(An,{to:`enrichment`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Enrichment`}),(0,L.jsx)(An,{to:`schema`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Schema`}),(0,L.jsx)(An,{to:`sensitivity`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Sensitivity`})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsx)(Ft,{})})]})}var Lm=si(`inline-flex min-h-6 max-w-full items-center rounded-md px-2 py-0.5 text-xs font-medium`,{variants:{variant:{default:`bg-primary text-primary-foreground`,secondary:`bg-secondary text-secondary-foreground`,warning:`bg-warning text-warning-foreground dark:bg-amber-500/15 dark:text-amber-400`,danger:`bg-destructive text-destructive-foreground`,outline:`border border-border bg-background text-muted-foreground`}},defaultVariants:{variant:`default`}});function Rm({className:e,variant:t,...n}){return(0,L.jsx)(`span`,{className:Q(Lm({variant:t}),e),...n})}function $({label:e,description:t,children:n,className:r}){return(0,L.jsxs)(`label`,{className:Q(`grid gap-1.5`,r),children:[(0,L.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground`,children:e}),n,t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null]})}function zm(e){return e?.join(`, `)??``}function Bm({value:e,onChange:t}){let[n,r]=(0,S.useState)(null);return(0,L.jsx)(Bp,{value:n??zm(e),onChange:e=>r(e.target.value),onFocus:()=>r(zm(e)),onBlur:()=>{t(Cr(n??zm(e))),r(null)}})}function Vm({className:e,...t}){return(0,L.jsx)(`textarea`,{"data-slot":`textarea`,className:Q(`min-h-24 w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}function Hm(){let{workspace:e,selectedTable:t,selectedDraft:n,updateTableDraft:r,updateColumnDraft:a,requestSuggestion:o,suggestingKey:s}=Or();if(!t||!n||!e)return null;let c=e.aiConfigured,l=t,u=n,d=l.physical.id;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Table Enrichment`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Description`,onSuggest:()=>o({scope:`table`,tableId:d,field:`description`},`table description`),suggesting:s===`table:${d}:description`,children:(0,L.jsx)(Vm,{value:u.description,onChange:e=>r(d,t=>({...t,description:e.target.value}))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Aliases`,onSuggest:()=>o({scope:`table`,tableId:d,field:`aliases`},`table aliases`),suggesting:s===`table:${d}:aliases`,children:(0,L.jsx)(Bm,{value:u.aliases,onChange:e=>r(d,t=>({...t,aliases:e}))})}),(0,L.jsx)(Um,{aiConfigured:c,label:`Primary entity`,onSuggest:()=>o({scope:`table`,tableId:d,field:`primaryEntity`},`primary entity`),suggesting:s===`table:${d}:primaryEntity`,children:(0,L.jsx)(Bp,{value:u.primaryEntity??``,onChange:e=>r(d,t=>({...t,primaryEntity:e.target.value.trim()||void 0}))})})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16,gridTemplateColumns:`1fr 220px`},children:[(0,L.jsx)($,{label:`Tags`,description:`Comma-separated labels used for browsing and filtering.`,children:(0,L.jsx)(Bm,{value:u.tags,onChange:e=>r(d,t=>({...t,tags:e}))})}),(0,L.jsx)(Wm,{label:`Table sensitivity override`,value:u.sensitive,onChange:e=>r(d,t=>({...t,sensitive:e}))})]})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Common Query Language`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(Um,{aiConfigured:c,label:`Business vocabulary`,onSuggest:()=>o({scope:`table`,tableId:d,field:`commonQueryLanguage`},`common query language`),suggesting:s===`table:${d}:commonQueryLanguage`,children:(0,L.jsx)(Vm,{className:`min-h-36`,value:u.commonQueryLanguage??``,onChange:e=>r(d,t=>({...t,commonQueryLanguage:e.target.value}))})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Example Questions`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)($,{label:`Questions`,children:(0,L.jsx)(Vm,{className:`min-h-32`,value:u.exampleQuestions??``,onChange:e=>r(d,t=>({...t,exampleQuestions:e.target.value}))})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsx)(`h3`,{children:`Columns`}),l.missingColumnIds.length>0&&(0,L.jsxs)(Rm,{variant:l.missingColumnIds.length>0?`warning`:`secondary`,children:[l.missingColumnIds.length,` missing`]})]}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:l.physical.columns.map(e=>{let t=u.columns[e.id]??{};return(0,L.jsxs)(`section`,{className:`column-row`,children:[(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h4`,{style:{fontSize:13,fontWeight:600},children:e.name}),(0,L.jsx)(Rm,{variant:`outline`,children:e.type}),e.primaryKey&&(0,L.jsx)(Rm,{variant:`secondary`,children:`PK`}),e.nullable&&(0,L.jsx)(Rm,{variant:`outline`,children:`nullable`}),(e.sensitive||t.sensitive)&&(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:4,wordBreak:`break-all`},children:e.id})]})}),(0,L.jsxs)(`div`,{style:{marginTop:12,display:`grid`,gap:12},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Description`,onSuggest:()=>o({scope:`column`,tableId:d,columnId:e.id,field:`description`},`${e.name} description`),suggesting:s===`column:${d}:${e.id}:description`,children:(0,L.jsx)(Vm,{value:t.description??``,onChange:t=>a(d,e.id,e=>({...e,description:t.target.value}))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr 1fr`},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Aliases`,onSuggest:()=>o({scope:`column`,tableId:d,columnId:e.id,field:`aliases`},`${e.name} aliases`),suggesting:s===`column:${d}:${e.id}:aliases`,children:(0,L.jsx)(Bm,{value:t.aliases,onChange:t=>a(d,e.id,e=>({...e,aliases:t}))})}),(0,L.jsx)($,{label:`Enum notes`,children:(0,L.jsx)(Bm,{value:t.enum,onChange:t=>a(d,e.id,e=>({...e,enum:t}))})}),(0,L.jsx)(Wm,{label:`Sensitivity override`,value:t.sensitive,onChange:t=>a(d,e.id,e=>({...e,sensitive:t}))})]})]})]},e.id)})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Relationships`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:l.physical.relationships&&l.physical.relationships.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:l.physical.relationships.map((e,t)=>(0,L.jsxs)(`div`,{className:`relationship-row`,children:[(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.from}),(0,L.jsx)(bi,{size:14,style:{color:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.to})]},`${e.from}-${e.to}-${t}`))}):(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:`No relationships recorded for this table.`})})]})]})}function Um({aiConfigured:e,children:t,label:n,onSuggest:r,suggesting:a}){return(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:n}),(0,L.jsxs)(`button`,{type:`button`,className:`suggest-link`,disabled:!e||a,onClick:()=>void r(),title:e?`Suggest with configured AI model`:`Configure an AI key to enable suggestions`,children:[a?(0,L.jsx)(Ni,{size:12,className:`animate-spin`}):(0,L.jsx)(Gi,{size:12}),`Suggest`]})]}),t]})}function Wm({label:e,onChange:t,value:n}){return(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:e}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:n===void 0?`inherit`:n?`true`:`false`,onChange:e=>{e.target.value===`inherit`?t(void 0):t(e.target.value===`true`)},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit physical metadata`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})]})}function Gm(){let{selectedTable:e}=Or();if(!e)return null;let t=e;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Column Details`})}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Name`}),(0,L.jsx)(`th`,{children:`Type`}),(0,L.jsx)(`th`,{children:`Nullable`}),(0,L.jsx)(`th`,{children:`PK`}),(0,L.jsx)(`th`,{children:`Default`}),(0,L.jsx)(`th`,{children:`Sensitive`})]})}),(0,L.jsx)(`tbody`,{children:t.physical.columns.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.name})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rm,{variant:`outline`,children:e.type})}),(0,L.jsx)(`td`,{children:e.nullable?`Yes`:`No`}),(0,L.jsx)(`td`,{children:e.primaryKey?(0,L.jsx)(Rm,{variant:`secondary`,children:`PK`}):`—`}),(0,L.jsx)(`td`,{className:`muted tiny`,children:e.default??`—`}),(0,L.jsx)(`td`,{children:e.sensitive?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):`—`})]},e.id))})]})})]}),t.physical.relationships&&t.physical.relationships.length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Relationships`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.physical.relationships.map((e,t)=>(0,L.jsxs)(`div`,{className:`relationship-row`,children:[(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.from}),(0,L.jsx)(bi,{size:14,style:{color:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.to})]},`${e.from}-${e.to}-${t}`))})})]})]})}function Km(){let{selectedTable:e,selectedDraft:t,updateColumnDraft:n,updateTableDraft:r}=Or();if(!e||!t)return null;let a=e,o=t,s=a.physical.id;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`LLM tracking`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:12,marginBottom:10},children:`Untracked tables are excluded from LLM prompts and RAG indexing. They remain in the schema and are still visible here.`}),(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Status`}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:o.tracked===!1?`false`:`true`,onChange:e=>{let t=e.target.value===`false`?!1:void 0;r(s,e=>({...e,tracked:t}))},children:[(0,L.jsx)(`option`,{value:`true`,children:`Tracked — included in LLM context`}),(0,L.jsx)(`option`,{value:`false`,children:`Untracked — excluded from LLM context`})]})]})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Table-level sensitivity`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Override`}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:o.sensitive===void 0?`inherit`:o.sensitive?`true`:`false`,onChange:e=>{let t=e.target.value===`inherit`?void 0:e.target.value===`true`;r(s,e=>({...e,sensitive:t}))},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit physical metadata`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Column sensitivity`})}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Column`}),(0,L.jsx)(`th`,{children:`Physical`}),(0,L.jsx)(`th`,{children:`Override`}),(0,L.jsx)(`th`,{children:`Effective`})]})}),(0,L.jsx)(`tbody`,{children:a.physical.columns.map(e=>{let t=o.columns[e.id]??{},r=t.sensitive===void 0?e.sensitive:t.sensitive;return(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.name})}),(0,L.jsx)(`td`,{children:e.sensitive?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):(0,L.jsx)(`span`,{className:`muted`,children:`—`})}),(0,L.jsx)(`td`,{children:(0,L.jsxs)(`select`,{style:{fontSize:12,padding:`2px 6px`,borderRadius:4,border:`1px solid var(--border)`},value:t.sensitive===void 0?`inherit`:t.sensitive?`true`:`false`,onChange:t=>{let r=t.target.value===`inherit`?void 0:t.target.value===`true`;n(s,e.id,e=>({...e,sensitive:r}))},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})}),(0,L.jsx)(`td`,{children:r?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):(0,L.jsx)(`span`,{className:`muted`,children:`—`})})]},e.id)})})]})})]})]})}var qm=`concept:`;function Jm(e){return e.startsWith(qm)?e.slice(8):e}function Ym(e){let t=e.trim();return t?t.startsWith(qm)?t:qm+t:``}function Xm(e){return structuredClone(e)}function Zm(){let{workspace:e,tables:t,handleSaveConcepts:n,saveStatus:r,busy:a}=Or(),{refreshRagStatus:o}=Vr(),s=(0,S.useCallback)(async e=>{await n(e),o()},[n,o]),c=(0,S.useMemo)(()=>{if(!t.length)return[];let e=[];for(let n of t){e.push({id:n.physical.id,label:`${n.physical.schema}.${n.physical.name}`,kind:`table`});for(let t of n.physical.columns)e.push({id:t.id,label:`${n.physical.schema}.${n.physical.name} → ${t.name}`,kind:`column`})}return e},[t]);if(!e)return null;let l=e.concepts.map(e=>e.id).join(`,`);return(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)($m,{concepts:e.concepts,linkOptions:c,onSave:s,saveStatus:r,busy:a},l)})}function Qm(e,t){switch(t.type){case`set_selectedIndex`:return{...e,selectedIndex:t.payload};case`set_conceptSearch`:return{...e,conceptSearch:t.payload};case`merge_addDraft`:return{...e,addDraft:{...e.addDraft,...t.payload}};case`update_concept`:return{...e,draft:e.draft.map((e,n)=>n===t.index?t.updater(Xm(e)):e)};case`remove_concept`:{let n=e.draft.filter((e,n)=>n!==t.index),r=e.selectedIndex;return e.selectedIndex===t.index?r=null:e.selectedIndex!==null&&e.selectedIndex>t.index&&(r=e.selectedIndex-1),{...e,draft:n,selectedIndex:r}}case`commit_add`:return{...e,draft:[...e.draft,t.concept],selectedIndex:t.newIndex,addDraft:{},addOpen:!1};case`open_add_form`:return{...e,addOpen:!0,selectedIndex:null};case`select_concept`:return{...e,selectedIndex:t.index,addOpen:!1};case`cancel_add`:return{...e,addOpen:!1,addDraft:{}}}}function $m({concepts:e,linkOptions:t,onSave:n,saveStatus:r,busy:a}){let[o,s]=(0,S.useReducer)(Qm,null,()=>({draft:Xm(e),selectedIndex:null,addOpen:!1,addDraft:{},conceptSearch:``})),{draft:c,selectedIndex:l,addOpen:u,addDraft:d,conceptSearch:f}=o,p=JSON.stringify(c)!==JSON.stringify(e),m=(0,S.useMemo)(()=>{if(!f)return c.map((e,t)=>({concept:e,index:t}));let e=f.toLowerCase();return c.flatMap((t,n)=>t.label.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.synonyms?.some(t=>t.toLowerCase().includes(e))?[{concept:t,index:n}]:[])},[c,f]),h=l===null?null:c[l];function g(e,t){s({type:`update_concept`,index:e,updater:t})}function _(e){s({type:`remove_concept`,index:e})}function v(){let e=Ym(d.id??``);!e||!d.label?.trim()||s({type:`commit_add`,concept:{id:e,label:d.label.trim(),...d.synonyms?.length?{synonyms:d.synonyms}:{},...d.links?.length?{links:d.links}:{},...d.description?.trim()?{description:d.description.trim()}:{}},newIndex:c.length})}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Ai,{size:18,style:{display:`inline`,marginRight:8}}),`Concepts`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Cross-table domain vocabulary for NL→SQL grounding`})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>{setDraft(Xm(e)),setSelectedIndex(null)},disabled:!p||a.has(`save-concepts`),children:[(0,L.jsx)(Bi,{size:14}),` Revert`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void n(c),disabled:!p||a.has(`save-concepts`),children:[a.has(`save-concepts`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),`Save`]})]})]}),r&&(0,L.jsx)(Om,{status:r}),(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`280px 1fr`,flex:1,minHeight:0,overflow:`hidden`},children:[(0,L.jsxs)(`div`,{className:`sub-rail`,style:{borderRight:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{className:`sub-rail-hd`,children:[(0,L.jsx)(`h2`,{children:`Concepts`}),(0,L.jsx)(`span`,{className:`muted tiny`,children:c.length})]}),(0,L.jsxs)(`div`,{className:`sub-rail-search`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Search concepts`,placeholder:`Search concepts…`,value:f,onChange:e=>s({type:`set_conceptSearch`,payload:e.target.value})})]}),(0,L.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,L.jsxs)(`button`,{type:`button`,className:`btn sm`,style:{width:`100%`,justifyContent:`center`},onClick:()=>s({type:`open_add_form`}),children:[(0,L.jsx)(Ri,{size:12}),` Add concept`]})}),(0,L.jsxs)(`div`,{className:`sub-rail-list`,children:[m.map(({concept:e,index:t})=>(0,L.jsxs)(`button`,{type:`button`,className:`sub-rail-row ${l===t?`active`:``}`,onClick:()=>s({type:`select_concept`,index:t}),children:[(0,L.jsx)(Ai,{size:12,style:{flexShrink:0,color:`var(--ink-400)`}}),(0,L.jsx)(`span`,{className:`row-name`,children:e.label}),(0,L.jsxs)(`span`,{className:`row-meta`,children:[e.links?.length??0,` links`]})]},e.id)),m.length===0&&(0,L.jsx)(`div`,{className:`muted tiny`,style:{padding:`16px`,textAlign:`center`},children:f?`No concepts match your search`:`No concepts yet`})]})]}),(0,L.jsx)(`div`,{style:{overflow:`auto`,padding:`var(--pad-y) var(--pad-x)`},children:u?(0,L.jsx)(`div`,{className:`stack`,children:(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`New Concept`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)($,{label:`ID`,description:`Unique slug (concept: prefix added automatically)`,children:(0,L.jsx)(th,{value:d.id??``,onChange:e=>s({type:`merge_addDraft`,payload:{id:e}}),placeholder:`revenue`})}),(0,L.jsx)($,{label:`Label`,description:`Human-readable name, e.g. "Revenue"`,children:(0,L.jsx)(Bp,{value:d.label??``,placeholder:`Revenue`,onChange:e=>s({type:`merge_addDraft`,payload:{label:e.target.value}})})})]}),(0,L.jsx)($,{label:`Synonyms`,description:`Comma-separated terms users might say`,children:(0,L.jsx)(Bm,{value:d.synonyms,onChange:e=>s({type:`merge_addDraft`,payload:{synonyms:e}})})}),(0,L.jsx)($,{label:`Links`,description:`Tables or columns this concept maps to`,children:(0,L.jsx)(nh,{value:d.links??[],onChange:e=>s({type:`merge_addDraft`,payload:{links:e}}),options:t})}),(0,L.jsx)($,{label:`Description`,description:`How this concept is computed or what it means`,children:(0,L.jsx)(Vm,{value:d.description??``,placeholder:`Sum of orders.total_amount where status = 'paid', expressed in cents.`,onChange:e=>s({type:`merge_addDraft`,payload:{description:e.target.value}})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`},children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s({type:`cancel_add`}),children:`Cancel`}),(0,L.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:v,disabled:!d.id?.trim()||!d.label?.trim(),children:`Add concept`})]})]})})]})}):h&&l!==null?(0,L.jsx)(eh,{concept:h,linkOptions:t,onChange:e=>g(l,e),onRemove:()=>_(l)}):(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:(0,L.jsxs)(`div`,{style:{textAlign:`center`,color:`var(--ink-400)`},children:[(0,L.jsx)(Ai,{size:24,style:{margin:`0 auto 8px`}}),(0,L.jsx)(`p`,{style:{fontSize:13},children:c.length===0?`Click "Add concept" to create your first one`:`Select a concept to edit`})]})})})]})]})}function eh({concept:e,linkOptions:t,onChange:n,onRemove:r}){return(0,L.jsx)(`div`,{className:`stack`,children:(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h3`,{children:e.label}),(0,L.jsx)(Rm,{variant:`outline`,children:e.id})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:r,title:`Remove concept`,style:{color:`var(--red-600)`},children:`Remove`})]}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)($,{label:`ID`,description:`Unique slug (concept: prefix added automatically)`,children:(0,L.jsx)(th,{value:e.id,onChange:e=>n(t=>({...t,id:e}))})}),(0,L.jsx)($,{label:`Label`,description:`Human-readable name`,children:(0,L.jsx)(Bp,{value:e.label,onChange:e=>n(t=>({...t,label:e.target.value}))})})]}),(0,L.jsx)($,{label:`Synonyms`,description:`Comma-separated alternative terms`,children:(0,L.jsx)(Bm,{value:e.synonyms,onChange:e=>n(t=>({...t,synonyms:e.length?e:void 0}))})}),(0,L.jsx)($,{label:`Links`,description:`Tables or columns this concept maps to`,children:(0,L.jsx)(nh,{value:e.links??[],onChange:e=>n(t=>({...t,links:e.length?e:void 0})),options:t})}),(0,L.jsx)($,{label:`Description`,description:`How this concept is computed or what it means`,children:(0,L.jsx)(Vm,{value:e.description??``,onChange:e=>n(t=>({...t,description:e.target.value||void 0}))})})]})})]})})}function th({value:e,onChange:t,placeholder:n}){let r=Jm(e);return(0,L.jsxs)(`div`,{className:`concept-id-input`,children:[(0,L.jsx)(`span`,{className:`concept-id-prefix`,children:`concept:`}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Concept ID`,className:`concept-id-slug`,value:r,placeholder:n??`my-concept`,onChange:e=>{t(Ym(e.target.value.replace(/\s+/g,`-`).toLowerCase()))}})]})}function nh({value:e,onChange:t,options:n}){let[r,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(0),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=(0,S.useRef)(null);(0,S.useEffect)(()=>{function e(e){u.current&&!u.current.contains(e.target)&&s(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let p=(0,S.useMemo)(()=>new Set(e),[e]),m=(0,S.useMemo)(()=>{if(!r)return n.filter(e=>!p.has(e.id));let e=r.toLowerCase();return n.filter(t=>!p.has(t.id)&&(t.label.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)))},[n,r,p]),h=m.slice(0,30),g=(0,S.useCallback)(n=>{t([...e,n]),a(``),d.current?.focus()},[e,t]),_=(0,S.useCallback)(n=>{t(e.filter(e=>e!==n))},[e,t]);(0,S.useEffect)(()=>{!o||!f.current||f.current.querySelectorAll(`[data-link-item]`)[c]?.scrollIntoView({block:`nearest`})},[c,o]);function v(e){if(!o){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(s(!0),e.preventDefault());return}switch(e.key){case`ArrowDown`:e.preventDefault(),l(e=>Math.min(e+1,h.length-1));break;case`ArrowUp`:e.preventDefault(),l(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault(),h[c]&&g(h[c].id);break;case`Escape`:e.preventDefault(),s(!1);break}}function y(e){return n.find(t=>t.id===e)?.label??e}function b(e){return n.find(t=>t.id===e)?.kind??(e.includes(`#`)?`column`:`table`)}return(0,L.jsxs)(`div`,{className:`links-input`,ref:u,children:[e.length>0&&(0,L.jsx)(`div`,{className:`links-chips`,children:e.map(e=>(0,L.jsxs)(`span`,{className:`links-chip ${b(e)}`,title:e,children:[(0,L.jsx)(qi,{size:10}),(0,L.jsx)(`span`,{className:`links-chip-label`,children:y(e)}),(0,L.jsx)(`button`,{type:`button`,className:`links-chip-remove`,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),_(e)},title:`Remove`,children:(0,L.jsx)(Xi,{size:10})})]},e))}),(0,L.jsxs)(`div`,{className:`links-search`,children:[(0,L.jsx)(Hi,{size:12}),(0,L.jsx)(`input`,{ref:d,type:`text`,"aria-label":`Search tables or columns`,className:`links-search-input`,placeholder:e.length?`Add another…`:`Search tables or columns…`,value:r,onChange:e=>{a(e.target.value),l(0)},onFocus:()=>s(!0),onKeyDown:v})]}),o&&h.length>0&&(0,L.jsxs)(`div`,{className:`links-dropdown`,ref:f,role:`listbox`,children:[h.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,"data-link-item":!0,role:`option`,"aria-selected":t===c,className:`links-dropdown-item ${t===c?`highlighted`:``}`,onMouseDown:t=>{t.preventDefault(),g(e.id)},onMouseEnter:()=>l(t),children:[(0,L.jsx)(`span`,{className:`links-kind-badge ${e.kind}`,children:e.kind===`table`?`T`:`C`}),(0,L.jsx)(`span`,{className:`links-dropdown-label`,children:e.label})]},e.id)),m.length>30&&(0,L.jsxs)(`div`,{className:`links-dropdown-more`,children:[m.length-30,` more — type to narrow`]})]})]})}function rh(){let{workspace:e,tables:t,handleSaveTenantPolicy:n,handleSuggestTenantPolicy:r,saveStatus:a,busy:o}=Or(),{refreshRagStatus:s}=Vr(),[c,l]=(0,S.useState)(!1),u=(0,S.useCallback)(async(e,t)=>{let r=await n(e,t);return r&&s(),r},[n,s]);if(!e)return null;let d=e.tenantPolicy??null;return d?c?(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ah,{tenantPolicy:d,tables:t,busy:o,saveStatus:a,onSave:async(e,t)=>{let n=await u(e,t);return n&&l(!1),n},onCancel:()=>l(!1)},d.schemaId)}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ih,{tenantPolicy:d,onEdit:()=>l(!0)})}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ch,{tables:t,schemaId:e.schemaId,aiConfigured:e.aiConfigured,busy:o,onSave:u,onSuggest:r,saveStatus:a})})}function ih({tenantPolicy:e,onEdit:t}){let n=e.coverage.reduce((e,t)=>(e[t.classification]=(e[t.classification]??0)+1,e),{}),r=e.coverage.length,a=r-(n.unknown??0),o=r>0?Math.round(a/r*100):0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Multi-Tenancy`]}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[`Schema: `,e.schemaId,` · `,o,`% table coverage (`,a,`/`,r,`)`,(0,L.jsx)(Rm,{variant:e.enforcement===`strict`?`danger`:`warning`,style:{marginLeft:8},children:e.enforcement})]})]}),(0,L.jsx)(`div`,{className:`main-actions`,children:(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:t,children:[(0,L.jsx)(Ii,{size:14}),` Edit`]})})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsx)(uh,{title:`Coverage`,children:(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsx)(dh,{label:`Root`,count:n.root??0,variant:`primary`}),(0,L.jsx)(dh,{label:`Scoped`,count:n.scoped??0,variant:`primary`}),(0,L.jsx)(dh,{label:`Global`,count:n.global??0,variant:`secondary`}),(0,L.jsx)(dh,{label:`Unknown`,count:n.unknown??0,variant:`warning`})]})}),(0,L.jsx)(uh,{title:`Tenant Roots`,count:e.roots.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.roots.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`span`,{className:`muted`,style:{marginLeft:8,fontSize:12},children:e.label})]}),(0,L.jsxs)(Rm,{variant:`outline`,children:[`col: `,e.tenantIdColumn]})]}),e.parent&&(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Parent: `,(0,L.jsx)(`code`,{children:e.parent.root}),` via `,(0,L.jsx)(`code`,{children:e.parent.foreignKey})]})]},e.id))})}),e.hierarchy.length>0&&(0,L.jsx)(uh,{title:`Hierarchy Edges`,count:e.hierarchy.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.hierarchy.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12,fontSize:13},children:[(0,L.jsx)(`code`,{children:e.parent}),(0,L.jsx)(`span`,{className:`muted`,style:{margin:`0 8px`},children:`→`}),(0,L.jsx)(`code`,{children:e.child}),(0,L.jsxs)(`div`,{className:`muted tiny`,style:{marginTop:4},children:[`FK: `,e.foreignKey]})]},`${e.parent}-${e.child}`))})}),e.scopedTables.length>0&&(0,L.jsx)(uh,{title:`Scoped Tables`,count:e.scopedTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.scopedTables.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`grid`,gap:4},children:e.scopeThrough.map((e,t)=>(0,L.jsxs)(`p`,{className:`muted tiny`,children:[`via `,(0,L.jsx)(Rm,{variant:`outline`,children:e.root}),` `,`column`in e?(0,L.jsxs)(`span`,{children:[`column `,(0,L.jsx)(`code`,{children:e.column})]}):(0,L.jsxs)(`span`,{children:[`join `,e.join.map(e=>`${e.from} -> ${e.to}`).join(`, `)]})]},t))})]},e.id))})}),e.polymorphicTables.length>0&&(0,L.jsx)(uh,{title:`Polymorphic Tables`,count:e.polymorphicTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.polymorphicTables.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Type: `,(0,L.jsx)(`code`,{children:e.typeColumn}),` · ID: `,(0,L.jsx)(`code`,{children:e.idColumn})]}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:Object.entries(e.mapping).map(([e,t])=>(0,L.jsxs)(Rm,{variant:`outline`,children:[e,` → `,t]},e))})]},e.id))})}),e.globalTables.length>0&&(0,L.jsx)(uh,{title:`Global Tables`,count:e.globalTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.globalTables.map(e=>(0,L.jsx)(Rm,{variant:`secondary`,children:e},e))})}),(0,L.jsx)(uh,{title:`Table Coverage`,count:e.coverage.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{className:`card`,children:(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Table`}),(0,L.jsx)(`th`,{children:`Classification`}),(0,L.jsx)(`th`,{children:`Scope Roots`})]})}),(0,L.jsx)(`tbody`,{children:e.coverage.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.tableId})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rm,{variant:e.classification===`unknown`?`warning`:e.classification===`global`?`secondary`:`outline`,children:e.classification})}),(0,L.jsx)(`td`,{className:`muted tiny`,children:e.scopeRoots?.join(`, `)??`—`})]},e.tableId))})]})})})}),e.warnings.length>0&&(0,L.jsx)(uh,{title:`Policy Warnings`,count:e.warnings.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.warnings.map(e=>(0,L.jsx)(`pre`,{className:`warning-block`,children:fh(e)},String(e)))})})]})})]})}function ah({tenantPolicy:e,tables:t,busy:n,saveStatus:r,onSave:a,onCancel:o}){let[s,c]=(0,S.useState)(()=>ph(e)),[l,u]=(0,S.useState)(()=>e.body);return(0,L.jsx)(lh,{tables:t,frontmatter:s,body:l,busy:n,saveStatus:r,onFrontmatterChange:c,onBodyChange:u,onConfirm:()=>void a(s,l||void 0),onBack:o,title:`Edit Tenant Policy`,backLabel:`Cancel`,confirmLabel:`Save Changes`,badgeLabel:`Saved`})}function oh(e,t){switch(t.type){case`set_mode`:return{...e,mode:t.payload};case`set_draftStatus`:return{...e,draftStatus:t.payload};case`set_draftFrontmatter`:return{...e,draftFrontmatter:t.payload};case`set_draftBody`:return{...e,draftBody:t.payload};case`set_enforcement`:return{...e,enforcement:t.payload};case`set_rootTenantIdColumn`:return{...e,rootTenantIdColumn:t.payload};case`set_rootLabel`:return{...e,rootLabel:t.payload};case`select_root_table`:return{...e,rootTableId:t.tableId,rootLabel:t.label,rootTenantIdColumn:``};case`toggle_global_table`:return{...e,globalTableIds:t.checked?[...e.globalTableIds,t.tableId]:e.globalTableIds.filter(e=>e!==t.tableId)};case`ai_draft_complete`:return{...e,draftFrontmatter:t.frontmatter,draftBody:t.body,mode:`review`,draftStatus:{kind:`success`,text:`AI draft ready for review.`}};case`manual_to_review`:return{...e,draftFrontmatter:t.frontmatter,draftBody:t.body,mode:`review`}}}var sh={mode:`choose`,draftStatus:null,draftFrontmatter:null,draftBody:``,enforcement:`strict`,rootTableId:``,rootTenantIdColumn:``,rootLabel:``,globalTableIds:[]};function ch({tables:e,schemaId:t,aiConfigured:n,busy:r,onSave:a,onSuggest:o,saveStatus:s}){let[c,l]=(0,S.useReducer)(oh,sh),{mode:u,draftStatus:d,draftFrontmatter:f,draftBody:p,enforcement:m,rootTableId:h,rootTenantIdColumn:g,rootLabel:_,globalTableIds:v}=c,y=e.find(e=>e.physical.id===h)?.physical.columns??[];async function b(){l({type:`set_draftStatus`,payload:{kind:`loading`,text:`Analyzing schema and drafting tenant policy...`}});try{let e=await o();l({type:`ai_draft_complete`,frontmatter:e.frontmatter,body:e.body})}catch(e){l({type:`set_draftStatus`,payload:{kind:`error`,text:e instanceof Error?e.message:String(e)}})}}function x(){!h||!g||!_.trim()||l({type:`manual_to_review`,frontmatter:{schemaId:t,enforcement:m,roots:[{id:h,tenantIdColumn:g,label:_.trim()}],...v.length>0?{globalTables:v}:{}},body:`# Tenant Policy
|
|
55
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return S.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Mc=`DialogDescriptionWarning`,Nc=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ac(Mc).contentName}}.`;return S.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Pc=ac,Fc=dc,Ic=pc,Lc=_c,Rc=Sc,zc=wc,Bc=Ec;function Vc(e){let[t,n]=S.useState(void 0);return Ea(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],a,o;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,o=t.blockSize}else a=e.offsetWidth,o=e.offsetHeight;n({width:a,height:o})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Hc=[`top`,`right`,`bottom`,`left`],Uc=Math.min,Wc=Math.max,Gc=Math.round,Kc=Math.floor,qc=e=>({x:e,y:e}),Jc={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Yc(e,t,n){return Wc(e,Uc(t,n))}function Xc(e,t){return typeof e==`function`?e(t):e}function Zc(e){return e.split(`-`)[0]}function Qc(e){return e.split(`-`)[1]}function $c(e){return e===`x`?`y`:`x`}function el(e){return e===`y`?`height`:`width`}function tl(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function nl(e){return $c(tl(e))}function rl(e,t,n){n===void 0&&(n=!1);let r=Qc(e),a=nl(e),o=el(a),s=a===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[o]>t.floating[o]&&(s=fl(s)),[s,fl(s)]}function il(e){let t=fl(e);return[al(e),t,al(t)]}function al(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ol=[`left`,`right`],sl=[`right`,`left`],cl=[`top`,`bottom`],ll=[`bottom`,`top`];function ul(e,t,n){switch(e){case`top`:case`bottom`:return n?t?sl:ol:t?ol:sl;case`left`:case`right`:return t?cl:ll;default:return[]}}function dl(e,t,n,r){let a=Qc(e),o=ul(Zc(e),n===`start`,r);return a&&(o=o.map(e=>e+`-`+a),t&&(o=o.concat(o.map(al)))),o}function fl(e){let t=Zc(e);return Jc[t]+e.slice(t.length)}function pl(e){return{top:0,right:0,bottom:0,left:0,...e}}function ml(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pl(e)}function hl(e){let{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function gl(e,t,n){let{reference:r,floating:a}=e,o=tl(t),s=nl(t),c=el(s),l=Zc(t),u=o===`y`,d=r.x+r.width/2-a.width/2,f=r.y+r.height/2-a.height/2,p=r[c]/2-a[c]/2,m;switch(l){case`top`:m={x:d,y:r.y-a.height};break;case`bottom`:m={x:d,y:r.y+r.height};break;case`right`:m={x:r.x+r.width,y:f};break;case`left`:m={x:r.x-a.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Qc(t)){case`start`:m[s]-=p*(n&&u?-1:1);break;case`end`:m[s]+=p*(n&&u?-1:1);break}return m}async function _l(e,t){t===void 0&&(t={});let{x:n,y:r,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=Xc(t,e),m=ml(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=hl(await a.getClippingRect({element:await(a.isElement==null?void 0:a.isElement(h))??!0?h:h.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:n,y:r,width:o.floating.width,height:o.floating.height}:o.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=hl(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var vl=50,yl=async(e,t,n)=>{let{placement:r=`bottom`,strategy:a=`absolute`,middleware:o=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:_l},l=await(s.isRTL==null?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:a}),{x:d,y:f}=gl(u,r,l),p=r,m=0,h={};for(let n=0;n<o.length;n++){let g=o[n];if(!g)continue;let{name:_,fn:v}=g,{x:y,y:b,data:x,reset:S}=await v({x:d,y:f,initialPlacement:r,placement:p,strategy:a,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});d=y??d,f=b??f,h[_]={...h[_],...x},S&&m<vl&&(m++,typeof S==`object`&&(S.placement&&(p=S.placement),S.rects&&(u=S.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:a}):S.rects),{x:d,y:f}=gl(u,p,l)),n=-1)}return{x:d,y:f,placement:p,strategy:a,middlewareData:h}},bl=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:a,rects:o,platform:s,elements:c,middlewareData:l}=t,{element:u,padding:d=0}=Xc(e,t)||{};if(u==null)return{};let f=ml(d),p={x:n,y:r},m=nl(a),h=el(m),g=await s.getDimensions(u),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=o.reference[h]+o.reference[m]-p[m]-o.floating[h],S=p[m]-o.reference[m],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u)),w=C?C[b]:0;(!w||!await(s.isElement==null?void 0:s.isElement(C)))&&(w=c.floating[b]||o.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Uc(f[v],E),ee=Uc(f[y],E),O=D,te=w-g[h]-ee,k=w/2-g[h]/2+T,A=Yc(O,k,te),ne=!l.arrow&&Qc(a)!=null&&k!==A&&o.reference[h]/2-(k<O?D:ee)-g[h]/2<0,j=ne?k<O?k-O:k-te:0;return{[m]:p[m]+j,data:{[m]:A,centerOffset:k-A-j,...ne&&{alignmentOffset:j}},reset:ne}}}),xl=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p=`bestFit`,fallbackAxisSideDirection:m=`none`,flipAlignment:h=!0,...g}=Xc(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let _=Zc(r),v=tl(s),y=Zc(s)===s,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=f||(y||!h?[fl(s)]:il(s)),S=m!==`none`;!f&&S&&x.push(...dl(s,h,m,b));let C=[s,...x],w=await c.detectOverflow(t,g),T=[],E=a.flip?.overflows||[];if(u&&T.push(w[_]),d){let e=rl(r,o,b);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(e=>e<=0)){let e=(a.flip?.index||0)+1,t=C[e];if(t&&(!(d===`alignment`&&v!==tl(t))||E.every(e=>tl(e.placement)===v?e.overflows[0]>0:!0)))return{data:{index:e,overflows:E},reset:{placement:t}};let n=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(p){case`bestFit`:{let e=E.filter(e=>{if(S){let t=tl(e.placement);return t===v||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Sl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cl(e){return Hc.some(t=>e[t]>=0)}var wl=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:a=`referenceHidden`,...o}=Xc(e,t);switch(a){case`referenceHidden`:{let e=Sl(await r.detectOverflow(t,{...o,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cl(e)}}}case`escaped`:{let e=Sl(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cl(e)}}}default:return{}}}}},Tl=new Set([`left`,`top`]);async function El(e,t){let{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),s=Zc(n),c=Qc(n),l=tl(n)===`y`,u=Tl.has(s)?-1:1,d=o&&l?-1:1,f=Xc(t,e),{mainAxis:p,crossAxis:m,alignmentAxis:h}=typeof f==`number`?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h==`number`&&(m=c===`end`?h*-1:h),l?{x:m*d,y:p*u}:{x:p*u,y:m*d}}var Dl=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:a,placement:o,middlewareData:s}=t,c=await El(t,e);return o===s.offset?.placement&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:r+c.x,y:a+c.y,data:{...c,placement:o}}}}},Ol=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:a,platform:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=Xc(e,t),d={x:n,y:r},f=await o.detectOverflow(t,u),p=tl(Zc(a)),m=$c(p),h=d[m],g=d[p];if(s){let e=m===`y`?`top`:`left`,t=m===`y`?`bottom`:`right`,n=h+f[e],r=h-f[t];h=Yc(n,h,r)}if(c){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=g+f[e],r=g-f[t];g=Yc(n,g,r)}let _=l.fn({...t,[m]:h,[p]:g});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[m]:s,[p]:c}}}}}},kl=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:a,rects:o,middlewareData:s}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Xc(e,t),d={x:n,y:r},f=tl(a),p=$c(f),m=d[p],h=d[f],g=Xc(c,t),_=typeof g==`number`?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){let e=p===`y`?`height`:`width`,t=o.reference[p]-o.floating[e]+_.mainAxis,n=o.reference[p]+o.reference[e]-_.mainAxis;m<t?m=t:m>n&&(m=n)}if(u){let e=p===`y`?`width`:`height`,t=Tl.has(Zc(a)),n=o.reference[f]-o.floating[e]+(t&&s.offset?.[f]||0)+(t?0:_.crossAxis),r=o.reference[f]+o.reference[e]+(t?0:s.offset?.[f]||0)-(t?_.crossAxis:0);h<n?h=n:h>r&&(h=r)}return{[p]:m,[f]:h}}}},Al=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:a,rects:o,platform:s,elements:c}=t,{apply:l=()=>{},...u}=Xc(e,t),d=await s.detectOverflow(t,u),f=Zc(a),p=Qc(a),m=tl(a)===`y`,{width:h,height:g}=o.floating,_,v;f===`top`||f===`bottom`?(_=f,v=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?`start`:`end`)?`left`:`right`):(v=f,_=p===`end`?`top`:`bottom`);let y=g-d.top-d.bottom,b=h-d.left-d.right,x=Uc(g-d[_],y),S=Uc(h-d[v],b),C=!t.middlewareData.shift,w=x,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=y),C&&!p){let e=Wc(d.left,0),t=Wc(d.right,0),n=Wc(d.top,0),r=Wc(d.bottom,0);m?T=h-2*(e!==0||t!==0?e+t:Wc(d.left,d.right)):w=g-2*(n!==0||r!==0?n+r:Wc(d.top,d.bottom))}await l({...t,availableWidth:T,availableHeight:w});let E=await s.getDimensions(c.floating);return h!==E.width||g!==E.height?{reset:{rects:!0}}:{}}}};function jl(){return typeof window<`u`}function Ml(e){return Fl(e)?(e.nodeName||``).toLowerCase():`#document`}function Nl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pl(e){return((Fl(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fl(e){return jl()?e instanceof Node||e instanceof Nl(e).Node:!1}function Il(e){return jl()?e instanceof Element||e instanceof Nl(e).Element:!1}function Ll(e){return jl()?e instanceof HTMLElement||e instanceof Nl(e).HTMLElement:!1}function Rl(e){return!jl()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Nl(e).ShadowRoot}function zl(e){let{overflow:t,overflowX:n,overflowY:r,display:a}=Kl(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!==`inline`&&a!==`contents`}function Bl(e){return/^(table|td|th)$/.test(Ml(e))}function Vl(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Hl=/transform|translate|scale|rotate|perspective|filter/,Ul=/paint|layout|strict|content/,H=e=>!!e&&e!==`none`,Wl;function U(e){let t=Il(e)?Kl(e):e;return H(t.transform)||H(t.translate)||H(t.scale)||H(t.rotate)||H(t.perspective)||!G()&&(H(t.backdropFilter)||H(t.filter))||Hl.test(t.willChange||``)||Ul.test(t.contain||``)}function W(e){let t=Jl(e);for(;Ll(t)&&!Gl(t);){if(U(t))return t;if(Vl(t))return null;t=Jl(t)}return null}function G(){return Wl??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Wl}function Gl(e){return/^(html|body|#document)$/.test(Ml(e))}function Kl(e){return Nl(e).getComputedStyle(e)}function ql(e){return Il(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jl(e){if(Ml(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Rl(e)&&e.host||Pl(e);return Rl(t)?t.host:t}function Yl(e){let t=Jl(e);return Gl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ll(t)&&zl(t)?t:Yl(t)}function Xl(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Yl(e),a=r===e.ownerDocument?.body,o=Nl(r);if(a){let e=Zl(o);return t.concat(o,o.visualViewport||[],zl(r)?r:[],e&&n?Xl(e):[])}else return t.concat(r,Xl(r,[],n))}function Zl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ql(e){let t=Kl(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,a=Ll(e),o=a?e.offsetWidth:n,s=a?e.offsetHeight:r,c=Gc(n)!==o||Gc(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function $l(e){return Il(e)?e:e.contextElement}function eu(e){let t=$l(e);if(!Ll(t))return qc(1);let n=t.getBoundingClientRect(),{width:r,height:a,$:o}=Ql(t),s=(o?Gc(n.width):n.width)/r,c=(o?Gc(n.height):n.height)/a;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}var tu=qc(0);function nu(e){let t=Nl(e);return!G()||!t.visualViewport?tu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ru(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nl(e)?!1:t}function iu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let a=e.getBoundingClientRect(),o=$l(e),s=qc(1);t&&(r?Il(r)&&(s=eu(r)):s=eu(e));let c=ru(o,n,r)?nu(o):qc(0),l=(a.left+c.x)/s.x,u=(a.top+c.y)/s.y,d=a.width/s.x,f=a.height/s.y;if(o){let e=Nl(o),t=r&&Il(r)?Nl(r):r,n=e,a=Zl(n);for(;a&&r&&t!==n;){let e=eu(a),t=a.getBoundingClientRect(),r=Kl(a),o=t.left+(a.clientLeft+parseFloat(r.paddingLeft))*e.x,s=t.top+(a.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,u*=e.y,d*=e.x,f*=e.y,l+=o,u+=s,n=Nl(a),a=Zl(n)}}return hl({width:d,height:f,x:l,y:u})}function au(e,t){let n=ql(e).scrollLeft;return t?t.left+n:iu(Pl(e)).left+n}function ou(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-au(e,n),y:n.top+t.scrollTop}}function su(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e,o=a===`fixed`,s=Pl(r),c=t?Vl(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=qc(1),d=qc(0),f=Ll(r);if((f||!f&&!o)&&((Ml(r)!==`body`||zl(s))&&(l=ql(r)),f)){let e=iu(r);u=eu(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}let p=s&&!f&&!o?ou(s,l):qc(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function cu(e){return Array.from(e.getClientRects())}function lu(e){let t=Pl(e),n=ql(e),r=e.ownerDocument.body,a=Wc(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Wc(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+au(e),c=-n.scrollTop;return Kl(r).direction===`rtl`&&(s+=Wc(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:s,y:c}}var uu=25;function du(e,t){let n=Nl(e),r=Pl(e),a=n.visualViewport,o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(a){o=a.width,s=a.height;let e=G();(!e||e&&t===`fixed`)&&(c=a.offsetLeft,l=a.offsetTop)}let u=au(r);if(u<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),a=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,s=Math.abs(r.clientWidth-t.clientWidth-a);s<=uu&&(o-=s)}else u<=uu&&(o+=u);return{width:o,height:s,x:c,y:l}}function fu(e,t){let n=iu(e,!0,t===`fixed`),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Ll(e)?eu(e):qc(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:a*o.x,y:r*o.y}}function pu(e,t,n){let r;if(t===`viewport`)r=du(e,n);else if(t===`document`)r=lu(Pl(e));else if(Il(t))r=fu(t,n);else{let n=nu(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return hl(r)}function mu(e,t){let n=Jl(e);return n===t||!Il(n)||Gl(n)?!1:Kl(n).position===`fixed`||mu(n,t)}function hu(e,t){let n=t.get(e);if(n)return n;let r=Xl(e,[],!1).filter(e=>Il(e)&&Ml(e)!==`body`),a=null,o=Kl(e).position===`fixed`,s=o?Jl(e):e;for(;Il(s)&&!Gl(s);){let t=Kl(s),n=U(s);!n&&t.position===`fixed`&&(a=null),(o?!n&&!a:!n&&t.position===`static`&&a&&(a.position===`absolute`||a.position===`fixed`)||zl(s)&&!n&&mu(e,s))?r=r.filter(e=>e!==s):a=t,s=Jl(s)}return t.set(e,r),r}function gu(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e,o=[...n===`clippingAncestors`?Vl(t)?[]:hu(t,this._c):[].concat(n),r],s=pu(t,o[0],a),c=s.top,l=s.right,u=s.bottom,d=s.left;for(let e=1;e<o.length;e++){let n=pu(t,o[e],a);c=Wc(n.top,c),l=Uc(n.right,l),u=Uc(n.bottom,u),d=Wc(n.left,d)}return{width:l-d,height:u-c,x:d,y:c}}function _u(e){let{width:t,height:n}=Ql(e);return{width:t,height:n}}function vu(e,t,n){let r=Ll(t),a=Pl(t),o=n===`fixed`,s=iu(e,!0,o,t),c={scrollLeft:0,scrollTop:0},l=qc(0);function u(){l.x=au(a)}if(r||!r&&!o)if((Ml(t)!==`body`||zl(a))&&(c=ql(t)),r){let e=iu(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&u();o&&!r&&a&&u();let d=a&&!r&&!o?ou(a,c):qc(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function yu(e){return Kl(e).position===`static`}function bu(e,t){if(!Ll(e)||Kl(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pl(e)===n&&(n=n.ownerDocument.body),n}function xu(e,t){let n=Nl(e);if(Vl(e))return n;if(!Ll(e)){let t=Jl(e);for(;t&&!Gl(t);){if(Il(t)&&!yu(t))return t;t=Jl(t)}return n}let r=bu(e,t);for(;r&&Bl(r)&&yu(r);)r=bu(r,t);return r&&Gl(r)&&yu(r)&&!U(r)?n:r||W(e)||n}var Su=async function(e){let t=this.getOffsetParent||xu,n=this.getDimensions,r=await n(e.floating);return{reference:vu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cu(e){return Kl(e).direction===`rtl`}var wu={convertOffsetParentRelativeRectToViewportRelativeRect:su,getDocumentElement:Pl,getClippingRect:gu,getOffsetParent:xu,getElementRects:Su,getClientRects:cu,getDimensions:_u,getScale:eu,isElement:Il,isRTL:Cu};function Tu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eu(e,t){let n=null,r,a=Pl(e);function o(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();let u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:m}=u;if(c||t(),!p||!m)return;let h=Kc(f),g=Kc(a.clientWidth-(d+p)),_=Kc(a.clientHeight-(f+m)),v=Kc(d),y={rootMargin:-h+`px `+-g+`px `+-_+`px `+-v+`px`,threshold:Wc(0,Uc(1,l))||1},b=!0;function x(t){let n=t[0].intersectionRatio;if(n!==l){if(!b)return s();n?s(!1,n):r=setTimeout(()=>{s(!1,1e-7)},1e3)}n===1&&!Tu(u,e.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(x,{...y,root:a.ownerDocument})}catch{n=new IntersectionObserver(x,y)}n.observe(e)}return s(!0),o}function Du(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver==`function`,layoutShift:c=typeof IntersectionObserver==`function`,animationFrame:l=!1}=r,u=$l(e),d=a||o?[...u?Xl(u):[],...t?Xl(t):[]]:[];d.forEach(e=>{a&&e.addEventListener(`scroll`,n,{passive:!0}),o&&e.addEventListener(`resize`,n)});let f=u&&c?Eu(u,n):null,p=-1,m=null;s&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;(e=m)==null||e.observe(t)})),n()}),u&&!l&&m.observe(u),t&&m.observe(t));let h,g=l?iu(e):null;l&&_();function _(){let t=iu(e);g&&!Tu(g,t)&&n(),g=t,h=requestAnimationFrame(_)}return n(),()=>{var e;d.forEach(e=>{a&&e.removeEventListener(`scroll`,n),o&&e.removeEventListener(`resize`,n)}),f?.(),(e=m)==null||e.disconnect(),m=null,l&&cancelAnimationFrame(h)}}var Ou=Dl,ku=Ol,Au=xl,ju=Al,Mu=wl,Nu=bl,Pu=kl,Fu=(e,t,n)=>{let r=new Map,a={platform:wu,...n},o={...a.platform,_c:r};return yl(e,t,{...a,platform:o})},Iu=typeof document<`u`?S.useLayoutEffect:function(){};function Lu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Lu(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){let n=a[r];if(!(n===`_owner`&&e.$$typeof)&&!Lu(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Ru(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zu(e,t){let n=Ru(e);return Math.round(t*n)/n}function Bu(e){let t=S.useRef(e);return Iu(()=>{t.current=e}),t}function Vu(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:a,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[d,f]=S.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=S.useState(r);Lu(p,r)||m(r);let[h,g]=S.useState(null),[_,v]=S.useState(null),y=S.useCallback(e=>{e!==w.current&&(w.current=e,g(e))},[]),b=S.useCallback(e=>{e!==T.current&&(T.current=e,v(e))},[]),x=o||h,C=s||_,w=S.useRef(null),T=S.useRef(null),E=S.useRef(d),D=l!=null,ee=Bu(l),O=Bu(a),te=Bu(u),k=S.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:p};O.current&&(e.platform=O.current),Fu(w.current,T.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};A.current&&!Lu(E.current,t)&&(E.current=t,ha.flushSync(()=>{f(t)}))})},[p,t,n,O,te]);Iu(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[u]);let A=S.useRef(!1);Iu(()=>(A.current=!0,()=>{A.current=!1}),[]),Iu(()=>{if(x&&(w.current=x),C&&(T.current=C),x&&C){if(ee.current)return ee.current(x,C,k);k()}},[x,C,k,ee,D]);let ne=S.useMemo(()=>({reference:w,floating:T,setReference:y,setFloating:b}),[y,b]),j=S.useMemo(()=>({reference:x,floating:C}),[x,C]),re=S.useMemo(()=>{let e={position:n,left:0,top:0};if(!j.floating)return e;let t=zu(j.floating,d.x),r=zu(j.floating,d.y);return c?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Ru(j.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,c,j.floating,d.x,d.y]);return S.useMemo(()=>({...d,update:k,refs:ne,elements:j,floatingStyles:re}),[d,k,ne,j,re])}var Hu=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:a}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Nu({element:r.current,padding:a}).fn(n):r?Nu({element:r,padding:a}).fn(n):{}}}},Uu=(e,t)=>{let n=Ou(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wu=(e,t)=>{let n=ku(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gu=(e,t)=>({fn:Pu(e).fn,options:[e,t]}),Ku=(e,t)=>{let n=Au(e);return{name:n.name,fn:n.fn,options:[e,t]}},qu=(e,t)=>{let n=ju(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ju=(e,t)=>{let n=Mu(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yu=(e,t)=>{let n=Hu(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xu=`Arrow`,K=S.forwardRef((e,t)=>{let{children:n,width:r=10,height:a=5,...o}=e;return(0,L.jsx)(ga.svg,{...o,ref:t,width:r,height:a,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,L.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});K.displayName=Xu;var Zu=K,Qu=`Popper`,[$u,ed]=Ca(Qu),[td,nd]=$u(Qu),rd=e=>{let{__scopePopper:t,children:n}=e,[r,a]=S.useState(null),[o,s]=S.useState(void 0);return(0,L.jsx)(td,{scope:t,anchor:r,onAnchorChange:a,placementState:o,setPlacementState:s,children:n})};rd.displayName=Qu;var id=`PopperAnchor`,ad=S.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...a}=e,o=nd(id,n),s=S.useRef(null),c=o.onAnchorChange,l=ea(t,S.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=S.useRef(null);S.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&c(u.current)});let d=o.placementState&&hd(o.placementState),f=d?.[0],p=d?.[1];return r?null:(0,L.jsx)(ga.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});ad.displayName=id;var od=`PopperContent`,[sd,cd]=$u(od),ld=S.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u,collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=nd(od,n),[v,y]=S.useState(null),b=ea(t,e=>y(e)),[x,C]=S.useState(null),w=Vc(x),T=w?.width??0,E=w?.height??0,D=r+(o===`center`?``:`-`+o),ee=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},O=u?Array.isArray(u)?u:[u]:void 0,te=O!==void 0&&O.length>0,k={padding:ee,boundary:O?.filter(pd),altBoundary:te},{refs:A,floatingStyles:ne,placement:j,isPositioned:re,middlewareData:ie}=Vu({strategy:`fixed`,placement:D,whileElementsMounted:(...e)=>Du(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[Uu({mainAxis:a+E,alignmentAxis:s}),l&&Wu({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?Gu():void 0,...k}),l&&Ku({...k}),qu({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:a,height:o}=t.reference,s=e.floating.style;s.setProperty(`--radix-popper-available-width`,`${n}px`),s.setProperty(`--radix-popper-available-height`,`${r}px`),s.setProperty(`--radix-popper-anchor-width`,`${a}px`),s.setProperty(`--radix-popper-anchor-height`,`${o}px`)}}),x&&Yu({element:x,padding:c}),md({arrowWidth:T,arrowHeight:E}),p&&Ju({strategy:`referenceHidden`,...k})]}),M=_.setPlacementState;Ea(()=>(M(j),()=>{M(void 0)}),[j,M]);let[N,ae]=hd(j),oe=eo(h);Ea(()=>{re&&oe?.()},[re,oe]);let se=ie.arrow?.x,P=ie.arrow?.y,F=ie.arrow?.centerOffset!==0,[I,ce]=S.useState();return Ea(()=>{v&&ce(window.getComputedStyle(v).zIndex)},[v]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:re?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:I,"--radix-popper-transform-origin":[ie.transformOrigin?.x,ie.transformOrigin?.y].join(` `),...ie.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(sd,{scope:n,placedSide:N,placedAlign:ae,onArrowChange:C,arrowX:se,arrowY:P,shouldHideArrow:F,children:(0,L.jsx)(ga.div,{"data-side":N,"data-align":ae,...g,ref:b,style:{...g.style,animation:re?void 0:`none`}})})})});ld.displayName=od;var ud=`PopperArrow`,dd={top:`bottom`,right:`left`,bottom:`top`,left:`right`},fd=S.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,a=cd(ud,n),o=dd[a.placedSide];return(0,L.jsx)(`span`,{ref:a.onArrowChange,style:{position:`absolute`,left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[a.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[a.placedSide],visibility:a.shouldHideArrow?`hidden`:void 0},children:(0,L.jsx)(Zu,{...r,ref:t,style:{...r.style,display:`block`}})})});fd.displayName=ud;function pd(e){return e!==null}var md=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:a}=t,o=a.arrow?.centerOffset!==0,s=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[l,u]=hd(n),d={start:`0%`,center:`50%`,end:`100%`}[u],f=(a.arrow?.x??0)+s/2,p=(a.arrow?.y??0)+c/2,m=``,h=``;return l===`bottom`?(m=o?d:`${f}px`,h=`${-c}px`):l===`top`?(m=o?d:`${f}px`,h=`${r.floating.height+c}px`):l===`right`?(m=`${-c}px`,h=o?d:`${p}px`):l===`left`&&(m=`${r.floating.width+c}px`,h=o?d:`${p}px`),{data:{x:m,y:h}}}});function hd(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var gd=rd,_d=ad,vd=ld,yd=fd,bd=`Separator`,xd=`horizontal`,Sd=[`horizontal`,`vertical`],Cd=S.forwardRef((e,t)=>{let{decorative:n,orientation:r=xd,...a}=e,o=wd(r)?r:xd,s=n?{role:`none`}:{"aria-orientation":o===`vertical`?o:void 0,role:`separator`};return(0,L.jsx)(ga.div,{"data-orientation":o,...s,...a,ref:t})});Cd.displayName=bd;function wd(e){return Sd.includes(e)}var Td=Cd,[q,Ed]=Ca(`Tooltip`,[ed]),Dd=ed(),Od=`TooltipProvider`,kd=700,Ad=`tooltip.open`,[jd,Md]=q(Od),Nd=e=>{let{__scopeTooltip:t,delayDuration:n=kd,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,s=S.useRef(!0),c=S.useRef(!1),l=S.useRef(0);return S.useEffect(()=>{let e=l.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(jd,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:S.useCallback(()=>{r<=0||(window.clearTimeout(l.current),s.current=!1)},[r]),onClose:S.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:c,onPointerInTransitChange:S.useCallback(e=>{c.current=e},[]),disableHoverableContent:a,children:o})};Nd.displayName=Od;var Pd=`Tooltip`,[Fd,Id]=q(Pd),Ld=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=Md(Pd,e.__scopeTooltip),u=Dd(t),[d,f]=S.useState(null),p=Ba(),m=S.useRef(0),h=s??l.disableHoverableContent,g=c??l.delayDuration,_=S.useRef(!1),[v,y]=Oa({prop:r,defaultProp:a??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ad))):l.onClose(),o?.(e)},caller:Pd}),b=S.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=S.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),C=S.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),w=S.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return S.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,L.jsx)(gd,{...u,children:(0,L.jsx)(Fd,{scope:t,contentId:p,open:v,stateAttribute:b,trigger:d,onTriggerChange:f,onTriggerEnter:S.useCallback(()=>{l.isOpenDelayedRef.current?w():x()},[l.isOpenDelayedRef,w,x]),onTriggerLeave:S.useCallback(()=>{h?C():(window.clearTimeout(m.current),m.current=0)},[C,h]),onOpen:x,onClose:C,disableHoverableContent:h,children:n})})};Ld.displayName=Pd;var Rd=`TooltipTrigger`,J=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=Id(Rd,n),o=Md(Rd,n),s=Dd(n),c=ea(t,S.useRef(null),a.onTriggerChange),l=S.useRef(!1),u=S.useRef(!1),d=S.useCallback(()=>l.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,L.jsx)(_d,{asChild:!0,...s,children:(0,L.jsx)(ga.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:Ta(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ta(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:Ta(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:Ta(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:Ta(e.onBlur,a.onClose),onClick:Ta(e.onClick,a.onClose)})})});J.displayName=Rd;var zd=`TooltipPortal`,[Bd,Vd]=q(zd,{forceMount:void 0}),Hd=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=Id(zd,t);return(0,L.jsx)(Bd,{scope:t,forceMount:n,children:(0,L.jsx)(Ma,{present:n||o.open,children:(0,L.jsx)(jo,{asChild:!0,container:a,children:r})})})};Hd.displayName=zd;var Ud=`TooltipContent`,Wd=S.forwardRef((e,t)=>{let n=Vd(Ud,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a=`top`,...o}=e,s=Id(Ud,e.__scopeTooltip);return(0,L.jsx)(Ma,{present:r||s.open,children:s.disableHoverableContent?(0,L.jsx)(Yd,{side:a,...o,ref:t}):(0,L.jsx)(Gd,{side:a,...o,ref:t})})}),Gd=S.forwardRef((e,t)=>{let n=Id(Ud,e.__scopeTooltip),r=Md(Ud,e.__scopeTooltip),a=S.useRef(null),o=ea(t,a),[s,c]=S.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},a=$d(r,Qd(r,n.getBoundingClientRect())),o=ef(t.getBoundingClientRect());c(nf([...a,...o])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),a=!tf(n,s);r?p():a&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,L.jsx)(Yd,{...e,ref:o})}),[Kd,qd]=q(Pd,{isInside:!1}),Jd=ia(`TooltipContent`),Yd=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Id(Ud,n),u=Dd(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(Ad,d),()=>document.removeEventListener(Ad,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,L.jsx)(co,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(vd,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(Jd,{children:r}),(0,L.jsx)(Kd,{scope:n,isInside:!0,children:(0,L.jsx)(xa,{id:l.contentId,role:`tooltip`,children:a||r})})]})})});Wd.displayName=Ud;var Xd=`TooltipArrow`,Zd=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=Dd(n);return qd(Xd,n).isInside?null:(0,L.jsx)(yd,{...a,...r,ref:t})});Zd.displayName=Xd;function Qd(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return`left`;case a:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function $d(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ef(e){let{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function tf(e,t){let{x:n,y:r}=e,a=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let s=t[e],c=t[o],l=s.x,u=s.y,d=c.x,f=c.y;u>r!=f>r&&n<(d-l)*(r-u)/(f-u)+l&&(a=!a)}return a}function nf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),rf(t)}function rf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var af=Nd,of=Ld,sf=J,cf=Hd,lf=Wd,uf=Zd,df=768;function ff(){let[e,t]=S.useState(()=>typeof window<`u`?window.innerWidth<df:void 0);return S.useEffect(()=>{let e=window.matchMedia(`(max-width: ${df-1}px)`),n=()=>{t(window.innerWidth<df)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),!!e}var pf=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},mf=(e,t)=>({classGroupId:e,validator:t}),hf=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),gf=`-`,_f=[],vf=`arbitrary..`,yf=e=>{let t=Sf(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return xf(e);let n=e.split(gf);return bf(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],a=n[e];return t?a?pf(a,t):t:a||_f}return n[e]||_f}}},bf=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],a=n.nextPart.get(r);if(a){let n=bf(e,t+1,a);if(n)return n}let o=n.validators;if(o===null)return;let s=t===0?e.join(gf):e.slice(t).join(gf),c=o.length;for(let e=0;e<c;e++){let t=o[e];if(t.validator(s))return t.classGroupId}},xf=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?vf+r:void 0})(),Sf=e=>{let{theme:t,classGroups:n}=e;return Cf(n,t)},Cf=(e,t)=>{let n=hf();for(let r in e){let a=e[r];wf(a,n,r,t)}return n},wf=(e,t,n,r)=>{let a=e.length;for(let o=0;o<a;o++){let a=e[o];Tf(a,t,n,r)}},Tf=(e,t,n,r)=>{if(typeof e==`string`){Ef(e,t,n);return}if(typeof e==`function`){Df(e,t,n,r);return}Of(e,t,n,r)},Ef=(e,t,n)=>{let r=e===``?t:kf(t,e);r.classGroupId=n},Df=(e,t,n,r)=>{if(Af(e)){wf(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(mf(n,e))},Of=(e,t,n,r)=>{let a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];wf(s,kf(t,o),n,r)}},kf=(e,t)=>{let n=e,r=t.split(gf),a=r.length;for(let e=0;e<a;e++){let t=r[e],a=n.nextPart.get(t);a||(a=hf(),n.nextPart.set(t,a)),n=a}return n},Af=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,jf=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),a=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return a(e,t),t},set(e,t){e in n?n[e]=t:a(e,t)}}},Mf=`!`,Nf=`:`,Pf=[],Ff=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),If=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,a=0,o,s=e.length;for(let c=0;c<s;c++){let s=e[c];if(n===0&&r===0){if(s===Nf){t.push(e.slice(a,c)),a=c+1;continue}if(s===`/`){o=c;continue}}s===`[`?n++:s===`]`?n--:s===`(`?r++:s===`)`&&r--}let c=t.length===0?e:e.slice(a),l=c,u=!1;c.endsWith(Mf)?(l=c.slice(0,-1),u=!0):c.startsWith(Mf)&&(l=c.slice(1),u=!0);let d=o&&o>a?o-a:void 0;return Ff(t,u,l,d)};if(t){let e=t+Nf,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ff(Pf,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Lf=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let a=0;a<e.length;a++){let o=e[a],s=o[0]===`[`,c=t.has(o);s||c?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(o)):r.push(o)}return r.length>0&&(r.sort(),n.push(...r)),n}},Rf=e=>({cache:jf(e.cacheSize),parseClassName:If(e),sortModifiers:Lf(e),postfixLookupClassGroupIds:zf(e),...yf(e)}),zf=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Bf=/\s+/,Vf=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:s}=t,c=[],l=e.trim().split(Bf),u=``;for(let e=l.length-1;e>=0;--e){let t=l[e],{isExternal:d,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:h}=n(t);if(d){u=t+(u.length>0?` `+u:u);continue}let g=!!h,_;if(g){_=r(m.substring(0,h));let e=_&&s[_]?r(m):void 0;e&&e!==_&&(_=e,g=!1)}else _=r(m);if(!_){if(!g){u=t+(u.length>0?` `+u:u);continue}if(_=r(m),!_){u=t+(u.length>0?` `+u:u);continue}g=!1}let v=f.length===0?``:f.length===1?f[0]:o(f).join(`:`),y=p?v+Mf:v,b=y+_;if(c.indexOf(b)>-1)continue;c.push(b);let x=a(_,g);for(let e=0;e<x.length;++e){let t=x[e];c.push(y+t)}u=t+(u.length>0?` `+u:u)}return u},Hf=(...e)=>{let t=0,n,r,a=``;for(;t<e.length;)(n=e[t++])&&(r=Uf(n))&&(a&&(a+=` `),a+=r);return a},Uf=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Uf(e[r]))&&(n&&(n+=` `),n+=t);return n},Wf=(e,...t)=>{let n,r,a,o,s=s=>(n=Rf(t.reduce((e,t)=>t(e),e())),r=n.cache.get,a=n.cache.set,o=c,c(s)),c=e=>{let t=r(e);if(t)return t;let o=Vf(e,n);return a(e,o),o};return o=s,(...e)=>o(Hf(...e))},Gf=[],Kf=e=>{let t=t=>t[e]||Gf;return t.isThemeGetter=!0,t},qf=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Jf=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Yf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Xf=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zf=/\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$/,Qf=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$f=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ep=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tp=e=>Yf.test(e),Y=e=>!!e&&!Number.isNaN(Number(e)),np=e=>!!e&&Number.isInteger(Number(e)),rp=e=>e.endsWith(`%`)&&Y(e.slice(0,-1)),ip=e=>Xf.test(e),ap=()=>!0,op=e=>Zf.test(e)&&!Qf.test(e),sp=()=>!1,cp=e=>$f.test(e),lp=e=>ep.test(e),up=e=>!X(e)&&!Z(e),dp=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),fp=e=>Dp(e,jp,sp),X=e=>qf.test(e),pp=e=>Dp(e,Mp,op),mp=e=>Dp(e,Np,Y),hp=e=>Dp(e,Fp,ap),gp=e=>Dp(e,Pp,sp),_p=e=>Dp(e,kp,sp),vp=e=>Dp(e,Ap,lp),yp=e=>Dp(e,Ip,cp),Z=e=>Jf.test(e),bp=e=>Op(e,Mp),xp=e=>Op(e,Pp),Sp=e=>Op(e,kp),Cp=e=>Op(e,jp),wp=e=>Op(e,Ap),Tp=e=>Op(e,Ip,!0),Ep=e=>Op(e,Fp,!0),Dp=(e,t,n)=>{let r=qf.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Op=(e,t,n=!1)=>{let r=Jf.exec(e);return r?r[1]?t(r[1]):n:!1},kp=e=>e===`position`||e===`percentage`,Ap=e=>e===`image`||e===`url`,jp=e=>e===`length`||e===`size`||e===`bg-size`,Mp=e=>e===`length`,Np=e=>e===`number`,Pp=e=>e===`family-name`,Fp=e=>e===`number`||e===`weight`,Ip=e=>e===`shadow`,Lp=Wf(()=>{let e=Kf(`color`),t=Kf(`font`),n=Kf(`text`),r=Kf(`font-weight`),a=Kf(`tracking`),o=Kf(`leading`),s=Kf(`breakpoint`),c=Kf(`container`),l=Kf(`spacing`),u=Kf(`radius`),d=Kf(`shadow`),f=Kf(`inset-shadow`),p=Kf(`text-shadow`),m=Kf(`drop-shadow`),h=Kf(`blur`),g=Kf(`perspective`),_=Kf(`aspect`),v=Kf(`ease`),y=Kf(`animate`),b=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],x=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],S=()=>[...x(),Z,X],C=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],w=()=>[`auto`,`contain`,`none`],T=()=>[Z,X,l],E=()=>[tp,`full`,`auto`,...T()],D=()=>[np,`none`,`subgrid`,Z,X],ee=()=>[`auto`,{span:[`full`,np,Z,X]},np,Z,X],O=()=>[np,`auto`,Z,X],te=()=>[`auto`,`min`,`max`,`fr`,Z,X],k=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ne=()=>[`auto`,...T()],j=()=>[tp,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...T()],re=()=>[tp,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...T()],ie=()=>[tp,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...T()],M=()=>[e,Z,X],N=()=>[...x(),Sp,_p,{position:[Z,X]}],ae=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],oe=()=>[`auto`,`cover`,`contain`,Cp,fp,{size:[Z,X]}],se=()=>[rp,bp,pp],P=()=>[``,`none`,`full`,u,Z,X],F=()=>[``,Y,bp,pp],I=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[Y,rp,Sp,_p],ue=()=>[``,`none`,h,Z,X],de=()=>[`none`,Y,Z,X],fe=()=>[`none`,Y,Z,X],pe=()=>[Y,Z,X],me=()=>[tp,`full`,...T()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[ip],breakpoint:[ip],color:[ap],container:[ip],"drop-shadow":[ip],ease:[`in`,`out`,`in-out`],font:[up],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[ip],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[ip],shadow:[ip],spacing:[`px`,Y],text:[ip],"text-shadow":[ip],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,tp,X,Z,_]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[dp],columns:[{columns:[Y,X,Z,c]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"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:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:w()}],"overscroll-x":[{"overscroll-x":w()}],"overscroll-y":[{"overscroll-y":w()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[np,`auto`,Z,X]}],basis:[{basis:[tp,`full`,`auto`,c,...T()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Y,tp,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,Y,Z,X]}],shrink:[{shrink:[``,Y,Z,X]}],order:[{order:[np,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...k(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...k()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pbs:[{pbs:T()}],pbe:[{pbe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:ne()}],mx:[{mx:ne()}],my:[{my:ne()}],ms:[{ms:ne()}],me:[{me:ne()}],mbs:[{mbs:ne()}],mbe:[{mbe:ne()}],mt:[{mt:ne()}],mr:[{mr:ne()}],mb:[{mb:ne()}],ml:[{ml:ne()}],"space-x":[{"space-x":T()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":T()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...re()]}],"min-inline-size":[{"min-inline":[`auto`,...re()]}],"max-inline-size":[{"max-inline":[`none`,...re()]}],"block-size":[{block:[`auto`,...ie()]}],"min-block-size":[{"min-block":[`auto`,...ie()]}],"max-block-size":[{"max-block":[`none`,...ie()]}],w:[{w:[c,`screen`,...j()]}],"min-w":[{"min-w":[c,`screen`,`none`,...j()]}],"max-w":[{"max-w":[c,`screen`,`none`,`prose`,{screen:[s]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,bp,pp]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Ep,hp]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,rp,X]}],"font-family":[{font:[xp,gp,t]}],"font-features":[{"font-features":[X]}],"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:[a,Z,X]}],"line-clamp":[{"line-clamp":[Y,`none`,Z,mp]}],leading:[{leading:[o,...T()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...I(),`wavy`]}],"text-decoration-thickness":[{decoration:[Y,`from-font`,`auto`,Z,pp]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Y,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:T()}],"tab-size":[{tab:[np,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],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`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:oe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},np,Z,X],radial:[``,Z,X],conic:[np,Z,X]},wp,vp]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-bs":[{"border-bs":F()}],"border-w-be":[{"border-be":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":F()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...I(),`hidden`,`none`]}],"divide-style":[{divide:[...I(),`hidden`,`none`]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...I(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Y,Z,X]}],"outline-w":[{outline:[``,Y,bp,pp]}],"outline-color":[{outline:M()}],shadow:[{shadow:[``,`none`,d,Tp,yp]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":[`none`,f,Tp,yp]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:F()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Y,pp]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":[`none`,p,Tp,yp]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Y,Z,X]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"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":[Y]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":x()}],"mask-image-conic-pos":[{"mask-conic":[Y]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:oe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ue()}],brightness:[{brightness:[Y,Z,X]}],contrast:[{contrast:[Y,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,m,Tp,yp]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:[``,Y,Z,X]}],"hue-rotate":[{"hue-rotate":[Y,Z,X]}],invert:[{invert:[``,Y,Z,X]}],saturate:[{saturate:[Y,Z,X]}],sepia:[{sepia:[``,Y,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[Y,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[Y,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Y,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Y,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,Y,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[Y,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[Y,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,Y,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Y,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,v,Z,X]}],delay:[{delay:[Y,Z,X]}],animate:[{animate:[`none`,y,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[g,Z,X]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],zoom:[{zoom:[np,Z,X]}],accent:[{accent:M()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:M()}],"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`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mbs":[{"scroll-mbs":T()}],"scroll-mbe":[{"scroll-mbe":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pbs":[{"scroll-pbs":T()}],"scroll-pbe":[{"scroll-pbe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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`,Z,X]}],fill:[{fill:[`none`,...M()]}],"stroke-w":[{stroke:[Y,bp,pp,mp]}],stroke:[{stroke:[`none`,...M()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return Lp(ii(e))}var Rp=si(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[1.5px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{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:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 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 gap-1.5 rounded-md 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 zp({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...a}){return(0,L.jsx)(r?na:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Q(Rp({variant:t,size:n,className:e})),...a})}function Bp({className:e,type:t,...n}){return(0,L.jsx)(`input`,{type:t,"data-slot":`input`,className:Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[1.5px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function Vp({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,L.jsx)(Td,{"data-slot":`separator`,decorative:n,orientation:t,className:Q(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function Hp({...e}){return(0,L.jsx)(Pc,{"data-slot":`sheet`,...e})}function Up({...e}){return(0,L.jsx)(Fc,{"data-slot":`sheet-portal`,...e})}function Wp({className:e,...t}){return(0,L.jsx)(Ic,{"data-slot":`sheet-overlay`,className:Q(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Gp({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...a}){return(0,L.jsxs)(Up,{children:[(0,L.jsx)(Wp,{}),(0,L.jsxs)(Lc,{"data-slot":`sheet-content`,className:Q(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,L.jsxs)(Bc,{className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,L.jsx)(Xi,{className:`size-4`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Kp({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sheet-header`,className:Q(`flex flex-col gap-1.5 p-4`,e),...t})}function qp({className:e,...t}){return(0,L.jsx)(Rc,{"data-slot":`sheet-title`,className:Q(`font-semibold text-foreground`,e),...t})}function Jp({className:e,...t}){return(0,L.jsx)(zc,{"data-slot":`sheet-description`,className:Q(`text-sm text-muted-foreground`,e),...t})}function Yp({delayDuration:e=0,...t}){return(0,L.jsx)(af,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Xp({...e}){return(0,L.jsx)(of,{"data-slot":`tooltip`,...e})}function Zp({...e}){return(0,L.jsx)(sf,{"data-slot":`tooltip-trigger`,...e})}function Qp({className:e,sideOffset:t=0,children:n,...r}){return(0,L.jsx)(cf,{children:(0,L.jsxs)(lf,{"data-slot":`tooltip-content`,sideOffset:t,className:Q(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,L.jsx)(uf,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var $p=`sidebar_state`,em=3600*24*7,tm=`16rem`,nm=`18rem`,rm=`3rem`,im=`b`,am=S.createContext(null);function om(){let e=S.use(am);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function sm({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:o,...s}){let c=ff(),[l,u]=S.useState(!1),[d,f]=S.useState(e),p=t??d,m=S.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${$p}=${t}; path=/; max-age=${em}`},[n,p]),h=S.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);S.useEffect(()=>{let e=e=>{e.key===im&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=S.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,L.jsx)(am.Provider,{value:_,children:(0,L.jsx)(Yp,{delayDuration:0,children:(0,L.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":tm,"--sidebar-width-icon":rm,...a},className:Q(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...s,children:o})})})}function cm({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=om();return n===`none`?(0,L.jsx)(`div`,{"data-slot":`sidebar`,className:Q(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:a}):s?(0,L.jsx)(Hp,{open:l,onOpenChange:u,...o,children:(0,L.jsxs)(Gp,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":nm},side:e,children:[(0,L.jsxs)(Kp,{className:`sr-only`,children:[(0,L.jsx)(qp,{children:`Sidebar`}),(0,L.jsx)(Jp,{children:`Displays the mobile sidebar.`})]}),(0,L.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:a})]})}):(0,L.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,L.jsx)(`div`,{"data-slot":`sidebar-gap`,className:Q(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,L.jsx)(`div`,{"data-slot":`sidebar-container`,className:Q(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,e===`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)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,L.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm`,children:a})})]})}function lm({className:e,onClick:t,...n}){let{toggleSidebar:r}=om();return(0,L.jsxs)(zp,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon`,className:Q(`size-7`,e),onClick:e=>{t?.(e),r()},...n,children:[(0,L.jsx)(z,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function um({className:e,...t}){return(0,L.jsx)(`main`,{"data-slot":`sidebar-inset`,className:Q(`relative flex w-full flex-1 flex-col bg-background`,`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`,e),...t})}function dm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:Q(`flex flex-col gap-2 p-2`,e),...t})}function fm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:Q(`flex flex-col gap-2 p-2`,e),...t})}function pm({className:e,...t}){return(0,L.jsx)(Vp,{"data-slot":`sidebar-separator`,"data-sidebar":`separator`,className:Q(`mx-2 w-auto bg-sidebar-border`,e),...t})}function mm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:Q(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function hm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:Q(`relative flex w-full min-w-0 flex-col p-2`,e),...t})}function gm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:Q(`w-full text-sm`,e),...t})}function _m({className:e,...t}){return(0,L.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:Q(`flex w-full min-w-0 flex-col gap-1`,e),...t})}function vm({className:e,...t}){return(0,L.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:Q(`group/menu-item relative`,e),...t})}var ym=si(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function bm({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:a,className:o,...s}){let c=e?na:`button`,{isMobile:l,state:u}=om(),d=(0,L.jsx)(c,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:Q(ym({variant:n,size:r}),o),...s});return a?(typeof a==`string`&&(a={children:a}),(0,L.jsxs)(Xp,{children:[(0,L.jsx)(Zp,{asChild:!0,children:d}),(0,L.jsx)(Qp,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...a})]})):d}function xm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sidebar-menu-badge`,"data-sidebar":`menu-badge`,className:Q(`pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t})}function Sm(){let e=rt(),{workspace:t,dirty:n}=Or(),{ragStatus:r}=Vr(),a=Cm(e.pathname),o=r?.hasIndex&&!r.stale;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`crumbs`,children:[a.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0&&(0,L.jsx)(`span`,{className:`sep`,style:{marginRight:8},children:`/`}),(0,L.jsx)(`span`,{className:t===a.length-1?`crumb cur`:`crumb`,children:e})]},e)),n&&(0,L.jsxs)(`span`,{className:`pill warn`,style:{marginLeft:8},children:[(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:`var(--amber-500)`}}),`Unsaved changes`]}),!n&&t&&a.some(e=>e===`Enrichment`||e===`Schema`)&&(0,L.jsxs)(`span`,{className:`pill ok`,style:{marginLeft:8},children:[(0,L.jsx)(vi,{size:10}),`Saved`]})]}),(0,L.jsxs)(`div`,{className:`right`,children:[(0,L.jsxs)(`div`,{className:`cmd-palette`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`span`,{style:{flex:1},children:`Search tables, concepts, queries…`}),(0,L.jsx)(`span`,{className:`kbd`,children:`⌘K`})]}),r&&(0,L.jsxs)(`span`,{className:`pill ${o?`ok`:`warn`}`,children:[(0,L.jsx)(`span`,{style:{width:6,height:6,borderRadius:`50%`,background:o?`var(--green-500)`:`var(--amber-500)`}}),o?`Index fresh`:r.hasIndex?`Index stale`:`No index`]})]})]})}function Cm(e){let t=e.split(`/`).filter(Boolean);if(t.length===0)return[`Overview`];let n=t[0],r=[];switch(n){case`overview`:r.push(`Overview`);break;case`tables`:r.push(`Tables`),t[1]&&r.push(t[1]),t[2]&&r.push(t[2]),t[3]&&r.push(wm(t[3]));break;case`concepts`:r.push(`Concepts`);break;case`tenancy`:r.push(`Tenancy`),t[1]&&r.push(wm(t[1]));break;case`rag-index`:r.push(`RAG Index`),t[1]&&r.push(wm(t[1]));break;case`playground`:r.push(`Playground`),t[1]&&r.push(`Query`);break;case`settings`:r.push(`Settings`);break;default:r.push(wm(n))}return r}function wm(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Tm=[{to:`/overview`,label:`Overview`,icon:Mi},{to:`/tables`,label:`Tables`,icon:qi,badgeKey:`tables`},{to:`/concepts`,label:`Concepts`,icon:Ai,badgeKey:`concepts`},{to:`/tenancy`,label:`Tenancy`,icon:Wi},{to:`/rag-index`,label:`RAG Index`,icon:Gi},{to:`/playground`,label:`Playground`,icon:Li}];function Em(){let{workspace:e}=Or(),{theme:t,toggleTheme:n}=er();function r(t){if(!(!e||!t)){if(t===`tables`)return String(e.tables.length);if(t===`concepts`)return String(e.concepts.length)}}return(0,L.jsxs)(cm,{collapsible:`icon`,className:`border-r`,children:[(0,L.jsx)(dm,{className:`px-2 py-2`,children:(0,L.jsx)(_m,{children:(0,L.jsx)(vm,{children:(0,L.jsx)(bm,{size:`lg`,asChild:!0,tooltip:`AskDB Studio`,children:(0,L.jsxs)(`a`,{href:`/`,className:`no-underline`,children:[(0,L.jsx)(`div`,{className:`flex aspect-square size-8 items-center justify-center shrink-0`,children:(0,L.jsx)(`img`,{src:t===`dark`?`/assets/brand/dark-icon.png`:`/assets/brand/light-icon.png`,alt:`AskDB`,className:`size-7`})}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5 leading-none`,children:[(0,L.jsx)(`span`,{className:`font-semibold`,children:`AskDB`}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Studio`})]})]})})})})}),(0,L.jsx)(mm,{children:(0,L.jsx)(hm,{children:(0,L.jsx)(gm,{children:(0,L.jsx)(_m,{children:Tm.map(e=>{let t=e.icon,n=r(e.badgeKey);return(0,L.jsxs)(vm,{children:[(0,L.jsx)(bm,{asChild:!0,tooltip:e.label,children:(0,L.jsxs)(An,{to:e.to,children:[(0,L.jsx)(t,{}),(0,L.jsx)(`span`,{children:e.label})]})}),n&&(0,L.jsx)(xm,{children:n})]},e.to)})})})})}),(0,L.jsxs)(fm,{children:[(0,L.jsxs)(_m,{children:[(0,L.jsx)(vm,{children:(0,L.jsx)(bm,{asChild:!0,tooltip:`Settings`,children:(0,L.jsxs)(An,{to:`/settings`,children:[(0,L.jsx)(Ui,{}),(0,L.jsx)(`span`,{children:`Settings`})]})})}),(0,L.jsx)(vm,{children:(0,L.jsxs)(bm,{tooltip:t===`light`?`Dark mode`:`Light mode`,onClick:n,children:[t===`light`?(0,L.jsx)(Fi,{}):(0,L.jsx)(Ki,{}),(0,L.jsx)(`span`,{children:t===`light`?`Dark mode`:`Light mode`})]})})]}),(0,L.jsx)(pm,{}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0`,children:[(0,L.jsx)(Ei,{size:14,className:`shrink-0`}),(0,L.jsx)(`span`,{className:`truncate font-mono group-data-[collapsible=icon]:hidden`,children:e?`${e.aiProvider||`postgres`} · ${e.schemaId.split(`/`).pop()||e.schemaId}`:`connecting…`})]})]})]})}function Dm({dialog:e,onApply:t,onClose:n}){return(0,L.jsx)(`div`,{className:`dialog-overlay`,onClick:n,"aria-hidden":`true`,children:(0,L.jsxs)(`div`,{className:`dialog`,onClick:e=>e.stopPropagation(),children:[(0,L.jsxs)(`div`,{className:`dialog-hd`,children:[(0,L.jsxs)(`h3`,{children:[`Suggestions for `,e.label]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:n,"aria-label":`Close`,children:(0,L.jsx)(Xi,{size:14})})]}),(0,L.jsx)(`div`,{className:`dialog-bd`,children:e.candidates.map(e=>(0,L.jsxs)(`article`,{className:`candidate`,children:[(0,L.jsx)(`p`,{children:e.text}),(0,L.jsx)(`div`,{className:`candidate-actions`,children:(0,L.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>t(e.text),children:`Use`})})]},e.text))})]})})}function Om({status:e}){return(0,L.jsxs)(`div`,{className:`status-banner ${e.kind}`,children:[e.kind===`loading`&&(0,L.jsx)(Ni,{size:14,className:`animate-spin`}),e.kind===`success`&&(0,L.jsx)(vi,{size:14}),e.kind===`error`&&(0,L.jsx)(Ci,{size:14}),(0,L.jsx)(`span`,{children:e.text})]})}function km({status:e}){return(0,L.jsxs)(`div`,{className:`inline-status ${e.kind}`,children:[e.kind===`loading`&&(0,L.jsx)(Ni,{size:12,className:`animate-spin`}),e.kind===`success`&&(0,L.jsx)(vi,{size:12}),e.kind===`error`&&(0,L.jsx)(Ci,{size:12}),(0,L.jsx)(`span`,{children:e.text})]})}function Am(){let e=ot(),{workspace:t,tables:n,load:r}=Or(),{ragStatus:a,refreshRagStatus:o}=Vr(),{historyEntries:s}=Jr(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null),f=(0,S.useCallback)(async()=>{l(!0),d({kind:`loading`,text:`Re-introspecting…`});try{let e=await br();await r(),o(),d({kind:`success`,text:`Re-introspected ${e.tables} table${e.tables===1?``:`s`} from ${e.engine} — enrichment preserved.`})}catch(e){d({kind:`error`,text:e instanceof Error?e.message:String(e)})}finally{l(!1)}},[r,o]),p=(0,S.useEffectEvent)(()=>d(null));if((0,S.useEffect)(()=>{if(u?.kind===`success`){let e=setTimeout(()=>p(),4e3);return()=>clearTimeout(e)}},[u]),!t)return null;let m=n.filter(e=>{let t=e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&r}).length,h=n.filter(e=>{let t=e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&!r}).length,g=!!t.tenantPolicy;return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsx)(`h1`,{children:`Overview`}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[t.aiProvider||`postgres`,` · `,t.schemaId]})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,disabled:c,title:`Re-run introspection with the connection from askdb.config.ts. Your enrichment is preserved.`,onClick:()=>void f(),children:[c?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(zi,{size:14}),` Resync schema`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>e(`/tables`),children:[(0,L.jsx)(Gi,{size:14}),` Draft enrichment`]})]})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,children:[u&&(0,L.jsx)(km,{status:u}),(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Tables`}),(0,L.jsx)(`div`,{className:`stat-num`,children:n.length}),(0,L.jsxs)(`div`,{className:`stat-hint`,children:[m,` enriched · `,h,` partial`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Concepts`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.concepts.length}),t.concepts.length>0&&(0,L.jsxs)(`div`,{className:`stat-hint`,children:[t.concepts.length,` defined`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Index health`}),(0,L.jsx)(`div`,{className:`stat-num`,children:a?.hasIndex?a.stale?`Stale`:`Fresh`:`None`}),a&&(0,L.jsxs)(`div`,{className:`stat-hint`,children:[a.chunksTotal,` chunks · `,a.dimensions,`d`]})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitivity coverage`}),(0,L.jsx)(`div`,{className:`stat-num`,children:a?`${Math.round((a.sensitiveExcluded+a.sensitiveIncluded)/Math.max(a.chunksTotal,1)*100)}%`:`—`})]})]}),(0,L.jsxs)(`div`,{className:`grid-2`,children:[(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Gi,{size:14}),` Pending enrichment`]}),(0,L.jsxs)(`span`,{className:`card-meta`,children:[n.length-m,` tables to go`]})]}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Table`}),(0,L.jsx)(`th`,{children:`Cols`}),(0,L.jsx)(`th`,{children:`Status`}),(0,L.jsx)(`th`,{"aria-label":`Actions`})]})}),(0,L.jsx)(`tbody`,{children:n.filter(e=>{let t=e.draft,n=Object.values(t.columns??{}).every(e=>e.description);return!(t.description&&n)}).slice(0,6).map(t=>{let n=t.draft.description||t.draft.aliases&&t.draft.aliases.length>0?`partial`:`none`;return(0,L.jsxs)(`tr`,{style:{cursor:`default`},onClick:()=>e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`),children:[(0,L.jsx)(`td`,{children:(0,L.jsxs)(`span`,{className:`mono`,children:[t.physical.schema,`.`,t.physical.name]})}),(0,L.jsx)(`td`,{className:`muted`,children:t.physical.columns.length}),(0,L.jsxs)(`td`,{children:[(0,L.jsx)(`span`,{className:`enrich-dot ${n}`}),(0,L.jsx)(`span`,{className:`muted tiny`,style:{marginLeft:6},children:n})]}),(0,L.jsx)(`td`,{style:{textAlign:`right`},children:(0,L.jsxs)(`span`,{className:`suggest-link`,children:[(0,L.jsx)(Gi,{size:12}),` Draft`]})})]},t.physical.id)})})]})})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(ji,{size:14}),` Recent playground queries`]}),(0,L.jsxs)(`span`,{className:`card-meta`,children:[`last `,s.length,` queries`]})]}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Question`}),(0,L.jsx)(`th`,{children:`Mode`}),(0,L.jsx)(`th`,{children:`Time`})]})}),(0,L.jsxs)(`tbody`,{children:[s.slice(0,5).map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{style:{maxWidth:300,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.question}),(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`chip ${e.mode===`rag`?`red`:``}`,children:e.mode})}),(0,L.jsx)(`td`,{className:`muted tiny`,children:new Date(e.timestamp).toLocaleString()})]},e.id)),s.length===0&&(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{colSpan:3,className:`muted tiny`,style:{textAlign:`center`,padding:16},children:`No queries yet`})})]})]})})]})]}),(0,L.jsxs)(`div`,{className:`grid-3`,children:[(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Gi,{size:14}),` RAG index`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid-2`,style:{gap:10},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Chunks`}),(0,L.jsx)(`div`,{style:{fontSize:18,fontWeight:600},children:Tr(a.chunksTotal)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Indexed`}),(0,L.jsx)(`div`,{style:{fontSize:18,fontWeight:600},children:Tr(a.chunksIndexed)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Dimensions`}),(0,L.jsx)(`div`,{className:`mono`,style:{fontSize:13},children:Tr(a.dimensions)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`muted tiny`,children:`Model`}),(0,L.jsx)(`div`,{className:`mono`,style:{fontSize:12},children:a.embedder.label})]})]}),(0,L.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,L.jsx)(`i`,{style:{width:a.chunksTotal>0?`${Math.round(a.chunksIndexed/a.chunksTotal*100)}%`:`0%`}})}),(0,L.jsxs)(`div`,{className:`tiny muted`,style:{marginTop:6},children:[`Updated: `,a.updatedAt??`never`]})]}):(0,L.jsx)(`div`,{className:`muted tiny`,children:`RAG status unavailable`})})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Wi,{size:14}),` Tenancy`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`div`,{className:`row-h`,style:{marginBottom:10},children:(0,L.jsxs)(`span`,{className:`chip ${g?`green`:`amber`}`,children:[(0,L.jsx)(Zi,{size:11}),g?`Configured`:`Not configured`]})}),(0,L.jsx)(`div`,{className:`tiny muted`,style:{lineHeight:1.6},children:g?`${t.tenantPolicy.roots.length} root(s) configured, ${t.tenantPolicy.enforcement} mode.`:`Multi-tenant scoping isn't set. Generated SQL won't enforce row-level isolation.`}),!g&&(0,L.jsxs)(`button`,{type:`button`,className:`btn sm primary`,style:{marginTop:12},onClick:()=>e(`/tenancy`),children:[(0,L.jsx)(Gi,{size:12}),` Draft tenant policy`]})]})]}),(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Zi,{size:14}),` Suggested next actions`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[n.filter(e=>!e.draft.description).length>0&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--red-600)`,flexShrink:0}}),(0,L.jsxs)(`span`,{style:{fontSize:12.5},children:[`Add description to`,` `,(0,L.jsx)(`span`,{className:`mono`,children:n.find(e=>!e.draft.description)?.physical.name})]})]}),!a?.hasIndex&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--amber-500)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Build RAG index for retrieval-augmented queries`})]}),a?.stale&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Rebuild index — tables changed since last build`})]}),n.length>0&&m===0&&(0,L.jsxs)(`div`,{className:`row-h`,children:[(0,L.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:`var(--amber-500)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{fontSize:12.5},children:`Start enriching tables to improve SQL generation quality`})]})]})]})]})]})})]})}var jm=e=>(0,L.jsx)(Ja,{"data-slot":`collapsible-trigger`,...e}),Mm=e=>(0,L.jsx)(Xa,{"data-slot":`collapsible-content`,...e}),Nm=e=>(0,L.jsx)($a,{"data-slot":`collapsible`,...e}),Pm={enriched:`Complete`,partial:`Partial`,none:`Not started`};function Fm(){let e=ot(),t=ut(),{filteredTables:n,tables:r,selectedTable:a,setSelectedTableId:o,tableSearch:s,setTableSearch:c,drafts:l}=Or(),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(null),m=(0,S.useCallback)(e=>{let t=l[e.physical.id]??e.draft,n=t.description||t.aliases&&t.aliases.length>0,r=Object.values(t.columns??{}).every(e=>e.description);return n&&r?`enriched`:n?`partial`:`none`},[l]),h=(0,S.useCallback)(e=>(l[e.physical.id]??e.draft).tracked!==!1,[l]),g=(0,S.useMemo)(()=>{let e={enriched:0,partial:0,none:0};for(let t of r)e[m(t)]++;return e},[r,m]),_=(0,S.useMemo)(()=>r.filter(e=>!h(e)).length,[r,h]),v=(0,S.useMemo)(()=>{let e=n;return u&&(e=e.filter(e=>u.has(m(e)))),f===`tracked`?e=e.filter(e=>h(e)):f===`untracked`&&(e=e.filter(e=>!h(e))),e},[n,u,f,m,h]),y=(0,S.useMemo)(()=>{let e=new Map;for(let t of v){let n=t.physical.schema;e.has(n)||e.set(n,[]),e.get(n).push(t)}return Array.from(e.entries()).sort(([e],[t])=>e.localeCompare(t))},[v]),b=(0,S.useMemo)(()=>y.map(([e])=>e),[y]),[x,C]=(0,S.useState)(new Set),w=(0,S.useMemo)(()=>new Set(b.filter(e=>!x.has(e))),[b,x]),T=x.size===0,E=()=>C(new Set(b)),D=()=>C(new Set);(0,S.useEffect)(()=>{s&&C(new Set)},[s]),(0,S.useEffect)(()=>{if(t.schema&&t.name)o(`table:${t.schema}.${t.name}`);else if(r.length>0&&!t.schema){let t=r[0];e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`,{replace:!0})}},[t.schema,t.name,r,e,o]);function ee(e){d(t=>{if(!t)return new Set([e]);let n=new Set(t);return n.has(e)?(n.delete(e),n.size===0?null:n):(n.add(e),n.size===3?null:n)})}let O=!!(t.schema&&t.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`sub-rail`,children:[(0,L.jsxs)(`div`,{className:`sub-rail-hd`,children:[(0,L.jsx)(`h2`,{children:`Tables`}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsxs)(`span`,{className:`muted tiny`,children:[r.length,` tables`]}),y.length>1&&(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:T?D:E,title:T?`Collapse all`:`Expand all`,style:{padding:2,height:20,width:20},children:T?(0,L.jsx)(xi,{size:13}):(0,L.jsx)(Si,{size:13})})]})]}),(0,L.jsxs)(`div`,{className:`sub-rail-search`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Search tables`,placeholder:`Search tables…`,value:s,onChange:e=>c(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`enrich-filter-bar`,children:[[`enriched`,`partial`,`none`].map(e=>{let t=!u||u.has(e);return(0,L.jsxs)(`button`,{type:`button`,className:`enrich-filter-chip ${e} ${t?`active`:``}`,onClick:()=>ee(e),title:`${t?`Hide`:`Show`} ${Pm[e].toLowerCase()} tables`,children:[(0,L.jsx)(`span`,{className:`enrich-dot ${e}`}),(0,L.jsx)(`span`,{className:`enrich-filter-label`,children:Pm[e]}),(0,L.jsx)(`span`,{className:`enrich-filter-count`,children:g[e]})]},e)}),_>0&&(0,L.jsxs)(`button`,{type:`button`,className:`enrich-filter-chip untracked ${f===`untracked`?`active`:``}`,onClick:()=>p(e=>e===`untracked`?null:`untracked`),title:f===`untracked`?`Show all tables`:`Show ${_} untracked table${_===1?``:`s`}`,children:[(0,L.jsx)(Di,{size:11}),(0,L.jsx)(`span`,{className:`enrich-filter-label`,children:`Untracked`}),(0,L.jsx)(`span`,{className:`enrich-filter-count`,children:_})]})]}),(0,L.jsxs)(`div`,{className:`sub-rail-list`,children:[y.map(([t,n])=>(0,L.jsx)(Nm,{open:w.has(t),onOpenChange:e=>{C(n=>{let r=new Set(n);return e?r.delete(t):r.add(t),r})},children:(0,L.jsxs)(`div`,{className:`schema-group`,children:[(0,L.jsx)(jm,{asChild:!0,children:(0,L.jsxs)(`button`,{type:`button`,className:`schema-group-hd`,children:[(0,L.jsx)(bi,{size:12,className:`schema-chevron`,style:{transform:w.has(t)?`rotate(90deg)`:void 0}}),(0,L.jsx)(ki,{size:13,className:`schema-icon`}),(0,L.jsx)(`span`,{className:`schema-name`,children:t}),(0,L.jsx)(`span`,{className:`schema-count`,children:n.length})]})}),(0,L.jsx)(Mm,{children:(0,L.jsx)(`div`,{className:`schema-group-bd`,children:n.map(t=>{let n=m(t),r=h(t);return(0,L.jsxs)(`button`,{type:`button`,className:`sub-rail-row table-leaf ${a?.physical.id===t.physical.id?`active`:``}${r?``:` untracked`}`,onClick:()=>e(`/tables/${t.physical.schema}/${t.physical.name}/enrichment`),title:r?void 0:`Untracked — excluded from LLM context`,children:[r?(0,L.jsx)(`span`,{className:`enrich-dot ${n}`}):(0,L.jsx)(Di,{size:10,style:{color:`var(--amber-500)`,flex:`none`}}),(0,L.jsx)(`span`,{className:`row-name mono`,children:t.physical.name}),(0,L.jsxs)(`span`,{className:`row-meta`,children:[t.physical.columns.length,` cols`]})]},t.physical.id)})})})]})},t)),v.length===0&&(0,L.jsx)(`div`,{className:`muted tiny`,style:{padding:`16px`,textAlign:`center`},children:f===`untracked`?`No untracked tables`:u?`No tables match this filter`:`No tables match your search`})]})]}),O?(0,L.jsx)(Ft,{}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(`div`,{className:`main-body`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(`div`,{style:{textAlign:`center`,color:`var(--ink-400)`},children:[(0,L.jsx)(Gi,{size:24,style:{margin:`0 auto 8px`}}),(0,L.jsx)(`p`,{style:{fontSize:13},children:`Select a table to start enriching`})]})})})]})}function Im(){let{selectedTable:e,selectedDraft:t,dirty:n,saveStatus:r,saveSelectedTable:a,resetSelectedDraft:o,busy:s}=Or(),{refreshRagStatus:c}=Vr();if(!e||!t)return null;async function l(){await a(),c()}let u=e,d=t.description||t.aliases&&t.aliases.length>0,f=Object.values(t.columns??{}).every(e=>e.description);return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(`span`,{className:`enrich-dot ${d&&f?`enriched`:d?`partial`:`none`}`,style:{marginRight:8}}),u.physical.schema,`.`,u.physical.name]}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[u.physical.columns.length,` columns`,u.physical.relationships&&u.physical.relationships.length>0?` · ${u.physical.relationships.length} relationships`:``,u.missingColumnIds.length>0?` · ${u.missingColumnIds.length} missing`:``]})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:o,disabled:!n||s.has(`save`),children:[(0,L.jsx)(Bi,{size:14}),` Revert`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void l(),disabled:!n||s.has(`save`),children:[s.has(`save`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),`Save`]})]})]}),r&&(0,L.jsx)(Om,{status:r}),(0,L.jsxs)(`div`,{className:`sub-tabs`,children:[(0,L.jsx)(An,{to:`enrichment`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Enrichment`}),(0,L.jsx)(An,{to:`schema`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Schema`}),(0,L.jsx)(An,{to:`sensitivity`,className:({isActive:e})=>`sub-tab ${e?`active`:``}`,children:`Sensitivity`})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsx)(Ft,{})})]})}var Lm=si(`inline-flex min-h-6 max-w-full items-center rounded-md px-2 py-0.5 text-xs font-medium`,{variants:{variant:{default:`bg-primary text-primary-foreground`,secondary:`bg-secondary text-secondary-foreground`,warning:`bg-warning text-warning-foreground dark:bg-amber-500/15 dark:text-amber-400`,danger:`bg-destructive text-destructive-foreground`,outline:`border border-border bg-background text-muted-foreground`}},defaultVariants:{variant:`default`}});function Rm({className:e,variant:t,...n}){return(0,L.jsx)(`span`,{className:Q(Lm({variant:t}),e),...n})}function $({label:e,description:t,children:n,className:r}){return(0,L.jsxs)(`label`,{className:Q(`grid gap-1.5`,r),children:[(0,L.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground`,children:e}),n,t?(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null]})}function zm(e){return e?.join(`, `)??``}function Bm({value:e,onChange:t}){let[n,r]=(0,S.useState)(null);return(0,L.jsx)(Bp,{value:n??zm(e),onChange:e=>r(e.target.value),onFocus:()=>r(zm(e)),onBlur:()=>{t(Cr(n??zm(e))),r(null)}})}function Vm({className:e,...t}){return(0,L.jsx)(`textarea`,{"data-slot":`textarea`,className:Q(`min-h-24 w-full rounded-md border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}function Hm(){let{workspace:e,selectedTable:t,selectedDraft:n,updateTableDraft:r,updateColumnDraft:a,requestSuggestion:o,suggestingKey:s}=Or();if(!t||!n||!e)return null;let c=e.aiConfigured,l=t,u=n,d=l.physical.id;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Table Enrichment`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Description`,onSuggest:()=>o({scope:`table`,tableId:d,field:`description`},`table description`),suggesting:s===`table:${d}:description`,children:(0,L.jsx)(Vm,{value:u.description,onChange:e=>r(d,t=>({...t,description:e.target.value}))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Aliases`,onSuggest:()=>o({scope:`table`,tableId:d,field:`aliases`},`table aliases`),suggesting:s===`table:${d}:aliases`,children:(0,L.jsx)(Bm,{value:u.aliases,onChange:e=>r(d,t=>({...t,aliases:e}))})}),(0,L.jsx)(Um,{aiConfigured:c,label:`Primary entity`,onSuggest:()=>o({scope:`table`,tableId:d,field:`primaryEntity`},`primary entity`),suggesting:s===`table:${d}:primaryEntity`,children:(0,L.jsx)(Bp,{value:u.primaryEntity??``,onChange:e=>r(d,t=>({...t,primaryEntity:e.target.value.trim()||void 0}))})})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16,gridTemplateColumns:`1fr 220px`},children:[(0,L.jsx)($,{label:`Tags`,description:`Comma-separated labels used for browsing and filtering.`,children:(0,L.jsx)(Bm,{value:u.tags,onChange:e=>r(d,t=>({...t,tags:e}))})}),(0,L.jsx)(Wm,{label:`Table sensitivity override`,value:u.sensitive,onChange:e=>r(d,t=>({...t,sensitive:e}))})]})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Common Query Language`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(Um,{aiConfigured:c,label:`Business vocabulary`,onSuggest:()=>o({scope:`table`,tableId:d,field:`commonQueryLanguage`},`common query language`),suggesting:s===`table:${d}:commonQueryLanguage`,children:(0,L.jsx)(Vm,{className:`min-h-36`,value:u.commonQueryLanguage??``,onChange:e=>r(d,t=>({...t,commonQueryLanguage:e.target.value}))})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Example Questions`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)($,{label:`Questions`,children:(0,L.jsx)(Vm,{className:`min-h-32`,value:u.exampleQuestions??``,onChange:e=>r(d,t=>({...t,exampleQuestions:e.target.value}))})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsx)(`h3`,{children:`Columns`}),l.missingColumnIds.length>0&&(0,L.jsxs)(Rm,{variant:l.missingColumnIds.length>0?`warning`:`secondary`,children:[l.missingColumnIds.length,` missing`]})]}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:l.physical.columns.map(e=>{let t=u.columns[e.id]??{};return(0,L.jsxs)(`section`,{className:`column-row`,children:[(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h4`,{style:{fontSize:13,fontWeight:600},children:e.name}),(0,L.jsx)(Rm,{variant:`outline`,children:e.type}),e.primaryKey&&(0,L.jsx)(Rm,{variant:`secondary`,children:`PK`}),e.nullable&&(0,L.jsx)(Rm,{variant:`outline`,children:`nullable`}),(e.sensitive||t.sensitive)&&(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:4,wordBreak:`break-all`},children:e.id})]})}),(0,L.jsxs)(`div`,{style:{marginTop:12,display:`grid`,gap:12},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Description`,onSuggest:()=>o({scope:`column`,tableId:d,columnId:e.id,field:`description`},`${e.name} description`),suggesting:s===`column:${d}:${e.id}:description`,children:(0,L.jsx)(Vm,{value:t.description??``,onChange:t=>a(d,e.id,e=>({...e,description:t.target.value}))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr 1fr`},children:[(0,L.jsx)(Um,{aiConfigured:c,label:`Aliases`,onSuggest:()=>o({scope:`column`,tableId:d,columnId:e.id,field:`aliases`},`${e.name} aliases`),suggesting:s===`column:${d}:${e.id}:aliases`,children:(0,L.jsx)(Bm,{value:t.aliases,onChange:t=>a(d,e.id,e=>({...e,aliases:t}))})}),(0,L.jsx)($,{label:`Enum notes`,children:(0,L.jsx)(Bm,{value:t.enum,onChange:t=>a(d,e.id,e=>({...e,enum:t}))})}),(0,L.jsx)(Wm,{label:`Sensitivity override`,value:t.sensitive,onChange:t=>a(d,e.id,e=>({...e,sensitive:t}))})]})]})]},e.id)})})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Relationships`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:l.physical.relationships&&l.physical.relationships.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:l.physical.relationships.map((e,t)=>(0,L.jsxs)(`div`,{className:`relationship-row`,children:[(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.from}),(0,L.jsx)(bi,{size:14,style:{color:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.to})]},`${e.from}-${e.to}-${t}`))}):(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:`No relationships recorded for this table.`})})]})]})}function Um({aiConfigured:e,children:t,label:n,onSuggest:r,suggesting:a}){return(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:n}),(0,L.jsxs)(`button`,{type:`button`,className:`suggest-link`,disabled:!e||a,onClick:()=>void r(),title:e?`Suggest with configured AI model`:`Configure an AI key to enable suggestions`,children:[a?(0,L.jsx)(Ni,{size:12,className:`animate-spin`}):(0,L.jsx)(Gi,{size:12}),`Suggest`]})]}),t]})}function Wm({label:e,onChange:t,value:n}){return(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:e}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:n===void 0?`inherit`:n?`true`:`false`,onChange:e=>{e.target.value===`inherit`?t(void 0):t(e.target.value===`true`)},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit physical metadata`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})]})}function Gm(){let{selectedTable:e}=Or();if(!e)return null;let t=e;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Column Details`})}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Name`}),(0,L.jsx)(`th`,{children:`Type`}),(0,L.jsx)(`th`,{children:`Nullable`}),(0,L.jsx)(`th`,{children:`PK`}),(0,L.jsx)(`th`,{children:`Default`}),(0,L.jsx)(`th`,{children:`Sensitive`})]})}),(0,L.jsx)(`tbody`,{children:t.physical.columns.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.name})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rm,{variant:`outline`,children:e.type})}),(0,L.jsx)(`td`,{children:e.nullable?`Yes`:`No`}),(0,L.jsx)(`td`,{children:e.primaryKey?(0,L.jsx)(Rm,{variant:`secondary`,children:`PK`}):`—`}),(0,L.jsx)(`td`,{className:`muted tiny`,children:e.default??`—`}),(0,L.jsx)(`td`,{children:e.sensitive?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):`—`})]},e.id))})]})})]}),t.physical.relationships&&t.physical.relationships.length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Relationships`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.physical.relationships.map((e,t)=>(0,L.jsxs)(`div`,{className:`relationship-row`,children:[(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.from}),(0,L.jsx)(bi,{size:14,style:{color:`var(--ink-400)`,flexShrink:0}}),(0,L.jsx)(`span`,{style:{wordBreak:`break-all`},children:e.to})]},`${e.from}-${e.to}-${t}`))})})]})]})}function Km(){let{selectedTable:e,selectedDraft:t,updateColumnDraft:n,updateTableDraft:r}=Or();if(!e||!t)return null;let a=e,o=t,s=a.physical.id;return(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`LLM tracking`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:12,marginBottom:10},children:`Untracked tables are excluded from LLM prompts and RAG indexing. They remain in the schema and are still visible here.`}),(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Status`}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:o.tracked===!1?`false`:`true`,onChange:e=>{let t=e.target.value===`false`?!1:void 0;r(s,e=>({...e,tracked:t}))},children:[(0,L.jsx)(`option`,{value:`true`,children:`Tracked — included in LLM context`}),(0,L.jsx)(`option`,{value:`false`,children:`Untracked — excluded from LLM context`})]})]})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Table-level sensitivity`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`label`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Override`}),(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:o.sensitive===void 0?`inherit`:o.sensitive?`true`:`false`,onChange:e=>{let t=e.target.value===`inherit`?void 0:e.target.value===`true`;r(s,e=>({...e,sensitive:t}))},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit physical metadata`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Column sensitivity`})}),(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Column`}),(0,L.jsx)(`th`,{children:`Physical`}),(0,L.jsx)(`th`,{children:`Override`}),(0,L.jsx)(`th`,{children:`Effective`})]})}),(0,L.jsx)(`tbody`,{children:a.physical.columns.map(e=>{let t=o.columns[e.id]??{},r=t.sensitive===void 0?e.sensitive:t.sensitive;return(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.name})}),(0,L.jsx)(`td`,{children:e.sensitive?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):(0,L.jsx)(`span`,{className:`muted`,children:`—`})}),(0,L.jsx)(`td`,{children:(0,L.jsxs)(`select`,{style:{fontSize:12,padding:`2px 6px`,borderRadius:4,border:`1px solid var(--border)`},value:t.sensitive===void 0?`inherit`:t.sensitive?`true`:`false`,onChange:t=>{let r=t.target.value===`inherit`?void 0:t.target.value===`true`;n(s,e.id,e=>({...e,sensitive:r}))},children:[(0,L.jsx)(`option`,{value:`inherit`,children:`Inherit`}),(0,L.jsx)(`option`,{value:`true`,children:`Sensitive`}),(0,L.jsx)(`option`,{value:`false`,children:`Not sensitive`})]})}),(0,L.jsx)(`td`,{children:r?(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`}):(0,L.jsx)(`span`,{className:`muted`,children:`—`})})]},e.id)})})]})})]})]})}var qm=`concept:`;function Jm(e){return e.startsWith(qm)?e.slice(8):e}function Ym(e){let t=e.trim();return t?t.startsWith(qm)?t:qm+t:``}function Xm(e){return structuredClone(e)}function Zm(){let{workspace:e,tables:t,handleSaveConcepts:n,saveStatus:r,busy:a}=Or(),{refreshRagStatus:o}=Vr(),s=(0,S.useCallback)(async e=>{await n(e),o()},[n,o]),c=(0,S.useMemo)(()=>{if(!t.length)return[];let e=[];for(let n of t){e.push({id:n.physical.id,label:`${n.physical.schema}.${n.physical.name}`,kind:`table`});for(let t of n.physical.columns)e.push({id:t.id,label:`${n.physical.schema}.${n.physical.name} → ${t.name}`,kind:`column`})}return e},[t]);if(!e)return null;let l=e.concepts.map(e=>e.id).join(`,`);return(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)($m,{concepts:e.concepts,linkOptions:c,onSave:s,saveStatus:r,busy:a},l)})}function Qm(e,t){switch(t.type){case`set_selectedIndex`:return{...e,selectedIndex:t.payload};case`set_conceptSearch`:return{...e,conceptSearch:t.payload};case`merge_addDraft`:return{...e,addDraft:{...e.addDraft,...t.payload}};case`update_concept`:return{...e,draft:e.draft.map((e,n)=>n===t.index?t.updater(Xm(e)):e)};case`remove_concept`:{let n=e.draft.filter((e,n)=>n!==t.index),r=e.selectedIndex;return e.selectedIndex===t.index?r=null:e.selectedIndex!==null&&e.selectedIndex>t.index&&(r=e.selectedIndex-1),{...e,draft:n,selectedIndex:r}}case`commit_add`:return{...e,draft:[...e.draft,t.concept],selectedIndex:t.newIndex,addDraft:{},addOpen:!1};case`open_add_form`:return{...e,addOpen:!0,selectedIndex:null};case`select_concept`:return{...e,selectedIndex:t.index,addOpen:!1};case`cancel_add`:return{...e,addOpen:!1,addDraft:{}}}}function $m({concepts:e,linkOptions:t,onSave:n,saveStatus:r,busy:a}){let[o,s]=(0,S.useReducer)(Qm,null,()=>({draft:Xm(e),selectedIndex:null,addOpen:!1,addDraft:{},conceptSearch:``})),{draft:c,selectedIndex:l,addOpen:u,addDraft:d,conceptSearch:f}=o,p=JSON.stringify(c)!==JSON.stringify(e),m=(0,S.useMemo)(()=>{if(!f)return c.map((e,t)=>({concept:e,index:t}));let e=f.toLowerCase();return c.flatMap((t,n)=>t.label.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.synonyms?.some(t=>t.toLowerCase().includes(e))?[{concept:t,index:n}]:[])},[c,f]),h=l===null?null:c[l];function g(e,t){s({type:`update_concept`,index:e,updater:t})}function _(e){s({type:`remove_concept`,index:e})}function v(){let e=Ym(d.id??``);!e||!d.label?.trim()||s({type:`commit_add`,concept:{id:e,label:d.label.trim(),...d.synonyms?.length?{synonyms:d.synonyms}:{},...d.links?.length?{links:d.links}:{},...d.description?.trim()?{description:d.description.trim()}:{}},newIndex:c.length})}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Ai,{size:18,style:{display:`inline`,marginRight:8}}),`Concepts`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Cross-table domain vocabulary for NL→SQL grounding`})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>{setDraft(Xm(e)),setSelectedIndex(null)},disabled:!p||a.has(`save-concepts`),children:[(0,L.jsx)(Bi,{size:14}),` Revert`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void n(c),disabled:!p||a.has(`save-concepts`),children:[a.has(`save-concepts`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),`Save`]})]})]}),r&&(0,L.jsx)(Om,{status:r}),(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`280px 1fr`,flex:1,minHeight:0,overflow:`hidden`},children:[(0,L.jsxs)(`div`,{className:`sub-rail`,style:{borderRight:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{className:`sub-rail-hd`,children:[(0,L.jsx)(`h2`,{children:`Concepts`}),(0,L.jsx)(`span`,{className:`muted tiny`,children:c.length})]}),(0,L.jsxs)(`div`,{className:`sub-rail-search`,children:[(0,L.jsx)(Hi,{size:13}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Search concepts`,placeholder:`Search concepts…`,value:f,onChange:e=>s({type:`set_conceptSearch`,payload:e.target.value})})]}),(0,L.jsx)(`div`,{style:{padding:`6px 8px`,borderBottom:`1px solid var(--border)`},children:(0,L.jsxs)(`button`,{type:`button`,className:`btn sm`,style:{width:`100%`,justifyContent:`center`},onClick:()=>s({type:`open_add_form`}),children:[(0,L.jsx)(Ri,{size:12}),` Add concept`]})}),(0,L.jsxs)(`div`,{className:`sub-rail-list`,children:[m.map(({concept:e,index:t})=>(0,L.jsxs)(`button`,{type:`button`,className:`sub-rail-row ${l===t?`active`:``}`,onClick:()=>s({type:`select_concept`,index:t}),children:[(0,L.jsx)(Ai,{size:12,style:{flexShrink:0,color:`var(--ink-400)`}}),(0,L.jsx)(`span`,{className:`row-name`,children:e.label}),(0,L.jsxs)(`span`,{className:`row-meta`,children:[e.links?.length??0,` links`]})]},e.id)),m.length===0&&(0,L.jsx)(`div`,{className:`muted tiny`,style:{padding:`16px`,textAlign:`center`},children:f?`No concepts match your search`:`No concepts yet`})]})]}),(0,L.jsx)(`div`,{style:{overflow:`auto`,padding:`var(--pad-y) var(--pad-x)`},children:u?(0,L.jsx)(`div`,{className:`stack`,children:(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`New Concept`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)($,{label:`ID`,description:`Unique slug (concept: prefix added automatically)`,children:(0,L.jsx)(th,{value:d.id??``,onChange:e=>s({type:`merge_addDraft`,payload:{id:e}}),placeholder:`revenue`})}),(0,L.jsx)($,{label:`Label`,description:`Human-readable name, e.g. "Revenue"`,children:(0,L.jsx)(Bp,{value:d.label??``,placeholder:`Revenue`,onChange:e=>s({type:`merge_addDraft`,payload:{label:e.target.value}})})})]}),(0,L.jsx)($,{label:`Synonyms`,description:`Comma-separated terms users might say`,children:(0,L.jsx)(Bm,{value:d.synonyms,onChange:e=>s({type:`merge_addDraft`,payload:{synonyms:e}})})}),(0,L.jsx)($,{label:`Links`,description:`Tables or columns this concept maps to`,children:(0,L.jsx)(nh,{value:d.links??[],onChange:e=>s({type:`merge_addDraft`,payload:{links:e}}),options:t})}),(0,L.jsx)($,{label:`Description`,description:`How this concept is computed or what it means`,children:(0,L.jsx)(Vm,{value:d.description??``,placeholder:`Sum of orders.total_amount where status = 'paid', expressed in cents.`,onChange:e=>s({type:`merge_addDraft`,payload:{description:e.target.value}})})}),(0,L.jsxs)(`div`,{style:{display:`flex`,gap:8,justifyContent:`flex-end`},children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s({type:`cancel_add`}),children:`Cancel`}),(0,L.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:v,disabled:!d.id?.trim()||!d.label?.trim(),children:`Add concept`})]})]})})]})}):h&&l!==null?(0,L.jsx)(eh,{concept:h,linkOptions:t,onChange:e=>g(l,e),onRemove:()=>_(l)}):(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`},children:(0,L.jsxs)(`div`,{style:{textAlign:`center`,color:`var(--ink-400)`},children:[(0,L.jsx)(Ai,{size:24,style:{margin:`0 auto 8px`}}),(0,L.jsx)(`p`,{style:{fontSize:13},children:c.length===0?`Click "Add concept" to create your first one`:`Select a concept to edit`})]})})})]})]})}function eh({concept:e,linkOptions:t,onChange:n,onRemove:r}){return(0,L.jsx)(`div`,{className:`stack`,children:(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h3`,{children:e.label}),(0,L.jsx)(Rm,{variant:`outline`,children:e.id})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:r,title:`Remove concept`,style:{color:`var(--red-600)`},children:`Remove`})]}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`1fr 1fr`},children:[(0,L.jsx)($,{label:`ID`,description:`Unique slug (concept: prefix added automatically)`,children:(0,L.jsx)(th,{value:e.id,onChange:e=>n(t=>({...t,id:e}))})}),(0,L.jsx)($,{label:`Label`,description:`Human-readable name`,children:(0,L.jsx)(Bp,{value:e.label,onChange:e=>n(t=>({...t,label:e.target.value}))})})]}),(0,L.jsx)($,{label:`Synonyms`,description:`Comma-separated alternative terms`,children:(0,L.jsx)(Bm,{value:e.synonyms,onChange:e=>n(t=>({...t,synonyms:e.length?e:void 0}))})}),(0,L.jsx)($,{label:`Links`,description:`Tables or columns this concept maps to`,children:(0,L.jsx)(nh,{value:e.links??[],onChange:e=>n(t=>({...t,links:e.length?e:void 0})),options:t})}),(0,L.jsx)($,{label:`Description`,description:`How this concept is computed or what it means`,children:(0,L.jsx)(Vm,{value:e.description??``,onChange:e=>n(t=>({...t,description:e.target.value||void 0}))})})]})})]})})}function th({value:e,onChange:t,placeholder:n}){let r=Jm(e);return(0,L.jsxs)(`div`,{className:`concept-id-input`,children:[(0,L.jsx)(`span`,{className:`concept-id-prefix`,children:`concept:`}),(0,L.jsx)(`input`,{type:`text`,"aria-label":`Concept ID`,className:`concept-id-slug`,value:r,placeholder:n??`my-concept`,onChange:e=>{t(Ym(e.target.value.replace(/\s+/g,`-`).toLowerCase()))}})]})}function nh({value:e,onChange:t,options:n}){let[r,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(0),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=(0,S.useRef)(null);(0,S.useEffect)(()=>{function e(e){u.current&&!u.current.contains(e.target)&&s(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let p=(0,S.useMemo)(()=>new Set(e),[e]),m=(0,S.useMemo)(()=>{if(!r)return n.filter(e=>!p.has(e.id));let e=r.toLowerCase();return n.filter(t=>!p.has(t.id)&&(t.label.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)))},[n,r,p]),h=m.slice(0,30),g=(0,S.useCallback)(n=>{t([...e,n]),a(``),d.current?.focus()},[e,t]),_=(0,S.useCallback)(n=>{t(e.filter(e=>e!==n))},[e,t]);(0,S.useEffect)(()=>{!o||!f.current||f.current.querySelectorAll(`[data-link-item]`)[c]?.scrollIntoView({block:`nearest`})},[c,o]);function v(e){if(!o){(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(s(!0),e.preventDefault());return}switch(e.key){case`ArrowDown`:e.preventDefault(),l(e=>Math.min(e+1,h.length-1));break;case`ArrowUp`:e.preventDefault(),l(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault(),h[c]&&g(h[c].id);break;case`Escape`:e.preventDefault(),s(!1);break}}function y(e){return n.find(t=>t.id===e)?.label??e}function b(e){return n.find(t=>t.id===e)?.kind??(e.includes(`#`)?`column`:`table`)}return(0,L.jsxs)(`div`,{className:`links-input`,ref:u,children:[e.length>0&&(0,L.jsx)(`div`,{className:`links-chips`,children:e.map(e=>(0,L.jsxs)(`span`,{className:`links-chip ${b(e)}`,title:e,children:[(0,L.jsx)(qi,{size:10}),(0,L.jsx)(`span`,{className:`links-chip-label`,children:y(e)}),(0,L.jsx)(`button`,{type:`button`,className:`links-chip-remove`,onMouseDown:t=>{t.preventDefault(),t.stopPropagation(),_(e)},title:`Remove`,children:(0,L.jsx)(Xi,{size:10})})]},e))}),(0,L.jsxs)(`div`,{className:`links-search`,children:[(0,L.jsx)(Hi,{size:12}),(0,L.jsx)(`input`,{ref:d,type:`text`,"aria-label":`Search tables or columns`,className:`links-search-input`,placeholder:e.length?`Add another…`:`Search tables or columns…`,value:r,onChange:e=>{a(e.target.value),l(0)},onFocus:()=>s(!0),onKeyDown:v})]}),o&&h.length>0&&(0,L.jsxs)(`div`,{className:`links-dropdown`,ref:f,role:`listbox`,children:[h.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,"data-link-item":!0,role:`option`,"aria-selected":t===c,className:`links-dropdown-item ${t===c?`highlighted`:``}`,onMouseDown:t=>{t.preventDefault(),g(e.id)},onMouseEnter:()=>l(t),children:[(0,L.jsx)(`span`,{className:`links-kind-badge ${e.kind}`,children:e.kind===`table`?`T`:`C`}),(0,L.jsx)(`span`,{className:`links-dropdown-label`,children:e.label})]},e.id)),m.length>30&&(0,L.jsxs)(`div`,{className:`links-dropdown-more`,children:[m.length-30,` more — type to narrow`]})]})]})}function rh(){let{workspace:e,tables:t,handleSaveTenantPolicy:n,handleSuggestTenantPolicy:r,saveStatus:a,busy:o}=Or(),{refreshRagStatus:s}=Vr(),[c,l]=(0,S.useState)(!1),u=(0,S.useCallback)(async(e,t)=>{let r=await n(e,t);return r&&s(),r},[n,s]);if(!e)return null;let d=e.tenantPolicy??null;return d?c?(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ah,{tenantPolicy:d,tables:t,busy:o,saveStatus:a,onSave:async(e,t)=>{let n=await u(e,t);return n&&l(!1),n},onCancel:()=>l(!1)},d.schemaId)}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ih,{tenantPolicy:d,onEdit:()=>l(!0)})}):(0,L.jsx)(`main`,{className:`main-pane`,children:(0,L.jsx)(ch,{tables:t,schemaId:e.schemaId,aiConfigured:e.aiConfigured,busy:o,onSave:u,onSuggest:r,saveStatus:a})})}function ih({tenantPolicy:e,onEdit:t}){let n=e.coverage.reduce((e,t)=>(e[t.classification]=(e[t.classification]??0)+1,e),{}),r=e.coverage.length,a=r-(n.unknown??0),o=r>0?Math.round(a/r*100):0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Multi-Tenancy`]}),(0,L.jsxs)(`div`,{className:`main-sub`,children:[`Schema: `,e.schemaId,` · `,o,`% table coverage (`,a,`/`,r,`)`,(0,L.jsx)(Rm,{variant:e.enforcement===`strict`?`danger`:`warning`,style:{marginLeft:8},children:e.enforcement})]})]}),(0,L.jsx)(`div`,{className:`main-actions`,children:(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:t,children:[(0,L.jsx)(Ii,{size:14}),` Edit`]})})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsx)(uh,{title:`Coverage`,children:(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsx)(dh,{label:`Root`,count:n.root??0,variant:`primary`}),(0,L.jsx)(dh,{label:`Scoped`,count:n.scoped??0,variant:`primary`}),(0,L.jsx)(dh,{label:`Global`,count:n.global??0,variant:`secondary`}),(0,L.jsx)(dh,{label:`Unknown`,count:n.unknown??0,variant:`warning`})]})}),(0,L.jsx)(uh,{title:`Tenant Roots`,count:e.roots.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.roots.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`span`,{className:`muted`,style:{marginLeft:8,fontSize:12},children:e.label})]}),(0,L.jsxs)(Rm,{variant:`outline`,children:[`col: `,e.tenantIdColumn]})]}),e.parent&&(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Parent: `,(0,L.jsx)(`code`,{children:e.parent.root}),` via `,(0,L.jsx)(`code`,{children:e.parent.foreignKey})]})]},e.id))})}),e.hierarchy.length>0&&(0,L.jsx)(uh,{title:`Hierarchy Edges`,count:e.hierarchy.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.hierarchy.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12,fontSize:13},children:[(0,L.jsx)(`code`,{children:e.parent}),(0,L.jsx)(`span`,{className:`muted`,style:{margin:`0 8px`},children:`→`}),(0,L.jsx)(`code`,{children:e.child}),(0,L.jsxs)(`div`,{className:`muted tiny`,style:{marginTop:4},children:[`FK: `,e.foreignKey]})]},`${e.parent}-${e.child}`))})}),e.scopedTables.length>0&&(0,L.jsx)(uh,{title:`Scoped Tables`,count:e.scopedTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.scopedTables.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`grid`,gap:4},children:e.scopeThrough.map((e,t)=>(0,L.jsxs)(`p`,{className:`muted tiny`,children:[`via `,(0,L.jsx)(Rm,{variant:`outline`,children:e.root}),` `,`column`in e?(0,L.jsxs)(`span`,{children:[`column `,(0,L.jsx)(`code`,{children:e.column})]}):(0,L.jsxs)(`span`,{children:[`join `,e.join.map(e=>`${e.from} -> ${e.to}`).join(`, `)]})]},t))})]},e.id))})}),e.polymorphicTables.length>0&&(0,L.jsx)(uh,{title:`Polymorphic Tables`,count:e.polymorphicTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.polymorphicTables.map(e=>(0,L.jsxs)(`div`,{className:`card`,style:{padding:12},children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Type: `,(0,L.jsx)(`code`,{children:e.typeColumn}),` · ID: `,(0,L.jsx)(`code`,{children:e.idColumn})]}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:Object.entries(e.mapping).map(([e,t])=>(0,L.jsxs)(Rm,{variant:`outline`,children:[e,` → `,t]},e))})]},e.id))})}),e.globalTables.length>0&&(0,L.jsx)(uh,{title:`Global Tables`,count:e.globalTables.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.globalTables.map(e=>(0,L.jsx)(Rm,{variant:`secondary`,children:e},e))})}),(0,L.jsx)(uh,{title:`Table Coverage`,count:e.coverage.length,defaultOpen:!1,children:(0,L.jsx)(`div`,{className:`card`,children:(0,L.jsx)(`div`,{className:`card-bd tight`,children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Table`}),(0,L.jsx)(`th`,{children:`Classification`}),(0,L.jsx)(`th`,{children:`Scope Roots`})]})}),(0,L.jsx)(`tbody`,{children:e.coverage.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(`span`,{className:`mono`,children:e.tableId})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rm,{variant:e.classification===`unknown`?`warning`:e.classification===`global`?`secondary`:`outline`,children:e.classification})}),(0,L.jsx)(`td`,{className:`muted tiny`,children:e.scopeRoots?.join(`, `)??`—`})]},e.tableId))})]})})})}),e.warnings.length>0&&(0,L.jsx)(uh,{title:`Policy Warnings`,count:e.warnings.length,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.warnings.map(e=>(0,L.jsx)(`pre`,{className:`warning-block`,children:fh(e)},String(e)))})})]})})]})}function ah({tenantPolicy:e,tables:t,busy:n,saveStatus:r,onSave:a,onCancel:o}){let[s,c]=(0,S.useState)(()=>ph(e)),[l,u]=(0,S.useState)(()=>e.body);return(0,L.jsx)(lh,{tables:t,frontmatter:s,body:l,busy:n,saveStatus:r,onFrontmatterChange:c,onBodyChange:u,onConfirm:()=>void a(s,l||void 0),onBack:o,title:`Edit Tenant Policy`,backLabel:`Cancel`,confirmLabel:`Save Changes`,badgeLabel:`Saved`})}function oh(e,t){switch(t.type){case`set_mode`:return{...e,mode:t.payload};case`set_draftStatus`:return{...e,draftStatus:t.payload};case`set_draftFrontmatter`:return{...e,draftFrontmatter:t.payload};case`set_draftBody`:return{...e,draftBody:t.payload};case`set_enforcement`:return{...e,enforcement:t.payload};case`set_rootTenantIdColumn`:return{...e,rootTenantIdColumn:t.payload};case`set_rootLabel`:return{...e,rootLabel:t.payload};case`select_root_table`:return{...e,rootTableId:t.tableId,rootLabel:t.label,rootTenantIdColumn:``};case`toggle_global_table`:return{...e,globalTableIds:t.checked?[...e.globalTableIds,t.tableId]:e.globalTableIds.filter(e=>e!==t.tableId)};case`ai_draft_complete`:return{...e,draftFrontmatter:t.frontmatter,draftBody:t.body,mode:`review`,draftStatus:{kind:`success`,text:`AI draft ready for review.`}};case`manual_to_review`:return{...e,draftFrontmatter:t.frontmatter,draftBody:t.body,mode:`review`}}}var sh={mode:`choose`,draftStatus:null,draftFrontmatter:null,draftBody:``,enforcement:`strict`,rootTableId:``,rootTenantIdColumn:``,rootLabel:``,globalTableIds:[]};function ch({tables:e,schemaId:t,aiConfigured:n,busy:r,onSave:a,onSuggest:o,saveStatus:s}){let[c,l]=(0,S.useReducer)(oh,sh),{mode:u,draftStatus:d,draftFrontmatter:f,draftBody:p,enforcement:m,rootTableId:h,rootTenantIdColumn:g,rootLabel:_,globalTableIds:v}=c,y=e.find(e=>e.physical.id===h)?.physical.columns??[];async function b(){l({type:`set_draftStatus`,payload:{kind:`loading`,text:`Analyzing schema and drafting tenant policy...`}});try{let e=await o();l({type:`ai_draft_complete`,frontmatter:e.frontmatter,body:e.body})}catch(e){l({type:`set_draftStatus`,payload:{kind:`error`,text:e instanceof Error?e.message:String(e)}})}}function x(){!h||!g||!_.trim()||l({type:`manual_to_review`,frontmatter:{schemaId:t,enforcement:m,roots:[{id:h,tenantIdColumn:g,label:_.trim()}],...v.length>0?{globalTables:v}:{}},body:`# Tenant Policy
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
@@ -66,10 +66,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
66
66
|
|
|
67
67
|
## Sensitive Interactions
|
|
68
68
|
|
|
69
|
-
`})}function C(){f&&a(f,p||void 0)}let w=h&&g&&_.trim();return u===`choose`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Enable Multi-Tenancy`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Configure tenant isolation for your schema`})]})}),d&&(0,L.jsx)(Om,{status:d}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsx)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:(0,L.jsxs)(`div`,{className:`grid-2`,children:[(0,L.jsx)(`button`,{type:`button`,className:`card`,style:{cursor:`pointer`,textAlign:`left`,border:`2px dashed var(--border)`},disabled:!n||d?.kind===`loading`,onClick:()=>void b(),children:(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[d?.kind===`loading`?(0,L.jsx)(Ni,{size:20,className:`animate-spin`,style:{color:`var(--red-600)`}}):(0,L.jsx)(Gi,{size:20,style:{color:`var(--red-600)`}}),(0,L.jsx)(`h3`,{style:{fontWeight:600},children:`Draft with AI`})]}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:d?.kind===`loading`?`Analyzing your schema...`:`Let AI analyze your schema and propose a complete tenant policy. You will review before saving.`}),!n&&(0,L.jsx)(`p`,{style:{marginTop:8,fontSize:12,color:`var(--red-600)`},children:`Configure an AI provider to use this option.`})]})}),(0,L.jsx)(`button`,{type:`button`,className:`card`,style:{cursor:`pointer`,textAlign:`left`,border:`2px dashed var(--border)`},onClick:()=>l({type:`set_mode`,payload:`manual`}),children:(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,L.jsx)(Ui,{size:20,style:{color:`var(--ink-400)`}}),(0,L.jsx)(`h3`,{style:{fontWeight:600},children:`Configure manually`})]}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:`Pick the tenant root table and column yourself, then review before saving.`})]})})]})})})]}):u===`manual`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Manual Configuration`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Configure the basics, then review before saving`})]}),(0,L.jsx)(`div`,{className:`main-actions`,children:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>l({type:`set_mode`,payload:`choose`}),children:`Back`})})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Tenant Root`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16},children:[(0,L.jsx)($,{label:`Root table`,description:`The table whose rows represent tenants.`,children:(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:h,onChange:t=>{let n=t.target.value;l({type:`select_root_table`,tableId:n,label:e.find(e=>e.physical.id===n)?.physical.name??``})},children:[(0,L.jsx)(`option`,{value:``,children:`Select a table...`}),e.map(e=>(0,L.jsxs)(`option`,{value:e.physical.id,children:[e.physical.schema,`.`,e.physical.name]},e.physical.id))]})}),h&&(0,L.jsx)($,{label:`Tenant ID column`,description:`The column that uniquely identifies a tenant.`,children:(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:g,onChange:e=>l({type:`set_rootTenantIdColumn`,payload:e.target.value}),children:[(0,L.jsx)(`option`,{value:``,children:`Select a column...`}),y.map(e=>(0,L.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.type,e.primaryKey?`, PK`:``,`)`]},e.id))]})}),(0,L.jsx)($,{label:`Label`,description:`e.g. "Organization" or "Company"`,children:(0,L.jsx)(Bp,{value:_,placeholder:`e.g. Organization`,onChange:e=>l({type:`set_rootLabel`,payload:e.target.value})})})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Enforcement Mode`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,children:[(0,L.jsx)(`button`,{type:`button`,className:m===`strict`?`active`:``,onClick:()=>l({type:`set_enforcement`,payload:`strict`}),children:`Strict`}),(0,L.jsx)(`button`,{type:`button`,className:m===`warn`?`active`:``,onClick:()=>l({type:`set_enforcement`,payload:`warn`}),children:`Warn`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:8},children:m===`strict`?`Queries touching unknown (unscoped) tables will be rejected.`:`Queries touching unknown tables will succeed but emit warnings.`})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Global Tables (optional)`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Global tables are shared across all tenants and never filtered.`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.map(e=>e.physical.id===h?null:(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:v.includes(e.physical.id),onChange:t=>l({type:`toggle_global_table`,tableId:e.physical.id,checked:t.target.checked})}),e.physical.schema,`.`,e.physical.name]},e.physical.id))})]})]}),(0,L.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:x,disabled:!w,children:[(0,L.jsx)(bi,{size:14}),` Review & Confirm`]})})]})})]}):(0,L.jsx)(lh,{tables:e,frontmatter:f,body:p,busy:r,saveStatus:s,onFrontmatterChange:e=>l({type:`set_draftFrontmatter`,payload:e}),onBodyChange:e=>l({type:`set_draftBody`,payload:e}),onConfirm:C,onBack:()=>l({type:`set_mode`,payload:`choose`})})}function lh({tables:e,frontmatter:t,body:n,busy:r,saveStatus:a,onFrontmatterChange:o,onBodyChange:s,onConfirm:c,onBack:l,title:u=`Review Tenant Policy`,backLabel:d=`Start Over`,confirmLabel:f=`Confirm & Save`,badgeLabel:p=`Draft`}){function m(e){o({...t,enforcement:e})}function h(e,n){let r=[...t.roots];r[e]={...r[e],label:n},o({...t,roots:r})}function g(e){let n=t.roots.filter((t,n)=>n!==e);n.length!==0&&o({...t,roots:n})}function _(e){let n=(t.hierarchy??[]).filter((t,n)=>n!==e);o({...t,hierarchy:n.length>0?n:void 0})}function v(e){let n=(t.scopedTables??[]).filter((t,n)=>n!==e);o({...t,scopedTables:n.length>0?n:void 0})}function y(e){let n=(t.polymorphicTables??[]).filter((t,n)=>n!==e);o({...t,polymorphicTables:n.length>0?n:void 0})}function b(e){let n=t.globalTables??[],r=n.includes(e)?n.filter(t=>t!==e):[...n,e];o({...t,globalTables:r.length>0?r:void 0})}let x=new Set(t.roots.map(e=>e.id)),S=new Set((t.scopedTables??[]).map(e=>e.id)),C=new Set((t.polymorphicTables??[]).map(e=>e.id)),w=new Set(t.globalTables??[]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),u]}),(0,L.jsx)(`div`,{className:`main-sub`,children:(0,L.jsx)(Rm,{variant:`warning`,children:p})})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:l,children:[(0,L.jsx)(Bi,{size:14}),` `,d]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:c,disabled:r.has(`save-tenant-policy`)||t.roots.length===0,children:[r.has(`save-tenant-policy`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),f]})]})]}),a&&(0,L.jsx)(Om,{status:a}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Enforcement Mode`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,children:[(0,L.jsx)(`button`,{type:`button`,className:t.enforcement===`strict`?`active`:``,onClick:()=>m(`strict`),children:`Strict`}),(0,L.jsx)(`button`,{type:`button`,className:t.enforcement===`warn`?`active`:``,onClick:()=>m(`warn`),children:`Warn`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:8},children:t.enforcement===`strict`?`Queries touching unknown (unscoped) tables will be rejected.`:`Queries touching unknown tables will succeed but emit warnings.`})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Tenant Roots (`,t.roots.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:t.roots.map((e,n)=>(0,L.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:[(0,L.jsxs)(Rm,{variant:`outline`,children:[`col: `,e.tenantIdColumn]}),e.parent&&(0,L.jsxs)(Rm,{variant:`outline`,children:[`parent: `,e.parent.root,` via `,e.parent.foreignKey]})]})]}),t.roots.length>1&&(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>g(n),title:`Remove root`,children:`×`})]}),(0,L.jsx)(`div`,{style:{marginTop:8},children:(0,L.jsx)($,{label:`Label`,description:`Human-readable name for this tenant root.`,children:(0,L.jsx)(Bp,{value:e.label,onChange:e=>h(n,e.target.value)})})})]},e.id))})})]}),(t.hierarchy??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Hierarchy Edges (`,t.hierarchy.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.hierarchy.map(e=>(0,L.jsxs)(`div`,{className:`policy-edge-card`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`code`,{children:e.parent}),(0,L.jsx)(`span`,{className:`muted`,style:{margin:`0 8px`},children:`→`}),(0,L.jsx)(`code`,{children:e.child}),(0,L.jsxs)(`div`,{className:`muted tiny`,style:{marginTop:4},children:[`FK: `,e.foreignKey]})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>_(i),title:`Remove`,children:`×`})]},`${e.parent}-${e.child}`))})})]}),(t.scopedTables??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Scoped Tables (`,t.scopedTables.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.scopedTables.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`grid`,gap:4},children:e.scopeThrough.map((e,t)=>(0,L.jsxs)(`p`,{className:`muted tiny`,children:[`via `,(0,L.jsx)(Rm,{variant:`outline`,children:e.root}),` `,`column`in e?(0,L.jsxs)(`span`,{children:[`column `,(0,L.jsx)(`code`,{children:e.column})]}):(0,L.jsxs)(`span`,{children:[`join `,e.join.map(e=>`${e.from} -> ${e.to}`).join(`, `)]})]},t))})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>v(t),title:`Remove`,children:`×`})]},e.id))})})]}),(t.polymorphicTables??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Polymorphic Tables (`,t.polymorphicTables.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.polymorphicTables.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Type: `,(0,L.jsx)(`code`,{children:e.typeColumn}),` · ID: `,(0,L.jsx)(`code`,{children:e.idColumn})]}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:Object.entries(e.mapping).map(([e,t])=>(0,L.jsxs)(Rm,{variant:`outline`,children:[e,` → `,t]},e))})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>y(t),title:`Remove`,children:`×`})]},e.id))})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Global Tables`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Global tables are shared across all tenants and never filtered.`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.map(e=>x.has(e.physical.id)||S.has(e.physical.id)||C.has(e.physical.id)?null:(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:w.has(e.physical.id),onChange:()=>b(e.physical.id)}),e.physical.schema,`.`,e.physical.name]},e.physical.id))})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Documentation (body)`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Optional markdown body explaining the tenant policy.`}),(0,L.jsx)(Vm,{className:`min-h-48 font-mono text-xs`,value:n,onChange:e=>s(e.target.value)})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Frontmatter Preview`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`pre`,{className:`plain-block`,style:{fontSize:12},children:JSON.stringify(t,null,2)})})]})]})})]})}function uh({title:e,count:t,children:n,defaultOpen:r=!0}){let[a,o]=(0,S.useState)(r);return(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`collapsible-btn`,onClick:()=>o(!a),children:[a?(0,L.jsx)(yi,{size:14}):(0,L.jsx)(bi,{size:14}),e,t==null?``:` (${t})`]}),a&&n]})}function dh({label:e,count:t,variant:n}){return(0,L.jsxs)(`div`,{className:`card`,style:{textAlign:`center`,padding:12,background:n===`primary`?`var(--red-50)`:n===`secondary`?`var(--surface-2)`:`#fef3c7`},children:[(0,L.jsx)(`div`,{style:{fontSize:24,fontWeight:700},children:t}),(0,L.jsx)(`div`,{className:`muted tiny`,children:e})]})}function fh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function ph(e){return{schemaId:e.schemaId,enforcement:e.enforcement,roots:mh(e.roots),...e.hierarchy.length>0?{hierarchy:mh(e.hierarchy)}:{},...e.scopedTables.length>0?{scopedTables:mh(e.scopedTables)}:{},...e.polymorphicTables.length>0?{polymorphicTables:mh(e.polymorphicTables)}:{},...e.globalTables.length>0?{globalTables:[...e.globalTables]}:{}}}function mh(e){return structuredClone(e)}function hh({text:e}){return(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-sm text-muted-foreground`,children:e})}function gh(){let{workspace:e}=Or(),{ragStatus:t,ragMessage:n,ragQuestion:r,setRagQuestion:a,ragK:o,setRagK:s,ragTypes:c,setRagTypes:l,ragResults:u,ragIndexUsage:d,busy:f,allChunkTypes:p,refreshRagStatus:m,handleBuildRag:h,handleQueryRag:g}=Vr();if(!e)return null;let _=!t?.hasIndex||t.stale||f.has(`rag-query`);return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Gi,{size:18,style:{display:`inline`,marginRight:8}}),`RAG Index`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Retrieval-augmented generation index and query debugger`})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>void m(),children:[(0,L.jsx)(zi,{size:14}),` Refresh`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void h(),disabled:f.has(`rag-build`),children:[f.has(`rag-build`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(_i,{size:14}),`Build Index`]})]})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[n&&(0,L.jsx)(km,{status:n}),t?(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Chunks`}),(0,L.jsx)(`div`,{className:`stat-num`,children:Tr(t.chunksTotal)})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Indexed`}),(0,L.jsx)(`div`,{className:`stat-num`,children:Tr(t.chunksIndexed)})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitive excluded`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.sensitiveExcluded})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitive included`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.sensitiveIncluded})]})]}):(0,L.jsx)(hh,{text:`RAG status is unavailable.`}),t&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Index Details`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,marginBottom:12},children:[(0,L.jsx)(Rm,{variant:t.hasIndex?`secondary`:`warning`,children:t.hasIndex?`Index present`:`No index`}),(0,L.jsx)(Rm,{variant:t.stale?`warning`:`secondary`,children:t.stale?`Stale`:`Fresh`}),(0,L.jsx)(Rm,{variant:t.embedder.configured?`secondary`:`warning`,children:t.embedder.label})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:4,fontSize:12,color:`var(--ink-400)`},children:[(0,L.jsxs)(`span`,{children:[`Expected: `,t.expectedEmbedderId]}),(0,L.jsxs)(`span`,{children:[`Indexed: `,t.embedder.indexedId??`none`]}),(0,L.jsxs)(`span`,{children:[`Dimensions: `,t.dimensions,` / expected `,t.expectedDimensions]}),(0,L.jsxs)(`span`,{children:[`Updated: `,t.updatedAt??`never`]}),(0,L.jsxs)(`span`,{children:[`Store: `,t.store.kind]})]}),(0,L.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,L.jsx)(`i`,{style:{width:t.chunksTotal>0?`${Math.round(t.chunksIndexed/t.chunksTotal*100)}%`:`0%`}})})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Query Debugger`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsx)($,{label:`Question`,children:(0,L.jsx)(Vm,{value:r,onChange:e=>a(e.target.value),placeholder:`Which customers placed orders last month?`})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`120px 1fr`},children:[(0,L.jsx)($,{label:`Top K`,children:(0,L.jsx)(Bp,{min:1,max:25,type:`number`,value:o,onChange:e=>s(Number(e.target.value))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Chunk types`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:p.map(e=>(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{checked:c.includes(e),type:`checkbox`,onChange:t=>{t.target.checked?l([...c,e]):l(c.filter(t=>t!==e))}}),e]},e))})]})]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:_,onClick:()=>void g(),children:[f.has(`rag-query`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Hi,{size:14}),`Query RAG`]}),(0,L.jsx)(vh,{title:`Last Index Usage`,usage:d}),(0,L.jsx)(vh,{title:`Last Query Usage`,usage:u?.usage??null})]})})]}),(0,L.jsx)(_h,{chunks:u?.results??[],emptyText:`No chunks retrieved yet.`})]})})]})}function _h({chunks:e,emptyText:t}){return(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Retrieved Chunks`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:e.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:e.map(e=>(0,L.jsxs)(`article`,{className:`chunk-card`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,wordBreak:`break-all`},children:e.id}),(0,L.jsx)(Rm,{variant:`outline`,children:e.type}),e.sensitive&&(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`})]}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4,wordBreak:`break-all`},children:[`refs: `,e.refs.length>0?e.refs.join(`, `):`none`]})]}),(0,L.jsx)(Rm,{variant:`secondary`,children:e.score.toFixed(3)})]}),(0,L.jsx)(`pre`,{className:`chunk-text`,children:e.text})]},e.id))}):(0,L.jsx)(hh,{text:t})})]})}function vh({title:e,usage:t}){if(!t)return null;let n=t.promptTokens??t.embeddingTokens;return(0,L.jsxs)(`section`,{className:`usage-summary`,"aria-label":e,children:[(0,L.jsx)(`h3`,{children:e}),(0,L.jsxs)(`dl`,{className:`usage-grid`,children:[n!==null&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{children:t.embeddingTokens===null?`Prompt`:`Embeddings`}),(0,L.jsx)(`dd`,{children:Tr(n)})]}),t.completionTokens!==null&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{children:`Completion`}),(0,L.jsx)(`dd`,{children:Tr(t.completionTokens)})]}),(0,L.jsxs)(`div`,{className:`usage-total`,children:[(0,L.jsx)(`dt`,{children:`Total`}),(0,L.jsx)(`dd`,{children:Tr(t.totalTokens)})]})]})]})}function yh({value:e}){let[t,n]=(0,S.useState)(!1);return(0,L.jsxs)(zp,{variant:`ghost`,size:`sm`,onClick:(0,S.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]),children:[t?(0,L.jsx)(vi,{className:`h-3.5 w-3.5 text-green-500`}):(0,L.jsx)(Ti,{className:`h-3.5 w-3.5`}),t?`Copied`:`Copy`]})}var bh={border:0,padding:0,margin:0},xh={openai:{adapterPackage:`@askdb/ai-openai`,adapterImport:`openaiProvider`,sdkPackage:`@ai-sdk/openai`,sdkImport:`openai`,sdkModel:e=>`openai(${JSON.stringify(e)})`},anthropic:{adapterPackage:`@askdb/ai-anthropic`,adapterImport:`anthropicProvider`,sdkPackage:`@ai-sdk/anthropic`,sdkImport:`anthropic`,sdkModel:e=>`anthropic(${JSON.stringify(e)})`},google:{adapterPackage:`@askdb/ai-google`,adapterImport:`googleProvider`,sdkPackage:`@ai-sdk/google`,sdkImport:`google`,sdkModel:e=>`google(${JSON.stringify(e)})`},azure:{adapterPackage:`@askdb/ai-azure`,adapterImport:`azureProvider`,sdkPackage:`@ai-sdk/azure`,sdkImport:`azure`,sdkModel:e=>`azure(${JSON.stringify(e)}) // your deployment name`}};function Sh(e){return e in xh?xh[e]:e===`foundry`||e===`azure-openai`?xh.azure:xh.openai}function Ch(){let{workspace:e}=Or(),{askQuestion:t,askTenantEnabled:n,generatedTenantScopeJson:r,askTenantSqlMode:a}=Jr(),[o,s]=(0,S.useState)(`client`),c=(0,S.useMemo)(()=>{if(!e)return``;let s=t.trim()||`Which customers signed up last week?`,c=Sh(e.aiProvider),l=e.schemaPathRelative,u=n&&r?r:null;if(o===`client`){let e=u?`, {\n tenantScope: ${wh(u,2)},\n tenantSqlMode: ${JSON.stringify(a)},\n}`:``;return`// npm install @askdb/client @askdb/config @askdb/ai ${c.adapterPackage}
|
|
69
|
+
`})}function C(){f&&a(f,p||void 0)}let w=h&&g&&_.trim();return u===`choose`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Enable Multi-Tenancy`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Configure tenant isolation for your schema`})]})}),d&&(0,L.jsx)(Om,{status:d}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsx)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:(0,L.jsxs)(`div`,{className:`grid-2`,children:[(0,L.jsx)(`button`,{type:`button`,className:`card`,style:{cursor:`pointer`,textAlign:`left`,border:`2px dashed var(--border)`},disabled:!n||d?.kind===`loading`,onClick:()=>void b(),children:(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[d?.kind===`loading`?(0,L.jsx)(Ni,{size:20,className:`animate-spin`,style:{color:`var(--red-600)`}}):(0,L.jsx)(Gi,{size:20,style:{color:`var(--red-600)`}}),(0,L.jsx)(`h3`,{style:{fontWeight:600},children:`Draft with AI`})]}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:d?.kind===`loading`?`Analyzing your schema...`:`Let AI analyze your schema and propose a complete tenant policy. You will review before saving.`}),!n&&(0,L.jsx)(`p`,{style:{marginTop:8,fontSize:12,color:`var(--red-600)`},children:`Configure an AI provider to use this option.`})]})}),(0,L.jsx)(`button`,{type:`button`,className:`card`,style:{cursor:`pointer`,textAlign:`left`,border:`2px dashed var(--border)`},onClick:()=>l({type:`set_mode`,payload:`manual`}),children:(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,L.jsx)(Ui,{size:20,style:{color:`var(--ink-400)`}}),(0,L.jsx)(`h3`,{style:{fontWeight:600},children:`Configure manually`})]}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13},children:`Pick the tenant root table and column yourself, then review before saving.`})]})})]})})})]}):u===`manual`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),`Manual Configuration`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Configure the basics, then review before saving`})]}),(0,L.jsx)(`div`,{className:`main-actions`,children:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>l({type:`set_mode`,payload:`choose`}),children:`Back`})})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Tenant Root`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:16},children:[(0,L.jsx)($,{label:`Root table`,description:`The table whose rows represent tenants.`,children:(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:h,onChange:t=>{let n=t.target.value;l({type:`select_root_table`,tableId:n,label:e.find(e=>e.physical.id===n)?.physical.name??``})},children:[(0,L.jsx)(`option`,{value:``,children:`Select a table...`}),e.map(e=>(0,L.jsxs)(`option`,{value:e.physical.id,children:[e.physical.schema,`.`,e.physical.name]},e.physical.id))]})}),h&&(0,L.jsx)($,{label:`Tenant ID column`,description:`The column that uniquely identifies a tenant.`,children:(0,L.jsxs)(`select`,{className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,value:g,onChange:e=>l({type:`set_rootTenantIdColumn`,payload:e.target.value}),children:[(0,L.jsx)(`option`,{value:``,children:`Select a column...`}),y.map(e=>(0,L.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.type,e.primaryKey?`, PK`:``,`)`]},e.id))]})}),(0,L.jsx)($,{label:`Label`,description:`e.g. "Organization" or "Company"`,children:(0,L.jsx)(Bp,{value:_,placeholder:`e.g. Organization`,onChange:e=>l({type:`set_rootLabel`,payload:e.target.value})})})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Enforcement Mode`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,children:[(0,L.jsx)(`button`,{type:`button`,className:m===`strict`?`active`:``,onClick:()=>l({type:`set_enforcement`,payload:`strict`}),children:`Strict`}),(0,L.jsx)(`button`,{type:`button`,className:m===`warn`?`active`:``,onClick:()=>l({type:`set_enforcement`,payload:`warn`}),children:`Warn`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:8},children:m===`strict`?`Queries touching unknown (unscoped) tables will be rejected.`:`Queries touching unknown tables will succeed but emit warnings.`})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Global Tables (optional)`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Global tables are shared across all tenants and never filtered.`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.map(e=>e.physical.id===h?null:(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:v.includes(e.physical.id),onChange:t=>l({type:`toggle_global_table`,tableId:e.physical.id,checked:t.target.checked})}),e.physical.schema,`.`,e.physical.name]},e.physical.id))})]})]}),(0,L.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:x,disabled:!w,children:[(0,L.jsx)(bi,{size:14}),` Review & Confirm`]})})]})})]}):(0,L.jsx)(lh,{tables:e,frontmatter:f,body:p,busy:r,saveStatus:s,onFrontmatterChange:e=>l({type:`set_draftFrontmatter`,payload:e}),onBodyChange:e=>l({type:`set_draftBody`,payload:e}),onConfirm:C,onBack:()=>l({type:`set_mode`,payload:`choose`})})}function lh({tables:e,frontmatter:t,body:n,busy:r,saveStatus:a,onFrontmatterChange:o,onBodyChange:s,onConfirm:c,onBack:l,title:u=`Review Tenant Policy`,backLabel:d=`Start Over`,confirmLabel:f=`Confirm & Save`,badgeLabel:p=`Draft`}){function m(e){o({...t,enforcement:e})}function h(e,n){let r=[...t.roots];r[e]={...r[e],label:n},o({...t,roots:r})}function g(e){let n=t.roots.filter((t,n)=>n!==e);n.length!==0&&o({...t,roots:n})}function _(e){let n=(t.hierarchy??[]).filter((t,n)=>n!==e);o({...t,hierarchy:n.length>0?n:void 0})}function v(e){let n=(t.scopedTables??[]).filter((t,n)=>n!==e);o({...t,scopedTables:n.length>0?n:void 0})}function y(e){let n=(t.polymorphicTables??[]).filter((t,n)=>n!==e);o({...t,polymorphicTables:n.length>0?n:void 0})}function b(e){let n=t.globalTables??[],r=n.includes(e)?n.filter(t=>t!==e):[...n,e];o({...t,globalTables:r.length>0?r:void 0})}let x=new Set(t.roots.map(e=>e.id)),S=new Set((t.scopedTables??[]).map(e=>e.id)),C=new Set((t.polymorphicTables??[]).map(e=>e.id)),w=new Set(t.globalTables??[]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Wi,{size:18,style:{display:`inline`,marginRight:8}}),u]}),(0,L.jsx)(`div`,{className:`main-sub`,children:(0,L.jsx)(Rm,{variant:`warning`,children:p})})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:l,children:[(0,L.jsx)(Bi,{size:14}),` `,d]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:c,disabled:r.has(`save-tenant-policy`)||t.roots.length===0,children:[r.has(`save-tenant-policy`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Vi,{size:14}),f]})]})]}),a&&(0,L.jsx)(Om,{status:a}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Enforcement Mode`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,children:[(0,L.jsx)(`button`,{type:`button`,className:t.enforcement===`strict`?`active`:``,onClick:()=>m(`strict`),children:`Strict`}),(0,L.jsx)(`button`,{type:`button`,className:t.enforcement===`warn`?`active`:``,onClick:()=>m(`warn`),children:`Warn`})]}),(0,L.jsx)(`p`,{className:`muted tiny`,style:{marginTop:8},children:t.enforcement===`strict`?`Queries touching unknown (unscoped) tables will be rejected.`:`Queries touching unknown tables will succeed but emit warnings.`})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Tenant Roots (`,t.roots.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:t.roots.map((e,n)=>(0,L.jsxs)(`div`,{style:{border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:[(0,L.jsxs)(Rm,{variant:`outline`,children:[`col: `,e.tenantIdColumn]}),e.parent&&(0,L.jsxs)(Rm,{variant:`outline`,children:[`parent: `,e.parent.root,` via `,e.parent.foreignKey]})]})]}),t.roots.length>1&&(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>g(n),title:`Remove root`,children:`×`})]}),(0,L.jsx)(`div`,{style:{marginTop:8},children:(0,L.jsx)($,{label:`Label`,description:`Human-readable name for this tenant root.`,children:(0,L.jsx)(Bp,{value:e.label,onChange:e=>h(n,e.target.value)})})})]},e.id))})})]}),(t.hierarchy??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Hierarchy Edges (`,t.hierarchy.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.hierarchy.map(e=>(0,L.jsxs)(`div`,{className:`policy-edge-card`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`code`,{children:e.parent}),(0,L.jsx)(`span`,{className:`muted`,style:{margin:`0 8px`},children:`→`}),(0,L.jsx)(`code`,{children:e.child}),(0,L.jsxs)(`div`,{className:`muted tiny`,style:{marginTop:4},children:[`FK: `,e.foreignKey]})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>_(i),title:`Remove`,children:`×`})]},`${e.parent}-${e.child}`))})})]}),(t.scopedTables??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Scoped Tables (`,t.scopedTables.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.scopedTables.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`grid`,gap:4},children:e.scopeThrough.map((e,t)=>(0,L.jsxs)(`p`,{className:`muted tiny`,children:[`via `,(0,L.jsx)(Rm,{variant:`outline`,children:e.root}),` `,`column`in e?(0,L.jsxs)(`span`,{children:[`column `,(0,L.jsx)(`code`,{children:e.column})]}):(0,L.jsxs)(`span`,{children:[`join `,e.join.map(e=>`${e.from} -> ${e.to}`).join(`, `)]})]},t))})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>v(t),title:`Remove`,children:`×`})]},e.id))})})]}),(t.polymorphicTables??[]).length>0&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[`Polymorphic Tables (`,t.polymorphicTables.length,`)`]})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:t.polymorphicTables.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,padding:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`mono`,style:{fontWeight:600,fontSize:13},children:e.id}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4},children:[`Type: `,(0,L.jsx)(`code`,{children:e.typeColumn}),` · ID: `,(0,L.jsx)(`code`,{children:e.idColumn})]}),(0,L.jsx)(`div`,{style:{marginTop:4,display:`flex`,flexWrap:`wrap`,gap:4},children:Object.entries(e.mapping).map(([e,t])=>(0,L.jsxs)(Rm,{variant:`outline`,children:[e,` → `,t]},e))})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>y(t),title:`Remove`,children:`×`})]},e.id))})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Global Tables`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Global tables are shared across all tenants and never filtered.`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:e.map(e=>x.has(e.physical.id)||S.has(e.physical.id)||C.has(e.physical.id)?null:(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:w.has(e.physical.id),onChange:()=>b(e.physical.id)}),e.physical.schema,`.`,e.physical.name]},e.physical.id))})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Documentation (body)`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginBottom:8},children:`Optional markdown body explaining the tenant policy.`}),(0,L.jsx)(Vm,{className:`min-h-48 font-mono text-xs`,value:n,onChange:e=>s(e.target.value)})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Frontmatter Preview`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`pre`,{className:`plain-block`,style:{fontSize:12},children:JSON.stringify(t,null,2)})})]})]})})]})}function uh({title:e,count:t,children:n,defaultOpen:r=!0}){let[a,o]=(0,S.useState)(r);return(0,L.jsxs)(`section`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`collapsible-btn`,onClick:()=>o(!a),children:[a?(0,L.jsx)(yi,{size:14}):(0,L.jsx)(bi,{size:14}),e,t==null?``:` (${t})`]}),a&&n]})}function dh({label:e,count:t,variant:n}){return(0,L.jsxs)(`div`,{className:`card`,style:{textAlign:`center`,padding:12,background:n===`primary`?`var(--red-50)`:n===`secondary`?`var(--surface-2)`:`#fef3c7`},children:[(0,L.jsx)(`div`,{style:{fontSize:24,fontWeight:700},children:t}),(0,L.jsx)(`div`,{className:`muted tiny`,children:e})]})}function fh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function ph(e){return{schemaId:e.schemaId,enforcement:e.enforcement,roots:mh(e.roots),...e.hierarchy.length>0?{hierarchy:mh(e.hierarchy)}:{},...e.scopedTables.length>0?{scopedTables:mh(e.scopedTables)}:{},...e.polymorphicTables.length>0?{polymorphicTables:mh(e.polymorphicTables)}:{},...e.globalTables.length>0?{globalTables:[...e.globalTables]}:{}}}function mh(e){return structuredClone(e)}function hh({text:e}){return(0,L.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-6 text-center text-sm text-muted-foreground`,children:e})}var gh=new Intl.NumberFormat;function _h(e){return gh.format(e)}function vh({label:e,value:t}){return t===null?null:(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{children:e}),(0,L.jsx)(`dd`,{children:_h(t)})]})}function yh({title:e,usage:t}){return t?(0,L.jsxs)(`section`,{className:`usage-summary`,"aria-label":e,children:[(0,L.jsx)(`h3`,{children:e}),(0,L.jsxs)(`dl`,{className:`usage-grid`,children:[(0,L.jsx)(vh,{label:`Prompt`,value:t.promptTokens}),(0,L.jsx)(vh,{label:`Completion`,value:t.completionTokens}),(0,L.jsx)(vh,{label:`Embeddings`,value:t.embeddingTokens}),(0,L.jsxs)(`div`,{className:`usage-total`,children:[(0,L.jsx)(`dt`,{children:`Total`}),(0,L.jsx)(`dd`,{children:_h(t.totalTokens)})]})]})]}):null}function bh(){let{workspace:e}=Or(),{ragStatus:t,ragMessage:n,ragQuestion:r,setRagQuestion:a,ragK:o,setRagK:s,ragTypes:c,setRagTypes:l,ragResults:u,ragIndexUsage:d,busy:f,allChunkTypes:p,refreshRagStatus:m,handleBuildRag:h,handleQueryRag:g}=Vr();if(!e)return null;let _=!t?.hasIndex||t.stale||f.has(`rag-query`);return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsxs)(`div`,{className:`main-hd`,children:[(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Gi,{size:18,style:{display:`inline`,marginRight:8}}),`RAG Index`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Retrieval-augmented generation index and query debugger`})]}),(0,L.jsxs)(`div`,{className:`main-actions`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,onClick:()=>void m(),children:[(0,L.jsx)(zi,{size:14}),` Refresh`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,onClick:()=>void h(),disabled:f.has(`rag-build`),children:[f.has(`rag-build`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(_i,{size:14}),`Build Index`]})]})]}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[n&&(0,L.jsx)(km,{status:n}),t?(0,L.jsxs)(`div`,{className:`grid-4`,children:[(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Chunks`}),(0,L.jsx)(`div`,{className:`stat-num`,children:Tr(t.chunksTotal)})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Indexed`}),(0,L.jsx)(`div`,{className:`stat-num`,children:Tr(t.chunksIndexed)})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitive excluded`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.sensitiveExcluded})]}),(0,L.jsxs)(`div`,{className:`card stat-card`,children:[(0,L.jsx)(`div`,{className:`stat-label`,children:`Sensitive included`}),(0,L.jsx)(`div`,{className:`stat-num`,children:t.sensitiveIncluded})]})]}):(0,L.jsx)(hh,{text:`RAG status is unavailable.`}),t&&(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Index Details`})}),(0,L.jsxs)(`div`,{className:`card-bd`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,marginBottom:12},children:[(0,L.jsx)(Rm,{variant:t.hasIndex?`secondary`:`warning`,children:t.hasIndex?`Index present`:`No index`}),(0,L.jsx)(Rm,{variant:t.stale?`warning`:`secondary`,children:t.stale?`Stale`:`Fresh`}),(0,L.jsx)(Rm,{variant:t.embedder.configured?`secondary`:`warning`,children:t.embedder.label})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:4,fontSize:12,color:`var(--ink-400)`},children:[(0,L.jsxs)(`span`,{children:[`Expected: `,t.expectedEmbedderId]}),(0,L.jsxs)(`span`,{children:[`Indexed: `,t.embedder.indexedId??`none`]}),(0,L.jsxs)(`span`,{children:[`Dimensions: `,t.dimensions,` / expected `,t.expectedDimensions]}),(0,L.jsxs)(`span`,{children:[`Updated: `,t.updatedAt??`never`]}),(0,L.jsxs)(`span`,{children:[`Store: `,t.store.kind]})]}),(0,L.jsx)(`div`,{className:`bar`,style:{marginTop:14},children:(0,L.jsx)(`i`,{style:{width:t.chunksTotal>0?`${Math.round(t.chunksIndexed/t.chunksTotal*100)}%`:`0%`}})})]})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Query Debugger`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsx)($,{label:`Question`,children:(0,L.jsx)(Vm,{value:r,onChange:e=>a(e.target.value),placeholder:`Which customers placed orders last month?`})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12,gridTemplateColumns:`120px 1fr`},children:[(0,L.jsx)($,{label:`Top K`,children:(0,L.jsx)(Bp,{min:1,max:25,type:`number`,value:o,onChange:e=>s(Number(e.target.value))})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:12,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Chunk types`}),(0,L.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8},children:p.map(e=>(0,L.jsxs)(`label`,{className:`chunk-toggle`,children:[(0,L.jsx)(`input`,{checked:c.includes(e),type:`checkbox`,onChange:t=>{t.target.checked?l([...c,e]):l(c.filter(t=>t!==e))}}),e]},e))})]})]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:_,onClick:()=>void g(),children:[f.has(`rag-query`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Hi,{size:14}),`Query RAG`]}),(0,L.jsx)(yh,{title:`Last Index Usage`,usage:d}),(0,L.jsx)(yh,{title:`Last Query Usage`,usage:u?.usage??null})]})})]}),(0,L.jsx)(xh,{chunks:u?.results??[],emptyText:`No chunks retrieved yet.`})]})})]})}function xh({chunks:e,emptyText:t}){return(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Retrieved Chunks`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:e.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:12},children:e.map(e=>(0,L.jsxs)(`article`,{className:`chunk-card`,children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`start`,justifyContent:`space-between`,gap:12},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`h4`,{style:{fontSize:13,fontWeight:600,wordBreak:`break-all`},children:e.id}),(0,L.jsx)(Rm,{variant:`outline`,children:e.type}),e.sensitive&&(0,L.jsx)(Rm,{variant:`danger`,children:`sensitive`})]}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:4,wordBreak:`break-all`},children:[`refs: `,e.refs.length>0?e.refs.join(`, `):`none`]})]}),(0,L.jsx)(Rm,{variant:`secondary`,children:e.score.toFixed(3)})]}),(0,L.jsx)(`pre`,{className:`chunk-text`,children:e.text})]},e.id))}):(0,L.jsx)(hh,{text:t})})]})}function Sh({value:e}){let[t,n]=(0,S.useState)(!1);return(0,L.jsxs)(zp,{variant:`ghost`,size:`sm`,onClick:(0,S.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]),children:[t?(0,L.jsx)(vi,{className:`h-3.5 w-3.5 text-green-500`}):(0,L.jsx)(Ti,{className:`h-3.5 w-3.5`}),t?`Copied`:`Copy`]})}var Ch={border:0,padding:0,margin:0},wh={openai:{adapterPackage:`@askdb/ai-openai`,adapterImport:`openaiProvider`,sdkPackage:`@ai-sdk/openai`,sdkImport:`openai`,sdkModel:e=>`openai(${JSON.stringify(e)})`},anthropic:{adapterPackage:`@askdb/ai-anthropic`,adapterImport:`anthropicProvider`,sdkPackage:`@ai-sdk/anthropic`,sdkImport:`anthropic`,sdkModel:e=>`anthropic(${JSON.stringify(e)})`},google:{adapterPackage:`@askdb/ai-google`,adapterImport:`googleProvider`,sdkPackage:`@ai-sdk/google`,sdkImport:`google`,sdkModel:e=>`google(${JSON.stringify(e)})`},azure:{adapterPackage:`@askdb/ai-azure`,adapterImport:`azureProvider`,sdkPackage:`@ai-sdk/azure`,sdkImport:`azure`,sdkModel:e=>`azure(${JSON.stringify(e)}) // your deployment name`}};function Th(e){return e in wh?wh[e]:e===`foundry`||e===`azure-openai`?wh.azure:wh.openai}function Eh(){let{workspace:e}=Or(),{askQuestion:t,askTenantEnabled:n,generatedTenantScopeJson:r,askTenantSqlMode:a}=Jr(),[o,s]=(0,S.useState)(`client`),c=(0,S.useMemo)(()=>{if(!e)return``;let s=t.trim()||`Which customers signed up last week?`,c=Th(e.aiProvider),l=e.schemaPathRelative,u=n&&r?r:null;if(o===`client`){let e=u?`, {\n tenantScope: ${Dh(u,2)},\n tenantSqlMode: ${JSON.stringify(a)},\n}`:``;return`// npm install @askdb/client @askdb/config ${c.adapterPackage}
|
|
70
70
|
import { createAskDb } from "@askdb/client";
|
|
71
71
|
import { bootstrapAskDbEnv, getAskDbRuntimeConfig } from "@askdb/config";
|
|
72
|
-
import { createAiRegistry } from "@askdb/ai";
|
|
73
72
|
import { ${c.adapterImport} } from "${c.adapterPackage}";
|
|
74
73
|
|
|
75
74
|
// Reads the same askdb.config.ts + .env this Studio session uses.
|
|
@@ -77,16 +76,16 @@ bootstrapAskDbEnv({ cwd: process.cwd() });
|
|
|
77
76
|
|
|
78
77
|
const askdb = createAskDb({
|
|
79
78
|
config: getAskDbRuntimeConfig(),
|
|
80
|
-
|
|
79
|
+
providers: [${c.adapterImport}],
|
|
81
80
|
schema: { path: ${JSON.stringify(l)} },
|
|
82
81
|
});
|
|
83
82
|
|
|
84
83
|
const { sql${u&&a===`sql-params`?`, tenantParams`:``} } = await askdb.ask(
|
|
85
|
-
${JSON.stringify(s)}${e?
|
|
84
|
+
${JSON.stringify(s)}${e?Dh(e,2):``}
|
|
86
85
|
);
|
|
87
86
|
|
|
88
87
|
// AskDB returns validated SQL — it never executes it.
|
|
89
|
-
// Run it through your own pool under a read-only role${u&&a===`sql-params`?`, binding tenantParams`:``}.`}let d=u?`\n tenantScope: ${
|
|
88
|
+
// Run it through your own pool under a read-only role${u&&a===`sql-params`?`, binding tenantParams`:``}.`}let d=u?`\n tenantScope: ${Dh(u,2)},\n tenantSqlMode: ${JSON.stringify(a)},`:``;return`// npm install @askdb/core ${c.sdkPackage}
|
|
90
89
|
import { ask, loadSchema } from "@askdb/core";
|
|
91
90
|
import { ${c.sdkImport} } from "${c.sdkPackage}";
|
|
92
91
|
|
|
@@ -101,8 +100,8 @@ const { sql${u&&a===`sql-params`?`, tenantParams`:``} } = await ask({
|
|
|
101
100
|
});
|
|
102
101
|
|
|
103
102
|
// AskDB returns validated SQL — it never executes it.
|
|
104
|
-
// Run it through your own pool under a read-only role${u&&a===`sql-params`?`, binding tenantParams`:``}.`},[e,o,t,n,r,a]);return e?(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8,gap:8,flexWrap:`wrap`},children:[(0,L.jsxs)(`h3`,{style:{fontSize:13,fontWeight:600,display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsx)(wi,{size:14}),` Get the code`]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:
|
|
103
|
+
// Run it through your own pool under a read-only role${u&&a===`sql-params`?`, binding tenantParams`:``}.`},[e,o,t,n,r,a]);return e?(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8,gap:8,flexWrap:`wrap`},children:[(0,L.jsxs)(`h3`,{style:{fontSize:13,fontWeight:600,display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsx)(wi,{size:14}),` Get the code`]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:Ch,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Integration style`}),(0,L.jsx)(`button`,{className:o===`client`?`active`:``,onClick:()=>s(`client`),children:`Config-driven`}),(0,L.jsx)(`button`,{className:o===`core`?`active`:``,onClick:()=>s(`core`),children:`Direct ask()`})]}),(0,L.jsx)(Sh,{value:c})]})]}),(0,L.jsxs)(`p`,{className:`muted`,style:{fontSize:12,marginBottom:8,lineHeight:1.5},children:[`This exact question, schema (`,e.schemaPathRelative,`), dialect (`,e.dialect,`), and provider (`,e.aiProvider,`) — as it runs in your own Node service.`]}),(0,L.jsx)(`pre`,{className:`plain-block`,style:{fontSize:11.5,overflow:`auto`},children:c}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{marginTop:8},children:[`Full walkthrough:`,` `,(0,L.jsx)(`a`,{href:`https://askdb.tools/guides/embed-in-node/`,target:`_blank`,rel:`noreferrer`,children:`Embed AskDB in a Node app`})]})]}):null}function Dh(e,t){let n=` `.repeat(t);return e.split(`
|
|
105
104
|
`).map((e,t)=>t===0?e:n+e).join(`
|
|
106
|
-
`)}var Th=`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,Eh={border:0,padding:0,margin:0};function Dh(e){return`${e}-${globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}function Oh(){let{workspace:e}=Or(),{ragAvailable:t}=Vr(),{askQuestion:n,setAskQuestion:r,askMode:a,setAskMode:o,askMessage:s,askResult:c,askTenantEnabled:l,setAskTenantEnabled:u,askTenantAccessKind:d,setAskTenantAccessKind:f,askTenantRoot:p,setAskTenantRoot:m,askTenantIdsText:h,setAskTenantIdsText:g,askTenantMultiRootRows:_,setAskTenantMultiRootRows:v,askTenantGlobalReason:y,setAskTenantGlobalReason:b,askTenantContext:x,setAskTenantContext:C,askTenantContextAttributes:w,setAskTenantContextAttributes:T,askTenantFilterRows:E,setAskTenantFilterRows:D,generatedTenantScopeJson:ee,tenantScopeValidationError:O,askTenantSqlMode:te,setAskTenantSqlMode:k,executeResult:A,executeMessage:ne,executeStatus:j,historyEntries:re,busy:ie,handleAsk:M,handleExecute:N,loadHistoryEntry:ae,handleDeleteHistory:oe,handleInstallExecuteDriver:se}=Jr(),P=(0,S.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!ie.has(`ask`)&&(e.preventDefault(),M())},[ie,M]);if((0,S.useEffect)(()=>(document.addEventListener(`keydown`,P),()=>document.removeEventListener(`keydown`,P)),[P]),!e)return null;let F=!!e.tenantPolicy,I=e.tenantPolicy?.roots??[],ce=e.tenantPolicy?.polymorphicTables??[],le=I[0]?.id??``,ue=ce[0];return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Li,{size:18,style:{display:`inline`,marginRight:8}}),`Query Playground`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Generate SQL from natural language and execute it against your database`})]})}),(0,L.jsx)(`div`,{className:`main-body`,style:{overflow:`hidden`,padding:0},children:(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`2fr 3fr`,height:`100%`},children:[(0,L.jsxs)(`div`,{style:{borderRight:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,overflow:`auto`},children:[(0,L.jsx)(`div`,{style:{padding:`var(--pad-y) var(--pad-x)`},children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsx)($,{label:`Natural language question`,children:(0,L.jsx)(Vm,{value:n,onChange:e=>r(e.target.value),placeholder:`How many users placed orders last month?`,rows:4})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Retrieval mode`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:Eh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Retrieval mode`}),(0,L.jsx)(`button`,{className:a===`full`?`active`:``,onClick:()=>o(`full`),children:`Full schema`}),(0,L.jsxs)(`button`,{className:a===`rag`?`active`:``,disabled:!t,title:t?void 0:`Build the RAG index first to query with retrieval.`,onClick:()=>o(`rag`),children:[!t&&(0,L.jsx)(Pi,{size:12,style:{display:`inline`,marginRight:4}}),`RAG`]})]})]}),F&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:10},children:[(0,L.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,L.jsxs)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600},children:[(0,L.jsx)(Wi,{size:12,style:{display:`inline`,marginRight:4}}),`Tenant scope`]})]}),l&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:10},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Access kind`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:Eh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Tenant scope access kind`}),(0,L.jsx)(`button`,{className:d===`ids`?`active`:``,onClick:()=>f(`ids`),children:`IDs`}),(0,L.jsx)(`button`,{className:d===`subtree`?`active`:``,onClick:()=>f(`subtree`),children:`Subtree`}),(0,L.jsx)(`button`,{className:d===`multi_root`?`active`:``,onClick:()=>f(`multi_root`),children:`Multi-root`}),(0,L.jsx)(`button`,{className:d===`global`?`active`:``,onClick:()=>f(`global`),children:`Super / global`})]})]}),(d===`ids`||d===`subtree`)&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8},children:[(0,L.jsx)($,{label:`Tenant root`,children:(0,L.jsx)(`select`,{className:Th,value:p,onChange:e=>m(e.target.value),children:I.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.id,`)`]},e.id))})}),(0,L.jsx)($,{label:d===`ids`?`Tenant IDs`:`Subtree root IDs`,description:`Comma-separated IDs from your app's auth context.`,children:(0,L.jsx)(Bp,{value:h,onChange:e=>g(e.target.value),placeholder:d===`ids`?`org-1, org-2`:`region-1`})})]}),d===`multi_root`&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8},children:[_.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Tenant root`,className:`min-w-0`,children:(0,L.jsx)(`select`,{className:Th,value:e.tenantRoot,onChange:n=>{let r=[..._];r[t]={...e,tenantRoot:n.target.value},v(r)},children:I.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.id,`)`]},e.id))})}),(0,L.jsx)($,{label:`IDs`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.idsText,onChange:n=>{let r=[..._];r[t]={...e,idsText:n.target.value},v(r)},placeholder:`org-1, org-2`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,disabled:_.length===1,onClick:()=>v(_.filter((e,n)=>n!==t)),title:`Remove scope row`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>v([..._,{id:Dh(`multi-root`),tenantRoot:le,idsText:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add root`]})})]}),d===`global`&&(0,L.jsx)($,{label:`Super / global reason`,description:`Required for audit context.`,children:(0,L.jsx)(Bp,{value:y,onChange:e=>b(e.target.value),placeholder:`superuser access for support investigation`})}),(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`muted`,style:{cursor:`pointer`,fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Advisory context`}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8,marginTop:8},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,L.jsx)($,{label:`Role`,children:(0,L.jsx)(Bp,{value:x.role,onChange:e=>C({...x,role:e.target.value}),placeholder:`regional_manager`})}),(0,L.jsx)($,{label:`Label`,children:(0,L.jsx)(Bp,{value:x.label,onChange:e=>C({...x,label:e.target.value}),placeholder:`Jane Smith, Northeast`})}),(0,L.jsx)($,{label:`Department`,children:(0,L.jsx)(Bp,{value:x.department,onChange:e=>C({...x,department:e.target.value}),placeholder:`operations`})}),(0,L.jsx)($,{label:`Region`,children:(0,L.jsx)(Bp,{value:x.region,onChange:e=>C({...x,region:e.target.value}),placeholder:`northeast`})})]}),(0,L.jsx)($,{label:`Description`,children:(0,L.jsx)(Vm,{value:x.description,onChange:e=>C({...x,description:e.target.value}),placeholder:`Business context for this user's scope.`,rows:2})}),w.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Attribute key`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.key,onChange:n=>{let r=[...w];r[t]={...e,key:n.target.value},T(r)},placeholder:`team`})}),(0,L.jsx)($,{label:`Attribute value`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.value,onChange:n=>{let r=[...w];r[t]={...e,value:n.target.value},T(r)},placeholder:`field-sales`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>T(w.filter((e,n)=>n!==t)),title:`Remove attribute`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>T([...w,{id:Dh(`context-attribute`),key:``,value:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add attribute`]})})]})]}),ce.length>0&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`muted`,style:{cursor:`pointer`,fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Tenant filters`}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8,marginTop:8},children:[E.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1.2fr) minmax(0, 1fr) 88px minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Table`,className:`min-w-0`,children:(0,L.jsx)(`select`,{className:Th,value:e.tableId,onChange:n=>{let r=ce.find(e=>e.id===n.target.value),a=[...E];a[t]={...e,tableId:n.target.value,column:e.column||r?.typeColumn||``},D(a)},children:ce.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.id},e.id))})}),(0,L.jsx)($,{label:`Column`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.column,onChange:n=>{let r=[...E];r[t]={...e,column:n.target.value},D(r)},placeholder:`owner_type`})}),(0,L.jsx)($,{label:`Operator`,className:`min-w-0`,children:(0,L.jsxs)(`select`,{className:Th,value:e.operator,onChange:n=>{let r=[...E];r[t]={...e,operator:n.target.value},D(r)},children:[(0,L.jsx)(`option`,{value:`=`,children:`=`}),(0,L.jsx)(`option`,{value:`IN`,children:`IN`}),(0,L.jsx)(`option`,{value:`!=`,children:`!=`}),(0,L.jsx)(`option`,{value:`NOT IN`,children:`NOT IN`})]})}),(0,L.jsx)($,{label:`Value`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.valueText,onChange:n=>{let r=[...E];r[t]={...e,valueText:n.target.value},D(r)},placeholder:e.operator===`IN`||e.operator===`NOT IN`?`client, agency`:`client`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>D(E.filter((e,n)=>n!==t)),title:`Remove condition`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>D([...E,{id:Dh(`tenant-filter`),tableId:ue.id,column:ue.typeColumn,operator:`=`,valueText:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add condition`]})})]})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`tenantScope JSON preview`}),ee&&(0,L.jsx)(yh,{value:ee})]}),(0,L.jsx)(`pre`,{className:`mono`,style:{minHeight:116,margin:0,overflow:`auto`,whiteSpace:`pre-wrap`,border:`1px solid var(--border)`,borderRadius:6,padding:10,fontSize:11,background:`var(--surface-2)`},children:ee||O||`Complete the tenant scope fields to preview the JSON passed to ask().`}),O&&(0,L.jsx)(`span`,{style:{color:`var(--red-600)`,fontSize:12},children:O})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`SQL output mode`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:Eh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`SQL output mode`}),(0,L.jsx)(`button`,{className:te===`sql-only`?`active`:``,onClick:()=>k(`sql-only`),children:`Inline literals`}),(0,L.jsx)(`button`,{className:te===`sql-params`?`active`:``,onClick:()=>k(`sql-params`),children:`$N parameters`})]})]})]})]}),(0,L.jsxs)(`button`,{className:`btn primary`,disabled:ie.has(`ask`),onClick:()=>void M(),title:`Generate SQL (⌘↵)`,children:[ie.has(`ask`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Gi,{size:14}),`Generate SQL`,(0,L.jsx)(`kbd`,{className:`kbd`,style:{marginLeft:4,opacity:.7},children:`⌘↵`})]}),s&&(0,L.jsx)(km,{status:s})]})}),re.length>0&&(0,L.jsxs)(`div`,{style:{borderTop:`1px solid var(--border)`,flex:1,overflow:`auto`},children:[(0,L.jsx)(`div`,{style:{padding:`8px var(--pad-x)`},children:(0,L.jsxs)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:[`History (`,re.length,`)`]})}),(0,L.jsx)(`div`,{children:re.slice(0,20).map(e=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`6px var(--pad-x)`,cursor:`pointer`,fontSize:12,borderBottom:`1px solid var(--border)`},onClick:()=>ae(e),children:[(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:e.question}),(0,L.jsx)(`span`,{className:`chip ${e.mode===`rag`?`red`:``}`,style:{flexShrink:0},children:e.mode}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:t=>{t.stopPropagation(),oe(e.id)},title:`Delete`,style:{flexShrink:0,padding:2},children:`×`})]},e.id))})]})]}),(0,L.jsx)(`div`,{style:{overflow:`auto`},children:c?(0,L.jsxs)(`div`,{style:{display:`grid`,gap:0},children:[(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600},children:`Generated SQL`}),c.sql&&(0,L.jsx)(yh,{value:c.sql})]}),c.sql?(0,L.jsx)(`pre`,{className:`sql-block`,children:c.sql}):(0,L.jsx)(hh,{text:`No SQL generated.`})]}),c.explain!==null&&c.explain!==void 0&&(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600,marginBottom:8},children:`Explain`}),(0,L.jsx)(`pre`,{className:`plain-block`,children:kh(c.explain)})]}),c.tenant?.enabled&&(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600,marginBottom:8},children:`Tenant Params`}),c.tenant.params.length>0?(0,L.jsxs)(`div`,{style:{padding:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,fontSize:12},children:[(0,L.jsx)(`span`,{style:{fontWeight:600},children:`Positional params:`}),` `,(0,L.jsx)(`code`,{children:JSON.stringify(c.tenant.params)})]}):(0,L.jsx)(hh,{text:`No tenant params.`})]}),(0,L.jsxs)(`div`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,gap:8},children:[j&&(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600},children:j.label}),j.configured?(0,L.jsx)(`span`,{className:`chip`,style:{fontSize:11},children:j.connectionKind===`file`?`file configured`:`URL configured`}):(0,L.jsx)(`span`,{className:`chip red`,style:{fontSize:11},children:j.connectionKind===`file`?`no file`:`no URL`}),j.installed?(0,L.jsxs)(`span`,{className:`chip`,style:{fontSize:11},children:[j.packageName,` ready`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`chip red`,style:{fontSize:11},children:[j.packageName,` missing`]}),j.canInstallFromStudio&&(0,L.jsxs)(`button`,{className:`btn ghost sm`,disabled:ie.has(`install-driver`),onClick:()=>void se(),style:{fontSize:11},children:[ie.has(`install-driver`)?(0,L.jsx)(Ni,{size:12,className:`animate-spin`}):null,`Install `,j.packageName]}),!j.canInstallFromStudio&&j.manualInstallReason&&(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11},children:j.installCommand})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,L.jsxs)(`button`,{className:`btn primary`,disabled:ie.has(`execute`)||!c.sql||j!==null&&(!j.configured||!j.installed),onClick:()=>void N(),children:[ie.has(`execute`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Li,{size:14}),`Execute Query`]}),ne&&(0,L.jsx)(km,{status:ne})]})]}),(0,L.jsx)(Ch,{}),A?.ok===!0&&(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600},children:`Results`}),A.truncated&&(0,L.jsx)(`span`,{className:`chip amber`,children:`Showing first 500 rows`})]}),A.columns&&A.rows?(0,L.jsx)(`div`,{style:{overflowX:`auto`},children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsx)(`tr`,{children:A.columns.map(e=>(0,L.jsx)(`th`,{children:e},e))})}),(0,L.jsx)(`tbody`,{children:A.rows.map((e,t)=>(0,L.jsx)(`tr`,{children:e.map((e,t)=>(0,L.jsx)(`td`,{className:`mono`,style:{fontSize:11},children:e==null?(0,L.jsx)(`span`,{className:`muted`,children:`NULL`}):String(e)},t))},t))})]})}):(0,L.jsx)(hh,{text:`No results.`})]})]}):(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,padding:32},children:(0,L.jsx)(hh,{text:`Ask a question to generate SQL`})})})]})})]})}function kh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function Ah(){let{workspace:e}=Or(),{ragStatus:t}=Vr();return e?(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Ui,{size:18,style:{display:`inline`,marginRight:8}}),`Settings`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Workspace configuration and diagnostics`})]})}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Workspace`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`dl`,{className:`definition-list`,children:[(0,L.jsx)(`dt`,{children:`Schema ID`}),(0,L.jsx)(`dd`,{children:e.schemaId}),(0,L.jsx)(`dt`,{children:`Schema path`}),(0,L.jsx)(`dd`,{children:e.schemaDir}),(0,L.jsx)(`dt`,{children:`AI provider`}),(0,L.jsx)(`dd`,{children:e.aiProvider}),(0,L.jsx)(`dt`,{children:`Model`}),(0,L.jsx)(`dd`,{children:e.model}),(0,L.jsx)(`dt`,{children:`AI suggestions`}),(0,L.jsx)(`dd`,{children:e.aiConfigured?`Configured`:`Not configured`})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`RAG Store`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:t?(0,L.jsxs)(`dl`,{className:`definition-list`,children:[(0,L.jsx)(`dt`,{children:`Store`}),(0,L.jsx)(`dd`,{children:t.store.kind}),(0,L.jsx)(`dt`,{children:`Lock file`}),(0,L.jsx)(`dd`,{children:t.files.lock?`present`:`missing`}),t.store.kind===`file`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Base path`}),(0,L.jsx)(`dd`,{children:t.store.basePath??`n/a`}),(0,L.jsx)(`dt`,{children:`Embeddings JSON`}),(0,L.jsx)(`dd`,{children:t.files.embeddingsJson?`present`:`missing`}),(0,L.jsx)(`dt`,{children:`Embeddings binary`}),(0,L.jsx)(`dd`,{children:t.files.embeddingsBin?`present`:`missing`})]}),t.store.kind===`pgvector`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Table`}),(0,L.jsx)(`dd`,{children:t.store.table??`askdb_rag_chunks`}),(0,L.jsx)(`dt`,{children:`Index strategy`}),(0,L.jsx)(`dd`,{children:t.store.indexStrategy??`default`})]}),t.store.kind===`memory`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Persistence`}),(0,L.jsx)(`dd`,{children:`In-process only`})]})]}):(0,L.jsx)(hh,{text:`RAG status is unavailable.`})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Schema Warnings`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:e.warnings.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.warnings.map((e,t)=>(0,L.jsx)(`pre`,{className:`warning-block`,children:typeof e==`string`?e:JSON.stringify(e,null,2)},t))}):(0,L.jsx)(hh,{text:`No schema warnings.`})})]})]})})]}):null}var jh=`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,Mh=[{value:`postgres`,label:`PostgreSQL`},{value:`mysql`,label:`MySQL`},{value:`sqlite`,label:`SQLite`},{value:`sqlserver`,label:`SQL Server`},{value:`prisma`,label:`Prisma schema file (no live database)`}],Nh=[{value:`openai`,label:`OpenAI`,keyEnv:`OPENAI_API_KEY`},{value:`anthropic`,label:`Anthropic`,keyEnv:`ANTHROPIC_API_KEY`},{value:`google`,label:`Google`,keyEnv:`GOOGLE_GENERATIVE_AI_API_KEY`},{value:`azure`,label:`Azure OpenAI`,keyEnv:`AZURE_OPENAI_API_KEY`}],Ph={postgres:`DATABASE_URL`,mysql:`MYSQL_URL`,sqlserver:`SQLSERVER_URL`,sqlite:``,prisma:``};function Fh({status:e,onComplete:t}){let n=e.reason===`no-artifact`,[r,a]=(0,S.useState)(`postgres`),[o,s]=(0,S.useState)(`DATABASE_URL`),c=(0,S.useRef)(!1),[l,u]=(0,S.useState)(`./data.db`),[d,f]=(0,S.useState)(``),[p,m]=(0,S.useState)(`openai`),[h,g]=(0,S.useState)(`OPENAI_API_KEY`),_=(0,S.useRef)(!1),[v,y]=(0,S.useState)(`./askdb`),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(null),D=r===`postgres`||r===`mysql`||r===`sqlserver`,ee=n||b!==null,O=(0,S.useMemo)(()=>b?b.envVars:D?[{name:o,purpose:`${r} connection URL`,requiredForIntrospection:!0},{name:h,purpose:`${p} API key`,requiredForIntrospection:!1}]:[{name:h,purpose:`${p} API key`,requiredForIntrospection:!1}],[b,D,o,r,h,p]),te=O.map(e=>`${e.name}=`).join(`
|
|
107
|
-
`),k=(0,S.useCallback)(e=>{a(e),c.current||s(
|
|
108
|
-
`)}),(0,L.jsx)(
|
|
105
|
+
`)}var Oh=`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,kh={border:0,padding:0,margin:0};function Ah(e){return`${e}-${globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`}`}function jh(){let{workspace:e}=Or(),{ragAvailable:t}=Vr(),{askQuestion:n,setAskQuestion:r,askMode:a,setAskMode:o,askMessage:s,askResult:c,askTenantEnabled:l,setAskTenantEnabled:u,askTenantAccessKind:d,setAskTenantAccessKind:f,askTenantRoot:p,setAskTenantRoot:m,askTenantIdsText:h,setAskTenantIdsText:g,askTenantMultiRootRows:_,setAskTenantMultiRootRows:v,askTenantGlobalReason:y,setAskTenantGlobalReason:b,askTenantContext:x,setAskTenantContext:C,askTenantContextAttributes:w,setAskTenantContextAttributes:T,askTenantFilterRows:E,setAskTenantFilterRows:D,generatedTenantScopeJson:ee,tenantScopeValidationError:O,askTenantSqlMode:te,setAskTenantSqlMode:k,executeResult:A,executeMessage:ne,executeStatus:j,historyEntries:re,busy:ie,handleAsk:M,handleExecute:N,loadHistoryEntry:ae,handleDeleteHistory:oe,handleInstallExecuteDriver:se}=Jr(),P=(0,S.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!ie.has(`ask`)&&(e.preventDefault(),M())},[ie,M]);if((0,S.useEffect)(()=>(document.addEventListener(`keydown`,P),()=>document.removeEventListener(`keydown`,P)),[P]),!e)return null;let F=!!e.tenantPolicy,I=e.tenantPolicy?.roots??[],ce=e.tenantPolicy?.polymorphicTables??[],le=I[0]?.id??``,ue=ce[0];return(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Li,{size:18,style:{display:`inline`,marginRight:8}}),`Query Playground`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Generate SQL from natural language and execute it against your database`})]})}),(0,L.jsx)(`div`,{className:`main-body`,style:{overflow:`hidden`,padding:0},children:(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`2fr 3fr`,height:`100%`},children:[(0,L.jsxs)(`div`,{style:{borderRight:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,overflow:`auto`},children:[(0,L.jsx)(`div`,{style:{padding:`var(--pad-y) var(--pad-x)`},children:(0,L.jsxs)(`div`,{style:{display:`grid`,gap:12},children:[(0,L.jsx)($,{label:`Natural language question`,children:(0,L.jsx)(Vm,{value:n,onChange:e=>r(e.target.value),placeholder:`How many users placed orders last month?`,rows:4})}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Retrieval mode`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:kh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Retrieval mode`}),(0,L.jsx)(`button`,{className:a===`full`?`active`:``,onClick:()=>o(`full`),children:`Full schema`}),(0,L.jsxs)(`button`,{className:a===`rag`?`active`:``,disabled:!t,title:t?void 0:`Build the RAG index first to query with retrieval.`,onClick:()=>o(`rag`),children:[!t&&(0,L.jsx)(Pi,{size:12,style:{display:`inline`,marginRight:4}}),`RAG`]})]})]}),F&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:10},children:[(0,L.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,L.jsxs)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600},children:[(0,L.jsx)(Wi,{size:12,style:{display:`inline`,marginRight:4}}),`Tenant scope`]})]}),l&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:10},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Access kind`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:kh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`Tenant scope access kind`}),(0,L.jsx)(`button`,{className:d===`ids`?`active`:``,onClick:()=>f(`ids`),children:`IDs`}),(0,L.jsx)(`button`,{className:d===`subtree`?`active`:``,onClick:()=>f(`subtree`),children:`Subtree`}),(0,L.jsx)(`button`,{className:d===`multi_root`?`active`:``,onClick:()=>f(`multi_root`),children:`Multi-root`}),(0,L.jsx)(`button`,{className:d===`global`?`active`:``,onClick:()=>f(`global`),children:`Super / global`})]})]}),(d===`ids`||d===`subtree`)&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8},children:[(0,L.jsx)($,{label:`Tenant root`,children:(0,L.jsx)(`select`,{className:Oh,value:p,onChange:e=>m(e.target.value),children:I.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.id,`)`]},e.id))})}),(0,L.jsx)($,{label:d===`ids`?`Tenant IDs`:`Subtree root IDs`,description:`Comma-separated IDs from your app's auth context.`,children:(0,L.jsx)(Bp,{value:h,onChange:e=>g(e.target.value),placeholder:d===`ids`?`org-1, org-2`:`region-1`})})]}),d===`multi_root`&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8},children:[_.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Tenant root`,className:`min-w-0`,children:(0,L.jsx)(`select`,{className:Oh,value:e.tenantRoot,onChange:n=>{let r=[..._];r[t]={...e,tenantRoot:n.target.value},v(r)},children:I.map(e=>(0,L.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.id,`)`]},e.id))})}),(0,L.jsx)($,{label:`IDs`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.idsText,onChange:n=>{let r=[..._];r[t]={...e,idsText:n.target.value},v(r)},placeholder:`org-1, org-2`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,disabled:_.length===1,onClick:()=>v(_.filter((e,n)=>n!==t)),title:`Remove scope row`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>v([..._,{id:Ah(`multi-root`),tenantRoot:le,idsText:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add root`]})})]}),d===`global`&&(0,L.jsx)($,{label:`Super / global reason`,description:`Required for audit context.`,children:(0,L.jsx)(Bp,{value:y,onChange:e=>b(e.target.value),placeholder:`superuser access for support investigation`})}),(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`muted`,style:{cursor:`pointer`,fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Advisory context`}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8,marginTop:8},children:[(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8},children:[(0,L.jsx)($,{label:`Role`,children:(0,L.jsx)(Bp,{value:x.role,onChange:e=>C({...x,role:e.target.value}),placeholder:`regional_manager`})}),(0,L.jsx)($,{label:`Label`,children:(0,L.jsx)(Bp,{value:x.label,onChange:e=>C({...x,label:e.target.value}),placeholder:`Jane Smith, Northeast`})}),(0,L.jsx)($,{label:`Department`,children:(0,L.jsx)(Bp,{value:x.department,onChange:e=>C({...x,department:e.target.value}),placeholder:`operations`})}),(0,L.jsx)($,{label:`Region`,children:(0,L.jsx)(Bp,{value:x.region,onChange:e=>C({...x,region:e.target.value}),placeholder:`northeast`})})]}),(0,L.jsx)($,{label:`Description`,children:(0,L.jsx)(Vm,{value:x.description,onChange:e=>C({...x,description:e.target.value}),placeholder:`Business context for this user's scope.`,rows:2})}),w.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1fr) minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Attribute key`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.key,onChange:n=>{let r=[...w];r[t]={...e,key:n.target.value},T(r)},placeholder:`team`})}),(0,L.jsx)($,{label:`Attribute value`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.value,onChange:n=>{let r=[...w];r[t]={...e,value:n.target.value},T(r)},placeholder:`field-sales`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>T(w.filter((e,n)=>n!==t)),title:`Remove attribute`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>T([...w,{id:Ah(`context-attribute`),key:``,value:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add attribute`]})})]})]}),ce.length>0&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{className:`muted`,style:{cursor:`pointer`,fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`Tenant filters`}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8,marginTop:8},children:[E.map((e,t)=>(0,L.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0, 1.2fr) minmax(0, 1fr) 88px minmax(0, 1fr) auto`,gap:8,alignItems:`end`},children:[(0,L.jsx)($,{label:`Table`,className:`min-w-0`,children:(0,L.jsx)(`select`,{className:Oh,value:e.tableId,onChange:n=>{let r=ce.find(e=>e.id===n.target.value),a=[...E];a[t]={...e,tableId:n.target.value,column:e.column||r?.typeColumn||``},D(a)},children:ce.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.id},e.id))})}),(0,L.jsx)($,{label:`Column`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.column,onChange:n=>{let r=[...E];r[t]={...e,column:n.target.value},D(r)},placeholder:`owner_type`})}),(0,L.jsx)($,{label:`Operator`,className:`min-w-0`,children:(0,L.jsxs)(`select`,{className:Oh,value:e.operator,onChange:n=>{let r=[...E];r[t]={...e,operator:n.target.value},D(r)},children:[(0,L.jsx)(`option`,{value:`=`,children:`=`}),(0,L.jsx)(`option`,{value:`IN`,children:`IN`}),(0,L.jsx)(`option`,{value:`!=`,children:`!=`}),(0,L.jsx)(`option`,{value:`NOT IN`,children:`NOT IN`})]})}),(0,L.jsx)($,{label:`Value`,className:`min-w-0`,children:(0,L.jsx)(Bp,{value:e.valueText,onChange:n=>{let r=[...E];r[t]={...e,valueText:n.target.value},D(r)},placeholder:e.operator===`IN`||e.operator===`NOT IN`?`client, agency`:`client`})}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>D(E.filter((e,n)=>n!==t)),title:`Remove condition`,children:(0,L.jsx)(Ji,{size:14})})]},e.id)),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{className:`btn ghost sm`,onClick:()=>D([...E,{id:Ah(`tenant-filter`),tableId:ue.id,column:ue.typeColumn,operator:`=`,valueText:``}]),children:[(0,L.jsx)(Ri,{size:14}),`Add condition`]})})]})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`tenantScope JSON preview`}),ee&&(0,L.jsx)(Sh,{value:ee})]}),(0,L.jsx)(`pre`,{className:`mono`,style:{minHeight:116,margin:0,overflow:`auto`,whiteSpace:`pre-wrap`,border:`1px solid var(--border)`,borderRadius:6,padding:10,fontSize:11,background:`var(--surface-2)`},children:ee||O||`Complete the tenant scope fields to preview the JSON passed to ask().`}),O&&(0,L.jsx)(`span`,{style:{color:`var(--red-600)`,fontSize:12},children:O})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:`SQL output mode`}),(0,L.jsxs)(`fieldset`,{className:`toggle-seg`,style:kh,children:[(0,L.jsx)(`legend`,{className:`sr-only`,children:`SQL output mode`}),(0,L.jsx)(`button`,{className:te===`sql-only`?`active`:``,onClick:()=>k(`sql-only`),children:`Inline literals`}),(0,L.jsx)(`button`,{className:te===`sql-params`?`active`:``,onClick:()=>k(`sql-params`),children:`$N parameters`})]})]})]})]}),(0,L.jsxs)(`button`,{className:`btn primary`,disabled:ie.has(`ask`),onClick:()=>void M(),title:`Generate SQL (⌘↵)`,children:[ie.has(`ask`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Gi,{size:14}),`Generate SQL`,(0,L.jsx)(`kbd`,{className:`kbd`,style:{marginLeft:4,opacity:.7},children:`⌘↵`})]}),s&&(0,L.jsx)(km,{status:s})]})}),re.length>0&&(0,L.jsxs)(`div`,{style:{borderTop:`1px solid var(--border)`,flex:1,overflow:`auto`},children:[(0,L.jsx)(`div`,{style:{padding:`8px var(--pad-x)`},children:(0,L.jsxs)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.04em`},children:[`History (`,re.length,`)`]})}),(0,L.jsx)(`div`,{children:re.slice(0,20).map(e=>(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8,padding:`6px var(--pad-x)`,cursor:`pointer`,fontSize:12,borderBottom:`1px solid var(--border)`},onClick:()=>ae(e),children:[(0,L.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:e.question}),(0,L.jsx)(`span`,{className:`chip ${e.mode===`rag`?`red`:``}`,style:{flexShrink:0},children:e.mode}),(0,L.jsx)(`button`,{className:`btn ghost sm`,onClick:t=>{t.stopPropagation(),oe(e.id)},title:`Delete`,style:{flexShrink:0,padding:2},children:`×`})]},e.id))})]})]}),(0,L.jsx)(`div`,{style:{overflow:`auto`},children:c?(0,L.jsxs)(`div`,{style:{display:`grid`,gap:0},children:[(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600},children:`Generated SQL`}),c.sql&&(0,L.jsx)(Sh,{value:c.sql})]}),c.sql?(0,L.jsx)(`pre`,{className:`sql-block`,children:c.sql}):(0,L.jsx)(hh,{text:`No SQL generated.`})]}),c.explain!==null&&c.explain!==void 0&&(0,L.jsx)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:(0,L.jsx)(Fh,{explain:c.explain})}),c.tenant?.enabled&&(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600,marginBottom:8},children:`Tenant Params`}),c.tenant.params.length>0?(0,L.jsxs)(`div`,{style:{padding:8,border:`1px solid var(--border)`,borderRadius:`var(--radius)`,fontSize:12},children:[(0,L.jsx)(`span`,{style:{fontWeight:600},children:`Positional params:`}),` `,(0,L.jsx)(`code`,{children:JSON.stringify(c.tenant.params)})]}):(0,L.jsx)(hh,{text:`No tenant params.`})]}),(0,L.jsxs)(`div`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderBottom:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,gap:8},children:[j&&(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,flexWrap:`wrap`},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11,fontWeight:600},children:j.label}),j.configured?(0,L.jsx)(`span`,{className:`chip`,style:{fontSize:11},children:j.connectionKind===`file`?`file configured`:`URL configured`}):(0,L.jsx)(`span`,{className:`chip red`,style:{fontSize:11},children:j.connectionKind===`file`?`no file`:`no URL`}),j.installed?(0,L.jsxs)(`span`,{className:`chip`,style:{fontSize:11},children:[j.packageName,` ready`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`chip red`,style:{fontSize:11},children:[j.packageName,` missing`]}),j.canInstallFromStudio&&(0,L.jsxs)(`button`,{className:`btn ghost sm`,disabled:ie.has(`install-driver`),onClick:()=>void se(),style:{fontSize:11},children:[ie.has(`install-driver`)?(0,L.jsx)(Ni,{size:12,className:`animate-spin`}):null,`Install `,j.packageName]}),!j.canInstallFromStudio&&j.manualInstallReason&&(0,L.jsx)(`span`,{className:`muted`,style:{fontSize:11},children:j.installCommand})]})]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,L.jsxs)(`button`,{className:`btn primary`,disabled:ie.has(`execute`)||!c.sql||j!==null&&(!j.configured||!j.installed),onClick:()=>void N(),children:[ie.has(`execute`)?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Li,{size:14}),`Execute Query`]}),ne&&(0,L.jsx)(km,{status:ne})]})]}),(0,L.jsx)(Eh,{}),A?.ok===!0&&(0,L.jsxs)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:8},children:[(0,L.jsx)(`h3`,{style:{fontSize:13,fontWeight:600},children:`Results`}),A.truncated&&(0,L.jsx)(`span`,{className:`chip amber`,children:`Showing first 500 rows`})]}),A.columns&&A.rows?(0,L.jsx)(`div`,{style:{overflowX:`auto`},children:(0,L.jsxs)(`table`,{className:`tbl`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsx)(`tr`,{children:A.columns.map(e=>(0,L.jsx)(`th`,{children:e},e))})}),(0,L.jsx)(`tbody`,{children:A.rows.map((e,t)=>(0,L.jsx)(`tr`,{children:e.map((e,t)=>(0,L.jsx)(`td`,{className:`mono`,style:{fontSize:11},children:e==null?(0,L.jsx)(`span`,{className:`muted`,children:`NULL`}):String(e)},t))},t))})]})}):(0,L.jsx)(hh,{text:`No results.`})]}),c.usage&&(0,L.jsx)(`section`,{style:{padding:`var(--pad-y) var(--pad-x)`,borderTop:`1px solid var(--border)`},children:(0,L.jsx)(yh,{title:`Token usage`,usage:c.usage})})]}):(0,L.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,padding:32},children:(0,L.jsx)(hh,{text:`Ask a question to generate SQL`})})})]})})]})}function Mh(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function Nh(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.statementKind==`string`&&Array.isArray(t.checksVerified)&&t.checksVerified.every(e=>typeof e==`string`)&&typeof t.remediationNote==`string`}function Ph(e){return e.replace(/_/g,` `)}function Fh({explain:e}){let[t,n]=(0,S.useState)(!1);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`collapsible-btn`,onClick:()=>n(!t),children:[t?(0,L.jsx)(yi,{size:14}):(0,L.jsx)(bi,{size:14}),`Explain`]}),t&&(Nh(e)?(0,L.jsxs)(`div`,{style:{display:`grid`,gap:8,fontSize:12},children:[(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontWeight:600},children:`Statement kind`}),(0,L.jsx)(`span`,{className:`chip`,children:e.statementKind})]}),(0,L.jsxs)(`div`,{style:{display:`grid`,gap:4},children:[(0,L.jsx)(`span`,{className:`muted`,style:{fontWeight:600},children:`Checks verified`}),(0,L.jsx)(`ul`,{style:{listStyle:`none`,margin:0,padding:0,display:`grid`,gap:4},children:e.checksVerified.map(e=>(0,L.jsxs)(`li`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,L.jsx)(vi,{size:13,style:{color:`var(--green-500)`,flexShrink:0}}),Ph(e)]},e))})]}),(0,L.jsx)(`p`,{className:`muted`,style:{margin:0,fontStyle:`italic`},children:e.remediationNote})]}):(0,L.jsx)(`pre`,{className:`plain-block`,children:Mh(e)}))]})}function Ih(){let{workspace:e}=Or(),{ragStatus:t}=Vr();return e?(0,L.jsxs)(`main`,{className:`main-pane`,children:[(0,L.jsx)(`div`,{className:`main-hd`,children:(0,L.jsxs)(`div`,{className:`main-title`,children:[(0,L.jsxs)(`h1`,{children:[(0,L.jsx)(Ui,{size:18,style:{display:`inline`,marginRight:8}}),`Settings`]}),(0,L.jsx)(`div`,{className:`main-sub`,children:`Workspace configuration and diagnostics`})]})}),(0,L.jsx)(`div`,{className:`main-body`,children:(0,L.jsxs)(`div`,{className:`stack`,style:{padding:`var(--pad-y) var(--pad-x)`},children:[(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Workspace`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsxs)(`dl`,{className:`definition-list`,children:[(0,L.jsx)(`dt`,{children:`Schema ID`}),(0,L.jsx)(`dd`,{children:e.schemaId}),(0,L.jsx)(`dt`,{children:`Schema path`}),(0,L.jsx)(`dd`,{children:e.schemaDir}),(0,L.jsx)(`dt`,{children:`AI provider`}),(0,L.jsx)(`dd`,{children:e.aiProvider}),(0,L.jsx)(`dt`,{children:`Model`}),(0,L.jsx)(`dd`,{children:e.model}),(0,L.jsx)(`dt`,{children:`AI suggestions`}),(0,L.jsx)(`dd`,{children:e.aiConfigured?`Configured`:`Not configured`})]})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`RAG Store`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:t?(0,L.jsxs)(`dl`,{className:`definition-list`,children:[(0,L.jsx)(`dt`,{children:`Store`}),(0,L.jsx)(`dd`,{children:t.store.kind}),(0,L.jsx)(`dt`,{children:`Lock file`}),(0,L.jsx)(`dd`,{children:t.files.lock?`present`:`missing`}),t.store.kind===`file`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Base path`}),(0,L.jsx)(`dd`,{children:t.store.basePath??`n/a`}),(0,L.jsx)(`dt`,{children:`Embeddings JSON`}),(0,L.jsx)(`dd`,{children:t.files.embeddingsJson?`present`:`missing`}),(0,L.jsx)(`dt`,{children:`Embeddings binary`}),(0,L.jsx)(`dd`,{children:t.files.embeddingsBin?`present`:`missing`})]}),t.store.kind===`pgvector`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Table`}),(0,L.jsx)(`dd`,{children:t.store.table??`askdb_rag_chunks`}),(0,L.jsx)(`dt`,{children:`Index strategy`}),(0,L.jsx)(`dd`,{children:t.store.indexStrategy??`default`})]}),t.store.kind===`memory`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{children:`Persistence`}),(0,L.jsx)(`dd`,{children:`In-process only`})]})]}):(0,L.jsx)(hh,{text:`RAG status is unavailable.`})})]}),(0,L.jsxs)(`section`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsx)(`h3`,{children:`Schema Warnings`})}),(0,L.jsx)(`div`,{className:`card-bd`,children:e.warnings.length>0?(0,L.jsx)(`div`,{style:{display:`grid`,gap:8},children:e.warnings.map((e,t)=>(0,L.jsx)(`pre`,{className:`warning-block`,children:typeof e==`string`?e:JSON.stringify(e,null,2)},t))}):(0,L.jsx)(hh,{text:`No schema warnings.`})})]})]})})]}):null}var Lh=`h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,Rh=[{value:`postgres`,label:`PostgreSQL`},{value:`mysql`,label:`MySQL`},{value:`sqlite`,label:`SQLite`},{value:`sqlserver`,label:`SQL Server`},{value:`prisma`,label:`Prisma schema file (no live database)`}],zh=[{value:`openai`,label:`OpenAI`,keyEnv:`OPENAI_API_KEY`},{value:`anthropic`,label:`Anthropic`,keyEnv:`ANTHROPIC_API_KEY`},{value:`google`,label:`Google`,keyEnv:`GOOGLE_GENERATIVE_AI_API_KEY`},{value:`azure`,label:`Azure OpenAI`,keyEnv:`AZURE_OPENAI_API_KEY`}],Bh={postgres:`DATABASE_URL`,mysql:`MYSQL_URL`,sqlserver:`SQLSERVER_URL`,sqlite:``,prisma:``};function Vh({status:e,onComplete:t}){let n=e.reason===`no-artifact`,[r,a]=(0,S.useState)(`postgres`),[o,s]=(0,S.useState)(`DATABASE_URL`),c=(0,S.useRef)(!1),[l,u]=(0,S.useState)(`./data.db`),[d,f]=(0,S.useState)(``),[p,m]=(0,S.useState)(`openai`),[h,g]=(0,S.useState)(`OPENAI_API_KEY`),_=(0,S.useRef)(!1),[v,y]=(0,S.useState)(`./askdb`),[b,x]=(0,S.useState)(null),[C,w]=(0,S.useState)(null),[T,E]=(0,S.useState)(null),D=r===`postgres`||r===`mysql`||r===`sqlserver`,ee=n||b!==null,O=(0,S.useMemo)(()=>b?b.envVars:D?[{name:o,purpose:`${r} connection URL`,requiredForIntrospection:!0},{name:h,purpose:`${p} API key`,requiredForIntrospection:!1}]:[{name:h,purpose:`${p} API key`,requiredForIntrospection:!1}],[b,D,o,r,h,p]),te=O.map(e=>`${e.name}=`).join(`
|
|
106
|
+
`),k=(0,S.useCallback)(e=>{a(e),c.current||s(Bh[e]||`DATABASE_URL`)},[]),A=(0,S.useCallback)(e=>{m(e),_.current||g(zh.find(t=>t.value===e)?.keyEnv??`OPENAI_API_KEY`)},[]),ne=(0,S.useCallback)(async()=>{w(`config`),E(null);try{x(await vr({database:r,aiProvider:p,...D&&o?{connectionEnv:o}:{},...r===`sqlite`&&l?{sqliteFile:l}:{},...r===`prisma`&&d?{prismaSchema:d}:{},...h?{aiKeyEnv:h}:{},...v?{schemaOut:v}:{}}))}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(null)}},[r,p,D,o,l,d,h,v]),j=(0,S.useCallback)(async()=>{w(`introspect`),E(null);try{await yr(),t()}catch(e){E(e instanceof Error?e.message:String(e))}finally{w(null)}},[t]);return(0,L.jsx)(`div`,{className:`app-shell`,style:{display:`flex`,alignItems:`flex-start`,justifyContent:`center`,overflow:`auto`,padding:`48px 16px`},children:(0,L.jsxs)(`div`,{style:{width:`100%`,maxWidth:640,display:`grid`,gap:16},children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`h1`,{style:{fontSize:20,fontWeight:700,display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(Yi,{size:18}),` Set up AskDB`]}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:13,marginTop:6,lineHeight:1.6},children:n?(0,L.jsxs)(L.Fragment,{children:[`Config found at `,(0,L.jsx)(`code`,{className:`mono`,children:e.configPath}),`, but no schema artifact yet. Run introspection to create it.`]}):(0,L.jsxs)(L.Fragment,{children:[`No `,(0,L.jsx)(`code`,{className:`mono`,children:`askdb.config.ts`}),` found in `,(0,L.jsx)(`code`,{className:`mono`,children:e.projectDir}),`. Answer two questions and Studio writes it for you — your secrets stay in `,(0,L.jsx)(`code`,{className:`mono`,children:`.env`}),`, on your machine.`]})})]}),!n&&(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsxs)(`div`,{className:`card-hd`,children:[(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Ei,{size:14}),` 1 · Database & model provider`]}),b&&(0,L.jsxs)(`span`,{className:`chip green`,children:[(0,L.jsx)(vi,{size:11}),` config written`]})]}),(0,L.jsxs)(`div`,{className:`card-bd`,style:{display:`grid`,gap:12},children:[(0,L.jsx)($,{label:`Database engine`,children:(0,L.jsx)(`select`,{className:Lh,value:r,disabled:!!b,onChange:e=>k(e.target.value),children:Rh.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})}),D&&(0,L.jsx)($,{label:`Connection URL env var name`,description:`The NAME of the environment variable — the actual URL goes in .env, never here.`,children:(0,L.jsx)(Bp,{value:o,disabled:!!b,onChange:e=>{s(e.target.value.toUpperCase()),c.current=!0}})}),r===`sqlite`&&(0,L.jsx)($,{label:`SQLite file path`,description:`Relative to the project root.`,children:(0,L.jsx)(Bp,{value:l,disabled:!!b,onChange:e=>u(e.target.value)})}),r===`prisma`&&(0,L.jsx)($,{label:`Prisma schema path`,description:`Leave empty to auto-discover prisma/schema.prisma.`,children:(0,L.jsx)(Bp,{value:d,disabled:!!b,onChange:e=>f(e.target.value),placeholder:`./prisma/schema.prisma`})}),(0,L.jsx)($,{label:`AI provider`,children:(0,L.jsx)(`select`,{className:Lh,value:p,disabled:!!b,onChange:e=>A(e.target.value),children:zh.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})}),(0,L.jsx)($,{label:`API key env var name`,description:`The NAME of the environment variable holding your model API key.`,children:(0,L.jsx)(Bp,{value:h,disabled:!!b,onChange:e=>{g(e.target.value.toUpperCase()),_.current=!0}})}),(0,L.jsx)($,{label:`Schema artifact directory`,description:`Where introspection writes the schema artifact.`,children:(0,L.jsx)(Bp,{value:v,disabled:!!b,onChange:e=>y(e.target.value)})}),!b&&(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:C===`config`,onClick:()=>void ne(),children:[C===`config`?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(vi,{size:14}),`Write askdb.config.ts`]})}),b&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6},children:[(0,L.jsxs)(`p`,{className:`muted`,style:{fontSize:12.5},children:[`Wrote `,(0,L.jsx)(`code`,{className:`mono`,children:b.configPath}),b.envExamplePath?(0,L.jsxs)(L.Fragment,{children:[` and `,(0,L.jsx)(`code`,{className:`mono`,children:b.envExamplePath})]}):null,b.packageJsonCreated?(0,L.jsxs)(L.Fragment,{children:[` (plus a minimal `,(0,L.jsx)(`code`,{className:`mono`,children:`package.json`}),`)`]}):null,`.`]}),b.installed&&b.installed.length>0&&(0,L.jsxs)(`p`,{className:`muted`,style:{fontSize:12.5},children:[`Installed into your project: `,(0,L.jsx)(`code`,{className:`mono`,children:b.installed.join(` `)}),`.`]}),b.manualInstallCommand&&(0,L.jsxs)(`div`,{style:{display:`grid`,gap:6,border:`1px solid var(--amber-500)`,borderRadius:6,padding:10},children:[(0,L.jsx)(`span`,{style:{fontSize:12.5,fontWeight:600},children:`One manual step: install the dependencies`}),(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:12},children:`The wizard couldn't install packages automatically. Run this in your project, then continue below:`}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,L.jsx)(`code`,{className:`mono`,style:{flex:1,fontSize:12,border:`1px solid var(--border)`,borderRadius:6,padding:`6px 8px`,background:`var(--surface-2)`},children:b.manualInstallCommand}),(0,L.jsx)(Sh,{value:b.manualInstallCommand})]})]})]})]})]}),ee&&(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Oi,{size:14}),` `,n?`1`:`2`,` · Add your secrets to .env`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,style:{display:`grid`,gap:10},children:[(0,L.jsxs)(`p`,{className:`muted`,style:{fontSize:12.5,lineHeight:1.6},children:[`Create a `,(0,L.jsx)(`code`,{className:`mono`,children:`.env`}),` file next to `,(0,L.jsx)(`code`,{className:`mono`,children:`askdb.config.ts`}),` and fill in the values. Studio never asks for secret values — they stay on disk, outside this UI.`]}),(0,L.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8},children:[(0,L.jsx)(`pre`,{className:`mono`,style:{flex:1,margin:0,border:`1px solid var(--border)`,borderRadius:6,padding:10,fontSize:12,background:`var(--surface-2)`},children:O.map(e=>`${e.name}= # ${e.purpose}`).join(`
|
|
107
|
+
`)}),(0,L.jsx)(Sh,{value:te})]})]})]}),ee&&(0,L.jsxs)(`div`,{className:`card`,children:[(0,L.jsx)(`div`,{className:`card-hd`,children:(0,L.jsxs)(`h3`,{children:[(0,L.jsx)(Gi,{size:14}),` `,n?`2`:`3`,` · Introspect your database`]})}),(0,L.jsxs)(`div`,{className:`card-bd`,style:{display:`grid`,gap:10},children:[(0,L.jsx)(`p`,{className:`muted`,style:{fontSize:12.5,lineHeight:1.6},children:`Reads your schema structure (tables, columns, relationships — never rows) and writes the schema artifact. When it finishes, Studio opens on the Overview.`}),(0,L.jsx)(`div`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:C===`introspect`,onClick:()=>void j(),children:[C===`introspect`?(0,L.jsx)(Ni,{size:14,className:`animate-spin`}):(0,L.jsx)(Ei,{size:14}),`Run introspection`]})})]})]}),T&&(0,L.jsx)(`div`,{className:`card`,style:{borderColor:`var(--red-600)`},children:(0,L.jsx)(`div`,{className:`card-bd`,children:(0,L.jsx)(`p`,{style:{color:`var(--red-600)`,fontSize:12.5,whiteSpace:`pre-wrap`},children:T})})}),(0,L.jsxs)(`p`,{className:`muted tiny`,style:{lineHeight:1.6},children:[`Prefer the terminal? `,(0,L.jsx)(`code`,{className:`mono`,children:`npx askdb init`}),` runs the same setup as a CLI wizard.`]})]})})}function Hh(){return(0,L.jsx)($n,{children:(0,L.jsx)(jr,{children:(0,L.jsx)(Wr,{children:(0,L.jsx)(Uh,{})})})})}function Uh(){let{load:e,loadState:t,setupStatus:n,suggestionDialog:r,setSuggestionDialog:a,applySuggestion:o}=Or(),{refreshRagStatus:s,ragAvailable:c}=Vr();return(0,S.useEffect)(()=>{e().then(()=>void s())},[e,s]),t.kind===`setup`&&n?(0,L.jsx)(Vh,{status:n,onComplete:()=>void e().then(()=>void s())}):t.kind===`loading`?(0,L.jsx)(`div`,{className:`app-shell`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsx)(`p`,{style:{color:`var(--ink-400)`,fontSize:13},children:`Loading workspace…`})}):t.kind===`error`?(0,L.jsx)(`div`,{className:`app-shell`,style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,L.jsx)(`p`,{style:{color:`var(--red-600)`,fontWeight:600,marginBottom:8},children:`Failed to load workspace`}),(0,L.jsx)(`p`,{style:{color:`var(--ink-400)`,fontSize:13},children:t.message})]})}):(0,L.jsxs)(Yr,{ragAvailable:c,children:[(0,L.jsxs)(sm,{defaultOpen:!0,className:`!min-h-0 h-svh`,style:{"--sidebar-width":`var(--nav-w)`},children:[(0,L.jsx)(Em,{}),(0,L.jsxs)(um,{className:`min-h-0 overflow-hidden`,children:[(0,L.jsxs)(`header`,{className:`topbar`,children:[(0,L.jsx)(lm,{className:`-ml-1`}),(0,L.jsx)(Vp,{orientation:`vertical`,className:`mr-2 !h-4`}),(0,L.jsx)(Sm,{})]}),(0,L.jsx)(`div`,{className:`app-content`,children:(0,L.jsxs)(Rt,{children:[(0,L.jsx)(It,{path:`/`,element:(0,L.jsx)(Pt,{to:`/overview`,replace:!0})}),(0,L.jsx)(It,{path:`/overview`,element:(0,L.jsx)(Am,{})}),(0,L.jsx)(It,{path:`/tables`,element:(0,L.jsx)(Fm,{}),children:(0,L.jsxs)(It,{path:`:schema/:name`,element:(0,L.jsx)(Im,{}),children:[(0,L.jsx)(It,{index:!0,element:(0,L.jsx)(Pt,{to:`enrichment`,replace:!0})}),(0,L.jsx)(It,{path:`enrichment`,element:(0,L.jsx)(Hm,{})}),(0,L.jsx)(It,{path:`schema`,element:(0,L.jsx)(Gm,{})}),(0,L.jsx)(It,{path:`sensitivity`,element:(0,L.jsx)(Km,{})})]})}),(0,L.jsx)(It,{path:`/concepts`,element:(0,L.jsx)(Zm,{})}),(0,L.jsx)(It,{path:`/tenancy`,element:(0,L.jsx)(rh,{})}),(0,L.jsx)(It,{path:`/rag-index`,element:(0,L.jsx)(bh,{})}),(0,L.jsx)(It,{path:`/playground`,element:(0,L.jsx)(jh,{})}),(0,L.jsx)(It,{path:`/settings`,element:(0,L.jsx)(Ih,{})})]})})]})]}),r&&(0,L.jsx)(Dm,{dialog:r,onApply:o,onClose:()=>a(null)})]})}var Wh=document.getElementById(`root`);if(!Wh)throw Error(`Missing #root element.`);(0,Yn.createRoot)(Wh).render((0,L.jsx)(S.StrictMode,{children:(0,L.jsx)(En,{children:(0,L.jsx)(Hh,{})})}));
|