planche 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/app/assets/{aL0ab6hA.js → 1E6FYbv2.js} +1 -1
  2. package/app/assets/B-Mrqvrb.css +2 -0
  3. package/app/assets/{C-MJZp-k.js → B3uI9Ppb.js} +1 -1
  4. package/app/assets/{g4S828aR.js → B5OocgEJ.js} +1 -1
  5. package/app/assets/{B6gKGoJk.js → B8xQ2o-X.js} +1 -1
  6. package/app/assets/{3tVT9YMh.js → BGOnv2_O.js} +1 -1
  7. package/app/assets/{B2VNJYl8.js → BIjF9ulh.js} +1 -1
  8. package/app/assets/{DURNOOys.js → Bpg8LzYe.js} +1 -1
  9. package/app/assets/{BxOkJTYb.js → BunrDTHn.js} +1 -1
  10. package/app/assets/{Brk9GcZh.js → C3bMAsUp.js} +1 -1
  11. package/app/assets/{BQ74FNAM.js → C4il2fft.js} +1 -1
  12. package/app/assets/{1qhRpHKv.js → COIa4uoZ.js} +1 -1
  13. package/app/assets/{8OZbP3hw.js → CkgLFvM5.js} +1 -1
  14. package/app/assets/{nij0MMY5.js → Cx_chT_j.js} +1 -1
  15. package/app/assets/{2sxOfzyn.js → D7Ze5md9.js} +5 -5
  16. package/app/assets/{D2AdQhHv.js → DFNc4ghA.js} +1 -1
  17. package/app/assets/{vIgrQ7V1.js → DGD5v9rw.js} +1 -1
  18. package/app/assets/{f1Yh3VFu.js → DZH-tLW-.js} +1 -1
  19. package/app/assets/{DkdStXtl.js → D_2UqK4k.js} +1 -1
  20. package/app/assets/{BCZ2DwDi.js → Dd9Cr3e8.js} +1 -1
  21. package/app/assets/{7D95fvkQ.js → Dh3YJ3G1.js} +1 -1
  22. package/app/assets/{BrwCR6-9.js → DiaA_DOW.js} +1 -1
  23. package/app/assets/{D98JmiqU.js → DlKZCiMg.js} +2 -2
  24. package/app/assets/{MdnUPkBs.js → DmejZTwI.js} +1 -1
  25. package/app/assets/{OQSC6nip.js → DnjY8W6t.js} +1 -1
  26. package/app/assets/{C3uDTQB5.js → FnB_uI57.js} +1 -1
  27. package/app/assets/{oSIomP-s.js → IzH8qyLi.js} +1 -1
  28. package/app/assets/{CCBE6CSG.js → NY_tAtcY.js} +1 -1
  29. package/app/assets/{q4qvsmm4.js → QBd1UkiI.js} +1 -1
  30. package/app/assets/{DCkfyKy4.js → RIOwEE7M.js} +1 -1
  31. package/app/assets/{Bfw0mW2q.js → S4Oofhu9.js} +1 -1
  32. package/app/assets/{B4qi_yRV.js → cc05Z2oj.js} +1 -1
  33. package/app/assets/{B_0rFJQl.js → dxLVUFtU.js} +1 -1
  34. package/app/assets/{Clm7zeUD.js → fCzQKDqY.js} +1 -1
  35. package/app/assets/{BmSO6bVX.js → og5dTmtH.js} +1 -1
  36. package/app/assets/{Bfuq7Ecs.js → qbvehL2h.js} +1 -1
  37. package/app/index.html +3 -3
  38. package/package.json +1 -1
  39. package/app/assets/ZV96pIZb.css +0 -2
