db-studio 1.1.0 → 1.1.5
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/core-dist/assets/_pathlessLayout-CpbrY7V1.js +7 -0
- package/dist/core-dist/assets/_queryId-Xb9OS7yO.js +1 -0
- package/dist/core-dist/assets/_table-CSCgsoDG.js +1 -0
- package/dist/core-dist/assets/cssMode-BvMXTcXH.js +1 -0
- package/dist/core-dist/assets/database.store-CtH7ADQ_.js +1 -0
- package/dist/core-dist/assets/{format-cell-value-CAPxCDrP.js → format-cell-value-Bcvj8RHO.js} +1 -1
- package/dist/core-dist/assets/{freemarker2-Cafaq6r-.js → freemarker2-CGqefnrm.js} +1 -1
- package/dist/core-dist/assets/handlebars-1qbmYBQG.js +1 -0
- package/dist/core-dist/assets/html-BAw772MI.js +1 -0
- package/dist/core-dist/assets/htmlMode-BNoG29IX.js +1 -0
- package/dist/core-dist/assets/{index-BJrfmP_S.css → index-BOaVrscn.css} +1 -1
- package/dist/core-dist/assets/{index-p_4LwMzZ.js → index-BqkvVbPL.js} +4 -4
- package/dist/core-dist/assets/{index-CPbwuhIf.js → index-CAk30CHn.js} +1 -1
- package/dist/core-dist/assets/index-Cjq5waSp.js +1 -0
- package/dist/core-dist/assets/{index-BnD_1q9P.js → index-DGuutxCX.js} +1 -1
- package/dist/core-dist/assets/{indexes-B6Ry1bI7.js → indexes-DKA81cG4.js} +1 -1
- package/dist/core-dist/assets/javascript-Bvd1UM8_.js +1 -0
- package/dist/core-dist/assets/{jsonMode-DwJFMbR8.js → jsonMode-CpGAcoKE.js} +1 -1
- package/dist/core-dist/assets/liquid-CGc9X4rq.js +1 -0
- package/dist/core-dist/assets/{logs-XEJKq_bD.js → logs-Dx6Qz3_B.js} +1 -1
- package/dist/core-dist/assets/{lspLanguageFeatures-CMProg3t.js → lspLanguageFeatures-DvlbDjuL.js} +1 -1
- package/dist/core-dist/assets/mdx-BlMW5Rxv.js +1 -0
- package/dist/core-dist/assets/python-BvuNYVPc.js +1 -0
- package/dist/core-dist/assets/{queries.store-d0aQcGZF.js → queries.store-FtsSrFD5.js} +1 -1
- package/dist/core-dist/assets/razor-C9dSyokN.js +1 -0
- package/dist/core-dist/assets/{runner-tab-BJGSkPa0.js → runner-tab-tkrQ9l47.js} +125 -125
- package/dist/core-dist/assets/{schema-CMK4AwY7.js → schema-DlzKDtjb.js} +1 -1
- package/dist/core-dist/assets/sheet-CjoilrT4.js +45 -0
- package/dist/core-dist/assets/{tsMode-CMQrGK-g.js → tsMode-DyAlIEsi.js} +1 -1
- package/dist/core-dist/assets/typescript-_ZO1EYql.js +1 -0
- package/dist/core-dist/assets/{visualizer-Cg1KEBYL.js → visualizer-Cv-Cks3p.js} +1 -1
- package/dist/core-dist/assets/xml-CCkoEvjM.js +1 -0
- package/dist/core-dist/assets/yaml-DritA0Og.js +1 -0
- package/dist/core-dist/index.html +2 -2
- package/dist/index.js +43 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/core-dist/assets/_pathlessLayout-DnFGHUdf.js +0 -7
- package/dist/core-dist/assets/_queryId-39qJDD28.js +0 -1
- package/dist/core-dist/assets/_table-BOi0lbVm.js +0 -1
- package/dist/core-dist/assets/cssMode-Dn_jaf5O.js +0 -1
- package/dist/core-dist/assets/handlebars-CITJ-W0i.js +0 -1
- package/dist/core-dist/assets/html-DVJRkD7a.js +0 -1
- package/dist/core-dist/assets/htmlMode-smiaIuqm.js +0 -1
- package/dist/core-dist/assets/index-BajHmqdE.js +0 -1
- package/dist/core-dist/assets/javascript-CDJKxGGn.js +0 -1
- package/dist/core-dist/assets/liquid-DpEcCOwm.js +0 -1
- package/dist/core-dist/assets/mdx-C8h6BCrd.js +0 -1
- package/dist/core-dist/assets/python-BQLXtyv4.js +0 -1
- package/dist/core-dist/assets/razor-DSk2yRor.js +0 -1
- package/dist/core-dist/assets/sheet-B-M9hmOy.js +0 -45
- package/dist/core-dist/assets/spinner-CaXFGkug.js +0 -1
- package/dist/core-dist/assets/typescript-D0dUAwub.js +0 -1
- package/dist/core-dist/assets/xml-DWUEh0YG.js +0 -1
- package/dist/core-dist/assets/yaml-DwwHu29W.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{u as ht,c as N,j as e,r as o,L as be,a as V,b as U,d as je,t as T,O as pt}from"./index-BqkvVbPL.js";import{u as Ce,c as ye,a as F,b as gt,P as Ne,T as vt,B as C,d as f,e as ee,f as te,g as ae,L as bt,h as ce,i as K,C as A,j as we,A as W,S as jt}from"./database.store-CtH7ADQ_.js";import{c as Se,R as Ct,W as yt,C as Nt,T as wt,D as St,a as _e,P as _t,O as At,b as Dt,d as Ae,e as Mt,A as Rt,f as Et,g as kt,I as Tt,S as zt,G as It,L as Pt,h as Ot,i as Ft,j as Lt,k as $t,l as Qt,m as qt,n as Bt,K as $,o as De,p as se,q as ne,r as re,s as oe,t as le,u as Q,v as ie,w as Me,x as Re,y as Ee,z as ke,B as G,E as X,F as Ht,H as Gt,J as Vt,M as Ut,N as Kt,Q as Wt,U as Xt}from"./sheet-CjoilrT4.js";import{u as Y}from"./queries.store-FtsSrFD5.js";function Te(t){return ht({select:a=>a.location})}const Yt=[["path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5",key:"svg-0"}]],Zt=N("outline","brand-github","BrandGithub",Yt);const Jt=[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],ea=N("outline","copy","Copy",Jt);const ta=[["path",{d:"M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]],ze=N("outline","folder-plus","FolderPlus",ta);const aa=[["path",{d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2",key:"svg-0"}]],sa=N("outline","folder","Folder",aa);const na=[["path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M9 4l0 16",key:"svg-1"}]],ra=N("outline","layout-sidebar","LayoutSidebar",na);const oa=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],Ie=N("outline","pencil","Pencil",oa);const la=[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]],ia=N("outline","pin","Pin",la);const ca=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],de=N("outline","plus","Plus",ca);const da=[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]],Pe=N("outline","search","Search",da);const ua=[["path",{d:"M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2zm0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2zm-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6z",key:"svg-0"}]],xa=N("outline","sparkles","Sparkles",ua);const ma=[["path",{d:"M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z",key:"svg-0"}]],fa=N("outline","star","Star",ma);const ha=[["path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1",key:"svg-0"}]],pa=N("filled","layout-sidebar-filled","LayoutSidebarFilled",ha);const ga=[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",key:"svg-0"}]],va=N("filled","pin-filled","PinFilled",ga);const ba=[["path",{d:"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z",key:"svg-0"}]],ja=N("filled","star-filled","StarFilled",ba);var Ca=Symbol("radix.slottable");function ya(t){const a=({children:n})=>e.jsx(e.Fragment,{children:n});return a.displayName=`${t}.Slottable`,a.__radixId=Ca,a}var Oe="AlertDialog",[Na]=ye(Oe,[Se]),M=Se(),Fe=t=>{const{__scopeAlertDialog:a,...n}=t,s=M(a);return e.jsx(Ct,{...s,...n,modal:!0})};Fe.displayName=Oe;var wa="AlertDialogTrigger",Sa=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,r=M(n);return e.jsx(Dt,{...r,...s,ref:a})});Sa.displayName=wa;var _a="AlertDialogPortal",Le=t=>{const{__scopeAlertDialog:a,...n}=t,s=M(a);return e.jsx(_t,{...s,...n})};Le.displayName=_a;var Aa="AlertDialogOverlay",$e=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,r=M(n);return e.jsx(At,{...r,...s,ref:a})});$e.displayName=Aa;var L="AlertDialogContent",[Da,Ma]=Na(L),Ra=ya("AlertDialogContent"),Qe=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,children:s,...r}=t,l=M(n),i=o.useRef(null),u=Ce(a,i),p=o.useRef(null);return e.jsx(yt,{contentName:L,titleName:qe,docsSlug:"alert-dialog",children:e.jsx(Da,{scope:n,cancelRef:p,children:e.jsxs(Nt,{role:"alertdialog",...l,...r,ref:u,onOpenAutoFocus:F(r.onOpenAutoFocus,c=>{c.preventDefault(),p.current?.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[e.jsx(Ra,{children:s}),e.jsx(ka,{contentRef:i})]})})})});Qe.displayName=L;var qe="AlertDialogTitle",Be=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,r=M(n);return e.jsx(wt,{...r,...s,ref:a})});Be.displayName=qe;var He="AlertDialogDescription",Ge=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,r=M(n);return e.jsx(St,{...r,...s,ref:a})});Ge.displayName=He;var Ea="AlertDialogAction",Ve=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,r=M(n);return e.jsx(_e,{...r,...s,ref:a})});Ve.displayName=Ea;var Ue="AlertDialogCancel",Ke=o.forwardRef((t,a)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:r}=Ma(Ue,n),l=M(n),i=Ce(a,r);return e.jsx(_e,{...l,...s,ref:i})});Ke.displayName=Ue;var ka=({contentRef:t})=>{const a=`\`${L}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
You can add a description to the \`${L}\` by passing a \`${He}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
+
|
|
5
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${L}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
|
+
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return o.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(a)},[a,t]),null},Ta=Fe,za=Le,Ia=$e,Pa=Qe,Oa=Ve,Fa=Ke,La=Be,$a=Ge,ue="ContextMenu",[Qa]=ye(ue,[Ae]),y=Ae(),[qa,We]=Qa(ue),Xe=t=>{const{__scopeContextMenu:a,children:n,onOpenChange:s,dir:r,modal:l=!0}=t,[i,u]=o.useState(!1),p=y(a),c=gt(s),m=o.useCallback(j=>{u(j),c(j)},[c]);return e.jsx(qa,{scope:a,open:i,onOpenChange:m,modal:l,children:e.jsx(Mt,{...p,dir:r,open:i,onOpenChange:m,modal:l,children:n})})};Xe.displayName=ue;var Ye="ContextMenuTrigger",Ze=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,disabled:s=!1,...r}=t,l=We(Ye,n),i=y(n),u=o.useRef({x:0,y:0}),p=o.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...u.current})}),c=o.useRef(0),m=o.useCallback(()=>window.clearTimeout(c.current),[]),j=g=>{u.current={x:g.clientX,y:g.clientY},l.onOpenChange(!0)};return o.useEffect(()=>m,[m]),o.useEffect(()=>void(s&&m()),[s,m]),e.jsxs(e.Fragment,{children:[e.jsx(Rt,{...i,virtualRef:p}),e.jsx(Ne.span,{"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,...r,ref:a,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:s?t.onContextMenu:F(t.onContextMenu,g=>{m(),j(g),g.preventDefault()}),onPointerDown:s?t.onPointerDown:F(t.onPointerDown,B(g=>{m(),c.current=window.setTimeout(()=>j(g),700)})),onPointerMove:s?t.onPointerMove:F(t.onPointerMove,B(m)),onPointerCancel:s?t.onPointerCancel:F(t.onPointerCancel,B(m)),onPointerUp:s?t.onPointerUp:F(t.onPointerUp,B(m))})]})});Ze.displayName=Ye;var Ba="ContextMenuPortal",Je=t=>{const{__scopeContextMenu:a,...n}=t,s=y(a);return e.jsx(Et,{...s,...n})};Je.displayName=Ba;var et="ContextMenuContent",tt=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=We(et,n),l=y(n),i=o.useRef(!1);return e.jsx(kt,{...l,...s,ref:a,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:u=>{t.onCloseAutoFocus?.(u),!u.defaultPrevented&&i.current&&u.preventDefault(),i.current=!1},onInteractOutside:u=>{t.onInteractOutside?.(u),!u.defaultPrevented&&!r.modal&&(i.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tt.displayName=et;var Ha="ContextMenuGroup",Ga=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(It,{...r,...s,ref:a})});Ga.displayName=Ha;var Va="ContextMenuLabel",Ua=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Pt,{...r,...s,ref:a})});Ua.displayName=Va;var Ka="ContextMenuItem",at=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Tt,{...r,...s,ref:a})});at.displayName=Ka;var Wa="ContextMenuCheckboxItem",Xa=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Ot,{...r,...s,ref:a})});Xa.displayName=Wa;var Ya="ContextMenuRadioGroup",Za=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Ft,{...r,...s,ref:a})});Za.displayName=Ya;var Ja="ContextMenuRadioItem",es=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Lt,{...r,...s,ref:a})});es.displayName=Ja;var ts="ContextMenuItemIndicator",as=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx($t,{...r,...s,ref:a})});as.displayName=ts;var ss="ContextMenuSeparator",st=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(zt,{...r,...s,ref:a})});st.displayName=ss;var ns="ContextMenuArrow",rs=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Qt,{...r,...s,ref:a})});rs.displayName=ns;var os="ContextMenuSubTrigger",ls=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(qt,{...r,...s,ref:a})});ls.displayName=os;var is="ContextMenuSubContent",cs=o.forwardRef((t,a)=>{const{__scopeContextMenu:n,...s}=t,r=y(n);return e.jsx(Bt,{...r,...s,ref:a,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cs.displayName=is;function B(t){return a=>a.pointerType!=="mouse"?t(a):void 0}var ds=Xe,us=Ze,xs=Je,ms=tt,fs=at,hs=st,ps="Separator",he="horizontal",gs=["horizontal","vertical"],nt=o.forwardRef((t,a)=>{const{decorative:n,orientation:s=he,...r}=t,l=vs(s)?s:he,u=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return e.jsx(Ne.div,{"data-orientation":l,...u,...r,ref:a})});nt.displayName=ps;function vs(t){return gs.includes(t)}var bs=nt;const js=()=>{const{pathname:t}=Te(),a=t.split("/")[1]||"table";return e.jsx("div",{className:"flex h-full items-center",children:vt.map(n=>e.jsx(be,{to:`/${n}`,className:"h-full flex items-center",children:e.jsx(C,{variant:"ghost",className:f("flex-1 px-4 border-l-0 border-y-0 border-r border-zinc-800 h-full rounded-none",a===n?"bg-zinc-900 text-white":"text-zinc-400"),children:n})},n))})},Cs=()=>{const{sidebar:{isOpen:t,isPinned:a},setSidebarOpen:n,setSidebarPinned:s}=V(),r=()=>{n(!t),s(!a)};return e.jsx(C,{variant:"ghost",onClick:r,className:"h-full aspect-square border-l-0 border-y-0 border-r border-zinc-800 rounded-none",children:t?e.jsx(pa,{className:"size-5"}):e.jsx(ra,{className:"size-5"})})},ys=()=>e.jsxs("div",{className:"border-b border-zinc-800 w-full flex items-center justify-between bg-black h-12",children:[e.jsxs("div",{className:"flex items-center h-full",children:[e.jsx(Cs,{}),e.jsx(js,{})]}),e.jsxs("div",{className:"flex items-center h-full",children:[e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsx(C,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-zinc-800 rounded-none h-full w-12",children:e.jsx(xa,{className:"size-5"})})}),e.jsx(ae,{children:e.jsx("p",{children:"AI Assistant (Coming soon)"})})]}),e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsx(C,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-zinc-800 rounded-none h-full w-12",asChild:!0,children:e.jsx("a",{href:bt.GITHUB,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Zt,{className:"size-5"})})})}),e.jsx(ae,{children:e.jsx("p",{children:"View on GitHub"})})]})]})]});const Ns=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ws=ce("chevron-down",Ns);const Ss=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pe=ce("chevron-right",Ss);const _s=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],As=ce("database",_s);function Ds({...t}){return e.jsx(Ta,{"data-slot":"alert-dialog",...t})}function Ms({...t}){return e.jsx(za,{"data-slot":"alert-dialog-portal",...t})}function Rs({className:t,...a}){return e.jsx(Ia,{"data-slot":"alert-dialog-overlay",className:f("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...a})}function Es({className:t,size:a="default",...n}){return e.jsxs(Ms,{children:[e.jsx(Rs,{}),e.jsx(Pa,{"data-slot":"alert-dialog-content","data-size":a,className:f("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",t),...n})]})}function ks({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:f("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...a})}function Ts({className:t,...a}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:f("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...a})}function zs({className:t,...a}){return e.jsx(La,{"data-slot":"alert-dialog-title",className:f("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...a})}function Is({className:t,...a}){return e.jsx($a,{"data-slot":"alert-dialog-description",className:f("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...a})}function Ps({className:t,variant:a="default",size:n="default",...s}){return e.jsx(C,{variant:a,size:n,asChild:!0,children:e.jsx(Oa,{"data-slot":"alert-dialog-action",className:f(t),...s})})}function Os({className:t,variant:a="outline",size:n="default",...s}){return e.jsx(C,{variant:a,size:n,asChild:!0,children:e.jsx(Fa,{"data-slot":"alert-dialog-cancel",className:f(t),...s})})}function rt({...t}){return e.jsx(ds,{"data-slot":"context-menu",...t})}function ot({className:t,...a}){return e.jsx(us,{"data-slot":"context-menu-trigger",className:f("select-none",t),...a})}function lt({className:t,...a}){return e.jsx(xs,{children:e.jsx(ms,{"data-slot":"context-menu-content",className:f("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open: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 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto",t),...a})})}function E({className:t,inset:a,variant:n="default",...s}){return e.jsx(fs,{"data-slot":"context-menu-item","data-inset":a,"data-variant":n,className:f("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...s})}function ge({className:t,...a}){return e.jsx(hs,{"data-slot":"context-menu-separator",className:f("bg-border/50 -mx-1 my-1 h-px",t),...a})}const J=({folderId:t,isExpanded:a,onToggle:n,count:s,name:r,showContextMenu:l=!1})=>{const i=U(),{deleteFolder:u,getQueriesByFolder:p,addQuery:c,updateFolder:m}=Y(),[j,g]=o.useState(!1),[b,d]=o.useState(""),[v,S]=o.useState(!1),D=o.useCallback(()=>{if(t){if(p(t).length>0){S(!0);return}u(t)}},[u,t,p]),x=o.useCallback(()=>{t&&(u(t),S(!1))},[u,t]),w=o.useCallback(()=>{const _=c(void 0,t);i({to:"/runner/$queryId",params:{queryId:_}})},[c,t,i]),R=o.useCallback(()=>{d(r),g(!0)},[r]),q=o.useCallback(()=>{t&&b.trim()&&(m(t,{name:b.trim()}),g(!1),d(""))},[t,b,m]);return e.jsxs(e.Fragment,{children:[l?e.jsxs(rt,{children:[e.jsx(ot,{asChild:!0,children:e.jsxs("button",{type:"button",onClick:n,className:f("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-zinc-800/50 hover:text-zinc-100 focus:outline-none focus:bg-zinc-800/50","text-zinc-400 items-center"),children:[e.jsx(pe,{className:f("size-4 transition-transform duration-200",a?"rotate-90":"")}),e.jsx("span",{className:"flex-1",children:r}),e.jsx($,{children:s})]})}),e.jsxs(lt,{children:[e.jsxs(E,{onClick:w,children:[e.jsx(de,{className:"size-4"}),"Add a new query"]}),e.jsxs(E,{onClick:R,children:[e.jsx(Ie,{className:"size-4"}),"Rename folder"]}),e.jsxs(E,{onClick:D,children:[e.jsx(De,{className:"size-4"}),"Delete folder"]})]})]}):e.jsxs("button",{type:"button",onClick:n,className:f("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-zinc-800/50 hover:text-zinc-100 focus:outline-none focus:bg-zinc-800/50","text-zinc-400 items-center"),children:[e.jsx(pe,{className:f("size-4 transition-transform duration-200",a?"rotate-90":"")}),e.jsx("span",{className:"flex-1",children:r}),e.jsx($,{children:s})]}),e.jsx(se,{open:j,onOpenChange:g,children:e.jsxs(ne,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:"Rename Folder"}),e.jsx(le,{children:"Enter a new name for this folder."})]}),e.jsx(Q,{value:b,onChange:_=>d(_.target.value),placeholder:"Folder name",onKeyDown:_=>{_.key==="Enter"&&q()},autoFocus:!0}),e.jsxs(ie,{children:[e.jsx(C,{variant:"outline",onClick:()=>{g(!1),d("")},children:"Cancel"}),e.jsx(C,{onClick:q,disabled:!b.trim(),children:"Rename"})]})]})}),e.jsx(Ds,{open:v,onOpenChange:S,children:e.jsxs(Es,{children:[e.jsxs(ks,{children:[e.jsx(zs,{children:"Delete Folder"}),e.jsxs(Is,{children:["This folder contains ",s," ",s===1?"query":"queries",". Deleting this folder will also delete all queries inside it. This action cannot be undone."]})]}),e.jsxs(Ts,{children:[e.jsx(Os,{children:"Cancel"}),e.jsx(Ps,{onClick:x,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Folder"})]})]})})]})},H=({id:t,tableName:a,isNested:n=!1,showContextMenu:s=!0})=>{const r=U(),{deleteQuery:l,addQuery:i,getQuery:u,toggleFavorite:p,updateQuery:c,moveQuery:m,folders:j,addFolder:g}=Y(),{queryId:b}=je({strict:!1}),d=b===t,v=u(t),S=v?.isFavorite??!1,[D,x]=o.useState(!1),[w,R]=o.useState(""),[q,_]=o.useState(!1),[Z,z]=o.useState(void 0),[I,k]=o.useState(!1),[P,O]=o.useState(""),xe=o.useCallback(()=>{r({to:"/runner/$queryId",params:{queryId:t}})},[r,t]),it=o.useCallback(()=>{l(t),b===t&&r({to:"/runner"}),T.success("Query deleted successfully")},[l,t,r,b]),ct=o.useCallback(()=>{const h=u(t),ft=i(`${h?.name} (Copy)`);r({to:"/runner/$queryId",params:{queryId:ft}}),T.success("Query duplicated successfully")},[i,u,r,t]),dt=o.useCallback(()=>{p(t),T.success("Query favorited successfully")},[p,t]),ut=o.useCallback(()=>{R(v?.name??""),x(!0)},[v?.name]),me=o.useCallback(()=>{w.trim()&&(c(t,{name:w.trim()}),x(!1),R(""),T.success("Query renamed successfully"))},[t,w,c]),xt=o.useCallback(()=>{z(v?.folderId),k(!1),O(""),_(!0)},[v?.folderId]),mt=o.useCallback(h=>{h==="__create_new__"?(k(!0),z(void 0)):(k(!1),z(h==="__none__"?void 0:h))},[]),fe=o.useCallback(()=>{if(I&&P.trim()){const h=Math.random().toString(36).substring(2,15);g({id:h,name:P.trim(),isExpanded:!0,isFavorite:!1}),m(t,h),T.success("Query moved to new folder successfully")}else I||(m(t,Z),T.success("Query moved to selected folder successfully"));_(!1),k(!1),O(""),z(void 0)},[I,P,Z,t,g,m]);return e.jsxs("li",{className:"relative",children:[s?e.jsxs(rt,{children:[e.jsx(ot,{asChild:!0,children:e.jsxs("button",{type:"button",onClick:xe,className:f("w-full flex gap-2 py-2 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",d?"text-zinc-100 bg-accent/10":"text-zinc-400",n?"px-4 pl-12":"px-4"),children:[d&&e.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),e.jsx("span",{className:"flex-1",children:a})]})}),e.jsxs(lt,{children:[e.jsxs(E,{onClick:ut,children:[e.jsx(Ie,{className:"size-4"}),"Rename query"]}),e.jsxs(E,{onClick:ct,children:[e.jsx(ea,{className:"size-4"}),"Duplicate query"]}),e.jsxs(E,{onClick:dt,children:[S?e.jsx(ja,{className:"size-4"}):e.jsx(fa,{className:"size-4"}),S?"Remove from favorites":"Add to favorites"]}),e.jsx(ge,{}),e.jsxs(E,{onClick:xt,children:[e.jsx(sa,{className:"size-4"}),"Move to folder"]}),e.jsx(ge,{}),e.jsxs(E,{onClick:it,children:[e.jsx(De,{className:"size-4"}),"Delete query"]})]})]}):e.jsxs("button",{type:"button",onClick:xe,className:f("w-full flex gap-2 py-2 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",d?"text-zinc-100 bg-accent/10":"text-zinc-400",n?"px-4 pl-12":"px-4"),children:[d&&e.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),e.jsx("span",{className:"flex-1",children:a})]}),e.jsx(se,{open:D,onOpenChange:x,children:e.jsxs(ne,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:"Rename Query"}),e.jsx(le,{children:"Enter a new name for this query."})]}),e.jsx(Q,{value:w,onChange:h=>R(h.target.value),placeholder:"Query name",onKeyDown:h=>{h.key==="Enter"&&me()},autoFocus:!0}),e.jsxs(ie,{children:[e.jsx(C,{variant:"outline",onClick:()=>{x(!1),R("")},children:"Cancel"}),e.jsx(C,{onClick:me,disabled:!w.trim(),children:"Rename"})]})]})}),e.jsx(se,{open:q,onOpenChange:h=>{_(h),h||(k(!1),O(""),z(void 0))},children:e.jsxs(ne,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:"Move to Folder"}),e.jsx(le,{children:"Select a folder to move this query to."})]}),e.jsx("div",{className:"space-y-4",children:I?e.jsx(Q,{value:P,onChange:h=>O(h.target.value),placeholder:"Folder name",onKeyDown:h=>{h.key==="Enter"&&P.trim()&&fe(),h.key==="Escape"&&(k(!1),O(""))},autoFocus:!0}):e.jsxs(Me,{value:Z??"__none__",onValueChange:mt,children:[e.jsx(Re,{className:"w-full",children:e.jsx(Ee,{placeholder:"Select a folder"})}),e.jsxs(ke,{children:[e.jsx(G,{value:"__none__",children:"No folder"}),j.map(h=>e.jsx(G,{value:h.id,children:h.name},h.id)),e.jsx(G,{value:"__create_new__",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{className:"size-4"}),"Create a new folder"]})})]})]})}),e.jsxs(ie,{children:[e.jsx(C,{variant:"outline",onClick:()=>{_(!1),k(!1),O(""),z(void 0)},children:"Cancel"}),e.jsx(C,{onClick:fe,disabled:I&&!P.trim(),children:I?"Create & Move":"Move"})]})]})})]})};function Fs({className:t,orientation:a="horizontal",decorative:n=!0,...s}){return e.jsx(bs,{"data-slot":"separator",decorative:n,orientation:a,className:f("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",t),...s})}const Ls=()=>{const[t]=K(A.SIDEBAR_SEARCH,{defaultValue:""}),{folders:a,queries:n,getFavoriteQueries:s,getQueriesByFolder:r,toggleFolder:l}=Y(),[i,u]=o.useState(!0),[p,c]=o.useState(!0),m=n.filter(d=>!d.isFavorite).length,j=s(),g=j.length,b=n.filter(d=>!d.folderId&&!d.isFavorite);if(t){const d=n.filter(v=>v.name.toLowerCase().includes(t.toLowerCase()));return d.length===0?e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:"No queries found matching"}):e.jsx("div",{className:"flex-1 overflow-y-auto",children:d.map(v=>e.jsx(H,{id:v.id,tableName:v.name},v.id))})}return e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx(J,{name:"Favorites",isExpanded:i,onToggle:()=>u(!i),count:g}),i&&j.map(d=>e.jsx(H,{id:d.id,tableName:d.name},d.id)),e.jsx(Fs,{className:"bg-zinc-800"}),e.jsx(J,{name:"Queries",isExpanded:p,onToggle:()=>c(!p),count:m}),p&&e.jsxs(e.Fragment,{children:[a.map(d=>{const v=r(d.id),S=v.length;return e.jsxs("div",{children:[e.jsx(J,{folderId:d.id,name:d.name,isExpanded:d.isExpanded,onToggle:()=>l(d.id),count:S,showContextMenu:!0}),d.isExpanded&&v.map(D=>e.jsx(H,{id:D.id,tableName:D.name,isNested:!0,showContextMenu:!0},D.id))]},d.id)}),b.map(d=>e.jsx(H,{id:d.id,tableName:d.name,showContextMenu:!0},d.id))]})]})},$s=()=>{const{addQuery:t,addFolder:a}=Y(),n=U(),s=o.useRef(null),[r,l]=K(A.SIDEBAR_SEARCH,{defaultValue:""}),i=c=>{l(c.target.value)},u=()=>{const c=t();n({to:"/runner/$queryId",params:{queryId:c}})},p=()=>{const c=Math.random().toString(36).substring(2,15);a({id:c,name:"New Folder",isExpanded:!0,isFavorite:!1})};return e.jsxs("div",{className:"p-3 space-y-2 border-b border-zinc-800",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(C,{className:"flex-1 justify-start h-8",onClick:u,children:[e.jsx(de,{className:"size-4"}),"Add Query"]}),e.jsxs(C,{className:"flex-1 justify-start h-8",onClick:p,children:[e.jsx(ze,{className:"size-4"}),"Add Folder"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(Pe,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(Q,{ref:s,placeholder:"Search queries",value:r??"",onChange:i,className:"rounded-sm h-8 pl-8 pr-8"}),e.jsx($,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]})]})},Qs=()=>e.jsxs(e.Fragment,{children:[e.jsx($s,{}),e.jsx(Ls,{})]}),qs=({tableName:t,rowCount:a})=>{const s=je({strict:!1}).table;return e.jsx("li",{className:"relative",children:e.jsxs(be,{to:"/table/$table",params:{table:t},className:f("w-full flex gap-0.5 px-4 py-1.5 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",s===t?"text-white bg-zinc-800/50":"text-zinc-400"),children:[s===t&&e.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),e.jsx("span",{className:"flex-1",children:t}),e.jsx($,{children:a})]})})},Bs=()=>{const{selectedDatabase:t}=we(),{data:a,isLoading:n,error:s}=X({queryKey:[A.CACHE_KEYS.TABLES_LIST,t],queryFn:async()=>{try{const r=new URL(`${W}/tables`);t&&r.searchParams.set("database",t);const l=await fetch(r.toString()),i=await l.json();if(!l.ok)throw new Error("Failed to fetch tables list");return console.log("useTablesList data",i),i}catch(r){throw console.error("Error fetching tables list:",r),r}}});return{tablesList:a,isLoadingTablesList:n,errorTablesList:s}},Hs=()=>{const[t]=K(A.SIDEBAR_SEARCH,{defaultValue:""}),{tablesList:a=[],isLoadingTablesList:n,errorTablesList:s}=Bs(),r=a?.filter(l=>l.tableName.toLowerCase().includes(t.toLowerCase()));return n?e.jsx("div",{className:"flex-1 h-full overflow-y-auto pb-3 flex items-center justify-center",children:e.jsx(jt,{size:"size-6"})}):s?e.jsxs("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:["Error: ",s.message]}):e.jsx("div",{className:"flex-1 overflow-y-auto pb-3",children:r&&r.length>0?e.jsx("ul",{children:r?.map(l=>e.jsx(qs,{tableName:l.tableName,rowCount:l.rowCount},l.tableName))}):t?e.jsx("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables found matching"}):e.jsx("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables available"})})},Gs=()=>{const t=o.useRef(null),[a,n]=K(A.SIDEBAR_SEARCH,{defaultValue:""}),{openSheet:s}=Ht();return Gt("/",r=>{r.preventDefault(),t.current&&t.current.focus()},{preventDefault:!0}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsxs(C,{className:"w-full justify-start h-8",onClick:()=>s("add-table"),children:[e.jsx(de,{className:"size-4"}),"Add Table"]}),e.jsxs("div",{className:"relative",children:[e.jsx(Pe,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(Q,{ref:t,placeholder:"Search tables",value:a??"",onChange:r=>n(r.target.value.trim()),className:"rounded-sm h-8 pl-8 pr-8"}),e.jsx($,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]})]})},ve=()=>e.jsxs(e.Fragment,{children:[e.jsx(Gs,{}),e.jsx(Vt,{className:"flex-1 overflow-y-auto pb-3 block h-full w-full",children:e.jsx(Hs,{})})]}),Vs=()=>{const{data:t,isLoading:a,error:n,refetch:s}=X({queryKey:[A.CACHE_KEYS.DATABASES_LIST],queryFn:async()=>{const r=await fetch(`${W}/databases`),l=await r.json();if(!r.ok)throw new Error("Failed to fetch databases list");return console.log("useDatabasesList data",l),l},staleTime:3e5});return{databases:t,isLoadingDatabases:a,databasesError:n,refetchDatabases:s}},Us=()=>{const{data:t,isLoading:a,error:n}=X({queryKey:[A.CACHE_KEYS.CURRENT_DATABASE],queryFn:async()=>{const s=await fetch(`${W}/databases/current`);if(!s.ok)throw new Error("Failed to fetch current database");return s.json()},staleTime:3e5});return{currentDatabase:t,isLoadingCurrentDatabase:a,currentDatabaseError:n}},Ks=()=>{const{data:t,isLoading:a,error:n}=X({queryKey:[A.CACHE_KEYS.DATABASE_CONNECTION_INFO],queryFn:async()=>{const s=await fetch(`${W}/databases/connection`);if(!s.ok)throw new Error("Failed to fetch database connection info");return s.json()},staleTime:3e5});return{connectionInfo:t,isLoadingConnectionInfo:a,connectionInfoError:n}};function Ws(){const{databases:t,isLoadingDatabases:a,refetchDatabases:n}=Vs(),{currentDatabase:s,isLoadingCurrentDatabase:r}=Us(),{connectionInfo:l}=Ks(),{selectedDatabase:i,setSelectedDatabase:u}=we(),p=U(),[c,m]=o.useState(!1);o.useEffect(()=>{s?.database&&!i&&!r&&u(s.database)},[s,i,u,r]);const j=b=>{u(b),p({to:"/table",search:{}})},g=async()=>{await n(),T.success("Databases refreshed")};return a||r?null:e.jsx("div",{className:"mt-auto border-t bg-background",children:e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(As,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Database"})]}),e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-6 w-6 hover:bg-accent",onClick:g,disabled:a,children:e.jsx(Ut,{className:f("h-3.5 w-3.5",a&&"animate-spin")})})}),e.jsx(ae,{children:"Refresh databases"})]})]}),e.jsxs(Me,{value:i||"",onValueChange:j,children:[e.jsx(Re,{className:"h-9 text-xs font-mono w-full",disabled:a,children:e.jsx(Ee,{placeholder:"Select database..."})}),e.jsx(ke,{children:t?.map(b=>e.jsx(G,{value:b.name,className:"font-mono text-xs",children:b.name},b.name))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(C,{variant:"ghost",className:"w-full hover:bg-accent flex items-center justify-between",onClick:()=>m(!c),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsxs("div",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})}),e.jsx("span",{className:"text-xs font-medium text-green-600",children:"Connected"})]}),e.jsx(ws,{className:f("size-3 text-muted-foreground transition-transform",c&&"rotate-180")})]}),c&&l&&e.jsxs("div",{className:"space-y-1.5 px-2 py-2 rounded-md bg-muted/30",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Host"}),e.jsxs("span",{className:"text-xs font-mono text-foreground",children:[l.host,":",l.port]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"User"}),e.jsx("span",{className:"text-xs font-mono text-foreground",children:l.user})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Databases"}),e.jsx("span",{className:"text-xs font-mono font-medium text-foreground",children:t?.length||0})]})]})]})]})})}const Xs=()=>{const{sidebar:{isPinned:t},toggleSidebarPinned:a}=V();return e.jsx("div",{className:"flex items-center justify-between h-9 border-b border-zinc-800",children:e.jsx(C,{variant:"ghost",size:"lg",onClick:a,className:"size-9 flex items-center justify-center transition hover:bg-transparent! focus-visible:ring-0 focus-visible:ring-offset-0",title:t?"Unpin sidebar":"Pin sidebar",children:t?e.jsx(va,{className:"size-4"}):e.jsx(ia,{className:"size-4"})})})},Ys=({children:t})=>{const{sidebar:{width:a,isOpen:n,isPinned:s},setSidebarWidth:r,setSidebarOpen:l}=V(),i=o.useRef(!1),u=o.useRef(0),p=o.useRef(0),c=o.useRef(null),m=o.useRef(null),j=o.useCallback(x=>{i.current&&requestAnimationFrame(()=>{const w=x.clientX-u.current,R=p.current+w;r(R)})},[r]),g=o.useCallback(()=>{i.current=!1,document.body.style.cursor="",document.body.style.userSelect="";const x=document.getElementById("resize-overlay");x&&x.remove()},[]),b=o.useCallback(x=>{x.preventDefault(),i.current=!0,u.current=x.clientX,p.current=a,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const w=document.createElement("div");w.id="resize-overlay",w.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(w)},[a]),d=o.useCallback(()=>{s||l(!0)},[s,l]),v=o.useCallback(()=>{s||l(!1)},[s,l]),S=o.useCallback(x=>{s||n||i.current||(x.clientX<=A.HOVER_ZONE?(c.current&&clearTimeout(c.current),c.current=window.setTimeout(()=>{l(!0)},A.HOVER_DELAY)):x.clientX>A.HOVER_ZONE+50&&c.current&&clearTimeout(c.current))},[s,n,l]),D=x=>{s||l(x)};return o.useEffect(()=>(document.addEventListener("mousemove",j),document.addEventListener("mouseup",g),document.addEventListener("mousemove",S),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",g),document.removeEventListener("mousemove",S),c.current&&clearTimeout(c.current)}),[j,g,S]),o.useEffect(()=>{const x=m.current;if(x)return x.addEventListener("mouseenter",d),x.addEventListener("mouseleave",v),()=>{x.removeEventListener("mouseenter",d),x.removeEventListener("mouseleave",v)}},[d,v]),e.jsxs(Kt,{open:n,onOpenChange:D,modal:!1,children:[e.jsx(Wt,{className:"sr-only",children:"Open Sidebar"}),e.jsx(Xt,{ref:m,side:"left",showCloseButton:!1,isPinned:s,className:f("bg-black border-r border-zinc-800 p-0","transition-transform duration-300 ease-out"),style:{width:`${a}px`},onOpenAutoFocus:x=>x.preventDefault(),children:e.jsxs("div",{className:"relative h-full flex flex-col",children:[t,e.jsx("div",{role:"button",tabIndex:0,onMouseDown:b,className:f("absolute top-0 right-0 w-2 h-full cursor-col-resize z-50","hover:bg-blue-500/50 transition-colors group"),title:"Drag to resize",children:e.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-2 h-12 bg-blue-500 opacity-0 group-hover:opacity-100 transition-opacity rounded-full"})})]})})]})},Zs=()=>{const{pathname:t}=Te(),a=t.split("/")[1],n=o.useMemo(()=>{switch(console.log(a),a){case"":case"table":return e.jsx(ve,{});case"runner":return e.jsx(Qs,{});default:return e.jsx(ve,{})}},[a]);return e.jsxs(Ys,{children:[e.jsx(Xs,{}),n,e.jsx(Ws,{})]})};function sn(){const{sidebar:{isPinned:t,width:a}}=V();return e.jsxs("div",{className:"bg-zinc-950 w-dvw flex h-dvh max-h-dvh overflow-hidden relative",children:[e.jsx(Zs,{}),e.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden ",style:{marginLeft:t?`${a}px`:"0"},children:[e.jsx(ys,{}),e.jsx(pt,{})]})]})}export{sn as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as t,j as r}from"./index-BqkvVbPL.js";import{R as m}from"./runner-tab-tkrQ9l47.js";import"./database.store-CtH7ADQ_.js";import"./format-cell-value-Bcvj8RHO.js";import"./queries.store-FtsSrFD5.js";function a(){const{queryId:o}=t.useParams();return r.jsx(m,{queryId:o})}export{a as component};
|