planche 0.8.6 → 0.8.7

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 (72) hide show
  1. package/app/assets/{CAHFhps_.js → 0Fs8FEUD.js} +2 -2
  2. package/app/assets/4_c4BD6i.js +1 -0
  3. package/app/assets/{CnOZTyPx.js → 5Jrsnc1i.js} +2 -2
  4. package/app/assets/{2rC1LDx2.js → 7lSlYhqB.js} +1 -1
  5. package/app/assets/AiAiN2FW.js +2 -0
  6. package/app/assets/{CQieSTGh.js → B2l0e8gZ.js} +1 -1
  7. package/app/assets/{DTxGpkJp.js → B3nhMsGp.js} +1 -1
  8. package/app/assets/BFDfeOJg.js +2 -0
  9. package/app/assets/BHp-ICZv.js +2 -0
  10. package/app/assets/{NYrZ_KG4.js → BLcW8KqJ.js} +1 -1
  11. package/app/assets/BNkgLUl5.js +1 -0
  12. package/app/assets/BVrYyQUV.js +1 -0
  13. package/app/assets/{BgDlbKXF.js → BaiI2zwt.js} +1 -1
  14. package/app/assets/{C1RY7wUM.js → BfSKVZnY.js} +1 -1
  15. package/app/assets/BgFzEiCb.css +2 -0
  16. package/app/assets/Bxw3grU1.js +959 -0
  17. package/app/assets/{DyJPwVZe.js → C3S71So3.js} +1 -1
  18. package/app/assets/C5SHWmPn.js +2 -0
  19. package/app/assets/{DtU_PUOl.js → CCwciyHS.js} +1 -1
  20. package/app/assets/{CPgI8it1.js → CJmQYjPl.js} +1 -1
  21. package/app/assets/{XlrBcEaO.js → CKB3jCfp.js} +1 -1
  22. package/app/assets/{BM_rLXLv.js → CMRtomUk.js} +1 -1
  23. package/app/assets/CQLuUHsS.js +2 -0
  24. package/app/assets/CRr_nYUE.js +2 -0
  25. package/app/assets/{Bxa5htLS.js → CU8MbklZ.js} +1 -1
  26. package/app/assets/{BdPEUnLq.js → Ca4g4XbM.js} +1 -1
  27. package/app/assets/CgRvgqaA.js +1 -0
  28. package/app/assets/{CfsL8_WC.js → CgWXabLX.js} +1 -1
  29. package/app/assets/{vKCvRvxP.js → ChiscGY_.js} +1 -1
  30. package/app/assets/{DbRMSZEW.js → Cr6Fx4T5.js} +1 -1
  31. package/app/assets/{Cw_LYT6k.js → CtXRSNHU.js} +1 -1
  32. package/app/assets/{DsAlsNTl.js → Cy3jxi5W.js} +1 -1
  33. package/app/assets/{DKjjOKsl.js → CyNRK4kc.js} +1 -1
  34. package/app/assets/CytzrZ6l.js +1 -0
  35. package/app/assets/{Bm1X7uTX.js → D2srGZZJ.js} +2 -2
  36. package/app/assets/{B4JrGAXR.js → D5KYAPHx.js} +1 -1
  37. package/app/assets/{BM5G_YA7.js → D8QuNkWm.js} +1 -1
  38. package/app/assets/{YjhzJVQZ.js → D8WkLv3B.js} +2 -2
  39. package/app/assets/{BuiqFOkR.js → DGXqbK7m.js} +1 -1
  40. package/app/assets/DNpCwjdk.js +1 -0
  41. package/app/assets/{BluggY4N.js → DQsFpqjm.js} +1 -1
  42. package/app/assets/DTqOQG1i.js +1 -0
  43. package/app/assets/{B1mA7CRG.js → DUyKev3g.js} +1 -1
  44. package/app/assets/DsllOXPq.js +1 -0
  45. package/app/assets/DwhUAD0k.js +1 -0
  46. package/app/assets/{Cl5bGhXD.js → GuPQTKm6.js} +1 -1
  47. package/app/assets/{B-yXhF3b.js → HNvyS0OG.js} +1 -1
  48. package/app/assets/Lv_K3w8K.js +1 -0
  49. package/app/assets/{D-RWduy5.js → RCiVSH3E.js} +1 -1
  50. package/app/assets/{B3UjY7jq.js → Y9NV3E8q.js} +1 -1
  51. package/app/assets/{ohBkXlZt.js → c2vgLpEV.js} +1 -1
  52. package/app/assets/{pp1UmAJW.js → c6OX2yNi.js} +1 -1
  53. package/app/assets/{ClyAuDY9.js → fDSXGLmI.js} +2 -2
  54. package/app/assets/{Cd_45PFU.js → kMxR92IL.js} +1 -1
  55. package/app/index.html +16 -14
  56. package/package.json +1 -1
  57. package/app/assets/B1lNzsWx.js +0 -959
  58. package/app/assets/B3LyCSVJ.js +0 -1
  59. package/app/assets/BGIwW6nZ.js +0 -1
  60. package/app/assets/BP4mxS6-.js +0 -1
  61. package/app/assets/BV9jV2YU.js +0 -1
  62. package/app/assets/BXX-BtBa.js +0 -2
  63. package/app/assets/BziT-o8V.js +0 -2
  64. package/app/assets/CB6XKkDn.js +0 -1
  65. package/app/assets/CChaTOPr.js +0 -1
  66. package/app/assets/CFQ-2DAt.js +0 -2
  67. package/app/assets/CWY0kZPK.js +0 -2
  68. package/app/assets/D3Eb1tV7.css +0 -2
  69. package/app/assets/D8nrOvmh.js +0 -2
  70. package/app/assets/bDuhhOB6.js +0 -1
  71. package/app/assets/mSiUHQYe.js +0 -1
  72. package/app/assets/u80owQsI.js +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{I as s,L as c,R as l,c as u,t as d}from"./B1lNzsWx.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./B1mA7CRG.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),i=r(`license`),{key:S,status:C,activate:w,clear:T}=s(),{t:E}=a(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(c()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(_,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(m,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(f,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(d,{size:44}),(0,b.jsx)(l,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(h,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(g,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(u,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(p,{children:[S&&(0,b.jsx)(o,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(o,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(o,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{L as s,R as c,c as l,t as u,z as d}from"./Bxw3grU1.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./DUyKev3g.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),i=r(`license`),{key:S,status:C,activate:w,clear:T}=s(),{t:E}=a(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(c()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(_,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(m,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(f,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(u,{size:44}),(0,b.jsx)(d,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(h,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(g,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(l,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(p,{children:[S&&(0,b.jsx)(o,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(o,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(o,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
@@ -1 +1 @@
1
- import{_ as e}from"./DTxGpkJp.js";function t(e,n){for(let r of e)n(r),r.children.length>0&&t(r.children,n)}function n(e,t){for(let r of e){if(r.id===t)return r;let e=n(r.children,t);if(e)return e}return null}function r(t){return(t.type===e.DATABASE||t.type===e.SCHEMA)&&!!t.metadata?.database}function i(e){let n=[];return t(e,e=>{r(e)&&n.push(e.metadata.database)}),n}function a(n,r){let i=[];return t(n,t=>{t.type===e.TABLE&&t.metadata?.database===r&&i.push(t.text)}),i}function o(e,t){return t?n(e,t)?.metadata?.database??null:null}function s(t,r){if(!r)return null;let i=n(t,r);return!i||i.type!==e.TABLE?null:{database:i.metadata?.database??``,table:i.text}}function c(e){return e.find(e=>e.metadata?.catalog&&!e.metadata.unreachable)?.metadata?.catalog}export{s as a,o as i,n,a as o,i as r,t as s,c as t};
1
+ import{_ as e}from"./B3nhMsGp.js";function t(e,n){for(let r of e)n(r),r.children.length>0&&t(r.children,n)}function n(e,t){for(let r of e){if(r.id===t)return r;let e=n(r.children,t);if(e)return e}return null}function r(t){return(t.type===e.DATABASE||t.type===e.SCHEMA)&&!!t.metadata?.database}function i(e){let n=[];return t(e,e=>{r(e)&&n.push(e.metadata.database)}),n}function a(n,r){let i=[];return t(n,t=>{t.type===e.TABLE&&t.metadata?.database===r&&i.push(t.text)}),i}function o(e,t){return t?n(e,t)?.metadata?.database??null:null}function s(t,r){if(!r)return null;let i=n(t,r);return!i||i.type!==e.TABLE?null:{database:i.metadata?.database??``,table:i.text}}function c(e){return e.find(e=>e.metadata?.catalog&&!e.metadata.unreachable)?.metadata?.catalog}export{s as a,o as i,n,a as o,i as r,t as s,c as t};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./BGIwW6nZ.js";import{_ as p,t as m}from"./DTxGpkJp.js";import{n as ee}from"./CChaTOPr.js";import{a as te}from"./Cw_LYT6k.js";import{n as ne}from"./DbRMSZEW.js";import{n as re}from"./CnOZTyPx.js";import{V as h,c as g,j as _,l as v}from"./B1lNzsWx.js";import{a as y,i as b,n as x,o as S,t as ie}from"./DxuXBECK.js";import{t as C}from"./CnYBZPf9.js";var w=e(n(),1);function T(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./DsllOXPq.js";import{_ as p,t as m}from"./B3nhMsGp.js";import{n as ee}from"./BNkgLUl5.js";import{a as te}from"./CtXRSNHU.js";import{n as ne}from"./Cr6Fx4T5.js";import{n as re}from"./5Jrsnc1i.js";import{H as h,M as ie,c as g,l as _}from"./Bxw3grU1.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";import{t as C}from"./CnYBZPf9.js";var w=e(n(),1);function T(e,t){let n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e);return!(typeof e==`number`||typeof e==`bigint`||/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?$/.test(n))&&/^[=+\-@\t\r]/.test(n)&&(n=`'${n}`),n.includes(t)||n.includes(`"`)||n.includes(`
2
2
  `)||n.includes(`\r`)?`"${n.replace(/"/g,`""`)}"`:n}var E=(e,t)=>e.map(e=>T(e,t)).join(t)+`
3
- `,D=e=>e===` `,O=e=>D(e)?`TSV`:`CSV`,k=e=>D(e)?`.tsv`:`.csv`,A=e=>D(e)?`text/tab-separated-values`:`text/csv`;async function j(e,t){let n=C(e),r=A(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:O(t),accept:{[r]:[k(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new M}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var M=class extends Error{constructor(){super(`CSV export cancelled`)}};async function N(e){let n=await j(`${e.table}${k(e.delimiter)}`,e.delimiter),r=0;try{let i=await h({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(E(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>E(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{source:`table`,rows:r,format:O(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function P(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(E(o,r));for(let e of n)s.push(E(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${A(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=C(a??`query_result${k(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{source:`result`,rows:n.length,format:O(r)})}var F=a(),I=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=o(),{activeDialog:t,closeDialog:n}=r(),a=i(`export-csv`),h=m(e=>e.activeConnectionId),C=ee(),T=t===`export-csv`,[E,O]=(0,w.useState)(`query_result`),[k,A]=(0,w.useState)(``),[j,L]=(0,w.useState)([]),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(`,`),[H,U]=(0,w.useState)(!0),[W,G]=(0,w.useState)(!1),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useRef)(null),Z=D(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===p.TABLE||a.nodeType===p.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!h)return null;let e=(C.tabs[h]??[]).find(e=>e.id===C.activeTabId[h]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,w.useEffect)(()=>{if(!T)return;let e=Q();V(a?.delimiter??`,`),e&&(A(e.table),O(`table_data`))},[T]),(0,w.useEffect)(()=>{if(!T||!h)return;let e=m.getState().activeConnections.find(e=>e.id===h);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await ne(h).introspect.listDatabases(te(e.serverConnectionId));if(t)return;L(n);let r=C.tabs[h]?.find(e=>e.id===C.activeTabId[h])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[T,h]);function $(e){if(!e){if(W){X.current?.abort();return}n(),O(`query_result`),A(``),V(`,`),U(!0)}}async function ae(){if(!h)return;if(Y(null),E===`query_result`){let e=C.activeTabId[h],t=(C.tabs[h]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;P(t.fields,t.rows,B,H),n();return}if(!k.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let i=await N({connectionId:h,database:R,table:k.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});r.getState().setFooterMessage(e(`database.csv.done`,{count:i,table:k.trim(),format:Z})),n()}catch(e){!(e instanceof M)&&!(e instanceof re&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,F.jsx)(ie,{open:T,onOpenChange:$,children:(0,F.jsxs)(x,{className:`sm:max-w-[450px]`,children:[(0,F.jsx)(y,{children:(0,F.jsx)(S,{children:e(`database.csv.title`,{format:Z})})}),(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{children:e(`database.csv.target`)}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`query_result`,checked:E===`query_result`,onChange:()=>O(`query_result`)}),e(`database.csv.targetQueryResult`)]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`table_data`,checked:E===`table_data`,onChange:()=>O(`table_data`)}),e(`database.csv.targetTableData`)]})]})]}),E===`table_data`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-database`,children:e(`database.csv.database`)}),(0,F.jsxs)(f,{value:R,onValueChange:z,disabled:j.length===0,children:[(0,F.jsx)(l,{id:`csv-database`,className:`w-full`,children:(0,F.jsx)(c,{placeholder:e(`database.csv.databasePlaceholder`)})}),(0,F.jsx)(u,{children:j.map(e=>(0,F.jsx)(d,{value:e,children:e},e))})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-table-name`,children:e(`database.csv.tableName`)}),(0,F.jsx)(v,{id:`csv-table-name`,value:k,onChange:e=>A(e.target.value),placeholder:e(`database.csv.tableNamePlaceholder`)})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-delimiter`,children:e(`database.csv.delimiter`)}),(0,F.jsxs)(f,{value:B,onValueChange:V,children:[(0,F.jsx)(l,{id:`csv-delimiter`,className:`w-full`,children:(0,F.jsx)(c,{})}),(0,F.jsx)(u,{children:I.map(t=>(0,F.jsx)(d,{value:t.value,children:e(t.label)},t.value))})]})]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked)}),e(`database.csv.includeHeaders`)]})]}),K&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(_,{value:oe??0}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:K.total===null?e(`database.csv.progressUnknown`,{loaded:K.loaded}):e(`database.csv.progress`,{loaded:K.loaded,total:K.total})})]}),J&&(0,F.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:J}),(0,F.jsxs)(b,{children:[(0,F.jsx)(s,{variant:`outline`,onClick:()=>$(!1),children:e(W?`database.csv.stop`:`database.csv.cancel`)}),(0,F.jsx)(s,{onClick:ae,disabled:W||E===`table_data`&&!k.trim(),children:e(W?`database.csv.downloading`:`database.csv.download`)})]})]})})}export{L as DownloadToCSVDialog};
3
+ `,D=e=>e===` `,O=e=>D(e)?`TSV`:`CSV`,k=e=>D(e)?`.tsv`:`.csv`,A=e=>D(e)?`text/tab-separated-values`:`text/csv`;async function j(e,t){let n=C(e),r=A(t);if(typeof window.showSaveFilePicker==`function`)try{let e=await(await window.showSaveFilePicker({suggestedName:n,types:[{description:O(t),accept:{[r]:[k(t)]}}]})).createWritable();return await e.write(``),{write:t=>e.write(t),finish:()=>e.close(),abort:()=>e.abort()}}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw new M}let i=[``];return{write:async e=>{i.push(e)},finish:async()=>{let e=new Blob(i,{type:`${r};charset=utf-8;`}),t=URL.createObjectURL(e),a=document.createElement(`a`);a.href=t,a.download=n,a.click(),URL.revokeObjectURL(t)},abort:async()=>{i.length=0}}}var M=class extends Error{constructor(){super(`CSV export cancelled`)}};async function N(e){let n=await j(`${e.table}${k(e.delimiter)}`,e.delimiter),r=0;try{let i=await h({connectionId:e.connectionId,database:e.database,table:e.table,signal:e.signal,onProgress:e.onProgress}),a=i.fields.map(e=>e.name);e.includeHeaders&&await n.write(E(a,e.delimiter));for await(let t of i.pages)await n.write(t.map(t=>E(a.map(e=>t[e]),e.delimiter)).join(``)),r+=t.length;return await n.finish(),t(`export_csv`,{source:`table`,rows:r,format:O(e.delimiter)}),r}catch(e){throw await n.abort().catch(()=>void 0),e}}function P(e,n,r,i,a){let o=e.map(e=>e.name),s=[``];i&&s.push(E(o,r));for(let e of n)s.push(E(o.map(t=>e[t]),r));let c=new Blob(s,{type:`${A(r)};charset=utf-8;`}),l=URL.createObjectURL(c),u=document.createElement(`a`);u.href=l,u.download=C(a??`query_result${k(r)}`),u.click(),URL.revokeObjectURL(l),t(`export_csv`,{source:`result`,rows:n.length,format:O(r)})}var F=a(),I=[{value:`,`,label:`database.csv.delimiterComma`},{value:` `,label:`database.csv.delimiterTab`},{value:`;`,label:`database.csv.delimiterSemicolon`},{value:`|`,label:`database.csv.delimiterPipe`}];function L(){let{t:e}=o(),{activeDialog:t,closeDialog:n}=r(),a=i(`export-csv`),h=m(e=>e.activeConnectionId),C=ee(),T=t===`export-csv`,[E,O]=(0,w.useState)(`query_result`),[k,A]=(0,w.useState)(``),[j,L]=(0,w.useState)([]),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(`,`),[H,U]=(0,w.useState)(!0),[W,G]=(0,w.useState)(!1),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(null),X=(0,w.useRef)(null),Z=D(B)?`TSV`:`CSV`,Q=()=>{if(a?.nodeText&&(a.nodeType===p.TABLE||a.nodeType===p.VIEW)){let e=a.metadata?.database;return{table:a.nodeText,database:typeof e==`string`?e:``}}if(!h)return null;let e=(C.tabs[h]??[]).find(e=>e.id===C.activeTabId[h]);return e?.sourceTable?{table:e.sourceTable.table,database:e.sourceTable.database}:null};(0,w.useEffect)(()=>{if(!T)return;let e=Q();V(a?.delimiter??`,`),e&&(A(e.table),O(`table_data`))},[T]),(0,w.useEffect)(()=>{if(!T||!h)return;let e=m.getState().activeConnections.find(e=>e.id===h);if(!e?.serverConnectionId)return;let t=!1;return(async()=>{try{let n=await ne(h).introspect.listDatabases(te(e.serverConnectionId));if(t)return;L(n);let r=C.tabs[h]?.find(e=>e.id===C.activeTabId[h])?.database||``,i=Q()?.database||``;z(e=>n.includes(i)?i:n.includes(e)?e:n.includes(r)?r:n.length===1?n[0]:``)}catch{t||L([])}})(),()=>{t=!0}},[T,h]);function $(e){if(!e){if(W){X.current?.abort();return}n(),O(`query_result`),A(``),V(`,`),U(!0)}}async function ae(){if(!h)return;if(Y(null),E===`query_result`){let e=C.activeTabId[h],t=(C.tabs[h]??[]).find(t=>t.id===e)?.results?.[0];if(!t||t.rows.length===0)return;P(t.fields,t.rows,B,H),n();return}if(!k.trim()||!R)return;let t=new AbortController;X.current=t,G(!0),q({loaded:0,total:null});try{let i=await N({connectionId:h,database:R,table:k.trim(),delimiter:B,includeHeaders:H,onProgress:q,signal:t.signal});r.getState().setFooterMessage(e(`database.csv.done`,{count:i,table:k.trim(),format:Z})),n()}catch(e){!(e instanceof M)&&!(e instanceof re&&t.signal.aborted)&&Y(e instanceof Error?e.message:String(e))}finally{G(!1),q(null),X.current=null}}let oe=K?.total?Math.min(100,Math.round(K.loaded/K.total*100)):null;return(0,F.jsx)(S,{open:T,onOpenChange:$,children:(0,F.jsxs)(b,{className:`sm:max-w-[450px]`,children:[(0,F.jsx)(v,{children:(0,F.jsx)(x,{children:e(`database.csv.title`,{format:Z})})}),(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{children:e(`database.csv.target`)}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`query_result`,checked:E===`query_result`,onChange:()=>O(`query_result`)}),e(`database.csv.targetQueryResult`)]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`radio`,name:`csv-target`,value:`table_data`,checked:E===`table_data`,onChange:()=>O(`table_data`)}),e(`database.csv.targetTableData`)]})]})]}),E===`table_data`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-database`,children:e(`database.csv.database`)}),(0,F.jsxs)(f,{value:R,onValueChange:z,disabled:j.length===0,children:[(0,F.jsx)(l,{id:`csv-database`,className:`w-full`,children:(0,F.jsx)(c,{placeholder:e(`database.csv.databasePlaceholder`)})}),(0,F.jsx)(u,{children:j.map(e=>(0,F.jsx)(d,{value:e,children:e},e))})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-table-name`,children:e(`database.csv.tableName`)}),(0,F.jsx)(_,{id:`csv-table-name`,value:k,onChange:e=>A(e.target.value),placeholder:e(`database.csv.tableNamePlaceholder`)})]})]}),(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsx)(g,{htmlFor:`csv-delimiter`,children:e(`database.csv.delimiter`)}),(0,F.jsxs)(f,{value:B,onValueChange:V,children:[(0,F.jsx)(l,{id:`csv-delimiter`,className:`w-full`,children:(0,F.jsx)(c,{})}),(0,F.jsx)(u,{children:I.map(t=>(0,F.jsx)(d,{value:t.value,children:e(t.label)},t.value))})]})]}),(0,F.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked)}),e(`database.csv.includeHeaders`)]})]}),K&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(ie,{value:oe??0}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:K.total===null?e(`database.csv.progressUnknown`,{loaded:K.loaded}):e(`database.csv.progress`,{loaded:K.loaded,total:K.total})})]}),J&&(0,F.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:J}),(0,F.jsxs)(y,{children:[(0,F.jsx)(s,{variant:`outline`,onClick:()=>$(!1),children:e(W?`database.csv.stop`:`database.csv.cancel`)}),(0,F.jsx)(s,{onClick:ae,disabled:W||E===`table_data`&&!k.trim(),children:e(W?`database.csv.downloading`:`database.csv.download`)})]})]})})}export{L as DownloadToCSVDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./ClyAuDY9.js";import{t as s}from"./DTxGpkJp.js";import{c}from"./Cw_LYT6k.js";import{t as l}from"./DbRMSZEW.js";import{C as u,S as d,b as f,ct as p,l as m,v as h,x as g,y as _}from"./B1lNzsWx.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";var C=e(t(),1),w=r();function T(){let e=s.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(o.t(`command.noActiveConnection`));let n=l().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await c(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:o}=n(),[s,c]=(0,C.useState)([]),[l,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(c).catch(t=>o(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[o,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!l.trim())return s;let e=l.toLowerCase();return s.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[s,l]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(a,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(a,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(m,{placeholder:e(`command.variables.filterPlaceholder`),value:l,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(p,{className:`h-[400px]`,children:(0,w.jsxs)(h,{children:[(0,w.jsx)(d,{children:(0,w.jsxs)(u,{children:[(0,w.jsx)(g,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(g,{children:e(`command.value`)})]})}),(0,w.jsx)(_,{children:j.length===0?(0,w.jsx)(u,{children:(0,w.jsx)(f,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(u,{children:[(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(a,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./fDSXGLmI.js";import{t as s}from"./B3nhMsGp.js";import{c}from"./CtXRSNHU.js";import{t as l}from"./Cr6Fx4T5.js";import{C as u,S as d,b as f,l as p,lt as m,v as h,x as g,y as _}from"./Bxw3grU1.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";var C=e(t(),1),w=r();function T(){let e=s.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(o.t(`command.noActiveConnection`));let n=l().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await c(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:o}=n(),[s,c]=(0,C.useState)([]),[l,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(c).catch(t=>o(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[o,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!l.trim())return s;let e=l.toLowerCase();return s.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[s,l]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(a,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(a,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(p,{placeholder:e(`command.variables.filterPlaceholder`),value:l,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(m,{className:`h-[400px]`,children:(0,w.jsxs)(h,{children:[(0,w.jsx)(d,{children:(0,w.jsxs)(u,{children:[(0,w.jsx)(g,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(g,{children:e(`command.value`)})]})}),(0,w.jsx)(_,{children:j.length===0?(0,w.jsx)(u,{children:(0,w.jsx)(f,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(u,{children:[(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(a,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,o,p as s,s as c,t as l}from"./CKOS5Y-e.js";import{S as u,_ as d,x as f,y as p}from"./CZQ1r4zz.js";import{a as m,i as h,n as g,r as _,t as v}from"./DsllOXPq.js";import{T as y,f as ee,t as b}from"./B3nhMsGp.js";import{E as x,O as S,T as C,a as w,f as T,m as te}from"./Ca4g4XbM.js";import{n as ne}from"./BNkgLUl5.js";import{S as E,d as D,g as re,i as ie,l as O,r as ae}from"./CtXRSNHU.js";import{n as oe,t as k}from"./BfSKVZnY.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"./Bxw3grU1.js";import{a as Ce,i as we,n as Te,o as Ee,t as De}from"./DxuXBECK.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{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./BGIwW6nZ.js";import{t as p}from"./DTxGpkJp.js";import{a as m}from"./Cw_LYT6k.js";import{n as h}from"./DbRMSZEW.js";import{t as ee}from"./B3LyCSVJ.js";import{J as g,Y as _,c as v,l as y}from"./B1lNzsWx.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=_(e=>e.links),P=_(e=>e.setLink),F=_(e=>e.removeLink),I=O?g(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./DsllOXPq.js";import{t as p}from"./B3nhMsGp.js";import{a as m}from"./CtXRSNHU.js";import{n as h}from"./Cr6Fx4T5.js";import{t as ee}from"./4_c4BD6i.js";import{X as g,Y as _,c as v,l as y}from"./Bxw3grU1.js";import{a as b,i as x,n as S,o as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D=e=>e instanceof Error?e.message:String(e);function O(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),O=i(`link-column`),k=n===`link-column`&&!!O,A=O?.connectionId??``,j=p(e=>e.activeConnections),M=j.filter(e=>e.serverConnectionId),N=g(e=>e.links),P=g(e=>e.setLink),F=g(e=>e.removeLink),I=O?_(N,A,O.database,O.table).find(e=>e.column===O.column)??null:null,[L,R]=(0,T.useState)(I?.targetConnectionId??A),z=j.find(e=>e.id===L)?.serverConnectionId,[B,V]=(0,T.useState)([]),[H,U]=(0,T.useState)([]),[W,G]=(0,T.useState)([]),[K,q]=(0,T.useState)(I?.targetDatabase??O?.database??``),[J,Y]=(0,T.useState)(I?.targetTable??``),[X,Z]=(0,T.useState)(I?.targetColumn??``),[Q,$]=(0,T.useState)(null);if((0,T.useEffect)(()=>{if(!k||!z)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listDatabases(m(z));if(e)return;V(t),q(e=>t.includes(e)?e:t[0]??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L]),(0,T.useEffect)(()=>{if(!k||!z||!K)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listTables(m(z),K);if(e)return;U(t.map(e=>e.name))}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K]),(0,T.useEffect)(()=>{if(!k||!z||!K||!J)return;let e=!1;return(async()=>{try{let t=await h(L).introspect.listColumns(m(z),K,J);if(e)return;G(t.map(e=>e.name)),Z(e=>t.some(t=>t.name===e)?e:t.find(e=>e.key===`PRI`)?.name??t[0]?.name??``)}catch(t){e||$(D(t))}})(),()=>{e=!0}},[k,z,L,K,J]),!O)return null;function te(){if(!O||!K||!J||!X)return;let e=L!==A;P(A,{database:O.database,table:O.table,column:O.column,...e?{targetConnectionId:L}:{},targetDatabase:K,targetTable:J,targetColumn:X}),ee(`column_link`),t(`column_link_set`,{dbms:h(A).id,target_dbms:h(L).id,cross_database:K!==O.database,cross_connection:e}),a()}function ne(){O&&(F(A,O),a())}return(0,E.jsx)(w,{open:k,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(S,{className:`sm:max-w-[460px]`,children:[(0,E.jsx)(b,{children:(0,E.jsx)(C,{children:e(`result.link.title`)})}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{children:e(`result.link.source`)}),(0,E.jsx)(y,{value:`${O.database}.${O.table}.${O.column}`,disabled:!0})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`result.link.hint`)}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-conn`,children:e(`result.link.targetConnection`)}),(0,E.jsxs)(f,{value:L,onValueChange:e=>{R(e),Y(``),U([]),G([])},children:[(0,E.jsx)(l,{id:`link-conn`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:M.map(e=>(0,E.jsx)(d,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-db`,children:e(`result.link.targetDatabase`)}),(0,E.jsxs)(f,{value:K,onValueChange:e=>{q(e),Y(``),G([])},children:[(0,E.jsx)(l,{id:`link-db`,className:`w-full`,children:(0,E.jsx)(c,{})}),(0,E.jsx)(u,{children:B.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-table`,children:e(`result.link.targetTable`)}),(0,E.jsxs)(f,{value:J,onValueChange:Y,disabled:H.length===0,children:[(0,E.jsx)(l,{id:`link-table`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickTable`)})}),(0,E.jsx)(u,{children:H.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),(0,E.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,E.jsx)(v,{htmlFor:`link-column`,children:e(`result.link.targetColumn`)}),(0,E.jsxs)(f,{value:X,onValueChange:Z,disabled:W.length===0,children:[(0,E.jsx)(l,{id:`link-column`,className:`w-full`,children:(0,E.jsx)(c,{placeholder:e(`result.link.pickColumn`)})}),(0,E.jsx)(u,{children:W.map(e=>(0,E.jsx)(d,{value:e,children:e},e))})]})]}),Q&&(0,E.jsx)(`p`,{className:`text-xs text-destructive`,children:Q})]}),(0,E.jsxs)(x,{children:[I&&(0,E.jsx)(s,{variant:`destructive`,onClick:ne,className:`mr-auto`,children:e(`result.link.remove`)}),(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`result.link.cancel`)}),(0,E.jsx)(s,{onClick:te,disabled:!K||!J||!X,children:e(`result.link.save`)})]})]})})}export{O as LinkColumnDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c,i as l,n as u,r as d,t as f}from"./DsllOXPq.js";import{t as p}from"./B3nhMsGp.js";import{a as m}from"./CtXRSNHU.js";import{n as h}from"./Cr6Fx4T5.js";import{t as g}from"./4_c4BD6i.js";import{H as _,_ as v,c as y,g as b,h as x,ot as S}from"./Bxw3grU1.js";import{a as ee,i as te,n as ne,o as C,t as re}from"./DxuXBECK.js";var w=e(n(),1),T=a(),ie=e=>e instanceof Error?e.message:String(e),E=e=>e.hostName||e.host||e.file||e.id,D=5e4;function O({id:e,label:t,side:n,onChange:r,connections:i,disabled:a}){let{t:s}=o(),[p,g]=(0,w.useState)([]),[_,v]=(0,w.useState)([]),b=i.find(e=>e.id===n.connectionId);return(0,w.useEffect)(()=>{if(!b?.serverConnectionId)return;let e=!1;return(async()=>{try{let t=await h(b.id).introspect.listDatabases(m(b.serverConnectionId));if(e)return;g(t),t.includes(n.database)||r({connectionId:b.id,database:t[0]??``,table:``})}catch{e||g([])}})(),()=>{e=!0}},[b?.id,b?.serverConnectionId]),(0,w.useEffect)(()=>{if(!b?.serverConnectionId||!n.database)return;let e=!1;return(async()=>{try{let t=await h(b.id).introspect.listTables(m(b.serverConnectionId),n.database);if(e)return;let i=t.map(e=>e.name);v(i),n.table&&!i.includes(n.table)&&r({...n,table:``})}catch{e||v([])}})(),()=>{e=!0}},[b?.id,b?.serverConnectionId,n.database]),(0,T.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[(0,T.jsx)(y,{className:`font-medium`,children:t}),(0,T.jsxs)(f,{value:n.connectionId,onValueChange:e=>r({connectionId:e,database:``,table:``}),disabled:a,children:[(0,T.jsx)(l,{id:`${e}-conn`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.diff.pickConnection`)})}),(0,T.jsx)(u,{children:i.map(e=>(0,T.jsx)(d,{value:e.id,children:E(e)},e.id))})]}),(0,T.jsxs)(f,{value:n.database,onValueChange:e=>r({...n,database:e,table:``}),disabled:a||p.length===0,children:[(0,T.jsx)(l,{id:`${e}-db`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.diff.pickDatabase`)})}),(0,T.jsx)(u,{children:p.map(e=>(0,T.jsx)(d,{value:e,children:e},e))})]}),(0,T.jsxs)(f,{value:n.table,onValueChange:e=>r({...n,table:e}),disabled:a||_.length===0,children:[(0,T.jsx)(l,{id:`${e}-table`,className:`w-full`,children:(0,T.jsx)(c,{placeholder:s(`database.dataDiff.pickTable`)})}),(0,T.jsx)(u,{children:_.map(e=>(0,T.jsx)(d,{value:e,children:e},e))})]})]})}async function k(e,t){let n=await _({connectionId:e.connectionId,database:e.database,table:e.table,limit:D,onProgress:t}),r=[];for await(let e of n.pages)r.push(...e);return{rows:r,columns:n.fields.map(e=>e.name),capped:r.length>=D}}function A({diff:e,row:t,other:n,changed:r}){let{t:i}=o(),a=[...e.keyColumns,...e.compareColumns];return(0,T.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,T.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.column`)}),(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:i(`database.diff.source`)}),(0,T.jsx)(`th`,{className:`text-left font-normal`,children:i(`database.diff.target`)})]})}),(0,T.jsx)(`tbody`,{children:a.map(e=>(0,T.jsxs)(`tr`,{className:r?.includes(e)?`text-amber-600 dark:text-amber-400`:``,children:[(0,T.jsx)(`td`,{className:`pr-2 align-top whitespace-nowrap`,children:e}),(0,T.jsx)(`td`,{className:`pr-2 align-top break-all`,children:b(t[e])}),(0,T.jsx)(`td`,{className:`align-top break-all`,children:n?b(n[e]):`—`})]},e))})]})}function j(){let{t:e}=o(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),c=i(`data-diff`),l=p(e=>e.activeConnections),u=(0,w.useMemo)(()=>l.filter(e=>e.serverConnectionId),[l]),d=p(e=>e.activeConnectionId),f=n===`data-diff`,[_,y]=(0,w.useState)(()=>c&&u.some(e=>e.id===c.connectionId)?{connectionId:c.connectionId,database:c.database,table:c.table}:{connectionId:d&&u.some(e=>e.id===d)?d:u[0]?.id??``,database:``,table:``}),[E,j]=(0,w.useState)(()=>({connectionId:u.find(e=>e.id!==_.connectionId)?.id??_.connectionId,database:``,table:``})),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)(null),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(`changed`),[B,V]=(0,w.useState)(0),[H,ae]=(0,w.useState)(!1),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)({source:null,target:null}),[q,J]=(0,w.useState)(null),oe=e=>j(e.database&&!e.table&&_.table?{...e,table:_.table}:e),Y=_.connectionId===E.connectionId&&_.database===E.database&&_.table===E.table,se=!!_.table&&!!E.table&&!Y,X=E.connectionId?h(E.connectionId):null;async function ce(){W(!0),J(null),F(null);try{let n=p.getState().activeConnections.find(e=>e.id===_.connectionId);if(!n?.serverConnectionId)throw Error(e(`services.query.notConnected`));let r=await h(_.connectionId).introspect.getPrimaryKeys(m(n.serverConnectionId),_.database,_.table);if(r.length===0)throw Error(e(`database.dataDiff.noPrimaryKey`,{table:_.table}));K({source:{loaded:0,total:null},target:{loaded:0,total:null}});let[i,a]=await Promise.all([k(_,e=>K(t=>({...t,source:e}))),k(E,e=>K(t=>({...t,target:e})))]);if(r.some(e=>!a.columns.includes(e)))throw Error(e(`database.dataDiff.keyMissingInTarget`,{columns:r.join(`, `)}));let o=v(i.rows,a.rows,r,i.columns,a.columns);N(r),L(i.capped||a.capped),F(o),z(o.changed.length>0?`changed`:o.added.length>0?`added`:`removed`),V(0),g(`compare_data`),t(`data_diff`,{source_dbms:h(_.connectionId).id,target_dbms:X?.id??`unknown`,added:o.added.length,changed:o.changed.length,removed:o.removed.length})}catch(e){J(ie(e))}finally{W(!1),K({source:null,target:null})}}let Z=e=>e?e.total===null?e.loaded.toLocaleString():`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:``,Q=(0,w.useMemo)(()=>P&&X?x(P,X,{database:E.database,table:E.table},{includeDeletes:H}):``,[P,X,E.database,E.table,H]);function le(){Q&&(S(E.connectionId,Q,E.database,e(`database.dataDiff.tabTitle`,{table:E.table})),a())}let $=P?R===`added`?P.added:R===`removed`?P.removed:P.changed.map(e=>e.source):[],ue=!!P&&P.added.length+P.changed.length+P.removed.length>0,de=e=>M.map(t=>b(e[t])).join(`, `);return(0,T.jsx)(re,{open:f,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(ne,{className:`sm:max-w-[900px]`,children:[(0,T.jsx)(ee,{children:(0,T.jsx)(C,{children:e(`database.dataDiff.title`)})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(O,{id:`ddiff-source`,label:e(`database.diff.source`),side:_,onChange:y,connections:u,disabled:U}),(0,T.jsx)(O,{id:`ddiff-target`,label:e(`database.diff.target`),side:E,onChange:oe,connections:u,disabled:U})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.hint`,{cap:D.toLocaleString()})}),Y&&_.table&&(0,T.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`database.dataDiff.sameSide`)}),q&&(0,T.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:q}),U&&(G.source||G.target)&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.loading`,{source:Z(G.source),target:Z(G.target)})}),P&&(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.summary`,{key:M.join(`, `),added:P.added.length,changed:P.changed.length,removed:P.removed.length,identical:P.identical})}),I&&(0,T.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:e(`database.dataDiff.capped`,{cap:D.toLocaleString()})}),(P.sourceOnlyColumns.length>0||P.targetOnlyColumns.length>0)&&(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.ignoredColumns`,{columns:[...P.sourceOnlyColumns,...P.targetOnlyColumns].join(`, `)})})]}),(0,T.jsx)(`div`,{className:`flex gap-1 text-xs`,children:[`added`,`changed`,`removed`].map(t=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>{z(t),V(0)},className:`rounded border px-2 py-0.5 ${R===t?`bg-accent`:``}`,children:e(`database.dataDiff.${t}`,{count:t===`added`?P.added.length:t===`removed`?P.removed.length:P.changed.length})},t))}),(0,T.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3 h-[280px]`,children:[(0,T.jsxs)(`ul`,{className:`overflow-auto rounded-md border text-sm font-mono`,children:[$.slice(0,2e3).map((e,t)=>(0,T.jsx)(`li`,{className:`px-2 py-1 cursor-pointer ${B===t?`bg-accent`:``}`,onClick:()=>V(t),children:de(e)},t)),$.length===0&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.none`)}),$.length>2e3&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.more`,{count:$.length-2e3})})]}),(0,T.jsx)(`div`,{className:`overflow-auto rounded-md border p-2`,children:$[B]?R===`changed`?(0,T.jsx)(A,{diff:P,row:P.changed[B].source,other:P.changed[B].target,changed:P.changed[B].columns}):R===`removed`?(0,T.jsx)(A,{diff:P,row:{},other:$[B]}):(0,T.jsx)(A,{diff:P,row:$[B]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.diff.selectTable`)})})]}),(0,T.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>ae(e.target.checked)}),(0,T.jsx)(`span`,{className:H?`text-destructive`:``,children:e(`database.dataDiff.includeDeletes`)})]})]})]}),(0,T.jsxs)(te,{children:[(0,T.jsx)(s,{variant:`outline`,onClick:a,children:e(`database.diff.close`)}),(0,T.jsx)(s,{variant:`secondary`,onClick:()=>{ce()},disabled:!se||U,children:e(U?`database.diff.comparing`:`database.diff.compare`)}),(0,T.jsx)(s,{onClick:le,disabled:!ue,children:e(`database.diff.openScript`)})]})]})})}export{j as DataDiffDialog};
@@ -1 +1 @@
1
- import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Lt as r}from"./B1lNzsWx.js";var i={currency:`USD`,annualPerMonth:8,annualTotal:96,monthly:10},a=e=>`$${e}`,o=e(),s=`https://planche.dev/pricing/`;function c({highlight:e,innerRef:c}){let{t:l}=t(),u=e?[e,...n.filter(t=>t!==e)]:[...n];return(0,o.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-primary/50 bg-muted/20 p-4 shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.15)]`,children:[(0,o.jsx)(`p`,{className:`text-[0.7rem] font-semibold uppercase tracking-[0.09em] text-muted-foreground`,children:`Pro`}),(0,o.jsxs)(`div`,{className:`grid gap-1`,children:[(0,o.jsxs)(`p`,{className:`flex items-baseline gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-3xl font-semibold leading-none text-foreground`,children:a(i.annualPerMonth)}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`pro.perMonth`)})]}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`pro.priceNote`,{annual:a(i.annualTotal),monthly:a(i.monthly)})})]}),(0,o.jsx)(`ul`,{className:`grid gap-2 text-xs`,children:u.map(t=>(0,o.jsxs)(`li`,{className:`flex gap-2`,children:[(0,o.jsx)(r,{className:`mt-0.5 size-3 shrink-0 ${t===e?`text-primary`:`text-emerald-500/80`}`}),(0,o.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,o.jsx)(`span`,{className:t===e?`font-medium text-foreground`:`text-foreground/90`,children:l(`pro.features.${t}`)}),(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:l(`pro.featureDetails.${t}`)})]})]},t))}),(0,o.jsx)(`a`,{ref:c,href:s,target:`_blank`,rel:`noreferrer`,className:`rounded-md bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l(`pro.pricing`)})]})}export{c as t};
1
+ import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Rt as r}from"./Bxw3grU1.js";var i={currency:`USD`,annualPerMonth:8,annualTotal:96,monthly:10},a=e=>`$${e}`,o=e(),s=`https://planche.dev/pricing/`;function c({highlight:e,innerRef:c}){let{t:l}=t(),u=e?[e,...n.filter(t=>t!==e)]:[...n];return(0,o.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-primary/50 bg-muted/20 p-4 shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.15)]`,children:[(0,o.jsx)(`p`,{className:`text-[0.7rem] font-semibold uppercase tracking-[0.09em] text-muted-foreground`,children:`Pro`}),(0,o.jsxs)(`div`,{className:`grid gap-1`,children:[(0,o.jsxs)(`p`,{className:`flex items-baseline gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-3xl font-semibold leading-none text-foreground`,children:a(i.annualPerMonth)}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`pro.perMonth`)})]}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`pro.priceNote`,{annual:a(i.annualTotal),monthly:a(i.monthly)})})]}),(0,o.jsx)(`ul`,{className:`grid gap-2 text-xs`,children:u.map(t=>(0,o.jsxs)(`li`,{className:`flex gap-2`,children:[(0,o.jsx)(r,{className:`mt-0.5 size-3 shrink-0 ${t===e?`text-primary`:`text-emerald-500/80`}`}),(0,o.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,o.jsx)(`span`,{className:t===e?`font-medium text-foreground`:`text-foreground/90`,children:l(`pro.features.${t}`)}),(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:l(`pro.featureDetails.${t}`)})]})]},t))}),(0,o.jsx)(`a`,{ref:c,href:s,target:`_blank`,rel:`noreferrer`,className:`rounded-md bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l(`pro.pricing`)})]})}export{c as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{h as t}from"./XzPc-eVf.js";import{b as n,l as r,o as i,p as a,s as o,u as s}from"./CKOS5Y-e.js";import{r as c,t as l}from"./CytzrZ6l.js";import{S as u,_ as d,b as f,d as p,f as m,g as h,h as g,m as _,p as v,u as y,v as b,x,y as S}from"./CZQ1r4zz.js";import{n as C,t as w}from"./BVrYyQUV.js";import{t as T}from"./CmJ3siBN.js";import{Lt as E,Qt as D,Rt as O,Xt as k,Yt as A,Zt as j}from"./Bxw3grU1.js";var M=e(n(),1),N=e(t(),1),P=Object.defineProperty,ee=(e,t)=>P(e,`name`,{value:t,configurable:!0});function F(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ee(F,`usePrevious`);var I=r(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=l(V),[G,te]=u(V,[W,D]),K=D(),[ne,q]=G(V),[re,ie]=G(V);function J(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=K(t),[v,y]=N.useState(null),[b,x]=N.useState(null),[w,T]=N.useState(!1),E=C(l),[D,O]=S({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=S({prop:o,defaultProp:s,onChange:c,caller:V}),M=N.useRef(null),P=N.useRef(k);N.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=R(()=>A(P.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,A]);let ee=!v||!!h||!!v.closest(`form`),[F,L]=N.useState(new Set),z=d(),B=Array.from(F).map(e=>e.props.value).join(`;`),U=N.useCallback(e=>{L(t=>new Set(t).add(e))},[]),W=N.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:u,autoComplete:f,form:h,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(j,{..._,children:(0,I.jsx)(ne,{scope:t,...G,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:W,children:Ve(g)?g(G):n})})})})}R(J,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(J,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Be,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=N.forwardRef(R(function(e,t){let{__scopeSelect:n,disabled:r=!1,...i}=e,s=K(n),c=q(oe,n),l=c.disabled||r,u=a(t,c.onTriggerChange),d=U(n),f=N.useRef(`touch`),[p,m,h]=He(e=>{let t=d().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=R(e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(A,{asChild:!0,...s,children:(0,I.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...i,ref:u,onClick:x(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:x(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:x(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,children:s,placeholder:c=``,...l}=e,u=q(ce,n),{onValueNodeHasChildrenChange:d}=u,p=s!==void 0,m=a(t,u.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(u.value);return(0,I.jsx)(o.span,{...l,asChild:!h&&l.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(N.Fragment,{children:h?c:s},h?`placeholder`:`value`)})},`SelectValue`)),ue=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,...i}=e;return(0,I.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(v,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,me=N.forwardRef(R(function(e,t){let n=fe(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeSelect),[o,s]=N.useState();return f(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(b,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:o})})},`SelectContent`)),he=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[ge,Z]=G(Y),_e=s(`SelectContent.RemoveScroll`),ve=N.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:v,sticky:b,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=q(Y,n),[E,D]=N.useState(null),[O,k]=N.useState(null),A=a(t,D),[j,M]=N.useState(null),[P,ee]=N.useState(null),F=U(n),[L,z]=N.useState(!1),B=N.useRef(!1);N.useEffect(()=>{if(E)return y(E)},[E]),m();let V=N.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,O]),H=N.useCallback(()=>V([j,E]),[V,j,E]);N.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:W,triggerPointerDownPosRef:G}=T;N.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(G.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||W(!1),document.removeEventListener(`pointermove`,t),G.current=null},`handlePointerUp`);return G.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,W,G]),N.useEffect(()=>{let e=R(()=>W(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[W]);let[te,K]=He(e=>{let t=F().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&(M(e),r&&(B.current=!0))},[T.value]),re=N.useCallback(()=>E?.focus(),[E]),ie=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&ee(e)},[T.value]),J=r===`popper`?be:ye,ae=J===be?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:v,sticky:b,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ne,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:L,searchRef:te,children:(0,I.jsx)(p,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:x(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(J,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>z(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:x(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&K(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onPlaced:r,...i}=e,s=q(Y,n),c=Z(Y,n),[l,u]=N.useState(null),[d,p]=N.useState(null),m=a(t,p),h=U(n),g=N.useRef(!1),_=N.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=c,S=N.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(s.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=w(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=w(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.right=d+`px`}let a=h(),o=window.innerHeight-X*2,c=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+c+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),T=parseInt(C.paddingTop,10),E=parseInt(C.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=f+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);l.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,f+v.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}l.style.margin=`${X}px 0`,l.style.minHeight=S+`px`,l.style.maxHeight=o+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,d,v,y,b,s.dir,r]);f(()=>S(),[S]);let[C,T]=N.useState();f(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);let E=N.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:E,children:(0,I.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(o.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})},`SelectItemAlignedPosition`)),be=N.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=K(n);return(0,I.jsx)(k,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(Y,{}),Ce=`SelectViewport`,we=N.forwardRef(R(function(e,t){let{__scopeSelect:n,nonce:r,...i}=e,s=Z(Ce,n),c=Se(Ce,n),l=a(t,s.onViewportChange),u=N.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:x(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=N.forwardRef(R(function(e,t){let{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...c}=e,l=q(De,n),u=Z(De,n),f=l.value===r,[p,m]=N.useState(s??``),[g,_]=N.useState(!1),v=h(e=>u.itemRefCallback?.(e,r,i)),y=a(t,v),b=d(),S=N.useRef(`touch`),C=R(()=>{i||(l.onValueChange(r),l.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:b,isSelected:f,onItemTextChange:N.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:(0,I.jsx)(o.div,{role:`option`,"aria-labelledby":b,"data-highlighted":g?``:void 0,"aria-selected":f&&g,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...c,ref:y,onFocus:x(c.onFocus,()=>_(!0)),onBlur:x(c.onBlur,()=>_(!1)),onClick:x(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:x(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:x(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:x(c.onPointerMove,e=>{S.current=e.pointerType,i?u.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:x(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:x(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(u.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Q=`SelectItemText`,je=N.forwardRef(R(function(e,t){let{__scopeSelect:n,className:r,style:i,...s}=e,c=q(Q,n),l=Z(Q,n),u=ke(Q,n),d=ie(Q,n),[p,m]=N.useState(null),g=h(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),_=a(t,m,u.onItemTextChange,g),v=p?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:u.value,disabled:u.disabled,children:v},u.value),[u.disabled,u.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.span,{id:u.textId,...s,ref:_}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?M.createPortal(s.children,c.valueNode):null]})},`SelectItemText`)),Me=`SelectItemIndicator`,Ne=N.forwardRef(R(function(e,t){let{__scopeSelect:n,...r}=e;return ke(Me,n).isSelected?(0,I.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null},`SelectItemIndicator`)),Pe=`SelectScrollUpButton`,Fe=N.forwardRef(R(function(e,t){let n=Z(Pe,e.__scopeSelect),r=Se(Pe,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Ie=`SelectScrollDownButton`,Le=N.forwardRef(R(function(e,t){let n=Z(Ie,e.__scopeSelect),r=Se(Ie,e.__scopeSelect),[i,o]=N.useState(!1),s=a(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Re=N.forwardRef(R(function(e,t){let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),s=N.useRef(null),c=U(n),l=N.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),f(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,I.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:x(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:x(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:x(i.onPointerLeave,()=>{l()})})},`SelectScrollButtonImpl`)),ze=`SelectBubbleInput`,Be=N.forwardRef(R(function({__scopeSelect:e,...t},n){let r=q(ze,e),{value:i,onValueChange:s,required:l,disabled:u,name:d,autoComplete:f,form:p}=r,{nativeOptions:m,nativeSelectKey:h}=r,g=N.useRef(null),_=a(n,g),v=i??``,y=F(v),b=Array.from(m).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=g.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(y!==v&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,v),e.dispatchEvent(t)}},[y,v]),(0,I.jsxs)(o.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:d,autoComplete:f,disabled:u,form:p,onChange:e=>s(e.target.value),...t,style:{...c,...t.style},ref:_,defaultValue:v,children:[$(i)&&!b?(0,I.jsx)(`option`,{value:``}):null,Array.from(m)]},h)},`SelectBubbleInput`));function Ve(e){return typeof e==`function`}R(Ve,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function He(e){let t=h(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),R((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(He,`useTypeaheadSearch`);function Ue(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=We(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(Ue,`findNextItem`);function We(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(We,`wrapArray`);function Ge({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ke({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function qe({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(E,{className:`size-4 opacity-50`})})]})}function Je({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover 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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,I.jsx)(Xe,{}),(0,I.jsx)(we,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(Ze,{})]})})}function Ye({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(Ne,{children:(0,I.jsx)(O,{className:`size-4`})})}),(0,I.jsx)(je,{children:t})]})}function Xe({className:e,...t}){return(0,I.jsx)(Fe,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(T,{className:`size-4`})})}function Ze({className:e,...t}){return(0,I.jsx)(Le,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(E,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,n as r}from"./XzPc-eVf.js";import{a as i,f as a,l as o,m as s,o as c,s as l}from"./CKOS5Y-e.js";import{r as u,t as d}from"./fDSXGLmI.js";import{_ as f,a as p,o as m,r as h,t as g}from"./CZQ1r4zz.js";import{t as _}from"./B3nhMsGp.js";import{n as v,r as y}from"./BBSxV90W.js";import{n as b,t as ee}from"./BNkgLUl5.js";import{n as x,t as S}from"./CtXRSNHU.js";import{c as C,i as w}from"./5Jrsnc1i.js";import{$ as T,At as te,Ct as E,Et as D,Ht as O,I as ne,J as k,Mt as A,Nt as j,Ot as M,Q as N,Rt as P,St as F,Tt as I,V as re,Z as ie,_t as ae,dt as oe,et as se,ft as ce,gt as le,pt as ue,q as de,st as fe,ut as pe,vt as me,wt as he,xt as ge,yt as _e,z as ve}from"./Bxw3grU1.js";import{a as ye,n as L,o as be,r as xe,t as Se}from"./DxuXBECK.js";var Ce=i(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),we=i(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Te=i(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ee=i(`database-zap`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 15 21.84`,key:`14ibmq`}],[`path`,{d:`M21 5V8`,key:`1marbg`}],[`path`,{d:`M21 12L18 17H22L19 22`,key:`zafso`}],[`path`,{d:`M3 12A9 3 0 0 0 14.59 14.87`,key:`1y4wr8`}]]),De=i(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Oe=i(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),ke=i(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),Ae=i(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),je=i(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Me=i(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Ne=i(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Pe=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Fe=i(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Ie=i(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Le=i(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Re=i(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ze=i(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Be=i(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ve=i(`waypoints`,[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]),R=e(n(),1),He=1,Ue=.9,We=.8,Ge=.17,z=.1,B=.999,Ke=.9999,V=.99,H=/[\\\/_+.#"@\[\(\{&]/,qe=/[\\\/_+.#"@\[\(\{&]/g,Je=/[\s-]/,Ye=/[\s-]/g;function U(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?He:V;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=U(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=He:H.test(e.charAt(l-1))?(d*=We,p=e.slice(i,l-1).match(qe),p&&i>0&&(d*=B**+p.length)):Je.test(e.charAt(l-1))?(d*=Ue,m=e.slice(i,l-1).match(Ye),m&&i>0&&(d*=B**+m.length)):(d*=Ge,i>0&&(d*=B**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ke)),(d<z&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=U(e,t,n,r,l+1,a+2,o),f*z>d&&(d=f*z)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Xe(e){return e.toLowerCase().replace(Ye,` `)}function Ze(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,U(e,t,Xe(e),Xe(t),0,0,{})}var W=`[cmdk-group=""]`,Qe=`[cmdk-group-items=""]`,$e=`[cmdk-group-heading=""]`,et=`[cmdk-item=""]`,tt=`${et}:not([aria-disabled="true"])`,nt=`cmdk-item-select`,G=`data-value`,rt=(e,t,n)=>Ze(e,t,n),it=R.createContext(void 0),K=()=>R.useContext(it),at=R.createContext(void 0),q=()=>R.useContext(at),ot=R.createContext(void 0),st=R.forwardRef((e,t)=>{let n=X(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=X(()=>new Set),i=X(()=>new Map),a=X(()=>new Map),o=X(()=>new Set),s=vt(e),{label:c,children:u,value:d,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=f(),ee=f(),x=f(),S=R.useRef(null),C=bt();Y(()=>{if(d!==void 0){let e=d.trim();n.current.value=e,w.emit()}},[d]),Y(()=>{C(6,ne)},[]);let w=R.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),C(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=k()?.id,w.emit()}),r||C(5,ne),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=R.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,te(t,r)),C(2,()=>{E(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{O(),E(),n.current.value||D(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();C(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:b,inputId:x,labelId:ee,listInnerRef:S}),[]);function te(e,t){let r=s.current?.filter??rt;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;A().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Qe);t?t.appendChild(e.parentElement===t?e:e.closest(`${Qe} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Qe} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${W}[${G}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=A().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(G);w.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=te(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ne(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(W)?.querySelector($e))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return S.current?.querySelector(`${et}[aria-selected="true"]`)}function A(){return Array.from(S.current?.querySelectorAll(tt)||[])}function j(e){let t=A()[e];t&&w.setState(`value`,t.getAttribute(G))}function M(e){var t;let n=k(),r=A(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(G))}function N(e){let t=k()?.closest(W),n;for(;t&&!n;)t=e>0?gt(t,W):_t(t,W),n=t?.querySelector(tt);n?w.setState(`value`,n.getAttribute(G)):M(e)}let P=()=>j(A().length-1),F=e=>{e.preventDefault(),e.metaKey?P():e.altKey?N(1):M(1)},I=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?N(-1):M(-1)};return R.createElement(l.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:v&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},R.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:St},c),Q(e,e=>R.createElement(at.Provider,{value:w},R.createElement(it.Provider,{value:T},e))))}),ct=R.forwardRef((e,t)=>{let n=f(),r=R.useRef(null),i=R.useContext(ot),o=K(),s=vt(e),c=s.current?.forceMount??i?.forceMount;Y(()=>{if(!c)return o.item(n,i?.id)},[c]);let u=yt(n,r,[e.value,e.children,r],e.keywords),d=q(),p=Z(e=>e.value&&e.value===u.current),m=Z(e=>c||o.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);R.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(nt,h),()=>t.removeEventListener(nt,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=s.current).onSelect)==null||t.call(e,u.current)}function g(){d.setState(`value`,u.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:ee,...x}=e;return R.createElement(l.div,{ref:a(r,t),...x,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||o.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),lt=R.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=f(),c=R.useRef(null),u=R.useRef(null),d=f(),p=K(),m=Z(e=>i||p.filter()===!1?!0:!e.search||e.filtered.groups.has(s));Y(()=>p.group(s),[]),yt(s,c,[e.value,e.heading,u]);let h=R.useMemo(()=>({id:s,forceMount:i}),[i]);return R.createElement(l.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&R.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:d},n),Q(e,e=>R.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?d:void 0},R.createElement(ot.Provider,{value:h},e))))}),ut=R.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=R.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:R.createElement(l.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),dt=R.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=q(),o=Z(e=>e.search),s=Z(e=>e.selectedItemId),c=K();return R.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),R.createElement(l.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),ft=R.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=R.useRef(null),s=R.useRef(null),c=Z(e=>e.selectedItemId),u=K();return R.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),R.createElement(l.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":c,"aria-label":r,id:u.listId},Q(e,e=>R.createElement(`div`,{ref:a(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),pt=R.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return R.createElement(g,{open:n,onOpenChange:r},R.createElement(m,{container:o},R.createElement(p,{"cmdk-overlay":``,className:i}),R.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},R.createElement(st,{ref:t,...s}))))}),mt=R.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?R.createElement(l.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ht=R.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return R.createElement(l.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Q(e,e=>R.createElement(`div`,{"aria-hidden":!0},e)))}),J=Object.assign(st,{List:ft,Item:ct,Input:dt,Group:lt,Separator:ut,Dialog:pt,Empty:mt,Loading:ht});function gt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function _t(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function vt(e){let t=R.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?R.useEffect:R.useLayoutEffect;function X(e){let t=R.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return R.useSyncExternalStore(t.subscribe,n,n)}function yt(e,t,n,r=[]){let i=R.useRef(),a=K();return Y(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(G,s),i.current=s}),i}var bt=()=>{let[e,t]=R.useState(),n=X(()=>new Map);return Y(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function xt(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Q({asChild:e,children:t},n){return e&&R.isValidElement(t)?R.cloneElement(xt(t),{ref:t.ref},n(t.props.children)):n(t)}var St={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},$=o();function Ct({className:e,...t}){return(0,$.jsx)(J,{"data-slot":`command`,className:c(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function wt({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,$.jsxs)(Se,{...a,children:[(0,$.jsxs)(ye,{className:`sr-only`,children:[(0,$.jsx)(be,{children:e}),(0,$.jsx)(xe,{children:t})]}),(0,$.jsx)(L,{className:c(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,$.jsx)(Ct,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function Tt({className:e,...t}){return(0,$.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,$.jsx)(ge,{className:`size-4 shrink-0 opacity-50`}),(0,$.jsx)(J.Input,{"data-slot":`command-input`,className:c(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function Et({className:e,...t}){return(0,$.jsx)(J.List,{"data-slot":`command-list`,className:c(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function Dt({...e}){return(0,$.jsx)(J.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function Ot({className:e,...t}){return(0,$.jsx)(J.Group,{"data-slot":`command-group`,className:c(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t})}function kt({className:e,...t}){return(0,$.jsx)(J.Item,{"data-slot":`command-item`,className:c(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}function At({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`command-shortcut`,className:c(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var jt={sky:`text-catppuccin-sky`,blue:`text-catppuccin-blue`,green:`text-catppuccin-green`,teal:`text-catppuccin-teal`,mauve:`text-catppuccin-mauve`,lavender:`text-catppuccin-lavender`,peach:`text-catppuccin-peach`,yellow:`text-catppuccin-yellow`,red:`text-catppuccin-red`};function Mt({theme:e}){let{background:t,blue:n,mauve:r,green:i}=e.colors;return(0,$.jsx)(`span`,{className:`flex size-5 shrink-0 overflow-hidden rounded-sm border border-catppuccin-surface2`,children:[t,n,r,i].map((e,t)=>(0,$.jsx)(`span`,{className:`flex-1`,style:{backgroundColor:e}},t))})}function Nt(){let{t:e}=s(),{activeDialog:n,closeDialog:i,openDialog:a}=r(),o=r(e=>e.setWelcomeVisible),l=r(e=>e.setFooterMessage),{executeCurrentQuery:f,executeCurrentStatement:p,executeWholeScript:m,addNewQueryTab:h,disconnectActive:g}=se(),{capabilities:ge}=fe(),ye=y(),L=_(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),be=_(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),xe=_(e=>e.updateProfile),Se=ie(e=>e.themeId),He=ie(e=>e.setTheme),Ue=v(e=>e.locale),We=v(e=>e.setLocale),Ge=n===`quick-command`,z=L!==void 0,B=b(e=>{let t=_.getState().activeConnectionId;if(!t)return!1;let n=e.activeTabId[t];return(e.tabs[t]??ee).find(e=>e.id===n)?.isExecuting??!1});async function Ke(){let e=_.getState().activeConnectionId;if(!e)return;let t=x(await S(e));t&&r.getState().setFooterMessage(t)}let V=(0,R.useCallback)(e=>{i(),e()},[i]),H=(0,R.useCallback)(e=>l(e instanceof Error?e.message:String(e)),[l]),qe=()=>{let e=_.getState().activeConnectionId;e&&(T.getState().openERD(e),t(`erd_open`),b.getState().setActiveQueryTab(e,`erd`))},Je=[{heading:e(`palette.groups.connection`),commands:[{id:`connect`,label:e(`palette.commands.connect`),icon:Pe,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!ye,action:()=>V(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:ce,tone:`red`,keywords:[`disconnect`,`close`],disabled:!z,action:()=>V(()=>{g()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:D,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!z,checked:L?.readOnly===!0,action:()=>V(()=>{L&&xe(L.id,{readOnly:!L.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:M,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!z,checked:L?.transactionMode===`manual`,action:()=>V(()=>{L&&xe(L.id,{transactionMode:L.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:P,tone:`green`,keywords:[`commit`,`transaction`],disabled:!be||!L,action:()=>V(()=>{L&&w(L.id).catch(H)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:ue,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!be||!L,action:()=>V(()=>{L&&C(L.id).catch(H)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:he,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!z,action:()=>V(()=>{f()})},{id:`stop-query`,label:e(`result.running.stop`),icon:me,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!B,action:()=>V(()=>{Ke()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:Te,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!z,action:()=>V(()=>{p()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Re,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!z,action:()=>V(()=>{m()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:E,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!z,action:()=>V(()=>h())},{id:`find-replace`,label:e(`menu.query.findReplace`),icon:Fe,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!z,action:()=>V(()=>a(`find-replace`))},{id:`local-history`,label:e(`menu.query.localHistory`),icon:je,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!z,action:()=>V(()=>a(`local-history`))}]},{heading:e(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:e(`palette.commands.createDatabase`),icon:A,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!z,action:()=>V(()=>a(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:e(`menu.database.alter`),icon:Ee,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!z,action:()=>V(()=>a(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:e(`menu.database.copy`),icon:j,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!z,action:()=>V(()=>a(`copy-database`))},{id:`schema-diff`,label:e(`menu.database.compare`),icon:ke,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:`compare_schemas`,disabled:!z,action:()=>V(()=>a(`schema-diff`))},{id:`data-diff`,label:e(`menu.database.compareData`),icon:Ae,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:`compare_data`,disabled:!z,action:()=>V(()=>a(`data-diff`))},{id:`group-by`,label:e(`menu.database.groupBy`),icon:_e,tone:`mauve`,keywords:[`group`,`count`,`aggregate`,`distinct`,`summary`],disabled:!z,action:()=>V(()=>a(`group-by`))}]},{heading:e(`palette.groups.table`),commands:[{id:`create-table`,label:e(`palette.commands.createTable`),icon:ae,tone:`green`,keywords:[`create`,`table`],disabled:!z,action:()=>V(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:pe,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!z,action:()=>V(()=>a(`alter-table`))},{id:`duplicate-table`,label:e(`menu.table.duplicateStructure`),icon:we,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!z,action:()=>V(()=>a(`duplicate-table-structure`))}]},{heading:e(`menu.export.title`),commands:[{id:`export-csv`,label:e(`menu.export.csv`),icon:Oe,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!z,action:()=>V(()=>a(`export-csv`))},{id:`export-html`,label:e(`menu.export.schemaHtml`),icon:De,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!z,action:()=>V(()=>a(`export-html`))}]},{heading:e(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:e(`palette.commands.processList`),icon:O,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!z,action:()=>V(()=>a(`process-list`))},{id:`variables`,capability:`variables`,label:e(`palette.commands.serverVariables`),icon:ze,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!z,action:()=>V(()=>a(`variables`))},{id:`status`,capability:`status`,label:e(`palette.commands.serverStatus`),icon:le,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!z,action:()=>V(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:F,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!z,action:()=>V(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:oe,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!z,action:()=>V(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:I,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>V(()=>{k().catch(H)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ve,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>V(()=>{re().catch(H)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Ne,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!z,action:()=>V(qe)}]},{heading:e(`menu.settings.theme`),commands:N().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:Se===e.id,swatch:e,action:()=>V(()=>He(e.id))}))},{heading:e(`menu.settings.language`),commands:[`auto`,...d].map(t=>({id:`locale-${t}`,label:t===`auto`?e(`language.auto`,{name:e(`language.${u()}`)}):e(`language.${t}`),icon:Me,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:Ue===t,action:()=>V(()=>We(t))}))},{heading:e(`menu.settings.title`),commands:[{id:`safety-settings`,label:e(`menu.settings.safety`),icon:Be,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>V(()=>a(`safety-settings`))}]},{heading:e(`menu.help.title`),commands:[{id:`documentation`,label:e(`menu.help.documentation`),icon:Ce,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>V(()=>{window.open(de(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Ie,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>V(()=>o(!0))},{id:`terms`,label:e(`menu.help.terms`),icon:Le,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>V(()=>a(`terms`))},{id:`about`,label:e(`menu.help.about`),icon:te,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>V(()=>a(`about`))}]}];function Ye(e){e||i()}let U=Je.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||ge[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(wt,{open:Ge,onOpenChange:Ye,title:e(`palette.title`),description:e(`palette.description`),children:[(0,$.jsx)(Tt,{placeholder:e(`palette.inputPlaceholder`)}),(0,$.jsxs)(Et,{className:`max-h-[60vh]`,children:[(0,$.jsx)(Dt,{children:e(`palette.empty`)}),U.map(e=>(0,$.jsx)(Ot,{heading:e.heading,children:e.commands.map(t=>(0,$.jsxs)(kt,{value:`${e.heading} ${t.label}`,keywords:t.keywords,disabled:t.disabled,onSelect:()=>{(!t.pro||ne(t.pro))&&t.action()},children:[t.swatch?(0,$.jsx)(Mt,{theme:t.swatch}):t.icon?(0,$.jsx)(t.icon,{className:c(`size-4`,jt[t.tone])}):null,(0,$.jsx)(`span`,{className:`truncate`,children:t.label}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[t.pro&&(0,$.jsx)(ve,{className:`ml-0`}),t.checked&&(0,$.jsx)(P,{className:`size-3.5 text-catppuccin-green`}),t.shortcut&&(0,$.jsx)(At,{className:`ml-0`,children:t.shortcut})]})]},t.id))},e.heading))]})]})}export{Nt as QuickCommandPalette};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./BGIwW6nZ.js";import{i as d,n as f}from"./BBSxV90W.js";import{b as p,c as m,d as h}from"./BdPEUnLq.js";import{c as g,l as _,w as v}from"./B1lNzsWx.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./DxuXBECK.js";var T=e(t(),1),E=r(),D={autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0};function O(){let{t:e}=i(),[t,n]=(0,T.useState)(null),[r,y]=(0,T.useState)(!1),[b,x]=(0,T.useState)(`anthropic`),[S,C]=(0,T.useState)(``),[w,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(``),[j,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)([]),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(!1),[z,B]=(0,T.useState)(null),V=f(e=>e.setAiPreferences),H=(0,T.useCallback)(()=>{h().then(e=>{n(e);let t=f.getState().aiPreferences,r=e.storage!==`none`;x(r?e.provider:t.provider),C(r?e.model:t.model),O((r?e.baseUrl:t.baseUrl)??``),M(r?e.storage===`file`:t.remember),P(e.clis??[]),I(e.anthropicProfile===!0)}).catch(()=>y(!0))},[]);(0,T.useEffect)(H,[H]);let U=(0,T.useCallback)(e=>{x(e),C(t=>d(t,e))},[]),W=(0,T.useCallback)(()=>{R(!0),B(null),p({provider:b,model:S.trim()||void 0,baseUrl:w.trim()||void 0,key:k,remember:j}).then(t=>{n(t),A(``),V({provider:b,model:S.trim()||t.model,baseUrl:w.trim(),remember:j}),B(e(`settings.ai.saved`)),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[b,S,w,k,j,V,e]),G=(0,T.useCallback)(()=>{R(!0),B(null),m().then(e=>{n(e),A(``),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[]);if(r)return(0,E.jsx)(`p`,{className:`rounded-md border p-3 text-xs text-muted-foreground`,children:e(`settings.ai.unreachable`)});if(!t)return null;let K=t.fromEnvironment,q=b===`cli`||b===`anthropic-profile`;return(0,E.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.intro`)}),(0,E.jsx)(`p`,{className:`text-xs`,children:t.storage===`environment`?e(`settings.ai.configuredEnv`):t.storage===`file`?e(t.provider===`cli`||t.provider===`anthropic-profile`?`settings.ai.configuredChoice`:`settings.ai.configuredFile`,{path:t.path,provider:t.provider===`cli`?t.model:e(`settings.ai.profile`)}):t.storage===`session`?e(`settings.ai.configuredSession`):e(`settings.ai.none`)}),!K&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-provider`,className:`text-sm font-medium`,children:e(`settings.ai.provider`)}),(0,E.jsxs)(u,{value:b,onValueChange:e=>U(e),children:[(0,E.jsx)(s,{id:`ai-provider`,children:(0,E.jsx)(o,{})}),(0,E.jsxs)(c,{children:[(0,E.jsx)(l,{value:`anthropic`,children:`Anthropic`}),(0,E.jsx)(l,{value:`anthropic-profile`,children:e(`settings.ai.profile`)}),(0,E.jsx)(l,{value:`openai`,children:e(`settings.ai.openaiCompatible`)}),(0,E.jsx)(l,{value:`gemini`,children:`Google Gemini`}),(0,E.jsx)(l,{value:`cli`,children:e(`settings.ai.cli`)})]})]})]}),b===`cli`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.cliHint`)}),N.length===0?(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.cliNone`)}):(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-cli`,className:`text-sm font-medium`,children:e(`settings.ai.cliCommand`)}),(0,E.jsxs)(u,{value:N.includes(S)?S:N[0],onValueChange:C,children:[(0,E.jsx)(s,{id:`ai-cli`,children:(0,E.jsx)(o,{})}),(0,E.jsx)(c,{children:N.map(e=>(0,E.jsx)(l,{value:e,children:e},e))})]})]})]}):(0,E.jsxs)(`div`,{className:`grid gap-3`,children:[b===`anthropic-profile`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.profileHint`)}),!F&&(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.profileNone`)})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-model`,className:`text-sm font-medium`,children:e(`settings.ai.model`)}),(0,E.jsx)(_,{id:`ai-model`,value:S,onChange:e=>C(e.target.value),spellCheck:!1,...D})]})]}),b===`openai`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,E.jsx)(g,{htmlFor:`ai-base-url`,className:`text-sm font-medium`,children:e(`settings.ai.baseUrl`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.baseUrlHint`)})]}),(0,E.jsx)(_,{id:`ai-base-url`,value:w,onChange:e=>O(e.target.value),placeholder:`https://api.openai.com/v1`,spellCheck:!1,...D})]}),q||(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(g,{htmlFor:`ai-key`,className:`text-sm font-medium`,children:e(`settings.ai.key`)}),(0,E.jsx)(_,{id:`ai-key`,type:`password`,value:k,onChange:e=>A(e.target.value),spellCheck:!1,placeholder:t.configured?`••••••••`:``,...D,autoComplete:`new-password`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.keyHint`)})]}),q||(0,E.jsxs)(`label`,{htmlFor:`ai-remember`,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,E.jsx)(`input`,{id:`ai-remember`,type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,E.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium`,children:e(`settings.ai.remember`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.rememberHint`,{path:t.path})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(a,{size:`sm`,onClick:W,disabled:L||(b===`cli`?N.length===0:!q&&!k.trim()),children:e(`settings.ai.save`)}),t.configured&&(0,E.jsx)(a,{size:`sm`,variant:`ghost`,onClick:G,disabled:L,children:e(`settings.ai.forget`)}),z&&(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:z})]})]})]})}function k(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{t:r}=i();return(0,E.jsx)(w,{open:e===`ai-settings`,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(x,{className:`sm:max-w-[560px]`,children:[(0,E.jsxs)(y,{children:[(0,E.jsx)(S,{children:r(`settings.ai.title`)}),(0,E.jsx)(C,{children:r(`settings.ai.description`)})]}),(0,E.jsx)(O,{}),(0,E.jsx)(b,{children:(0,E.jsx)(a,{onClick:t,children:r(`settings.done`)})})]})})}export{k as AiSettingsDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./DsllOXPq.js";import{i as d,n as f}from"./BBSxV90W.js";import{b as p,c as m,d as h}from"./Ca4g4XbM.js";import{c as g,l as _,w as v}from"./Bxw3grU1.js";import{a as y,i as b,n as x,o as S,r as C,t as w}from"./DxuXBECK.js";var T=e(t(),1),E=r(),D={autoComplete:`off`,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0};function O(){let{t:e}=i(),[t,n]=(0,T.useState)(null),[r,y]=(0,T.useState)(!1),[b,x]=(0,T.useState)(`anthropic`),[S,C]=(0,T.useState)(``),[w,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(``),[j,M]=(0,T.useState)(!1),[N,P]=(0,T.useState)([]),[F,I]=(0,T.useState)(!1),[L,R]=(0,T.useState)(!1),[z,B]=(0,T.useState)(null),V=f(e=>e.setAiPreferences),H=(0,T.useCallback)(()=>{h().then(e=>{n(e);let t=f.getState().aiPreferences,r=e.storage!==`none`;x(r?e.provider:t.provider),C(r?e.model:t.model),O((r?e.baseUrl:t.baseUrl)??``),M(r?e.storage===`file`:t.remember),P(e.clis??[]),I(e.anthropicProfile===!0)}).catch(()=>y(!0))},[]);(0,T.useEffect)(H,[H]);let U=(0,T.useCallback)(e=>{x(e),C(t=>d(t,e))},[]),W=(0,T.useCallback)(()=>{R(!0),B(null),p({provider:b,model:S.trim()||void 0,baseUrl:w.trim()||void 0,key:k,remember:j}).then(t=>{n(t),A(``),V({provider:b,model:S.trim()||t.model,baseUrl:w.trim(),remember:j}),B(e(`settings.ai.saved`)),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[b,S,w,k,j,V,e]),G=(0,T.useCallback)(()=>{R(!0),B(null),m().then(e=>{n(e),A(``),v()}).catch(e=>B(e instanceof Error?e.message:String(e))).finally(()=>R(!1))},[]);if(r)return(0,E.jsx)(`p`,{className:`rounded-md border p-3 text-xs text-muted-foreground`,children:e(`settings.ai.unreachable`)});if(!t)return null;let K=t.fromEnvironment,q=b===`cli`||b===`anthropic-profile`;return(0,E.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.intro`)}),(0,E.jsx)(`p`,{className:`text-xs`,children:t.storage===`environment`?e(`settings.ai.configuredEnv`):t.storage===`file`?e(t.provider===`cli`||t.provider===`anthropic-profile`?`settings.ai.configuredChoice`:`settings.ai.configuredFile`,{path:t.path,provider:t.provider===`cli`?t.model:e(`settings.ai.profile`)}):t.storage===`session`?e(`settings.ai.configuredSession`):e(`settings.ai.none`)}),!K&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-provider`,className:`text-sm font-medium`,children:e(`settings.ai.provider`)}),(0,E.jsxs)(u,{value:b,onValueChange:e=>U(e),children:[(0,E.jsx)(s,{id:`ai-provider`,children:(0,E.jsx)(o,{})}),(0,E.jsxs)(c,{children:[(0,E.jsx)(l,{value:`anthropic`,children:`Anthropic`}),(0,E.jsx)(l,{value:`anthropic-profile`,children:e(`settings.ai.profile`)}),(0,E.jsx)(l,{value:`openai`,children:e(`settings.ai.openaiCompatible`)}),(0,E.jsx)(l,{value:`gemini`,children:`Google Gemini`}),(0,E.jsx)(l,{value:`cli`,children:e(`settings.ai.cli`)})]})]})]}),b===`cli`?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.cliHint`)}),N.length===0?(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.cliNone`)}):(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-cli`,className:`text-sm font-medium`,children:e(`settings.ai.cliCommand`)}),(0,E.jsxs)(u,{value:N.includes(S)?S:N[0],onValueChange:C,children:[(0,E.jsx)(s,{id:`ai-cli`,children:(0,E.jsx)(o,{})}),(0,E.jsx)(c,{children:N.map(e=>(0,E.jsx)(l,{value:e,children:e},e))})]})]})]}):(0,E.jsxs)(`div`,{className:`grid gap-3`,children:[b===`anthropic-profile`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.profileHint`)}),!F&&(0,E.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:e(`settings.ai.profileNone`)})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsx)(g,{htmlFor:`ai-model`,className:`text-sm font-medium`,children:e(`settings.ai.model`)}),(0,E.jsx)(_,{id:`ai-model`,value:S,onChange:e=>C(e.target.value),spellCheck:!1,...D})]})]}),b===`openai`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-[1fr_220px] items-center gap-3`,children:[(0,E.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,E.jsx)(g,{htmlFor:`ai-base-url`,className:`text-sm font-medium`,children:e(`settings.ai.baseUrl`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.baseUrlHint`)})]}),(0,E.jsx)(_,{id:`ai-base-url`,value:w,onChange:e=>O(e.target.value),placeholder:`https://api.openai.com/v1`,spellCheck:!1,...D})]}),q||(0,E.jsxs)(`div`,{className:`grid gap-1`,children:[(0,E.jsx)(g,{htmlFor:`ai-key`,className:`text-sm font-medium`,children:e(`settings.ai.key`)}),(0,E.jsx)(_,{id:`ai-key`,type:`password`,value:k,onChange:e=>A(e.target.value),spellCheck:!1,placeholder:t.configured?`••••••••`:``,...D,autoComplete:`new-password`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.keyHint`)})]}),q||(0,E.jsxs)(`label`,{htmlFor:`ai-remember`,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,E.jsx)(`input`,{id:`ai-remember`,type:`checkbox`,checked:j,onChange:e=>M(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,E.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,E.jsx)(`span`,{className:`text-sm font-medium`,children:e(`settings.ai.remember`)}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`settings.ai.rememberHint`,{path:t.path})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(a,{size:`sm`,onClick:W,disabled:L||(b===`cli`?N.length===0:!q&&!k.trim()),children:e(`settings.ai.save`)}),t.configured&&(0,E.jsx)(a,{size:`sm`,variant:`ghost`,onClick:G,disabled:L,children:e(`settings.ai.forget`)}),z&&(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:z})]})]})]})}function k(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{t:r}=i();return(0,E.jsx)(w,{open:e===`ai-settings`,onOpenChange:e=>{e||t()},children:(0,E.jsxs)(x,{className:`sm:max-w-[560px]`,children:[(0,E.jsxs)(y,{children:[(0,E.jsx)(S,{children:r(`settings.ai.title`)}),(0,E.jsx)(C,{children:r(`settings.ai.description`)})]}),(0,E.jsx)(O,{}),(0,E.jsx)(b,{children:(0,E.jsx)(a,{onClick:t,children:r(`settings.done`)})})]})})}export{k as AiSettingsDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./BGIwW6nZ.js";import{t as d}from"./DTxGpkJp.js";import{c as f,l as p}from"./B1lNzsWx.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";import{n as y}from"./rcI4Fmt0.js";var b=e(t(),1),x=r();function S(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:S}=n(),C=d(e=>e.activeConnectionId)??``,w=y(e=>e.addUser),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)(`%`),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(`caching_sha2_password`),F=t===`user-add`;function I(e){e||(L(),r())}function L(){E(``),O(`%`),A(``),M(``),P(`caching_sha2_password`)}function R(){if(!T.trim()){S(e(`user.add.usernameRequired`));return}if(k!==j){S(e(`user.add.passwordMismatch`));return}w(C,{user:T.trim(),host:D.trim()||`%`,privileges:[],maxQuestions:0,maxUpdates:0,maxConnections:0,maxUserConnections:0,plugin:N,authenticationString:``,passwordExpired:!1,accountLocked:!1}),S(e(`user.add.added`,{user:T,host:D})),L(),r()}return(0,x.jsx)(v,{open:F,onOpenChange:I,children:(0,x.jsxs)(g,{className:`sm:max-w-[450px]`,children:[(0,x.jsx)(m,{children:(0,x.jsx)(_,{children:e(`user.add.title`)})}),(0,x.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-username`,children:e(`user.add.username`)}),(0,x.jsx)(p,{id:`user-add-username`,value:T,onChange:e=>E(e.target.value),placeholder:e(`user.add.usernamePlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-host`,children:e(`user.add.host`)}),(0,x.jsx)(p,{id:`user-add-host`,value:D,onChange:e=>O(e.target.value),placeholder:`%`})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-password`,children:e(`user.add.password`)}),(0,x.jsx)(p,{id:`user-add-password`,type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:e(`user.add.passwordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-confirm-password`,children:e(`user.add.confirmPassword`)}),(0,x.jsx)(p,{id:`user-add-confirm-password`,type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:e(`user.add.confirmPasswordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{children:e(`user.add.plugin`)}),(0,x.jsxs)(u,{value:N,onValueChange:P,children:[(0,x.jsx)(s,{className:`w-full`,children:(0,x.jsx)(o,{})}),(0,x.jsxs)(c,{children:[(0,x.jsx)(l,{value:`mysql_native_password`,children:`mysql_native_password`}),(0,x.jsx)(l,{value:`caching_sha2_password`,children:`caching_sha2_password`})]})]})]})]}),(0,x.jsxs)(h,{children:[(0,x.jsx)(a,{variant:`outline`,onClick:()=>I(!1),children:e(`user.add.cancel`)}),(0,x.jsx)(a,{onClick:R,children:e(`user.add.add`)})]})]})})}export{S as UserAddDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./DsllOXPq.js";import{t as d}from"./B3nhMsGp.js";import{c as f,l as p}from"./Bxw3grU1.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";import{n as y}from"./rcI4Fmt0.js";var b=e(t(),1),x=r();function S(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:S}=n(),C=d(e=>e.activeConnectionId)??``,w=y(e=>e.addUser),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)(`%`),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(`caching_sha2_password`),F=t===`user-add`;function I(e){e||(L(),r())}function L(){E(``),O(`%`),A(``),M(``),P(`caching_sha2_password`)}function R(){if(!T.trim()){S(e(`user.add.usernameRequired`));return}if(k!==j){S(e(`user.add.passwordMismatch`));return}w(C,{user:T.trim(),host:D.trim()||`%`,privileges:[],maxQuestions:0,maxUpdates:0,maxConnections:0,maxUserConnections:0,plugin:N,authenticationString:``,passwordExpired:!1,accountLocked:!1}),S(e(`user.add.added`,{user:T,host:D})),L(),r()}return(0,x.jsx)(v,{open:F,onOpenChange:I,children:(0,x.jsxs)(g,{className:`sm:max-w-[450px]`,children:[(0,x.jsx)(m,{children:(0,x.jsx)(_,{children:e(`user.add.title`)})}),(0,x.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-username`,children:e(`user.add.username`)}),(0,x.jsx)(p,{id:`user-add-username`,value:T,onChange:e=>E(e.target.value),placeholder:e(`user.add.usernamePlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-host`,children:e(`user.add.host`)}),(0,x.jsx)(p,{id:`user-add-host`,value:D,onChange:e=>O(e.target.value),placeholder:`%`})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-password`,children:e(`user.add.password`)}),(0,x.jsx)(p,{id:`user-add-password`,type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:e(`user.add.passwordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-confirm-password`,children:e(`user.add.confirmPassword`)}),(0,x.jsx)(p,{id:`user-add-confirm-password`,type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:e(`user.add.confirmPasswordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{children:e(`user.add.plugin`)}),(0,x.jsxs)(u,{value:N,onValueChange:P,children:[(0,x.jsx)(s,{className:`w-full`,children:(0,x.jsx)(o,{})}),(0,x.jsxs)(c,{children:[(0,x.jsx)(l,{value:`mysql_native_password`,children:`mysql_native_password`}),(0,x.jsx)(l,{value:`caching_sha2_password`,children:`caching_sha2_password`})]})]})]})]}),(0,x.jsxs)(h,{children:[(0,x.jsx)(a,{variant:`outline`,onClick:()=>I(!1),children:e(`user.add.cancel`)}),(0,x.jsx)(a,{onClick:R,children:e(`user.add.add`)})]})]})})}export{S as UserAddDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{c as t,h as n,i as r,n as i}from"./XzPc-eVf.js";import{l as a,m as ee,t as o}from"./CKOS5Y-e.js";import{i as s,t as c}from"./B3nhMsGp.js";import{n as l}from"./BBSxV90W.js";import{n as u,t as d}from"./BNkgLUl5.js";import{T as f,Z as p,en as m,ht as h,l as g,lt as _,ot as v,xt as y}from"./Bxw3grU1.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./DxuXBECK.js";var E=e(n(),1),D=a(),O={execute:`command.localHistory.reason.execute`,edit:`command.localHistory.reason.edit`,replaced:`command.localHistory.reason.replaced`,restore:`command.localHistory.reason.restore`,close:`command.localHistory.reason.close`},k=Object.freeze([]);function A(e){let t=(Date.now()-e)/36e5;return t<1?`<1h`:t<24?`1-24h`:t<168?`1-7d`:`7d+`}function j(){let{t:e}=ee(),n=i(e=>e.activeDialog),a=i(e=>e.closeDialog),j=i(e=>e.setFooterMessage),M=c(e=>e.activeConnectionId),N=u(e=>M?e.activeTabId[M]:null),P=u(e=>M?e.tabs[M]??d:d),F=s(e=>M?e.revisions[M]??k:k),I=l(e=>e.persistQueryHistory),L=p(e=>e.themeId),R=f(L),[z,B]=(0,E.useState)(!0),[V,H]=(0,E.useState)(``),[U,W]=(0,E.useState)(null),[G,K]=(0,E.useState)(`current`),q=P.find(e=>e.id===N),J=n===`local-history`;(0,E.useEffect)(()=>{if(!J)return;let e=N?F.filter(e=>e.docId===N).length:0;t(`local_history_open`,{revisions:r(F.length),tab_revisions:r(e)})},[J]);let Y=(0,E.useMemo)(()=>{let e=V.trim().toLowerCase();return F.filter(t=>z&&N&&t.docId!==N?!1:!e||t.text.toLowerCase().includes(e)||t.title.toLowerCase().includes(e))},[F,V,z,N]),X=q?.query??``,Z=Y.find(e=>e.id===U)??Y.find(e=>e.text!==X)??Y[0],Q=(0,E.useMemo)(()=>{if(!Z)return;let e=F.filter(e=>e.docId===Z.docId);return e[e.findIndex(e=>e.id===Z.id)+1]},[F,Z]),te=G===`current`?X:Q?.text??``;function $(e,n){t(`local_history_recover`,{action:e,reason:n.reason,age:A(n.timestamp),same_tab:n.docId===N,compare:G})}function ne(){if(!M||!N||!Z)return;$(`restore`,Z);let t=u.getState();t.captureRevision(M,N,`restore`),t.setEditorContent(M,N,Z.text),j(e(`command.localHistory.restored`)),a()}function re(){!M||!Z||($(`new_tab`,Z),v(M,Z.text,Z.database,Z.title),j(e(`command.localHistory.openedInTab`)),a())}function ie(e){M&&(s.getState().removeRevision(M,e.id),U===e.id&&W(null))}function ae(){M&&(s.getState().clearRevisions(M),W(null))}return(0,D.jsx)(T,{open:J,onOpenChange:e=>{e||a()},children:(0,D.jsxs)(S,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,D.jsxs)(b,{children:[(0,D.jsx)(C,{children:e(`command.localHistory.title`)}),(0,D.jsx)(w,{children:e(`command.localHistory.description`)})]}),!I&&(0,D.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:e(`command.localHistory.notPersisted`)}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsxs)(`div`,{className:`relative min-w-[200px] flex-1`,children:[(0,D.jsx)(y,{className:`absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(g,{value:V,onChange:e=>H(e.target.value),placeholder:e(`command.localHistory.searchPlaceholder`),className:`h-8 pl-7 text-xs`})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!0),className:`px-2 py-1 text-xs ${z?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.scopeTab`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>B(!1),className:`border-l px-2 py-1 text-xs ${z?`hover:bg-accent/50`:`bg-accent`}`,children:e(`command.localHistory.scopeAll`)})]}),(0,D.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`current`),className:`px-2 py-1 text-xs ${G===`current`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.compareCurrent`)}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>K(`previous`),className:`border-l px-2 py-1 text-xs ${G===`previous`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.comparePrevious`)})]})]}),Y.length===0?(0,D.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:F.length===0?e(`command.localHistory.empty`):e(`command.localHistory.noMatch`)}):(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[260px_1fr] gap-3`,children:[(0,D.jsx)(_,{className:`h-[440px] rounded-md border`,children:(0,D.jsx)(`ul`,{className:`divide-y`,children:Y.map(t=>(0,D.jsxs)(`li`,{className:`group relative`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>W(t.id),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 pr-8 text-left text-xs hover:bg-accent ${t.id===Z?.id?`bg-accent`:``}`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:new Date(t.timestamp).toLocaleString()}),(0,D.jsxs)(`span`,{className:`w-full truncate text-muted-foreground`,children:[t.title,` · `,e(O[t.reason]),` · `,e(`command.localHistory.chars`,{count:t.text.length})]})]}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>ie(t),title:e(`command.localHistory.delete`),className:`absolute right-1.5 top-1.5 rounded p-1 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,children:(0,D.jsx)(h,{className:`h-3.5 w-3.5`})})]},t.id))})}),(0,D.jsxs)(`div`,{className:`flex h-[440px] flex-col overflow-hidden rounded-md border`,children:[(0,D.jsx)(`div`,{className:`border-b bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground`,children:G===`current`?e(`command.localHistory.diffAgainstCurrent`):Q?e(`command.localHistory.diffAgainstPrevious`,{time:new Date(Q.timestamp).toLocaleString()}):e(`command.localHistory.noPrevious`)}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(m,{language:`sql`,theme:R,original:Z?.text??``,modified:te,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,renderOverviewRuler:!1}})})]})]}),(0,D.jsxs)(x,{className:`sm:justify-between`,children:[(0,D.jsx)(o,{variant:`ghost`,onClick:ae,disabled:F.length===0,children:e(`command.localHistory.clearAll`)}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,D.jsx)(o,{variant:`outline`,onClick:re,disabled:!Z,children:e(`command.localHistory.openInNewTab`)}),(0,D.jsx)(o,{onClick:ne,disabled:!Z||!q,children:e(`command.localHistory.restore`)})]})]})]})})}export{j as LocalHistoryDialog};
@@ -1 +1 @@
1
- import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{t as i}from"./DTxGpkJp.js";import{c as a}from"./Cw_LYT6k.js";import{a as o,i as s,n as c,o as l,t as u}from"./DxuXBECK.js";var d=t(),f=[`FLUSH HOSTS`,`FLUSH LOGS`,`FLUSH PRIVILEGES`,`FLUSH STATUS`,`FLUSH TABLES`,`FLUSH THREADS`,`FLUSH QUERY CACHE`,`FLUSH DES_KEY_FILE`,`FLUSH RELAY LOGS`,`FLUSH SLOW LOGS`,`FLUSH BINARY LOGS`,`FLUSH ENGINE LOGS`,`FLUSH ERROR LOGS`,`FLUSH GENERAL LOGS`,`FLUSH USER_RESOURCES`,`FLUSH OPTIMIZER_COSTS`];function p(){let e=i.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}function m(){let{t}=n(),{activeDialog:i,closeDialog:m,setFooterMessage:h}=e(),g=i===`flush`;function _(e){e||m()}async function v(e){let n=p();if(!n){h(t(`command.noActiveConnection`));return}try{await a(n,e),h(t(`command.flush.executed`,{command:e}))}catch(n){h(t(`command.flush.executeError`,{command:e,message:n instanceof Error?n.message:String(n)}))}}return(0,d.jsx)(u,{open:g,onOpenChange:_,children:(0,d.jsxs)(c,{className:`sm:max-w-[500px]`,children:[(0,d.jsx)(o,{children:(0,d.jsx)(l,{children:t(`command.flush.title`)})}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:f.map(e=>(0,d.jsx)(r,{variant:`outline`,size:`sm`,className:`justify-start text-xs h-8`,onClick:()=>{v(e)},children:e},e))}),(0,d.jsx)(s,{children:(0,d.jsx)(r,{variant:`outline`,onClick:()=>_(!1),children:t(`command.close`)})})]})})}export{m as FlushDialog};
1
+ import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{t as i}from"./B3nhMsGp.js";import{c as a}from"./CtXRSNHU.js";import{a as o,i as s,n as c,o as l,t as u}from"./DxuXBECK.js";var d=t(),f=[`FLUSH HOSTS`,`FLUSH LOGS`,`FLUSH PRIVILEGES`,`FLUSH STATUS`,`FLUSH TABLES`,`FLUSH THREADS`,`FLUSH QUERY CACHE`,`FLUSH DES_KEY_FILE`,`FLUSH RELAY LOGS`,`FLUSH SLOW LOGS`,`FLUSH BINARY LOGS`,`FLUSH ENGINE LOGS`,`FLUSH ERROR LOGS`,`FLUSH GENERAL LOGS`,`FLUSH USER_RESOURCES`,`FLUSH OPTIMIZER_COSTS`];function p(){let e=i.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}function m(){let{t}=n(),{activeDialog:i,closeDialog:m,setFooterMessage:h}=e(),g=i===`flush`;function _(e){e||m()}async function v(e){let n=p();if(!n){h(t(`command.noActiveConnection`));return}try{await a(n,e),h(t(`command.flush.executed`,{command:e}))}catch(n){h(t(`command.flush.executeError`,{command:e,message:n instanceof Error?n.message:String(n)}))}}return(0,d.jsx)(u,{open:g,onOpenChange:_,children:(0,d.jsxs)(c,{className:`sm:max-w-[500px]`,children:[(0,d.jsx)(o,{children:(0,d.jsx)(l,{children:t(`command.flush.title`)})}),(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:f.map(e=>(0,d.jsx)(r,{variant:`outline`,size:`sm`,className:`justify-start text-xs h-8`,onClick:()=>{v(e)},children:e},e))}),(0,d.jsx)(s,{children:(0,d.jsx)(r,{variant:`outline`,onClick:()=>_(!1),children:t(`command.close`)})})]})})}export{m as FlushDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{At as o,I as s,M as c,N as l,P as u,c as d,l as f,tt as p}from"./B1lNzsWx.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./DxuXBECK.js";import{t as b}from"./B1mA7CRG.js";var x=e(t(),1);function S(){let e=s(e=>e.status.state===`valid`);return!u()||e}var C=r(),w={offline:`sync.offline`,server:`sync.serverError`,unauthorized:`sync.serverError`,conflict:`sync.serverError`,"bad-passphrase":`sync.wrongPassphrase`,malformed:`sync.wrongPassphrase`,unsupported:`sync.serverError`};function T(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{phase:r,user:s,busy:u,error:T,lastSyncedAt:E,vault:D,refresh:O,createVault:k,unlock:A,push:j,signOut:M,forgetVault:N,closeAccount:P,setError:F}=c(),{t:I}=i(),L=S(),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(``),[H,U]=(0,x.useState)(!1),[W,G]=(0,x.useState)(!1);(0,x.useEffect)(()=>{O()},[O]);let K=R.length>0&&R.length<10,q=B.length>0&&R!==B,J=R.length>=10&&R===B,Y=T?I(w[T]??`sync.serverError`):null,X=D?Object.keys(D.profiles).length:0,Z=()=>{z(``),V(``),F(null)};return(0,C.jsx)(y,{open:e===`sync`,onOpenChange:e=>{e||t()},children:(0,C.jsxs)(g,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,C.jsxs)(m,{children:[(0,C.jsx)(_,{children:I(`sync.title`)}),(0,C.jsxs)(v,{children:[I(`sync.description`),s&&(0,C.jsx)(`span`,{className:`mt-1 block text-xs`,children:I(`sync.signedInAs`,{email:s.email??s.id})})]})]}),(0,C.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,C.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:I(`sync.stored`)}),r===`unavailable`&&(0,C.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:p()?I(`sync.unavailable`):I(`sync.notDeployed`)}),r===`signed-out`&&(0,C.jsxs)(a,{onClick:()=>{window.location.href=l(`github`,window.location.href)},children:[(0,C.jsx)(o,{className:`size-4`}),I(`sync.signIn`)]}),s&&!L&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.needsPro`)}),(0,C.jsx)(b,{highlight:`sync`})]}),L&&r===`no-vault`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.createTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.createHint`)}),(0,C.jsx)(d,{htmlFor:`sync-pass`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-pass`,type:`password`,autoComplete:`new-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(d,{htmlFor:`sync-confirm`,children:I(`sync.confirm`)}),(0,C.jsx)(f,{id:`sync-confirm`,type:`password`,autoComplete:`new-password`,value:B,onChange:e=>{V(e.target.value),F(null)}}),K&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.tooShort`,{count:10})}),q&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.mismatch`)}),(0,C.jsx)(a,{disabled:!J||u,onClick:()=>{k(R).then(Z)},children:I(`sync.enable`)})]}),L&&r===`locked`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.unlockTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.unlockHint`)}),(0,C.jsx)(d,{htmlFor:`sync-unlock`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-unlock`,type:`password`,autoComplete:`current-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(a,{disabled:!R||u,onClick:()=>{A(R).then(Z)},children:I(`sync.unlock`)})]}),L&&r===`ready`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E?I(`sync.lastSynced`,{when:new Date(E).toLocaleString()}):I(`sync.neverSynced`),` · `,I(`sync.profiles`,{count:X})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(a,{variant:`secondary`,disabled:u,onClick:()=>{U(!1),j()},children:I(`sync.syncNow`)}),(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{c.getState().lock(),Z()},children:I(`sync.changePassphrase`)})]}),H?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteVaultConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{N().then(()=>U(!1))},children:I(`sync.deleteVault`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>U(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(a,{variant:`ghost`,className:`justify-start px-0 text-destructive`,onClick:()=>U(!0),children:I(`sync.deleteVault`)})]}),s&&(W?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteAccountConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:u,onClick:()=>{P().then(()=>G(!1))},children:I(`sync.deleteAccount`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>G(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:I(`sync.deleteAccount`)})),u&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.working`)}),Y&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:Y})]}),(0,C.jsxs)(h,{children:[s&&(0,C.jsx)(a,{variant:`ghost`,disabled:u,onClick:()=>{M().then(Z)},children:I(`sync.signOut`)}),(0,C.jsx)(a,{onClick:t,children:I(`settings.done`)})]})]})})}export{T as SyncDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{F as o,L as s,N as c,P as l,c as u,jt as d,l as f,nt as p}from"./Bxw3grU1.js";import{a as m,i as h,n as g,o as _,r as v,t as y}from"./DxuXBECK.js";import{t as b}from"./DUyKev3g.js";var x=e(t(),1);function S(){let e=s(e=>e.status.state===`valid`);return!o()||e}var C=r(),w={offline:`sync.offline`,server:`sync.serverError`,unauthorized:`sync.serverError`,conflict:`sync.serverError`,"bad-passphrase":`sync.wrongPassphrase`,malformed:`sync.wrongPassphrase`,unsupported:`sync.serverError`};function T(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{phase:r,user:o,busy:s,error:T,lastSyncedAt:E,vault:D,refresh:O,createVault:k,unlock:A,push:j,signOut:M,forgetVault:N,closeAccount:P,setError:F}=c(),{t:I}=i(),L=S(),[R,z]=(0,x.useState)(``),[B,V]=(0,x.useState)(``),[H,U]=(0,x.useState)(!1),[W,G]=(0,x.useState)(!1);(0,x.useEffect)(()=>{O()},[O]);let K=R.length>0&&R.length<10,q=B.length>0&&R!==B,J=R.length>=10&&R===B,Y=T?I(w[T]??`sync.serverError`):null,X=D?Object.keys(D.profiles).length:0,Z=()=>{z(``),V(``),F(null)};return(0,C.jsx)(y,{open:e===`sync`,onOpenChange:e=>{e||t()},children:(0,C.jsxs)(g,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,C.jsxs)(m,{children:[(0,C.jsx)(_,{children:I(`sync.title`)}),(0,C.jsxs)(v,{children:[I(`sync.description`),o&&(0,C.jsx)(`span`,{className:`mt-1 block text-xs`,children:I(`sync.signedInAs`,{email:o.email??o.id})})]})]}),(0,C.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,C.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:I(`sync.stored`)}),r===`unavailable`&&(0,C.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:p()?I(`sync.unavailable`):I(`sync.notDeployed`)}),r===`signed-out`&&(0,C.jsxs)(a,{onClick:()=>{window.location.href=l(`github`,window.location.href)},children:[(0,C.jsx)(d,{className:`size-4`}),I(`sync.signIn`)]}),o&&!L&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.needsPro`)}),(0,C.jsx)(b,{highlight:`sync`})]}),L&&r===`no-vault`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.createTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.createHint`)}),(0,C.jsx)(u,{htmlFor:`sync-pass`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-pass`,type:`password`,autoComplete:`new-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(u,{htmlFor:`sync-confirm`,children:I(`sync.confirm`)}),(0,C.jsx)(f,{id:`sync-confirm`,type:`password`,autoComplete:`new-password`,value:B,onChange:e=>{V(e.target.value),F(null)}}),K&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.tooShort`,{count:10})}),q&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:I(`sync.mismatch`)}),(0,C.jsx)(a,{disabled:!J||s,onClick:()=>{k(R).then(Z)},children:I(`sync.enable`)})]}),L&&r===`locked`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:I(`sync.unlockTitle`)}),(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.unlockHint`)}),(0,C.jsx)(u,{htmlFor:`sync-unlock`,children:I(`sync.passphrase`)}),(0,C.jsx)(f,{id:`sync-unlock`,type:`password`,autoComplete:`current-password`,value:R,onChange:e=>{z(e.target.value),F(null)}}),(0,C.jsx)(a,{disabled:!R||s,onClick:()=>{A(R).then(Z)},children:I(`sync.unlock`)})]}),L&&r===`ready`&&(0,C.jsxs)(`div`,{className:`grid gap-2`,children:[(0,C.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[E?I(`sync.lastSynced`,{when:new Date(E).toLocaleString()}):I(`sync.neverSynced`),` · `,I(`sync.profiles`,{count:X})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(a,{variant:`secondary`,disabled:s,onClick:()=>{U(!1),j()},children:I(`sync.syncNow`)}),(0,C.jsx)(a,{variant:`ghost`,disabled:s,onClick:()=>{c.getState().lock(),Z()},children:I(`sync.changePassphrase`)})]}),H?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteVaultConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:s,onClick:()=>{N().then(()=>U(!1))},children:I(`sync.deleteVault`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>U(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(a,{variant:`ghost`,className:`justify-start px-0 text-destructive`,onClick:()=>U(!0),children:I(`sync.deleteVault`)})]}),o&&(W?(0,C.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/5 p-3`,children:[(0,C.jsx)(`p`,{className:`mb-2 text-xs`,children:I(`sync.deleteAccountConfirm`)}),(0,C.jsxs)(`div`,{className:`flex gap-2`,children:[(0,C.jsx)(a,{variant:`destructive`,disabled:s,onClick:()=>{P().then(()=>G(!1))},children:I(`sync.deleteAccount`)}),(0,C.jsx)(a,{variant:`ghost`,onClick:()=>G(!1),children:I(`settings.done`)})]})]}):(0,C.jsx)(`button`,{type:`button`,onClick:()=>G(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-destructive focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:I(`sync.deleteAccount`)})),s&&(0,C.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:I(`sync.working`)}),Y&&(0,C.jsx)(`p`,{className:`text-xs text-destructive`,children:Y})]}),(0,C.jsxs)(h,{children:[o&&(0,C.jsx)(a,{variant:`ghost`,disabled:s,onClick:()=>{M().then(Z)},children:I(`sync.signOut`)}),(0,C.jsx)(a,{onClick:t,children:I(`settings.done`)})]})]})})}export{T as SyncDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{i as r,l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./CmJ3siBN.js";import{t as c}from"./DTxGpkJp.js";import{n as l}from"./CChaTOPr.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{It as m,c as h,l as g,rt as _}from"./B1lNzsWx.js";var v=e(t(),1),y=i();function b(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=c(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{_(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(s,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(r,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(g,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{i as r,l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./CmJ3siBN.js";import{t as c}from"./B3nhMsGp.js";import{n as l}from"./BNkgLUl5.js";import{n as u,o as d,s as f,t as p}from"./DAFA-E1-.js";import{Lt as m,c as h,it as g,l as _}from"./Bxw3grU1.js";var v=e(t(),1),y=i();function b(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(0),M=c(e=>e.activeConnectionId)??``,N=l(e=>M?e.activeTabId[M]:void 0)??``;if(t!==`find-replace`)return null;let P={query:b,caseSensitive:w,regex:E,wholeWord:O},F=M!==``&&N!==``&&b!==``;function I(){i()}function L(){j(F?u(M,N,P,`next`):0)}function R(){j(F?u(M,N,P,`prev`):0)}function z(){F&&j(f(M,N,P,S))}function B(){F&&(d(M,N,P,S),j(p(M,N,P)))}return(0,y.jsxs)(`div`,{className:`fixed top-12 right-4 z-50 bg-background border rounded-md shadow-lg p-3 w-[400px] space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(_,{placeholder:e(`command.findReplace.findPlaceholder`),value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{g(e)||(e.key===`Enter`&&(e.shiftKey?R():L()),e.key===`Escape`&&I())},className:`flex-1 h-7 text-sm`,autoFocus:!0}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap min-w-[60px] text-center`,children:A>0?e(`command.findReplace.found`,{count:A}):e(`command.findReplace.noResults`)}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:R,title:e(`command.findReplace.previous`),children:(0,y.jsx)(s,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:L,title:e(`command.findReplace.next`),children:(0,y.jsx)(m,{className:`h-4 w-4`})}),(0,y.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:I,title:e(`command.findReplace.close`),children:(0,y.jsx)(r,{className:`h-4 w-4`})})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(_,{placeholder:e(`command.findReplace.replacePlaceholder`),value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Escape`&&I()},className:`flex-1 h-7 text-sm`}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:z,children:e(`command.findReplace.replace`)}),(0,y.jsx)(o,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,onClick:B,children:e(`command.findReplace.all`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.caseSensitive`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:E,onChange:e=>D(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.regex`)]}),(0,y.jsxs)(h,{className:`flex items-center gap-1.5 text-xs font-normal cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),className:`rounded border-input`}),e(`command.findReplace.wholeWord`)]})]})]})}export{b as FindReplaceDialog};
@@ -1 +1 @@
1
- import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{n as i,t as a}from"./BBSxV90W.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";import{t as f}from"./vKCvRvxP.js";var p=t();function m(){let t=e(e=>e.activeDialog),m=e(e=>e.closeDialog),h=i(),g=h.update,{t:_}=n();return(0,p.jsx)(d,{open:t===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(c,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(o,{children:[(0,p.jsx)(l,{children:_(`settings.title`)}),(0,p.jsx)(u,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(s,{children:[(0,p.jsx)(r,{variant:`ghost`,onClick:()=>g(a),children:_(`settings.resetDefaults`)}),(0,p.jsx)(r,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
1
+ import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{n as i,t as a}from"./BBSxV90W.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";import{t as f}from"./ChiscGY_.js";var p=t();function m(){let t=e(e=>e.activeDialog),m=e(e=>e.closeDialog),h=i(),g=h.update,{t:_}=n();return(0,p.jsx)(d,{open:t===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(c,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(o,{children:[(0,p.jsx)(l,{children:_(`settings.title`)}),(0,p.jsx)(u,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(s,{children:[(0,p.jsx)(r,{variant:`ghost`,onClick:()=>g(a),children:_(`settings.resetDefaults`)}),(0,p.jsx)(r,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};