@@ -1 +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"./ClyAuDY9.js";import{_ as f,a as p,o as m,r as h,t as g}from"./CZQ1r4zz.js";import{t as _}from"./DTxGpkJp.js";import{n as v,r as y}from"./BBSxV90W.js";import{n as b,t as ee}from"./CChaTOPr.js";import{n as x,t as S}from"./Cw_LYT6k.js";import{c as C,i as w}from"./D98JmiqU.js";import{$ as T,B as te,Ct as E,Dt as D,F as O,K as ne,Lt as k,Mt as A,Q as j,R as M,St as re,Tt as N,Vt as ie,X as P,Z as ae,_t as oe,bt as se,dt as ce,ft as le,gt as ue,ht as de,jt as fe,kt as pe,lt as me,ot as he,q as ge,ut as _e,vt as ve,wt as ye,xt as be}from"./2sxOfzyn.js";import{a as xe,n as F,o as Se,r as Ce,t as we}from"./DxuXBECK.js";var Te=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`}]]),Ee=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`}]]),De=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`}]]),Oe=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`}]]),ke=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`}]]),Ae=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`}]]),je=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`}]]),Me=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`}]]),Ne=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`}]]),Pe=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`}]]),Fe=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`}]]),Ie=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`}]]),Le=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`}]]),Re=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`}]]),ze=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`}]]),Be=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`}]]),Ve=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`}]]),He=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`}]]),Ue=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`}]]),I=e(n(),1),L=1,We=.9,Ge=.8,Ke=.17,R=.1,z=.999,qe=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Je=/[\\\/_+.#"@\[\(\{&]/g,Ye=/[\s-]/,Xe=/[\s-]/g;function H(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?L:B;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=H(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=L:V.test(e.charAt(l-1))?(d*=Ge,p=e.slice(i,l-1).match(Je),p&&i>0&&(d*=z**+p.length)):Ye.test(e.charAt(l-1))?(d*=We,m=e.slice(i,l-1).match(Xe),m&&i>0&&(d*=z**+m.length)):(d*=Ke,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=qe)),(d<R&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=H(e,t,n,r,l+1,a+2,o),f*R>d&&(d=f*R)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ze(e){return e.toLowerCase().replace(Xe,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,H(e,t,Ze(e),Ze(t),0,0,{})}var U=`[cmdk-group=""]`,W=`[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)=>Qe(e,t,n),it=I.createContext(void 0),K=()=>I.useContext(it),at=I.createContext(void 0),q=()=>I.useContext(at),ot=I.createContext(void 0),st=I.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=I.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=I.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=I.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(W);t?t.appendChild(e.parentElement===t?e:e.closest(`${W} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${W} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${U}[${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(U)?.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 re(e){let t=k()?.closest(U),n;for(;t&&!n;)t=e>0?gt(t,U):_t(t,U),n=t?.querySelector(tt);n?w.setState(`value`,n.getAttribute(G)):M(e)}let N=()=>j(A().length-1),ie=e=>{e.preventDefault(),e.metaKey?N():e.altKey?re(1):M(1)},P=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?re(-1):M(-1)};return I.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&&ie(e);break;case`ArrowDown`:ie(e);break;case`p`:case`k`:v&&e.ctrlKey&&P(e);break;case`ArrowUp`:P(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),N();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:St},c),Q(e,e=>I.createElement(at.Provider,{value:w},I.createElement(it.Provider,{value:T},e))))}),ct=I.forwardRef((e,t)=>{let n=f(),r=I.useRef(null),i=I.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);I.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 I.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=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=f(),c=I.useRef(null),u=I.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=I.useMemo(()=>({id:s,forceMount:i}),[i]);return I.createElement(l.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&I.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:d},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?d:void 0},I.createElement(ot.Provider,{value:h},e))))}),ut=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:I.createElement(l.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),dt=I.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 I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.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=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=I.useRef(null),s=I.useRef(null),c=Z(e=>e.selectedItemId),u=K();return I.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)}}},[]),I.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=>I.createElement(`div`,{ref:a(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),pt=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(g,{open:n,onOpenChange:r},I.createElement(m,{container:o},I.createElement(p,{"cmdk-overlay":``,className:i}),I.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(st,{ref:t,...s}))))}),mt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(l.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ht=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.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=>I.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=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function yt(e,t,n,r=[]){let i=I.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]=I.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&&I.isValidElement(t)?I.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)(we,{...a,children:[(0,$.jsxs)(xe,{className:`sr-only`,children:[(0,$.jsx)(Se,{children:e}),(0,$.jsx)(Ce,{children:t})]}),(0,$.jsx)(F,{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)(se,{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}=T(),{capabilities:se}=he(),xe=y(),F=_(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),Se=_(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),Ce=_(e=>e.updateProfile),we=P(e=>e.themeId),L=P(e=>e.setTheme),We=v(e=>e.locale),Ge=v(e=>e.setLocale),Ke=n===`quick-command`,R=F!==void 0,z=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 qe(){let e=_.getState().activeConnectionId;if(!e)return;let t=x(await S(e));t&&r.getState().setFooterMessage(t)}let B=(0,I.useCallback)(e=>{i(),e()},[i]),V=(0,I.useCallback)(e=>l(e instanceof Error?e.message:String(e)),[l]),Je=()=>{let e=_.getState().activeConnectionId;e&&(j.getState().openERD(e),t(`erd_open`),b.getState().setActiveQueryTab(e,`erd`))},Ye=[{heading:e(`palette.groups.connection`),commands:[{id:`connect`,label:e(`palette.commands.connect`),icon:Ie,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!xe,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:ce,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{g()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:N,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:F?.readOnly===!0,action:()=>B(()=>{F&&Ce(F.id,{readOnly:!F.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:D,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:F?.transactionMode===`manual`,action:()=>B(()=>{F&&Ce(F.id,{transactionMode:F.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:k,tone:`green`,keywords:[`commit`,`transaction`],disabled:!Se||!F,action:()=>B(()=>{F&&w(F.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:le,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!Se||!F,action:()=>B(()=>{F&&C(F.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:E,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{f()})},{id:`stop-query`,label:e(`result.running.stop`),icon:oe,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{qe()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{p()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{m()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:re,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>h())},{id:`find-replace`,label:e(`menu.query.findReplace`),icon:Le,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!R,action:()=>B(()=>a(`find-replace`))},{id:`local-history`,label:e(`menu.query.localHistory`),icon:Ne,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!R,action:()=>B(()=>a(`local-history`))}]},{heading:e(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:e(`palette.commands.createDatabase`),icon:fe,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!R,action:()=>B(()=>a(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:e(`menu.database.alter`),icon:Oe,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!R,action:()=>B(()=>a(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:e(`menu.database.copy`),icon:A,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!R,action:()=>B(()=>a(`copy-database`))},{id:`schema-diff`,label:e(`menu.database.compare`),icon:je,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:`compare_schemas`,disabled:!R,action:()=>B(()=>a(`schema-diff`))},{id:`data-diff`,label:e(`menu.database.compareData`),icon:Me,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:`compare_data`,disabled:!R,action:()=>B(()=>a(`data-diff`))},{id:`group-by`,label:e(`menu.database.groupBy`),icon:ve,tone:`mauve`,keywords:[`group`,`count`,`aggregate`,`distinct`,`summary`],disabled:!R,action:()=>B(()=>a(`group-by`))}]},{heading:e(`palette.groups.table`),commands:[{id:`create-table`,label:e(`palette.commands.createTable`),icon:ue,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:me,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!R,action:()=>B(()=>a(`alter-table`))},{id:`duplicate-table`,label:e(`menu.table.duplicateStructure`),icon:Ee,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!R,action:()=>B(()=>a(`duplicate-table-structure`))}]},{heading:e(`menu.export.title`),commands:[{id:`export-csv`,label:e(`menu.export.csv`),icon:Ae,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!R,action:()=>B(()=>a(`export-csv`))},{id:`export-html`,label:e(`menu.export.schemaHtml`),icon:ke,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!R,action:()=>B(()=>a(`export-html`))}]},{heading:e(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:e(`palette.commands.processList`),icon:ie,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!R,action:()=>B(()=>a(`process-list`))},{id:`variables`,capability:`variables`,label:e(`palette.commands.serverVariables`),icon:Ve,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!R,action:()=>B(()=>a(`variables`))},{id:`status`,capability:`status`,label:e(`palette.commands.serverStatus`),icon:de,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:be,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:_e,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:ye,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ge().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{te().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Je)}]},{heading:e(`menu.settings.theme`),commands:ae().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:we===e.id,swatch:e,action:()=>B(()=>L(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:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:We===t,action:()=>B(()=>Ge(t))}))},{heading:e(`menu.settings.title`),commands:[{id:`safety-settings`,label:e(`menu.settings.safety`),icon:He,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>B(()=>a(`safety-settings`))}]},{heading:e(`menu.help.title`),commands:[{id:`documentation`,label:e(`menu.help.documentation`),icon:Te,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>B(()=>{window.open(ne(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>o(!0))},{id:`terms`,label:e(`menu.help.terms`),icon:ze,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>B(()=>a(`terms`))},{id:`about`,label:e(`menu.help.about`),icon:pe,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function Xe(e){e||i()}let H=Ye.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||se[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(wt,{open:Ke,onOpenChange:Xe,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`)}),H.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||O(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)(M,{className:`ml-0`}),t.checked&&(0,$.jsx)(k,{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
+ 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"./ClyAuDY9.js";import{_ as f,a as p,o as m,r as h,t as g}from"./CZQ1r4zz.js";import{t as _}from"./DTxGpkJp.js";import{n as v,r as y}from"./BBSxV90W.js";import{n as b,t as ee}from"./CChaTOPr.js";import{n as x,t as S}from"./Cw_LYT6k.js";import{c as C,i as w}from"./DlKZCiMg.js";import{$ as T,B as te,Ct as E,Dt as D,F as O,K as ne,Lt as k,Mt as A,Q as j,R as M,St as re,Tt as N,Vt as ie,X as P,Z as ae,_t as oe,bt as se,dt as ce,ft as le,gt as ue,ht as de,jt as fe,kt as pe,lt as me,ot as he,q as ge,ut as _e,vt as ve,wt as ye,xt as be}from"./D7Ze5md9.js";import{a as xe,n as F,o as Se,r as Ce,t as we}from"./DxuXBECK.js";var Te=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`}]]),Ee=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`}]]),De=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`}]]),Oe=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`}]]),ke=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`}]]),Ae=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`}]]),je=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`}]]),Me=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`}]]),Ne=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`}]]),Pe=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`}]]),Fe=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`}]]),Ie=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`}]]),Le=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`}]]),Re=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`}]]),ze=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`}]]),Be=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`}]]),Ve=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`}]]),He=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`}]]),Ue=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`}]]),I=e(n(),1),L=1,We=.9,Ge=.8,Ke=.17,R=.1,z=.999,qe=.9999,B=.99,V=/[\\\/_+.#"@\[\(\{&]/,Je=/[\\\/_+.#"@\[\(\{&]/g,Ye=/[\s-]/,Xe=/[\s-]/g;function H(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?L:B;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=H(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=L:V.test(e.charAt(l-1))?(d*=Ge,p=e.slice(i,l-1).match(Je),p&&i>0&&(d*=z**+p.length)):Ye.test(e.charAt(l-1))?(d*=We,m=e.slice(i,l-1).match(Xe),m&&i>0&&(d*=z**+m.length)):(d*=Ke,i>0&&(d*=z**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=qe)),(d<R&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=H(e,t,n,r,l+1,a+2,o),f*R>d&&(d=f*R)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Ze(e){return e.toLowerCase().replace(Xe,` `)}function Qe(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,H(e,t,Ze(e),Ze(t),0,0,{})}var U=`[cmdk-group=""]`,W=`[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)=>Qe(e,t,n),it=I.createContext(void 0),K=()=>I.useContext(it),at=I.createContext(void 0),q=()=>I.useContext(at),ot=I.createContext(void 0),st=I.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=I.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=I.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=I.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(W);t?t.appendChild(e.parentElement===t?e:e.closest(`${W} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${W} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${U}[${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(U)?.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 re(e){let t=k()?.closest(U),n;for(;t&&!n;)t=e>0?gt(t,U):_t(t,U),n=t?.querySelector(tt);n?w.setState(`value`,n.getAttribute(G)):M(e)}let N=()=>j(A().length-1),ie=e=>{e.preventDefault(),e.metaKey?N():e.altKey?re(1):M(1)},P=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?re(-1):M(-1)};return I.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&&ie(e);break;case`ArrowDown`:ie(e);break;case`p`:case`k`:v&&e.ctrlKey&&P(e);break;case`ArrowUp`:P(e);break;case`Home`:e.preventDefault(),j(0);break;case`End`:e.preventDefault(),N();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(nt);t.dispatchEvent(e)}}}}},I.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:St},c),Q(e,e=>I.createElement(at.Provider,{value:w},I.createElement(it.Provider,{value:T},e))))}),ct=I.forwardRef((e,t)=>{let n=f(),r=I.useRef(null),i=I.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);I.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 I.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=I.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...o}=e,s=f(),c=I.useRef(null),u=I.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=I.useMemo(()=>({id:s,forceMount:i}),[i]);return I.createElement(l.div,{ref:a(c,t),...o,"cmdk-group":``,role:`presentation`,hidden:!m||void 0},n&&I.createElement(`div`,{ref:u,"cmdk-group-heading":``,"aria-hidden":!0,id:d},n),Q(e,e=>I.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?d:void 0},I.createElement(ot.Provider,{value:h},e))))}),ut=I.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=I.useRef(null),o=Z(e=>!e.search);return!n&&!o?null:I.createElement(l.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),dt=I.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 I.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),I.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=I.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=I.useRef(null),s=I.useRef(null),c=Z(e=>e.selectedItemId),u=K();return I.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)}}},[]),I.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=>I.createElement(`div`,{ref:a(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),pt=I.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return I.createElement(g,{open:n,onOpenChange:r},I.createElement(m,{container:o},I.createElement(p,{"cmdk-overlay":``,className:i}),I.createElement(h,{"aria-label":e.label,"cmdk-dialog":``,className:a},I.createElement(st,{ref:t,...s}))))}),mt=I.forwardRef((e,t)=>Z(e=>e.filtered.count===0)?I.createElement(l.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ht=I.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return I.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=>I.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=I.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>`u`?I.useEffect:I.useLayoutEffect;function X(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function Z(e){let t=q(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function yt(e,t,n,r=[]){let i=I.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]=I.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&&I.isValidElement(t)?I.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)(we,{...a,children:[(0,$.jsxs)(xe,{className:`sr-only`,children:[(0,$.jsx)(Se,{children:e}),(0,$.jsx)(Ce,{children:t})]}),(0,$.jsx)(F,{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)(se,{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}=T(),{capabilities:se}=he(),xe=y(),F=_(e=>e.activeConnections.find(t=>t.id===e.activeConnectionId)),Se=_(e=>e.activeConnectionId?e.transactionOpen[e.activeConnectionId]??!1:!1),Ce=_(e=>e.updateProfile),we=P(e=>e.themeId),L=P(e=>e.setTheme),We=v(e=>e.locale),Ge=v(e=>e.setLocale),Ke=n===`quick-command`,R=F!==void 0,z=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 qe(){let e=_.getState().activeConnectionId;if(!e)return;let t=x(await S(e));t&&r.getState().setFooterMessage(t)}let B=(0,I.useCallback)(e=>{i(),e()},[i]),V=(0,I.useCallback)(e=>l(e instanceof Error?e.message:String(e)),[l]),Je=()=>{let e=_.getState().activeConnectionId;e&&(j.getState().openERD(e),t(`erd_open`),b.getState().setActiveQueryTab(e,`erd`))},Ye=[{heading:e(`palette.groups.connection`),commands:[{id:`connect`,label:e(`palette.commands.connect`),icon:Ie,tone:`sky`,shortcut:`Alt+N`,keywords:[`connect`,`server`,`profile`,`login`],disabled:!xe,action:()=>B(()=>a(`connect`))},{id:`disconnect`,label:e(`palette.commands.disconnect`),icon:ce,tone:`red`,keywords:[`disconnect`,`close`],disabled:!R,action:()=>B(()=>{g()})},{id:`read-only`,label:e(`menu.connection.readOnly`),icon:N,tone:`yellow`,keywords:[`read only`,`safety`,`guard`],disabled:!R,checked:F?.readOnly===!0,action:()=>B(()=>{F&&Ce(F.id,{readOnly:!F.readOnly})})},{id:`manual-transactions`,capability:`transactions`,label:e(`menu.connection.manualTransactions`),icon:D,tone:`lavender`,keywords:[`transaction`,`manual`,`autocommit`],disabled:!R,checked:F?.transactionMode===`manual`,action:()=>B(()=>{F&&Ce(F.id,{transactionMode:F.transactionMode===`manual`?`auto`:`manual`})})},{id:`commit`,capability:`transactions`,label:e(`toolbar.commit`),icon:k,tone:`green`,keywords:[`commit`,`transaction`],disabled:!Se||!F,action:()=>B(()=>{F&&w(F.id).catch(V)})},{id:`rollback`,capability:`transactions`,label:e(`toolbar.rollback`),icon:le,tone:`peach`,keywords:[`rollback`,`transaction`,`undo`],disabled:!Se||!F,action:()=>B(()=>{F&&C(F.id).catch(V)})}]},{heading:e(`palette.groups.query`),commands:[{id:`execute`,label:e(`palette.commands.executeQuery`),icon:E,tone:`green`,shortcut:`F9`,keywords:[`run`,`execute`,`sql`],disabled:!R,action:()=>B(()=>{f()})},{id:`stop-query`,label:e(`result.running.stop`),icon:oe,tone:`red`,keywords:[`stop`,`cancel`,`abort`,`kill`],disabled:!z,action:()=>B(()=>{qe()})},{id:`execute-statement`,label:e(`menu.query.executeStatementAtCursor`),icon:De,tone:`green`,shortcut:`Ctrl+Enter`,keywords:[`run`,`statement`,`cursor`],disabled:!R,action:()=>B(()=>{p()})},{id:`execute-script`,label:e(`menu.query.executeWholeScript`),icon:Be,tone:`teal`,shortcut:`Ctrl+Shift+Enter`,keywords:[`run`,`script`,`batch`],disabled:!R,action:()=>B(()=>{m()})},{id:`new-tab`,label:e(`palette.commands.newQueryTab`),icon:re,tone:`blue`,shortcut:`Alt+T`,keywords:[`new`,`tab`,`editor`],disabled:!R,action:()=>B(()=>h())},{id:`find-replace`,label:e(`menu.query.findReplace`),icon:Le,tone:`lavender`,keywords:[`find`,`replace`,`search`],disabled:!R,action:()=>B(()=>a(`find-replace`))},{id:`local-history`,label:e(`menu.query.localHistory`),icon:Ne,tone:`mauve`,keywords:[`history`,`snapshot`,`undo`],disabled:!R,action:()=>B(()=>a(`local-history`))}]},{heading:e(`palette.groups.database`),commands:[{id:`create-db`,capability:`multipleDatabases`,label:e(`palette.commands.createDatabase`),icon:fe,tone:`blue`,keywords:[`create`,`database`,`schema`],disabled:!R,action:()=>B(()=>a(`create-database`))},{id:`alter-db`,capability:`multipleDatabases`,label:e(`menu.database.alter`),icon:Oe,tone:`blue`,keywords:[`alter`,`database`,`charset`],disabled:!R,action:()=>B(()=>a(`alter-database`))},{id:`copy-db`,capability:`multipleDatabases`,label:e(`menu.database.copy`),icon:A,tone:`sky`,keywords:[`copy`,`clone`,`database`],disabled:!R,action:()=>B(()=>a(`copy-database`))},{id:`schema-diff`,label:e(`menu.database.compare`),icon:je,tone:`mauve`,keywords:[`compare`,`diff`,`schema`,`sync`],pro:`compare_schemas`,disabled:!R,action:()=>B(()=>a(`schema-diff`))},{id:`data-diff`,label:e(`menu.database.compareData`),icon:Me,tone:`mauve`,keywords:[`compare`,`diff`,`data`,`rows`],pro:`compare_data`,disabled:!R,action:()=>B(()=>a(`data-diff`))},{id:`group-by`,label:e(`menu.database.groupBy`),icon:ve,tone:`mauve`,keywords:[`group`,`count`,`aggregate`,`distinct`,`summary`],disabled:!R,action:()=>B(()=>a(`group-by`))}]},{heading:e(`palette.groups.table`),commands:[{id:`create-table`,label:e(`palette.commands.createTable`),icon:ue,tone:`green`,keywords:[`create`,`table`],disabled:!R,action:()=>B(()=>a(`create-table`))},{id:`alter-table`,label:e(`palette.commands.alterTable`),icon:me,tone:`yellow`,keywords:[`alter`,`table`,`column`],disabled:!R,action:()=>B(()=>a(`alter-table`))},{id:`duplicate-table`,label:e(`menu.table.duplicateStructure`),icon:Ee,tone:`teal`,keywords:[`duplicate`,`structure`,`table`],disabled:!R,action:()=>B(()=>a(`duplicate-table-structure`))}]},{heading:e(`menu.export.title`),commands:[{id:`export-csv`,label:e(`menu.export.csv`),icon:Ae,tone:`green`,keywords:[`export`,`csv`,`excel`],disabled:!R,action:()=>B(()=>a(`export-csv`))},{id:`export-html`,label:e(`menu.export.schemaHtml`),icon:ke,tone:`peach`,keywords:[`export`,`html`,`schema`,`documentation`],disabled:!R,action:()=>B(()=>a(`export-html`))}]},{heading:e(`palette.groups.tools`),commands:[{id:`process-list`,capability:`processList`,label:e(`palette.commands.processList`),icon:ie,tone:`red`,keywords:[`process`,`kill`,`connections`],disabled:!R,action:()=>B(()=>a(`process-list`))},{id:`variables`,capability:`variables`,label:e(`palette.commands.serverVariables`),icon:Ve,tone:`lavender`,keywords:[`variables`,`server`,`settings`],disabled:!R,action:()=>B(()=>a(`variables`))},{id:`status`,capability:`status`,label:e(`palette.commands.serverStatus`),icon:de,tone:`teal`,keywords:[`status`,`server`,`metrics`],disabled:!R,action:()=>B(()=>a(`status`))},{id:`flush`,capability:`flush`,label:e(`palette.commands.flush`),icon:be,tone:`peach`,keywords:[`flush`,`cache`,`reload`],disabled:!R,action:()=>B(()=>a(`flush`))},{id:`user-manager`,capability:`users`,label:e(`palette.commands.userManager`),icon:_e,tone:`blue`,keywords:[`users`,`grants`,`privileges`],disabled:!R,action:()=>B(()=>a(`user-manager`))},{id:`scratchpad`,label:e(`menu.tools.scratchpad`),icon:ye,tone:`yellow`,keywords:[`scratchpad`,`sqlite`,`local`],pro:`scratchpad`,action:()=>B(()=>{ge().catch(V)})},{id:`federated`,label:e(`menu.tools.federated`),icon:Ue,tone:`mauve`,keywords:[`federated`,`cross`,`join`,`connections`],pro:`federated`,action:()=>B(()=>{te().catch(V)})},{id:`erd`,label:e(`menu.tools.viewErd`),icon:Fe,tone:`sky`,keywords:[`erd`,`diagram`,`relations`],disabled:!R,action:()=>B(Je)}]},{heading:e(`menu.settings.theme`),commands:ae().map(e=>({id:`theme-${e.id}`,label:e.name,tone:`lavender`,keywords:[`theme`,`color`,`appearance`,`dark`,`light`,e.id],checked:we===e.id,swatch:e,action:()=>B(()=>L(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:Pe,tone:`teal`,keywords:[`language`,`locale`,`i18n`,t],checked:We===t,action:()=>B(()=>Ge(t))}))},{heading:e(`menu.settings.title`),commands:[{id:`safety-settings`,label:e(`menu.settings.safety`),icon:He,tone:`yellow`,keywords:[`safety`,`settings`,`row limit`,`preferences`],action:()=>B(()=>a(`safety-settings`))}]},{heading:e(`menu.help.title`),commands:[{id:`documentation`,label:e(`menu.help.documentation`),icon:Te,tone:`blue`,keywords:[`docs`,`documentation`,`manual`,`help`],action:()=>B(()=>{window.open(ne(),`_blank`,`noopener,noreferrer`)})},{id:`getting-started`,label:e(`menu.help.gettingStarted`),icon:Re,tone:`green`,keywords:[`welcome`,`onboarding`,`sample`,`getting started`],action:()=>B(()=>o(!0))},{id:`terms`,label:e(`menu.help.terms`),icon:ze,tone:`peach`,keywords:[`terms`,`privacy`,`legal`],action:()=>B(()=>a(`terms`))},{id:`about`,label:e(`menu.help.about`),icon:pe,tone:`sky`,keywords:[`about`,`version`,`agent`],action:()=>B(()=>a(`about`))}]}];function Xe(e){e||i()}let H=Ye.map(e=>({...e,commands:e.commands.filter(e=>!e.capability||se[e.capability])})).filter(e=>e.commands.length>0);return(0,$.jsxs)(wt,{open:Ke,onOpenChange:Xe,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`)}),H.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||O(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)(M,{className:`ml-0`}),t.checked&&(0,$.jsx)(k,{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{c as t,h as n,n as r,t as i}from"./XzPc-eVf.js";import{l as a,m as ee,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./DkdStXtl.js";import{t as f}from"./DTxGpkJp.js";import{a as p}from"./Cw_LYT6k.js";import{n as m}from"./DbRMSZEW.js";import{a as te,d as ne}from"./D98JmiqU.js";import{Ot as re,at as h,c as g,ct as ie,l as ae,pt as _}from"./2sxOfzyn.js";import{a as oe,i as se,n as ce,o as v,r as y,t as le}from"./DxuXBECK.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function S(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function C(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function w(e,t){return t.has(e.toLowerCase())}function de(e,t){let n=C(t);return e.some(e=>w(e,n))}var T=a(),E=`none`,fe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function D(){let{t:e}=ee(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),x=i(`group-by`),D=n===`group-by`,O=f(e=>e.activeConnections),pe=f(e=>e.activeConnectionId),me=(0,b.useMemo)(()=>O.filter(e=>e.serverConnectionId),[O]),[k,he]=(0,b.useState)(()=>x?.connectionId??pe??``),[A,j]=(0,b.useState)(()=>x?.database??``),[M,N]=(0,b.useState)(()=>x?.table??``),[P,F]=(0,b.useState)([]),[I,L]=(0,b.useState)([]),R=x&&k===x.connectionId&&A===x.database&&M===x.table?x.where??``:``,[z,ge]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(E),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!D||!k)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await m(k).introspect.listDatabases(p(e));if(t)return;F(n),j(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k]),(0,b.useEffect)(()=>{if(!D||!k||!A)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await m(k).introspect.listTables(p(e),A);if(t)return;let r=n.map(e=>e.name);L(r),N(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A]),(0,b.useEffect)(()=>{if(!D||!k||!M)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{let n=p(e),r=m(k).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,A,M),r.listIndexes(n,A,M).catch(()=>[])]);if(t)return;ge(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A,M]);let Ce=(0,b.useMemo)(()=>C(B),[B]),we=(0,b.useMemo)(()=>z.filter(e=>fe.test(e.type)),[z]),Z=(0,b.useMemo)(()=>!k||V.length===0?``:S(m(k),{database:A,table:M,columns:V,aggregate:U!==E&&W?{fn:U,column:W}:null,where:K?R:``,minCount:Number(G)||1,limit:ne()}),[k,A,M,V,U,W,G,K,R]),Q=V.length>0&&B.length>0&&!de(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:m(k).id,columns:V.length,aggregate:U,filtered:!!(K&&R),indexed:!Q})}function Ee(){Z&&($(`open`),h(k,Z,A,e(`database.groupBy.tabTitle`,{table:M})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=h(k,Z,A,e(`database.groupBy.tabTitle`,{table:M}));a();try{await te(k,t)}finally{Y(!1)}}return(0,T.jsx)(le,{open:D,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,T.jsxs)(oe,{children:[(0,T.jsx)(v,{children:e(`database.groupBy.title`)}),(0,T.jsx)(y,{children:e(`database.groupBy.description`,{table:M})})]}),q&&(0,T.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,T.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,T.jsxs)(d,{value:k,onValueChange:he,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:me.map(e=>(0,T.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,T.jsxs)(d,{value:A,onValueChange:j,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:P.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,T.jsxs)(d,{value:M,onValueChange:N,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:I.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,T.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,T.jsx)(ie,{className:`h-[260px] rounded-md border`,children:(0,T.jsx)(`ul`,{className:`p-1`,children:z.map(t=>{let n=w(t.name,Ce);return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,T.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,T.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,T.jsx)(re,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsxs)(d,{value:U,onValueChange:ve,children:[(0,T.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsxs)(l,{children:[(0,T.jsx)(u,{value:E,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,T.jsx)(u,{value:e,children:e},e))]})]}),(0,T.jsxs)(d,{value:W,onValueChange:ye,disabled:U===E,children:[(0,T.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,T.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,T.jsx)(l,{children:we.map(e=>(0,T.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,T.jsx)(ae,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),R&&(0,T.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,T.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,T.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,T.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,T.jsxs)(se,{children:[(0,T.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,T.jsx)(o,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,T.jsx)(o,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{D as GroupByDialog};
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 ee,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./D_2UqK4k.js";import{t as f}from"./DTxGpkJp.js";import{a as p}from"./Cw_LYT6k.js";import{n as m}from"./DbRMSZEW.js";import{a as te,d as ne}from"./DlKZCiMg.js";import{Ot as re,at as h,c as g,ct as ie,l as ae,pt as _}from"./D7Ze5md9.js";import{a as oe,i as se,n as ce,o as v,r as y,t as le}from"./DxuXBECK.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function S(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function C(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function w(e,t){return t.has(e.toLowerCase())}function de(e,t){let n=C(t);return e.some(e=>w(e,n))}var T=a(),E=`none`,fe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function D(){let{t:e}=ee(),n=r(e=>e.activeDialog),a=r(e=>e.closeDialog),x=i(`group-by`),D=n===`group-by`,O=f(e=>e.activeConnections),pe=f(e=>e.activeConnectionId),me=(0,b.useMemo)(()=>O.filter(e=>e.serverConnectionId),[O]),[k,he]=(0,b.useState)(()=>x?.connectionId??pe??``),[A,j]=(0,b.useState)(()=>x?.database??``),[M,N]=(0,b.useState)(()=>x?.table??``),[P,F]=(0,b.useState)([]),[I,L]=(0,b.useState)([]),R=x&&k===x.connectionId&&A===x.database&&M===x.table?x.where??``:``,[z,ge]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(E),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!D||!k)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await m(k).introspect.listDatabases(p(e));if(t)return;F(n),j(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k]),(0,b.useEffect)(()=>{if(!D||!k||!A)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await m(k).introspect.listTables(p(e),A);if(t)return;let r=n.map(e=>e.name);L(r),N(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A]),(0,b.useEffect)(()=>{if(!D||!k||!M)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{let n=p(e),r=m(k).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,A,M),r.listIndexes(n,A,M).catch(()=>[])]);if(t)return;ge(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A,M]);let Ce=(0,b.useMemo)(()=>C(B),[B]),we=(0,b.useMemo)(()=>z.filter(e=>fe.test(e.type)),[z]),Z=(0,b.useMemo)(()=>!k||V.length===0?``:S(m(k),{database:A,table:M,columns:V,aggregate:U!==E&&W?{fn:U,column:W}:null,where:K?R:``,minCount:Number(G)||1,limit:ne()}),[k,A,M,V,U,W,G,K,R]),Q=V.length>0&&B.length>0&&!de(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:m(k).id,columns:V.length,aggregate:U,filtered:!!(K&&R),indexed:!Q})}function Ee(){Z&&($(`open`),h(k,Z,A,e(`database.groupBy.tabTitle`,{table:M})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=h(k,Z,A,e(`database.groupBy.tabTitle`,{table:M}));a();try{await te(k,t)}finally{Y(!1)}}return(0,T.jsx)(le,{open:D,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,T.jsxs)(oe,{children:[(0,T.jsx)(v,{children:e(`database.groupBy.title`)}),(0,T.jsx)(y,{children:e(`database.groupBy.description`,{table:M})})]}),q&&(0,T.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,T.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,T.jsxs)(d,{value:k,onValueChange:he,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:me.map(e=>(0,T.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,T.jsxs)(d,{value:A,onValueChange:j,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:P.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,T.jsxs)(d,{value:M,onValueChange:N,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:I.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,T.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,T.jsx)(ie,{className:`h-[260px] rounded-md border`,children:(0,T.jsx)(`ul`,{className:`p-1`,children:z.map(t=>{let n=w(t.name,Ce);return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,T.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,T.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,T.jsx)(re,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsxs)(d,{value:U,onValueChange:ve,children:[(0,T.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsxs)(l,{children:[(0,T.jsx)(u,{value:E,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,T.jsx)(u,{value:e,children:e},e))]})]}),(0,T.jsxs)(d,{value:W,onValueChange:ye,disabled:U===E,children:[(0,T.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,T.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,T.jsx)(l,{children:we.map(e=>(0,T.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,T.jsx)(ae,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),R&&(0,T.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,T.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,T.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(g,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,T.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,T.jsxs)(se,{children:[(0,T.jsx)(o,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,T.jsx)(o,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,T.jsx)(o,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{D as GroupByDialog};
@@ -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"./CCBE6CSG.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"./NY_tAtcY.js";var p=t();function m(){let t=e(e=>e.activeDialog),m=e(e=>e.closeDialog),h=i(),g=h.update,{t:_}=n();return(0,p.jsx)(d,{open:t===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(c,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(o,{children:[(0,p.jsx)(l,{children:_(`settings.title`)}),(0,p.jsx)(u,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(s,{children:[(0,p.jsx)(r,{variant:`ghost`,onClick:()=>g(a),children:_(`settings.resetDefaults`)}),(0,p.jsx)(r,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t}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{S as c,_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./CZQ1r4zz.js";import{t as x}from"./CmJ3siBN.js";import{Gt as S,Ht as C,It as w,Jt as T,Kt as E,Lt as D,Ut as O,Wt as k,Yt as A,qt as j}from"./2sxOfzyn.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]=T(V),[G,te]=c(V,[W,E]),K=E(),[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:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=K(t),[v,y]=N.useState(null),[x,C]=N.useState(null),[w,T]=N.useState(!1),E=j(u),[D,O]=b({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=b({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=l(),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:x,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(S,{..._,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)(O,{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:y(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:y(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:y(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,d=q(ce,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,m=a(t,d.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=$(d.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)(g,{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 u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(v,{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:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,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 _(E)},[E]),f();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:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,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)(d,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:y(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(m,{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:y(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,d]=N.useState(null),[f,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&&f&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=f.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=C(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=C(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(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),w=window.getComputedStyle(v),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+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=f.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,d+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,f,v,y,b,s.dir,r]);u(()=>S(),[S]);let[w,T]=N.useState();u(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]);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:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},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:y(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,u=q(De,n),d=Z(De,n),f=u.value===r,[m,h]=N.useState(s??``),[g,_]=N.useState(!1),v=p(e=>d.itemRefCallback?.(e,r,i)),b=a(t,v),x=l(),S=N.useRef(`touch`),C=R(()=>{i||(u.onValueChange(r),u.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:f,onItemTextChange:N.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(o.div,{role:`option`,"aria-labelledby":x,"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:b,onFocus:y(c.onFocus,()=>_(!0)),onBlur:y(c.onBlur,()=>_(!1)),onClick:y(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:y(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:y(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:y(c.onPointerMove,e=>{S.current=e.pointerType,i?d.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:y(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:y(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(d.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),d=ke(Q,n),f=ie(Q,n),[m,h]=N.useState(null),g=p(e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),_=a(t,h,d.onItemTextChange,g),v=m?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return u(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.span,{id:d.textId,...s,ref:_}),d.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 u(()=>{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 u(()=>{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]),u(()=>{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:y(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:y(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:y(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:c,disabled:l,name:u,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=N.useRef(null),g=a(n,h),_=i??``,v=F(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(o.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:u,autoComplete:d,disabled:l,form:f,onChange:e=>s(e.target.value),...t,style:{...A,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`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=p(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)(w,{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)(D,{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)(x,{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)(w,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
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{S as c,_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./CZQ1r4zz.js";import{t as x}from"./CmJ3siBN.js";import{Gt as S,Ht as C,It as w,Jt as T,Kt as E,Lt as D,Ut as O,Wt as k,Yt as A,qt as j}from"./D7Ze5md9.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]=T(V),[G,te]=c(V,[W,E]),K=E(),[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:u,name:d,autoComplete:f,disabled:p,required:m,form:h,internal_do_not_use_render:g}=e,_=K(t),[v,y]=N.useState(null),[x,C]=N.useState(null),[w,T]=N.useState(!1),E=j(u),[D,O]=b({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[k,A]=b({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=l(),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:x,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:k,onValueChange:A,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:d,autoComplete:f,form:h,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(S,{..._,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)(O,{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:y(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:y(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:y(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,d=q(ce,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,m=a(t,d.onValueNodeChange);u(()=>{f(p)},[f,p]);let h=$(d.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)(g,{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 u(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(v,{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:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,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 _(E)},[E]),f();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:p,arrowPadding:g,collisionBoundary:v,collisionPadding:b,sticky:x,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)(d,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:y(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(m,{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:y(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,d]=N.useState(null),[f,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&&f&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=f.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=C(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=C(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(f),d=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=d+p+c+_+m,S=Math.min(y.offsetHeight*5,x),w=window.getComputedStyle(v),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=d+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=f.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,d+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,f,v,y,b,s.dir,r]);u(()=>S(),[S]);let[w,T]=N.useState();u(()=>{f&&T(window.getComputedStyle(f).zIndex)},[f]);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:d,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},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:y(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,u=q(De,n),d=Z(De,n),f=u.value===r,[m,h]=N.useState(s??``),[g,_]=N.useState(!1),v=p(e=>d.itemRefCallback?.(e,r,i)),b=a(t,v),x=l(),S=N.useRef(`touch`),C=R(()=>{i||(u.onValueChange(r),u.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:n,value:r,disabled:i,textId:x,isSelected:f,onItemTextChange:N.useCallback(e=>{h(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:m,children:(0,I.jsx)(o.div,{role:`option`,"aria-labelledby":x,"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:b,onFocus:y(c.onFocus,()=>_(!0)),onBlur:y(c.onBlur,()=>_(!1)),onClick:y(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:y(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:y(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:y(c.onPointerMove,e=>{S.current=e.pointerType,i?d.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:y(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:y(c.onKeyDown,e=>{i||e.target!==e.currentTarget||(d.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),d=ke(Q,n),f=ie(Q,n),[m,h]=N.useState(null),g=p(e=>l.itemTextRefCallback?.(e,d.value,d.disabled)),_=a(t,h,d.onItemTextChange,g),v=m?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=f;return u(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o.span,{id:d.textId,...s,ref:_}),d.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 u(()=>{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 u(()=>{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]),u(()=>{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:y(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:y(i.onPointerMove,()=>{a.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:y(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:c,disabled:l,name:u,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=N.useRef(null),g=a(n,h),_=i??``,v=F(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,I.jsxs)(o.select,{"aria-hidden":!0,required:c,tabIndex:-1,name:u,autoComplete:d,disabled:l,form:f,onChange:e=>s(e.target.value),...t,style:{...A,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,I.jsx)(`option`,{value:``}):null,Array.from(p)]},m)},`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=p(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)(w,{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)(D,{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)(x,{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)(w,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c}from"./ClyAuDY9.js";import{t as l}from"./DTxGpkJp.js";import{c as u}from"./Cw_LYT6k.js";import{t as d}from"./DbRMSZEW.js";import{Bt as f,C as p,Lt as ee,Mt as te,S as ne,Vt as re,b as m,bt as ie,v as h,x as g,xt as _,y as v,zt as ae}from"./2sxOfzyn.js";import{a as oe,i as se,n as ce,o as le,t as ue}from"./DxuXBECK.js";var de=r(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),y=r(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),b=r(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),x=r(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),S=e(t(),1),C=a(),w=10,fe=[2,5,10,30];function T(){let e=l.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function pe(){let e=T();if(!e)throw Error(c.t(`command.noActiveConnection`));let t=await u(e,d().getQuery(`SHOW_PROCESS_LIST`));return t.records.map(e=>{let n={};return t.fields.forEach((t,r)=>{n[t.name]=e[r]}),{...n,Id:String(n.Id)}})}function E(e){return/^(sleep|idle)/i.test(e.Command??``)}function me(e){return/lock/i.test(e.State??``)}function he(e){return/PROCESSLIST|pg_stat_activity/i.test(e.Info??``)}function D(e){let t=Number(e.Time);return Number.isFinite(t)?t:0}function O(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function k({icon:e,label:t,value:n,tone:r}){return(0,C.jsxs)(`div`,{className:`flex min-w-[120px] flex-1 items-center gap-2.5 rounded-md border bg-muted/30 px-3 py-1.5`,children:[(0,C.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md [&_svg]:size-3.5 ${r===`warn`?`bg-catppuccin-yellow/15 text-catppuccin-yellow`:`bg-primary/10 text-primary`}`,children:e}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`truncate text-sm font-semibold tabular-nums`,children:n})]})]})}function A(){let{t:e}=o(),{activeDialog:t,closeDialog:r,setFooterMessage:a,requestDestructiveConfirm:c}=n(),[l,A]=(0,S.useState)([]),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(5),[F,I]=(0,S.useState)(null),[L,R]=(0,S.useState)(``),[z,ge]=(0,S.useState)(!1),[B,_e]=(0,S.useState)(!0),[V,H]=(0,S.useState)(!1),[U,ve]=(0,S.useState)(null),[W,G]=(0,S.useState)(!1),K=(0,S.useRef)(null),q=t===`process-list`,J=(0,S.useCallback)(()=>Promise.resolve().then(()=>(H(!0),pe())).then(e=>{A(e),ve(new Date)}).catch(t=>a(e(`command.processList.loadError`,{message:t instanceof Error?t.message:String(t)}))).finally(()=>H(!1)),[a,e]);(0,S.useEffect)(()=>{q&&J()},[q,J]),(0,S.useEffect)(()=>(K.current&&=(clearInterval(K.current),null),j&&q&&(K.current=setInterval(()=>{J()},N*1e3)),()=>{K.current&&=(clearInterval(K.current),null)}),[j,N,q,J]);function Y(e){e||(M(!1),I(null),R(``),r())}let X=(0,S.useMemo)(()=>{let e=l.filter(E).length,t=l.filter(e=>!E(e)).reduce((e,t)=>Math.max(e,D(t)),0);return{total:l.length,active:l.length-e,idle:e,longest:t}},[l]),Z=(0,S.useMemo)(()=>{let e=L.trim().toLowerCase();return l.filter(t=>z&&E(t)?!1:!e||[t.Id,t.User,t.Host,t.db,t.Command,t.State,t.Info].some(t=>(t??``).toString().toLowerCase().includes(e))).sort((e,t)=>B?D(t)-D(e):D(e)-D(t))},[l,L,z,B]),Q=l.find(e=>e.Id===F)??null,ye=(0,S.useCallback)(()=>{Q?.Info&&navigator.clipboard.writeText(Q.Info).then(()=>{G(!0),setTimeout(()=>G(!1),1500)})},[Q]);async function $(t){let n=t??F;if(!n){a(e(`command.processList.selectToKill`));return}let r=T();if(!r)return;let i=l.find(e=>e.Id===n),o=d().getQuery(`KILL_QUERY`,String(n));if(await c({title:e(`command.processList.killConfirmTitle`,{id:n}),description:e(`command.processList.killConfirmDescription`,{user:i?.User??`?`,host:i?.Host??`?`}),confirmLabel:e(`command.processList.killProcess`),statements:[o]}))try{await u(r,o),a(e(`command.processList.killed`,{id:n})),F===n&&I(null),J()}catch(t){a(e(`command.processList.killError`,{message:t instanceof Error?t.message:String(t)}))}}return(0,C.jsx)(ue,{open:q,onOpenChange:Y,children:(0,C.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,C.jsx)(oe,{children:(0,C.jsxs)(le,{className:`flex items-center gap-2`,children:[e(`command.processList.title`),U&&(0,C.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:e(`command.processList.updatedAt`,{time:U.toLocaleTimeString(void 0,{hour12:!1})})})]})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(k,{icon:(0,C.jsx)(de,{}),label:e(`command.processList.stats.total`),value:X.total}),(0,C.jsx)(k,{icon:(0,C.jsx)(re,{}),label:e(`command.processList.stats.active`),value:X.active}),(0,C.jsx)(k,{icon:(0,C.jsx)(y,{}),label:e(`command.processList.stats.idle`),value:X.idle}),(0,C.jsx)(k,{icon:(0,C.jsx)(x,{}),label:e(`command.processList.stats.longest`),value:O(X.longest),tone:X.longest>=w?`warn`:void 0})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(ie,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:e(`command.processList.filterPlaceholder`),value:L,onChange:e=>R(e.target.value)}),L&&(0,C.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>R(``),children:(0,C.jsx)(i,{className:`size-3`})})]}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:z,onChange:e=>ge(e.target.checked)}),e(`command.processList.hideIdle`)]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:j,onChange:e=>M(e.target.checked)}),e(`command.processList.autoRefresh`)]}),(0,C.jsx)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs disabled:opacity-50`,value:N,onChange:e=>P(Number(e.target.value)),disabled:!j,children:fe.map(e=>(0,C.jsxs)(`option`,{value:e,children:[e,`s`]},e))}),(0,C.jsxs)(s,{variant:`outline`,size:`sm`,className:`h-7`,onClick:()=>{J()},disabled:V,children:[(0,C.jsx)(_,{className:`mr-1 size-3.5 ${V?`animate-spin`:``}`}),e(`command.processList.refresh`)]})]}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border`,children:(0,C.jsxs)(h,{className:`text-xs`,children:[(0,C.jsx)(ne,{className:`sticky top-0 z-10 bg-background`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(g,{className:`w-[70px]`,children:e(`command.processList.columns.id`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.user`)}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.host`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.db`)}),(0,C.jsx)(g,{className:`w-[90px]`,children:e(`command.processList.columns.command`)}),(0,C.jsx)(g,{className:`w-[80px] cursor-pointer select-none`,onClick:()=>_e(e=>!e),children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e(`command.processList.columns.time`),B?(0,C.jsx)(f,{className:`size-3 text-primary`}):(0,C.jsx)(ae,{className:`size-3 text-primary`})]})}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.state`)}),(0,C.jsx)(g,{children:e(`command.processList.columns.info`)}),(0,C.jsx)(g,{className:`w-[50px]`})]})}),(0,C.jsx)(v,{children:Z.length===0?(0,C.jsx)(p,{children:(0,C.jsx)(m,{colSpan:9,className:`py-8 text-center text-muted-foreground`,children:l.length===0?e(`command.processList.empty`):e(`command.processList.noMatch`)})}):Z.map(t=>{let n=E(t),r=D(t),i=!n&&r>=w,a=me(t),o=he(t);return(0,C.jsxs)(p,{"data-state":F===t.Id?`selected`:void 0,className:`cursor-pointer ${n?`text-muted-foreground`:``} ${a?`bg-destructive/5`:i?`bg-catppuccin-yellow/5`:``}`,onClick:()=>I(t.Id),children:[(0,C.jsx)(m,{className:`font-mono tabular-nums`,children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t.Id,o&&(0,C.jsx)(`span`,{className:`rounded bg-primary/10 px-1 text-[9px] font-semibold text-primary`,title:e(`command.processList.selfHint`),children:e(`command.processList.self`)})]})}),(0,C.jsx)(m,{children:t.User}),(0,C.jsx)(m,{className:`font-mono`,children:t.Host}),(0,C.jsx)(m,{className:`font-mono`,children:t.db??``}),(0,C.jsx)(m,{children:(0,C.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${n?`bg-muted`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,children:t.Command})}),(0,C.jsx)(m,{className:`tabular-nums ${i?`font-semibold text-catppuccin-yellow`:``}`,children:O(r)}),(0,C.jsx)(m,{className:a?`font-medium text-destructive`:``,children:t.State}),(0,C.jsx)(m,{className:`max-w-[260px] truncate font-mono`,title:t.Info??``,children:t.Info??``}),(0,C.jsx)(m,{className:`text-right`,children:(0,C.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,title:e(`command.processList.kill`),onClick:e=>{e.stopPropagation(),$(t.Id)},children:(0,C.jsx)(b,{className:`size-3.5`})})})]},t.Id)})})]})}),Q&&(0,C.jsxs)(`div`,{className:`shrink-0 rounded-md border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`command.processList.statementOf`,{id:Q.Id})}),(0,C.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[Q.User,`@`,Q.Host,Q.db?` · ${Q.db}`:``]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:ye,disabled:!Q.Info,children:[W?(0,C.jsx)(ee,{className:`size-3`}):(0,C.jsx)(te,{className:`size-3`}),e(W?`command.processList.copied`:`command.processList.copy`)]})]}),(0,C.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Q.Info||(0,C.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`command.processList.noStatement`)})})]}),(0,C.jsxs)(se,{children:[(0,C.jsx)(s,{variant:`destructive`,onClick:()=>{$()},disabled:!F,children:e(`command.processList.killProcess`)}),(0,C.jsx)(s,{variant:`outline`,onClick:()=>Y(!1),children:e(`command.close`)})]})]})})}export{A as ProcessListDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,i,l as a,m as o,t as s}from"./CKOS5Y-e.js";import{a as c}from"./ClyAuDY9.js";import{t as l}from"./DTxGpkJp.js";import{c as u}from"./Cw_LYT6k.js";import{t as d}from"./DbRMSZEW.js";import{Bt as f,C as p,Lt as ee,Mt as te,S as ne,Vt as re,b as m,bt as ie,v as h,x as g,xt as _,y as v,zt as ae}from"./D7Ze5md9.js";import{a as oe,i as se,n as ce,o as le,t as ue}from"./DxuXBECK.js";var de=r(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),y=r(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),b=r(`skull`,[[`path`,{d:`m12.5 17-.5-1-.5 1h1z`,key:`3me087`}],[`path`,{d:`M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z`,key:`1o5pge`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}]]),x=r(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),S=e(t(),1),C=a(),w=10,fe=[2,5,10,30];function T(){let e=l.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function pe(){let e=T();if(!e)throw Error(c.t(`command.noActiveConnection`));let t=await u(e,d().getQuery(`SHOW_PROCESS_LIST`));return t.records.map(e=>{let n={};return t.fields.forEach((t,r)=>{n[t.name]=e[r]}),{...n,Id:String(n.Id)}})}function E(e){return/^(sleep|idle)/i.test(e.Command??``)}function me(e){return/lock/i.test(e.State??``)}function he(e){return/PROCESSLIST|pg_stat_activity/i.test(e.Info??``)}function D(e){let t=Number(e.Time);return Number.isFinite(t)?t:0}function O(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function k({icon:e,label:t,value:n,tone:r}){return(0,C.jsxs)(`div`,{className:`flex min-w-[120px] flex-1 items-center gap-2.5 rounded-md border bg-muted/30 px-3 py-1.5`,children:[(0,C.jsx)(`div`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md [&_svg]:size-3.5 ${r===`warn`?`bg-catppuccin-yellow/15 text-catppuccin-yellow`:`bg-primary/10 text-primary`}`,children:e}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:t}),(0,C.jsx)(`div`,{className:`truncate text-sm font-semibold tabular-nums`,children:n})]})]})}function A(){let{t:e}=o(),{activeDialog:t,closeDialog:r,setFooterMessage:a,requestDestructiveConfirm:c}=n(),[l,A]=(0,S.useState)([]),[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(5),[F,I]=(0,S.useState)(null),[L,R]=(0,S.useState)(``),[z,ge]=(0,S.useState)(!1),[B,_e]=(0,S.useState)(!0),[V,H]=(0,S.useState)(!1),[U,ve]=(0,S.useState)(null),[W,G]=(0,S.useState)(!1),K=(0,S.useRef)(null),q=t===`process-list`,J=(0,S.useCallback)(()=>Promise.resolve().then(()=>(H(!0),pe())).then(e=>{A(e),ve(new Date)}).catch(t=>a(e(`command.processList.loadError`,{message:t instanceof Error?t.message:String(t)}))).finally(()=>H(!1)),[a,e]);(0,S.useEffect)(()=>{q&&J()},[q,J]),(0,S.useEffect)(()=>(K.current&&=(clearInterval(K.current),null),j&&q&&(K.current=setInterval(()=>{J()},N*1e3)),()=>{K.current&&=(clearInterval(K.current),null)}),[j,N,q,J]);function Y(e){e||(M(!1),I(null),R(``),r())}let X=(0,S.useMemo)(()=>{let e=l.filter(E).length,t=l.filter(e=>!E(e)).reduce((e,t)=>Math.max(e,D(t)),0);return{total:l.length,active:l.length-e,idle:e,longest:t}},[l]),Z=(0,S.useMemo)(()=>{let e=L.trim().toLowerCase();return l.filter(t=>z&&E(t)?!1:!e||[t.Id,t.User,t.Host,t.db,t.Command,t.State,t.Info].some(t=>(t??``).toString().toLowerCase().includes(e))).sort((e,t)=>B?D(t)-D(e):D(e)-D(t))},[l,L,z,B]),Q=l.find(e=>e.Id===F)??null,ye=(0,S.useCallback)(()=>{Q?.Info&&navigator.clipboard.writeText(Q.Info).then(()=>{G(!0),setTimeout(()=>G(!1),1500)})},[Q]);async function $(t){let n=t??F;if(!n){a(e(`command.processList.selectToKill`));return}let r=T();if(!r)return;let i=l.find(e=>e.Id===n),o=d().getQuery(`KILL_QUERY`,String(n));if(await c({title:e(`command.processList.killConfirmTitle`,{id:n}),description:e(`command.processList.killConfirmDescription`,{user:i?.User??`?`,host:i?.Host??`?`}),confirmLabel:e(`command.processList.killProcess`),statements:[o]}))try{await u(r,o),a(e(`command.processList.killed`,{id:n})),F===n&&I(null),J()}catch(t){a(e(`command.processList.killError`,{message:t instanceof Error?t.message:String(t)}))}}return(0,C.jsx)(ue,{open:q,onOpenChange:Y,children:(0,C.jsxs)(ce,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,C.jsx)(oe,{children:(0,C.jsxs)(le,{className:`flex items-center gap-2`,children:[e(`command.processList.title`),U&&(0,C.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:e(`command.processList.updatedAt`,{time:U.toLocaleTimeString(void 0,{hour12:!1})})})]})}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(k,{icon:(0,C.jsx)(de,{}),label:e(`command.processList.stats.total`),value:X.total}),(0,C.jsx)(k,{icon:(0,C.jsx)(re,{}),label:e(`command.processList.stats.active`),value:X.active}),(0,C.jsx)(k,{icon:(0,C.jsx)(y,{}),label:e(`command.processList.stats.idle`),value:X.idle}),(0,C.jsx)(k,{icon:(0,C.jsx)(x,{}),label:e(`command.processList.stats.longest`),value:O(X.longest),tone:X.longest>=w?`warn`:void 0})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(ie,{className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,C.jsx)(`input`,{className:`h-7 w-56 rounded border bg-background pl-7 pr-6 text-xs placeholder:text-muted-foreground`,placeholder:e(`command.processList.filterPlaceholder`),value:L,onChange:e=>R(e.target.value)}),L&&(0,C.jsx)(`button`,{type:`button`,className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>R(``),children:(0,C.jsx)(i,{className:`size-3`})})]}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:z,onChange:e=>ge(e.target.checked)}),e(`command.processList.hideIdle`)]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5 text-xs`,children:[(0,C.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:j,onChange:e=>M(e.target.checked)}),e(`command.processList.autoRefresh`)]}),(0,C.jsx)(`select`,{className:`h-7 rounded border bg-background px-1.5 text-xs disabled:opacity-50`,value:N,onChange:e=>P(Number(e.target.value)),disabled:!j,children:fe.map(e=>(0,C.jsxs)(`option`,{value:e,children:[e,`s`]},e))}),(0,C.jsxs)(s,{variant:`outline`,size:`sm`,className:`h-7`,onClick:()=>{J()},disabled:V,children:[(0,C.jsx)(_,{className:`mr-1 size-3.5 ${V?`animate-spin`:``}`}),e(`command.processList.refresh`)]})]}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border`,children:(0,C.jsxs)(h,{className:`text-xs`,children:[(0,C.jsx)(ne,{className:`sticky top-0 z-10 bg-background`,children:(0,C.jsxs)(p,{children:[(0,C.jsx)(g,{className:`w-[70px]`,children:e(`command.processList.columns.id`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.user`)}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.host`)}),(0,C.jsx)(g,{className:`w-[100px]`,children:e(`command.processList.columns.db`)}),(0,C.jsx)(g,{className:`w-[90px]`,children:e(`command.processList.columns.command`)}),(0,C.jsx)(g,{className:`w-[80px] cursor-pointer select-none`,onClick:()=>_e(e=>!e),children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[e(`command.processList.columns.time`),B?(0,C.jsx)(f,{className:`size-3 text-primary`}):(0,C.jsx)(ae,{className:`size-3 text-primary`})]})}),(0,C.jsx)(g,{className:`w-[130px]`,children:e(`command.processList.columns.state`)}),(0,C.jsx)(g,{children:e(`command.processList.columns.info`)}),(0,C.jsx)(g,{className:`w-[50px]`})]})}),(0,C.jsx)(v,{children:Z.length===0?(0,C.jsx)(p,{children:(0,C.jsx)(m,{colSpan:9,className:`py-8 text-center text-muted-foreground`,children:l.length===0?e(`command.processList.empty`):e(`command.processList.noMatch`)})}):Z.map(t=>{let n=E(t),r=D(t),i=!n&&r>=w,a=me(t),o=he(t);return(0,C.jsxs)(p,{"data-state":F===t.Id?`selected`:void 0,className:`cursor-pointer ${n?`text-muted-foreground`:``} ${a?`bg-destructive/5`:i?`bg-catppuccin-yellow/5`:``}`,onClick:()=>I(t.Id),children:[(0,C.jsx)(m,{className:`font-mono tabular-nums`,children:(0,C.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t.Id,o&&(0,C.jsx)(`span`,{className:`rounded bg-primary/10 px-1 text-[9px] font-semibold text-primary`,title:e(`command.processList.selfHint`),children:e(`command.processList.self`)})]})}),(0,C.jsx)(m,{children:t.User}),(0,C.jsx)(m,{className:`font-mono`,children:t.Host}),(0,C.jsx)(m,{className:`font-mono`,children:t.db??``}),(0,C.jsx)(m,{children:(0,C.jsx)(`span`,{className:`rounded px-1.5 py-px text-[10px] font-medium ${n?`bg-muted`:`bg-green-500/10 text-green-600 dark:text-green-400`}`,children:t.Command})}),(0,C.jsx)(m,{className:`tabular-nums ${i?`font-semibold text-catppuccin-yellow`:``}`,children:O(r)}),(0,C.jsx)(m,{className:a?`font-medium text-destructive`:``,children:t.State}),(0,C.jsx)(m,{className:`max-w-[260px] truncate font-mono`,title:t.Info??``,children:t.Info??``}),(0,C.jsx)(m,{className:`text-right`,children:(0,C.jsx)(`button`,{type:`button`,className:`rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,title:e(`command.processList.kill`),onClick:e=>{e.stopPropagation(),$(t.Id)},children:(0,C.jsx)(b,{className:`size-3.5`})})})]},t.Id)})})]})}),Q&&(0,C.jsxs)(`div`,{className:`shrink-0 rounded-md border`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-1`,children:[(0,C.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`command.processList.statementOf`,{id:Q.Id})}),(0,C.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[Q.User,`@`,Q.Host,Q.db?` · ${Q.db}`:``]}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-40`,onClick:ye,disabled:!Q.Info,children:[W?(0,C.jsx)(ee,{className:`size-3`}):(0,C.jsx)(te,{className:`size-3`}),e(W?`command.processList.copied`:`command.processList.copy`)]})]}),(0,C.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Q.Info||(0,C.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`command.processList.noStatement`)})})]}),(0,C.jsxs)(se,{children:[(0,C.jsx)(s,{variant:`destructive`,onClick:()=>{$()},disabled:!F,children:e(`command.processList.killProcess`)}),(0,C.jsx)(s,{variant:`outline`,onClick:()=>Y(!1),children:e(`command.close`)})]})]})})}export{A as ProcessListDialog};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./DTxGpkJp.js";import{n as c}from"./DbRMSZEW.js";import{l,m as u}from"./D98JmiqU.js";import{c as d,l as f,rt as p}from"./2sxOfzyn.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";var y=e(t(),1),b=i();function x(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),x=r(`create-schema`),S=t===`create-schema`,[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null);function k(e){e||(i(),w(``),O(null))}async function A(){let e=x?.connectionId??s.getState().activeConnectionId,t=C.trim();if(!(!e||!t)){O(null),E(!0);try{await l(e,c(e).getQuery(`CREATE_SCHEMA`,t)),await u(e),k(!1)}catch(e){O(e instanceof Error?e.message:String(e))}finally{E(!1)}}}return(0,b.jsx)(v,{open:S,onOpenChange:k,children:(0,b.jsxs)(g,{className:`sm:max-w-[420px]`,children:[(0,b.jsx)(m,{children:(0,b.jsx)(_,{children:e(`database.schema.createTitle`)})}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(d,{htmlFor:`schema-name`,children:e(`database.schema.name`)}),(0,b.jsx)(f,{id:`schema-name`,value:C,autoFocus:!0,placeholder:e(`database.schema.namePlaceholder`),onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!p(e)&&A()}})]}),D&&(0,b.jsx)(`p`,{className:`text-xs text-destructive leading-relaxed`,children:D}),(0,b.jsxs)(h,{children:[(0,b.jsx)(o,{variant:`outline`,onClick:()=>k(!1),children:e(`database.schema.cancel`)}),(0,b.jsx)(o,{onClick:()=>void A(),disabled:!C.trim()||T,children:e(`database.schema.create`)})]})]})})}export{x as CreateSchemaDialog};
1
+ import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./DTxGpkJp.js";import{n as c}from"./DbRMSZEW.js";import{l,m as u}from"./DlKZCiMg.js";import{c as d,l as f,rt as p}from"./D7Ze5md9.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";var y=e(t(),1),b=i();function x(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),x=r(`create-schema`),S=t===`create-schema`,[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null);function k(e){e||(i(),w(``),O(null))}async function A(){let e=x?.connectionId??s.getState().activeConnectionId,t=C.trim();if(!(!e||!t)){O(null),E(!0);try{await l(e,c(e).getQuery(`CREATE_SCHEMA`,t)),await u(e),k(!1)}catch(e){O(e instanceof Error?e.message:String(e))}finally{E(!1)}}}return(0,b.jsx)(v,{open:S,onOpenChange:k,children:(0,b.jsxs)(g,{className:`sm:max-w-[420px]`,children:[(0,b.jsx)(m,{children:(0,b.jsx)(_,{children:e(`database.schema.createTitle`)})}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(d,{htmlFor:`schema-name`,children:e(`database.schema.name`)}),(0,b.jsx)(f,{id:`schema-name`,value:C,autoFocus:!0,placeholder:e(`database.schema.namePlaceholder`),onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!p(e)&&A()}})]}),D&&(0,b.jsx)(`p`,{className:`text-xs text-destructive leading-relaxed`,children:D}),(0,b.jsxs)(h,{children:[(0,b.jsx)(o,{variant:`outline`,onClick:()=>k(!1),children:e(`database.schema.cancel`)}),(0,b.jsx)(o,{onClick:()=>void A(),disabled:!C.trim()||T,children:e(`database.schema.create`)})]})]})})}export{x as CreateSchemaDialog};
@@ -1 +1 @@
1
- import{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"./2sxOfzyn.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"./8OZbP3hw.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{I as s,L as c,R as l,c as u,t as d}from"./D7Ze5md9.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"./CkgLFvM5.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,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/2sxOfzyn.js","assets/hePW80VL.js","assets/XzPc-eVf.js","assets/CKOS5Y-e.js","assets/ClyAuDY9.js","assets/CZQ1r4zz.js","assets/eFSiW0Lh.js","assets/DTxGpkJp.js","assets/BBSxV90W.js","assets/BdPEUnLq.js","assets/Bit0Kfog.js","assets/CChaTOPr.js","assets/Cw_LYT6k.js","assets/C1RY7wUM.js","assets/DbRMSZEW.js","assets/DAFA-E1-.js","assets/CfsL8_WC.js","assets/BM5G_YA7.js","assets/B3LyCSVJ.js","assets/Bs5VSn0X.js","assets/ZV96pIZb.css"])))=>i.map(i=>d[i]);
2
- 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,i as a}from"./ClyAuDY9.js";import{_ as o,g as s,h as c,m as l,p as u,s as d,t as f}from"./DTxGpkJp.js";import{n as p}from"./BBSxV90W.js";import{D as m}from"./BdPEUnLq.js";import{t as h}from"./Bit0Kfog.js";import{n as g}from"./CChaTOPr.js";import{S as _,a as v,c as y}from"./Cw_LYT6k.js";import{a as b}from"./C1RY7wUM.js";import{n as x,r as ee}from"./DbRMSZEW.js";import{i as te}from"./DAFA-E1-.js";import{c as S,d as C,f as w,l as ne,p as re,t as T}from"./CfsL8_WC.js";import{n as E,t as D}from"./BM5G_YA7.js";function O(e){return f.getState().activeConnections.find(t=>t.id===e)?.database||D(_.getState().trees[e]??[])}function ie(e,t,n,r){return x(e).tree.objectPath(t,n,r,O(e))}function k(e,t){return x(e).tree.namespacePath(t,O(e))}function A(e,t){for(let n of e){if(n.id===t)return n;let e=A(n.children,t);if(e)return e}return null}async function ae(e,t,n){let r=_.getState;for(let i=0;i<t.length;i++){let a=r().trees[e];if(!a)return!1;let o=A(a,t[i]);if(!o)return!1;if(i===t.length-1)return r().setSelected(e,o.id),!0;o.children.length===0&&!o.isLeaf?await n(e,o):o.isExpanded||r().setExpanded(e,o.id,!0)}return!1}function j(e,t){for(let n of e){if(n.id===t)return n;let e=j(n.children,t);if(e)return e}return null}function M(e,t){let n=_.getState(),r=n.trees[e];if(!r||!t)return;let i=k(e,t),a=null;for(let t of i){let i=j(r,t);if(!i||(a=i,i.isLeaf))break;!i.isExpanded&&i.children.length>0&&n.setExpanded(e,i.id,!0)}!a||a.id!==i[i.length-1]||(n.setSelected(e,a.id),!a.isExpanded&&a.children.length>0&&n.setExpanded(e,a.id,!0))}var N=e(n(),1);function oe(e,t,n){let r=[];function i(e){for(let n of e){if(r.push(n),n.id===t||n.children.length>0&&i(n.children))return!0;r.pop()}return!1}i(e);for(let e=r.length-1;e>=0;e--)if(r[e].type===n)return r[e];return null}function P(e,t){for(let n of e){if(n.id===t)return n;if(n.children.length>0){let e=P(n.children,t);if(e)return e}}return null}var F=h(`schemaTreeLoadingRoots`,()=>new Set);h(`schemaTreeCacheWriter`,()=>{let e={};return _.subscribe(t=>{if(t.trees!==e){for(let[n,r]of Object.entries(t.trees)){if(r===e[n])continue;let t=f.getState().activeConnections.find(e=>e.id===n);t&&u(t)&&c(n,s(t),r)}e=t.trees}})});function I(e){let t=f.getState().activeConnections.find(t=>t.id===e);return t?.serverConnectionId?{engine:x(e),run:v(t.serverConnectionId),database:t.database||void 0}:null}function se(){let{setTree:e,setChildren:t,setNodeMetadata:n,setLoading:a}=_(),c=(0,N.useCallback)(async t=>{let n=I(t);if(n&&!F.has(t)){F.add(t);try{let r=f.getState().activeConnections.find(e=>e.id===t),i=r&&u(r)?await l(t,s(r)):null;e(t,i??await n.engine.tree.loadRoot(n))}catch(n){let a=n instanceof Error?n.message:String(n);console.error(`Failed to load databases:`,n),r.getState().setFooterMessage(i.t(`schema.tree.loadDatabasesFailed`,{message:a})),e(t,[])}finally{F.delete(t)}}},[e]),d=(0,N.useCallback)(async(e,r)=>{if(!_.getState().trees[e])return;let i=I(e);if(i&&!r.isLeaf){a(e,r.id,!0);try{let a=await i.engine.tree.loadChildren(i,r);t(e,r.id,a),Promise.all(a.filter(e=>e.type===o.FOLDER&&e.metadata?.countable).map(async t=>{try{let r=await i.engine.tree.loadChildren(i,t);n(e,t.id,{count:r.length})}catch(e){console.error(`Failed to count ${t.text}:`,e)}}))}catch(t){console.error(`Failed to load children:`,t),a(e,r.id,!1)}}},[t,n,a]);return{loadDatabases:c,loadChildren:d,refreshNode:(0,N.useCallback)(async(e,t)=>{await d(e,t)},[d]),createNode:b,findNode:P,findAncestor:oe}}async function L(e,t){T(e,t);let n=_.getState().trees[e];if(!n||!t)return;let r=I(e);if(!r)return;let i=k(e,t),a=E(n,i[i.length-1]);!a||a.children.length===0||await Promise.all(a.children.filter(e=>e.type===o.FOLDER).map(async t=>{try{let n=await r.engine.tree.loadChildren(r,t),i=_.getState();(t.children.length>0||t.isExpanded)&&i.setChildren(e,t.id,n),t.metadata?.countable&&i.setNodeMetadata(e,t.id,{count:n.length})}catch(e){console.error(`Failed to refresh ${t.text}:`,e)}}))}async function ce(e){T(e);let t=I(e);t&&_.getState().setTree(e,await t.engine.tree.loadRoot(t))}var R=class extends Error{sql;constructor(e,t){super(e),this.name=`QueryError`,this.sql=t}},z=class extends Error{constructor(e=`Cancelled`){super(e),this.name=`ExecutionCancelled`}};function B(e){let t=e.fields??[],n=e.records??[];return{fields:t.map(e=>({name:e.name,type:e.type,orgTable:e.orgTable??e.table??``,orgName:e.orgName??e.name,db:e.db??``})),rows:n.map(e=>{let n={};return t.forEach((t,r)=>{n[t.name]=e[r]}),n}),affectedRows:e.affectedRows??0,insertId:e.insertId??0,message:e.message??(n.length>0?i.t(`services.query.rowsReturned`,{count:n.length}):i.t(`services.query.rowsAffected`,{count:e.affectedRows??0}))}}async function V(e,t,n,r=ee(t),i){let a=new Set(e.fields.map(e=>e.orgTable).filter(Boolean));if(a.size!==1)return e;let o=[...a][0];try{let a=i??await r.introspect.getPrimaryKeys(v(t),n,o);a.length>0&&(e.primaryKeys=a)}catch{}return!e.primaryKeys?.length&&e.fields.some(e=>e.name===`_rowid_`)&&(e.primaryKeys=[m]),e}var H=new Set([`SELECT`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`VALUES`,`TABLE`,`WITH`,`USE`,`SET`,`CHECK`,`CHECKSUM`]);function U(e){return e.kind===`PRAGMA`?!e.sql.includes(`=`):!(!H.has(e.kind)||e.destructive||e.kind===`SELECT`&&C(e,`INTO`))}var W=new Set([`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`MERGE`,`LOAD`]),le=new Set([`CREATE`,`ALTER`,`DROP`,`TRUNCATE`,`RENAME`,`GRANT`,`REVOKE`,`FLUSH`,`LOCK`,`UNLOCK`]),ue=new Set([`CREATE`,`ALTER`,`DROP`,`RENAME`]);function de(e){return W.has(e.kind)||!!e.destructive?.dataLoss}function G(e,t,n=`limit`){if(t<=0||e.kind!==`SELECT`||e.limit!==null||C(e,`LIMIT`)||C(e,`INTO`)||C(e,`FOR`)||C(e,`LOCK`))return{sql:e.sql,limited:!1};if(n===`top`){if(C(e,`TOP`)||C(e,`OFFSET`))return{sql:e.sql,limited:!1};let n=re(e);return n===-1?{sql:e.sql,limited:!1}:{sql:`${e.sql.slice(0,n)} TOP ${t}${e.sql.slice(n)}`,limited:!0}}return n===`fetch`?C(e,`FETCH`)||/\bROWNUM\b/i.test(e.sql)?{sql:e.sql,limited:!1}:{sql:`${e.sql} FETCH FIRST ${t} ROWS ONLY`,limited:!0}:{sql:`${e.sql} LIMIT ${t}`,limited:!0}}function fe(e,t=0){let n=K();return n<=0?``:e.limitClause(n,t)}function K(){return p.getState().resultRowLimit}function pe(e){let t=e.destructive,n=t.names.length?t.names.join(`, `):i.t(`services.destructive.unknownTarget`);switch(t.action){case`DROP`:return`DROP ${t.objectType} ${n}`;case`TRUNCATE`:return`TRUNCATE ${n}`;case`DELETE_ALL`:return i.t(`services.destructive.deleteAll`,{target:n});case`UPDATE_ALL`:return i.t(`services.destructive.updateAll`,{target:n});case`ALTER_DROP`:return i.t(`services.destructive.alterDrop`,{target:n})}}async function me(e){if(!p.getState().confirmDestructive)return!0;let t=e.filter(e=>e.destructive?.dataLoss);return t.length===0||r.getState().requestDestructiveConfirm({title:i.t(`services.destructive.title`,{count:t.length}),description:i.t(`services.destructive.description`),statements:t.map(pe),confirmLabel:i.t(`services.runAnyway`)})}async function he(e,t){if(!e.readOnly)return;let n=t.filter(e=>!U(e));if(n.length===0)return;let a=`${e.hostName||e.host}`;if(!p.getState().allowReadOnlyOverride)throw new R(i.t(`services.readOnly.refused`,{label:a,count:n.length}));if(!await r.getState().requestDestructiveConfirm({title:i.t(`services.readOnly.title`,{label:a}),description:i.t(`services.readOnly.description`),statements:n.map(e=>e.sql.length>120?e.sql.slice(0,117)+`...`:e.sql),confirmLabel:i.t(`services.runAnyway`)}))throw new z(`Cancelled: connection is read-only.`)}function q(e,t){let n=f.getState(),r=n.activeConnections.find(t=>t.id===e);if(!r?.serverConnectionId)throw new R(i.t(`services.query.notConnected`));if(n.pendingReopen[e])throw new R(i.t(`services.query.fileNotOpen`));return{connId:e,serverConnId:r.serverConnectionId,conn:r,engine:x(e),tabId:t}}async function J(e,t,n){let r=new S(e.engine).statements(t);if(e.conn.scratchpad){let{materializeFederated:t}=await a(async()=>{let{materializeFederated:e}=await import(`./2sxOfzyn.js`).then(e=>e.z);return{materializeFederated:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]));for(let n of r)n.sql=await t(e.connId,n.sql)}if(await he(e.conn,r),!n.skipDestructiveConfirm&&!await me(r))throw new z;return r}async function Y(e,n,a){let{connId:o,serverConnId:s,engine:c,tabId:l}=e,u=n.stmt?.kind??``,d=()=>f.getState();if(e.conn.transactionMode===`manual`&&c.capabilities.transactions&&n.stmt&&de(n.stmt)&&!d().transactionOpen[o]){let e=await y(s,c.getQuery(`START_TRANSACTION`),a||void 0);if(!e.success)throw new R(e.message??i.t(`services.transaction.startFailed`));d().setTransactionOpen(o,!0),r.getState().setFooterMessage(i.t(`services.transaction.started`))}let p=await y(s,n.sql,a||void 0);if(!p.success){let r=p.message??i.t(`services.query.failed`);throw g.getState().recordExecution({connectionId:o,tabId:l,query:n.sql,database:a,executionTime:p.execTime,error:r,kind:u||void 0}),t(`query_execute`,{dbms:e.conn.dbms,kind:u||`unknown`,source:l?`editor`:`app`,success:!1}),new R(r,n.sql)}let m=B(p);return u===`COMMIT`||u===`ROLLBACK`?d().setTransactionOpen(o,!1):u===`START`||u===`BEGIN`?d().setTransactionOpen(o,!0):le.has(u)&&d().transactionOpen[o]&&c.capabilities.implicitCommitDdl&&(d().setTransactionOpen(o,!1),r.getState().setFooterMessage(i.t(`services.transaction.implicitCommit`,{kind:u}))),ue.has(u)&&L(o,a),e.skipHistory||g.getState().recordExecution({connectionId:o,tabId:l,query:n.sql,database:a,executionTime:p.execTime,kind:u||void 0,...m.fields.length>0?{rowCount:m.rows.length}:{affectedRows:m.affectedRows}}),t(`query_execute`,{dbms:e.conn.dbms,kind:u||`unknown`,source:l?`editor`:`app`,success:!0,exec_time_ms:Math.round(p.execTime??0)}),{qr:m,execTime:p.execTime}}async function ge(e,t,n={}){let r=q(e,n.tabId??null);r.skipHistory=n.skipHistory;let a=t.trim();if(!a)throw new R(i.t(`services.query.nothingToExecute`));let o=await J(r,a,n),s=n.database??``;n.previewWrites&&p.getState().previewAffectedRows&&await Q(r,o,s);let c=o.length>0?o.map(e=>({sql:e.sql,stmt:e})):[{sql:a,stmt:null}],l=null;for(let e of c){let{qr:t}=await Y(r,e,s);n.primaryKeys&&t.fields.length>0&&s&&await V(t,r.serverConnId,s,r.engine,Array.isArray(n.primaryKeys)?n.primaryKeys:void 0),l=t}return l}function _e(e,t){return X(e,t)?.sql??null}function X(e,t){let n=g.getState().tabs[e]?.find(e=>e.id===t);if(!n)return null;let r=te(e,t);if(r&&`selection`in r)return{sql:r.selection,start:r.start};let i=r&&`cursorOffset`in r?r.cursorOffset:n.query.length,a=new S(x(e)).statements(n.query);if(a.length===0)return null;let o=a.find(e=>i>=w(e)&&i<=e.end)??[...a].reverse().find(e=>e.end<=i)??a[0];return{sql:o.sql,start:w(o)}}async function ve(e,n,r={}){let o=()=>g.getState(),s=o().tabs[e]?.find(e=>e.id===n);if(!s)return;let c=(r.sql??s.query)?.trim();if(!c)return;let l,u;try{l=q(e,n),u=await J(l,c,{})}catch(t){if(t instanceof z){t.message!==`Cancelled`&&o().setError(e,n,t.message);return}o().setError(e,n,t instanceof Error?t.message:String(t));return}let f=p.getState(),m=new Map;if(f.previewAffectedRows)try{m=await Q(l,u,s.database||``)}catch(e){if(e instanceof z)return;throw e}let h=m.size===1,_=u.length>0?u.map(e=>({...G(e,f.resultRowLimit,l.engine.syntax.limitStyle),stmt:e})):[{sql:c,limited:!1,stmt:null}],v=r.sql?r.sqlOffset??null:0;a(async()=>{let{readStructures:e}=await import(`./2sxOfzyn.js`).then(e=>e.et);return{readStructures:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(({readStructures:t})=>t(e,n,u.length>0?u.map(e=>({sql:e.sql,start:v===null?null:v+w(e)})):[{sql:c,start:v}])),o().captureRevision(e,n,`execute`),o().setExecuting(e,n,!0),o().setError(e,n,null);let y=[],b=s.database||``;try{for(let r of _){let{qr:a,execTime:s}=await Y(l,r,b);if(a.sql=r.stmt?.sql??r.sql,a.executionTime=s,r.limited&&a.rows.length>=f.resultRowLimit&&(a.limited=!0,a.message=i.t(`services.query.rowsReturnedLimited`,{count:a.rows.length,limit:f.resultRowLimit})),!b&&a.fields.length>0){let t=a.fields.find(e=>e.db)?.db;t&&(b=t,o().setDatabase(e,n,b),M(e,b))}a.fields.length>0&&b&&await V(a,l.serverConnId,b,l.engine);let c=h&&r.stmt?m.get(r.stmt):void 0;c!==void 0&&Number.isFinite(a.affectedRows)&&a.affectedRows!==c&&(a.warning=i.t(`services.query.dryRunMismatch`,{predicted:c,actual:a.affectedRows}),t(`dry_run_mismatch`,{dbms:l.conn.dbms,kind:r.stmt?.kind??`unknown`})),y.push(a)}o().setResults(e,n,y)}catch(t){y.length>0&&o().setResults(e,n,y),o().setError(e,n,t instanceof Error?t.message:String(t),t instanceof R?t.sql:null),t instanceof R&&d(`query_error`)}finally{o().setExecuting(e,n,!1)}}var Z=50;function ye(e,t,n){return e.syntax.limitStyle===`top`?t.replace(/^SELECT\b/i,`SELECT TOP ${n}`):`${t} ${e.limitClause(n)}`}async function Q(e,t,n){let i=new Map;for(let a of t){if(a.kind!==`UPDATE`&&a.kind!==`DELETE`)continue;let t=ne(a);if(!t)continue;let o=null,s=[],c=[],l,u=await y(e.serverConnId,t.count,n||void 0);if(u.success){let r=Number(u.records[0]?.[0]);o=Number.isFinite(r)?r:null;let i=await y(e.serverConnId,t.limited?t.select:ye(e.engine,t.select,Z),n||void 0);i.success?(s=i.fields.map(e=>e.name),c=i.records):l=i.message}else l=u.message;if(!await r.getState().requestDryRun({statement:a.sql,previewSql:t.select,count:o,fields:s,rows:c,truncated:o!==null&&c.length<o,error:l}))throw new z;o!==null&&i.set(a,o)}return i}async function $(e,t){let n=f.getState(),a=n.activeConnections.find(t=>t.id===e);if(!a?.serverConnectionId)return;let o=x(e);try{let e=await y(a.serverConnectionId,o.getQuery(t));if(!e.success)throw new R(e.message??i.t(`services.transaction.commandFailed`,{name:t}));r.getState().setFooterMessage(t===`COMMIT`?i.t(`services.transaction.committed`):i.t(`services.transaction.rolledBack`))}catch(e){r.getState().setFooterMessage(i.t(`services.transaction.commandFailedWith`,{name:t,message:e instanceof Error?e.message:String(e)}))}finally{n.setTransactionOpen(e,!1)}}var be=e=>$(e,`COMMIT`),xe=e=>$(e,`ROLLBACK`);export{ae as _,ve as a,xe as c,K as d,fe as f,M as g,se as h,be as i,ge as l,ce as m,R as n,_e as o,L as p,G as r,U as s,z as t,X as u,ie as v};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/D7Ze5md9.js","assets/hePW80VL.js","assets/XzPc-eVf.js","assets/CKOS5Y-e.js","assets/ClyAuDY9.js","assets/CZQ1r4zz.js","assets/eFSiW0Lh.js","assets/DTxGpkJp.js","assets/BBSxV90W.js","assets/BdPEUnLq.js","assets/Bit0Kfog.js","assets/CChaTOPr.js","assets/Cw_LYT6k.js","assets/C1RY7wUM.js","assets/DbRMSZEW.js","assets/DAFA-E1-.js","assets/CfsL8_WC.js","assets/BM5G_YA7.js","assets/B3LyCSVJ.js","assets/Bs5VSn0X.js","assets/B-Mrqvrb.css"])))=>i.map(i=>d[i]);
2
+ 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,i as a}from"./ClyAuDY9.js";import{_ as o,g as s,h as c,m as l,p as u,s as d,t as f}from"./DTxGpkJp.js";import{n as p}from"./BBSxV90W.js";import{D as m}from"./BdPEUnLq.js";import{t as h}from"./Bit0Kfog.js";import{n as g}from"./CChaTOPr.js";import{S as _,a as v,c as y}from"./Cw_LYT6k.js";import{a as b}from"./C1RY7wUM.js";import{n as x,r as ee}from"./DbRMSZEW.js";import{i as te}from"./DAFA-E1-.js";import{c as S,d as C,f as w,l as ne,p as re,t as T}from"./CfsL8_WC.js";import{n as E,t as D}from"./BM5G_YA7.js";function O(e){return f.getState().activeConnections.find(t=>t.id===e)?.database||D(_.getState().trees[e]??[])}function ie(e,t,n,r){return x(e).tree.objectPath(t,n,r,O(e))}function k(e,t){return x(e).tree.namespacePath(t,O(e))}function A(e,t){for(let n of e){if(n.id===t)return n;let e=A(n.children,t);if(e)return e}return null}async function ae(e,t,n){let r=_.getState;for(let i=0;i<t.length;i++){let a=r().trees[e];if(!a)return!1;let o=A(a,t[i]);if(!o)return!1;if(i===t.length-1)return r().setSelected(e,o.id),!0;o.children.length===0&&!o.isLeaf?await n(e,o):o.isExpanded||r().setExpanded(e,o.id,!0)}return!1}function j(e,t){for(let n of e){if(n.id===t)return n;let e=j(n.children,t);if(e)return e}return null}function M(e,t){let n=_.getState(),r=n.trees[e];if(!r||!t)return;let i=k(e,t),a=null;for(let t of i){let i=j(r,t);if(!i||(a=i,i.isLeaf))break;!i.isExpanded&&i.children.length>0&&n.setExpanded(e,i.id,!0)}!a||a.id!==i[i.length-1]||(n.setSelected(e,a.id),!a.isExpanded&&a.children.length>0&&n.setExpanded(e,a.id,!0))}var N=e(n(),1);function oe(e,t,n){let r=[];function i(e){for(let n of e){if(r.push(n),n.id===t||n.children.length>0&&i(n.children))return!0;r.pop()}return!1}i(e);for(let e=r.length-1;e>=0;e--)if(r[e].type===n)return r[e];return null}function P(e,t){for(let n of e){if(n.id===t)return n;if(n.children.length>0){let e=P(n.children,t);if(e)return e}}return null}var F=h(`schemaTreeLoadingRoots`,()=>new Set);h(`schemaTreeCacheWriter`,()=>{let e={};return _.subscribe(t=>{if(t.trees!==e){for(let[n,r]of Object.entries(t.trees)){if(r===e[n])continue;let t=f.getState().activeConnections.find(e=>e.id===n);t&&u(t)&&c(n,s(t),r)}e=t.trees}})});function I(e){let t=f.getState().activeConnections.find(t=>t.id===e);return t?.serverConnectionId?{engine:x(e),run:v(t.serverConnectionId),database:t.database||void 0}:null}function se(){let{setTree:e,setChildren:t,setNodeMetadata:n,setLoading:a}=_(),c=(0,N.useCallback)(async t=>{let n=I(t);if(n&&!F.has(t)){F.add(t);try{let r=f.getState().activeConnections.find(e=>e.id===t),i=r&&u(r)?await l(t,s(r)):null;e(t,i??await n.engine.tree.loadRoot(n))}catch(n){let a=n instanceof Error?n.message:String(n);console.error(`Failed to load databases:`,n),r.getState().setFooterMessage(i.t(`schema.tree.loadDatabasesFailed`,{message:a})),e(t,[])}finally{F.delete(t)}}},[e]),d=(0,N.useCallback)(async(e,r)=>{if(!_.getState().trees[e])return;let i=I(e);if(i&&!r.isLeaf){a(e,r.id,!0);try{let a=await i.engine.tree.loadChildren(i,r);t(e,r.id,a),Promise.all(a.filter(e=>e.type===o.FOLDER&&e.metadata?.countable).map(async t=>{try{let r=await i.engine.tree.loadChildren(i,t);n(e,t.id,{count:r.length})}catch(e){console.error(`Failed to count ${t.text}:`,e)}}))}catch(t){console.error(`Failed to load children:`,t),a(e,r.id,!1)}}},[t,n,a]);return{loadDatabases:c,loadChildren:d,refreshNode:(0,N.useCallback)(async(e,t)=>{await d(e,t)},[d]),createNode:b,findNode:P,findAncestor:oe}}async function L(e,t){T(e,t);let n=_.getState().trees[e];if(!n||!t)return;let r=I(e);if(!r)return;let i=k(e,t),a=E(n,i[i.length-1]);!a||a.children.length===0||await Promise.all(a.children.filter(e=>e.type===o.FOLDER).map(async t=>{try{let n=await r.engine.tree.loadChildren(r,t),i=_.getState();(t.children.length>0||t.isExpanded)&&i.setChildren(e,t.id,n),t.metadata?.countable&&i.setNodeMetadata(e,t.id,{count:n.length})}catch(e){console.error(`Failed to refresh ${t.text}:`,e)}}))}async function ce(e){T(e);let t=I(e);t&&_.getState().setTree(e,await t.engine.tree.loadRoot(t))}var R=class extends Error{sql;constructor(e,t){super(e),this.name=`QueryError`,this.sql=t}},z=class extends Error{constructor(e=`Cancelled`){super(e),this.name=`ExecutionCancelled`}};function B(e){let t=e.fields??[],n=e.records??[];return{fields:t.map(e=>({name:e.name,type:e.type,orgTable:e.orgTable??e.table??``,orgName:e.orgName??e.name,db:e.db??``})),rows:n.map(e=>{let n={};return t.forEach((t,r)=>{n[t.name]=e[r]}),n}),affectedRows:e.affectedRows??0,insertId:e.insertId??0,message:e.message??(n.length>0?i.t(`services.query.rowsReturned`,{count:n.length}):i.t(`services.query.rowsAffected`,{count:e.affectedRows??0}))}}async function V(e,t,n,r=ee(t),i){let a=new Set(e.fields.map(e=>e.orgTable).filter(Boolean));if(a.size!==1)return e;let o=[...a][0];try{let a=i??await r.introspect.getPrimaryKeys(v(t),n,o);a.length>0&&(e.primaryKeys=a)}catch{}return!e.primaryKeys?.length&&e.fields.some(e=>e.name===`_rowid_`)&&(e.primaryKeys=[m]),e}var H=new Set([`SELECT`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`VALUES`,`TABLE`,`WITH`,`USE`,`SET`,`CHECK`,`CHECKSUM`]);function U(e){return e.kind===`PRAGMA`?!e.sql.includes(`=`):!(!H.has(e.kind)||e.destructive||e.kind===`SELECT`&&C(e,`INTO`))}var W=new Set([`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`MERGE`,`LOAD`]),le=new Set([`CREATE`,`ALTER`,`DROP`,`TRUNCATE`,`RENAME`,`GRANT`,`REVOKE`,`FLUSH`,`LOCK`,`UNLOCK`]),ue=new Set([`CREATE`,`ALTER`,`DROP`,`RENAME`]);function de(e){return W.has(e.kind)||!!e.destructive?.dataLoss}function G(e,t,n=`limit`){if(t<=0||e.kind!==`SELECT`||e.limit!==null||C(e,`LIMIT`)||C(e,`INTO`)||C(e,`FOR`)||C(e,`LOCK`))return{sql:e.sql,limited:!1};if(n===`top`){if(C(e,`TOP`)||C(e,`OFFSET`))return{sql:e.sql,limited:!1};let n=re(e);return n===-1?{sql:e.sql,limited:!1}:{sql:`${e.sql.slice(0,n)} TOP ${t}${e.sql.slice(n)}`,limited:!0}}return n===`fetch`?C(e,`FETCH`)||/\bROWNUM\b/i.test(e.sql)?{sql:e.sql,limited:!1}:{sql:`${e.sql} FETCH FIRST ${t} ROWS ONLY`,limited:!0}:{sql:`${e.sql} LIMIT ${t}`,limited:!0}}function fe(e,t=0){let n=K();return n<=0?``:e.limitClause(n,t)}function K(){return p.getState().resultRowLimit}function pe(e){let t=e.destructive,n=t.names.length?t.names.join(`, `):i.t(`services.destructive.unknownTarget`);switch(t.action){case`DROP`:return`DROP ${t.objectType} ${n}`;case`TRUNCATE`:return`TRUNCATE ${n}`;case`DELETE_ALL`:return i.t(`services.destructive.deleteAll`,{target:n});case`UPDATE_ALL`:return i.t(`services.destructive.updateAll`,{target:n});case`ALTER_DROP`:return i.t(`services.destructive.alterDrop`,{target:n})}}async function me(e){if(!p.getState().confirmDestructive)return!0;let t=e.filter(e=>e.destructive?.dataLoss);return t.length===0||r.getState().requestDestructiveConfirm({title:i.t(`services.destructive.title`,{count:t.length}),description:i.t(`services.destructive.description`),statements:t.map(pe),confirmLabel:i.t(`services.runAnyway`)})}async function he(e,t){if(!e.readOnly)return;let n=t.filter(e=>!U(e));if(n.length===0)return;let a=`${e.hostName||e.host}`;if(!p.getState().allowReadOnlyOverride)throw new R(i.t(`services.readOnly.refused`,{label:a,count:n.length}));if(!await r.getState().requestDestructiveConfirm({title:i.t(`services.readOnly.title`,{label:a}),description:i.t(`services.readOnly.description`),statements:n.map(e=>e.sql.length>120?e.sql.slice(0,117)+`...`:e.sql),confirmLabel:i.t(`services.runAnyway`)}))throw new z(`Cancelled: connection is read-only.`)}function q(e,t){let n=f.getState(),r=n.activeConnections.find(t=>t.id===e);if(!r?.serverConnectionId)throw new R(i.t(`services.query.notConnected`));if(n.pendingReopen[e])throw new R(i.t(`services.query.fileNotOpen`));return{connId:e,serverConnId:r.serverConnectionId,conn:r,engine:x(e),tabId:t}}async function J(e,t,n){let r=new S(e.engine).statements(t);if(e.conn.scratchpad){let{materializeFederated:t}=await a(async()=>{let{materializeFederated:e}=await import(`./D7Ze5md9.js`).then(e=>e.z);return{materializeFederated:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]));for(let n of r)n.sql=await t(e.connId,n.sql)}if(await he(e.conn,r),!n.skipDestructiveConfirm&&!await me(r))throw new z;return r}async function Y(e,n,a){let{connId:o,serverConnId:s,engine:c,tabId:l}=e,u=n.stmt?.kind??``,d=()=>f.getState();if(e.conn.transactionMode===`manual`&&c.capabilities.transactions&&n.stmt&&de(n.stmt)&&!d().transactionOpen[o]){let e=await y(s,c.getQuery(`START_TRANSACTION`),a||void 0);if(!e.success)throw new R(e.message??i.t(`services.transaction.startFailed`));d().setTransactionOpen(o,!0),r.getState().setFooterMessage(i.t(`services.transaction.started`))}let p=await y(s,n.sql,a||void 0);if(!p.success){let r=p.message??i.t(`services.query.failed`);throw g.getState().recordExecution({connectionId:o,tabId:l,query:n.sql,database:a,executionTime:p.execTime,error:r,kind:u||void 0}),t(`query_execute`,{dbms:e.conn.dbms,kind:u||`unknown`,source:l?`editor`:`app`,success:!1}),new R(r,n.sql)}let m=B(p);return u===`COMMIT`||u===`ROLLBACK`?d().setTransactionOpen(o,!1):u===`START`||u===`BEGIN`?d().setTransactionOpen(o,!0):le.has(u)&&d().transactionOpen[o]&&c.capabilities.implicitCommitDdl&&(d().setTransactionOpen(o,!1),r.getState().setFooterMessage(i.t(`services.transaction.implicitCommit`,{kind:u}))),ue.has(u)&&L(o,a),e.skipHistory||g.getState().recordExecution({connectionId:o,tabId:l,query:n.sql,database:a,executionTime:p.execTime,kind:u||void 0,...m.fields.length>0?{rowCount:m.rows.length}:{affectedRows:m.affectedRows}}),t(`query_execute`,{dbms:e.conn.dbms,kind:u||`unknown`,source:l?`editor`:`app`,success:!0,exec_time_ms:Math.round(p.execTime??0)}),{qr:m,execTime:p.execTime}}async function ge(e,t,n={}){let r=q(e,n.tabId??null);r.skipHistory=n.skipHistory;let a=t.trim();if(!a)throw new R(i.t(`services.query.nothingToExecute`));let o=await J(r,a,n),s=n.database??``;n.previewWrites&&p.getState().previewAffectedRows&&await Q(r,o,s);let c=o.length>0?o.map(e=>({sql:e.sql,stmt:e})):[{sql:a,stmt:null}],l=null;for(let e of c){let{qr:t}=await Y(r,e,s);n.primaryKeys&&t.fields.length>0&&s&&await V(t,r.serverConnId,s,r.engine,Array.isArray(n.primaryKeys)?n.primaryKeys:void 0),l=t}return l}function _e(e,t){return X(e,t)?.sql??null}function X(e,t){let n=g.getState().tabs[e]?.find(e=>e.id===t);if(!n)return null;let r=te(e,t);if(r&&`selection`in r)return{sql:r.selection,start:r.start};let i=r&&`cursorOffset`in r?r.cursorOffset:n.query.length,a=new S(x(e)).statements(n.query);if(a.length===0)return null;let o=a.find(e=>i>=w(e)&&i<=e.end)??[...a].reverse().find(e=>e.end<=i)??a[0];return{sql:o.sql,start:w(o)}}async function ve(e,n,r={}){let o=()=>g.getState(),s=o().tabs[e]?.find(e=>e.id===n);if(!s)return;let c=(r.sql??s.query)?.trim();if(!c)return;let l,u;try{l=q(e,n),u=await J(l,c,{})}catch(t){if(t instanceof z){t.message!==`Cancelled`&&o().setError(e,n,t.message);return}o().setError(e,n,t instanceof Error?t.message:String(t));return}let f=p.getState(),m=new Map;if(f.previewAffectedRows)try{m=await Q(l,u,s.database||``)}catch(e){if(e instanceof z)return;throw e}let h=m.size===1,_=u.length>0?u.map(e=>({...G(e,f.resultRowLimit,l.engine.syntax.limitStyle),stmt:e})):[{sql:c,limited:!1,stmt:null}],v=r.sql?r.sqlOffset??null:0;a(async()=>{let{readStructures:e}=await import(`./D7Ze5md9.js`).then(e=>e.et);return{readStructures:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])).then(({readStructures:t})=>t(e,n,u.length>0?u.map(e=>({sql:e.sql,start:v===null?null:v+w(e)})):[{sql:c,start:v}])),o().captureRevision(e,n,`execute`),o().setExecuting(e,n,!0),o().setError(e,n,null);let y=[],b=s.database||``;try{for(let r of _){let{qr:a,execTime:s}=await Y(l,r,b);if(a.sql=r.stmt?.sql??r.sql,a.executionTime=s,r.limited&&a.rows.length>=f.resultRowLimit&&(a.limited=!0,a.message=i.t(`services.query.rowsReturnedLimited`,{count:a.rows.length,limit:f.resultRowLimit})),!b&&a.fields.length>0){let t=a.fields.find(e=>e.db)?.db;t&&(b=t,o().setDatabase(e,n,b),M(e,b))}a.fields.length>0&&b&&await V(a,l.serverConnId,b,l.engine);let c=h&&r.stmt?m.get(r.stmt):void 0;c!==void 0&&Number.isFinite(a.affectedRows)&&a.affectedRows!==c&&(a.warning=i.t(`services.query.dryRunMismatch`,{predicted:c,actual:a.affectedRows}),t(`dry_run_mismatch`,{dbms:l.conn.dbms,kind:r.stmt?.kind??`unknown`})),y.push(a)}o().setResults(e,n,y)}catch(t){y.length>0&&o().setResults(e,n,y),o().setError(e,n,t instanceof Error?t.message:String(t),t instanceof R?t.sql:null),t instanceof R&&d(`query_error`)}finally{o().setExecuting(e,n,!1)}}var Z=50;function ye(e,t,n){return e.syntax.limitStyle===`top`?t.replace(/^SELECT\b/i,`SELECT TOP ${n}`):`${t} ${e.limitClause(n)}`}async function Q(e,t,n){let i=new Map;for(let a of t){if(a.kind!==`UPDATE`&&a.kind!==`DELETE`)continue;let t=ne(a);if(!t)continue;let o=null,s=[],c=[],l,u=await y(e.serverConnId,t.count,n||void 0);if(u.success){let r=Number(u.records[0]?.[0]);o=Number.isFinite(r)?r:null;let i=await y(e.serverConnId,t.limited?t.select:ye(e.engine,t.select,Z),n||void 0);i.success?(s=i.fields.map(e=>e.name),c=i.records):l=i.message}else l=u.message;if(!await r.getState().requestDryRun({statement:a.sql,previewSql:t.select,count:o,fields:s,rows:c,truncated:o!==null&&c.length<o,error:l}))throw new z;o!==null&&i.set(a,o)}return i}async function $(e,t){let n=f.getState(),a=n.activeConnections.find(t=>t.id===e);if(!a?.serverConnectionId)return;let o=x(e);try{let e=await y(a.serverConnectionId,o.getQuery(t));if(!e.success)throw new R(e.message??i.t(`services.transaction.commandFailed`,{name:t}));r.getState().setFooterMessage(t===`COMMIT`?i.t(`services.transaction.committed`):i.t(`services.transaction.rolledBack`))}catch(e){r.getState().setFooterMessage(i.t(`services.transaction.commandFailedWith`,{name:t,message:e instanceof Error?e.message:String(e)}))}finally{n.setTransactionOpen(e,!1)}}var be=e=>$(e,`COMMIT`),xe=e=>$(e,`ROLLBACK`);export{ae as _,ve as a,xe as c,K as d,fe as f,M as g,se as h,be as i,ge as l,ce as m,R as n,_e as o,L as p,G as r,U as s,z as t,X as u,ie as v};
@@ -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"./DkdStXtl.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"./2sxOfzyn.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"./D_2UqK4k.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"./D7Ze5md9.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,4 +1,4 @@
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"./DkdStXtl.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 g}from"./B3LyCSVJ.js";import{t as _}from"./Bs5VSn0X.js";import{at as v,c as y,it as ee}from"./2sxOfzyn.js";import{a as b,i as x,n as te,o as ne,t as S}from"./DxuXBECK.js";var C=e(n(),1),w=[`VIEW`,`PROCEDURE`,`FUNCTION`,`TRIGGER`,`EVENT`];function T(e,t){return e.replace(/\bDEFINER\s*=\s*(?:`[^`]*`|'[^']*'|"[^"]*"|\w+)@(?:`[^`]*`|'[^']*'|"[^"]*"|[\w.%-]+)/gi,``).replace(/\bSQL SECURITY (?:DEFINER|INVOKER)\b/gi,``).replace(/\bALGORITHM\s*=\s*\w+/gi,``).replace(RegExp(`[\`"\\[]?${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}[\`"\\]]?\\.`,`gi`),``).replace(/\s+/g,` `).replace(/;\s*$/,``).trim()}function E(e,t){let n=[];for(let r of w){let i=e.objects?.get(r),a=t.objects?.get(r);if(!i&&!a)continue;let o=[...new Set([...i?.keys()??[],...a?.keys()??[]])].sort();for(let s of o){let o=i?.get(s)??null,c=a?.get(s)??null,l;l=o?c?o.sql!==null&&c.sql!==null&&T(o.sql,e.database)===T(c.sql,t.database)?`identical`:`changed`:`missingInTarget`:`missingInSource`,n.push({type:r,name:s,status:l,source:o,target:c})}}return n}var D=e=>e.toLowerCase().replace(/\s+/g,` `).trim(),O=e=>e===null?null:e.trim().replace(/^'(.*)'(?:::\w+)?$/s,`$1`),k=e=>e.addedColumns.length+e.removedColumns.length+e.changedColumns.length+e.addedIndexes.length+e.removedIndexes.length+e.changedIndexes.length>0;function A(e,t){let n=[];return D(e.type)!==D(t.type)&&n.push(`type`),e.nullable!==t.nullable&&n.push(`nullable`),O(e.defaultValue)!==O(t.defaultValue)&&n.push(`default`),e.extra.toLowerCase()!==t.extra.toLowerCase()&&n.push(`extra`),n}var j=(e,t)=>e.type===t.type&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n]);function M(e,t,n){let r=t.columns.get(e)??[],i=n.columns.get(e)??[],a=new Map(i.map(e=>[e.name,e])),o=new Map(r.map(e=>[e.name,e])),s={table:e,addedColumns:r.filter(e=>!a.has(e.name)),removedColumns:i.filter(e=>!o.has(e.name)),changedColumns:[],addedIndexes:[],removedIndexes:[],changedIndexes:[]};for(let e of r){let t=a.get(e.name);if(!t)continue;let n=A(e,t);n.length>0&&s.changedColumns.push({name:e.name,source:e,target:t,attributes:n})}let c=t.indexes.get(e)??[],l=n.indexes.get(e)??[],u=new Map(l.map(e=>[e.name,e])),d=new Map(c.map(e=>[e.name,e]));s.addedIndexes=c.filter(e=>!u.has(e.name)),s.removedIndexes=l.filter(e=>!d.has(e.name));for(let e of c){let t=u.get(e.name);t&&!j(e,t)&&s.changedIndexes.push({name:e.name,source:e,target:t})}return s}function N(e,t){let n=new Set(t.tables),r=new Set(e.tables),i={missingInTarget:[],missingInSource:[],changed:[],identical:[],objects:E(e,t)};for(let r of e.tables){if(!n.has(r)){i.missingInTarget.push(r);continue}let a=M(r,e,t);k(a)?i.changed.push(a):i.identical.push(r)}return i.missingInSource=t.tables.filter(e=>!r.has(e)),i}var P=e=>e.split(`
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"./D_2UqK4k.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 g}from"./B3LyCSVJ.js";import{t as _}from"./Bs5VSn0X.js";import{at as v,c as y,it as ee}from"./D7Ze5md9.js";import{a as b,i as x,n as te,o as ne,t as S}from"./DxuXBECK.js";var C=e(n(),1),w=[`VIEW`,`PROCEDURE`,`FUNCTION`,`TRIGGER`,`EVENT`];function T(e,t){return e.replace(/\bDEFINER\s*=\s*(?:`[^`]*`|'[^']*'|"[^"]*"|\w+)@(?:`[^`]*`|'[^']*'|"[^"]*"|[\w.%-]+)/gi,``).replace(/\bSQL SECURITY (?:DEFINER|INVOKER)\b/gi,``).replace(/\bALGORITHM\s*=\s*\w+/gi,``).replace(RegExp(`[\`"\\[]?${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}[\`"\\]]?\\.`,`gi`),``).replace(/\s+/g,` `).replace(/;\s*$/,``).trim()}function E(e,t){let n=[];for(let r of w){let i=e.objects?.get(r),a=t.objects?.get(r);if(!i&&!a)continue;let o=[...new Set([...i?.keys()??[],...a?.keys()??[]])].sort();for(let s of o){let o=i?.get(s)??null,c=a?.get(s)??null,l;l=o?c?o.sql!==null&&c.sql!==null&&T(o.sql,e.database)===T(c.sql,t.database)?`identical`:`changed`:`missingInTarget`:`missingInSource`,n.push({type:r,name:s,status:l,source:o,target:c})}}return n}var D=e=>e.toLowerCase().replace(/\s+/g,` `).trim(),O=e=>e===null?null:e.trim().replace(/^'(.*)'(?:::\w+)?$/s,`$1`),k=e=>e.addedColumns.length+e.removedColumns.length+e.changedColumns.length+e.addedIndexes.length+e.removedIndexes.length+e.changedIndexes.length>0;function A(e,t){let n=[];return D(e.type)!==D(t.type)&&n.push(`type`),e.nullable!==t.nullable&&n.push(`nullable`),O(e.defaultValue)!==O(t.defaultValue)&&n.push(`default`),e.extra.toLowerCase()!==t.extra.toLowerCase()&&n.push(`extra`),n}var j=(e,t)=>e.type===t.type&&e.columns.length===t.columns.length&&e.columns.every((e,n)=>e===t.columns[n]);function M(e,t,n){let r=t.columns.get(e)??[],i=n.columns.get(e)??[],a=new Map(i.map(e=>[e.name,e])),o=new Map(r.map(e=>[e.name,e])),s={table:e,addedColumns:r.filter(e=>!a.has(e.name)),removedColumns:i.filter(e=>!o.has(e.name)),changedColumns:[],addedIndexes:[],removedIndexes:[],changedIndexes:[]};for(let e of r){let t=a.get(e.name);if(!t)continue;let n=A(e,t);n.length>0&&s.changedColumns.push({name:e.name,source:e,target:t,attributes:n})}let c=t.indexes.get(e)??[],l=n.indexes.get(e)??[],u=new Map(l.map(e=>[e.name,e])),d=new Map(c.map(e=>[e.name,e]));s.addedIndexes=c.filter(e=>!u.has(e.name)),s.removedIndexes=l.filter(e=>!d.has(e.name));for(let e of c){let t=u.get(e.name);t&&!j(e,t)&&s.changedIndexes.push({name:e.name,source:e,target:t})}return s}function N(e,t){let n=new Set(t.tables),r=new Set(e.tables),i={missingInTarget:[],missingInSource:[],changed:[],identical:[],objects:E(e,t)};for(let r of e.tables){if(!n.has(r)){i.missingInTarget.push(r);continue}let a=M(r,e,t);k(a)?i.changed.push(a):i.identical.push(r)}return i.missingInSource=t.tables.filter(e=>!r.has(e)),i}var P=e=>e.split(`
2
2
  `).map(e=>`-- ${e}`).join(`
3
3
  `);function re(e,t,n,r,i={}){let a=n.ddl,o=r.database,s=e=>i.includeDrops?e:P(e),c=[`-- Schema sync: ${t.database} -> ${o} (${n.label})`,`-- Review before running. Statements that drop data are commented out unless "Include DROP statements" was checked.`,``];for(let r of e.missingInTarget)c.push(`-- Table ${r} is missing in the target`),c.push(F(r,t,n,o)),c.push(``);for(let t of e.changed){c.push(`-- Table ${t.table}`);for(let e of t.removedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.changedIndexes)c.push(s(a.dropIndex(o,t.table,e.name)));for(let e of t.addedColumns)c.push(a.addColumn(o,t.table,e));for(let e of t.changedColumns){let r=a.alterColumn(o,t.table,e.source);c.push(r??P(`${n.label} cannot alter column ${e.name} in place (${e.attributes.join(`, `)}): recreate the table`))}for(let e of t.removedColumns)c.push(s(a.dropColumn(o,t.table,e.name)));for(let e of t.addedIndexes)c.push(a.createIndex(o,t.table,e));for(let e of t.changedIndexes)c.push(a.createIndex(o,t.table,e.source));c.push(``)}for(let t of e.missingInSource)c.push(`-- Table ${t} exists only in the target`),c.push(s(`DROP TABLE ${n.qualify(o,t)};`)),c.push(``);for(let t of e.objects){if(t.status===`identical`)continue;let e=`${t.type.charAt(0)}${t.type.slice(1).toLowerCase()} ${t.name}`,r=L(n,o,t);t.status===`missingInSource`?(c.push(`-- ${e} exists only in the target`),c.push(s(r))):(c.push(t.status===`changed`?`-- ${e} differs; recreated from the source`:`-- ${e} is missing in the target`),t.status===`changed`&&c.push(s(r)),c.push(t.source?.sql?R(t.source.sql):P(`the source engine did not return a CREATE statement for ${e}`))),c.push(``)}return c.join(`
4
4
  `).replace(/\n{3,}/g,`
@@ -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"./2sxOfzyn.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"./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"./D7Ze5md9.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 +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"./DkdStXtl.js";import{t as d}from"./DTxGpkJp.js";import{n as f}from"./DbRMSZEW.js";import{l as p,m}from"./D98JmiqU.js";import{c as h,l as g}from"./2sxOfzyn.js";import{a as _,i as v,n as y,o as b,t as x}from"./DxuXBECK.js";var S=e(t(),1),C=r(),w=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],T={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function E(){let{t:e}=i(),{activeDialog:t,closeDialog:r}=n(),E=t===`create-database`,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(`utf8mb4`),[j,M]=(0,S.useState)(`utf8mb4_general_ci`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null);function L(e){e||(r(),I(null),O(``),A(`utf8mb4`),M(`utf8mb4_general_ci`))}function R(e){A(e);let t=T[e];M(t?.[0]??``)}async function z(){let e=d.getState().activeConnectionId,t=D.trim();if(!(!e||!t)){I(null),P(!0);try{let n=f(e).getQuery(`CREATE_DATABASE`,t,k,j);await p(e,n),await m(e),L(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}}let B=T[k]??[];return(0,C.jsx)(x,{open:E,onOpenChange:L,children:(0,C.jsxs)(y,{className:`sm:max-w-[450px]`,children:[(0,C.jsx)(_,{children:(0,C.jsx)(b,{children:e(`database.create.title`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-name`,children:e(`database.create.name`)}),(0,C.jsx)(g,{id:`db-name`,value:D,onChange:e=>O(e.target.value),placeholder:e(`database.create.namePlaceholder`)})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-charset`,children:e(`database.create.charset`)}),(0,C.jsxs)(u,{value:k,onValueChange:R,children:[(0,C.jsx)(s,{id:`db-charset`,className:`w-full`,children:(0,C.jsx)(o,{})}),(0,C.jsx)(c,{children:w.map(e=>(0,C.jsx)(l,{value:e,children:e},e))})]})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-collation`,children:e(`database.create.collation`)}),(0,C.jsxs)(u,{value:j,onValueChange:M,children:[(0,C.jsx)(s,{id:`db-collation`,className:`w-full`,children:(0,C.jsx)(o,{})}),(0,C.jsx)(c,{children:B.map(e=>(0,C.jsx)(l,{value:e,children:e},e))})]})]})]}),F&&(0,C.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:F}),(0,C.jsxs)(v,{children:[(0,C.jsx)(a,{variant:`outline`,onClick:()=>L(!1),children:e(`database.create.cancel`)}),(0,C.jsx)(a,{onClick:()=>void z(),disabled:!D.trim()||N,children:e(`database.create.create`)})]})]})})}export{E as CreateDatabaseDialog};
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"./D_2UqK4k.js";import{t as d}from"./DTxGpkJp.js";import{n as f}from"./DbRMSZEW.js";import{l as p,m}from"./DlKZCiMg.js";import{c as h,l as g}from"./D7Ze5md9.js";import{a as _,i as v,n as y,o as b,t as x}from"./DxuXBECK.js";var S=e(t(),1),C=r(),w=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],T={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function E(){let{t:e}=i(),{activeDialog:t,closeDialog:r}=n(),E=t===`create-database`,[D,O]=(0,S.useState)(``),[k,A]=(0,S.useState)(`utf8mb4`),[j,M]=(0,S.useState)(`utf8mb4_general_ci`),[N,P]=(0,S.useState)(!1),[F,I]=(0,S.useState)(null);function L(e){e||(r(),I(null),O(``),A(`utf8mb4`),M(`utf8mb4_general_ci`))}function R(e){A(e);let t=T[e];M(t?.[0]??``)}async function z(){let e=d.getState().activeConnectionId,t=D.trim();if(!(!e||!t)){I(null),P(!0);try{let n=f(e).getQuery(`CREATE_DATABASE`,t,k,j);await p(e,n),await m(e),L(!1)}catch(e){I(e instanceof Error?e.message:String(e))}finally{P(!1)}}}let B=T[k]??[];return(0,C.jsx)(x,{open:E,onOpenChange:L,children:(0,C.jsxs)(y,{className:`sm:max-w-[450px]`,children:[(0,C.jsx)(_,{children:(0,C.jsx)(b,{children:e(`database.create.title`)})}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-name`,children:e(`database.create.name`)}),(0,C.jsx)(g,{id:`db-name`,value:D,onChange:e=>O(e.target.value),placeholder:e(`database.create.namePlaceholder`)})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-charset`,children:e(`database.create.charset`)}),(0,C.jsxs)(u,{value:k,onValueChange:R,children:[(0,C.jsx)(s,{id:`db-charset`,className:`w-full`,children:(0,C.jsx)(o,{})}),(0,C.jsx)(c,{children:w.map(e=>(0,C.jsx)(l,{value:e,children:e},e))})]})]}),(0,C.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,C.jsx)(h,{htmlFor:`db-collation`,children:e(`database.create.collation`)}),(0,C.jsxs)(u,{value:j,onValueChange:M,children:[(0,C.jsx)(s,{id:`db-collation`,className:`w-full`,children:(0,C.jsx)(o,{})}),(0,C.jsx)(c,{children:B.map(e=>(0,C.jsx)(l,{value:e,children:e},e))})]})]})]}),F&&(0,C.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:F}),(0,C.jsxs)(v,{children:[(0,C.jsx)(a,{variant:`outline`,onClick:()=>L(!1),children:e(`database.create.cancel`)}),(0,C.jsx)(a,{onClick:()=>void z(),disabled:!D.trim()||N,children:e(`database.create.create`)})]})]})})}export{E as CreateDatabaseDialog};
@@ -1 +1 @@
1
- import{l as e}from"./CKOS5Y-e.js";import{R as t}from"./2sxOfzyn.js";var n=e();function r({id:e,checked:r,onChange:i,label:a,hint:o,pro:s}){return(0,n.jsxs)(`label`,{htmlFor:e,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,n.jsx)(`input`,{id:e,type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,n.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,n.jsxs)(`span`,{className:`flex items-center text-sm font-medium`,children:[a,s?(0,n.jsx)(t,{}):null]}),(0,n.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}export{r as t};
1
+ import{l as e}from"./CKOS5Y-e.js";import{R as t}from"./D7Ze5md9.js";var n=e();function r({id:e,checked:r,onChange:i,label:a,hint:o,pro:s}){return(0,n.jsxs)(`label`,{htmlFor:e,className:`flex cursor-pointer items-start gap-3 rounded-md border p-3 hover:bg-accent/40`,children:[(0,n.jsx)(`input`,{id:e,type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,n.jsxs)(`span`,{className:`grid flex-1 gap-0.5`,children:[(0,n.jsxs)(`span`,{className:`flex items-center text-sm font-medium`,children:[a,s?(0,n.jsx)(t,{}):null]}),(0,n.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}export{r as t};