planche 0.8.13 → 0.8.14

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.
Files changed (37) hide show
  1. package/app/assets/{SFsWRs4-.js → B6E7IbMa.js} +1 -1
  2. package/app/assets/{CUK2WAdf.js → BBLekwhn.js} +1 -1
  3. package/app/assets/{DSmKDd5u.js → BLPGwQub.js} +1 -1
  4. package/app/assets/{BW4K9UH-.js → BUcTqhSL.js} +1 -1
  5. package/app/assets/{BRc4Nt6e.js → BX4n4TJQ.js} +1 -1
  6. package/app/assets/{Bhquh17w.js → BZ6aghND.js} +4 -4
  7. package/app/assets/{CeXMO4BR.js → BbFio3pA.js} +1 -1
  8. package/app/assets/{y4cmNs6-.js → Bdp1DKAx.js} +1 -1
  9. package/app/assets/{COfwwXGO.js → Bpq2Whsw.js} +2 -2
  10. package/app/assets/{CiFkP-9S.js → BuhEpB12.js} +1 -1
  11. package/app/assets/{B2csuorb.js → BxW20weH.js} +1 -1
  12. package/app/assets/{hrOpaTVU.js → C-8gMuEc.js} +1 -1
  13. package/app/assets/{DTDWV2fP.js → C29gYFqD.js} +1 -1
  14. package/app/assets/{CqK9ewb_.js → C3PpGnxB.js} +1 -1
  15. package/app/assets/{fI8KJgQa.js → CNC8pjhK.js} +1 -1
  16. package/app/assets/{y664aOTm.js → CSYxJn5_.js} +1 -1
  17. package/app/assets/{DzVnJu74.js → CkPnfgzt.js} +1 -1
  18. package/app/assets/{CpSudzcZ.js → ClIJYMXh.js} +1 -1
  19. package/app/assets/{DkPnEF-y.js → ClQzFEcL.js} +1 -1
  20. package/app/assets/{Bajzqc8D.js → CoSpkBZh.js} +1 -1
  21. package/app/assets/{Bs-p2SdN.js → CxGlndnu.js} +1 -1
  22. package/app/assets/{DMRY-PmY.js → D3ZaTPbf.js} +1 -1
  23. package/app/assets/{CMoC9sLj.js → DF5d9evm.js} +1 -1
  24. package/app/assets/{DWMVPRon.js → DGpfJHer.js} +1 -1
  25. package/app/assets/{Dc12Sye0.js → DOU2MWdA.js} +1 -1
  26. package/app/assets/{qXWuX5B-.js → DXtaGfxh.js} +1 -1
  27. package/app/assets/{CVpOAP2j.js → DdHg_zlz.js} +1 -1
  28. package/app/assets/{CrT26gRf.js → DiIO0MJM.js} +1 -1
  29. package/app/assets/{useqs8Jk.js → DnZlL3PP.js} +1 -1
  30. package/app/assets/{CbmIWIww.js → H8HkC925.js} +1 -1
  31. package/app/assets/{9kM6GVHV.js → VZqLr_d1.js} +1 -1
  32. package/app/assets/{Bjm-okwb.js → _OOlglTI.js} +1 -1
  33. package/app/assets/{OjAiMU9J.js → mA5FXiEh.js} +2 -2
  34. package/app/assets/{DW8BZVdB.js → mZyfO6B4.js} +1 -1
  35. package/app/assets/{DIJgEIiP.js → uVZVQeN3.js} +1 -1
  36. package/app/index.html +2 -2
  37. package/package.json +1 -1
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./B1pia_Rg.js";import{l as i,m as a,o,p as s,s as c,t as l}from"./pjlgs2cl.js";import{S as u,_ as d,x as f,y as p}from"./CF6jyexg.js";import{a as m,i as h,n as g,r as _,t as v}from"./CiFkP-9S.js";import{T as y,f as ee,t as b}from"./BCmzDvBt.js";import{E as x,O as S,T as C,a as w,f as T,m as te}from"./DEEGN6UG.js";import{n as ne}from"./BO_H_8D-.js";import{S as E,d as D,g as re,i as ie,l as O,r as ae}from"./CS2mpWDL.js";import{n as oe,t as k}from"./DbqogdCK.js";import{A,C as j,Gt as se,I as ce,Jt as M,Kt as N,Lt as le,S as ue,Ut as P,Wt as de,a as fe,b as F,bt as pe,c as me,i as he,j as I,l as L,lt as ge,n as _e,o as R,qt as ve,r as ye,rt as be,s as z,u as B,v as xe,x as V,y as Se,z as H}from"./Bhquh17w.js";import{a as Ce,i as we,n as Te,o as Ee,t as De}from"./BgkATqP8.js";import{t as Oe}from"./CnYBZPf9.js";var U=e(t(),1),W=i(),G=Object.defineProperty,K=(e,t)=>G(e,`name`,{value:t,configurable:!0}),q=`DropdownMenu`,[J,ke]=u(q,[M]),Y=M(),[Ae,je]=J(q),Me=K(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Y(t),l=U.useRef(null),[u,f]=p({prop:i,defaultProp:a??!1,onChange:o,caller:q});return(0,W.jsx)(Ae,{scope:t,triggerId:d(),triggerRef:l,contentId:d(),open:u,onOpenChange:f,onOpenToggle:U.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,W.jsx)(ve,{...c,open:u,onOpenChange:f,dir:r,modal:s,children:n})})},`DropdownMenu`),Ne=`DropdownMenuTrigger`,Pe=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=je(Ne,n),o=Y(n),l=s(t,a.triggerRef);return(0,W.jsx)(P,{asChild:!0,...o,children:(0,W.jsx)(c.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:l,onPointerDown:f(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:f(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Fe=K(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Y(t);return(0,W.jsx)(N,{...r,...n})},`DropdownMenuPortal`),Ie=`DropdownMenuContent`,Le=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=je(Ie,n),a=Y(n),o=U.useRef(!1);return(0,W.jsx)(de,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:f(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:f(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Re=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,W.jsx)(se,{...i,...r,ref:t})},`DropdownMenuItem`)),ze=Me,Be=Pe,Ve=Fe,He=Le,Ue=Re,We=new Set([`postgres:`,`postgresql:`]);function Ge(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!We.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var Ke=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function qe(e,t){let n;try{let t=new URL(e);if(!Ke.has(t.hostname.toLowerCase()))return[];n=t.origin}catch{return[]}try{let e=await fetch(`${n}/cdn-cgi/local/explorer/api/d1/database`,{signal:t});if(!e.ok)return[];let r=await e.json(),i=new Map;for(let e of r.result??[])e.uuid&&i.set(e.uuid,{name:e.name??e.uuid,id:e.uuid});return[...i.values()]}catch{return[]}}var Je=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],Ye={enabled:!1,host:``,port:22,user:``,auth:`key`};function X({label:e,htmlFor:t,children:n}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,W.jsx)(me,{htmlFor:t,children:e}),n]})}function Xe({value:e,onChange:t}){let{t:n}=a();function r(n,r){t({...e,[n]:r})}let[i,o]=(0,U.useState)([]),s=e.dbms===`d1`?e.devUrl??``:``;(0,U.useEffect)(()=>{if(!s){o([]);return}let e=new AbortController,t=setTimeout(()=>{qe(s,e.signal).then(o)},300);return()=>{clearTimeout(t),e.abort()}},[s]);let c=e.dbms===`sqlite`,u=e.transport??`browser`,d=c&&u===`browser`,f=x.has(e.dbms),p=e.dbms===`d1`,y=e.dbms===`do`,ee=k.find(t=>t.id===e.dbms)?.capabilities,b=e.ssh??Ye,[C,w]=(0,U.useState)(``),T=C.trim()===``?`empty`:Ge(C)?`applied`:`invalid`,te=e.dbms===`supabase`&&e.port===6543;function ne(n){w(n);let r=Ge(n);r&&t({...e,host:r.host??e.host,port:r.port??k.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function E(n){t({...e,ssh:{...b,...n}})}async function D(e){e&&E({privateKey:await e.text(),privateKeyName:e.name})}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,W.jsx)(X,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,W.jsx)(L,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.dataSource`),children:(0,W.jsxs)(v,{value:e.dbms,onValueChange:n=>{let r=k.find(e=>e.id===n);if(!r)return;let i=r.id,a=x.has(i)||i===`d1`||i===`do`;w(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||f||p||y?z(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!f&&!p&&!y?e.database:R(i)??e.database})},children:[(0,W.jsx)(h,{id:`conn-dbms`,className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsx)(g,{children:k.map(e=>(0,W.jsx)(_,{value:e.id,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(B,{dbms:e.id}),e.label]})},e.id))})]})}),f&&(0,W.jsx)(X,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(L,{id:`conn-uri`,type:`password`,autoComplete:`new-password`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:C,onChange:e=>ne(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${T===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(T===`invalid`?`connection.form.connectionStringInvalid`:T===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),c&&(0,W.jsxs)(X,{label:n(`connection.form.openVia`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:u===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:u===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(u===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),d?(0,W.jsx)(X,{label:n(`connection.form.databaseFile`),children:(0,W.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,W.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{O(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,W.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,W.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!d&&(0,W.jsx)(X,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,W.jsx)(L,{id:`conn-authToken`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),d?null:y?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,W.jsx)(L,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):p?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,W.jsx)(L,{id:`conn-d1-dev`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,W.jsx)(X,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,W.jsx)(L,{id:`conn-d1-account`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,W.jsxs)(v,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,W.jsx)(h,{id:`conn-d1-database`,children:(0,W.jsx)(m,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,W.jsx)(g,{children:i.map(e=>(0,W.jsxs)(_,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,W.jsx)(L,{id:`conn-d1-database`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(L,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,W.jsx)(L,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,W.jsx)(L,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,W.jsx)(L,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||k.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),te&&(0,W.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),(S(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,W.jsx)(X,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,W.jsx)(L,{id:`conn-database`,placeholder:R(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,W.jsx)(L,{id:`conn-user`,autoComplete:`off`,placeholder:z(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(L,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),f&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!f&&e.dbms!==`oracle`&&(0,W.jsx)(X,{label:n(`connection.form.tls`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!f&&(0,W.jsx)(X,{label:n(`connection.form.charset`),children:(0,W.jsxs)(v,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsx)(g,{children:Je.map(e=>(0,W.jsx)(_,{value:e,children:e},e))})]})})]}),!c&&!f&&!p&&!y&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,W.jsx)(H,{className:`ml-2`})]}),(0,W.jsx)(X,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:b.enabled,onChange:e=>{(!e.target.checked||ce(`ssh_tunnel`))&&E({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),b.enabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(L,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:b.host,onChange:e=>E({host:e.target.value.trim()})}),(0,W.jsx)(L,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:b.port,onChange:e=>E({port:Number(e.target.value)||22})})]})}),(0,W.jsx)(X,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,W.jsx)(L,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:b.user,onChange:e=>E({user:e.target.value.trim()})})}),(0,W.jsx)(X,{label:n(`connection.form.sshAuth`),children:(0,W.jsxs)(v,{value:b.auth,onValueChange:e=>E({auth:e}),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsxs)(g,{children:[(0,W.jsx)(_,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,W.jsx)(_,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,W.jsx)(_,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),b.auth===`password`&&(0,W.jsx)(X,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,W.jsx)(L,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:b.password??``,onChange:e=>E({password:e.target.value})})}),b.auth===`key`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{D(e.target.files?.[0]),e.target.value=``}}),(0,W.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:b.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:b.privateKeyName,children:b.privateKey?b.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,W.jsx)(X,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,W.jsx)(L,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:b.passphrase??``,onChange:e=>E({passphrase:e.target.value})})})]}),b.auth===`agent`&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,W.jsx)(X,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,W.jsx)(`div`,{className:`flex items-center`,children:(0,W.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,W.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,W.jsx)(X,{label:n(`connection.form.environment`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[A.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,W.jsx)(`button`,{type:`button`,title:I(t.id),"aria-label":I(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,W.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,W.jsx)(X,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),ee?.transactions!==!1&&(0,W.jsx)(X,{label:n(`connection.form.transactions`),children:(0,W.jsxs)(v,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsxs)(g,{children:[(0,W.jsx)(_,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,W.jsx)(_,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}var Ze=[`id`,`serverConnectionId`,`sample`,`scratchpad`,`autoConnection`];function Qe(e){return!e.sample&&!e.scratchpad}function $e(e,t,n=new Date){let r=t?e:y(e),i={...r};for(let e of Ze)delete i[e];if(i.pass||delete i.pass,i.authToken||delete i.authToken,r.ssh){let e={...r.ssh};for(let t of[`password`,`passphrase`,`privateKey`])e[t]||delete e[t];i.ssh=e}return{planche:`connection`,version:1,exportedAt:n.toISOString(),secrets:t,connection:i}}function et(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Not a JSON file`)}let n=t;if(!n||n.planche!==`connection`||!n.connection||typeof n.connection!=`object`)throw Error(`Not a Planche connection file`);if(typeof n.connection.dbms!=`string`||!n.connection.dbms)throw Error(`The connection has no database type`);return n}var Z=(e,t=``)=>typeof e==`string`?e:t,Q=e=>typeof e==`boolean`?e:void 0,tt=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t,$=e=>e===void 0||e===``?void 0:e;function nt(e){if(!e||typeof e!=`object`)return;let t=e,n=t.auth===`key`||t.auth===`agent`?t.auth:`password`;return{enabled:t.enabled===!0,host:Z(t.host),port:tt(t.port,22),user:Z(t.user),auth:n,password:$(Z(t.password)),privateKey:$(Z(t.privateKey)),privateKeyName:$(Z(t.privateKeyName)),passphrase:$(Z(t.passphrase))}}function rt(e,t,n=crypto.randomUUID()){let r=e.connection,i=Q(r.savePassword),a={id:n,hostName:it(Z(r.hostName),t),host:Z(r.host),user:Z(r.user),pass:Z(r.pass),charset:Z(r.charset,`utf8`),port:tt(r.port,0),dbms:r.dbms,database:$(Z(r.database)),transport:r.transport===`tunnel`||r.transport===`browser`?r.transport:void 0,file:$(Z(r.file)),createIfMissing:Q(r.createIfMissing),ssl:Q(r.ssl),sslVerify:Q(r.sslVerify),accountId:$(Z(r.accountId)),databaseId:$(Z(r.databaseId)),devUrl:$(Z(r.devUrl)),ssh:nt(r.ssh),gatewayProfile:$(Z(r.gatewayProfile)),autoConnection:!1,savePassword:i??!0,authToken:Z(r.authToken),readOnly:Q(r.readOnly),environmentColor:$(Z(r.environmentColor)),transactionMode:$(Z(r.transactionMode))};for(let e of Object.keys(a))a[e]===void 0&&delete a[e];return a}function it(e,t){if(!e||!t.some(t=>t.hostName===e))return e;for(let n=2;;n++){let r=`${e} (${n})`;if(!t.some(e=>e.hostName===r))return r}}async function at(e,t,n=`application/json`){let r=Oe(e);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:r,types:[{accept:{[n]:[`.${r.split(`.`).pop()??`txt`}`]}}]})).createWritable();return await e.write(t),await e.close(),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1}let i=URL.createObjectURL(new Blob([t],{type:n})),a=document.createElement(`a`);return a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),!0}function ot(e=`.json,application/json`){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.onchange=async()=>{let e=n.files?.[0];t(e?await e.text():null)},n.oncancel=()=>t(null),n.click()})}function st({...e}){return(0,W.jsx)(ze,{"data-slot":`dropdown-menu`,...e})}function ct({...e}){return(0,W.jsx)(Be,{"data-slot":`dropdown-menu-trigger`,...e})}function lt({className:e,sideOffset:t=4,...n}){return(0,W.jsx)(Ve,{children:(0,W.jsx)(He,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:o(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function ut({className:e,inset:t,variant:n=`default`,...r}){return(0,W.jsx)(Ue,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:o(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function dt(){let{t:e}=a(),{activeDialog:t,closeDialog:i,showMessage:o}=n(),[s,c]=(0,U.useState)(!1),{savedConnections:u,addSavedConnection:d,updateSavedConnection:f,deleteSavedConnection:p,openConnection:m}=b(),h=r(`connect`)?.profileId,[g,_]=(0,U.useState)(()=>h??null),[v,y]=(0,U.useState)(()=>{let e=h?u.find(e=>e.id===h):void 0;return e?{...e}:null}),x=t===`connect`,[S,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(null),se=be(e=>e.url),ce=be(e=>e.token);(0,U.useEffect)(()=>{if(!x)return;let e=!1;return(async()=>{try{let t=await w();if(e||t.state!==`online`||!t.gateway){e||O(null);return}let n=await T();e||(O({name:n.gateway,profiles:n.profiles}),A(null))}catch(t){e||A(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[x,se,ce]);function M(t){let r=u.find(e=>e.gatewayProfile===t.name);if(r){P(r);return}let i=ye(t);d(i),P(i),n.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function N(e){e||(i(),_(null),y(null))}function P(e){_(e.id),y({...e})}function de(e){y(e),f(e.id,e)}function me(){let e=fe();d(e),_(e.id),y(e)}function I(){g&&(p(g),_(null),y(null))}async function L(t){let r=u.find(e=>e.id===g);if(!r||!Qe(r))return;let i=r.hostName||e(`connection.dialog.unnamed`),a=$e(b.getState().resolveCredentials(r),t);await at(`planche-connection-${i}.json`,JSON.stringify(a,null,2))&&n.getState().setFooterMessage(e(`connection.dialog.exported`,{name:i}))}async function R(){let t=await ot();if(t!==null)try{let r=rt(et(t),b.getState().savedConnections);d(r),_(r.id),y(r),n.getState().setFooterMessage(e(`connection.dialog.imported`,{name:r.hostName||e(`connection.dialog.unnamed`)}))}catch(t){o({tone:`error`,title:e(`connection.dialog.importFailedTitle`),description:t instanceof Error?t.message:String(t)})}}let ve=g!==null&&u.some(e=>e.id===g&&Qe(e)),[z,H]=(0,U.useState)(!1),Oe=ne(e=>e.addQueryTab);function G(t){let n=b.getState().activeConnections.some(e=>e.id===t.id);if(m(t),E.getState().removeTree(t.id),ee(t.id),n){i(),_(null),y(null);return}Oe(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),i(),_(null),y(null)}async function K(t){let r=await ae(t.id,{interactive:!0});if(!r)return;let i={...t,file:r.fileName,serverConnectionId:r.connectionId};f(t.id,{file:r.fileName}),G(i),b.getState().setFileDetached(t.id,r.fileDetached),r.restoredUnsaved?n.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?n.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&n.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function q(t,r){try{return await r(t)}catch(i){let a=te(i);if(!a||!(`ssh`in t)||!t.ssh||!await n.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...t,ssh:{...t.ssh,acceptHostKey:a.fingerprint}})}}async function J(){if(v){H(!0);try{if(D(v)===`browser`){await K(v);return}let t=await q(C(v),e=>ie(e,v.authToken||void 0));t.success?G({...v,serverConnectionId:t.connectionId}):o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{H(!1)}}}async function ke(){if(v){if(D(v)===`browser`){o({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}c(!0);try{let t=await q(C(v),e=>re(e,v.authToken||void 0));t.success?o({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{c(!1)}}}return(0,W.jsx)(De,{open:x,onOpenChange:N,children:(0,W.jsxs)(Te,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,W.jsx)(Ce,{children:(0,W.jsx)(Ee,{children:e(`connection.dialog.title`)})}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,W.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,W.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(S||k)&&(0,W.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,W.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),S?` — ${S.name}`:``]}),k&&(0,W.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:k})}),S?.profiles.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,W.jsx)(B,{dbms:_e[t.driver],className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.name}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,W.jsx)(l,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>M(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,W.jsx)(ge,{className:`h-full`,children:(0,W.jsxs)(xe,{className:`table-fixed`,children:[(0,W.jsx)(ue,{children:(0,W.jsxs)(j,{children:[(0,W.jsx)(V,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,W.jsx)(V,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,W.jsx)(V,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,W.jsx)(Se,{children:u.length===0?(0,W.jsx)(j,{children:(0,W.jsx)(F,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):u.map(t=>(0,W.jsxs)(j,{"data-state":g===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>P(t),onDoubleClick:()=>{P(t),J()},children:[(0,W.jsx)(F,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,W.jsx)(F,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(D(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,W.jsx)(F,{className:`truncate`,title:oe(t.dbms).label,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(B,{dbms:t.dbms,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:oe(t.dbms).label})]})})]},t.id))})]})})]}),(0,W.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:v?(0,W.jsxs)(W.Fragment,{children:[D(v)!==`browser`&&(0,W.jsx)(`div`,{className:`p-4 pb-0`,children:(0,W.jsx)(he,{})}),v.gatewayProfile?(0,W.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,W.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,W.jsx)(B,{dbms:v.dbms,className:`size-4`}),v.hostName]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:v.gatewayProfile})}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[v.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),v.database?` · ${v.database}`:``]})]}):(0,W.jsx)(Xe,{value:v,onChange:de})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,W.jsxs)(we,{className:`sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(l,{variant:`outline`,onClick:me,children:e(`connection.dialog.addNew`)}),(0,W.jsx)(l,{variant:`destructive`,onClick:I,disabled:!g,children:e(`connection.dialog.delete`)}),(0,W.jsxs)(st,{children:[(0,W.jsx)(ct,{asChild:!0,children:(0,W.jsxs)(l,{variant:`outline`,disabled:!ve,children:[e(`connection.dialog.export`),(0,W.jsx)(le,{className:`ml-1 size-3.5`,"aria-hidden":!0})]})}),(0,W.jsxs)(lt,{align:`start`,children:[(0,W.jsx)(ut,{onSelect:()=>void L(!1),children:e(`connection.dialog.exportWithoutSecrets`)}),(0,W.jsx)(ut,{onSelect:()=>void L(!0),children:e(`connection.dialog.exportWithSecrets`)})]})]}),(0,W.jsx)(l,{variant:`outline`,onClick:()=>void R(),children:e(`connection.dialog.import`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(l,{variant:`outline`,onClick:ke,disabled:!v||s,children:e(`connection.dialog.testConnection`)}),(0,W.jsx)(l,{onClick:J,disabled:!v||z,children:e(`connection.dialog.connect`)}),(0,W.jsx)(l,{variant:`outline`,onClick:()=>N(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{dt as ConnectDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./B1pia_Rg.js";import{l as i,m as a,o,p as s,s as c,t as l}from"./pjlgs2cl.js";import{S as u,_ as d,x as f,y as p}from"./CF6jyexg.js";import{a as m,i as h,n as g,r as _,t as v}from"./BuhEpB12.js";import{T as y,f as ee,t as b}from"./BCmzDvBt.js";import{E as x,O as S,T as C,a as w,f as T,m as te}from"./DEEGN6UG.js";import{n as ne}from"./BO_H_8D-.js";import{S as E,d as D,g as re,i as ie,l as O,r as ae}from"./CS2mpWDL.js";import{n as oe,t as k}from"./DbqogdCK.js";import{A,C as j,Gt as se,I as ce,Jt as M,Kt as N,Lt as le,S as ue,Ut as P,Wt as de,a as fe,b as F,bt as pe,c as me,i as he,j as I,l as L,lt as ge,n as _e,o as R,qt as ve,r as ye,rt as be,s as z,u as B,v as xe,x as V,y as Se,z as H}from"./BZ6aghND.js";import{a as Ce,i as we,n as Te,o as Ee,t as De}from"./BgkATqP8.js";import{t as Oe}from"./CnYBZPf9.js";var U=e(t(),1),W=i(),G=Object.defineProperty,K=(e,t)=>G(e,`name`,{value:t,configurable:!0}),q=`DropdownMenu`,[J,ke]=u(q,[M]),Y=M(),[Ae,je]=J(q),Me=K(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Y(t),l=U.useRef(null),[u,f]=p({prop:i,defaultProp:a??!1,onChange:o,caller:q});return(0,W.jsx)(Ae,{scope:t,triggerId:d(),triggerRef:l,contentId:d(),open:u,onOpenChange:f,onOpenToggle:U.useCallback(()=>f(e=>!e),[f]),modal:s,children:(0,W.jsx)(ve,{...c,open:u,onOpenChange:f,dir:r,modal:s,children:n})})},`DropdownMenu`),Ne=`DropdownMenuTrigger`,Pe=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=je(Ne,n),o=Y(n),l=s(t,a.triggerRef);return(0,W.jsx)(P,{asChild:!0,...o,children:(0,W.jsx)(c.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:l,onPointerDown:f(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:f(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),Fe=K(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Y(t);return(0,W.jsx)(N,{...r,...n})},`DropdownMenuPortal`),Ie=`DropdownMenuContent`,Le=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=je(Ie,n),a=Y(n),o=U.useRef(!1);return(0,W.jsx)(de,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:f(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:f(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Re=U.forwardRef(K(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Y(n);return(0,W.jsx)(se,{...i,...r,ref:t})},`DropdownMenuItem`)),ze=Me,Be=Pe,Ve=Fe,He=Le,Ue=Re,We=new Set([`postgres:`,`postgresql:`]);function Ge(e){let t=e.trim().replace(/^psql\s+(['"])?/,``).replace(/['"]$/,``);if(!/^postgres(ql)?:\/\//i.test(t))return null;let n;try{n=new URL(t)}catch{return null}if(!We.has(n.protocol.toLowerCase())||!n.hostname)return null;let r=e=>{try{return decodeURIComponent(e)}catch{return e}},i={host:n.hostname};n.port&&(i.port=Number(n.port)),n.username&&(i.user=r(n.username)),n.password&&(i.pass=r(n.password));let a=r(n.pathname.replace(/^\//,``));return a&&(i.database=a),i}var Ke=new Set([`localhost`,`127.0.0.1`,`[::1]`,`::1`,`0.0.0.0`]);async function qe(e,t){let n;try{let t=new URL(e);if(!Ke.has(t.hostname.toLowerCase()))return[];n=t.origin}catch{return[]}try{let e=await fetch(`${n}/cdn-cgi/local/explorer/api/d1/database`,{signal:t});if(!e.ok)return[];let r=await e.json(),i=new Map;for(let e of r.result??[])e.uuid&&i.set(e.uuid,{name:e.name??e.uuid,id:e.uuid});return[...i.values()]}catch{return[]}}var Je=[`utf8`,`utf8mb4`,`latin1`,`ascii`,`euckr`,`sjis`,`big5`],Ye={enabled:!1,host:``,port:22,user:``,auth:`key`};function X({label:e,htmlFor:t,children:n}){return(0,W.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-center gap-2`,children:[(0,W.jsx)(me,{htmlFor:t,children:e}),n]})}function Xe({value:e,onChange:t}){let{t:n}=a();function r(n,r){t({...e,[n]:r})}let[i,o]=(0,U.useState)([]),s=e.dbms===`d1`?e.devUrl??``:``;(0,U.useEffect)(()=>{if(!s){o([]);return}let e=new AbortController,t=setTimeout(()=>{qe(s,e.signal).then(o)},300);return()=>{clearTimeout(t),e.abort()}},[s]);let c=e.dbms===`sqlite`,u=e.transport??`browser`,d=c&&u===`browser`,f=x.has(e.dbms),p=e.dbms===`d1`,y=e.dbms===`do`,ee=k.find(t=>t.id===e.dbms)?.capabilities,b=e.ssh??Ye,[C,w]=(0,U.useState)(``),T=C.trim()===``?`empty`:Ge(C)?`applied`:`invalid`,te=e.dbms===`supabase`&&e.port===6543;function ne(n){w(n);let r=Ge(n);r&&t({...e,host:r.host??e.host,port:r.port??k.find(t=>t.id===e.dbms)?.defaultPort??e.port,user:r.user??e.user,pass:r.pass??e.pass,database:r.database??e.database})}function E(n){t({...e,ssh:{...b,...n}})}async function D(e){e&&E({privateKey:await e.text(),privateKeyName:e.name})}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,W.jsx)(X,{label:n(`connection.form.hostName`),htmlFor:`conn-hostName`,children:(0,W.jsx)(L,{id:`conn-hostName`,placeholder:n(`connection.form.hostNamePlaceholder`),value:e.hostName,onChange:e=>r(`hostName`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.dataSource`),children:(0,W.jsxs)(v,{value:e.dbms,onValueChange:n=>{let r=k.find(e=>e.id===n);if(!r)return;let i=r.id,a=x.has(i)||i===`d1`||i===`do`;w(``),t({...e,dbms:i,transactionMode:r.capabilities.transactions?e.transactionMode:`auto`,port:r.defaultPort??e.port,host:a&&e.host===`localhost`?``:!a&&e.host===``?`localhost`:e.host,user:a||f||p||y?z(i):e.user,devUrl:i===`do`?e.devUrl||`http://localhost:8787`:e.devUrl,database:e.database&&!a&&!f&&!p&&!y?e.database:R(i)??e.database})},children:[(0,W.jsx)(h,{id:`conn-dbms`,className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsx)(g,{children:k.map(e=>(0,W.jsx)(_,{value:e.id,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(B,{dbms:e.id}),e.label]})},e.id))})]})}),f&&(0,W.jsx)(X,{label:n(`connection.form.connectionString`),htmlFor:`conn-uri`,children:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(L,{id:`conn-uri`,type:`password`,autoComplete:`new-password`,spellCheck:!1,className:`font-mono text-xs`,placeholder:e.dbms===`neon`?`postgresql://neondb_owner:npg_…@ep-….neon.tech/neondb?sslmode=require`:`postgresql://postgres.[ref]:[password]@aws-0-….pooler.supabase.com:5432/postgres`,value:C,onChange:e=>ne(e.target.value)}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed ${T===`invalid`?`text-destructive`:`text-muted-foreground`}`,children:n(T===`invalid`?`connection.form.connectionStringInvalid`:T===`applied`?`connection.form.connectionStringApplied`:e.dbms===`neon`?`connection.form.neonHint`:`connection.form.supabaseHint`)})]})}),c&&(0,W.jsxs)(X,{label:n(`connection.form.openVia`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`browser`,checked:u===`browser`,onChange:()=>r(`transport`,`browser`),className:`accent-primary`}),n(`connection.form.viaBrowser`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-sm cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`radio`,name:`transport`,value:`tunnel`,checked:u===`tunnel`,onChange:()=>r(`transport`,`tunnel`),className:`accent-primary`}),n(`connection.form.viaAgent`)]})]}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(u===`browser`?`connection.form.viaBrowserHint`:`connection.form.viaAgentHint`)})]}),d?(0,W.jsx)(X,{label:n(`connection.form.databaseFile`),children:(0,W.jsxs)(`div`,{className:`min-w-0 text-xs text-muted-foreground leading-relaxed`,children:[e.file?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,W.jsx)(`span`,{className:`min-w-0 break-all text-foreground`,title:e.file,children:e.file}),(0,W.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>{O(e.id),r(`file`,``)},children:n(`connection.form.changeFile`)})]}):(0,W.jsx)(`p`,{children:n(`connection.form.filePickerHint`)}),(0,W.jsx)(`p`,{className:`mt-1`,children:n(`connection.form.fileRememberedHint`)})]})}):null,!d&&(0,W.jsx)(X,{label:n(`connection.form.authToken`),htmlFor:`conn-authToken`,children:(0,W.jsx)(L,{id:`conn-authToken`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.authTokenPlaceholder`),value:e.authToken,onChange:e=>r(`authToken`,e.target.value.trim())})}),d?null:y?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.doDevUrl`),htmlFor:`conn-do-url`,children:(0,W.jsx)(L,{id:`conn-do-url`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doHint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.doLimitsHint`)})]}):p?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.d1DevUrl`),htmlFor:`conn-d1-dev`,children:(0,W.jsx)(L,{id:`conn-d1-dev`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`http://localhost:8787`,value:e.devUrl??``,onChange:e=>r(`devUrl`,e.target.value.trim())})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1DevUrlHint`)}),(0,W.jsx)(X,{label:n(`connection.form.d1AccountId`),htmlFor:`conn-d1-account`,children:(0,W.jsx)(L,{id:`conn-d1-account`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`023e105f4ecef8ad9ca31a8372d0c353`,value:e.accountId??``,onChange:e=>r(`accountId`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.d1DatabaseId`),htmlFor:`conn-d1-database`,children:i.length>0?(0,W.jsxs)(v,{value:e.databaseId??``,onValueChange:e=>r(`databaseId`,e),children:[(0,W.jsx)(h,{id:`conn-d1-database`,children:(0,W.jsx)(m,{placeholder:n(`connection.form.d1PickDatabase`)})}),(0,W.jsx)(g,{children:i.map(e=>(0,W.jsxs)(_,{value:e.id,children:[e.name,` · `,e.id]},e.id))})]}):(0,W.jsx)(L,{id:`conn-d1-database`,autoComplete:`off`,className:`font-mono text-xs`,spellCheck:!1,placeholder:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`,value:e.databaseId??``,onChange:e=>r(`databaseId`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.d1ApiToken`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(L,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value.trim())}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1Hint`)}),(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.d1LimitsHint`)})]}):c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.databaseFile`),htmlFor:`conn-file`,children:(0,W.jsx)(L,{id:`conn-file`,placeholder:n(`connection.form.filePathPlaceholder`),value:e.file??``,onChange:e=>r(`file`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.createIfMissing`),htmlFor:`conn-create`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-create`,type:`checkbox`,checked:e.createIfMissing??!1,onChange:e=>r(`createIfMissing`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.createIfMissingHint`)})]})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.host`),htmlFor:`conn-host`,children:(0,W.jsx)(L,{id:`conn-host`,placeholder:e.dbms===`neon`?`ep-….aws.neon.tech`:e.dbms===`supabase`?`aws-0-….pooler.supabase.com`:`localhost`,value:e.host,onChange:e=>r(`host`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.port`),htmlFor:`conn-port`,children:(0,W.jsx)(L,{id:`conn-port`,type:`number`,value:e.port,onChange:t=>r(`port`,Number(t.target.value)||k.find(t=>t.id===e.dbms)?.defaultPort||3306)})}),te&&(0,W.jsx)(`p`,{className:`col-start-2 rounded-md border border-yellow-500/40 bg-yellow-500/10 px-2 py-1.5 text-xs leading-relaxed text-foreground`,children:n(`connection.form.supabasePoolerWarning`)}),(S(e.dbms)||e.dbms===`mssql`||e.dbms===`oracle`)&&(0,W.jsx)(X,{label:e.dbms===`oracle`?n(`connection.form.serviceName`):n(`connection.form.database`),htmlFor:`conn-database`,children:(0,W.jsx)(L,{id:`conn-database`,placeholder:R(e.dbms),value:e.database??``,onChange:e=>r(`database`,e.target.value.trim())})}),(0,W.jsx)(X,{label:n(`connection.form.user`),htmlFor:`conn-user`,children:(0,W.jsx)(L,{id:`conn-user`,autoComplete:`off`,placeholder:z(e.dbms),value:e.user,onChange:e=>r(`user`,e.target.value)})}),(0,W.jsx)(X,{label:n(`connection.form.password`),htmlFor:`conn-pass`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(L,{id:`conn-pass`,type:`password`,autoComplete:`new-password`,value:e.pass,onChange:e=>r(`pass`,e.target.value)}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs whitespace-nowrap cursor-pointer`,title:n(`connection.form.savePasswordHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.savePassword??!0,onChange:e=>r(`savePassword`,e.target.checked)}),n(`connection.form.savePassword`)]})]})}),f&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.managedTlsHint`)}),!f&&e.dbms!==`oracle`&&(0,W.jsx)(X,{label:n(`connection.form.tls`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:e.ssl??!1,onChange:e=>r(`ssl`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsEnable`)]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer ${e.ssl?``:`opacity-50`}`,title:n(`connection.form.tlsVerifyHint`),children:[(0,W.jsx)(`input`,{type:`checkbox`,disabled:!e.ssl,checked:e.sslVerify??!1,onChange:e=>r(`sslVerify`,e.target.checked),className:`size-4 accent-primary`}),n(`connection.form.tlsVerify`)]})]})}),!f&&(0,W.jsx)(X,{label:n(`connection.form.charset`),children:(0,W.jsxs)(v,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsx)(g,{children:Je.map(e=>(0,W.jsx)(_,{value:e,children:e},e))})]})})]}),!c&&!f&&!p&&!y&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mt-1 flex items-center border-t pt-3 text-xs font-medium text-muted-foreground`,children:[n(`connection.form.ssh`),(0,W.jsx)(H,{className:`ml-2`})]}),(0,W.jsx)(X,{label:n(`connection.form.sshTunnel`),htmlFor:`conn-ssh`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh`,type:`checkbox`,checked:b.enabled,onChange:e=>{(!e.target.checked||ce(`ssh_tunnel`))&&E({enabled:e.target.checked})},className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.sshTunnelHint`)})]})}),b.enabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.sshHost`),htmlFor:`conn-ssh-host`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(L,{id:`conn-ssh-host`,placeholder:n(`connection.form.sshHostPlaceholder`),value:b.host,onChange:e=>E({host:e.target.value.trim()})}),(0,W.jsx)(L,{"aria-label":n(`connection.form.sshPort`),type:`number`,className:`w-24 shrink-0`,value:b.port,onChange:e=>E({port:Number(e.target.value)||22})})]})}),(0,W.jsx)(X,{label:n(`connection.form.sshUser`),htmlFor:`conn-ssh-user`,children:(0,W.jsx)(L,{id:`conn-ssh-user`,placeholder:n(`connection.form.sshUserPlaceholder`),value:b.user,onChange:e=>E({user:e.target.value.trim()})})}),(0,W.jsx)(X,{label:n(`connection.form.sshAuth`),children:(0,W.jsxs)(v,{value:b.auth,onValueChange:e=>E({auth:e}),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsxs)(g,{children:[(0,W.jsx)(_,{value:`key`,children:n(`connection.form.sshAuthKey`)}),(0,W.jsx)(_,{value:`password`,children:n(`connection.form.sshAuthPassword`)}),(0,W.jsx)(_,{value:`agent`,children:n(`connection.form.sshAuthAgent`)})]})]})}),b.auth===`password`&&(0,W.jsx)(X,{label:n(`connection.form.sshPassword`),htmlFor:`conn-ssh-pass`,children:(0,W.jsx)(L,{id:`conn-ssh-pass`,type:`password`,autoComplete:`new-password`,value:b.password??``,onChange:e=>E({password:e.target.value})})}),b.auth===`key`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:n(`connection.form.sshKey`),htmlFor:`conn-ssh-key`,children:(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-ssh-key`,type:`file`,className:`hidden`,onChange:e=>{D(e.target.files?.[0]),e.target.value=``}}),(0,W.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,className:`h-7 shrink-0 px-2 text-xs`,onClick:()=>document.getElementById(`conn-ssh-key`)?.click(),children:b.privateKey?n(`connection.form.changeFile`):n(`connection.form.sshKeyPick`)}),(0,W.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,title:b.privateKeyName,children:b.privateKey?b.privateKeyName||n(`connection.form.sshKeyLoaded`):n(`connection.form.sshKeyHint`)})]})}),(0,W.jsx)(X,{label:n(`connection.form.sshPassphrase`),htmlFor:`conn-ssh-passphrase`,children:(0,W.jsx)(L,{id:`conn-ssh-passphrase`,type:`password`,autoComplete:`new-password`,placeholder:n(`connection.form.sshPassphrasePlaceholder`),value:b.passphrase??``,onChange:e=>E({passphrase:e.target.value})})})]}),b.auth===`agent`&&(0,W.jsx)(`p`,{className:`col-start-2 text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshAuthAgentHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshTargetHint`)}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:n(`connection.form.sshSecretsHint`)})]})]}),(0,W.jsx)(X,{label:n(`connection.form.autoConnection`),htmlFor:`conn-auto`,children:(0,W.jsx)(`div`,{className:`flex items-center`,children:(0,W.jsx)(`input`,{id:`conn-auto`,type:`checkbox`,checked:e.autoConnection,onChange:e=>r(`autoConnection`,e.target.checked),className:`size-4 accent-primary cursor-pointer`})})}),(0,W.jsx)(`div`,{className:`mt-1 border-t pt-3 text-xs font-medium text-muted-foreground`,children:n(`connection.form.safety`)}),(0,W.jsx)(X,{label:n(`connection.form.environment`),children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[A.map(t=>{let n=(e.environmentColor??`none`)===t.id;return(0,W.jsx)(`button`,{type:`button`,title:I(t.id),"aria-label":I(t.id),"aria-pressed":n,onClick:()=>r(`environmentColor`,t.id),className:`size-6 rounded-full border-2 transition-transform ${n?`scale-110 border-foreground`:`border-transparent hover:scale-105`}`,style:{background:t.id===`none`?`repeating-linear-gradient(45deg, transparent, transparent 3px, var(--muted-foreground) 3px, var(--muted-foreground) 4px)`:t.hex}},t.id)}),(0,W.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground`,children:n(`connection.form.environmentHint`)})]})}),(0,W.jsx)(X,{label:n(`connection.form.readOnly`),htmlFor:`conn-readonly`,children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`input`,{id:`conn-readonly`,type:`checkbox`,checked:e.readOnly??!1,onChange:e=>r(`readOnly`,e.target.checked),className:`size-4 accent-primary cursor-pointer`}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`connection.form.readOnlyHint`)})]})}),ee?.transactions!==!1&&(0,W.jsx)(X,{label:n(`connection.form.transactions`),children:(0,W.jsxs)(v,{value:e.transactionMode??`auto`,onValueChange:e=>r(`transactionMode`,e),children:[(0,W.jsx)(h,{className:`w-full`,children:(0,W.jsx)(m,{})}),(0,W.jsxs)(g,{children:[(0,W.jsx)(_,{value:`auto`,children:n(`connection.form.txAuto`)}),(0,W.jsx)(_,{value:`manual`,children:n(`connection.form.txManual`)})]})]})})]})}var Ze=[`id`,`serverConnectionId`,`sample`,`scratchpad`,`autoConnection`];function Qe(e){return!e.sample&&!e.scratchpad}function $e(e,t,n=new Date){let r=t?e:y(e),i={...r};for(let e of Ze)delete i[e];if(i.pass||delete i.pass,i.authToken||delete i.authToken,r.ssh){let e={...r.ssh};for(let t of[`password`,`passphrase`,`privateKey`])e[t]||delete e[t];i.ssh=e}return{planche:`connection`,version:1,exportedAt:n.toISOString(),secrets:t,connection:i}}function et(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Not a JSON file`)}let n=t;if(!n||n.planche!==`connection`||!n.connection||typeof n.connection!=`object`)throw Error(`Not a Planche connection file`);if(typeof n.connection.dbms!=`string`||!n.connection.dbms)throw Error(`The connection has no database type`);return n}var Z=(e,t=``)=>typeof e==`string`?e:t,Q=e=>typeof e==`boolean`?e:void 0,tt=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:t,$=e=>e===void 0||e===``?void 0:e;function nt(e){if(!e||typeof e!=`object`)return;let t=e,n=t.auth===`key`||t.auth===`agent`?t.auth:`password`;return{enabled:t.enabled===!0,host:Z(t.host),port:tt(t.port,22),user:Z(t.user),auth:n,password:$(Z(t.password)),privateKey:$(Z(t.privateKey)),privateKeyName:$(Z(t.privateKeyName)),passphrase:$(Z(t.passphrase))}}function rt(e,t,n=crypto.randomUUID()){let r=e.connection,i=Q(r.savePassword),a={id:n,hostName:it(Z(r.hostName),t),host:Z(r.host),user:Z(r.user),pass:Z(r.pass),charset:Z(r.charset,`utf8`),port:tt(r.port,0),dbms:r.dbms,database:$(Z(r.database)),transport:r.transport===`tunnel`||r.transport===`browser`?r.transport:void 0,file:$(Z(r.file)),createIfMissing:Q(r.createIfMissing),ssl:Q(r.ssl),sslVerify:Q(r.sslVerify),accountId:$(Z(r.accountId)),databaseId:$(Z(r.databaseId)),devUrl:$(Z(r.devUrl)),ssh:nt(r.ssh),gatewayProfile:$(Z(r.gatewayProfile)),autoConnection:!1,savePassword:i??!0,authToken:Z(r.authToken),readOnly:Q(r.readOnly),environmentColor:$(Z(r.environmentColor)),transactionMode:$(Z(r.transactionMode))};for(let e of Object.keys(a))a[e]===void 0&&delete a[e];return a}function it(e,t){if(!e||!t.some(t=>t.hostName===e))return e;for(let n=2;;n++){let r=`${e} (${n})`;if(!t.some(e=>e.hostName===r))return r}}async function at(e,t,n=`application/json`){let r=Oe(e);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:r,types:[{accept:{[n]:[`.${r.split(`.`).pop()??`txt`}`]}}]})).createWritable();return await e.write(t),await e.close(),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1}let i=URL.createObjectURL(new Blob([t],{type:n})),a=document.createElement(`a`);return a.href=i,a.download=r,a.click(),URL.revokeObjectURL(i),!0}function ot(e=`.json,application/json`){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.onchange=async()=>{let e=n.files?.[0];t(e?await e.text():null)},n.oncancel=()=>t(null),n.click()})}function st({...e}){return(0,W.jsx)(ze,{"data-slot":`dropdown-menu`,...e})}function ct({...e}){return(0,W.jsx)(Be,{"data-slot":`dropdown-menu-trigger`,...e})}function lt({className:e,sideOffset:t=4,...n}){return(0,W.jsx)(Ve,{children:(0,W.jsx)(He,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:o(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function ut({className:e,inset:t,variant:n=`default`,...r}){return(0,W.jsx)(Ue,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:o(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function dt(){let{t:e}=a(),{activeDialog:t,closeDialog:i,showMessage:o}=n(),[s,c]=(0,U.useState)(!1),{savedConnections:u,addSavedConnection:d,updateSavedConnection:f,deleteSavedConnection:p,openConnection:m}=b(),h=r(`connect`)?.profileId,[g,_]=(0,U.useState)(()=>h??null),[v,y]=(0,U.useState)(()=>{let e=h?u.find(e=>e.id===h):void 0;return e?{...e}:null}),x=t===`connect`,[S,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(null),se=be(e=>e.url),ce=be(e=>e.token);(0,U.useEffect)(()=>{if(!x)return;let e=!1;return(async()=>{try{let t=await w();if(e||t.state!==`online`||!t.gateway){e||O(null);return}let n=await T();e||(O({name:n.gateway,profiles:n.profiles}),A(null))}catch(t){e||A(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[x,se,ce]);function M(t){let r=u.find(e=>e.gatewayProfile===t.name);if(r){P(r);return}let i=ye(t);d(i),P(i),n.getState().setFooterMessage(e(`connection.dialog.gatewayAdded`,{name:t.name}))}function N(e){e||(i(),_(null),y(null))}function P(e){_(e.id),y({...e})}function de(e){y(e),f(e.id,e)}function me(){let e=fe();d(e),_(e.id),y(e)}function I(){g&&(p(g),_(null),y(null))}async function L(t){let r=u.find(e=>e.id===g);if(!r||!Qe(r))return;let i=r.hostName||e(`connection.dialog.unnamed`),a=$e(b.getState().resolveCredentials(r),t);await at(`planche-connection-${i}.json`,JSON.stringify(a,null,2))&&n.getState().setFooterMessage(e(`connection.dialog.exported`,{name:i}))}async function R(){let t=await ot();if(t!==null)try{let r=rt(et(t),b.getState().savedConnections);d(r),_(r.id),y(r),n.getState().setFooterMessage(e(`connection.dialog.imported`,{name:r.hostName||e(`connection.dialog.unnamed`)}))}catch(t){o({tone:`error`,title:e(`connection.dialog.importFailedTitle`),description:t instanceof Error?t.message:String(t)})}}let ve=g!==null&&u.some(e=>e.id===g&&Qe(e)),[z,H]=(0,U.useState)(!1),Oe=ne(e=>e.addQueryTab);function G(t){let n=b.getState().activeConnections.some(e=>e.id===t.id);if(m(t),E.getState().removeTree(t.id),ee(t.id),n){i(),_(null),y(null);return}Oe(t.id,{id:`tab-${Date.now()}`,title:e(`connection.dialog.firstQueryTab`),query:``,database:``,isExecuting:!1,results:[],error:null,executionTime:null}),i(),_(null),y(null)}async function K(t){let r=await ae(t.id,{interactive:!0});if(!r)return;let i={...t,file:r.fileName,serverConnectionId:r.connectionId};f(t.id,{file:r.fileName}),G(i),b.getState().setFileDetached(t.id,r.fileDetached),r.restoredUnsaved?n.getState().setFooterMessage(e(r.diskChanged?`connection.dialog.restoredUnsavedDiskChanged`:`connection.dialog.restoredUnsaved`,{file:r.fileName})):r.wal&&!r.walApplied?n.getState().setFooterMessage(e(`connection.dialog.walPending`,{file:r.fileName})):r.walApplied&&n.getState().setFooterMessage(e(`connection.dialog.walApplied`,{file:r.fileName}))}async function q(t,r){try{return await r(t)}catch(i){let a=te(i);if(!a||!(`ssh`in t)||!t.ssh||!await n.getState().requestDestructiveConfirm({title:e(`connection.dialog.hostKeyTitle`),description:e(`connection.dialog.hostKeyDescription`,a),confirmLabel:e(`connection.dialog.hostKeyAccept`)}))throw i;return r({...t,ssh:{...t.ssh,acceptHostKey:a.fingerprint}})}}async function J(){if(v){H(!0);try{if(D(v)===`browser`){await K(v);return}let t=await q(C(v),e=>ie(e,v.authToken||void 0));t.success?G({...v,serverConnectionId:t.connectionId}):o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.connectFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{H(!1)}}}async function ke(){if(v){if(D(v)===`browser`){o({tone:`info`,title:e(`connection.dialog.testConnection`),description:e(`connection.dialog.browserTestHint`)});return}c(!0);try{let t=await q(C(v),e=>re(e,v.authToken||void 0));t.success?o({tone:`success`,title:e(`connection.dialog.testSuccess`),description:e(`connection.dialog.testSuccessDescription`)}):o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t.message??e(`connection.dialog.unknownError`)})}catch(t){o({tone:`error`,title:e(`connection.dialog.testFailedTitle`),description:t instanceof Error?t.message:String(t)})}finally{c(!1)}}}return(0,W.jsx)(De,{open:x,onOpenChange:N,children:(0,W.jsxs)(Te,{className:`sm:max-w-[1100px] h-[85vh] max-h-[85vh] flex flex-col`,children:[(0,W.jsx)(Ce,{children:(0,W.jsx)(Ee,{children:e(`connection.dialog.title`)})}),(0,W.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-catppuccin-green/40 bg-catppuccin-green/10 px-3 py-2 text-xs leading-relaxed text-foreground`,children:[(0,W.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-catppuccin-green`,"aria-hidden":!0}),(0,W.jsx)(`span`,{children:e(`connection.dialog.privacy`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 gap-4 overflow-hidden min-h-0`,children:[(0,W.jsxs)(`div`,{className:`w-[460px] shrink-0 border rounded-md overflow-hidden flex flex-col`,children:[(S||k)&&(0,W.jsxs)(`div`,{className:`border-b p-2 text-xs space-y-1 max-h-40 overflow-auto`,children:[(0,W.jsxs)(`p`,{className:`font-medium`,children:[e(`connection.dialog.gatewayTitle`),S?` — ${S.name}`:``]}),k&&(0,W.jsx)(`p`,{className:`text-destructive`,children:e(`connection.dialog.gatewayLoadFailed`,{error:k})}),S?.profiles.map(t=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate`,children:[(0,W.jsx)(B,{dbms:_e[t.driver],className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:t.name}),(0,W.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,t.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),`)`]})]}),(0,W.jsx)(l,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>M(t),children:e(`connection.dialog.gatewayAdd`)})]},t.name))]}),(0,W.jsx)(ge,{className:`h-full`,children:(0,W.jsxs)(xe,{className:`table-fixed`,children:[(0,W.jsx)(ue,{children:(0,W.jsxs)(j,{children:[(0,W.jsx)(V,{className:`w-[32%]`,children:e(`connection.dialog.colHostName`)}),(0,W.jsx)(V,{className:`w-[40%]`,children:e(`connection.dialog.colTarget`)}),(0,W.jsx)(V,{className:`w-[28%]`,children:e(`connection.dialog.colDbms`)})]})}),(0,W.jsx)(Se,{children:u.length===0?(0,W.jsx)(j,{children:(0,W.jsx)(F,{colSpan:3,className:`text-center text-muted-foreground`,children:e(`connection.dialog.noSaved`)})}):u.map(t=>(0,W.jsxs)(j,{"data-state":g===t.id?`selected`:void 0,className:`cursor-pointer`,onClick:()=>P(t),onDoubleClick:()=>{P(t),J()},children:[(0,W.jsx)(F,{className:`truncate font-medium`,title:t.hostName,children:t.hostName||e(`connection.dialog.unnamed`)}),(0,W.jsx)(F,{className:`truncate`,title:t.dbms===`sqlite`?t.file:t.dbms===`d1`?t.databaseId:t.dbms===`do`?t.devUrl:`${t.user}@${t.host}:${t.port}`,children:t.dbms===`sqlite`?t.file||(D(t)===`browser`?e(`connection.dialog.pickOnConnect`):e(`connection.dialog.noFile`)):t.dbms===`d1`?t.databaseId||`—`:t.dbms===`do`?t.devUrl||`—`:`${t.user}@${t.host}:${t.port}`}),(0,W.jsx)(F,{className:`truncate`,title:oe(t.dbms).label,children:(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(B,{dbms:t.dbms,className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate`,children:oe(t.dbms).label})]})})]},t.id))})]})})]}),(0,W.jsx)(`div`,{className:`flex-1 border rounded-md overflow-auto`,children:v?(0,W.jsxs)(W.Fragment,{children:[D(v)!==`browser`&&(0,W.jsx)(`div`,{className:`p-4 pb-0`,children:(0,W.jsx)(he,{})}),v.gatewayProfile?(0,W.jsxs)(`div`,{className:`p-4 space-y-2 text-sm`,children:[(0,W.jsxs)(`p`,{className:`font-medium flex items-center gap-2`,children:[(0,W.jsx)(B,{dbms:v.dbms,className:`size-4`}),v.hostName]}),(0,W.jsx)(`p`,{className:`text-muted-foreground`,children:e(`connection.dialog.gatewayProfileHint`,{name:v.gatewayProfile})}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[v.readOnly?e(`connection.dialog.gatewayReadOnly`):e(`connection.dialog.gatewayWritable`),v.database?` · ${v.database}`:``]})]}):(0,W.jsx)(Xe,{value:v,onChange:de})]}):(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:e(`connection.dialog.selectPrompt`)})})]}),(0,W.jsxs)(we,{className:`sm:justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(l,{variant:`outline`,onClick:me,children:e(`connection.dialog.addNew`)}),(0,W.jsx)(l,{variant:`destructive`,onClick:I,disabled:!g,children:e(`connection.dialog.delete`)}),(0,W.jsxs)(st,{children:[(0,W.jsx)(ct,{asChild:!0,children:(0,W.jsxs)(l,{variant:`outline`,disabled:!ve,children:[e(`connection.dialog.export`),(0,W.jsx)(le,{className:`ml-1 size-3.5`,"aria-hidden":!0})]})}),(0,W.jsxs)(lt,{align:`start`,children:[(0,W.jsx)(ut,{onSelect:()=>void L(!1),children:e(`connection.dialog.exportWithoutSecrets`)}),(0,W.jsx)(ut,{onSelect:()=>void L(!0),children:e(`connection.dialog.exportWithSecrets`)})]})]}),(0,W.jsx)(l,{variant:`outline`,onClick:()=>void R(),children:e(`connection.dialog.import`)})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(l,{variant:`outline`,onClick:ke,disabled:!v||s,children:e(`connection.dialog.testConnection`)}),(0,W.jsx)(l,{onClick:J,disabled:!v||z,children:e(`connection.dialog.connect`)}),(0,W.jsx)(l,{variant:`outline`,onClick:()=>N(!1),children:e(`connection.dialog.close`)})]})]})]})})}export{dt as ConnectDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./B1pia_Rg.js";import{l as i,m as a,t as o}from"./pjlgs2cl.js";import{t as s}from"./BCmzDvBt.js";import{n as c}from"./pneb1la9.js";import{l,m as u}from"./OjAiMU9J.js";import{c as d,it as f,l as p}from"./Bhquh17w.js";import{a as m,i as h,n as g,o as _,t as v}from"./BgkATqP8.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
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./B1pia_Rg.js";import{l as i,m as a,t as o}from"./pjlgs2cl.js";import{t as s}from"./BCmzDvBt.js";import{n as c}from"./pneb1la9.js";import{l,m as u}from"./mA5FXiEh.js";import{c as d,it as f,l as p}from"./BZ6aghND.js";import{a as m,i as h,n as g,o as _,t as v}from"./BgkATqP8.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 +1 @@
1
- import{n as e}from"./B1pia_Rg.js";import{l as t,m as n,t as r}from"./pjlgs2cl.js";import{a as i,i as a,n as o,r as s,t as c}from"./CiFkP-9S.js";import{n as l}from"./D6kbK-ng.js";import{c as u,l as d}from"./Bhquh17w.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./BgkATqP8.js";import{t as v}from"./DkPnEF-y.js";var y=t();function b(){let t=e(e=>e.activeDialog),b=e(e=>e.closeDialog),x=l(),S=x.update,{t:C}=n();return(0,y.jsx)(_,{open:t===`query-settings`,onOpenChange:e=>{e||b()},children:(0,y.jsxs)(m,{className:`sm:max-w-[560px]`,children:[(0,y.jsxs)(f,{children:[(0,y.jsx)(h,{children:C(`settings.query.title`)}),(0,y.jsx)(g,{children:C(`settings.query.description`)})]}),(0,y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,y.jsx)(v,{id:`s-dryrun`,checked:x.previewAffectedRows,onChange:e=>S({previewAffectedRows:e}),pro:!0,label:`Dry run`,hint:`Before an UPDATE or DELETE runs, read its WHERE (joins included) as a SELECT and show how many rows it would change, with a sample of them, to confirm.`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(u,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,y.jsx)(d,{id:`s-limit`,type:`number`,min:0,step:100,value:x.resultRowLimit,onChange:e=>S({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,y.jsxs)(c,{value:x.executeScope,onValueChange:e=>S({executeScope:e}),children:[(0,y.jsx)(a,{children:(0,y.jsx)(i,{})}),(0,y.jsxs)(o,{children:[(0,y.jsx)(s,{value:`script`,children:`Whole script`}),(0,y.jsx)(s,{value:`statement`,children:`Statement at cursor`})]})]})]})]}),(0,y.jsx)(p,{children:(0,y.jsx)(r,{onClick:b,children:C(`settings.done`)})})]})})}export{b as QuerySettingsDialog};
1
+ import{n as e}from"./B1pia_Rg.js";import{l as t,m as n,t as r}from"./pjlgs2cl.js";import{a as i,i as a,n as o,r as s,t as c}from"./BuhEpB12.js";import{n as l}from"./D6kbK-ng.js";import{c as u,l as d}from"./BZ6aghND.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./BgkATqP8.js";import{t as v}from"./ClQzFEcL.js";var y=t();function b(){let t=e(e=>e.activeDialog),b=e(e=>e.closeDialog),x=l(),S=x.update,{t:C}=n();return(0,y.jsx)(_,{open:t===`query-settings`,onOpenChange:e=>{e||b()},children:(0,y.jsxs)(m,{className:`sm:max-w-[560px]`,children:[(0,y.jsxs)(f,{children:[(0,y.jsx)(h,{children:C(`settings.query.title`)}),(0,y.jsx)(g,{children:C(`settings.query.description`)})]}),(0,y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,y.jsx)(v,{id:`s-dryrun`,checked:x.previewAffectedRows,onChange:e=>S({previewAffectedRows:e}),pro:!0,label:`Dry run`,hint:`Before an UPDATE or DELETE runs, read its WHERE (joins included) as a SELECT and show how many rows it would change, with a sample of them, to confirm.`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(u,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,y.jsx)(d,{id:`s-limit`,type:`number`,min:0,step:100,value:x.resultRowLimit,onChange:e=>S({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,y.jsxs)(c,{value:x.executeScope,onValueChange:e=>S({executeScope:e}),children:[(0,y.jsx)(a,{children:(0,y.jsx)(i,{})}),(0,y.jsxs)(o,{children:[(0,y.jsx)(s,{value:`script`,children:`Whole script`}),(0,y.jsx)(s,{value:`statement`,children:`Statement at cursor`})]})]})]})]}),(0,y.jsx)(p,{children:(0,y.jsx)(r,{onClick:b,children:C(`settings.done`)})})]})})}export{b as QuerySettingsDialog};
@@ -1 +1 @@
1
- import{n as e}from"./B1pia_Rg.js";import{l as t,m as n,t as r}from"./pjlgs2cl.js";import"./D6kbK-ng.js";import{K as i}from"./Bhquh17w.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./BgkATqP8.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"./B1pia_Rg.js";import{l as t,m as n,t as r}from"./pjlgs2cl.js";import"./D6kbK-ng.js";import{K as i}from"./BZ6aghND.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./BgkATqP8.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{c as t,h as n,n as r,t as i}from"./B1pia_Rg.js";import{l as a,m as ee,t as o}from"./pjlgs2cl.js";import{a as s,i as c,n as l,r as u,t as d}from"./CiFkP-9S.js";import{t as f}from"./BCmzDvBt.js";import{a as p}from"./CS2mpWDL.js";import{n as m}from"./pneb1la9.js";import{a as h,d as te}from"./OjAiMU9J.js";import{c as g,kt as _,l as ne,lt as re,mt as ie,ot as v}from"./Bhquh17w.js";import{a as ae,i as oe,n as se,o as ce,r as le,t as y}from"./BgkATqP8.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function de(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function S(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function C(e,t){return t.has(e.toLowerCase())}function fe(e,t){let n=S(t);return e.some(e=>C(e,n))}var w=a(),T=`none`,pe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function E(){let{t:e}=ee(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),x=i(`group-by`),E=n===`group-by`,D=f(e=>e.activeConnections),me=f(e=>e.activeConnectionId),he=(0,b.useMemo)(()=>D.filter(e=>e.serverConnectionId),[D]),[O,ge]=(0,b.useState)(()=>x?.connectionId??me??``),[k,A]=(0,b.useState)(()=>x?.database??``),[j,M]=(0,b.useState)(()=>x?.table??``),[N,P]=(0,b.useState)([]),[F,I]=(0,b.useState)([]),L=x&&O===x.connectionId&&k===x.database&&j===x.table?x.where??``:``,[R,z]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(T),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!E||!O)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listDatabases(p(e));if(t)return;P(n),A(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O]),(0,b.useEffect)(()=>{if(!E||!O||!k)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listTables(p(e),k);if(t)return;let r=n.map(e=>e.name);I(r),M(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k]),(0,b.useEffect)(()=>{if(!E||!O||!j)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{let n=p(e),r=m(O).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,k,j),r.listIndexes(n,k,j).catch(()=>[])]);if(t)return;z(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k,j]);let Ce=(0,b.useMemo)(()=>S(B),[B]),we=(0,b.useMemo)(()=>R.filter(e=>pe.test(e.type)),[R]),Z=(0,b.useMemo)(()=>!O||V.length===0?``:de(m(O),{database:k,table:j,columns:V,aggregate:U!==T&&W?{fn:U,column:W}:null,where:K?L:``,minCount:Number(G)||1,limit:te()}),[O,k,j,V,U,W,G,K,L]),Q=V.length>0&&B.length>0&&!fe(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:m(O).id,columns:V.length,aggregate:U,filtered:!!(K&&L),indexed:!Q})}function Ee(){Z&&($(`open`),v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j}));a();try{await h(O,t)}finally{Y(!1)}}return(0,w.jsx)(y,{open:E,onOpenChange:e=>{e||a()},children:(0,w.jsxs)(se,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,w.jsxs)(ae,{children:[(0,w.jsx)(ce,{children:e(`database.groupBy.title`)}),(0,w.jsx)(le,{children:e(`database.groupBy.description`,{table:j})})]}),q&&(0,w.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,w.jsxs)(d,{value:O,onValueChange:ge,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:he.map(e=>(0,w.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,w.jsxs)(d,{value:k,onValueChange:A,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:N.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,w.jsxs)(d,{value:j,onValueChange:M,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:F.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,w.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,w.jsx)(re,{className:`h-[260px] rounded-md border`,children:(0,w.jsx)(`ul`,{className:`p-1`,children:R.map(t=>{let n=C(t.name,Ce);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,w.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,w.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,w.jsx)(_,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsxs)(d,{value:U,onValueChange:ve,children:[(0,w.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsxs)(l,{children:[(0,w.jsx)(u,{value:T,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,w.jsx)(u,{value:e,children:e},e))]})]}),(0,w.jsxs)(d,{value:W,onValueChange:ye,disabled:U===T,children:[(0,w.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,w.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,w.jsx)(l,{children:we.map(e=>(0,w.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,w.jsx)(ne,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),L&&(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,w.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(ie,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,w.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,w.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,w.jsxs)(oe,{children:[(0,w.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,w.jsx)(o,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,w.jsx)(o,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{E as GroupByDialog};
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./B1pia_Rg.js";import{l as a,m as ee,t as o}from"./pjlgs2cl.js";import{a as s,i as c,n as l,r as u,t as d}from"./BuhEpB12.js";import{t as f}from"./BCmzDvBt.js";import{a as p}from"./CS2mpWDL.js";import{n as m}from"./pneb1la9.js";import{a as h,d as te}from"./mA5FXiEh.js";import{c as g,kt as _,l as ne,lt as re,mt as ie,ot as v}from"./BZ6aghND.js";import{a as ae,i as oe,n as se,o as ce,r as le,t as y}from"./BgkATqP8.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function de(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function S(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function C(e,t){return t.has(e.toLowerCase())}function fe(e,t){let n=S(t);return e.some(e=>C(e,n))}var w=a(),T=`none`,pe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function E(){let{t:e}=ee(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),x=i(`group-by`),E=n===`group-by`,D=f(e=>e.activeConnections),me=f(e=>e.activeConnectionId),he=(0,b.useMemo)(()=>D.filter(e=>e.serverConnectionId),[D]),[O,ge]=(0,b.useState)(()=>x?.connectionId??me??``),[k,A]=(0,b.useState)(()=>x?.database??``),[j,M]=(0,b.useState)(()=>x?.table??``),[N,P]=(0,b.useState)([]),[F,I]=(0,b.useState)([]),L=x&&O===x.connectionId&&k===x.database&&j===x.table?x.where??``:``,[R,z]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(T),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!E||!O)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listDatabases(p(e));if(t)return;P(n),A(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O]),(0,b.useEffect)(()=>{if(!E||!O||!k)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{try{let n=await m(O).introspect.listTables(p(e),k);if(t)return;let r=n.map(e=>e.name);I(r),M(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k]),(0,b.useEffect)(()=>{if(!E||!O||!j)return;let e=X(O);if(!e)return;let t=!1;return(async()=>{let n=p(e),r=m(O).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,k,j),r.listIndexes(n,k,j).catch(()=>[])]);if(t)return;z(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[E,O,k,j]);let Ce=(0,b.useMemo)(()=>S(B),[B]),we=(0,b.useMemo)(()=>R.filter(e=>pe.test(e.type)),[R]),Z=(0,b.useMemo)(()=>!O||V.length===0?``:de(m(O),{database:k,table:j,columns:V,aggregate:U!==T&&W?{fn:U,column:W}:null,where:K?L:``,minCount:Number(G)||1,limit:te()}),[O,k,j,V,U,W,G,K,L]),Q=V.length>0&&B.length>0&&!fe(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:m(O).id,columns:V.length,aggregate:U,filtered:!!(K&&L),indexed:!Q})}function Ee(){Z&&($(`open`),v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=v(O,Z,k,e(`database.groupBy.tabTitle`,{table:j}));a();try{await h(O,t)}finally{Y(!1)}}return(0,w.jsx)(y,{open:E,onOpenChange:e=>{e||a()},children:(0,w.jsxs)(se,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,w.jsxs)(ae,{children:[(0,w.jsx)(ce,{children:e(`database.groupBy.title`)}),(0,w.jsx)(le,{children:e(`database.groupBy.description`,{table:j})})]}),q&&(0,w.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,w.jsxs)(d,{value:O,onValueChange:ge,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:he.map(e=>(0,w.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,w.jsxs)(d,{value:k,onValueChange:A,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:N.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,w.jsxs)(d,{value:j,onValueChange:M,children:[(0,w.jsx)(c,{className:`h-8 text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsx)(l,{children:F.map(e=>(0,w.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,w.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,w.jsx)(re,{className:`h-[260px] rounded-md border`,children:(0,w.jsx)(`ul`,{className:`p-1`,children:R.map(t=>{let n=C(t.name,Ce);return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,w.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,w.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,w.jsx)(_,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsxs)(d,{value:U,onValueChange:ve,children:[(0,w.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,w.jsx)(s,{})}),(0,w.jsxs)(l,{children:[(0,w.jsx)(u,{value:T,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,w.jsx)(u,{value:e,children:e},e))]})]}),(0,w.jsxs)(d,{value:W,onValueChange:ye,disabled:U===T,children:[(0,w.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,w.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,w.jsx)(l,{children:we.map(e=>(0,w.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,w.jsx)(ne,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),L&&(0,w.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,w.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(ie,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,w.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,w.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,w.jsxs)(oe,{children:[(0,w.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,w.jsx)(o,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,w.jsx)(o,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{E as GroupByDialog};