From 014409e5b011791181e903b226a067dc6382ef22 Mon Sep 17 00:00:00 2001 From: vwh Date: Wed, 6 Nov 2024 22:36:50 +0300 Subject: [PATCH] Updates --- assets/index-CCxazG49.js | 7 ------- assets/index-CCxazG49.js.gz | Bin 14996 -> 0 bytes assets/index-Cr9yX2c0.js | 7 +++++++ assets/index-Cr9yX2c0.js.gz | Bin 0 -> 15042 bytes index.html | 2 +- index.html.gz | Bin 1808 -> 1808 bytes sw.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 assets/index-CCxazG49.js delete mode 100644 assets/index-CCxazG49.js.gz create mode 100644 assets/index-Cr9yX2c0.js create mode 100644 assets/index-Cr9yX2c0.js.gz diff --git a/assets/index-CCxazG49.js b/assets/index-CCxazG49.js deleted file mode 100644 index 385b7fa..0000000 --- a/assets/index-CCxazG49.js +++ /dev/null @@ -1,7 +0,0 @@ -import{r as o,j as e,R as Rt}from"./react-DmpIMwDM.js";import{c as Tt}from"./react-dom-Cjr6YfK8.js";import{c as St}from"./zustand-BpWCCnYR.js";import{i as At}from"./sql.js-Ch_tM77n.js";import{F as fe}from"./file-saver-DhbZvGod.js";import{f as Lt}from"./sql-formatter-BoZ82dp4.js";import{I as Dt,H as It,c as xe,d as pe,e as Ft,S as kt,f as Ot,g as ge,h as Mt,i as Pt,j as he,k as be,l as ye,m as Bt,n as Ne,o as qt,p as je,q as we,r as Ut,s as Ce,V as $t,L as Ee,t as ve,u as Qt,v as zt,w as Re,x as Ht,G as Vt,y as Gt,z as Te,A as _t,B as Wt,E as Se,F as Ae,J as Le,K as De,M as Ie,N as Fe,Q as Kt,U as Yt}from"./@radix-ui-BQVY8FyZ.js";import{c as Xt}from"./clsx-B-dksMZM.js";import{t as Jt}from"./tailwind-merge-BkWO730n.js";import{C as J,L as Zt,I as es,a as ts,T as ss,F as as,b as rs,R as os,c as ke,P as Oe,S as Me,d as ns,M as ls,e as is,f as cs,g as ds,h as ms,A as us,i as fs,j as xs,K as ps,k as gs,l as hs,m as bs,H as ys,n as Ns,o as js,p as ws,q as Cs,r as Es,s as vs,G as Rs,Z as Ts,t as Ss,u as As,v as Ls,w as Ds}from"./lucide-react-S8ZAjIB-.js";import{c as Z}from"./class-variance-authority-Bb4qSo10.js";import{J as L,T as Is}from"./sonner-CxG_nbEz.js";import{D as T}from"./vaul-OrZLygqJ.js";import{p as Pe,i as Be,f as Fs,a as ks}from"./date-fns-BAPXOope.js";import{G as Os,I as Ms,t as Ps}from"./@codemirror-CCjSF3Vf.js";import{R as Bs,n as qs}from"./@uiw-CvcbIrPa.js";import{u as Us}from"./react-dropzone-D-IBOhIS.js";import"./attr-accept-BWI1aNlo.js";import"./scheduler-CzFDRTuY.js";import"./use-sync-external-store-ByYeed7R.js";import"./nearley-CG12bGQB.js";import"./aria-hidden-DQ5UC2Eg.js";import"./react-remove-scroll-BOyN_WUU.js";import"./tslib-CuZy2iRz.js";import"./react-remove-scroll-bar-DZjhPxUV.js";import"./react-style-singleton-CpxBwIWS.js";import"./get-nonce-C-Z93AgS.js";import"./use-sidecar-D8_hMcUG.js";import"./use-callback-ref-DRzK4jWO.js";import"./@floating-ui-Bob4LHZu.js";import"./@lezer-DgLl1T_N.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";import"./@babel-BjXSgPXB.js";import"./prop-types-psm7UO16.js";import"./file-selector-CBHVlu32.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=a(n);fetch(n.href,l)}})();const $s="/sql.wasm";let G;const Qs=async()=>(G||(G=await At({locateFile:()=>$s})),G),zs=async t=>{try{const s=await Qs();return new s.Database(t)}catch(s){throw console.error("Failed to load database:",s),s}},ee=t=>{try{const s=t.prepare("SELECT name FROM sqlite_master WHERE type='table';"),a=[];for(;s.step();)a.push(s.get()[0]);return s.free(),a}catch{throw new Error("Invalid database file")}},Hs=(t,s)=>{try{const a={},r=t.prepare(`PRAGMA table_info("${s}");`);for(;r.step();){const l=r.getAsObject();a[l.name]={type:l.type?l.type.toUpperCase():l.type,isPrimaryKey:l.pk===1,isForeignKey:!1,nullable:l.notnull===0}}r.free();const n=t.prepare(`PRAGMA foreign_key_list("${s}");`);for(;n.step();){const l=n.getAsObject();a[l.from]&&(a[l.from].isForeignKey=!0)}return n.free(),a}catch(a){throw console.error(`Failed to get schema for table "${s}":`,a),a}},le=t=>{if(t.length===0)return{data:[],columns:[]};const{columns:s,values:a}=t[0];return{data:a.map(n=>Object.fromEntries(s.map((l,i)=>[l,n[i]]))),columns:s}},Vs=t=>{try{const s=t.export(),a=new Blob([s],{type:"application/x-sqlite3"});fe.saveAs(a,"database.sqlite")}catch(s){throw console.error("Failed to export database:",s),s}},Gs=(t,s)=>{const a=t.map(n=>`"${n}"`).join(","),r=s.map(n=>t.map(l=>`"${n[l]??""}"`).join(","));return[a,...r].join(` -`)},te=(t,s,a)=>{try{const r=s.prepare(t),n=r.getColumnNames(),l=[];for(;r.step();){const d=r.getAsObject();l.push(d)}if(r.free(),l.length===0)throw new Error(`Query "${t}" returned no results.`);const i=Gs(n,l),c=new Blob([i],{type:"text/csv;charset=utf-8;"});fe.saveAs(c,`${a}.csv`)}catch(r){throw console.error(`Failed to get CSV for query "${t}":`,r),r}},_s=(t,s)=>{const r=ee(t)[s],n=`SELECT * FROM "${r}"`;te(n,t,r)},Ws=t=>{const s=ee(t);for(const a of s)try{const r=`SELECT * FROM "${a}"`;te(r,t,a)}catch(r){throw console.error(`Failed to get CSV for table "${a}":`,r),r}},Ks=(t,s)=>{te(s,t,"custom_query")},ie=["Bytes","KB","MB","GB","TB"];function Ys(t){let s=0;for(;t>=1024&&s({db:null,isLoading:!1,loadDatabaseBytes:async a=>{t({isLoading:!0});try{const r=await zs(a),n=ee(r),l=await Promise.all(n.map(async d=>{const u=r.exec(`SELECT COUNT(*) FROM "${d}"`),f=Number.parseInt(u[0].values[0][0],10),x=await Hs(r,d);return{name:d,count:f,schema:x}})),i=l.map(({name:d,count:u})=>({name:d,count:u})),c=l.reduce((d,{name:u,schema:f})=>(d[u]=f,d),{});t({db:r,tables:i,tableSchemas:c,isLoading:!1})}catch(r){throw t({isLoading:!1}),r}},tables:[],setTables:a=>t({tables:a}),selectedTable:"0",setSelectedTable:a=>t({selectedTable:a}),tableSchemas:{},customQuery:"",setIsCustomQuery:a=>t({isCustomQuery:a}),setCustomQuery:a=>t({customQuery:a}),isCustomQuery:!1,queryError:null,setQueryError:a=>t({queryError:a}),query:a=>{const{db:r}=s();return r?r.exec(a):(console.warn("Database is not loaded."),[])},rowPerPageOrAuto:"auto",setRowPerPageOrAuto:a=>t({rowPerPageOrAuto:a}),queryHistory:[],unShiftToQueryHistory:a=>t(r=>({queryHistory:[a,...r.queryHistory]})),expandPage:!1,setExpandPage:a=>t({expandPage:a}),dateFormatValue:"formatDateFormatted",setDateFormatValue:a=>t({dateFormatValue:a}),filters:{},setFilters:a=>t({filters:a}),appendToFilters:(a,r)=>t(n=>({filters:{...n.filters,[a]:r}})),filtersNeedClear:!1,setFiltersNeedClear:a=>t({filtersNeedClear:a}),totalRows:0,setTotalRows:a=>t({totalRows:a}),orderBy:{column:null,direction:"ASC"},setOrderBy:(a,r)=>t({orderBy:{column:a,direction:r}}),databaseData:{name:"database.db",size:0,sizeAsString:"0 Bytes"},setDatabaseData:a=>{t({databaseData:{...a,sizeAsString:Ys(a.size)}})}}));function Xs(t,s,a){const{db:r,setQueryError:n,setIsCustomQuery:l,query:i,unShiftToQueryHistory:c,customQuery:d,setCustomQuery:u,filters:f,totalRows:x,setTotalRows:g,orderBy:p,selectedTable:y,tables:N}=h(),[w,C]=o.useState([]),[S,D]=o.useState([]),[E,A]=o.useState(!0),P=o.useMemo(()=>Object.fromEntries(Object.entries(f).filter(([,j])=>j!=="")),[f]),v=o.useMemo(()=>Object.entries(P).map(([j,R])=>`LOWER(${j}) LIKE LOWER('%${R}%')`).join(" AND "),[P]);o.useEffect(()=>{if(!r||!t)return;(async()=>{A(!0);try{const R=`PRAGMA table_info("${t}");`,V=i(R)[0].values.map(I=>({name:I[1],type:I[2]})).map(I=>I.type.toUpperCase()==="BLOB"?`hex(${I.name}) as ${I.name}`:I.name).join(", "),k=`SELECT COUNT(*) as count FROM "${t}"${v?` WHERE ${v}`:""}`,U=i(k)[0].values[0][0];g(U);let O=`SELECT - ${V} -FROM "${t}"`;v&&(O+=` -WHERE ${v}`),p.column&&(O+=` -ORDER BY "${p.column}" ${p.direction}`),O+=` -LIMIT ${s} OFFSET ${a};`;const Ct=i(O),{data:Et,columns:vt}=le(Ct);D(vt),C(Et),n(null),u(O),c(O)}catch(R){R instanceof Error&&n(R.message)}finally{A(!1)}})()},[r,t,a,s,v,p,i,n,u,c,g]);const H=o.useCallback(()=>{if(d.trim()===""){n(null);return}A(!0);try{const j=N[Number.parseInt(y)].name,R=i(d.replace("@",`"${j}"`)),{data:B,columns:q}=le(R);D(q),C(B),l(!0),n(null)}catch(j){j instanceof Error&&n(j.message)}finally{A(!1)}},[d,i,n,l,N,y]);return{data:w,columns:S,customQuery:d,setCustomQuery:u,isQueryLoading:E,handleCustomQuery:H,totalRows:x}}function Js(t){const{setIsCustomQuery:s}=h(),[a,r]=o.useState(0);o.useEffect(()=>{r(0),s(!1)},[s]);const n=o.useMemo(()=>{if(t!=="auto")return t;const l=window.innerHeight,u=Math.min(2e3,40+l*.03),f=Math.max(1,Math.floor(l/u));return Math.min(Math.max(f,5),50)},[t]);return{page:a,setPage:r,rowsPerPage:n}}function m(...t){return Jt(Xt(t))}const Zs=Ft,qe=o.forwardRef(({className:t,...s},a)=>e.jsx(Dt,{ref:a,className:m("border-b",t),...s}));qe.displayName="AccordionItem";const Ue=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(It,{className:"flex",children:e.jsxs(xe,{ref:r,className:m("flex flex-1 items-center justify-between py-3 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(J,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ue.displayName=xe.displayName;const $e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(pe,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:m("pb-4 pt-0",t),children:s})}));$e.displayName=pe.displayName;const se=Z("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),b=o.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},l)=>{const i=r?kt:"button";return e.jsx(i,{className:m(se({variant:s,size:a,className:t})),ref:l,...n})});b.displayName="Button";const ea=o.memo(Zt);function K({type:t,children:s,className:a=""}){let r,n;switch(t){case"error":r=e.jsx(ss,{className:"mr-3 h-6 w-6 text-red-500"}),n="bg-red-100 text-red-800 border-l-4 border-red-500";break;case"loading":{r=e.jsx(ea,{className:"mr-3 h-6 w-6 animate-spin text-blue-500"}),n="bg-blue-100 text-blue-800 border-l-4 border-blue-500";break}case"success":r=e.jsx(ts,{className:"mr-3 h-6 w-6 text-green-500"}),n="bg-green-100 text-green-800 border-l-4 border-green-500";break;case"info":r=e.jsx(es,{className:"mr-3 h-6 w-6 text-yellow-500"}),n="bg-yellow-100 text-yellow-800 border-l-4 border-yellow-500";break;default:r=null,n=""}return e.jsxs("div",{className:`flex items-center rounded-lg p-4 shadow-md ${n} ${a}`,children:[r,e.jsx("span",{className:"font-medium",children:s})]})}const ta=Mt,sa=Pt,Qe=o.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Ot,{children:e.jsx(ge,{ref:n,align:s,sideOffset:a,className:m("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",t),...r})}));Qe.displayName=ge.displayName;function aa(){const{selectedTable:t,customQuery:s,db:a}=h(),r=o.useMemo(()=>a&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx($,{onClick:()=>{try{Vs(a)}catch{L.error("Failed to download database")}},label:"Export as SQLite",title:"Download database as SQLite"}),e.jsx($,{onClick:()=>{try{_s(a,Number.parseInt(t))}catch{L.error("Failed to export selected table as CSV")}},label:"Export selected table as CSV"}),e.jsx($,{onClick:()=>{try{Ws(a)}catch{L.error("Failed to export all tables as CSV")}},label:"Export all tables as CSV"}),e.jsx($,{onClick:()=>{try{Ks(a,s)}catch{L.error("Failed to export custom query as CSV")}},label:"Export custom query as CSV",title:"Export the result of the custom query as CSV"})]}),[a,t,s]);return e.jsxs(ta,{children:[e.jsx(sa,{asChild:!0,children:e.jsx(b,{title:"Open export options",children:e.jsx(as,{className:"h-5 w-5"})})}),e.jsx(Qe,{align:"end",className:"w-80",children:r})]})}function $({onClick:t,label:s,className:a,title:r}){return e.jsx(b,{className:a,onClick:t,title:r??s,children:e.jsx("span",{className:"ml-2",children:s})})}const ze=(t,s)=>localStorage.getItem(t)||s,He=(t,s)=>localStorage.setItem(t,s),ce=(t,s)=>{const[a,r]=o.useState(()=>ze(t,s));return o.useEffect(()=>{He(t,a)},[t,a]),[a,r]},Ve=({shouldScaleBackground:t=!0,...s})=>e.jsx(T.Root,{shouldScaleBackground:t,...s});Ve.displayName="Drawer";const ra=T.Trigger,oa=T.Portal,na=T.Close,Ge=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Overlay,{ref:a,className:m("fixed inset-0 z-50 bg-black/80",t),...s}));Ge.displayName=T.Overlay.displayName;const _e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(oa,{children:[e.jsx(Ge,{}),e.jsxs(T.Content,{ref:r,className:m("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",t),...a,children:[e.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),s]})]}));_e.displayName="DrawerContent";const We=({className:t,...s})=>e.jsx("div",{className:m("grid gap-1.5 p-4 text-center sm:text-left",t),...s});We.displayName="DrawerHeader";const Ke=({className:t,...s})=>e.jsx("div",{className:m("mt-auto flex flex-col gap-2 pb-4",t),...s});Ke.displayName="DrawerFooter";const Ye=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Title,{ref:a,className:m("text-lg font-semibold leading-none tracking-tight",t),...s}));Ye.displayName=T.Title.displayName;const Xe=o.forwardRef(({className:t,...s},a)=>e.jsx(T.Description,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Xe.displayName=T.Description.displayName;const _=t=>s=>{const a=Pe(s);return Be(a)?Fs(a,t):s},la=t=>{const s=Pe(t);return Be(s)?ks(s,{addSuffix:!0}):t},Y={formatDateRelative:{label:"Over 56 years ago",func:la},formatDateFormatted:{label:"January 9th, 1968",func:_("MMMM do, yyyy")},formatDateLong:{label:"1968/09/01",func:_("yyyy/MM/dd")},formatDateShort:{label:"01/09/1968",func:_("MM/dd/yyyy")}},ia=Z("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Je=o.forwardRef(({className:t,...s},a)=>e.jsx(he,{ref:a,className:m(ia(),t),...s}));Je.displayName=he.displayName;const ae=o.forwardRef(({className:t,...s},a)=>e.jsx(be,{className:m("grid gap-2",t),...s,ref:a}));ae.displayName=be.displayName;const Ze=o.forwardRef(({className:t,...s},a)=>e.jsx(ye,{ref:a,className:m("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Bt,{className:"flex items-center justify-center",children:e.jsx(rs,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ze.displayName=ye.displayName;const re=o.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:m("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a}));re.displayName="Input";const Q=({value:t,label:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{value:t,id:`r-${t}`}),e.jsx(Je,{htmlFor:`r-${t}`,children:s})]}),ca=({rowsPerPage:t,onRowsPerPageChange:s})=>{const a=t==="auto";return e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Rows Per Page"})]}),e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:[e.jsx(re,{id:"rowsPerPage",value:a?"":t,onChange:r=>s(r.target.value),placeholder:"Number of rows",type:"number",className:"w-full",autoFocus:!1}),e.jsx(b,{variant:"outline",onClick:()=>s("auto"),className:"w-full whitespace-nowrap",children:"Auto Calculate"})]})]})},da=({dateFormatValue:t,onDateFormatChange:s})=>e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Date Format"})]}),e.jsx("div",{className:"h-full rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:e.jsxs(ae,{className:"flex h-full flex-col gap-2",name:"dateType",value:t,onValueChange:s,children:[e.jsx(Q,{value:"default",label:"Default"}),Object.entries(Y).map(([a,{label:r}])=>e.jsx(Q,{value:a,label:r},a))]})})]}),ma=({themeColor:t,onThemeColorChange:s,themeColors:a})=>e.jsxs("div",{className:"flex grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Theme Color"})]}),e.jsxs(ae,{className:"flex flex-col gap-2 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",name:"themeColor",value:t,onValueChange:s,children:[e.jsx(Q,{value:"default",label:"Default"}),a.map(r=>e.jsx(Q,{value:r,label:r[0].toUpperCase()+r.slice(1)},r))]})]}),ua="rowsPerPage",de="dateFormat",fa="theme-color",me=["nord","zinc"],xa=o.memo(function(){const{setRowPerPageOrAuto:s,setIsCustomQuery:a,dateFormatValue:r,setDateFormatValue:n}=h(),[l,i]=ce(ua,"auto"),[c,d]=ce(fa,"default"),u=l==="auto";o.useEffect(()=>{s(u?"auto":Number(l))},[l,s,u]),o.useEffect(()=>{n(ze(de,"default"))},[n]),o.useEffect(()=>{var p;for(const y of me)(p=document.body)==null||p.classList.toggle(y,y===c)},[c]);const f=o.useCallback(p=>{a(!1),p==="auto"||Number(p)>0?i(p):L.error("Please provide a positive number of rows per page or set it to auto.")},[a,i]),x=o.useCallback(p=>{n(p),He(de,p)},[n]),g=o.useCallback(p=>{d(p)},[d]);return e.jsxs(Ve,{children:[e.jsx(ra,{asChild:!0,children:e.jsx(b,{className:"grow",title:"Open settings drawer",children:e.jsx(Me,{className:"h-5 w-5"})})}),e.jsxs(_e,{children:[e.jsxs(We,{className:"hidden",children:[e.jsx(Ye,{children:"Settings"}),e.jsx(Xe,{children:"Change settings."})]}),e.jsxs("div",{className:"mx-auto flex w-full max-w-sm flex-col gap-3",children:[e.jsx(ca,{rowsPerPage:l,onRowsPerPageChange:f}),e.jsx(ma,{themeColor:c,onThemeColorChange:g,themeColors:me}),e.jsx(da,{dateFormatValue:r,onDateFormatChange:x}),e.jsx(Ke,{children:e.jsx(na,{asChild:!0,children:e.jsx(b,{variant:"outline",children:"Cancel"})})})]})]})]},"settings-drawer")}),W="theme-mode",ue="animate-circular-reveal";function pa(){const[t,s]=o.useState(()=>{const l=localStorage.getItem(W),i=window.matchMedia("(prefers-color-scheme: dark)").matches;return l||(i?"dark":"light")}),a=o.useCallback(l=>{s(l),document.body.classList.remove("light","dark"),document.body.classList.add(l),localStorage.setItem(W,l),document.body.classList.add(ue),setTimeout(()=>{document.body.classList.remove(ue)},500)},[]);o.useEffect(()=>{const l=c=>{localStorage.getItem(W)||a(c.matches?"dark":"light")},i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",l),a(t),()=>{i.removeEventListener("change",l)}},[a,t]);const r=o.useCallback(()=>{a(t==="light"?"dark":"light")},[t,a]);return o.useMemo(()=>e.jsx(b,{className:"relative grow",onClick:r,title:t==="dark"?"Enable light mode":"Enable dark mode",children:t==="dark"?e.jsx(ns,{className:"h-5 w-5"}):e.jsx(ls,{className:"h-5 w-5"})}),[t,r])}const et=o.memo(pa),ga=o.memo(is),ha=o.memo(cs);function ba({page:t,setPage:s,rowsPerPage:a}){const{totalRows:r}=h(),n=o.useMemo(()=>Math.ceil(r/a),[r,a]),l=o.useMemo(()=>Math.ceil(t/a)+1,[t,a]),i=l1,d=o.useCallback(()=>{i&&s(f=>f+a)},[i,a,s]),u=o.useCallback(()=>{c&&s(f=>f-a)},[c,a,s]);return e.jsx("section",{className:"fixed bottom-2 left-1/2 z-10 w-[270px] -translate-x-1/2 transform",children:e.jsxs("div",{className:"flex justify-between gap-2 rounded border bg-secondary p-[6px]",children:[e.jsx(b,{onClick:u,title:"Previous page",disabled:!c,children:e.jsx(ga,{className:"h-4 w-4"})}),e.jsxs("span",{className:"flex items-center justify-center text-sm",children:["Page ",l," of ",n]}),e.jsx(b,{onClick:d,title:"Next page",disabled:!i,children:e.jsx(ha,{className:"h-4 w-4"})})]})})}const ya=Ht,Na=Vt,ja=Gt,wa=o.memo(J),tt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ne,{ref:r,className:m("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(qt,{asChild:!0,children:e.jsx(wa,{className:"h-4 w-4 opacity-50"})})]}));tt.displayName=Ne.displayName;const st=o.forwardRef(({className:t,...s},a)=>e.jsx(je,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ds,{className:"h-4 w-4"})}));st.displayName=je.displayName;const at=o.forwardRef(({className:t,...s},a)=>e.jsx(we,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(J,{className:"h-4 w-4"})}));at.displayName=we.displayName;const rt=o.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(Ut,{children:e.jsxs(Ce,{ref:n,className:m("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(st,{}),e.jsx($t,{className:m("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(at,{})]})}));rt.displayName=Ce.displayName;const ot=o.forwardRef(({className:t,...s},a)=>e.jsx(Ee,{ref:a,className:m("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));ot.displayName=Ee.displayName;const nt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ve,{ref:r,className:m("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Qt,{children:e.jsx(ms,{className:"h-4 w-4"})})}),e.jsx(zt,{children:s})]}));nt.displayName=ve.displayName;const Ca=o.forwardRef(({className:t,...s},a)=>e.jsx(Re,{ref:a,className:m("-mx-1 my-1 h-px bg-muted",t),...s}));Ca.displayName=Re.displayName;const Ea=Z("inline-flex items-center rounded border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function z({className:t,variant:s,...a}){return e.jsx("div",{className:m(Ea({variant:s}),t),...a,children:e.jsx("span",{className:"w-full",children:a.children})})}function va(){const{tables:t,selectedTable:s,setSelectedTable:a,setIsCustomQuery:r}=h(),n=o.useMemo(()=>{var d;const c=Number.parseInt(s);return Number.isNaN(c)?0:((d=t[c])==null?void 0:d.count)||0},[t,s]),l=o.useMemo(()=>t.map((c,d)=>e.jsx(nt,{value:`${d}`,children:c.name[0].toUpperCase()+c.name.slice(1)},c.name)),[t]);function i(c){r(!1),a(c)}return e.jsxs("section",{className:"flex grow items-center justify-center gap-1",children:[e.jsxs(ya,{value:s,onValueChange:i,children:[e.jsx(tt,{className:"grow",children:e.jsx(ja,{placeholder:"Select a table"})}),e.jsx(rt,{children:e.jsxs(Na,{children:[e.jsx(ot,{children:"Tables"}),l]})})]}),e.jsx(z,{title:"Rows",className:"hidden min-w-[100px] grow bg-background py-2 text-center text-sm md:block md:min-w-[200px]",variant:"outline",children:e.jsx("span",{className:"w-full text-center",children:n})})]})}const Ra=o.memo(va),Ta={DATE:/DATE|TIMESTAMP/i,BLOB:/^BLOB$/i,TEXT:/CHAR|TEXT|CLOB|VARCHAR/i,INTEGER:/INT/i,REAL:/REAL|FLOAT|DOUBLE|DECIMAL/i,NUMERIC:/NUMERIC/i,BOOLEAN:/BOOL/i},F=(t,s)=>Ta[s].test(t),lt=t=>F(t,"DATE"),Sa=t=>F(t,"BLOB"),Aa=t=>F(t,"TEXT"),La=t=>F(t,"INTEGER"),Da=t=>F(t,"REAL"),Ia=t=>F(t,"NUMERIC"),Fa=t=>F(t,"BOOLEAN"),ka=t=>La(t)||Da(t)||Ia(t),it=_t,ct=Wt,oe=o.forwardRef(({className:t,align:s="start",side:a="bottom",sideOffset:r=4,...n},l)=>e.jsx(Te,{ref:l,align:s,side:a,sideOffset:r,className:m("z-50 w-64 text-balance break-words rounded-md border p-4 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[side=bottom]:slide-in-from-top-1","data-[side=left]:slide-in-from-right-1","data-[side=right]:slide-in-from-left-1","data-[side=top]:slide-in-from-bottom-1","bg-gray-100 dark:bg-gray-700",t),...n}));oe.displayName=Te.displayName;const dt=o.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:m("w-full caption-bottom text-sm",t),...s})}));dt.displayName="Table";const mt=o.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:m("[&_tr]:border-b",t),...s}));mt.displayName="TableHeader";const ut=o.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:m("[&_tr:last-child]:border-0",t),...s}));ut.displayName="TableBody";const Oa=o.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:m("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Oa.displayName="TableFooter";const X=o.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:m("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));X.displayName="TableRow";const ft=o.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:m("h-12 min-w-[150px] px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ft.displayName="TableHead";const Ma=t=>{const s=new Uint8Array(t.match(/.{1,2}/g).map(r=>Number.parseInt(r,16))),a=new Blob([s],{type:"image/jpeg"});return URL.createObjectURL(a)},xt=o.memo(o.forwardRef(({className:t,children:s,dataType:a,...r},n)=>{const l=(a==null?void 0:a.toUpperCase())==="BLOB",i=o.useMemo(()=>typeof s=="string"&&s.length>40?`${s.slice(0,40)}...`:s,[s]);return e.jsx("td",{ref:n,className:m("max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r,children:e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsx("span",{className:"cursor-pointer hover:underline",children:l?e.jsx("span",{className:"italic opacity-40",children:"BLOB"}):i})}),e.jsx(oe,{side:"bottom",align:"start",children:e.jsxs("div",{className:"flex flex-col justify-center gap-1",children:[l&&typeof s=="string"?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:Ma(s),alt:"BLOB content",className:"flex max-h-40 flex-col items-center justify-center gap-2 rounded object-contain",onError:c=>{c.currentTarget.style.display="none"}}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Blob length: ",s.length]})]}):e.jsx("span",{className:"max-w-full break-words",children:s}),e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:a||"Unknown"})]})})]})})}));xt.displayName="TableCell";const Pa=o.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:m("mt-4 text-sm text-muted-foreground",t),...s}));Pa.displayName="TableCaption";function Ba({columnName:t}){const{appendToFilters:s,selectedTable:a,filtersNeedClear:r,setFiltersNeedClear:n}=h(),[l,i]=o.useState("");o.useEffect(()=>{i("")},[a]),o.useEffect(()=>{r&&(i(""),n(!1))},[r,n]);const c=o.useCallback(d=>{const u=d.target.value;i(u),s(t,u)},[s,t]);return e.jsx(re,{value:l,onChange:c,className:"mt-[2px] max-h-7 w-full text-xs",placeholder:"Filter"})}function qa({columnName:t}){const{orderBy:s,setOrderBy:a}=h(),r=o.useCallback(()=>{s.column===t?s.direction==="ASC"?a(t,"DESC"):s.direction==="DESC"&&a(null,"ASC"):a(t,"ASC")},[s,t,a]);return e.jsx("div",{onClick:r,onKeyUp:r,className:"flex items-center",children:s.column===t?s.direction==="ASC"?e.jsx("button",{title:"Descending",type:"button","aria-label":"Sort Descending",children:e.jsx(us,{className:"h-4 w-4"})}):e.jsx("button",{title:"Ascending",type:"button","aria-label":"Sort Ascending",children:e.jsx(fs,{className:"h-4 w-4"})}):e.jsx("button",{title:"Sort column",type:"button","aria-label":"Sort Column",children:e.jsx(xs,{className:"h-4 w-4"})})})}const Ua=o.memo(({columnSchema:t})=>e.jsxs(e.Fragment,{children:[(t==null?void 0:t.isPrimaryKey)&&e.jsx("p",{className:"text-sm font-semibold text-yellow-600",children:"(Primary)"}),(t==null?void 0:t.isForeignKey)&&e.jsx("p",{className:"text-sm font-semibold text-purple-600",children:"(Foreign)"})]})),$a=o.memo(({columnSchema:t})=>{const{type:s,isPrimaryKey:a,isForeignKey:r}=t;if(a)return e.jsx(ps,{className:"h-4 w-4 text-yellow-500"});if(r)return e.jsx(gs,{className:"h-4 w-4 text-purple-500"});if(s){if(Sa(s))return e.jsx(hs,{className:"h-4 w-4 text-green-500"});if(lt(s))return e.jsx(ke,{className:"h-4 w-4 text-blue-500"});if(Aa(s))return e.jsx(bs,{className:"h-4 w-4 text-indigo-500"});if(ka(s))return e.jsx(ys,{className:"h-4 w-4 text-red-500"});if(Fa(s))return e.jsx(Ns,{className:"h-4 w-4 text-pink-500"})}return e.jsx(js,{className:"h-4 w-4 text-gray-500"})}),Qa=o.memo(({columnName:t,columnSchema:s})=>e.jsxs(ft,{className:"bg-gray-100 py-2 dark:bg-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qa,{columnName:t}),e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1",children:[e.jsx("span",{className:"max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:t}),s&&e.jsx($a,{columnSchema:s})]})}),e.jsxs(oe,{className:"w-64",children:[e.jsxs("div",{className:"mb-1 flex items-center space-x-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),e.jsx(Ua,{columnSchema:s})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:(s==null?void 0:s.type)||"Unknown"}),(s==null?void 0:s.nullable)&&e.jsx(z,{className:"w-full self-start text-center text-xs font-semibold",children:"NULLABLE"})]})]})]})]}),e.jsx(Ba,{columnName:t})]})),za=o.memo(({value:t,dataType:s})=>{const{dateFormatValue:a}=h(),r=()=>t?s&<(s)&&Y[a]?Y[a].func(t):t:e.jsx("span",{className:"italic text-gray-400",children:"NULL"});return e.jsx(xt,{dataType:s,className:"px-5 py-[11px] text-sm",children:r()})});function Ha({data:t,columns:s,tableName:a,tableSchemas:r}){const{filters:n,setFiltersNeedClear:l,setFilters:i}=h(),c=o.useMemo(()=>e.jsx(mt,{children:e.jsx(X,{children:s.map((f,x)=>e.jsx(Qa,{columnName:f,columnSchema:r[a][f]},x))})}),[s,r,a]),d=o.useMemo(()=>e.jsx(ut,{children:t.map((f,x)=>e.jsx(X,{children:s.map((g,p)=>{var y;return e.jsx(za,{value:f[g],dataType:(y=r[a][g])==null?void 0:y.type},p)})},x))}),[t,s,r,a]),u=o.useCallback(()=>{l(!0),i({})},[l,i]);return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(dt,{children:[c,t.length>0&&d]}),t.length===0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full p-4 text-center font-medium",children:["No data available for ",a]}),Object.keys(n).length>0&&e.jsx(b,{className:"w-full rounded-none",variant:"outline",onClick:u,children:"Clear filters"})]})]})}function Va(){const[t,s]=o.useState(()=>document.body.classList.contains("dark"));return o.useEffect(()=>{const a=new MutationObserver(()=>{s(document.body.classList.contains("dark"))});return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),t}const Ga=["ABORT","ACTION","ADD","AFTER","ALL","ALTER","ANALYZE","AND","AS","ASC","ATTACH","AUTOINCREMENT","BEFORE","BEGIN","BETWEEN","BY","CASCADE","CASE","CAST","CHECK","COLLATE","COLUMN","COMMIT","CONFLICT","CONSTRAINT","CREATE","CROSS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATABASE","DEFAULT","DEFERRABLE","DEFERRED","DELETE","DESC","DETACH","DISTINCT","DROP","EACH","ELSE","END","ESCAPE","EXCEPT","EXCLUSIVE","EXISTS","EXPLAIN","FAIL","FOR","FOREIGN","FROM","FULL","GLOB","GROUP","HAVING","IF","IGNORE","IMMEDIATE","IN","INDEX","INDEXED","INITIALLY","INNER","INSERT","INSTEAD","INTERSECT","INTO","IS","ISNULL","JOIN","KEY","LEFT","LIKE","LIMIT","MATCH","NATURAL","NO","NOT","NOTNULL","NULL","OF","OFFSET","ON","OR","ORDER","OUTER","PLAN","PRAGMA","PRIMARY","QUERY","RAISE","RECURSIVE","REFERENCES","REGEXP","REINDEX","RELEASE","RENAME","REPLACE","RESTRICT","RIGHT","ROLLBACK","ROW","SAVEPOINT","SELECT","SET","TABLE","TEMP","TEMPORARY","THEN","TO","TRANSACTION","TRIGGER","UNION","UNIQUE","UPDATE","USING","VACUUM","VALUES","VIEW","VIRTUAL","WHEN","WHERE","WITH","WITHOUT"];function _a({columnNames:t}){const{customQuery:s,setCustomQuery:a,tables:r}=h(),n=Va(),l=o.useCallback(d=>{const u=d.matchBefore(/\w*/);if(!u||u.from===u.to&&!d.explicit)return null;const f=[...Ga.map(x=>({label:x,type:"keyword"})),...r.map(x=>({label:x.name,type:"table"})),...t.map(x=>({label:x,type:"column"}))];return{from:u.from,to:u.to,options:f}},[r,t]),i=o.useCallback(d=>{a(d)},[a]),c=o.useMemo(()=>[Os,Ms(),Ps({override:[l]})],[l]);return e.jsx(Bs,{value:s,height:"126px",extensions:c,onChange:i,className:"rounded-md border",theme:n?qs:"light"})}const Wa=o.memo(Ra),Ka=o.memo(aa);function Ya(){const{tables:t,selectedTable:s,tableSchemas:a,queryError:r,setQueryError:n,rowPerPageOrAuto:l,isCustomQuery:i,customQuery:c,setIsCustomQuery:d,setCustomQuery:u,expandPage:f,setExpandPage:x,filters:g,setFilters:p,databaseData:y}=h(),{page:N,setPage:w,rowsPerPage:C}=Js(l),S=o.useMemo(()=>{var k;return(k=t[Number.parseInt(s)])==null?void 0:k.name},[t,s]),{data:D,columns:E,isQueryLoading:A,handleCustomQuery:P}=Xs(S,C,N),[v,H]=o.useState([]);o.useEffect(()=>{E.length>0&&H(E)},[E]);const j=o.useCallback(()=>{n(null),u(""),d(!1)},[d,n,u]),R=o.useCallback(()=>{function k(U){try{return Lt(U,{language:"sqlite",useTabs:!1,keywordCase:"upper",tabWidth:2,expressionWidth:100,linesBetweenQueries:1})}catch{return U}}const ne=k(c);u(ne)},[c,u]);o.useEffect(()=>{w(0),p({})},[s]),o.useEffect(()=>{w(0)},[g]);const B=o.useMemo(()=>e.jsx(Zs,{type:"single",collapsible:!0,className:"w-full rounded-lg bg-background px-3",children:e.jsxs(qe,{value:"item-1",children:[e.jsx(Ue,{className:"text-xs",children:"Execute Query"}),e.jsxs($e,{className:"flex flex-col gap-[6px]",children:[e.jsx("div",{className:"flex-grow",children:e.jsx(_a,{columnNames:v})}),e.jsxs("div",{className:"flex flex-row gap-1 md:gap-2",children:[e.jsx(b,{className:"grow",variant:"secondary",onClick:P,title:"Run custom query",children:e.jsx(ws,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:j,title:"Remove query",children:e.jsx(Cs,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:R,title:"Format SQL",children:e.jsx(Oe,{className:"h-5 w-5"})})]})]})]})}),[P,j,R,N,v]),q=o.useMemo(()=>A?e.jsxs(K,{type:"loading",children:["Loading ",S]}):e.jsx("div",{className:"mb-[40px] overflow-hidden rounded-lg border border-gray-200 dark:border dark:border-gray-700",children:e.jsx(Ha,{data:D,columns:v.length>0?v:E,tableName:S,tableSchemas:a})}),[A,D,E,S,a,v]),V=o.useMemo(()=>e.jsx(Ka,{}),[]);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 pb-8",children:[e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[y.name,", (",y.sizeAsString,")"]}),e.jsxs("section",{className:"rounded-lg bg-gray-100 p-4 shadow-sm dark:bg-gray-700",children:[e.jsxs("div",{className:"mb-[5px] flex items-center justify-between gap-[6px] pb-[3px]",children:[e.jsx(Wa,{}),e.jsxs("div",{className:"g-1 flex items-center justify-center gap-1",children:[V,e.jsx(b,{className:"hidden expand:block",onClick:()=>x(!f),title:"Toggle page size",children:f?e.jsx(Es,{className:"h-5 w-5"}):e.jsx(vs,{className:"h-5 w-5"})}),e.jsx(et,{}),e.jsx(xa,{})]})]}),B,r&&e.jsx("p",{className:"mt-2 text-center text-sm text-red-500 dark:text-red-400",children:r})]}),q,!i&&e.jsx(ba,{page:N,setPage:w,rowsPerPage:C})]})})}const Xa=o.memo(Ya),Ja={"application/vnd.sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/x-sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/octet-stream":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sql":[".sql"],"application/x-sql":[".sql"],"text/x-sql":[".sql"],"text/sql":[".sql"],"text/x-sqlite3":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite3-dump":[".sql"],"text/x-sqlite-dump":[".sql"],"text/sqlite-dump":[".sql"]};function Za(){const{loadDatabaseBytes:t,setDatabaseData:s}=h(),[a,r]=o.useState([]),n=o.useCallback(async(u,f)=>{if(f.length>0){const x=f.flatMap(g=>g.errors);r(x);return}if(u.length>0)try{const x=u[0],g=new Uint8Array(await x.arrayBuffer());s({name:x.name,size:x.size}),await t(g)}catch(x){return x instanceof Error?L(x.message,{position:"bottom-right"}):L("Failed to load database",{position:"bottom-right"})}},[t,s]),{getRootProps:l,getInputProps:i,isDragActive:c}=Us({onDrop:n,multiple:!1,accept:Ja}),d=o.useMemo(()=>e.jsx("div",{className:"flex w-full items-center justify-between gap-2",children:e.jsxs("div",{...l(),className:`flex w-full grow transform cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed bg-gray-100/50 p-6 transition-colors duration-300 ease-in-out hover:bg-secondary dark:bg-gray-700/50 ${c?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-primary py-12 dark:border-gray-700"}`,children:[e.jsx("input",{id:"file-upload",...i()}),e.jsx("label",{htmlFor:"file-upload",className:"sr-only",children:"Upload SQLite File"}),e.jsxs("div",{className:"text-center text-sm md:text-base",children:[e.jsx("span",{className:"hidden sm:block lg:text-lg",children:"Drag and drop file here, or click to select one"}),e.jsx("div",{className:"block sm:hidden",children:e.jsx("span",{className:"text-lg font-medium",children:"Click to select a SQLite file"})})]})]})}),[l,i,c]);return e.jsxs("section",{className:"mx-auto w-full",children:[d,e.jsx(er,{errors:a})]})}const er=o.memo(({errors:t})=>(o.useEffect(()=>{if(t)for(const s of t)L(s.message,{position:"bottom-right"})},[t]),null));function tr(){return e.jsx("header",{className:"rounded bg-gradient-to-r shadow-md dark:from-gray-800 dark:to-indigo-900",children:e.jsx("div",{className:"mx-auto max-w-4xl px-4 py-8 sm:py-12",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold sm:text-3xl",children:"SQLite Viewer"}),e.jsx("p",{className:"max-w-md text-sm sm:text-base",children:"Explore and analyze your SQLite databases directly in your browser"})]})})})}function sr(){return e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"rounded bg-gradient-to-r py-6 shadow-md dark:from-gray-800 dark:to-indigo-900 md:py-10",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsx("div",{children:e.jsxs("div",{className:"grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(M,{icon:Rs,title:"Browser Based",description:"No installation required. Access and analyze your SQLite databases directly in your web browser."}),e.jsx(M,{icon:Ts,title:"Lightning Fast",description:"Powered by WebAssembly (WASM) for near-native performance, even with large databases."}),e.jsx(M,{icon:Ss,title:"100% Secure",description:"Your data never leaves your device. All processing happens client-side, ensuring complete privacy."}),e.jsx(M,{icon:Me,title:"Customizable Interface",description:"Different themes and settings. Adjust the look and feel of your interface to suit your preferences and workflow."}),e.jsx(M,{icon:As,title:"Offline Capable",description:"Work on your databases without an internet connection. Perfect for sensitive data or remote work."}),e.jsx(M,{icon:Ls,title:"PWA Support",description:"Install the app on your desktop or mobile device for a genuine native experience. Enjoy robust offline functionality."})]})})})}),e.jsx("div",{className:"pb-[72px] md:pb-0"})]})}function M({icon:t,title:s,description:a}){return e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(t,{className:"h-6 w-6 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"mt-1 text-sm",children:a})]})]})}const ar=Kt,rr=Yt,pt=o.forwardRef(({className:t,...s},a)=>e.jsx(Se,{className:m("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));pt.displayName=Se.displayName;const gt=o.forwardRef(({className:t,...s},a)=>e.jsxs(rr,{children:[e.jsx(pt,{}),e.jsx(Ae,{ref:a,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));gt.displayName=Ae.displayName;const ht=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col space-y-2",t),...s});ht.displayName="AlertDialogHeader";const bt=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});bt.displayName="AlertDialogFooter";const yt=o.forwardRef(({className:t,...s},a)=>e.jsx(Le,{ref:a,className:m("text-lg font-semibold",t),...s}));yt.displayName=Le.displayName;const Nt=o.forwardRef(({className:t,...s},a)=>e.jsx(De,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Nt.displayName=De.displayName;const jt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ie,{ref:a,className:m(se(),t),...s}));jt.displayName=Ie.displayName;const wt=o.forwardRef(({className:t,...s},a)=>e.jsx(Fe,{ref:a,className:m(se({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));wt.displayName=Fe.displayName;const or=o.memo(gt);function nr({showDialog:t,setShowDialog:s,onConfirm:a}){const r=o.useCallback(()=>{s(!1)},[s]);return e.jsx(ar,{open:t,onOpenChange:s,children:e.jsxs(or,{children:[e.jsxs(ht,{children:[e.jsx(yt,{children:"Use Proxy to Load Database?"}),e.jsx(Nt,{children:"We couldn't load the database from the provided URL due to CORS restrictions. Would you like to try using a proxy?"})]}),e.jsx("div",{className:"font-semibold text-yellow-600 md:text-left",children:"Warning: Using the proxy will route your database traffic through cors.eu.org."}),e.jsxs(bt,{children:[e.jsx(wt,{onClick:r,children:"Cancel"}),e.jsx(jt,{onClick:a,children:"Use Proxy"})]})]})})}const lr=/^(https?:\/\/(?:www\.)?[a-zA-Z0-9-]{1,256}\.[a-zA-Z]{2,6}(?:\/[^\s]*)?)$/i,ir="https://cors.eu.org";function cr(){const{db:t,isLoading:s,loadDatabaseBytes:a,setDatabaseData:r}=h(),[n,l]=o.useState(null),[i,c]=o.useState(!1),[d,u]=o.useState(null),[f,x]=o.useState(!1),g=o.useRef(!1),p=o.useCallback(async(N,w=!1)=>{if(!lr.test(N)){l("Invalid URL");return}try{x(!0);const C=w?`${ir}/${encodeURIComponent(N)}`:N,S=await fetch(C);if(!S.ok)throw new Error("URL not found or invalid");const D=await S.blob(),E=new File([D],"database.sqlite"),A=new Uint8Array(await E.arrayBuffer());r({name:E.name,size:E.size}),await a(A),l(null)}catch(C){w?l(`Error while fetching, ${C instanceof Error?C.message:String(C)}`):(u(N),c(!0))}finally{x(!1)}},[a,r]);o.useEffect(()=>{if(g.current)return;const w=new URLSearchParams(window.location.search).get("url");w&&(p(decodeURIComponent(w)),g.current=!0)},[p]);const y=o.useCallback(()=>{d&&(p(d,!0),c(!1))},[d,p]);return s||f?e.jsxs(K,{type:"loading",children:[f?"Fetching":"Loading"," SQLite file"]}):n&&!t?e.jsx(K,{type:"error",children:n}):e.jsx(e.Fragment,{children:i&&e.jsx(nr,{showDialog:i,setShowDialog:c,onConfirm:y},"proxy-message")})}function dr(){return e.jsx("footer",{className:"fixed bottom-0 left-0 right-0 border-t bg-background shadow-md",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between py-4 md:py-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sms hidden sm:block",children:"No file will be uploaded to server. Using JavaScript, sql.js"}),e.jsx("p",{className:"text-sm sm:hidden",children:"No file uploads to server."})]}),e.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-2 text-blue-500",title:"Star on GitHub",children:[e.jsx(Ds,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium hover:underline",children:"Star us on GitHub"})]})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx(et,{})})]})})})}const mr=o.memo(Xa),ur=o.memo(Za),fr=o.memo(cr);function xr(){const{db:t,expandPage:s}=h();return e.jsxs("main",{className:`mx-auto flex h-screen flex-col ${t?"gap-3":"gap-4"} p-4 ${s?"w-full":"container"}`,children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(tr,{})," ",e.jsx(ur,{})," ",e.jsx(fr,{}),e.jsx(sr,{}),e.jsx(dr,{})]}),t&&e.jsx(mr,{isDatabaseLoaded:t})]})}const pr=({...t})=>e.jsx(Is,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-gray-100 p-2 dark:group-[.toaster]:bg-gray-700 text-lg p-4 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t});Tt.createRoot(document.getElementById("root")).render(e.jsxs(Rt.StrictMode,{children:[e.jsx(xr,{}),e.jsx(pr,{})]})); diff --git a/assets/index-CCxazG49.js.gz b/assets/index-CCxazG49.js.gz deleted file mode 100644 index 483be272acbe86d7612682ca31b7a22c8e8af34d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14996 zcmV;FI%~xriwFP!000021MPilbK5$y;OCuR!LTwOat4%T=W%l6%Xnm2PL%i+NzO~7 z8$%={(WXcSfGjDB{`*z~;G44Jb7t=DR&ABb6hS;1jRw%@7ra>%Qog1dW?G1D;6YFq z9$mf}({QHOb}7LQw~l8~=WKC&R=Z*PfhUVOkg;FL=!P?^bwgi%8NYv3%G^sb|Clq5 z1J^o=KDAoGmu@zz2U(j*R`%Vm-7u>){l?FJ`z^@kJb|2J66YLyKCu|SBh)&cj=tW# z3Egb&G2}kY)@zMJI>Ve3Y8{1NU+ufm^K5|*6gcMSEj&9Mi9Rd|a^V>fMBsVCQ4gNC z9Ek=lIGVt7LeLbRXB>$RU2=)wDM7dJ91-Nhb4Ab$o<|%7@H{6dgy(mTB6!{q^c|iH zg2Xsoam3)+BIqMLpK^2x&o)6Eo_7Sz;rW51J9z%!Xdy~^k+Z=&Kl2CaI#wBvmw-q>57}sp6Q$2=(WV=MqcK;@+#T&701V zRT`+T={RA=tUF9S95}?nb3P5J$5+m4qWP-bq?yVGs~%wU%$b1*7(l zY=L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RwK7cgDQScoBA(VnsckRqqj=S1RE5J~4U4jWs}xmb|ik%(kcDwB!tT~%8-+_#P# z!JKcePe7pk5^S3dl7o8C=PEKC*sr9%j1$7!K7pS{tBz~v6rwAdW{nb91q?;1U0&;n ev(s7VR@~IM%#vRelb?C;m;VjckWQuLxc~qj!6r)p diff --git a/assets/index-Cr9yX2c0.js b/assets/index-Cr9yX2c0.js new file mode 100644 index 0000000..97f5da8 --- /dev/null +++ b/assets/index-Cr9yX2c0.js @@ -0,0 +1,7 @@ +import{r as o,j as e,R as Rt}from"./react-DmpIMwDM.js";import{c as Tt}from"./react-dom-Cjr6YfK8.js";import{c as St}from"./zustand-BpWCCnYR.js";import{i as At}from"./sql.js-Ch_tM77n.js";import{F as fe}from"./file-saver-DhbZvGod.js";import{f as Lt}from"./sql-formatter-BoZ82dp4.js";import{I as Dt,H as It,c as xe,d as pe,e as Ft,S as kt,f as Ot,g as ge,h as Mt,i as Pt,j as he,k as be,l as ye,m as Bt,n as je,o as qt,p as Ne,q as we,r as Ut,s as Ce,V as $t,L as Ee,t as ve,u as Qt,v as zt,w as Re,x as Ht,G as Vt,y as Gt,z as Te,A as _t,B as Wt,E as Se,F as Ae,J as Le,K as De,M as Ie,N as Fe,Q as Kt,U as Yt}from"./@radix-ui-BQVY8FyZ.js";import{c as Xt}from"./clsx-B-dksMZM.js";import{t as Jt}from"./tailwind-merge-BkWO730n.js";import{C as Z,L as Zt,I as es,a as ts,T as ss,F as as,b as rs,R as os,c as ke,P as Oe,S as Me,d as ns,M as ls,e as is,f as cs,g as ds,h as ms,A as us,i as fs,j as xs,K as ps,k as gs,l as hs,m as bs,H as ys,n as js,o as Ns,p as ws,q as Cs,r as Es,s as vs,G as Rs,Z as Ts,t as Ss,u as As,v as Ls,w as Ds}from"./lucide-react-S8ZAjIB-.js";import{c as ee}from"./class-variance-authority-Bb4qSo10.js";import{J as D,T as Is}from"./sonner-CxG_nbEz.js";import{D as R}from"./vaul-OrZLygqJ.js";import{p as Pe,i as Be,f as Fs,a as ks}from"./date-fns-BAPXOope.js";import{G as Os,I as Ms,t as Ps}from"./@codemirror-CCjSF3Vf.js";import{R as Bs,n as qs}from"./@uiw-CvcbIrPa.js";import{u as Us}from"./react-dropzone-D-IBOhIS.js";import"./attr-accept-BWI1aNlo.js";import"./scheduler-CzFDRTuY.js";import"./use-sync-external-store-ByYeed7R.js";import"./nearley-CG12bGQB.js";import"./aria-hidden-DQ5UC2Eg.js";import"./react-remove-scroll-BOyN_WUU.js";import"./tslib-CuZy2iRz.js";import"./react-remove-scroll-bar-DZjhPxUV.js";import"./react-style-singleton-CpxBwIWS.js";import"./get-nonce-C-Z93AgS.js";import"./use-sidecar-D8_hMcUG.js";import"./use-callback-ref-DRzK4jWO.js";import"./@floating-ui-Bob4LHZu.js";import"./@lezer-DgLl1T_N.js";import"./crelt-C8TCjufn.js";import"./style-mod-Bc2inJdb.js";import"./w3c-keyname-Vcq4gwWv.js";import"./@babel-BjXSgPXB.js";import"./prop-types-psm7UO16.js";import"./file-selector-CBHVlu32.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(n){if(n.ep)return;n.ep=!0;const l=a(n);fetch(n.href,l)}})();const $s="/sql.wasm";let _;const Qs=async()=>(_||(_=await At({locateFile:()=>$s})),_),zs=async t=>{try{const s=await Qs();return new s.Database(t)}catch(s){throw console.error("Failed to load database:",s),s}},te=t=>{try{const s=t.prepare("SELECT name FROM sqlite_master WHERE type='table';"),a=[];for(;s.step();)a.push(s.get()[0]);return s.free(),a}catch{throw new Error("Invalid database file")}},Hs=(t,s)=>{try{const a={},r=t.prepare(`PRAGMA table_info("${s}");`);for(;r.step();){const l=r.getAsObject();a[l.name]={type:l.type?l.type.toUpperCase():l.type,isPrimaryKey:l.pk===1,isForeignKey:!1,nullable:l.notnull===0}}r.free();const n=t.prepare(`PRAGMA foreign_key_list("${s}");`);for(;n.step();){const l=n.getAsObject();a[l.from]&&(a[l.from].isForeignKey=!0)}return n.free(),a}catch(a){throw console.error(`Failed to get schema for table "${s}":`,a),a}},le=t=>{if(t.length===0)return{data:[],columns:[]};const{columns:s,values:a}=t[0];return{data:a.map(n=>Object.fromEntries(s.map((l,i)=>[l,n[i]]))),columns:s}},Vs=t=>{try{const s=t.export(),a=new Blob([s],{type:"application/x-sqlite3"});fe.saveAs(a,"database.sqlite")}catch(s){throw console.error("Failed to export database:",s),s}},Gs=(t,s)=>{const a=t.map(n=>`"${n}"`).join(","),r=s.map(n=>t.map(l=>`"${n[l]??""}"`).join(","));return[a,...r].join(` +`)},se=(t,s,a)=>{try{const r=s.prepare(t),n=r.getColumnNames(),l=[];for(;r.step();){const d=r.getAsObject();l.push(d)}if(r.free(),l.length===0)throw new Error(`Query "${t}" returned no results.`);const i=Gs(n,l),c=new Blob([i],{type:"text/csv;charset=utf-8;"});fe.saveAs(c,`${a}.csv`)}catch(r){throw console.error(`Failed to get CSV for query "${t}":`,r),r}},_s=(t,s)=>{const r=te(t)[s],n=`SELECT * FROM "${r}"`;se(n,t,r)},Ws=t=>{const s=te(t);for(const a of s)try{const r=`SELECT * FROM "${a}"`;se(r,t,a)}catch(r){throw console.error(`Failed to get CSV for table "${a}":`,r),r}},Ks=(t,s)=>{se(s,t,"custom_query")},ie=["Bytes","KB","MB","GB","TB"];function Ys(t){let s=0;for(;t>=1024&&s({db:null,isLoading:!1,loadDatabaseBytes:async a=>{t({isLoading:!0});try{const r=await zs(a),n=te(r),l=await Promise.all(n.map(async d=>{const u=r.exec(`SELECT COUNT(*) FROM "${d}"`),f=Number.parseInt(u[0].values[0][0],10),x=await Hs(r,d);return{name:d,count:f,schema:x}})),i=l.map(({name:d,count:u})=>({name:d,count:u})),c=l.reduce((d,{name:u,schema:f})=>(d[u]=f,d),{});t({db:r,tables:i,tableSchemas:c,isLoading:!1})}catch(r){throw t({isLoading:!1}),r}},tables:[],setTables:a=>t({tables:a}),selectedTable:"0",setSelectedTable:a=>t({selectedTable:a}),tableSchemas:{},customQuery:"",setIsCustomQuery:a=>t({isCustomQuery:a}),setCustomQuery:a=>t({customQuery:a}),isCustomQuery:!1,queryError:null,setQueryError:a=>t({queryError:a}),query:a=>{const{db:r}=s();return r?r.exec(a):(console.warn("Database is not loaded."),[])},rowPerPageOrAuto:"auto",setRowPerPageOrAuto:a=>t({rowPerPageOrAuto:a}),queryHistory:[],unShiftToQueryHistory:a=>t(r=>({queryHistory:[a,...r.queryHistory]})),expandPage:!1,setExpandPage:a=>t({expandPage:a}),dateFormatValue:"formatDateFormatted",setDateFormatValue:a=>t({dateFormatValue:a}),filters:{},setFilters:a=>t({filters:a}),appendToFilters:(a,r)=>t(n=>({filters:{...n.filters,[a]:r}})),filtersNeedClear:!1,setFiltersNeedClear:a=>t({filtersNeedClear:a}),totalRows:0,setTotalRows:a=>t({totalRows:a}),orderBy:{column:null,direction:"ASC"},setOrderBy:(a,r)=>t({orderBy:{column:a,direction:r}}),databaseData:{name:"database.db",size:0,sizeAsString:"0 Bytes"},setDatabaseData:a=>{t({databaseData:{...a,sizeAsString:Ys(a.size)}})}}));function Xs(t,s,a){const{db:r,setQueryError:n,setIsCustomQuery:l,query:i,unShiftToQueryHistory:c,customQuery:d,setCustomQuery:u,filters:f,totalRows:x,setTotalRows:p,orderBy:g,selectedTable:y,tables:j}=h(),[w,C]=o.useState([]),[S,I]=o.useState([]),[E,A]=o.useState(!0),M=o.useMemo(()=>Object.fromEntries(Object.entries(f).filter(([,N])=>N!=="")),[f]),T=o.useMemo(()=>Object.entries(M).map(([N,v])=>`LOWER(${N}) LIKE LOWER('%${v}%')`).join(" AND "),[M]);o.useEffect(()=>{if(!r||!t)return;(async()=>{A(!0);try{const v=`PRAGMA table_info("${t}");`,H=i(v)[0].values.map(F=>({name:F[1],type:F[2]})).map(F=>F.type.toUpperCase()==="BLOB"?`hex(${F.name}) as ${F.name}`:F.name).join(", "),V=`SELECT COUNT(*) as count FROM "${t}"${T?` WHERE ${T}`:""}`,G=i(V)[0].values[0][0];p(G);let L=`SELECT + ${H} +FROM "${t}"`;T&&(L+=` +WHERE ${T}`),g.column&&(L+=` +ORDER BY "${g.column}" ${g.direction}`),L+=` +LIMIT ${s} OFFSET ${a};`;const Ct=i(L),{data:Et,columns:vt}=le(Ct);I(vt),C(Et),n(null),u(L),c(L)}catch(v){v instanceof Error&&n(v.message)}finally{A(!1)}})()},[r,t,a,s,T,g,i,n,u,c,p]);const z=o.useCallback(()=>{if(d.trim()===""){n(null);return}A(!0);try{const N=j[Number.parseInt(y)].name,v=i(d.replace("@",`"${N}"`)),{data:B,columns:q}=le(v);I(q),C(B),l(!0),n(null)}catch(N){N instanceof Error&&n(N.message)}finally{A(!1)}},[d,i,n,l,j,y]);return{data:w,columns:S,customQuery:d,setCustomQuery:u,isQueryLoading:E,handleCustomQuery:z,totalRows:x}}function Js(t){const{setIsCustomQuery:s}=h(),[a,r]=o.useState(0);o.useEffect(()=>{r(0),s(!1)},[s]);const n=o.useMemo(()=>{if(t!=="auto")return t;const l=window.innerHeight,u=Math.min(2e3,40+l*.03),f=Math.max(1,Math.floor(l/u));return Math.min(Math.max(f,5),50)},[t]);return{page:a,setPage:r,rowsPerPage:n}}function m(...t){return Jt(Xt(t))}const Zs=Ft,qe=o.forwardRef(({className:t,...s},a)=>e.jsx(Dt,{ref:a,className:m("border-b",t),...s}));qe.displayName="AccordionItem";const Ue=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(It,{className:"flex",children:e.jsxs(xe,{ref:r,className:m("flex flex-1 items-center justify-between py-3 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Ue.displayName=xe.displayName;const $e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsx(pe,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:m("pb-4 pt-0",t),children:s})}));$e.displayName=pe.displayName;const ae=ee("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),b=o.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},l)=>{const i=r?kt:"button";return e.jsx(i,{className:m(ae({variant:s,size:a,className:t})),ref:l,...n})});b.displayName="Button";const ea=o.memo(Zt);function Y({type:t,children:s,className:a=""}){let r,n;switch(t){case"error":r=e.jsx(ss,{className:"mr-3 h-6 w-6 text-red-500"}),n="bg-red-100 text-red-800 border-l-4 border-red-500";break;case"loading":{r=e.jsx(ea,{className:"mr-3 h-6 w-6 animate-spin text-blue-500"}),n="bg-blue-100 text-blue-800 border-l-4 border-blue-500";break}case"success":r=e.jsx(ts,{className:"mr-3 h-6 w-6 text-green-500"}),n="bg-green-100 text-green-800 border-l-4 border-green-500";break;case"info":r=e.jsx(es,{className:"mr-3 h-6 w-6 text-yellow-500"}),n="bg-yellow-100 text-yellow-800 border-l-4 border-yellow-500";break;default:r=null,n=""}return e.jsxs("div",{className:`flex items-center rounded-lg p-4 shadow-md ${n} ${a}`,children:[r,e.jsx("span",{className:"font-medium",children:s})]})}const ta=Mt,sa=Pt,Qe=o.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Ot,{children:e.jsx(ge,{ref:n,align:s,sideOffset:a,className:m("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",t),...r})}));Qe.displayName=ge.displayName;function aa(){const{selectedTable:t,customQuery:s,db:a}=h(),r=o.useMemo(()=>a&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(U,{onClick:()=>{try{Vs(a)}catch{D.error("Failed to download database")}},label:"Export as SQLite",title:"Download database as SQLite"}),e.jsx(U,{onClick:()=>{try{_s(a,Number.parseInt(t))}catch{D.error("Failed to export selected table as CSV")}},label:"Export selected table as CSV"}),e.jsx(U,{onClick:()=>{try{Ws(a)}catch{D.error("Failed to export all tables as CSV")}},label:"Export all tables as CSV"}),e.jsx(U,{onClick:()=>{try{Ks(a,s)}catch{D.error("Failed to export custom query as CSV")}},label:"Export custom query as CSV",title:"Export the result of the custom query as CSV"})]}),[a,t,s]);return e.jsxs(ta,{children:[e.jsx(sa,{asChild:!0,children:e.jsx(b,{title:"Open export options",children:e.jsx(as,{className:"h-5 w-5"})})}),e.jsx(Qe,{align:"end",className:"w-80",children:r})]})}function U({onClick:t,label:s,className:a,title:r}){return e.jsx(b,{className:a,onClick:t,title:r??s,children:e.jsx("span",{className:"ml-2",children:s})})}const ze=(t,s)=>localStorage.getItem(t)||s,He=(t,s)=>localStorage.setItem(t,s),ce=(t,s)=>{const[a,r]=o.useState(()=>ze(t,s));return o.useEffect(()=>{He(t,a)},[t,a]),[a,r]},Ve=({shouldScaleBackground:t=!0,...s})=>e.jsx(R.Root,{shouldScaleBackground:t,...s});Ve.displayName="Drawer";const ra=R.Trigger,oa=R.Portal,na=R.Close,Ge=o.forwardRef(({className:t,...s},a)=>e.jsx(R.Overlay,{ref:a,className:m("fixed inset-0 z-50 bg-black/80",t),...s}));Ge.displayName=R.Overlay.displayName;const _e=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(oa,{children:[e.jsx(Ge,{}),e.jsxs(R.Content,{ref:r,className:m("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",t),...a,children:[e.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),s]})]}));_e.displayName="DrawerContent";const We=({className:t,...s})=>e.jsx("div",{className:m("grid gap-1.5 p-4 text-center sm:text-left",t),...s});We.displayName="DrawerHeader";const Ke=({className:t,...s})=>e.jsx("div",{className:m("mt-auto flex flex-col gap-2 pb-4",t),...s});Ke.displayName="DrawerFooter";const Ye=o.forwardRef(({className:t,...s},a)=>e.jsx(R.Title,{ref:a,className:m("text-lg font-semibold leading-none tracking-tight",t),...s}));Ye.displayName=R.Title.displayName;const Xe=o.forwardRef(({className:t,...s},a)=>e.jsx(R.Description,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));Xe.displayName=R.Description.displayName;const W=t=>s=>{const a=Pe(s);return Be(a)?Fs(a,t):s},la=t=>{const s=Pe(t);return Be(s)?ks(s,{addSuffix:!0}):t},X={formatDateRelative:{label:"Over 56 years ago",func:la},formatDateFormatted:{label:"January 9th, 1968",func:W("MMMM do, yyyy")},formatDateLong:{label:"1968/09/01",func:W("yyyy/MM/dd")},formatDateShort:{label:"01/09/1968",func:W("MM/dd/yyyy")}},ia=ee("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Je=o.forwardRef(({className:t,...s},a)=>e.jsx(he,{ref:a,className:m(ia(),t),...s}));Je.displayName=he.displayName;const re=o.forwardRef(({className:t,...s},a)=>e.jsx(be,{className:m("grid gap-2",t),...s,ref:a}));re.displayName=be.displayName;const Ze=o.forwardRef(({className:t,...s},a)=>e.jsx(ye,{ref:a,className:m("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Bt,{className:"flex items-center justify-center",children:e.jsx(rs,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ze.displayName=ye.displayName;const oe=o.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:m("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...a}));oe.displayName="Input";const $=({value:t,label:s})=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{value:t,id:`r-${t}`}),e.jsx(Je,{htmlFor:`r-${t}`,children:s})]}),ca=({rowsPerPage:t,onRowsPerPageChange:s})=>{const a=t==="auto";return e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(os,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Rows Per Page"})]}),e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:[e.jsx(oe,{id:"rowsPerPage",value:a?"":t,onChange:r=>s(r.target.value),placeholder:"Number of rows",type:"number",className:"w-full",autoFocus:!1}),e.jsx(b,{variant:"outline",onClick:()=>s("auto"),className:"w-full whitespace-nowrap",children:"Auto Calculate"})]})]})},da=({dateFormatValue:t,onDateFormatChange:s})=>e.jsxs("div",{className:"flex h-full grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Date Format"})]}),e.jsx("div",{className:"h-full rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",children:e.jsxs(re,{className:"flex h-full flex-col gap-2",name:"dateType",value:t,onValueChange:s,children:[e.jsx($,{value:"default",label:"Default"}),Object.entries(X).map(([a,{label:r}])=>e.jsx($,{value:a,label:r},a))]})})]}),ma=({themeColor:t,onThemeColorChange:s,themeColors:a})=>e.jsxs("div",{className:"flex grow flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("p",{className:"text-sm font-medium",children:"Theme Color"})]}),e.jsxs(re,{className:"flex flex-col gap-2 rounded border bg-gray-100/50 p-2 dark:bg-gray-700/50",name:"themeColor",value:t,onValueChange:s,children:[e.jsx($,{value:"default",label:"Default"}),a.map(r=>e.jsx($,{value:r,label:r[0].toUpperCase()+r.slice(1)},r))]})]}),ua="rowsPerPage",de="dateFormat",fa="theme-color",me=["nord","zinc"],xa=o.memo(function(){const{setRowPerPageOrAuto:s,setIsCustomQuery:a,dateFormatValue:r,setDateFormatValue:n}=h(),[l,i]=ce(ua,"auto"),[c,d]=ce(fa,"default"),u=l==="auto";o.useEffect(()=>{s(u?"auto":Number(l))},[l,s,u]),o.useEffect(()=>{n(ze(de,"default"))},[n]),o.useEffect(()=>{var g;for(const y of me)(g=document.body)==null||g.classList.toggle(y,y===c)},[c]);const f=o.useCallback(g=>{a(!1),g==="auto"||Number(g)>0?i(g):D.error("Please provide a positive number of rows per page or set it to auto.")},[a,i]),x=o.useCallback(g=>{n(g),He(de,g)},[n]),p=o.useCallback(g=>{d(g)},[d]);return e.jsxs(Ve,{children:[e.jsx(ra,{asChild:!0,children:e.jsx(b,{className:"grow",title:"Open settings drawer",children:e.jsx(Me,{className:"h-5 w-5"})})}),e.jsxs(_e,{children:[e.jsxs(We,{className:"hidden",children:[e.jsx(Ye,{children:"Settings"}),e.jsx(Xe,{children:"Change settings."})]}),e.jsxs("div",{className:"mx-auto flex w-full max-w-sm flex-col gap-3",children:[e.jsx(ca,{rowsPerPage:l,onRowsPerPageChange:f}),e.jsx(ma,{themeColor:c,onThemeColorChange:p,themeColors:me}),e.jsx(da,{dateFormatValue:r,onDateFormatChange:x}),e.jsx(Ke,{children:e.jsx(na,{asChild:!0,children:e.jsx(b,{variant:"outline",children:"Cancel"})})})]})]})]},"settings-drawer")}),K="theme-mode",ue="animate-circular-reveal";function pa(){const[t,s]=o.useState(()=>{const l=localStorage.getItem(K),i=window.matchMedia("(prefers-color-scheme: dark)").matches;return l||(i?"dark":"light")}),a=o.useCallback(l=>{s(l),document.body.classList.remove("light","dark"),document.body.classList.add(l),localStorage.setItem(K,l),document.body.classList.add(ue),setTimeout(()=>{document.body.classList.remove(ue)},500)},[]);o.useEffect(()=>{const l=c=>{localStorage.getItem(K)||a(c.matches?"dark":"light")},i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",l),a(t),()=>{i.removeEventListener("change",l)}},[a,t]);const r=o.useCallback(()=>{a(t==="light"?"dark":"light")},[t,a]);return o.useMemo(()=>e.jsx(b,{className:"relative grow",onClick:r,title:t==="dark"?"Enable light mode":"Enable dark mode",children:t==="dark"?e.jsx(ns,{className:"h-5 w-5"}):e.jsx(ls,{className:"h-5 w-5"})}),[t,r])}const et=o.memo(pa),ga=o.memo(is),ha=o.memo(cs);function ba({page:t,setPage:s,rowsPerPage:a}){const{totalRows:r}=h(),n=o.useMemo(()=>Math.ceil(r/a),[r,a]),l=o.useMemo(()=>Math.ceil(t/a)+1,[t,a]),i=l1,d=o.useCallback(()=>{i&&s(f=>f+a)},[i,a,s]),u=o.useCallback(()=>{c&&s(f=>f-a)},[c,a,s]);return e.jsx("section",{className:"fixed bottom-2 left-1/2 z-10 w-[270px] -translate-x-1/2 transform",children:e.jsxs("div",{className:"flex justify-between gap-2 rounded border bg-secondary p-[6px]",children:[e.jsx(b,{onClick:u,title:"Previous page",disabled:!c,children:e.jsx(ga,{className:"h-4 w-4"})}),e.jsxs("span",{className:"flex items-center justify-center text-sm",children:["Page ",l," of ",n]}),e.jsx(b,{onClick:d,title:"Next page",disabled:!i,children:e.jsx(ha,{className:"h-4 w-4"})})]})})}const ya=Ht,ja=Vt,Na=Gt,wa=o.memo(Z),tt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(je,{ref:r,className:m("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(qt,{asChild:!0,children:e.jsx(wa,{className:"h-4 w-4 opacity-50"})})]}));tt.displayName=je.displayName;const st=o.forwardRef(({className:t,...s},a)=>e.jsx(Ne,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ds,{className:"h-4 w-4"})}));st.displayName=Ne.displayName;const at=o.forwardRef(({className:t,...s},a)=>e.jsx(we,{ref:a,className:m("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Z,{className:"h-4 w-4"})}));at.displayName=we.displayName;const rt=o.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(Ut,{children:e.jsxs(Ce,{ref:n,className:m("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(st,{}),e.jsx($t,{className:m("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(at,{})]})}));rt.displayName=Ce.displayName;const ot=o.forwardRef(({className:t,...s},a)=>e.jsx(Ee,{ref:a,className:m("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));ot.displayName=Ee.displayName;const nt=o.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ve,{ref:r,className:m("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Qt,{children:e.jsx(ms,{className:"h-4 w-4"})})}),e.jsx(zt,{children:s})]}));nt.displayName=ve.displayName;const Ca=o.forwardRef(({className:t,...s},a)=>e.jsx(Re,{ref:a,className:m("-mx-1 my-1 h-px bg-muted",t),...s}));Ca.displayName=Re.displayName;const Ea=ee("inline-flex items-center rounded border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Q({className:t,variant:s,...a}){return e.jsx("div",{className:m(Ea({variant:s}),t),...a,children:e.jsx("span",{className:"w-full",children:a.children})})}function va(){const{tables:t,selectedTable:s,setSelectedTable:a,setIsCustomQuery:r}=h(),n=o.useMemo(()=>{var d;const c=Number.parseInt(s);return Number.isNaN(c)?0:((d=t[c])==null?void 0:d.count)||0},[t,s]),l=o.useMemo(()=>t.map((c,d)=>e.jsx(nt,{value:`${d}`,children:c.name[0].toUpperCase()+c.name.slice(1)},c.name)),[t]);function i(c){r(!1),a(c)}return e.jsxs("section",{className:"flex grow items-center justify-center gap-1",children:[e.jsxs(ya,{value:s,onValueChange:i,children:[e.jsx(tt,{className:"grow",children:e.jsx(Na,{placeholder:"Select a table"})}),e.jsx(rt,{children:e.jsxs(ja,{children:[e.jsx(ot,{children:"Tables"}),l]})})]}),e.jsx(Q,{title:"Rows",className:"hidden min-w-[100px] grow bg-background py-2 text-center text-sm md:block md:min-w-[200px]",variant:"outline",children:e.jsx("span",{className:"w-full text-center",children:n})})]})}const Ra=o.memo(va),Ta={DATE:/DATE|TIMESTAMP/i,BLOB:/^BLOB$/i,TEXT:/CHAR|TEXT|CLOB|VARCHAR/i,INTEGER:/INT/i,REAL:/REAL|FLOAT|DOUBLE|DECIMAL/i,NUMERIC:/NUMERIC/i,BOOLEAN:/BOOL/i},k=(t,s)=>Ta[s].test(t),lt=t=>k(t,"DATE"),Sa=t=>k(t,"BLOB"),Aa=t=>k(t,"TEXT"),La=t=>k(t,"INTEGER"),Da=t=>k(t,"REAL"),Ia=t=>k(t,"NUMERIC"),Fa=t=>k(t,"BOOLEAN"),ka=t=>La(t)||Da(t)||Ia(t),it=_t,ct=Wt,ne=o.forwardRef(({className:t,align:s="start",side:a="bottom",sideOffset:r=4,...n},l)=>e.jsx(Te,{ref:l,align:s,side:a,sideOffset:r,className:m("z-50 w-64 text-balance break-words rounded-md border p-4 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[side=bottom]:slide-in-from-top-1","data-[side=left]:slide-in-from-right-1","data-[side=right]:slide-in-from-left-1","data-[side=top]:slide-in-from-bottom-1","bg-gray-100 dark:bg-gray-700",t),...n}));ne.displayName=Te.displayName;const dt=o.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:m("w-full caption-bottom text-sm",t),...s})}));dt.displayName="Table";const mt=o.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:m("[&_tr]:border-b",t),...s}));mt.displayName="TableHeader";const ut=o.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:m("[&_tr:last-child]:border-0",t),...s}));ut.displayName="TableBody";const Oa=o.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:m("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Oa.displayName="TableFooter";const J=o.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:m("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));J.displayName="TableRow";const ft=o.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:m("h-12 min-w-[150px] px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ft.displayName="TableHead";const Ma=t=>{const s=new Uint8Array(t.match(/.{1,2}/g).map(r=>Number.parseInt(r,16))),a=new Blob([s],{type:"image/jpeg"});return URL.createObjectURL(a)},xt=o.memo(o.forwardRef(({className:t,children:s,dataType:a,...r},n)=>{const l=(a==null?void 0:a.toUpperCase())==="BLOB",i=o.useMemo(()=>typeof s=="string"&&s.length>40?`${s.slice(0,40)}...`:s,[s]);return e.jsx("td",{ref:n,className:m("max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...r,children:e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsx("span",{className:"cursor-pointer hover:underline",children:l?e.jsx("span",{className:"italic opacity-40",children:"BLOB"}):i})}),e.jsx(ne,{side:"bottom",align:"start",children:e.jsxs("div",{className:"flex flex-col justify-center gap-1",children:[l&&typeof s=="string"?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:Ma(s),alt:"BLOB content",className:"flex max-h-40 flex-col items-center justify-center gap-2 rounded object-contain",onError:c=>{c.currentTarget.style.display="none"}}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Blob length: ",s.length]})]}):e.jsx("span",{className:"max-w-full break-words",children:s}),e.jsx(Q,{className:"w-full self-start text-center text-xs font-semibold",children:a||"Unknown"})]})})]})})}));xt.displayName="TableCell";const Pa=o.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:m("mt-4 text-sm text-muted-foreground",t),...s}));Pa.displayName="TableCaption";function Ba({columnName:t}){const{appendToFilters:s,selectedTable:a,filtersNeedClear:r,setFiltersNeedClear:n}=h(),[l,i]=o.useState("");o.useEffect(()=>{i("")},[a]),o.useEffect(()=>{r&&(i(""),n(!1))},[r,n]);const c=o.useCallback(d=>{const u=d.target.value;i(u),s(t,u)},[s,t]);return e.jsx(oe,{value:l,onChange:c,className:"mt-[2px] max-h-7 w-full text-xs",placeholder:"Filter"})}function qa({columnName:t}){const{orderBy:s,setOrderBy:a}=h(),r=o.useCallback(()=>{s.column===t?s.direction==="ASC"?a(t,"DESC"):s.direction==="DESC"&&a(null,"ASC"):a(t,"ASC")},[s,t,a]);return e.jsx("div",{onClick:r,onKeyUp:r,className:"flex items-center",children:s.column===t?s.direction==="ASC"?e.jsx("button",{title:"Descending",type:"button","aria-label":"Sort Descending",children:e.jsx(us,{className:"h-4 w-4"})}):e.jsx("button",{title:"Ascending",type:"button","aria-label":"Sort Ascending",children:e.jsx(fs,{className:"h-4 w-4"})}):e.jsx("button",{title:"Sort column",type:"button","aria-label":"Sort Column",children:e.jsx(xs,{className:"h-4 w-4"})})})}const Ua=o.memo(({columnSchema:t})=>e.jsxs(e.Fragment,{children:[(t==null?void 0:t.isPrimaryKey)&&e.jsx("p",{className:"text-sm font-semibold text-yellow-600",children:"(Primary)"}),(t==null?void 0:t.isForeignKey)&&e.jsx("p",{className:"text-sm font-semibold text-purple-600",children:"(Foreign)"})]})),$a=o.memo(({columnSchema:t})=>{const{type:s,isPrimaryKey:a,isForeignKey:r}=t;if(a)return e.jsx(ps,{className:"h-4 w-4 text-yellow-500"});if(r)return e.jsx(gs,{className:"h-4 w-4 text-purple-500"});if(s){if(Sa(s))return e.jsx(hs,{className:"h-4 w-4 text-green-500"});if(lt(s))return e.jsx(ke,{className:"h-4 w-4 text-blue-500"});if(Aa(s))return e.jsx(bs,{className:"h-4 w-4 text-indigo-500"});if(ka(s))return e.jsx(ys,{className:"h-4 w-4 text-red-500"});if(Fa(s))return e.jsx(js,{className:"h-4 w-4 text-pink-500"})}return e.jsx(Ns,{className:"h-4 w-4 text-gray-500"})}),Qa=o.memo(({columnName:t,columnSchema:s})=>e.jsxs(ft,{className:"bg-gray-100 py-2 dark:bg-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qa,{columnName:t}),e.jsxs(it,{children:[e.jsx(ct,{asChild:!0,children:e.jsxs("div",{className:"flex cursor-pointer items-center space-x-1",children:[e.jsx("span",{className:"max-w-[200px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:t}),s&&e.jsx($a,{columnSchema:s})]})}),e.jsxs(ne,{className:"w-64",children:[e.jsxs("div",{className:"mb-1 flex items-center space-x-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t}),e.jsx(Ua,{columnSchema:s})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{className:"w-full self-start text-center text-xs font-semibold",children:(s==null?void 0:s.type)||"Unknown"}),(s==null?void 0:s.nullable)&&e.jsx(Q,{className:"w-full self-start text-center text-xs font-semibold",children:"NULLABLE"})]})]})]})]}),e.jsx(Ba,{columnName:t})]})),za=o.memo(({value:t,dataType:s})=>{const{dateFormatValue:a}=h(),r=()=>t?s&<(s)&&X[a]?X[a].func(t):t:e.jsx("span",{className:"italic text-gray-400",children:"NULL"});return e.jsx(xt,{dataType:s,className:"px-5 py-[11px] text-sm",children:r()})});function Ha({data:t,columns:s,tableName:a,tableSchemas:r}){const{filters:n,setFiltersNeedClear:l,setFilters:i}=h(),c=o.useMemo(()=>e.jsx(mt,{children:e.jsx(J,{children:s.map((f,x)=>e.jsx(Qa,{columnName:f,columnSchema:r[a][f]},x))})}),[s,r,a]),d=o.useMemo(()=>e.jsx(ut,{children:t.map((f,x)=>e.jsx(J,{children:s.map((p,g)=>{var y;return e.jsx(za,{value:f[p],dataType:(y=r[a][p])==null?void 0:y.type},g)})},x))}),[t,s,r,a]),u=o.useCallback(()=>{l(!0),i({})},[l,i]);return e.jsxs("div",{className:"overflow-x-auto",children:[e.jsxs(dt,{children:[c,t.length>0&&d]}),t.length===0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"w-full p-4 text-center font-medium",children:["No data available for ",a]}),Object.keys(n).length>0&&e.jsx(b,{className:"w-full rounded-none",variant:"outline",onClick:u,children:"Clear filters"})]})]})}function Va(){const[t,s]=o.useState(()=>document.body.classList.contains("dark"));return o.useEffect(()=>{const a=new MutationObserver(()=>{s(document.body.classList.contains("dark"))});return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),t}const Ga=["ABORT","ACTION","ADD","AFTER","ALL","ALTER","ANALYZE","AND","AS","ASC","ATTACH","AUTOINCREMENT","BEFORE","BEGIN","BETWEEN","BY","CASCADE","CASE","CAST","CHECK","COLLATE","COLUMN","COMMIT","CONFLICT","CONSTRAINT","CREATE","CROSS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATABASE","DEFAULT","DEFERRABLE","DEFERRED","DELETE","DESC","DETACH","DISTINCT","DROP","EACH","ELSE","END","ESCAPE","EXCEPT","EXCLUSIVE","EXISTS","EXPLAIN","FAIL","FOR","FOREIGN","FROM","FULL","GLOB","GROUP","HAVING","IF","IGNORE","IMMEDIATE","IN","INDEX","INDEXED","INITIALLY","INNER","INSERT","INSTEAD","INTERSECT","INTO","IS","ISNULL","JOIN","KEY","LEFT","LIKE","LIMIT","MATCH","NATURAL","NO","NOT","NOTNULL","NULL","OF","OFFSET","ON","OR","ORDER","OUTER","PLAN","PRAGMA","PRIMARY","QUERY","RAISE","RECURSIVE","REFERENCES","REGEXP","REINDEX","RELEASE","RENAME","REPLACE","RESTRICT","RIGHT","ROLLBACK","ROW","SAVEPOINT","SELECT","SET","TABLE","TEMP","TEMPORARY","THEN","TO","TRANSACTION","TRIGGER","UNION","UNIQUE","UPDATE","USING","VACUUM","VALUES","VIEW","VIRTUAL","WHEN","WHERE","WITH","WITHOUT"];function _a(){const{customQuery:t,setCustomQuery:s,tables:a,tableSchemas:r}=h(),n=Va(),l=o.useCallback(d=>{const u=d.matchBefore(/\w*/);if(!u||u.from===u.to&&!d.explicit)return null;const f=[];for(const p of Object.values(r))f.push(...Object.keys(p));const x=[...Ga.map(p=>({label:p,type:"keyword"})),...a.map(p=>({label:p.name,type:"table"})),...f.map(p=>({label:p,type:"column"}))];return{from:u.from,to:u.to,options:x}},[a,r]),i=o.useCallback(d=>{s(d)},[s]),c=o.useMemo(()=>[Os,Ms(),Ps({override:[l]})],[l]);return e.jsx(Bs,{value:t,height:"126px",extensions:c,onChange:i,className:"rounded-md border",theme:n?qs:"light"})}const Wa=o.memo(Ra),Ka=o.memo(aa);function Ya(){const{tables:t,selectedTable:s,tableSchemas:a,queryError:r,setQueryError:n,rowPerPageOrAuto:l,isCustomQuery:i,customQuery:c,setIsCustomQuery:d,setCustomQuery:u,expandPage:f,setExpandPage:x,filters:p,setFilters:g,databaseData:y}=h(),{page:j,setPage:w,rowsPerPage:C}=Js(l),S=o.useMemo(()=>{var P;return(P=t[Number.parseInt(s)])==null?void 0:P.name},[t,s]),{data:I,columns:E,isQueryLoading:A,handleCustomQuery:M}=Xs(S,C,j),[T,z]=o.useState([]);o.useEffect(()=>{E.length>0&&z(E)},[E]);const N=o.useCallback(()=>{n(null),u(""),d(!1)},[d,n,u]),v=o.useCallback(()=>{function P(L){try{return Lt(L,{language:"sqlite",useTabs:!1,keywordCase:"upper",tabWidth:2,expressionWidth:100,linesBetweenQueries:1})}catch{return L}}const G=P(c);u(G)},[c,u]);o.useEffect(()=>{w(0),g({})},[s]),o.useEffect(()=>{w(0)},[p]);const B=o.useMemo(()=>e.jsx(Zs,{type:"single",collapsible:!0,className:"w-full rounded-lg bg-background px-3",children:e.jsxs(qe,{value:"item-1",children:[e.jsx(Ue,{className:"text-xs",children:"Execute Query"}),e.jsxs($e,{className:"flex flex-col gap-[6px]",children:[e.jsx("div",{className:"flex-grow",children:e.jsx(_a,{})}),e.jsxs("div",{className:"flex flex-row gap-1 md:gap-2",children:[e.jsx(b,{className:"grow",variant:"secondary",onClick:M,title:"Run custom query",children:e.jsx(ws,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:N,title:"Remove query",children:e.jsx(Cs,{className:"h-5 w-5"})}),e.jsx(b,{className:"grow opacity-80",variant:"secondary",onClick:v,title:"Format SQL",children:e.jsx(Oe,{className:"h-5 w-5"})})]})]})]})}),[M,N,v,j,T]),q=o.useMemo(()=>A?e.jsxs(Y,{type:"loading",children:["Loading ",S]}):e.jsx("div",{className:"mb-[40px] overflow-hidden rounded-lg border border-gray-200 dark:border dark:border-gray-700",children:e.jsx(Ha,{data:I,columns:T.length>0?T:E,tableName:S,tableSchemas:a})}),[A,I,E,S,a,T]),H=o.useMemo(()=>e.jsx(Ka,{}),[]),V=o.useMemo(()=>f?e.jsx(Es,{className:"h-5 w-5"}):e.jsx(vs,{className:"h-5 w-5"}),[f]);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex flex-col gap-3 pb-8",children:[e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[y.name,", (",y.sizeAsString,")"]}),e.jsxs("section",{className:"rounded-lg bg-gray-100 p-4 shadow-sm dark:bg-gray-700",children:[e.jsxs("div",{className:"mb-[5px] flex items-center justify-between gap-[6px] pb-[3px]",children:[e.jsx(Wa,{}),e.jsxs("div",{className:"g-1 flex items-center justify-center gap-1",children:[H,e.jsx(b,{className:"hidden expand:block",onClick:()=>x(!f),title:"Toggle page size",children:V}),e.jsx(et,{}),e.jsx(xa,{})]})]}),B,r&&e.jsx("p",{className:"mt-2 text-center text-sm text-red-500 dark:text-red-400",children:r})]}),q,!i&&e.jsx(ba,{page:j,setPage:w,rowsPerPage:C})]})})}const Xa=o.memo(Ya),Ja={"application/vnd.sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/x-sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sqlite3":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/octet-stream":[".sqlite",".sqlite3",".db",".sqlitedb"],"application/sql":[".sql"],"application/x-sql":[".sql"],"text/x-sql":[".sql"],"text/sql":[".sql"],"text/x-sqlite3":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/sqlite":[".sql",".sqlite",".sqlite3",".db",".sqlitedb"],"text/x-sqlite3-dump":[".sql"],"text/x-sqlite-dump":[".sql"],"text/sqlite-dump":[".sql"]};function Za(){const{loadDatabaseBytes:t,setDatabaseData:s}=h(),[a,r]=o.useState([]),n=o.useCallback(async(u,f)=>{if(f.length>0){const x=f.flatMap(p=>p.errors);r(x);return}if(u.length>0)try{const x=u[0],p=new Uint8Array(await x.arrayBuffer());s({name:x.name,size:x.size}),await t(p)}catch(x){return x instanceof Error?D(x.message,{position:"bottom-right"}):D("Failed to load database",{position:"bottom-right"})}},[t,s]),{getRootProps:l,getInputProps:i,isDragActive:c}=Us({onDrop:n,multiple:!1,accept:Ja}),d=o.useMemo(()=>e.jsx("div",{className:"flex w-full items-center justify-between gap-2",children:e.jsxs("div",{...l(),className:`flex w-full grow transform cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed bg-gray-100/50 p-6 transition-colors duration-300 ease-in-out hover:bg-secondary dark:bg-gray-700/50 ${c?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-primary py-12 dark:border-gray-700"}`,children:[e.jsx("input",{id:"file-upload",...i()}),e.jsx("label",{htmlFor:"file-upload",className:"sr-only",children:"Upload SQLite File"}),e.jsxs("div",{className:"text-center text-sm md:text-base",children:[e.jsx("span",{className:"hidden sm:block lg:text-lg",children:"Drag and drop file here, or click to select one"}),e.jsx("div",{className:"block sm:hidden",children:e.jsx("span",{className:"text-lg font-medium",children:"Click to select a SQLite file"})})]})]})}),[l,i,c]);return e.jsxs("section",{className:"mx-auto w-full",children:[d,e.jsx(er,{errors:a})]})}const er=o.memo(({errors:t})=>(o.useEffect(()=>{if(t)for(const s of t)D(s.message,{position:"bottom-right"})},[t]),null)),tr=o.memo(Za);function sr(){return e.jsx("header",{className:"rounded bg-gradient-to-r shadow-md dark:from-gray-800 dark:to-indigo-900",children:e.jsx("div",{className:"mx-auto max-w-4xl px-4 py-8 sm:py-12",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold sm:text-3xl",children:"SQLite Viewer"}),e.jsx("p",{className:"max-w-md text-sm sm:text-base",children:"Explore and analyze your SQLite databases directly in your browser"})]})})})}function ar(){return e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"rounded bg-gradient-to-r py-6 shadow-md dark:from-gray-800 dark:to-indigo-900 md:py-10",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsx("div",{children:e.jsxs("div",{className:"grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(O,{icon:Rs,title:"Browser Based",description:"No installation required. Access and analyze your SQLite databases directly in your web browser."}),e.jsx(O,{icon:Ts,title:"Lightning Fast",description:"Powered by WebAssembly (WASM) for near-native performance, even with large databases."}),e.jsx(O,{icon:Ss,title:"100% Secure",description:"Your data never leaves your device. All processing happens client-side, ensuring complete privacy."}),e.jsx(O,{icon:Me,title:"Customizable Interface",description:"Different themes and settings. Adjust the look and feel of your interface to suit your preferences and workflow."}),e.jsx(O,{icon:As,title:"Offline Capable",description:"Work on your databases without an internet connection. Perfect for sensitive data or remote work."}),e.jsx(O,{icon:Ls,title:"PWA Support",description:"Install the app on your desktop or mobile device for a genuine native experience. Enjoy robust offline functionality."})]})})})}),e.jsx("div",{className:"pb-[72px] md:pb-0"})]})}function O({icon:t,title:s,description:a}){return e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(t,{className:"h-6 w-6 text-blue-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium",children:s}),e.jsx("p",{className:"mt-1 text-sm",children:a})]})]})}const rr=Kt,or=Yt,pt=o.forwardRef(({className:t,...s},a)=>e.jsx(Se,{className:m("fixed inset-0 z-50 bg-black/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));pt.displayName=Se.displayName;const gt=o.forwardRef(({className:t,...s},a)=>e.jsxs(or,{children:[e.jsx(pt,{}),e.jsx(Ae,{ref:a,className:m("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));gt.displayName=Ae.displayName;const ht=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col space-y-2",t),...s});ht.displayName="AlertDialogHeader";const bt=({className:t,...s})=>e.jsx("div",{className:m("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});bt.displayName="AlertDialogFooter";const yt=o.forwardRef(({className:t,...s},a)=>e.jsx(Le,{ref:a,className:m("text-lg font-semibold",t),...s}));yt.displayName=Le.displayName;const jt=o.forwardRef(({className:t,...s},a)=>e.jsx(De,{ref:a,className:m("text-sm text-muted-foreground",t),...s}));jt.displayName=De.displayName;const Nt=o.forwardRef(({className:t,...s},a)=>e.jsx(Ie,{ref:a,className:m(ae(),t),...s}));Nt.displayName=Ie.displayName;const wt=o.forwardRef(({className:t,...s},a)=>e.jsx(Fe,{ref:a,className:m(ae({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));wt.displayName=Fe.displayName;const nr=o.memo(gt);function lr({showDialog:t,setShowDialog:s,onConfirm:a}){const r=o.useCallback(()=>{s(!1)},[s]);return e.jsx(rr,{open:t,onOpenChange:s,children:e.jsxs(nr,{children:[e.jsxs(ht,{children:[e.jsx(yt,{children:"Use Proxy to Load Database?"}),e.jsx(jt,{children:"We couldn't load the database from the provided URL due to CORS restrictions. Would you like to try using a proxy?"})]}),e.jsx("div",{className:"font-semibold text-yellow-600 md:text-left",children:"Warning: Using the proxy will route your database traffic through cors.eu.org."}),e.jsxs(bt,{children:[e.jsx(wt,{onClick:r,children:"Cancel"}),e.jsx(Nt,{onClick:a,children:"Use Proxy"})]})]})})}const ir=/^(https?:\/\/(?:www\.)?[a-zA-Z0-9-]{1,256}\.[a-zA-Z]{2,6}(?:\/[^\s]*)?)$/i,cr="https://cors.eu.org";function dr(){const{db:t,isLoading:s,loadDatabaseBytes:a,setDatabaseData:r}=h(),[n,l]=o.useState(null),[i,c]=o.useState(!1),[d,u]=o.useState(null),[f,x]=o.useState(!1),p=o.useRef(!1),g=o.useCallback(async(j,w=!1)=>{if(!ir.test(j)){l("Invalid URL");return}try{x(!0);const C=w?`${cr}/${encodeURIComponent(j)}`:j,S=await fetch(C);if(!S.ok)throw new Error("URL not found or invalid");const I=await S.blob(),E=new File([I],"database.sqlite"),A=new Uint8Array(await E.arrayBuffer());r({name:E.name,size:E.size}),await a(A),l(null)}catch(C){w?l(`Error while fetching, ${C instanceof Error?C.message:String(C)}`):(u(j),c(!0))}finally{x(!1)}},[a,r]);o.useEffect(()=>{if(p.current)return;const w=new URLSearchParams(window.location.search).get("url");w&&(g(decodeURIComponent(w)),p.current=!0)},[g]);const y=o.useCallback(()=>{d&&(g(d,!0),c(!1))},[d,g]);return s||f?e.jsxs(Y,{type:"loading",children:[f?"Fetching":"Loading"," SQLite file"]}):n&&!t?e.jsx(Y,{type:"error",children:n}):e.jsx(e.Fragment,{children:i&&e.jsx(lr,{showDialog:i,setShowDialog:c,onConfirm:y},"proxy-message")})}function mr(){return e.jsx("footer",{className:"fixed bottom-0 left-0 right-0 border-t bg-background shadow-md",children:e.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between py-4 md:py-6",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sms hidden sm:block",children:"No file will be uploaded to server. Using JavaScript, sql.js"}),e.jsx("p",{className:"text-sm sm:hidden",children:"No file uploads to server."})]}),e.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-2 text-blue-500",title:"Star on GitHub",children:[e.jsx(Ds,{className:"h-5 w-5"}),e.jsx("span",{className:"text-sm font-medium hover:underline",children:"Star us on GitHub"})]})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx(et,{})})]})})})}const ur=o.memo(mr),fr=o.memo(Xa),xr=o.memo(tr),pr=o.memo(dr);function gr(){const{db:t,expandPage:s}=h();return e.jsxs("main",{className:`mx-auto flex h-screen flex-col ${t?"gap-3":"gap-4"} p-4 ${s?"w-full":"container"}`,children:[!t&&e.jsxs(e.Fragment,{children:[e.jsx(sr,{})," ",e.jsx(xr,{})," ",e.jsx(pr,{}),e.jsx(ar,{}),e.jsx(ur,{})]}),t&&e.jsx(fr,{isDatabaseLoaded:t})]})}const hr=({...t})=>e.jsx(Is,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-gray-100 p-2 dark:group-[.toaster]:bg-gray-700 text-lg p-4 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t});Tt.createRoot(document.getElementById("root")).render(e.jsxs(Rt.StrictMode,{children:[e.jsx(gr,{}),e.jsx(hr,{})]})); diff --git a/assets/index-Cr9yX2c0.js.gz b/assets/index-Cr9yX2c0.js.gz new file mode 100644 index 0000000000000000000000000000000000000000..f6e937352eba262fca8a6d430d539745b5af1142 GIT binary patch literal 15042 zcmV;zIz7c7iwFP!000021MPijbK5$$;OFUI!LZV9vKy3TXSuoZW8AVVCrZ3UlC!Dx zVu*w!+7!tEkR?UYf1f%4xKnm~Z}*#-s;P3BB8cSxH~
dm5%@-@{k(?WCu4}!Yz z=<>~&hBLjkO9^(kbv%nYXN%*r+6~hWJXy?vjQv7JH=J3m8~XCg`2DL==3bKd$DDB- zxYkkhsnrU;bhBAK$l6S@vhRNFhFPuYH-7fpZ$UQa3FI7;IOo{&iN)|8q1N$q^!4sd z=w@?|A@^yvUTYlE8Rnc&>nQyCYTu2XXA5+oz%fT};o0Fx^kGSm3(trk0?!kUdhopE zNHlQ4(FC3of~N31<4APqlFI>}5_AjC5kWpYR|L)AdBjlw&l`e5cz)+7g6BCw-{H9+ zNX*j}M+}}Vfw3s z*IQb1&pP_>@yn}|)z=bYd`>buK3iHxmV3+2zUHt^bnab}k7LhYc!6up2%Qk?==Rga zZ_nyE>}WxWuX1$0awKMxFofaB8S2B6G1)uJ&5i_5&t+ z?=y)79+R{0Fgg1!le0f#a#ZI`V!@b6ELbu*iV>68FkuoKrc7ePh)JwlF@+UOV#PU= zSg~LdD_TrqMVm>ixMOm5y9|95v&tk^^q9noCX-lk$|P1Cvv@%Lx#PLSlB>A)>TC0+ zb7Yk!ijZ`oFk{vorXCI)V&OTThScLL>uB`+doSFp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B;ECo3y`h8xdHe7W8H=4B5>%BqYoAtmxk40nJCLEf}j~KKo_H zJDXC_7%p$4yuc>RM2*g-l<_>@ zZl|i<#iQCi+1743y1~XoQux7UjTtX^NLb_{JE?T}m|Wc_JacvTsffe8kSHb@#J%(# z9AUM>VC>OZ>L9VZw2f@q;tnz!WZA4ed&_ zr9fV;w1p=XLpaG(=5T_J$6#17rQv)s)tr#B8kyHZI;mwCfuo8+U+}EmY(=yU)w%Ob zK8z}+DODDa$up1IyZ>!WIgi+3<6pb~+BFUvi^bw!HS=(QtshP6Yu)A(&mN(>>{X`9`-iUQ| zbfo9_=%BX~?Cd<@N^2#lP%yajegPZzD5E5zeV?N2@#YndHz#wvtu{y(o2R8_SI_Y} zXJsDuSQ2F0gKN~~m8Y&rPi%E9>#!q@+pN z6w9nsau!WIKAn$hPB`1WTTEk7{+(p@?stI<#?5q%9eY?*j3BjCYfGC)x zJ|^z)^U|7;ibW|ePT4Rd^zV$CXq>!##wJ=OZ=9MaO5R+Wp_C^Dk|Co*E|n;X^1hjH zR+Q<*buNh8)M5_!BS_cF(=|WTWeB&1cs|!RLhtP9njOZjhrtv<*sg&{CM!gK!hgm3 z&|p-sYjjPIRj-N(5zR1kaQ0Or3?7kHrCk{V4;2ygoYejcqluAx(K<7k>SN?=bg6smT4ttW0$XQ5jW Y6LOM8ziEtq=D}b7Hr`ZvX%Q literal 0 HcmV?d00001 diff --git a/index.html b/index.html index cd89d58..745ded4 100644 --- a/index.html +++ b/index.html @@ -93,7 +93,7 @@ font-size: 2rem; } - + diff --git a/index.html.gz b/index.html.gz index 308f38801df40f906043bc80b8534010ed1f8b45..f5fa10557cdad528457e4b9da4c73645029a114f 100644 GIT binary patch delta 1795 zcmV+e2mJVu4v-FzA%BtpLk~2UaB1?wk>!f5AWKG)lbAjG-}lIli32nW9*_dw zbz&me1hjEbq+rr@G&9hcgTESo!+=>)Hi2xQGXd*e6^S9ihL`cCX;iX@ZF^S%DUH!L31(*#qU?Wo+6_U%Bn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mXxGEbG+>fB*dZnM|SPLgesdcb({jdsp}0YEFp)Zm{3J@+aB2 z=87q6WgxbdH4y_6 z0LT5w_hEGYz2>IgZb?w`fSZ||*@rtKZXvO^do1AK6>{kcJPiS*8`yt^D&yPEGUI};Y# zj{*j8$}`&sr8BapAY$4ctMtrSG$_lV;q7`?(s7p`Av(6BTX+?+X#uRHv{Y`$rZ2kJ zWgA$C7G<;R6rGmSdwg!QI lkP28zB516PcAu@T24}66?zm+@J8t;_=zlSu@RJc5001R>fRg|K diff --git a/sw.js b/sw.js index f492da1..24964fc 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()})).then((()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s})));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const t=s=>l(s,i),o={module:{uri:i},exports:u,require:t};e[i]=Promise.all(r.map((s=>o[s]||t(s)))).then((s=>(n(...s),u)))}}define(["./workbox-3e911b1d"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/@babel-BjXSgPXB.js",revision:null},{url:"assets/@codemirror-CCjSF3Vf.js",revision:null},{url:"assets/@floating-ui-Bob4LHZu.js",revision:null},{url:"assets/@lezer-DgLl1T_N.js",revision:null},{url:"assets/@radix-ui-BQVY8FyZ.js",revision:null},{url:"assets/@uiw-CvcbIrPa.js",revision:null},{url:"assets/aria-hidden-DQ5UC2Eg.js",revision:null},{url:"assets/attr-accept-BWI1aNlo.js",revision:null},{url:"assets/class-variance-authority-Bb4qSo10.js",revision:null},{url:"assets/clsx-B-dksMZM.js",revision:null},{url:"assets/crelt-C8TCjufn.js",revision:null},{url:"assets/date-fns-BAPXOope.js",revision:null},{url:"assets/detect-node-es-l0sNRNKZ.js",revision:null},{url:"assets/file-saver-DhbZvGod.js",revision:null},{url:"assets/file-selector-CBHVlu32.js",revision:null},{url:"assets/get-nonce-C-Z93AgS.js",revision:null},{url:"assets/index-CCxazG49.js",revision:null},{url:"assets/index-DmD-EE65.css",revision:null},{url:"assets/lucide-react-S8ZAjIB-.js",revision:null},{url:"assets/nearley-CG12bGQB.js",revision:null},{url:"assets/prop-types-psm7UO16.js",revision:null},{url:"assets/react-DmpIMwDM.js",revision:null},{url:"assets/react-dom-Cjr6YfK8.js",revision:null},{url:"assets/react-dropzone-D-IBOhIS.js",revision:null},{url:"assets/react-remove-scroll-bar-DZjhPxUV.js",revision:null},{url:"assets/react-remove-scroll-BOyN_WUU.js",revision:null},{url:"assets/react-style-singleton-CpxBwIWS.js",revision:null},{url:"assets/scheduler-CzFDRTuY.js",revision:null},{url:"assets/sonner-CxG_nbEz.js",revision:null},{url:"assets/sql-formatter-BoZ82dp4.js",revision:null},{url:"assets/sql.js-Ch_tM77n.js",revision:null},{url:"assets/style-mod-Bc2inJdb.js",revision:null},{url:"assets/tailwind-merge-BkWO730n.js",revision:null},{url:"assets/tslib-CuZy2iRz.js",revision:null},{url:"assets/use-callback-ref-DRzK4jWO.js",revision:null},{url:"assets/use-sidecar-D8_hMcUG.js",revision:null},{url:"assets/use-sync-external-store-ByYeed7R.js",revision:null},{url:"assets/vaul-OrZLygqJ.js",revision:null},{url:"assets/w3c-keyname-Vcq4gwWv.js",revision:null},{url:"assets/zustand-BpWCCnYR.js",revision:null},{url:"index.html",revision:"3265eded7b2a6010b85d9f46e35fa47e"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"sql.wasm",revision:"f6ad6454f4630b310eb8473858eb33bb"},{url:"manifest.webmanifest",revision:"662c9ac5fe5300a257a596b0ad6130ea"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))})); +if(!self.define){let s,e={};const l=(l,r)=>(l=new URL(l+".js",r).href,e[l]||new Promise((e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()})).then((()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s})));self.define=(r,n)=>{const i=s||("document"in self?document.currentScript.src:"")||location.href;if(e[i])return;let u={};const t=s=>l(s,i),o={module:{uri:i},exports:u,require:t};e[i]=Promise.all(r.map((s=>o[s]||t(s)))).then((s=>(n(...s),u)))}}define(["./workbox-3e911b1d"],(function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"assets/@babel-BjXSgPXB.js",revision:null},{url:"assets/@codemirror-CCjSF3Vf.js",revision:null},{url:"assets/@floating-ui-Bob4LHZu.js",revision:null},{url:"assets/@lezer-DgLl1T_N.js",revision:null},{url:"assets/@radix-ui-BQVY8FyZ.js",revision:null},{url:"assets/@uiw-CvcbIrPa.js",revision:null},{url:"assets/aria-hidden-DQ5UC2Eg.js",revision:null},{url:"assets/attr-accept-BWI1aNlo.js",revision:null},{url:"assets/class-variance-authority-Bb4qSo10.js",revision:null},{url:"assets/clsx-B-dksMZM.js",revision:null},{url:"assets/crelt-C8TCjufn.js",revision:null},{url:"assets/date-fns-BAPXOope.js",revision:null},{url:"assets/detect-node-es-l0sNRNKZ.js",revision:null},{url:"assets/file-saver-DhbZvGod.js",revision:null},{url:"assets/file-selector-CBHVlu32.js",revision:null},{url:"assets/get-nonce-C-Z93AgS.js",revision:null},{url:"assets/index-Cr9yX2c0.js",revision:null},{url:"assets/index-DmD-EE65.css",revision:null},{url:"assets/lucide-react-S8ZAjIB-.js",revision:null},{url:"assets/nearley-CG12bGQB.js",revision:null},{url:"assets/prop-types-psm7UO16.js",revision:null},{url:"assets/react-DmpIMwDM.js",revision:null},{url:"assets/react-dom-Cjr6YfK8.js",revision:null},{url:"assets/react-dropzone-D-IBOhIS.js",revision:null},{url:"assets/react-remove-scroll-bar-DZjhPxUV.js",revision:null},{url:"assets/react-remove-scroll-BOyN_WUU.js",revision:null},{url:"assets/react-style-singleton-CpxBwIWS.js",revision:null},{url:"assets/scheduler-CzFDRTuY.js",revision:null},{url:"assets/sonner-CxG_nbEz.js",revision:null},{url:"assets/sql-formatter-BoZ82dp4.js",revision:null},{url:"assets/sql.js-Ch_tM77n.js",revision:null},{url:"assets/style-mod-Bc2inJdb.js",revision:null},{url:"assets/tailwind-merge-BkWO730n.js",revision:null},{url:"assets/tslib-CuZy2iRz.js",revision:null},{url:"assets/use-callback-ref-DRzK4jWO.js",revision:null},{url:"assets/use-sidecar-D8_hMcUG.js",revision:null},{url:"assets/use-sync-external-store-ByYeed7R.js",revision:null},{url:"assets/vaul-OrZLygqJ.js",revision:null},{url:"assets/w3c-keyname-Vcq4gwWv.js",revision:null},{url:"assets/zustand-BpWCCnYR.js",revision:null},{url:"index.html",revision:"fed430105fd04743abd54257e35ae1a5"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"sql.wasm",revision:"f6ad6454f4630b310eb8473858eb33bb"},{url:"manifest.webmanifest",revision:"662c9ac5fe5300a257a596b0ad6130ea"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html")))}));