planche 0.8.6 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/{B-yXhF3b.js → 40YxirOy.js} +1 -1
- package/app/assets/4_c4BD6i.js +1 -0
- package/app/assets/{DyJPwVZe.js → 8DjNs_2Q.js} +1 -1
- package/app/assets/{NYrZ_KG4.js → 9U3RO0MO.js} +1 -1
- package/app/assets/9YYClKHB.js +1 -0
- package/app/assets/AiAiN2FW.js +2 -0
- package/app/assets/{DTxGpkJp.js → B3nhMsGp.js} +1 -1
- package/app/assets/{BM_rLXLv.js → B7ofUN9Z.js} +1 -1
- package/app/assets/BFDfeOJg.js +2 -0
- package/app/assets/BNkgLUl5.js +1 -0
- package/app/assets/BVrYyQUV.js +1 -0
- package/app/assets/B_UAjgBr.js +959 -0
- package/app/assets/Baj0YiGk.js +1 -0
- package/app/assets/{C1RY7wUM.js → BfSKVZnY.js} +1 -1
- package/app/assets/{vKCvRvxP.js → BjlaUaDI.js} +1 -1
- package/app/assets/{BuiqFOkR.js → BteHmqJi.js} +1 -1
- package/app/assets/{CAHFhps_.js → BwrB7xZ-.js} +2 -2
- package/app/assets/BxdVjvjj.js +2 -0
- package/app/assets/Bz1cma8F.js +1 -0
- package/app/assets/C5SHWmPn.js +2 -0
- package/app/assets/{B3UjY7jq.js → C8pwHENI.js} +1 -1
- package/app/assets/{CnOZTyPx.js → CCQZjXae.js} +2 -2
- package/app/assets/{DtU_PUOl.js → CCcRP83D.js} +1 -1
- package/app/assets/{B1mA7CRG.js → CFzRFS2A.js} +1 -1
- package/app/assets/{Bxa5htLS.js → CKDAL3sp.js} +1 -1
- package/app/assets/COkWw8gt.js +1 -0
- package/app/assets/{BgDlbKXF.js → COuEjUso.js} +1 -1
- package/app/assets/CQLuUHsS.js +2 -0
- package/app/assets/CRr_nYUE.js +2 -0
- package/app/assets/CYAMmigV.js +1 -0
- package/app/assets/{BdPEUnLq.js → Ca4g4XbM.js} +1 -1
- package/app/assets/{2rC1LDx2.js → CcgrsKRV.js} +1 -1
- package/app/assets/{CfsL8_WC.js → CgWXabLX.js} +1 -1
- package/app/assets/{XlrBcEaO.js → Cni8dWDa.js} +1 -1
- package/app/assets/{YjhzJVQZ.js → CoElGuoC.js} +2 -2
- package/app/assets/{DbRMSZEW.js → Cr6Fx4T5.js} +1 -1
- package/app/assets/{Cw_LYT6k.js → CtXRSNHU.js} +1 -1
- package/app/assets/CytzrZ6l.js +1 -0
- package/app/assets/{Cd_45PFU.js → D7TzN7zW.js} +1 -1
- package/app/assets/{BM5G_YA7.js → D8QuNkWm.js} +1 -1
- package/app/assets/{DsAlsNTl.js → DUi2bIfW.js} +1 -1
- package/app/assets/{DKjjOKsl.js → Dc-epzIX.js} +1 -1
- package/app/assets/{ohBkXlZt.js → DmnLfXty.js} +1 -1
- package/app/assets/{Bm1X7uTX.js → DnMHkY8_.js} +2 -2
- package/app/assets/{B4JrGAXR.js → DouS7NHO.js} +1 -1
- package/app/assets/{pp1UmAJW.js → DprcmWG4.js} +1 -1
- package/app/assets/{Cl5bGhXD.js → HtYgLQZp.js} +1 -1
- package/app/assets/{CQieSTGh.js → KZSCUzXE.js} +1 -1
- package/app/assets/MJ9qDdN_.css +2 -0
- package/app/assets/{D-RWduy5.js → RCiVSH3E.js} +1 -1
- package/app/assets/{CPgI8it1.js → ZjgMfDAG.js} +1 -1
- package/app/assets/{ClyAuDY9.js → fDSXGLmI.js} +2 -2
- package/app/assets/xc6SHidZ.js +1 -0
- package/app/assets/{BluggY4N.js → zrrdltej.js} +1 -1
- package/app/index.html +16 -14
- package/package.json +1 -1
- package/app/assets/B1lNzsWx.js +0 -959
- package/app/assets/B3LyCSVJ.js +0 -1
- package/app/assets/BGIwW6nZ.js +0 -1
- package/app/assets/BP4mxS6-.js +0 -1
- package/app/assets/BV9jV2YU.js +0 -1
- package/app/assets/BXX-BtBa.js +0 -2
- package/app/assets/BziT-o8V.js +0 -2
- package/app/assets/CB6XKkDn.js +0 -1
- package/app/assets/CChaTOPr.js +0 -1
- package/app/assets/CFQ-2DAt.js +0 -2
- package/app/assets/CWY0kZPK.js +0 -2
- package/app/assets/D3Eb1tV7.css +0 -2
- package/app/assets/D8nrOvmh.js +0 -2
- package/app/assets/bDuhhOB6.js +0 -1
- package/app/assets/mSiUHQYe.js +0 -1
- package/app/assets/u80owQsI.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./Bz1cma8F.js";import{t as p}from"./B3nhMsGp.js";import{a as m}from"./CtXRSNHU.js";import{n as h}from"./Cr6Fx4T5.js";import{t as g}from"./4_c4BD6i.js";import{H as _,_ as v,c as y,g as b,h as x,ot as S}from"./B_UAjgBr.js";import{a as ee,i as te,n as ne,o as C,t as re}from"./DxuXBECK.js";var w=e(n(),1),T=a(),ie=e=>e instanceof Error?e.message:String(e),E=e=>e.hostName||e.host||e.file||e.id,D=5e4;function O({id:e,label:t,side:n,onChange:r,connections:i,disabled:a}){let{t:s}=o(),[p,g]=(0,w.useState)([]),[_,v]=(0,w.useState)([]),b=i.find(e=>e.id===n.connectionId);return(0,w.useEffect)(()=>{if(!b?.serverConnectionId)return;let e=!1;return(async()=>{try{let t=await h(b.id).introspect.listDatabases(m(b.serverConnectionId));if(e)return;g(t),t.includes(n.database)||r({connectionId:b.id,database:t[0]??``,table:``})}catch{e||g([])}})(),()=>{e=!0}},[b?.id,b?.serverConnectionId]),(0,w.useEffect)(()=>{if(!b?.serverConnectionId||!n.database)return;let e=!1;return(async()=>{try{let t=await h(b.id).introspect.listTables(m(b.serverConnectionId),n.database);if(e)return;let i=t.map(e=>e.name);v(i),n.table&&!i.includes(n.table)&&r({...n,table:``})}catch{e||v([])}})(),()=>{e=!0}},[b?.id,b?.serverConnectionId,n.database]),(0,T.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[(0,T.jsx)(y,{className:`font-medium`,children:t}),(0,T.jsxs)(f,{value:n.connectionId,onValueChange:e=>r({connectionId:e,database:``,table:``}),disabled:a,children:[(0,T.jsx)(l,{id:`${e}-conn`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.diff.pickConnection`)})}),(0,T.jsx)(u,{children:i.map(e=>(0,T.jsx)(d,{value:e.id,children:E(e)},e.id))})]}),(0,T.jsxs)(f,{value:n.database,onValueChange:e=>r({...n,database:e,table:``}),disabled:a||p.length===0,children:[(0,T.jsx)(l,{id:`${e}-db`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.diff.pickDatabase`)})}),(0,T.jsx)(u,{children:p.map(e=>(0,T.jsx)(d,{value:e,children:e},e))})]}),(0,T.jsxs)(f,{value:n.table,onValueChange:e=>r({...n,table:e}),disabled:a||_.length===0,children:[(0,T.jsx)(l,{id:`${e}-table`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.dataDiff.pickTable`)})}),(0,T.jsx)(u,{children:_.map(e=>(0,T.jsx)(d,{value:e,children:e},e))})]})]})}async function k(e,t){let n=await _({connectionId:e.connectionId,database:e.database,table:e.table,limit:D,onProgress:t}),r=[];for await(let e of n.pages)r.push(...e);return{rows:r,columns:n.fields.map(e=>e.name),capped:r.length>=D}}function A({diff:e,row:t,other:n,changed:r}){let{t:i}=o(),a=[...e.keyColumns,...e.compareColumns];return(0,T.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,T.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.column`)}),(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.source`)}),(0,T.jsx)(`th`,{className:`text-left font-normal`,children:i(`database.diff.target`)})]})}),(0,T.jsx)(`tbody`,{children:a.map(e=>(0,T.jsxs)(`tr`,{className:r?.includes(e)?`text-amber-600 dark:text-amber-400`:``,children:[(0,T.jsx)(`td`,{className:`pr-2 align-top whitespace-nowrap`,children:e}),(0,T.jsx)(`td`,{className:`pr-2 align-top break-all`,children:b(t[e])}),(0,T.jsx)(`td`,{className:`align-top break-all`,children:n?b(n[e]):`—`})]},e))})]})}function j(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),c=i(`data-diff`),l=p(e=>e.activeConnections),u=(0,w.useMemo)(()=>l.filter(e=>e.serverConnectionId),[l]),d=p(e=>e.activeConnectionId),f=n===`data-diff`,[_,y]=(0,w.useState)(()=>c&&u.some(e=>e.id===c.connectionId)?{connectionId:c.connectionId,database:c.database,table:c.table}:{connectionId:d&&u.some(e=>e.id===d)?d:u[0]?.id??``,database:``,table:``}),[E,j]=(0,w.useState)(()=>({connectionId:u.find(e=>e.id!==_.connectionId)?.id??_.connectionId,database:``,table:``})),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)(null),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(`changed`),[B,V]=(0,w.useState)(0),[H,ae]=(0,w.useState)(!1),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)({source:null,target:null}),[q,J]=(0,w.useState)(null),oe=e=>j(e.database&&!e.table&&_.table?{...e,table:_.table}:e),Y=_.connectionId===E.connectionId&&_.database===E.database&&_.table===E.table,se=!!_.table&&!!E.table&&!Y,X=E.connectionId?h(E.connectionId):null;async function ce(){W(!0),J(null),F(null);try{let n=p.getState().activeConnections.find(e=>e.id===_.connectionId);if(!n?.serverConnectionId)throw Error(e(`services.query.notConnected`));let r=await h(_.connectionId).introspect.getPrimaryKeys(m(n.serverConnectionId),_.database,_.table);if(r.length===0)throw Error(e(`database.dataDiff.noPrimaryKey`,{table:_.table}));K({source:{loaded:0,total:null},target:{loaded:0,total:null}});let[i,a]=await Promise.all([k(_,e=>K(t=>({...t,source:e}))),k(E,e=>K(t=>({...t,target:e})))]);if(r.some(e=>!a.columns.includes(e)))throw Error(e(`database.dataDiff.keyMissingInTarget`,{columns:r.join(`, `)}));let o=v(i.rows,a.rows,r,i.columns,a.columns);N(r),L(i.capped||a.capped),F(o),z(o.changed.length>0?`changed`:o.added.length>0?`added`:`removed`),V(0),g(`compare_data`),t(`data_diff`,{source_dbms:h(_.connectionId).id,target_dbms:X?.id??`unknown`,added:o.added.length,changed:o.changed.length,removed:o.removed.length})}catch(e){J(ie(e))}finally{W(!1),K({source:null,target:null})}}let Z=e=>e?e.total===null?e.loaded.toLocaleString():`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:``,Q=(0,w.useMemo)(()=>P&&X?x(P,X,{database:E.database,table:E.table},{includeDeletes:H}):``,[P,X,E.database,E.table,H]);function le(){Q&&(S(E.connectionId,Q,E.database,e(`database.dataDiff.tabTitle`,{table:E.table})),a())}let $=P?R===`added`?P.added:R===`removed`?P.removed:P.changed.map(e=>e.source):[],ue=!!P&&P.added.length+P.changed.length+P.removed.length>0,de=e=>M.map(t=>b(e[t])).join(`, `);return(0,T.jsx)(re,{open:f,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(ne,{className:`sm:max-w-[900px]`,children:[(0,T.jsx)(ee,{children:(0,T.jsx)(C,{children:e(`database.dataDiff.title`)})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(O,{id:`ddiff-source`,label:e(`database.diff.source`),side:_,onChange:y,connections:u,disabled:U}),(0,T.jsx)(O,{id:`ddiff-target`,label:e(`database.diff.target`),side:E,onChange:oe,connections:u,disabled:U})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.hint`,{cap:D.toLocaleString()})}),Y&&_.table&&(0,T.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`database.dataDiff.sameSide`)}),q&&(0,T.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:q}),U&&(G.source||G.target)&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.loading`,{source:Z(G.source),target:Z(G.target)})}),P&&(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.summary`,{key:M.join(`, `),added:P.added.length,changed:P.changed.length,removed:P.removed.length,identical:P.identical})}),I&&(0,T.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:e(`database.dataDiff.capped`,{cap:D.toLocaleString()})}),(P.sourceOnlyColumns.length>0||P.targetOnlyColumns.length>0)&&(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.ignoredColumns`,{columns:[...P.sourceOnlyColumns,...P.targetOnlyColumns].join(`, `)})})]}),(0,T.jsx)(`div`,{className:`flex gap-1 text-xs`,children:[`added`,`changed`,`removed`].map(t=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>{z(t),V(0)},className:`rounded border px-2 py-0.5 ${R===t?`bg-accent`:``}`,children:e(`database.dataDiff.${t}`,{count:t===`added`?P.added.length:t===`removed`?P.removed.length:P.changed.length})},t))}),(0,T.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3 h-[280px]`,children:[(0,T.jsxs)(`ul`,{className:`overflow-auto rounded-md border text-sm font-mono`,children:[$.slice(0,2e3).map((e,t)=>(0,T.jsx)(`li`,{className:`px-2 py-1 cursor-pointer ${B===t?`bg-accent`:``}`,onClick:()=>V(t),children:de(e)},t)),$.length===0&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.none`)}),$.length>2e3&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.more`,{count:$.length-2e3})})]}),(0,T.jsx)(`div`,{className:`overflow-auto rounded-md border p-2`,children:$[B]?R===`changed`?(0,T.jsx)(A,{diff:P,row:P.changed[B].source,other:P.changed[B].target,changed:P.changed[B].columns}):R===`removed`?(0,T.jsx)(A,{diff:P,row:{},other:$[B]}):(0,T.jsx)(A,{diff:P,row:$[B]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.diff.selectTable`)})})]}),(0,T.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>ae(e.target.checked)}),(0,T.jsx)(`span`,{className:H?`text-destructive`:``,children:e(`database.dataDiff.includeDeletes`)})]})]})]}),(0,T.jsxs)(te,{children:[(0,T.jsx)(s,{variant:`outline`,onClick:a,children:e(`database.diff.close`)}),(0,T.jsx)(s,{variant:`secondary`,onClick:()=>{ce()},disabled:!se||U,children:e(U?`database.diff.comparing`:`database.diff.compare`)}),(0,T.jsx)(s,{onClick:le,disabled:!ue,children:e(`database.diff.openScript`)})]})]})})}export{j as DataDiffDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./
|
|
1
|
+
import{a as e}from"./fDSXGLmI.js";import{t}from"./Bit0Kfog.js";var n=new Set([`neon`,`supabase`]);function r(e){return e===`postgres`||n.has(e)}var i=`_rowid_`,a=`http://127.0.0.1:8888`,o=t(`tunnelAgent`,()=>({url:null,token:null}));function s(e){o.url=e.url?.replace(/\/+$/,``)||null,o.token=e.token?.trim()||null}var c=new Set([`127.0.0.1`,`localhost`,`[::1]`,`::1`]);function l(e){try{let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&c.has(t.hostname)}catch{return!1}}function u(e){try{return typeof window<`u`&&new URL(e).origin===window.location.origin}catch{return!1}}function d(e){return l(e)||u(e)}function f(){return o.url!==null&&o.url!==`/api`&&!d(o.url)}function p(){return o.url??a}function m(){let t=p();return t===`/api`?e.t(`services.agent.devProxyUrl`,{url:`http://localhost:8888`}):t}async function h(){let t=m(),n;try{let e={};o.token&&(e.Authorization=`Bearer ${o.token}`),n=await(await fetch(`${p()}/health`,{cache:`no-store`,headers:e})).json()}catch(e){return{state:`offline`,url:t,message:e instanceof Error?e.message:String(e)}}return n.name!==`planche`||typeof n.version!=`string`||!/^[\w.+-]{1,32}$/.test(n.version)?{state:`offline`,url:t,message:e.t(`services.agent.notPlanche`)}:n.protocolVersion===2?n.authorized===!1||o.token===null&&n.authorized===void 0?{state:`unauthorized`,url:t,version:n.version}:{state:`online`,url:t,version:n.version,activeConnections:n.activeConnections??0,...n.gateway?{gateway:n.gateway}:{}}:{state:`outdated`,url:t,version:n.version,protocolVersion:n.protocolVersion??0,install:n.install===`standalone`?`standalone`:`npx`}}async function g(){let t=await fetch(`${p()}/profiles`,{cache:`no-store`,headers:N()}),n=await t.json().catch(()=>null);if(!t.ok||!n||n.success!==!0)throw new P(n?.message??e.t(`services.agent.httpError`,{status:t.status,statusText:t.statusText}),t.status);return n}async function _(){return D(`/ai/config`,{method:`GET`})}async function v(e){return D(`/ai/config`,{method:`PUT`,body:JSON.stringify(e)})}async function y(){return D(`/ai/config`,{method:`DELETE`})}async function b(){try{return(await(await fetch(`${p()}/health`,{cache:`no-store`,headers:N()})).json()).ai?.tools===!0}catch{return!1}}async function x(e){await D(`/bridge/tools`,{method:`POST`,body:JSON.stringify({tools:e})})}async function S(e,t,n){await D(`/bridge/result`,{method:`POST`,body:JSON.stringify({id:e,content:t,isError:n})})}async function C(t,n){let r=new AbortController,i=await fetch(`${p()}/bridge/events`,{headers:N(),signal:r.signal,cache:`no-store`});if(!i.ok||!i.body)throw new P(e.t(`services.agent.httpError`,{status:i.status,statusText:i.statusText}),i.status);return(async()=>{let e=i.body.getReader(),r=new TextDecoder,a=``;try{for(;;){let{done:n,value:i}=await e.read();if(n)break;a+=r.decode(i,{stream:!0});let o=a.indexOf(`
|
|
2
2
|
|
|
3
3
|
`);for(;o!==-1;){let e=a.slice(0,o);a=a.slice(o+2);for(let n of e.split(`
|
|
4
4
|
`))n.startsWith(`data: `)&&t(n.slice(6));o=a.indexOf(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{K as i,t as a}from"./B_UAjgBr.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";var f=t(),p=`https://planche.dev`,m=`/third-party-notices.txt`;function h(){let t=e(e=>e.activeDialog),h=e(e=>e.closeDialog),{t:g}=n();return(0,f.jsx)(d,{open:t===`about`,onOpenChange:e=>{e||h()},children:(0,f.jsxs)(c,{className:`sm:max-w-[440px]`,children:[(0,f.jsx)(o,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(a,{size:44,className:`shrink-0`}),(0,f.jsxs)(`div`,{className:`grid gap-1`,children:[(0,f.jsx)(l,{children:g(`about.title`)}),(0,f.jsx)(u,{children:g(`about.tagline`)})]})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,f.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.version`)}),(0,f.jsx)(`dd`,{children:`0.1.1`}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.website`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.licenses`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.licensesLink`)})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.legal`)}),(0,f.jsxs)(`dd`,{className:`flex gap-3`,children:[(0,f.jsx)(`a`,{href:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.terms`)}),(0,f.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.privacy`)}),(0,f.jsx)(`a`,{href:i.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.refund`)})]})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`© 2026 Juwon Jeong. `,g(`about.rights`)]}),(0,f.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:g(`about.disclaimer`)}),(0,f.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(`p`,{className:`mb-1 font-medium text-amber-600 dark:text-amber-400`,children:g(`pro.noticeTitle`)}),(0,f.jsx)(`p`,{children:g(`pro.notice`)})]})]}),(0,f.jsx)(s,{children:(0,f.jsx)(r,{onClick:h,children:g(`settings.done`)})})]})})}export{h as AboutDialog};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/R93pYE1w.js","assets/hePW80VL.js","assets/DeB5sJfy.js","assets/DOeLCbYG.js","assets/5E2RYjEs.js","assets/eRZ39OKr.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./hePW80VL.js";import{i as t}from"./
|
|
2
|
+
import{r as e}from"./hePW80VL.js";import{i as t}from"./fDSXGLmI.js";import{t as n}from"./B3nhMsGp.js";import{n as r}from"./BNkgLUl5.js";import{S as i,a}from"./CtXRSNHU.js";import{n as o}from"./Cr6Fx4T5.js";import{i as s,r as c}from"./D8QuNkWm.js";var l=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function u(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function d(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function f(e){return e>=`0`&&e<=`9`}function p(e){return e===` `||e===` `||e===`
|
|
3
3
|
`||e===`\r`||e===`\f`||e===`\v`}var m=class{input;syntax;pos=0;delimiter;significantInStatement=0;constructor(e,t,n=`;`){this.input=e,this.syntax=t,this.delimiter=n}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.next();t.kind===`terminator`||t.kind===`delimiter_command`?this.significantInStatement=0:t.kind!==`space`&&t.kind!==`comment`&&this.significantInStatement++,e.push(t)}return e}atLineStart(e){let t=e-1;for(;t>=0&&(this.input[t]===` `||this.input[t]===` `);)t--;return t<0||this.input[t]===`
|
|
4
4
|
`}make(e,t,n){let r=this.input.slice(t,n),i={kind:e,value:r,start:t,end:n};return e===`identifier`&&(i.upper=r.toUpperCase()),i}next(){let e=this.input,t=this.pos,n=e[t];if(p(n)){let n=t+1;for(;n<e.length&&p(e[n]);)n++;return this.pos=n,this.make(`space`,t,n)}if(e.startsWith(this.delimiter,t))return this.pos=t+this.delimiter.length,this.make(`terminator`,t,this.pos);if(n===`#`&&this.syntax.hashComments)return this.lineComment(t);if(n===`-`&&e[t+1]===`-`){let n=e[t+2];if(!this.syntax.dashCommentNeedsSpace||n===void 0||p(n))return this.lineComment(t)}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return this.pos=n===-1?e.length:n+2,this.make(`comment`,t,this.pos)}if(n===`$`&&this.syntax.dollarQuotes){let n=/^\$([A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF]*)?\$/.exec(e.slice(t,t+64));if(n){let r=e.indexOf(n[0],t+n[0].length);return this.pos=r===-1?e.length:r+n[0].length,this.make(`string`,t,this.pos)}}if((n===`e`||n===`E`)&&e[t+1]===`'`&&this.syntax.dollarQuotes){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,!0);return this.make(`string`,t,e.end)}if(n===`'`)return this.quoted(t,`'`,`string`,this.syntax.backslashEscapes);if(n===`"`)return this.syntax.doubleQuoteIsIdentifier?this.quoted(t,`"`,`quoted_identifier`,!1):this.quoted(t,`"`,`string`,this.syntax.backslashEscapes);if((n===`x`||n===`X`||n===`b`||n===`B`||n===`n`||n===`N`)&&e[t+1]===`'`){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,this.syntax.backslashEscapes);return this.make(`string`,t,e.end)}if(n==="`")return this.quoted(t,"`",`quoted_identifier`,!1);if(n===`[`&&this.syntax.bracketIdentifiers){let n=e.indexOf(`]`,t+1);return this.pos=n===-1?e.length:n+1,this.make(`quoted_identifier`,t,this.pos)}if(f(n)||n===`.`&&f(e[t+1]??``))return this.number(t);if(n===`@`){let n=t+1;if(e[n]===`@`&&n++,e[n]===`'`||e[n]===`"`||e[n]==="`"){let r=e[n];this.pos=n;let i=this.quoted(n,r,`string`,this.syntax.backslashEscapes);return this.make(`variable`,t,i.end)}for(;n<e.length&&(d(e[n])||e[n]===`.`);)n++;return this.pos=n,this.make(`variable`,t,n)}if((n===`:`||n===`$`)&&u(e[t+1]??``)&&e[t+1]!==`$`){let n=t+1;for(;n<e.length&&d(e[n]);)n++;return this.pos=n,this.make(`variable`,t,n)}if(n===`?`){let n=t+1;for(;n<e.length&&f(e[n]);)n++;return this.pos=n,this.make(`placeholder`,t,n)}if(u(n)){let n=t+1;for(;n<e.length&&d(e[n])&&!e.startsWith(this.delimiter,n);)n++;let r=e.slice(t,n).toUpperCase();if(r===`DELIMITER`&&this.syntax.delimiterCommand&&this.significantInStatement===0){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;let i=r;for(;i<e.length&&!p(e[i]);)i++;if(i>r)return this.delimiter=e.slice(r,i),this.pos=i,this.make(`delimiter_command`,t,i)}if(r===`GO`&&this.syntax.goBatchSeparator&&this.atLineStart(t)){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;for(;r<e.length&&f(e[r]);)r++;for(;r<e.length&&(e[r]===` `||e[r]===` `||e[r]===`\r`);)r++;if(r>=e.length||e[r]===`
|
|
5
5
|
`)return this.pos=r,this.make(`delimiter_command`,t,r)}return this.pos=n,this.make(`identifier`,t,n)}if(n===`/`&&this.syntax.plsqlBlocks&&this.atLineStart(t)){let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n++;if(n>=e.length||e[n]===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./B3nhMsGp.js";import{n as c}from"./Cr6Fx4T5.js";import{l,m as u}from"./CCQZjXae.js";import{c as d,it as f,l as p}from"./B_UAjgBr.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";var y=e(t(),1),b=i();function x(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),x=r(`create-schema`),S=t===`create-schema`,[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null);function k(e){e||(i(),w(``),O(null))}async function A(){let e=x?.connectionId??s.getState().activeConnectionId,t=C.trim();if(!(!e||!t)){O(null),E(!0);try{await l(e,c(e).getQuery(`CREATE_SCHEMA`,t)),await u(e),k(!1)}catch(e){O(e instanceof Error?e.message:String(e))}finally{E(!1)}}}return(0,b.jsx)(v,{open:S,onOpenChange:k,children:(0,b.jsxs)(g,{className:`sm:max-w-[420px]`,children:[(0,b.jsx)(m,{children:(0,b.jsx)(_,{children:e(`database.schema.createTitle`)})}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(d,{htmlFor:`schema-name`,children:e(`database.schema.name`)}),(0,b.jsx)(p,{id:`schema-name`,value:C,autoFocus:!0,placeholder:e(`database.schema.namePlaceholder`),onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!f(e)&&A()}})]}),D&&(0,b.jsx)(`p`,{className:`text-xs text-destructive leading-relaxed`,children:D}),(0,b.jsxs)(h,{children:[(0,b.jsx)(o,{variant:`outline`,onClick:()=>k(!1),children:e(`database.schema.cancel`)}),(0,b.jsx)(o,{onClick:()=>void A(),disabled:!C.trim()||T,children:e(`database.schema.create`)})]})]})})}export{x as CreateSchemaDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./Bz1cma8F.js";import{_ as p,t as m}from"./B3nhMsGp.js";import{n as ee}from"./BNkgLUl5.js";import{a as te}from"./CtXRSNHU.js";import{n as ne}from"./Cr6Fx4T5.js";import{n as re}from"./CCQZjXae.js";import{H as h,M as ie,c as g,l as _}from"./B_UAjgBr.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";import{t as C}from"./CnYBZPf9.js";var w=e(n(),1);function T(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
|
|
2
2
|
`)||n.includes(`\r`)?`"${n.replace(/"/g,`""`)}"`:n}var E=(e,t)=>e.map(e=>T(e,t)).join(t)+`
|
|
3
|
-
`,D=e=>e===` `,O=e=>D(e)?`TSV`:`CSV`,k=e=>D(e)?`.tsv`:`.csv`,A=e=>D(e)?`text/tab-separated-values`:`text/csv`;async function j(e,t){let n=C(e),r=A(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:O(t),accept:{[r]:[k(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new M}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var M=class extends Error{constructor(){super(`CSV export cancelled`)}};async function N(e){let n=await j(`${e.table}${k(e.delimiter)}`,e.delimiter),r=0;try{let i=await h({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(E(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>E(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{source:`table`,rows:r,format:O(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function P(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(E(o,r));for(let e of n)s.push(E(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${A(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=C(a??`query_result${k(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{source:`result`,rows:n.length,format:O(r)})}var F=a(),I=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=o(),{activeDialog:t,closeDialog:n}=r(),a=i(`export-csv`),h=m(e=>e.activeConnectionId),C=ee(),T=t===`export-csv`,[E,O]=(0,w.useState)(`query_result`),[k,A]=(0,w.useState)(``),[j,L]=(0,w.useState)([]),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(`,`),[H,U]=(0,w.useState)(!0),[W,G]=(0,w.useState)(!1),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useRef)(null),Z=D(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===p.TABLE||a.nodeType===p.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!h)return null;let e=(C.tabs[h]??[]).find(e=>e.id===C.activeTabId[h]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,w.useEffect)(()=>{if(!T)return;let e=Q();V(a?.delimiter??`,`),e&&(A(e.table),O(`table_data`))},[T]),(0,w.useEffect)(()=>{if(!T||!h)return;let e=m.getState().activeConnections.find(e=>e.id===h);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await ne(h).introspect.listDatabases(te(e.serverConnectionId));if(t)return;L(n);let r=C.tabs[h]?.find(e=>e.id===C.activeTabId[h])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[T,h]);function $(e){if(!e){if(W){X.current?.abort();return}n(),O(`query_result`),A(``),V(`,`),U(!0)}}async function ae(){if(!h)return;if(Y(null),E===`query_result`){let e=C.activeTabId[h],t=(C.tabs[h]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;P(t.fields,t.rows,B,H),n();return}if(!k.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let i=await N({connectionId:h,database:R,table:k.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});r.getState().setFooterMessage(e(`database.csv.done`,{count:i,table:k.trim(),format:Z})),n()}catch(e){!(e instanceof M)&&!(e instanceof re&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,F.jsx)(
|
|
3
|
+
`,D=e=>e===` `,O=e=>D(e)?`TSV`:`CSV`,k=e=>D(e)?`.tsv`:`.csv`,A=e=>D(e)?`text/tab-separated-values`:`text/csv`;async function j(e,t){let n=C(e),r=A(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:O(t),accept:{[r]:[k(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new M}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var M=class extends Error{constructor(){super(`CSV export cancelled`)}};async function N(e){let n=await j(`${e.table}${k(e.delimiter)}`,e.delimiter),r=0;try{let i=await h({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(E(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>E(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{source:`table`,rows:r,format:O(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function P(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(E(o,r));for(let e of n)s.push(E(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${A(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=C(a??`query_result${k(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{source:`result`,rows:n.length,format:O(r)})}var F=a(),I=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=o(),{activeDialog:t,closeDialog:n}=r(),a=i(`export-csv`),h=m(e=>e.activeConnectionId),C=ee(),T=t===`export-csv`,[E,O]=(0,w.useState)(`query_result`),[k,A]=(0,w.useState)(``),[j,L]=(0,w.useState)([]),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(`,`),[H,U]=(0,w.useState)(!0),[W,G]=(0,w.useState)(!1),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useRef)(null),Z=D(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===p.TABLE||a.nodeType===p.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!h)return null;let e=(C.tabs[h]??[]).find(e=>e.id===C.activeTabId[h]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,w.useEffect)(()=>{if(!T)return;let e=Q();V(a?.delimiter??`,`),e&&(A(e.table),O(`table_data`))},[T]),(0,w.useEffect)(()=>{if(!T||!h)return;let e=m.getState().activeConnections.find(e=>e.id===h);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await ne(h).introspect.listDatabases(te(e.serverConnectionId));if(t)return;L(n);let r=C.tabs[h]?.find(e=>e.id===C.activeTabId[h])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[T,h]);function $(e){if(!e){if(W){X.current?.abort();return}n(),O(`query_result`),A(``),V(`,`),U(!0)}}async function ae(){if(!h)return;if(Y(null),E===`query_result`){let e=C.activeTabId[h],t=(C.tabs[h]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;P(t.fields,t.rows,B,H),n();return}if(!k.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let i=await N({connectionId:h,database:R,table:k.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});r.getState().setFooterMessage(e(`database.csv.done`,{count:i,table:k.trim(),format:Z})),n()}catch(e){!(e instanceof M)&&!(e instanceof re&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,F.jsx)(S,{open:T,onOpenChange:$,children:(0,F.jsxs)(b,{className:`sm:max-w-[450px]`,children:[(0,F.jsx)(v,{children:(0,F.jsx)(x,{children:e(`database.csv.title`,{format:Z})})}),(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{children:e(`database.csv.target`)}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`query_result`,checked:E===`query_result`,onChange:()=>O(`query_result`)}),e(`database.csv.targetQueryResult`)]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`table_data`,checked:E===`table_data`,onChange:()=>O(`table_data`)}),e(`database.csv.targetTableData`)]})]})]}),E===`table_data`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-database`,children:e(`database.csv.database`)}),(0,F.jsxs)(f,{value:R,onValueChange:z,disabled:j.length===0,children:[(0,F.jsx)(l,{id:`csv-database`,className:`w-full`,children:(0,F.jsx)(c,{placeholder:e(`database.csv.databasePlaceholder`)})}),(0,F.jsx)(u,{children:j.map(e=>(0,F.jsx)(d,{value:e,children:e},e))})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-table-name`,children:e(`database.csv.tableName`)}),(0,F.jsx)(_,{id:`csv-table-name`,value:k,onChange:e=>A(e.target.value),placeholder:e(`database.csv.tableNamePlaceholder`)})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-delimiter`,children:e(`database.csv.delimiter`)}),(0,F.jsxs)(f,{value:B,onValueChange:V,children:[(0,F.jsx)(l,{id:`csv-delimiter`,className:`w-full`,children:(0,F.jsx)(c,{})}),(0,F.jsx)(u,{children:I.map(t=>(0,F.jsx)(d,{value:t.value,children:e(t.label)},t.value))})]})]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked)}),e(`database.csv.includeHeaders`)]})]}),K&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(ie,{value:oe??0}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:K.total===null?e(`database.csv.progressUnknown`,{loaded:K.loaded}):e(`database.csv.progress`,{loaded:K.loaded,total:K.total})})]}),J&&(0,F.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:J}),(0,F.jsxs)(y,{children:[(0,F.jsx)(s,{variant:`outline`,onClick:()=>$(!1),children:e(W?`database.csv.stop`:`database.csv.cancel`)}),(0,F.jsx)(s,{onClick:ae,disabled:W||E===`table_data`&&!k.trim(),children:e(W?`database.csv.downloading`:`database.csv.download`)})]})]})})}export{L as DownloadToCSVDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./B3nhMsGp.js";import{r as t}from"./BfSKVZnY.js";function n(n){let r=e.getState().activeConnections.find(e=>e.id===n);return t(r)}function r(n){let r=e.getState().activeConnections.find(e=>e.serverConnectionId===n);return t(r)}function i(){return n(e.getState().activeConnectionId)}export{n,r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,n as t,r as n}from"./XzPc-eVf.js";import{a as r,i}from"./ClyAuDY9.js";import{i as a,n as o,r as s,t as c}from"./eFSiW0Lh.js";import{f as l,t as u}from"./DTxGpkJp.js";import{T as d,i as f,l as p,n as ee,s as m,t as te,u as h,w as ne}from"./BdPEUnLq.js";import{t as g}from"./Bit0Kfog.js";import{n as re}from"./CChaTOPr.js";function _(e,t,n){return e.map(e=>e.id===t?n(e):e.children.length>0?{...e,children:_(e.children,t,n)}:e)}function ie(e,t){for(let n of e){if(n.id===t)return n;let e=ie(n.children,t);if(e)return e}return null}function v(e,t,n){let r=new Set(e??[]);if(n)r.add(t);else for(let e of r)(e===t||e.startsWith(`${t}/`))&&r.delete(e);return[...r]}var y=n()(a(e=>({trees:{},selectedNodeId:{},expandedIds:{},setTree:(t,n)=>e(e=>({trees:{...e.trees,[t]:n}})),setChildren:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,!0)},trees:{...e.trees,[t]:_(i,n,e=>({...e,children:r,isLoading:!1,isExpanded:!0,metadata:{...e.metadata,count:r.length}}))}}:e}),setNodeMetadata:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:_(i,n,e=>({...e,metadata:{...e.metadata,...r}}))}}:e}),toggleExpanded:(t,n)=>e(e=>{let r=e.trees[t];if(!r)return e;let i=!ie(r,n)?.isExpanded;return{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,i)},trees:{...e.trees,[t]:_(r,n,e=>({...e,isExpanded:i}))}}}),setExpanded:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,r)},trees:{...e.trees,[t]:_(i,n,e=>({...e,isExpanded:r}))}}:e}),setSelected:(t,n)=>e(e=>({selectedNodeId:{...e.selectedNodeId,[t]:n}})),setLoading:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:_(i,n,e=>({...e,isLoading:r}))}}:e}),removeTree:t=>e(e=>{let n={...e.trees},r={...e.selectedNodeId};return delete n[t],delete r[t],{trees:n,selectedNodeId:r}})}),{name:`planche-schema`,storage:c(),partialize:e=>({selectedNodeId:e.selectedNodeId,expandedIds:e.expandedIds})})),b=32,x=24,ae=931071618,oe=931071619,S=(e,t)=>(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0,se=(e,t)=>(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0;function C(e,t,n,r,i=0,a=0){let o=r?S:se;for(let r=t;r<t+n;r+=8)i=i+o(e,r)+a>>>0,a=a+o(e,r+4)+i>>>0;return[i,a]}function ce(e){if(e.byteLength<b)return null;let t=S(e,0);if(t!==ae&&t!==oe)return null;let n=t===oe,r=S(e,8);if(r<512||r>65536||r&r-1)return null;let i=S(e,16),a=S(e,20),[o,s]=C(e,0,24,n);if(o!==S(e,24)||s!==S(e,28))return null;let c=x+r,l=new Map,u=new Map,d=0,f=0,p=0;for(let t=b;t+c<=e.byteLength&&!(S(e,t+8)!==i||S(e,t+12)!==a||([o,s]=C(e,t,8,n,o,s),[o,s]=C(e,t+x,r,n,o,s),o!==S(e,t+16)||s!==S(e,t+20)));t+=c){let n=S(e,t),r=S(e,t+4);if(n===0)break;if(u.set(n,e.subarray(t+x,t+c)),p++,r>0){for(let[e,t]of u)l.set(e,t);u.clear(),d=r,f+=p,p=0}}return{pageSize:r,dbSizePages:d,pages:l,committedFrames:f}}function le(e,t){let n=ce(t);if(!n||n.committedFrames===0)return{bytes:e,appliedFrames:0};let{pageSize:r,dbSizePages:i,pages:a}=n,o=Math.max(i*r,e.byteLength-e.byteLength%r),s=new Uint8Array(o);s.set(e.subarray(0,Math.min(e.byteLength,o)));for(let[e,t]of a){let n=(e-1)*r;n+r<=o&&s.set(t,n)}return{bytes:i>0?s.subarray(0,i*r):s,appliedFrames:n.committedFrames}}var ue=`planche-file-handles`,w=`handles`;function de(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB unavailable`));return}let n=indexedDB.open(ue,1);n.onupgradeneeded=()=>n.result.createObjectStore(w),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function T(e,t){return de().then(n=>new Promise((r,i)=>{let a=t(n.transaction(w,e).objectStore(w));a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)}))}var E=e=>`${e}:wal`;async function D(e,t){try{await T(`readwrite`,n=>n.put(t,e))}catch{}}async function O(e){try{return await T(`readonly`,t=>t.get(e))??null}catch{return null}}async function k(e){try{await T(`readwrite`,t=>t.delete(e))}catch{}}async function A(e,t){let n=e,r={mode:`readwrite`};try{if(n.queryPermission&&await n.queryPermission(r)===`granted`)return!0;if(t&&n.requestPermission)return await n.requestPermission(r)===`granted`}catch{}return!1}var j=e=>`dbcache-meta:${e}`,M=e=>`${e}.sqlite3`;async function fe(e){try{let t=await s.getItem(j(e));if(!t)return null;let n=JSON.parse(t),r=await o.get(M(e));return r?{bytes:new Uint8Array(r),meta:n}:null}catch{return null}}async function pe(e,t,n){try{let r=t.slice().buffer;return await o.set(M(e),r)?(await s.setItem(j(e),JSON.stringify(n)),!0):!1}catch(e){return console.warn(`[db-cache] write failed:`,e),!1}}async function me(e,t){try{let n=await s.getItem(j(e));if(!n)return;await s.setItem(j(e),JSON.stringify({...JSON.parse(n),...t}))}catch{}}async function N(e){try{await o.remove(M(e)),await s.removeItem(j(e))}catch{}}var he=`browser:`;function P(e){return typeof e==`string`&&e.startsWith(`browser:`)}var ge=750;function _e(e){let t=z.get(e);t?.profileId&&(t.flushTimer&&clearTimeout(t.flushTimer),t.flushTimer=setTimeout(()=>{t.flushTimer=null,F(e)},ge))}async function F(e){let t=z.get(e);if(t?.profileId)try{let n=await J(e);await pe(t.profileId,n,I(t))}catch(e){console.warn(`[browser-sqlite] cache flush failed:`,e)}}function I(e){return{name:e.source.name,lastModified:e.fileMeta.lastModified,size:e.fileMeta.size,dirty:e.dirty,cachedAt:Date.now()}}var L=g(`browserSqliteVisibilityListener`,()=>({installed:!1}));typeof document<`u`&&!L.installed&&(L.installed=!0,document.addEventListener(`visibilitychange`,()=>{if(document.visibilityState===`hidden`)for(let[e,t]of z)t.flushTimer&&(clearTimeout(t.flushTimer),t.flushTimer=null,F(e))}));function R(e){return e.toLowerCase().endsWith(`-wal`)}var z=g(`browserSqliteDatabases`,()=>new Map),B=g(`browserSqliteModule`,()=>({promise:null}));async function V(){return B.promise||=i(()=>import(`./DD58tsa9.js`).then(e=>e.default()),[]),B.promise}function H(e){let t=z.get(e);if(!t)throw Error(`Browser connection not found: ${e}`);return t}function ve(e){if(!(e.byteLength>=100&&e[0]===83&&e[15]===0)||e[18]!==2&&e[19]!==2)return{bytes:e,wal:!1};let t=new Uint8Array(e);return t[18]=1,t[19]=1,{bytes:t,wal:!0}}var ye=`SQLite format 3\0`;function be(e){if(e.byteLength===0)return null;if(e.byteLength<100)return r.t(`services.sqliteFile.tooSmall`);if(String.fromCharCode(...e.subarray(0,16))!==ye)return r.t(`services.sqliteFile.notSqlite`);let t=e[16]<<8|e[17],n=t===1?65536:t;return n<512||n&n-1?r.t(`services.sqliteFile.badPageSize`,{size:n}):null}async function xe(e){let t=be(e);if(t)throw Error(t);let n=await V(),i=new n.oo1.DB;if(e.byteLength===0)return i;let a=n.wasm.allocFromTypedArray(e),o=n.capi,s=o.SQLITE_DESERIALIZE_FREEONCLOSE??1,c=o.SQLITE_DESERIALIZE_RESIZEABLE??2,l=n.capi.sqlite3_deserialize(i.pointer,`main`,a,e.byteLength,e.byteLength,s|c);i.checkRc(l);try{i.exec(`SELECT count(*) FROM sqlite_master`)}catch(e){throw i.close(),Error(r.t(`services.sqliteFile.unreadable`,{message:e instanceof Error?e.message:String(e)}))}return i}async function U(e){let t=window.showOpenFilePicker;if(t)try{let n=await t({multiple:e.multiple,types:e.sqliteOnly?[{description:r.t(`services.sqliteFile.pickerDescription`),accept:{"application/vnd.sqlite3":[`.sqlite`,`.sqlite3`,`.db`,`.db3`]}}]:void 0,excludeAcceptAllOption:!1});return Promise.all(n.map(async e=>({file:await e.getFile(),handle:e})))}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return[];throw e}return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.multiple=e.multiple,e.sqliteOnly&&(n.accept=`.sqlite,.sqlite3,.db,.db3,application/vnd.sqlite3`),n.onchange=()=>t(Array.from(n.files??[]).map(e=>({file:e}))),n.oncancel=()=>t([]),n.click()})}async function Se(){let e=await U({multiple:!0,sqliteOnly:!1}),t=e.find(e=>!R(e.file.name));return t?{main:t,wal:e.find(e=>R(e.file.name)&&e.file.name.toLowerCase()===`${t.file.name.toLowerCase()}-wal`)??e.find(e=>R(e.file.name))}:null}async function Ce(){let[e]=await U({multiple:!1,sqliteOnly:!1});return e??null}async function W(e,t,n={}){let{bytes:r,wal:i}=ve(e),a=await xe(r),o=`${he}${crypto.randomUUID()}`,s={...t,wal:i};return z.set(o,{db:a,source:s,rawBytes:e,profileId:n.profileId,fileMeta:n.fileMeta??{lastModified:0,size:e.byteLength},dirty:n.dirty??!1,flushTimer:null}),{connectionId:o,source:s}}async function G(e,t,n,r={}){let i=e?new Uint8Array(await e.arrayBuffer()):new Uint8Array,a=i,o=!1;n&&(a=le(i,new Uint8Array(await n.file.arrayBuffer())).bytes,o=!0);let s=await W(a,{name:e?.name??`:memory:`,handle:t,walApplied:o,walHandle:n?.handle},{profileId:r.profileId,fileMeta:{lastModified:Math.max(e?.lastModified??0,n?.file.lastModified??0),size:i.byteLength}});return z.get(s.connectionId).rawBytes=i,r.profileId&&F(s.connectionId),s}async function K(e,t,n,r){return await W(t,{name:n.name,handle:r,walApplied:!0},{profileId:e,fileMeta:{lastModified:n.lastModified,size:n.size},dirty:n.dirty})}function we(e,t){let n=H(e);n.source={...n.source,handle:t}}function Te(e){return z.get(e)?.dirty??!1}async function Ee(e,t){let n=H(e),r=le(n.rawBytes,new Uint8Array(await t.file.arrayBuffer())),i=await W(r.bytes,{...n.source,walApplied:!0,walHandle:t.handle},{profileId:n.profileId,fileMeta:n.fileMeta});return z.get(i.connectionId).rawBytes=n.rawBytes,X(e),n.profileId&&F(i.connectionId),{...i,appliedFrames:r.appliedFrames}}function q(e){return z.get(e)?.source??null}function De(e){return e&&e.trim().toLowerCase().replace(/\(.*$/,``).trim()||null}function Oe(e){return e==null?`null`:typeof e==`number`?Number.isInteger(e)?`integer`:`real`:typeof e==`bigint`?`bigint`:e instanceof Uint8Array?`blob`:`text`}function ke(e){return typeof e==`bigint`?Number(e):e instanceof Uint8Array?{type:`Buffer`,data:Array.from(e)}:e}async function Ae(e,t){let{db:n}=H(e),r=await V(),i=performance.now(),a=H(e),o=Number(r.capi.sqlite3_total_changes(n.pointer)),s=n.prepare(t);try{if(s.columnCount===0){s.step();let c=Number(n.changes()),l=Number(r.capi.sqlite3_last_insert_rowid(n.pointer)),u=/^\s*(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(t);return(c>0||Number(r.capi.sqlite3_total_changes(n.pointer))!==o||!u)&&(a.dirty=!0,_e(e)),{success:!0,fields:[],records:[],affectedRows:c,insertId:l,isResultQuery:!1,execTime:Math.round(performance.now()-i)}}let c=[];for(;s.step();)c.push(s.get([]).map(ke));let l=s.getColumnNames(),u=r.capi,d=s.pointer;return{success:!0,fields:l.map((e,t)=>{let n=De(u.sqlite3_column_decltype(d,t)),r=u.sqlite3_column_table_name(d,t)??``;return{name:e,orgName:u.sqlite3_column_origin_name(d,t)??e,type:n??Oe(je(c,t)),table:r,orgTable:r,db:u.sqlite3_column_database_name(d,t)??``,maxLength:0}}),records:c,affectedRows:0,insertId:0,isResultQuery:!0,execTime:Math.round(performance.now()-i)}}finally{s.finalize()}}function je(e,t){for(let n of e){let e=n[t];if(e!=null)return e}return null}async function J(e){let{db:t}=H(e);return(await V()).capi.sqlite3_js_db_export(t.pointer)}function Y(e){let t=z.get(e);if(!t?.source.handle)return null;let{source:n}=t;return n.wal&&!n.walApplied&&!n.walAcknowledged?r.t(`services.sqliteFile.walNotLoaded`):null}function Me(e){let t=H(e);t.source={...t.source,walAcknowledged:!0}}async function Ne(e){let{source:t,fileMeta:n}=e;if(!t.handle)return;let i=await t.handle.getFile();if(n.lastModified&&(i.lastModified!==n.lastModified||i.size!==n.size))throw Error(r.t(`services.sqliteFile.changedOnDisk`,{name:t.name}));if(t.walHandle)try{let e=await t.walHandle.getFile();if(e.size>0&&!t.walApplied)throw Error(r.t(`services.sqliteFile.walHasChanges`,{name:t.name}));if(e.size>0&&t.walApplied&&e.lastModified>n.lastModified)throw Error(r.t(`services.sqliteFile.walChangedOnDisk`,{name:t.name}))}catch(e){if(e instanceof Error&&!(e instanceof DOMException))throw e}}async function Pe(e){let t=H(e),{source:n}=t,i=Y(e);if(i)throw Error(i);n.handle&&await Ne(t);let a=await J(e);if(n.handle){if(!await A(n.handle,!0))throw Error(r.t(`services.sqliteFile.writeDenied`,{name:n.name}));let t=await n.handle.createWritable();await t.write(a),await t.close(),n.walHandle&&await(await n.walHandle.createWritable()).close();let i=H(e);i.dirty=!1;try{let e=await n.handle.getFile();i.fileMeta={lastModified:e.lastModified,size:e.size}}catch{i.fileMeta={lastModified:Date.now(),size:a.byteLength}}return i.profileId&&me(i.profileId,{...I(i)}),`in-place`}let o=new Blob([a],{type:`application/vnd.sqlite3`}),s=URL.createObjectURL(o),c=document.createElement(`a`);return c.href=s,c.download=n.name===`:memory:`?`database.sqlite`:n.name,c.click(),URL.revokeObjectURL(s),`download`}function X(e){let t=z.get(e);t&&(t.flushTimer&&clearTimeout(t.flushTimer),t.db.close(),z.delete(e))}function Z(e){return z.get(e)?.profileId}async function Fe(e){await k(e),await k(E(e)),await N(e)}async function Ie(e,t){let n=await O(e);if(!n)return null;if(!await A(n,t))return`denied`;try{return{handle:n,file:await n.getFile()}}catch(t){if(t instanceof DOMException&&(t.name===`NotFoundError`||t.name===`NotAllowedError`))return await k(e),null;throw t}}async function Le(e,t){let n=await O(E(e));if(!(!n||!await A(n,t)))try{return{file:await n.getFile(),handle:n}}catch{await k(E(e));return}}async function Re(e,t){let n={remembered:!0,fromCache:!1,restoredUnsaved:!1,fileDetached:!1,diskChanged:!1},r=await fe(e),i=await Ie(e,t.interactive),a=i&&i!==`denied`?i.handle:void 0,o=i&&i!==`denied`?i.file:null;if(r?.meta.dirty){let{connectionId:t,source:i}=await K(e,r.bytes,r.meta,a),s=o?o.lastModified!==r.meta.lastModified||o.size!==r.meta.size:!1;return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,restoredUnsaved:!0,fileDetached:!a,diskChanged:s}}if(o&&a){let{connectionId:r,source:i}=await G(o,a,await Le(e,t.interactive),{profileId:e});return{...n,connectionId:r,fileName:i.name,wal:i.wal,walApplied:i.walApplied}}if(r){let{connectionId:t,source:i}=await K(e,r.bytes,r.meta);return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,fileDetached:!0}}if(!t.interactive)return null;let s=await Se();if(!s)return null;let{connectionId:c,source:l}=await G(s.main.file,s.main.handle,s.wal,{profileId:e});return s.main.handle?await D(e,s.main.handle):await k(e),s.wal?.handle?await D(E(e),s.wal.handle):await k(E(e)),{...n,connectionId:c,fileName:l.name,wal:l.wal,walApplied:l.walApplied,remembered:!1}}var ze=`SQLite format 3\0`;async function Be(e){if(e.size===0)return!0;if(e.size<100)return!1;let t=new Uint8Array(await e.slice(0,16).arrayBuffer());return String.fromCharCode(...t)===ze}async function Ve(e,t){try{let n=await O(e);return n?await n.isSameEntry(t):!1}catch{return!1}}async function He(n){let i=n.find(e=>!R(e.file.name));if(!i)return;if(!await Be(i.file))throw Error(r.t(`app.dropNotSqlite`,{name:i.file.name}));let a=n.find(e=>R(e.file.name)&&e.file.name.toLowerCase()===`${i.file.name.toLowerCase()}-wal`),o=u.getState(),s;for(let e of o.savedConnections)if(!(e.dbms!==`sqlite`||(e.transport??`browser`)!==`browser`||e.sample||e.file!==i.file.name)&&i.handle&&await Ve(e.id,i.handle)){s=e;break}let c=s??{id:crypto.randomUUID(),hostName:i.file.name.replace(/\.(db|sqlite|sqlite3|db3)$/i,``),host:``,user:``,pass:``,charset:`utf8`,port:0,dbms:`sqlite`,transport:`browser`,file:i.file.name,autoConnection:!1,savePassword:!0,authToken:``};e(`sqlite_file_drop`,{reused:!!s,wal:!!a,handle:!!i.handle});let d=o.activeConnections.some(e=>e.id===c.id),f=o.activeConnections.find(e=>e.id===c.id)?.serverConnectionId,{connectionId:p}=await G(i.file,i.handle,a,{profileId:c.id});f&&f!==p&&P(f)&&X(f),i.handle?await D(c.id,i.handle):await k(c.id),a?.handle?await D(E(c.id),a.handle):await k(E(c.id)),s||o.addSavedConnection(c),o.openConnection({...c,serverConnectionId:p}),o.setPendingReopen(c.id,!1),o.setFileDetached(c.id,!1),y.getState().removeTree(c.id),l(c.id),d||re.getState().addQueryTab(c.id,{id:`tab-${Date.now()}`,title:r.t(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),t.getState().setWelcomeVisible(!1)}async function Ue(e,t){let n=await Ie(e,!0);return!n||n===`denied`?!1:(we(t,n.handle),!0)}async function We(e){let t=Z(e),n=q(e);return n&&!n.handle&&t&&await Ue(t,e),Pe(e)}function Ge(e){let t=q(e);return t?t.name===`:memory:`?r.t(`services.save.inMemory`):typeof window<`u`&&!(`showOpenFilePicker`in window)?r.t(`services.save.noFileSystemAccess`):!t.handle&&!Z(e)?r.t(`services.save.noWritableHandle`):null:r.t(`services.save.notBrowserSqlite`)}async function Ke(e,t){let n=await Ce();if(!n)return null;let r=await Ee(t,n);return n.handle&&await D(E(e),n.handle),{connectionId:r.connectionId,appliedFrames:r.appliedFrames}}function qe(e){if(!P(e))return null;let t=q(e);return t?{wal:t.wal,walApplied:t.walApplied,walAcknowledged:t.walAcknowledged??!1}:null}function Je(e){return e.dbms===`sqlite`&&e.transport===`browser`?`browser`:`tunnel`}async function Ye(e,t){return m(e,t)}async function Xe(e,t){return ne(e,t)}async function Ze(e,t,n){let r=e=>({success:!1,fields:[],records:[],affectedRows:0,insertId:0,isResultQuery:!1,execTime:0,message:e instanceof Error?e.message:String(e)});if(P(e))try{return await Ae(e,t)}catch(e){return r(e)}let i=Q.get(e)??e;try{return await h(i,t,n)}catch(e){if(!(e instanceof te)||e.status!==404)return r(e);let a=await Qe(i);if(!a)return r(e);try{return await h(a,t,n)}catch(e){return r(e)}}}var Q=new Map,$=new Map;function Qe(e){let n=$.get(e);if(n)return n;let i=(async()=>{let n=u.getState(),i=n.activeConnections.find(t=>t.serverConnectionId===e||Q.get(t.serverConnectionId??``)===e);if(!i||Je(i)===`browser`||ee())return null;if(i.serverConnectionId&&i.serverConnectionId!==e&&!Q.has(i.serverConnectionId))return Q.set(e,i.serverConnectionId),i.serverConnectionId;let a=n.resolveCredentials(i),o=a.ssh?.enabled&&a.ssh.auth===`password`&&!a.ssh.password;if(!a.pass&&i.pass===``&&i.dbms!==`sqlite`||o)return null;try{let n=await m(d(a),a.authToken||void 0);if(!n.success||!n.connectionId)return null;for(let[t,r]of Q)r===e&&Q.set(t,n.connectionId);return Q.set(e,n.connectionId),u.getState().updateServerConnectionId(i.id,n.connectionId),u.getState().setTransactionOpen(i.id,!1),t.getState().setFooterMessage(r.t(`services.agent.reconnected`,{name:i.hostName||i.host||i.databaseId||i.file||i.id})),n.connectionId}catch{return null}})();return $.set(e,i),i.finally(()=>$.delete(e)),i}async function $e(e){if(P(e)){let t=Z(e);X(e),t&&await N(t);return}return p(e)}function et(e){return e===`cancelled`?null:e===`abandoned`?r.t(`result.running.abandoned`):e===`agent-outdated`?r.t(`result.running.agentOutdated`):e===`unsupported`?r.t(`result.running.cannotCancel`):r.t(`result.running.cancelFailed`)}async function tt(e){if(P(e))return`unsupported`;let t=u.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;return t?f(t):`failed`}function nt(e){return async(t,n)=>{let i=await Ze(e,t,n);if(!i.success)throw Error(i.message??r.t(`services.query.failed`));return i}}export{y as S,Me as _,nt as a,Te as b,Ze as c,Je as d,Ke as f,Xe as g,We as h,Ye as i,Fe as l,Ue as m,et as n,Ge as o,He as p,Re as r,$e as s,tt as t,qe as u,Y as v,G as x,P as y};
|
|
1
|
+
import{c as e,n as t,r as n}from"./XzPc-eVf.js";import{a as r,i}from"./fDSXGLmI.js";import{i as a,n as o,r as s,t as c}from"./eFSiW0Lh.js";import{f as l,t as u}from"./B3nhMsGp.js";import{T as d,i as f,l as p,n as ee,s as m,t as te,u as h,w as ne}from"./Ca4g4XbM.js";import{t as g}from"./Bit0Kfog.js";import{n as re}from"./BNkgLUl5.js";function _(e,t,n){return e.map(e=>e.id===t?n(e):e.children.length>0?{...e,children:_(e.children,t,n)}:e)}function ie(e,t){for(let n of e){if(n.id===t)return n;let e=ie(n.children,t);if(e)return e}return null}function v(e,t,n){let r=new Set(e??[]);if(n)r.add(t);else for(let e of r)(e===t||e.startsWith(`${t}/`))&&r.delete(e);return[...r]}var y=n()(a(e=>({trees:{},selectedNodeId:{},expandedIds:{},setTree:(t,n)=>e(e=>({trees:{...e.trees,[t]:n}})),setChildren:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,!0)},trees:{...e.trees,[t]:_(i,n,e=>({...e,children:r,isLoading:!1,isExpanded:!0,metadata:{...e.metadata,count:r.length}}))}}:e}),setNodeMetadata:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:_(i,n,e=>({...e,metadata:{...e.metadata,...r}}))}}:e}),toggleExpanded:(t,n)=>e(e=>{let r=e.trees[t];if(!r)return e;let i=!ie(r,n)?.isExpanded;return{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,i)},trees:{...e.trees,[t]:_(r,n,e=>({...e,isExpanded:i}))}}}),setExpanded:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{expandedIds:{...e.expandedIds,[t]:v(e.expandedIds[t],n,r)},trees:{...e.trees,[t]:_(i,n,e=>({...e,isExpanded:r}))}}:e}),setSelected:(t,n)=>e(e=>({selectedNodeId:{...e.selectedNodeId,[t]:n}})),setLoading:(t,n,r)=>e(e=>{let i=e.trees[t];return i?{trees:{...e.trees,[t]:_(i,n,e=>({...e,isLoading:r}))}}:e}),removeTree:t=>e(e=>{let n={...e.trees},r={...e.selectedNodeId};return delete n[t],delete r[t],{trees:n,selectedNodeId:r}})}),{name:`planche-schema`,storage:c(),partialize:e=>({selectedNodeId:e.selectedNodeId,expandedIds:e.expandedIds})})),b=32,x=24,ae=931071618,oe=931071619,S=(e,t)=>(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0,se=(e,t)=>(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0;function C(e,t,n,r,i=0,a=0){let o=r?S:se;for(let r=t;r<t+n;r+=8)i=i+o(e,r)+a>>>0,a=a+o(e,r+4)+i>>>0;return[i,a]}function ce(e){if(e.byteLength<b)return null;let t=S(e,0);if(t!==ae&&t!==oe)return null;let n=t===oe,r=S(e,8);if(r<512||r>65536||r&r-1)return null;let i=S(e,16),a=S(e,20),[o,s]=C(e,0,24,n);if(o!==S(e,24)||s!==S(e,28))return null;let c=x+r,l=new Map,u=new Map,d=0,f=0,p=0;for(let t=b;t+c<=e.byteLength&&!(S(e,t+8)!==i||S(e,t+12)!==a||([o,s]=C(e,t,8,n,o,s),[o,s]=C(e,t+x,r,n,o,s),o!==S(e,t+16)||s!==S(e,t+20)));t+=c){let n=S(e,t),r=S(e,t+4);if(n===0)break;if(u.set(n,e.subarray(t+x,t+c)),p++,r>0){for(let[e,t]of u)l.set(e,t);u.clear(),d=r,f+=p,p=0}}return{pageSize:r,dbSizePages:d,pages:l,committedFrames:f}}function le(e,t){let n=ce(t);if(!n||n.committedFrames===0)return{bytes:e,appliedFrames:0};let{pageSize:r,dbSizePages:i,pages:a}=n,o=Math.max(i*r,e.byteLength-e.byteLength%r),s=new Uint8Array(o);s.set(e.subarray(0,Math.min(e.byteLength,o)));for(let[e,t]of a){let n=(e-1)*r;n+r<=o&&s.set(t,n)}return{bytes:i>0?s.subarray(0,i*r):s,appliedFrames:n.committedFrames}}var ue=`planche-file-handles`,w=`handles`;function de(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`IndexedDB unavailable`));return}let n=indexedDB.open(ue,1);n.onupgradeneeded=()=>n.result.createObjectStore(w),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function T(e,t){return de().then(n=>new Promise((r,i)=>{let a=t(n.transaction(w,e).objectStore(w));a.onsuccess=()=>r(a.result),a.onerror=()=>i(a.error)}))}var E=e=>`${e}:wal`;async function D(e,t){try{await T(`readwrite`,n=>n.put(t,e))}catch{}}async function O(e){try{return await T(`readonly`,t=>t.get(e))??null}catch{return null}}async function k(e){try{await T(`readwrite`,t=>t.delete(e))}catch{}}async function A(e,t){let n=e,r={mode:`readwrite`};try{if(n.queryPermission&&await n.queryPermission(r)===`granted`)return!0;if(t&&n.requestPermission)return await n.requestPermission(r)===`granted`}catch{}return!1}var j=e=>`dbcache-meta:${e}`,M=e=>`${e}.sqlite3`;async function fe(e){try{let t=await s.getItem(j(e));if(!t)return null;let n=JSON.parse(t),r=await o.get(M(e));return r?{bytes:new Uint8Array(r),meta:n}:null}catch{return null}}async function pe(e,t,n){try{let r=t.slice().buffer;return await o.set(M(e),r)?(await s.setItem(j(e),JSON.stringify(n)),!0):!1}catch(e){return console.warn(`[db-cache] write failed:`,e),!1}}async function me(e,t){try{let n=await s.getItem(j(e));if(!n)return;await s.setItem(j(e),JSON.stringify({...JSON.parse(n),...t}))}catch{}}async function N(e){try{await o.remove(M(e)),await s.removeItem(j(e))}catch{}}var he=`browser:`;function P(e){return typeof e==`string`&&e.startsWith(`browser:`)}var ge=750;function _e(e){let t=z.get(e);t?.profileId&&(t.flushTimer&&clearTimeout(t.flushTimer),t.flushTimer=setTimeout(()=>{t.flushTimer=null,F(e)},ge))}async function F(e){let t=z.get(e);if(t?.profileId)try{let n=await J(e);await pe(t.profileId,n,I(t))}catch(e){console.warn(`[browser-sqlite] cache flush failed:`,e)}}function I(e){return{name:e.source.name,lastModified:e.fileMeta.lastModified,size:e.fileMeta.size,dirty:e.dirty,cachedAt:Date.now()}}var L=g(`browserSqliteVisibilityListener`,()=>({installed:!1}));typeof document<`u`&&!L.installed&&(L.installed=!0,document.addEventListener(`visibilitychange`,()=>{if(document.visibilityState===`hidden`)for(let[e,t]of z)t.flushTimer&&(clearTimeout(t.flushTimer),t.flushTimer=null,F(e))}));function R(e){return e.toLowerCase().endsWith(`-wal`)}var z=g(`browserSqliteDatabases`,()=>new Map),B=g(`browserSqliteModule`,()=>({promise:null}));async function V(){return B.promise||=i(()=>import(`./DD58tsa9.js`).then(e=>e.default()),[]),B.promise}function H(e){let t=z.get(e);if(!t)throw Error(`Browser connection not found: ${e}`);return t}function ve(e){if(!(e.byteLength>=100&&e[0]===83&&e[15]===0)||e[18]!==2&&e[19]!==2)return{bytes:e,wal:!1};let t=new Uint8Array(e);return t[18]=1,t[19]=1,{bytes:t,wal:!0}}var ye=`SQLite format 3\0`;function be(e){if(e.byteLength===0)return null;if(e.byteLength<100)return r.t(`services.sqliteFile.tooSmall`);if(String.fromCharCode(...e.subarray(0,16))!==ye)return r.t(`services.sqliteFile.notSqlite`);let t=e[16]<<8|e[17],n=t===1?65536:t;return n<512||n&n-1?r.t(`services.sqliteFile.badPageSize`,{size:n}):null}async function xe(e){let t=be(e);if(t)throw Error(t);let n=await V(),i=new n.oo1.DB;if(e.byteLength===0)return i;let a=n.wasm.allocFromTypedArray(e),o=n.capi,s=o.SQLITE_DESERIALIZE_FREEONCLOSE??1,c=o.SQLITE_DESERIALIZE_RESIZEABLE??2,l=n.capi.sqlite3_deserialize(i.pointer,`main`,a,e.byteLength,e.byteLength,s|c);i.checkRc(l);try{i.exec(`SELECT count(*) FROM sqlite_master`)}catch(e){throw i.close(),Error(r.t(`services.sqliteFile.unreadable`,{message:e instanceof Error?e.message:String(e)}))}return i}async function U(e){let t=window.showOpenFilePicker;if(t)try{let n=await t({multiple:e.multiple,types:e.sqliteOnly?[{description:r.t(`services.sqliteFile.pickerDescription`),accept:{"application/vnd.sqlite3":[`.sqlite`,`.sqlite3`,`.db`,`.db3`]}}]:void 0,excludeAcceptAllOption:!1});return Promise.all(n.map(async e=>({file:await e.getFile(),handle:e})))}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return[];throw e}return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.multiple=e.multiple,e.sqliteOnly&&(n.accept=`.sqlite,.sqlite3,.db,.db3,application/vnd.sqlite3`),n.onchange=()=>t(Array.from(n.files??[]).map(e=>({file:e}))),n.oncancel=()=>t([]),n.click()})}async function Se(){let e=await U({multiple:!0,sqliteOnly:!1}),t=e.find(e=>!R(e.file.name));return t?{main:t,wal:e.find(e=>R(e.file.name)&&e.file.name.toLowerCase()===`${t.file.name.toLowerCase()}-wal`)??e.find(e=>R(e.file.name))}:null}async function Ce(){let[e]=await U({multiple:!1,sqliteOnly:!1});return e??null}async function W(e,t,n={}){let{bytes:r,wal:i}=ve(e),a=await xe(r),o=`${he}${crypto.randomUUID()}`,s={...t,wal:i};return z.set(o,{db:a,source:s,rawBytes:e,profileId:n.profileId,fileMeta:n.fileMeta??{lastModified:0,size:e.byteLength},dirty:n.dirty??!1,flushTimer:null}),{connectionId:o,source:s}}async function G(e,t,n,r={}){let i=e?new Uint8Array(await e.arrayBuffer()):new Uint8Array,a=i,o=!1;n&&(a=le(i,new Uint8Array(await n.file.arrayBuffer())).bytes,o=!0);let s=await W(a,{name:e?.name??`:memory:`,handle:t,walApplied:o,walHandle:n?.handle},{profileId:r.profileId,fileMeta:{lastModified:Math.max(e?.lastModified??0,n?.file.lastModified??0),size:i.byteLength}});return z.get(s.connectionId).rawBytes=i,r.profileId&&F(s.connectionId),s}async function K(e,t,n,r){return await W(t,{name:n.name,handle:r,walApplied:!0},{profileId:e,fileMeta:{lastModified:n.lastModified,size:n.size},dirty:n.dirty})}function we(e,t){let n=H(e);n.source={...n.source,handle:t}}function Te(e){return z.get(e)?.dirty??!1}async function Ee(e,t){let n=H(e),r=le(n.rawBytes,new Uint8Array(await t.file.arrayBuffer())),i=await W(r.bytes,{...n.source,walApplied:!0,walHandle:t.handle},{profileId:n.profileId,fileMeta:n.fileMeta});return z.get(i.connectionId).rawBytes=n.rawBytes,X(e),n.profileId&&F(i.connectionId),{...i,appliedFrames:r.appliedFrames}}function q(e){return z.get(e)?.source??null}function De(e){return e&&e.trim().toLowerCase().replace(/\(.*$/,``).trim()||null}function Oe(e){return e==null?`null`:typeof e==`number`?Number.isInteger(e)?`integer`:`real`:typeof e==`bigint`?`bigint`:e instanceof Uint8Array?`blob`:`text`}function ke(e){return typeof e==`bigint`?Number(e):e instanceof Uint8Array?{type:`Buffer`,data:Array.from(e)}:e}async function Ae(e,t){let{db:n}=H(e),r=await V(),i=performance.now(),a=H(e),o=Number(r.capi.sqlite3_total_changes(n.pointer)),s=n.prepare(t);try{if(s.columnCount===0){s.step();let c=Number(n.changes()),l=Number(r.capi.sqlite3_last_insert_rowid(n.pointer)),u=/^\s*(BEGIN|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(t);return(c>0||Number(r.capi.sqlite3_total_changes(n.pointer))!==o||!u)&&(a.dirty=!0,_e(e)),{success:!0,fields:[],records:[],affectedRows:c,insertId:l,isResultQuery:!1,execTime:Math.round(performance.now()-i)}}let c=[];for(;s.step();)c.push(s.get([]).map(ke));let l=s.getColumnNames(),u=r.capi,d=s.pointer;return{success:!0,fields:l.map((e,t)=>{let n=De(u.sqlite3_column_decltype(d,t)),r=u.sqlite3_column_table_name(d,t)??``;return{name:e,orgName:u.sqlite3_column_origin_name(d,t)??e,type:n??Oe(je(c,t)),table:r,orgTable:r,db:u.sqlite3_column_database_name(d,t)??``,maxLength:0}}),records:c,affectedRows:0,insertId:0,isResultQuery:!0,execTime:Math.round(performance.now()-i)}}finally{s.finalize()}}function je(e,t){for(let n of e){let e=n[t];if(e!=null)return e}return null}async function J(e){let{db:t}=H(e);return(await V()).capi.sqlite3_js_db_export(t.pointer)}function Y(e){let t=z.get(e);if(!t?.source.handle)return null;let{source:n}=t;return n.wal&&!n.walApplied&&!n.walAcknowledged?r.t(`services.sqliteFile.walNotLoaded`):null}function Me(e){let t=H(e);t.source={...t.source,walAcknowledged:!0}}async function Ne(e){let{source:t,fileMeta:n}=e;if(!t.handle)return;let i=await t.handle.getFile();if(n.lastModified&&(i.lastModified!==n.lastModified||i.size!==n.size))throw Error(r.t(`services.sqliteFile.changedOnDisk`,{name:t.name}));if(t.walHandle)try{let e=await t.walHandle.getFile();if(e.size>0&&!t.walApplied)throw Error(r.t(`services.sqliteFile.walHasChanges`,{name:t.name}));if(e.size>0&&t.walApplied&&e.lastModified>n.lastModified)throw Error(r.t(`services.sqliteFile.walChangedOnDisk`,{name:t.name}))}catch(e){if(e instanceof Error&&!(e instanceof DOMException))throw e}}async function Pe(e){let t=H(e),{source:n}=t,i=Y(e);if(i)throw Error(i);n.handle&&await Ne(t);let a=await J(e);if(n.handle){if(!await A(n.handle,!0))throw Error(r.t(`services.sqliteFile.writeDenied`,{name:n.name}));let t=await n.handle.createWritable();await t.write(a),await t.close(),n.walHandle&&await(await n.walHandle.createWritable()).close();let i=H(e);i.dirty=!1;try{let e=await n.handle.getFile();i.fileMeta={lastModified:e.lastModified,size:e.size}}catch{i.fileMeta={lastModified:Date.now(),size:a.byteLength}}return i.profileId&&me(i.profileId,{...I(i)}),`in-place`}let o=new Blob([a],{type:`application/vnd.sqlite3`}),s=URL.createObjectURL(o),c=document.createElement(`a`);return c.href=s,c.download=n.name===`:memory:`?`database.sqlite`:n.name,c.click(),URL.revokeObjectURL(s),`download`}function X(e){let t=z.get(e);t&&(t.flushTimer&&clearTimeout(t.flushTimer),t.db.close(),z.delete(e))}function Z(e){return z.get(e)?.profileId}async function Fe(e){await k(e),await k(E(e)),await N(e)}async function Ie(e,t){let n=await O(e);if(!n)return null;if(!await A(n,t))return`denied`;try{return{handle:n,file:await n.getFile()}}catch(t){if(t instanceof DOMException&&(t.name===`NotFoundError`||t.name===`NotAllowedError`))return await k(e),null;throw t}}async function Le(e,t){let n=await O(E(e));if(!(!n||!await A(n,t)))try{return{file:await n.getFile(),handle:n}}catch{await k(E(e));return}}async function Re(e,t){let n={remembered:!0,fromCache:!1,restoredUnsaved:!1,fileDetached:!1,diskChanged:!1},r=await fe(e),i=await Ie(e,t.interactive),a=i&&i!==`denied`?i.handle:void 0,o=i&&i!==`denied`?i.file:null;if(r?.meta.dirty){let{connectionId:t,source:i}=await K(e,r.bytes,r.meta,a),s=o?o.lastModified!==r.meta.lastModified||o.size!==r.meta.size:!1;return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,restoredUnsaved:!0,fileDetached:!a,diskChanged:s}}if(o&&a){let{connectionId:r,source:i}=await G(o,a,await Le(e,t.interactive),{profileId:e});return{...n,connectionId:r,fileName:i.name,wal:i.wal,walApplied:i.walApplied}}if(r){let{connectionId:t,source:i}=await K(e,r.bytes,r.meta);return{...n,connectionId:t,fileName:i.name,wal:i.wal,walApplied:i.walApplied,fromCache:!0,fileDetached:!0}}if(!t.interactive)return null;let s=await Se();if(!s)return null;let{connectionId:c,source:l}=await G(s.main.file,s.main.handle,s.wal,{profileId:e});return s.main.handle?await D(e,s.main.handle):await k(e),s.wal?.handle?await D(E(e),s.wal.handle):await k(E(e)),{...n,connectionId:c,fileName:l.name,wal:l.wal,walApplied:l.walApplied,remembered:!1}}var ze=`SQLite format 3\0`;async function Be(e){if(e.size===0)return!0;if(e.size<100)return!1;let t=new Uint8Array(await e.slice(0,16).arrayBuffer());return String.fromCharCode(...t)===ze}async function Ve(e,t){try{let n=await O(e);return n?await n.isSameEntry(t):!1}catch{return!1}}async function He(n){let i=n.find(e=>!R(e.file.name));if(!i)return;if(!await Be(i.file))throw Error(r.t(`app.dropNotSqlite`,{name:i.file.name}));let a=n.find(e=>R(e.file.name)&&e.file.name.toLowerCase()===`${i.file.name.toLowerCase()}-wal`),o=u.getState(),s;for(let e of o.savedConnections)if(!(e.dbms!==`sqlite`||(e.transport??`browser`)!==`browser`||e.sample||e.file!==i.file.name)&&i.handle&&await Ve(e.id,i.handle)){s=e;break}let c=s??{id:crypto.randomUUID(),hostName:i.file.name.replace(/\.(db|sqlite|sqlite3|db3)$/i,``),host:``,user:``,pass:``,charset:`utf8`,port:0,dbms:`sqlite`,transport:`browser`,file:i.file.name,autoConnection:!1,savePassword:!0,authToken:``};e(`sqlite_file_drop`,{reused:!!s,wal:!!a,handle:!!i.handle});let d=o.activeConnections.some(e=>e.id===c.id),f=o.activeConnections.find(e=>e.id===c.id)?.serverConnectionId,{connectionId:p}=await G(i.file,i.handle,a,{profileId:c.id});f&&f!==p&&P(f)&&X(f),i.handle?await D(c.id,i.handle):await k(c.id),a?.handle?await D(E(c.id),a.handle):await k(E(c.id)),s||o.addSavedConnection(c),o.openConnection({...c,serverConnectionId:p}),o.setPendingReopen(c.id,!1),o.setFileDetached(c.id,!1),y.getState().removeTree(c.id),l(c.id),d||re.getState().addQueryTab(c.id,{id:`tab-${Date.now()}`,title:r.t(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),t.getState().setWelcomeVisible(!1)}async function Ue(e,t){let n=await Ie(e,!0);return!n||n===`denied`?!1:(we(t,n.handle),!0)}async function We(e){let t=Z(e),n=q(e);return n&&!n.handle&&t&&await Ue(t,e),Pe(e)}function Ge(e){let t=q(e);return t?t.name===`:memory:`?r.t(`services.save.inMemory`):typeof window<`u`&&!(`showOpenFilePicker`in window)?r.t(`services.save.noFileSystemAccess`):!t.handle&&!Z(e)?r.t(`services.save.noWritableHandle`):null:r.t(`services.save.notBrowserSqlite`)}async function Ke(e,t){let n=await Ce();if(!n)return null;let r=await Ee(t,n);return n.handle&&await D(E(e),n.handle),{connectionId:r.connectionId,appliedFrames:r.appliedFrames}}function qe(e){if(!P(e))return null;let t=q(e);return t?{wal:t.wal,walApplied:t.walApplied,walAcknowledged:t.walAcknowledged??!1}:null}function Je(e){return e.dbms===`sqlite`&&e.transport===`browser`?`browser`:`tunnel`}async function Ye(e,t){return m(e,t)}async function Xe(e,t){return ne(e,t)}async function Ze(e,t,n){let r=e=>({success:!1,fields:[],records:[],affectedRows:0,insertId:0,isResultQuery:!1,execTime:0,message:e instanceof Error?e.message:String(e)});if(P(e))try{return await Ae(e,t)}catch(e){return r(e)}let i=Q.get(e)??e;try{return await h(i,t,n)}catch(e){if(!(e instanceof te)||e.status!==404)return r(e);let a=await Qe(i);if(!a)return r(e);try{return await h(a,t,n)}catch(e){return r(e)}}}var Q=new Map,$=new Map;function Qe(e){let n=$.get(e);if(n)return n;let i=(async()=>{let n=u.getState(),i=n.activeConnections.find(t=>t.serverConnectionId===e||Q.get(t.serverConnectionId??``)===e);if(!i||Je(i)===`browser`||ee())return null;if(i.serverConnectionId&&i.serverConnectionId!==e&&!Q.has(i.serverConnectionId))return Q.set(e,i.serverConnectionId),i.serverConnectionId;let a=n.resolveCredentials(i),o=a.ssh?.enabled&&a.ssh.auth===`password`&&!a.ssh.password;if(!a.pass&&i.pass===``&&i.dbms!==`sqlite`||o)return null;try{let n=await m(d(a),a.authToken||void 0);if(!n.success||!n.connectionId)return null;for(let[t,r]of Q)r===e&&Q.set(t,n.connectionId);return Q.set(e,n.connectionId),u.getState().updateServerConnectionId(i.id,n.connectionId),u.getState().setTransactionOpen(i.id,!1),t.getState().setFooterMessage(r.t(`services.agent.reconnected`,{name:i.hostName||i.host||i.databaseId||i.file||i.id})),n.connectionId}catch{return null}})();return $.set(e,i),i.finally(()=>$.delete(e)),i}async function $e(e){if(P(e)){let t=Z(e);X(e),t&&await N(t);return}return p(e)}function et(e){return e===`cancelled`?null:e===`abandoned`?r.t(`result.running.abandoned`):e===`agent-outdated`?r.t(`result.running.agentOutdated`):e===`unsupported`?r.t(`result.running.cannotCancel`):r.t(`result.running.cancelFailed`)}async function tt(e){if(P(e))return`unsupported`;let t=u.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;return t?f(t):`failed`}function nt(e){return async(t,n)=>{let i=await Ze(e,t,n);if(!i.success)throw Error(i.message??r.t(`services.query.failed`));return i}}export{y as S,Me as _,nt as a,Te as b,Ze as c,Je as d,Ke as f,Xe as g,We as h,Ye as i,Fe as l,Ue as m,et as n,Ge as o,He as p,Re as r,$e as s,tt as t,qe as u,Y as v,G as x,P as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t}from"./XzPc-eVf.js";import{l as n,p as r,s as i,u as a}from"./CKOS5Y-e.js";import{S as o}from"./CZQ1r4zz.js";var s=e(t(),1),c=n(),l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0}),d=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),f=s.forwardRef(u(function(e,t){return(0,c.jsx)(i.span,{...e,ref:t,style:{...d,...e.style}})},`VisuallyHidden`)),p=Object.defineProperty,m=(e,t)=>p(e,`name`,{value:t,configurable:!0});function h(e){let t=e+`CollectionProvider`,[n,i]=o(t),[l,u]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=m(e=>{let{scope:t,children:n}=e,r=s.useRef(null),i=s.useRef(new Map).current;return(0,c.jsx)(l,{scope:t,itemMap:i,collectionRef:r,children:n})},`CollectionProvider`);d.displayName=t;let f=e+`CollectionSlot`,p=a(f),h=s.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=u(f,n),o=r(t,a.collectionRef);return(0,c.jsx)(p,{ref:o,children:i})});h.displayName=f;let g=e+`CollectionItemSlot`,_=`data-radix-collection-item`,v=a(g),y=s.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=s.useRef(null),l=r(t,o),d=u(g,n);return s.useEffect(()=>(d.itemMap.set(o,{ref:o,...a}),()=>void d.itemMap.delete(o))),(0,c.jsx)(v,{[_]:``,ref:l,children:i})});y.displayName=g;function b(t){let n=u(e+`CollectionConsumer`,t);return s.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${_}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return m(b,`useCollection`),[{Provider:d,Slot:h,ItemSlot:y},b,i]}m(h,`createCollection`);var g=new WeakMap,_=class e extends Map{static{m(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],g.set(this,!0)}set(e,t){return g.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=b(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=v(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=v(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return v(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function v(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=y(e,t);return n===-1?void 0:e[n]}m(v,`at`);function y(e,t){let n=e.length,r=b(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}m(y,`toSafeIndex`);function b(e){return e!==e||e===0?0:Math.trunc(e)}m(b,`toSafeInteger`);function x(e){let t=e+`CollectionProvider`,[n,i]=o(t),[l,u]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _,setItemMap:m(()=>void 0,`setItemMap`)}),d=m(({state:e,...t})=>e?(0,c.jsx)(p,{...t,state:e}):(0,c.jsx)(f,{...t}),`CollectionProvider`);d.displayName=t;let f=m(e=>{let t=C();return(0,c.jsx)(p,{...e,state:t})},`CollectionInit`);f.displayName=t+`Init`;let p=m(e=>{let{scope:t,children:n,state:i}=e,a=s.useRef(null),[o,u]=s.useState(null),d=r(a,u),[f,p]=i;return s.useEffect(()=>{if(!o)return;let e=T(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,c.jsx)(l,{scope:t,itemMap:f,setItemMap:p,collectionRef:d,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);p.displayName=t+`Impl`;let h=e+`CollectionSlot`,g=a(h),v=s.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=u(h,n),o=r(t,a.collectionRef);return(0,c.jsx)(g,{ref:o,children:i})});v.displayName=h;let y=e+`CollectionItemSlot`,b=a(y),x=s.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=s.useRef(null),[l,d]=s.useState(null),f=r(t,o,d),{setItemMap:p}=u(y,n),m=s.useRef(a);S(m.current,a)||(m.current=a);let h=m.current;return s.useEffect(()=>{let e=h;return p(t=>l?t.has(l)?t.set(l,{...e,element:l}).toSorted(w):(t.set(l,{...e,element:l}),t.toSorted(w)):t),()=>{p(e=>!l||!e.has(l)?e:(e.delete(l),new _(e)))}},[l,h,p]),(0,c.jsx)(b,{"data-radix-collection-item":``,ref:f,children:i})});x.displayName=y;function C(){return s.useState(new _)}m(C,`useInitCollection`);function E(t){let{itemMap:n}=u(e+`CollectionConsumer`,t);return n}return m(E,`useCollection`),[{Provider:d,Slot:v,ItemSlot:x},{createCollectionScope:i,useCollection:E,useInitCollection:C}]}m(x,`createCollection`);function S(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}m(S,`shallowEqual`);function C(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}m(C,`isElementPreceding`);function w(e,t){return!e[1].element||!t[1].element?0:C(e[1].element,t[1].element)?-1:1}m(w,`sortByDocumentPosition`);function T(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}m(T,`getChildListObserver`);export{f as n,d as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./B3nhMsGp.js";import{a as c}from"./CtXRSNHU.js";import{n as l}from"./Cr6Fx4T5.js";import{l as u,m as d}from"./CCQZjXae.js";import{U as f,W as p,c as m,l as h}from"./B_UAjgBr.js";import{a as g,i as _,n as v,o as y,t as b}from"./DxuXBECK.js";var x=e(t(),1),S=i();function C(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),C=r(`copy-database`),w=t===`copy-database`,T=C?.database??``,[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(`structure_data`),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null);function P(e){e||(i(),N(null),j(null),D(``),k(`structure_data`))}async function F(){let t=s.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=l(t),i=s.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await u(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=c(i.serverConnectionId),o=await r.introspect.listTables(a,T);for(let[r,i]of o.entries()){j(e(`database.copy.copying`,{table:i.name,index:r+1,total:o.length}));let a={connectionId:t,database:T,table:i.name},s={connectionId:t,database:n,table:i.name},c=await f(a,s);await p({source:a,target:s,mode:O,onConflict:`abort`,createSql:l(t).ddl.createTable(c)})}await d(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(b,{open:w,onOpenChange:P,children:(0,S.jsxs)(v,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(g,{children:(0,S.jsx)(y,{children:e(`database.copy.title`)})}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(m,{children:e(`database.copy.source`)}),(0,S.jsx)(h,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(m,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(h,{id:`target-db-name`,value:E,onChange:e=>D(e.target.value),placeholder:e(`database.copy.targetPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(m,{children:e(`database.copy.options`)}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_data`,checked:O===`structure_data`,onChange:()=>k(`structure_data`)}),e(`database.copy.structureAndData`)]}),(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_only`,checked:O===`structure_only`,onChange:()=>k(`structure_only`)}),e(`database.copy.structureOnly`)]})]})]})]}),A&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:A}),M&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:M}),(0,S.jsxs)(_,{children:[(0,S.jsx)(o,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(o,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./
|
|
1
|
+
import{_ as e}from"./B3nhMsGp.js";function t(e,n){for(let r of e)n(r),r.children.length>0&&t(r.children,n)}function n(e,t){for(let r of e){if(r.id===t)return r;let e=n(r.children,t);if(e)return e}return null}function r(t){return(t.type===e.DATABASE||t.type===e.SCHEMA)&&!!t.metadata?.database}function i(e){let n=[];return t(e,e=>{r(e)&&n.push(e.metadata.database)}),n}function a(n,r){let i=[];return t(n,t=>{t.type===e.TABLE&&t.metadata?.database===r&&i.push(t.text)}),i}function o(e,t){return t?n(e,t)?.metadata?.database??null:null}function s(t,r){if(!r)return null;let i=n(t,r);return!i||i.type!==e.TABLE?null:{database:i.metadata?.database??``,table:i.text}}function c(e){return e.find(e=>e.metadata?.catalog&&!e.metadata.unreachable)?.metadata?.catalog}export{s as a,o as i,n,a as o,i as r,t as s,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./fDSXGLmI.js";import{t as s}from"./B3nhMsGp.js";import{c}from"./CtXRSNHU.js";import{t as l}from"./Cr6Fx4T5.js";import{C as u,S as d,b as f,l as p,lt as m,v as h,x as g,y as _}from"./B_UAjgBr.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";var C=e(t(),1),w=r();function T(){let e=s.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(o.t(`command.noActiveConnection`));let n=l().getQuery(e===`global`?`SHOW_GLOBAL_STATUS`:`SHOW_SESSION_STATUS`);return(await c(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:o}=n(),[s,c]=(0,C.useState)([]),[l,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`status`,A=(0,C.useCallback)(t=>E(t).then(c).catch(t=>o(e(`command.status.loadError`,{message:t instanceof Error?t.message:String(t)}))),[o,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!l.trim())return s;let e=l.toLowerCase();return s.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[s,l]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.status.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(a,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(a,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(p,{placeholder:e(`command.status.filterPlaceholder`),value:l,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(m,{className:`h-[400px]`,children:(0,w.jsxs)(h,{children:[(0,w.jsx)(d,{children:(0,w.jsxs)(u,{children:[(0,w.jsx)(g,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(g,{children:e(`command.value`)})]})}),(0,w.jsx)(_,{children:j.length===0?(0,w.jsx)(u,{children:(0,w.jsx)(f,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.status.empty`)})}):j.map(e=>(0,w.jsxs)(u,{children:[(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(a,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as StatusDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import"./BBSxV90W.js";import{G as i}from"./B1lNzsWx.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DxuXBECK.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=t();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in i?i[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let t=e(e=>e.activeDialog),d=e(e=>e.closeDialog),{t:p}=n();return(0,g.jsx)(u,{open:t===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(s,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(c,{children:p(`terms.title`)}),(0,g.jsxs)(l,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(o,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:i.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(r,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import"./BBSxV90W.js";import{K as i}from"./B_UAjgBr.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DxuXBECK.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=t();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in i?i[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let t=e(e=>e.activeDialog),d=e(e=>e.closeDialog),{t:p}=n();return(0,g.jsx)(u,{open:t===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(s,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(c,{children:p(`terms.title`)}),(0,g.jsxs)(l,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(o,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:i.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(r,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{i as r,l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./CmJ3siBN.js";import{t as c}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{i as r,l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./CmJ3siBN.js";import{t as c}from"./B3nhMsGp.js";import{n as l}from"./BNkgLUl5.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Lt as m,c as h,it as g,l as _}from"./B_UAjgBr.js";var v=e(t(),1),y=i();function b(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=c(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(_,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{g(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(s,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(r,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(_,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{a as i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{t as c}from"./
|
|
2
|
-
`);return(0,L.jsxs)(`div`,{className:`space-y-0.5`,children:[i?(0,L.jsx)(`textarea`,{className:`${a} min-h-[56px] resize-y`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1}):(0,L.jsx)(`input`,{className:a,value:t.text,onChange:e=>r(e.target.value),disabled:n,maxLength:e.maxLength}),e.maxLength&&(0,L.jsxs)(`div`,{className:`text-right text-[10px] tabular-nums ${t.text.length>e.maxLength?`text-destructive`:`text-muted-foreground`}`,children:[t.text.length,`/`,e.maxLength]})]})}}}function U(){let{t:e}=o(),t=r(`row-form`),i=n(e=>e.closeDialog),a=n(e=>e.setFooterMessage),
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{a as i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{t as c}from"./B3nhMsGp.js";import{n as l}from"./BBSxV90W.js";import{a as u}from"./CtXRSNHU.js";import{l as d,t as f}from"./CCQZjXae.js";import{Dt as p,Ft as m,Pt as h,ct as g,d as _,f as v,kt as y,m as b,p as x,zt as S}from"./B_UAjgBr.js";import{a as C,i as w,n as ee,o as T,r as E,t as D}from"./DxuXBECK.js";var O=i(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),k=e(t(),1);function A(e){let t=e.slice(e.indexOf(`(`)+1,e.lastIndexOf(`)`)),n=[],r=/'((?:[^']|'')*)'/g,i;for(;i=r.exec(t);)n.push(i[1].replaceAll(`''`,`'`));return n}function j(e,t={}){let{oracleDate:n=!1}=t,r=e.type.trim(),i=r.toLowerCase(),a=/\bunsigned\b/.test(i);if(/^enum\(/.test(i))return{kind:`enum`,options:A(r)};if(/^set\(/.test(i))return{kind:`set`,options:A(r)};if(/^(tinyint\(1\)|bool|boolean|bit\(1\)|bit)(?![\w(])/.test(i))return{kind:`boolean`};let o=/^number(?:\((\d+|\*)(?:,\s*(-?\d+))?\))?$/.exec(i);if(o)return o[2]&&Number(o[2])>0?{kind:`decimal`}:o[1]?{kind:`integer`}:{kind:`decimal`};if(/^(tinyint|smallint|mediumint|int|integer|bigint|int2|int4|int8|serial|bigserial|smallserial)\b/.test(i))return{kind:`integer`,unsigned:a};if(/^(decimal|numeric|float|double|real|money|float4|float8|double precision)\b/.test(i))return{kind:`decimal`,unsigned:a};if(/^(datetime2|datetime|timestamp|smalldatetime|datetimeoffset)\b/.test(i))return{kind:`datetime`};if(/^date\b/.test(i))return{kind:n?`datetime`:`date`};if(/^(time|timetz)\b/.test(i))return{kind:`time`};if(/^(json|jsonb)\b/.test(i))return{kind:`json`};if(/^(uuid|uniqueidentifier)\b/.test(i))return{kind:`uuid`};if(/^(blob|tinyblob|mediumblob|longblob|binary|varbinary|bytea|raw|image|bfile)\b/.test(i))return{kind:`binary`};if(/^(text|ntext|tinytext|mediumtext|longtext|clob|nclob|long)\b/.test(i)||/^n?(?:var)?char2?\(max\)/.test(i))return{kind:`text`};let s=/^n?(?:var)?char2?(?:acter)?(?:\s+varying)?\((\d+)(?:\s+(?:char|byte))?\)/.exec(i);return s?{kind:`string`,maxLength:Number(s[1])}:{kind:`string`}}var M=/auto_increment|identity|generated/i;function N(e){return M.test(e.extra)||/^(serial|bigserial|smallserial)\b/i.test(e.type)?{mode:`auto`,text:``}:e.defaultValue===null?e.nullable?{mode:`null`,text:``}:{mode:`value`,text:``}:{mode:`default`,text:``}}function P(e){return e==null?{mode:`keep`,text:``}:{mode:`keep`,text:F(e)}}function F(e){if(e==null)return``;if(typeof e==`object`){if(ArrayBuffer.isView(e))return``;if(e instanceof Date)return e.toISOString();try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function I(e,t){let n=t.trim();switch(e.kind){case`integer`:{if(!/^[+-]?\d+$/.test(n))return{error:`integer`};if(e.unsigned&&n.startsWith(`-`))return{error:`unsigned`};let t=Number(n);return{value:Number.isSafeInteger(t)?t:BigInt(n)}}case`decimal`:return n===``||Number.isNaN(Number(n))?{error:`number`}:{value:Number(n)};case`boolean`:return{value:n===`true`||n===`1`};case`json`:try{return{value:JSON.parse(n===``?`null`:n)}}catch{return{error:`json`}}case`set`:return{value:n};case`date`:return n&&!/^\d{4}-\d{2}-\d{2}$/.test(n)?{error:`date`}:{value:n};case`datetime`:return n&&!/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?)?([+-]\d{2}:?\d{2}|Z)?$/.test(n)?{error:`datetime`}:{value:n};case`time`:return n&&!/^-?\d{1,3}:\d{2}(:\d{2}(\.\d+)?)?$/.test(n)?{error:`time`}:{value:n};default:return{value:t}}}var L=a(),R={integer:`result.rowForm.invalid.integer`,unsigned:`result.rowForm.invalid.unsigned`,number:`result.rowForm.invalid.number`,json:`result.rowForm.invalid.json`,date:`result.rowForm.invalid.date`,datetime:`result.rowForm.invalid.datetime`,time:`result.rowForm.invalid.time`};function z(e){return String(e).padStart(2,`0`)}function B(e){let t=new Date,n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`,r=`${z(t.getHours())}:${z(t.getMinutes())}:${z(t.getSeconds())}`;return e===`date`?n:e===`time`?r:`${n} ${r}`}function V(e){let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(n.getTime())?void 0:n}function H({spec:e,state:t,disabled:n,onText:r}){let{t:i}=o(),a=`w-full rounded border bg-background px-2 py-1 text-sm font-mono outline-none focus:ring-1 focus:ring-primary disabled:opacity-50`;switch(e.kind){case`boolean`:return(0,L.jsxs)(`select`,{className:a,value:t.text===`true`||t.text===`1`?`true`:`false`,onChange:e=>r(e.target.value),disabled:n,children:[(0,L.jsx)(`option`,{value:`true`,children:`TRUE`}),(0,L.jsx)(`option`,{value:`false`,children:`FALSE`})]});case`enum`:return(0,L.jsxs)(`select`,{className:a,value:t.text,onChange:e=>r(e.target.value),disabled:n,children:[!e.options?.includes(t.text)&&(0,L.jsx)(`option`,{value:t.text,children:t.text||`—`}),e.options?.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]});case`set`:{let i=new Set(t.text.split(`,`).map(e=>e.trim()).filter(Boolean));return(0,L.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 rounded border bg-background px-2 py-1.5`,children:e.options?.map(t=>(0,L.jsxs)(`label`,{className:`flex items-center gap-1 text-xs font-mono`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:i.has(t),disabled:n,onChange:n=>{let a=new Set(i);n.target.checked?a.add(t):a.delete(t),r(e.options.filter(e=>a.has(e)).join(`,`))}}),t]},t))})}case`integer`:case`decimal`:return(0,L.jsx)(`input`,{className:`${a} tabular-nums`,inputMode:`decimal`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:e.kind===`integer`?`0`:`0.00`});case`date`:case`datetime`:{let[o,s]=t.text.trim().split(/[ T]/);return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:e.kind===`date`?`YYYY-MM-DD`:`YYYY-MM-DD HH:MM:SS`}),(0,L.jsxs)(v,{children:[(0,L.jsx)(b,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background p-1.5 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,title:i(`result.rowForm.pickDate`),children:(0,L.jsx)(S,{className:`size-3.5`})})}),(0,L.jsx)(x,{className:`w-auto p-0`,align:`end`,children:(0,L.jsx)(_,{mode:`single`,selected:V(o??``),defaultMonth:V(o??``),onSelect:t=>{if(!t)return;let n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`;r(e.kind===`date`?n:`${n} ${s||`00:00:00`}`)}})})]}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(B(e.kind)),title:i(`result.rowForm.now`),children:(0,L.jsx)(h,{className:`size-3.5`})})]})}case`time`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:`HH:MM:SS`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(B(`time`)),title:i(`result.rowForm.now`),children:(0,L.jsx)(h,{className:`size-3.5`})})]});case`json`:{let e=!0;try{t.text.trim()&&JSON.parse(t.text)}catch{e=!1}return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`textarea`,{className:`${a} min-h-[96px] resize-y text-xs ${e?``:`border-destructive`}`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1,placeholder:`{}`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n||!e||!t.text.trim(),onClick:()=>{try{r(JSON.stringify(JSON.parse(t.text),null,2))}catch{}},children:[(0,L.jsx)(O,{className:`size-3`}),i(`result.rowForm.formatJson`)]}),!e&&(0,L.jsx)(`span`,{className:`text-[10px] text-destructive`,children:i(`result.rowForm.invalid.json`)})]})]})}case`text`:return(0,L.jsx)(`textarea`,{className:`${a} min-h-[72px] resize-y`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1});case`binary`:return(0,L.jsx)(`div`,{className:`rounded border bg-muted/40 px-2 py-1 text-xs italic text-muted-foreground`,children:i(`result.rowForm.binaryUnsupported`)});case`uuid`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${a} flex-1`,value:t.text,onChange:e=>r(e.target.value),disabled:n,placeholder:`00000000-0000-0000-0000-000000000000`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>r(crypto.randomUUID()),title:i(`result.rowForm.generateUuid`),children:(0,L.jsx)(O,{className:`size-3.5`})})]});default:{let i=t.text.length>80||t.text.includes(`
|
|
2
|
+
`);return(0,L.jsxs)(`div`,{className:`space-y-0.5`,children:[i?(0,L.jsx)(`textarea`,{className:`${a} min-h-[56px] resize-y`,value:t.text,onChange:e=>r(e.target.value),disabled:n,spellCheck:!1}):(0,L.jsx)(`input`,{className:a,value:t.text,onChange:e=>r(e.target.value),disabled:n,maxLength:e.maxLength}),e.maxLength&&(0,L.jsxs)(`div`,{className:`text-right text-[10px] tabular-nums ${t.text.length>e.maxLength?`text-destructive`:`text-muted-foreground`}`,children:[t.text.length,`/`,e.maxLength]})]})}}}function U(){let{t:e}=o(),t=r(`row-form`),i=n(e=>e.closeDialog),a=n(e=>e.setFooterMessage),h=g(t?.connectionId??``),_=c(e=>t?e.transactionOpen[t.connectionId]:!1),[v,b]=(0,k.useState)(null),[x,S]=(0,k.useState)(null),[O,A]=(0,k.useState)({}),[M,F]=(0,k.useState)({}),[z,B]=(0,k.useState)(null),[V,U]=(0,k.useState)(!1),W=t?.mode===`edit`;(0,k.useEffect)(()=>{if(!t)return;let e=!1,n=u(t.serverConnectionId);return h.introspect.listColumns(n,t.database,t.table).then(n=>{if(e)return;b(n);let r={};for(let e of n)if(t.mode===`edit`){let n=t.fields.find(t=>t.orgName===e.name);r[e.name]=P(n?t.row?.[n.name]:void 0)}else r[e.name]=N(e);A(r)}).catch(t=>{e||S(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[t?.serverConnectionId,t?.database,t?.table,t?.mode]);let G=(0,k.useMemo)(()=>new Map((v??[]).map(e=>[e.name,j(e,{oracleDate:h.id===`oracle`})])),[v,h.id]),K=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{...n[e],mode:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),q=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{mode:`value`,text:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),J=(0,k.useMemo)(()=>({__default:!0}),[]),Y=(0,k.useCallback)(()=>{if(!v)return null;let t=new Map,n={};for(let r of v){let i=O[r.name],a=G.get(r.name);if(!i||i.mode===`auto`||i.mode===`keep`)continue;if(i.mode===`null`){t.set(r.name,null);continue}if(i.mode==="default"){t.set(r.name,J);continue}let o=I(a,i.text);if(`error`in o){n[r.name]=e(R[o.error]??`result.rowForm.invalid.number`);continue}if(a.maxLength&&typeof o.value==`string`&&o.value.length>a.maxLength){n[r.name]=e(`result.rowForm.invalid.length`,{max:a.maxLength});continue}t.set(r.name,o.value)}return F(n),Object.keys(n).length>0?null:{values:t}},[v,O,G,e,J]),X=(0,k.useCallback)(e=>{if(!t)return null;let n=e=>e===J?`DEFAULT`:h.quoteLiteral(e);if(t.mode===`insert`){let r=[...e];return r.length===0?h.getQuery(`INSERT_DEFAULT_VALUES`,t.database,t.table):h.getQuery(`INSERT_TABLE`,t.database,t.table,r.map(([e])=>h.quoteIdentifier(e)).join(`, `),r.map(([,e])=>n(e)).join(`, `))}return!t.where||e.size===0?null:h.getQuery(`UPDATE_TABLE`,t.database,t.table,[...e].map(([e,t])=>`${h.quoteIdentifier(e)} = ${n(t)}`).join(`, `),t.where)},[t,h,J]),Z=(0,k.useMemo)(()=>{if(!v)return``;let e=new Map;for(let t of v){let n=O[t.name];if(!(!n||n.mode===`auto`||n.mode===`keep`)){if(n.mode===`null`)e.set(t.name,null);else if(n.mode==="default")e.set(t.name,J);else{let r=I(G.get(t.name),n.text);e.set(t.name,`error`in r?n.text:r.value)}}}return X(e)??``},[v,O,G,X,J]),Q=e=>{let n={};for(let[r,i]of e){if(i===J)continue;let e=t?.fields.find(e=>e.orgName===r);n[e?.name??r]=typeof i==`bigint`?i.toString():i}return n},te=()=>{let e=Y();!e||!t||(t.onStage?.(t.mode,Q(e.values)),i())},ne=async()=>{let r=Y();if(!r||!t)return;let o=X(r.values);if(!o){B(e(`result.rowForm.nothingToWrite`));return}U(!0),B(null);try{if(l.getState().previewGridCommit&&!await n.getState().requestDestructiveConfirm({title:e(W?`result.rowForm.confirmUpdateTitle`:`result.rowForm.confirmInsertTitle`,{table:`${t.database}.${t.table}`}),statements:[o],confirmLabel:e(W?`result.rowForm.update`:`result.rowForm.insert`)}))return;await d(t.connectionId,o,{database:t.database,skipDestructiveConfirm:!0}),a(e(W?`result.rowForm.updated`:`result.rowForm.inserted`,{table:`${t.database}.${t.table}`})),t.onCommitted?.(t.mode,Q(r.values)),i()}catch(e){if(e instanceof f)return;B(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(!t)return null;let $=(e,t,n,r)=>(0,L.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 text-[10px] font-medium ${r===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>K(e,t),children:n});return(0,L.jsx)(D,{open:!0,onOpenChange:e=>{e||i()},children:(0,L.jsxs)(ee,{className:`flex max-h-[90vh] flex-col sm:max-w-[860px]`,children:[(0,L.jsxs)(C,{children:[(0,L.jsx)(T,{children:e(W?`result.rowForm.editTitle`:`result.rowForm.insertTitle`)}),(0,L.jsxs)(E,{className:`font-mono text-xs`,children:[t.database,`.`,t.table]})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto rounded-md border`,children:[x&&(0,L.jsx)(`div`,{className:`rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:x}),!v&&!x&&(0,L.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground`,children:[(0,L.jsx)(p,{className:`size-4 animate-spin`}),e(`result.rowForm.loading`)]}),v&&(0,L.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-sm`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 z-10 bg-background`,children:(0,L.jsxs)(`tr`,{className:`text-left text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,L.jsx)(`th`,{className:`w-[38%] border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colColumn`)}),(0,L.jsx)(`th`,{className:`border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colValue`)})]})}),(0,L.jsx)(`tbody`,{children:v.map(n=>{let r=O[n.name]??{mode:`value`,text:``},i=G.get(n.name),a=r.mode===`auto`,o=M[n.name],s=n.key===`PRI`,c=t.fields.find(e=>e.orgName===n.name),l=!!c&&!!t.row&&t.row[c.name]===null;return(0,L.jsxs)(`tr`,{className:`align-top ${o?`bg-destructive/5`:`hover:bg-muted/30`}`,children:[(0,L.jsxs)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,title:n.name,children:n.name}),s&&(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 rounded border border-catppuccin-yellow/50 px-1 text-[9px] font-semibold text-catppuccin-yellow`,children:[(0,L.jsx)(y,{className:`size-2.5`}),`PK`]})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded bg-muted px-1 py-px font-mono`,children:n.type}),!n.nullable&&(0,L.jsx)(`span`,{children:`NOT NULL`}),n.defaultValue!==null&&(0,L.jsxs)(`span`,{className:`font-mono`,title:e(`result.rowForm.defaultValue`),children:[`= `,n.defaultValue]}),n.extra&&(0,L.jsx)(`span`,{children:n.extra})]}),n.comment&&(0,L.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground/80`,children:n.comment})]}),(0,L.jsx)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r.mode===`keep`?(0,L.jsx)(`div`,{className:`cursor-text truncate rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs text-muted-foreground`,onClick:()=>K(n.name,`value`),title:e(`result.rowForm.clickToChange`),children:l?(0,L.jsx)(`span`,{className:`italic`,children:`NULL`}):r.text||(0,L.jsx)(`span`,{className:`italic`,children:e(`result.rowForm.empty`)})}):r.mode===`value`?(0,L.jsx)(H,{spec:i,state:r,disabled:!1,onText:e=>q(n.name,e)}):(0,L.jsx)(`div`,{className:`rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs italic text-muted-foreground`,children:r.mode===`null`?`NULL`:r.mode==="default"?`DEFAULT (${n.defaultValue??``})`:e(`result.rowForm.autoHint`)}),o&&(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[11px] text-destructive`,children:[(0,L.jsx)(m,{className:`size-3`}),o]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded border bg-background p-0.5`,children:[W&&$(n.name,`keep`,e(`result.rowForm.mode.keep`),r.mode),(a||!W&&/auto_increment|identity/i.test(n.extra))&&$(n.name,`auto`,e(`result.rowForm.mode.auto`),r.mode),$(n.name,`value`,e(`result.rowForm.mode.value`),r.mode),n.nullable&&$(n.name,`null`,`NULL`,r.mode),n.defaultValue!==null&&$(n.name,`default`,`DEFAULT`,r.mode)]})]})})]},n.name)})})]})]}),v&&(0,L.jsxs)(`div`,{className:`shrink-0 rounded-md border bg-muted/30`,children:[(0,L.jsx)(`div`,{className:`border-b px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`result.rowForm.preview`)}),(0,L.jsx)(`pre`,{className:`max-h-24 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Z||(0,L.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`result.rowForm.nothingToWrite`)})})]}),z&&(0,L.jsx)(`div`,{className:`shrink-0 rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:z}),(0,L.jsxs)(w,{className:`items-center`,children:[_&&(0,L.jsx)(`span`,{className:`mr-auto text-[11px] text-catppuccin-yellow`,children:e(`result.rowForm.inTransaction`)}),(0,L.jsx)(s,{variant:`outline`,onClick:()=>i(),disabled:V,children:e(`command.close`)}),t.onStage&&(0,L.jsx)(s,{variant:`outline`,onClick:te,disabled:V||!v,title:e(`result.rowForm.stageHint`),children:e(W?`result.rowForm.stageEdit`:`result.rowForm.stageInsert`)}),(0,L.jsxs)(s,{onClick:()=>void ne(),disabled:V||!v,children:[V&&(0,L.jsx)(p,{className:`mr-1 size-3.5 animate-spin`}),e(W?`result.rowForm.update`:`result.rowForm.insert`)]})]})]})})}export{U as RowFormDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{L as s,R as c,c as l,t as u,z as d}from"./B_UAjgBr.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./CFzRFS2A.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),i=r(`license`),{key:S,status:C,activate:w,clear:T}=s(),{t:E}=a(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(c()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(_,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(m,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(f,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(u,{size:44}),(0,b.jsx)(d,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(h,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(g,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(l,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(p,{children:[S&&(0,b.jsx)(o,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(o,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(o,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{n as i,t as a}from"./BBSxV90W.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";import{t as f}from"./
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{n as i,t as a}from"./BBSxV90W.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";import{t as f}from"./BjlaUaDI.js";var p=t();function m(){let t=e(e=>e.activeDialog),m=e(e=>e.closeDialog),h=i(),g=h.update,{t:_}=n();return(0,p.jsx)(d,{open:t===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(c,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(o,{children:[(0,p.jsx)(l,{children:_(`settings.title`)}),(0,p.jsx)(u,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(s,{children:[(0,p.jsx)(r,{variant:`ghost`,onClick:()=>g(a),children:_(`settings.resetDefaults`)}),(0,p.jsx)(r,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./Bz1cma8F.js";import{i as d,n as f}from"./BBSxV90W.js";import{b as p,c as m,d as h}from"./Ca4g4XbM.js";import{c as g,l as _,w as v}from"./B_UAjgBr.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./DxuXBECK.js";var T=e(t(),1),E=r(),D={autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0};function O(){let{t:e}=i(),[t,n]=(0,T.useState)(null),[r,y]=(0,T.useState)(!1),[b,x]=(0,T.useState)(`anthropic`),[S,C]=(0,T.useState)(``),[w,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(``),[j,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)([]),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(!1),[z,B]=(0,T.useState)(null),V=f(e=>e.setAiPreferences),H=(0,T.useCallback)(()=>{h().then(e=>{n(e);let t=f.getState().aiPreferences,r=e.storage!==`none`;x(r?e.provider:t.provider),C(r?e.model:t.model),O((r?e.baseUrl:t.baseUrl)??``),M(r?e.storage===`file`:t.remember),P(e.clis??[]),I(e.anthropicProfile===!0)}).catch(()=>y(!0))},[]);(0,T.useEffect)(H,[H]);let U=(0,T.useCallback)(e=>{x(e),C(t=>d(t,e))},[]),W=(0,T.useCallback)(()=>{R(!0),B(null),p({provider:b,model:S.trim()||void 0,baseUrl:w.trim()||void 0,key:k,remember:j}).then(t=>{n(t),A(``),V({provider:b,model:S.trim()||t.model,baseUrl:w.trim(),remember:j}),B(e(`settings.ai.saved`)),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[b,S,w,k,j,V,e]),G=(0,T.useCallback)(()=>{R(!0),B(null),m().then(e=>{n(e),A(``),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[]);if(r)return(0,E.jsx)(`p`,{className:`rounded-md border p-3 text-xs text-muted-foreground`,children:e(`settings.ai.unreachable`)});if(!t)return null;let K=t.fromEnvironment,q=b===`cli`||b===`anthropic-profile`;return(0,E.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.intro`)}),(0,E.jsx)(`p`,{className:`text-xs`,children:t.storage===`environment`?e(`settings.ai.configuredEnv`):t.storage===`file`?e(t.provider===`cli`||t.provider===`anthropic-profile`?`settings.ai.configuredChoice`:`settings.ai.configuredFile`,{path:t.path,provider:t.provider===`cli`?t.model:e(`settings.ai.profile`)}):t.storage===`session`?e(`settings.ai.configuredSession`):e(`settings.ai.none`)}),!K&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-provider`,className:`text-sm font-medium`,children:e(`settings.ai.provider`)}),(0,E.jsxs)(u,{value:b,onValueChange:e=>U(e),children:[(0,E.jsx)(s,{id:`ai-provider`,children:(0,E.jsx)(o,{})}),(0,E.jsxs)(c,{children:[(0,E.jsx)(l,{value:`anthropic`,children:`Anthropic`}),(0,E.jsx)(l,{value:`anthropic-profile`,children:e(`settings.ai.profile`)}),(0,E.jsx)(l,{value:`openai`,children:e(`settings.ai.openaiCompatible`)}),(0,E.jsx)(l,{value:`gemini`,children:`Google Gemini`}),(0,E.jsx)(l,{value:`cli`,children:e(`settings.ai.cli`)})]})]})]}),b===`cli`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.cliHint`)}),N.length===0?(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.cliNone`)}):(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-cli`,className:`text-sm font-medium`,children:e(`settings.ai.cliCommand`)}),(0,E.jsxs)(u,{value:N.includes(S)?S:N[0],onValueChange:C,children:[(0,E.jsx)(s,{id:`ai-cli`,children:(0,E.jsx)(o,{})}),(0,E.jsx)(c,{children:N.map(e=>(0,E.jsx)(l,{value:e,children:e},e))})]})]})]}):(0,E.jsxs)(`div`,{className:`grid gap-3`,children:[b===`anthropic-profile`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.profileHint`)}),!F&&(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.profileNone`)})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-model`,className:`text-sm font-medium`,children:e(`settings.ai.model`)}),(0,E.jsx)(_,{id:`ai-model`,value:S,onChange:e=>C(e.target.value),spellCheck:!1,...D})]})]}),b===`openai`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,E.jsx)(g,{htmlFor:`ai-base-url`,className:`text-sm font-medium`,children:e(`settings.ai.baseUrl`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.baseUrlHint`)})]}),(0,E.jsx)(_,{id:`ai-base-url`,value:w,onChange:e=>O(e.target.value),placeholder:`https://api.openai.com/v1`,spellCheck:!1,...D})]}),q||(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(g,{htmlFor:`ai-key`,className:`text-sm font-medium`,children:e(`settings.ai.key`)}),(0,E.jsx)(_,{id:`ai-key`,type:`password`,value:k,onChange:e=>A(e.target.value),spellCheck:!1,placeholder:t.configured?`••••••••`:``,...D,autoComplete:`new-password`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.keyHint`)})]}),q||(0,E.jsxs)(`label`,{htmlFor:`ai-remember`,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,E.jsx)(`input`,{id:`ai-remember`,type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,E.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium`,children:e(`settings.ai.remember`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.rememberHint`,{path:t.path})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(a,{size:`sm`,onClick:W,disabled:L||(b===`cli`?N.length===0:!q&&!k.trim()),children:e(`settings.ai.save`)}),t.configured&&(0,E.jsx)(a,{size:`sm`,variant:`ghost`,onClick:G,disabled:L,children:e(`settings.ai.forget`)}),z&&(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:z})]})]})]})}function k(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{t:r}=i();return(0,E.jsx)(w,{open:e===`ai-settings`,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(x,{className:`sm:max-w-[560px]`,children:[(0,E.jsxs)(y,{children:[(0,E.jsx)(S,{children:r(`settings.ai.title`)}),(0,E.jsx)(C,{children:r(`settings.ai.description`)})]}),(0,E.jsx)(O,{}),(0,E.jsx)(b,{children:(0,E.jsx)(a,{onClick:t,children:r(`settings.done`)})})]})})}export{k as AiSettingsDialog};
|