@hienlh/ppm 0.13.81 → 0.13.84

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/CHANGELOG.md +15 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/bun.lock +2248 -0
  5. package/bunfig.toml +2 -0
  6. package/dist/web/assets/{audio-preview-CAfDYjm4.js → audio-preview-BDvRxNLM.js} +1 -1
  7. package/dist/web/assets/chat-tab-BufLWyuh.js +16 -0
  8. package/dist/web/assets/{code-editor-CX0KfaaR.js → code-editor-BTazCHFV.js} +2 -2
  9. package/dist/web/assets/{conflict-editor-ChrygxPj.js → conflict-editor-_26EuzFY.js} +1 -1
  10. package/dist/web/assets/{database-viewer-HmoUxmiZ.js → database-viewer-4Zhmq-Y_.js} +1 -1
  11. package/dist/web/assets/{diff-viewer-tjllHYjj.js → diff-viewer-BqajGrQu.js} +1 -1
  12. package/dist/web/assets/{docx-preview-dzqMxh2q.js → docx-preview-B_twNQVN.js} +1 -1
  13. package/dist/web/assets/{extension-webview-CnbQrqHw.js → extension-webview-QeJr_2ep.js} +1 -1
  14. package/dist/web/assets/{git-log-panel-CZV6iLf6.js → git-log-panel-BeJ1dm7u.js} +1 -1
  15. package/dist/web/assets/{glide-data-grid-BItCRKyi.js → glide-data-grid-oGWwEx-C.js} +1 -1
  16. package/dist/web/assets/{image-preview-D4BdMNJh.js → image-preview-7bjGlR19.js} +1 -1
  17. package/dist/web/assets/{index-V5EQVDli.js → index-DUQla965.js} +3 -3
  18. package/dist/web/assets/keybindings-store-C6fOhpuR.js +1 -0
  19. package/dist/web/assets/{markdown-renderer-Cir2ekZS.js → markdown-renderer-DNM11etB.js} +1 -1
  20. package/dist/web/assets/notification-store-FhBnY4N6.js +1 -0
  21. package/dist/web/assets/{pdf-preview-Bz24adIt.js → pdf-preview-DFU1txpL.js} +1 -1
  22. package/dist/web/assets/{port-forwarding-tab-DV92LzzG.js → port-forwarding-tab-CJmXr1Y_.js} +1 -1
  23. package/dist/web/assets/{postgres-viewer-Co76S2y6.js → postgres-viewer-CaXJeBw1.js} +1 -1
  24. package/dist/web/assets/{settings-tab-B1Ddkecv.js → settings-tab-CvqKKtLt.js} +1 -1
  25. package/dist/web/assets/{sql-query-editor-V-W6AOtE.js → sql-query-editor-BVz7tnJt.js} +1 -1
  26. package/dist/web/assets/{sqlite-viewer-B4KOYMXG.js → sqlite-viewer-Dpz0BVbf.js} +1 -1
  27. package/dist/web/assets/{system-monitor-tab-BVSp8qJS.js → system-monitor-tab-Bpjmj8cy.js} +1 -1
  28. package/dist/web/assets/{terminal-tab-CQGv4hum.js → terminal-tab-DoAf-HTf.js} +1 -1
  29. package/dist/web/assets/{video-preview-DYJ6E4Zi.js → video-preview-CKxVc4yo.js} +1 -1
  30. package/dist/web/index.html +1 -1
  31. package/dist/web/sw.js +1 -1
  32. package/package.json +2 -2
  33. package/src/index.ts +0 -0
  34. package/src/web/components/chat/message-list.tsx +18 -10
  35. package/src/web/components/layout/tab-pool.tsx +6 -3
  36. package/src/web/hooks/use-extension-ws.ts +24 -9
  37. package/dist/web/assets/chat-tab-C_dKbbG0.js +0 -16
  38. package/dist/web/assets/keybindings-store-BPuImB7x.js +0 -1
  39. package/dist/web/assets/notification-store-B0mXpyFT.js +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{i as r,t as i}from"./api-client-bbJLzRVE.js";import{n as a}from"./settings-store-BL2a9FtJ.js";import"./vendor-mermaid-Bfbv_YGB.js";import{$ as o,D as s,St as c,mt as l}from"./index-V5EQVDli.js";import{r as u,t as d}from"./use-monaco-theme-B9wG8s0C.js";var f=e(n(),1),p=t();function m(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function h({metadata:e}){let t=e?.filePath,n=e?.projectName,h=e?.ref1,_=e?.ref2,v=e?.file1,y=e?.file2,b=e?.original,x=e?.modified,S=b!=null||x!=null,C=!!(v&&y),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!S),[M,N]=(0,f.useState)(null),{wordWrap:P,toggleWordWrap:F}=a(s(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap}))),I=d(),L=(0,f.useRef)(null),R=(0,f.useRef)(null),[z,B]=(0,f.useState)(!1),[V,H]=(0,f.useState)();(0,f.useEffect)(()=>{let e=L.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&H(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,f.useEffect)(()=>{if(S||!n)return;if(j(!0),N(null),k(null),D(null),T(null),v&&y){let e=new URLSearchParams({file1:v,file2:y});i.get(`${r(n)}/files/compare?${e}`).then(e=>{D(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}if(t){let e=new URLSearchParams({file:t});h&&e.set(`ref`,h),_&&e.set(`ref2`,_),i.get(`${r(n)}/git/file-full-diff?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)});return}let e;if(h||_){let t=new URLSearchParams;h&&t.set(`ref1`,h),_&&t.set(`ref2`,_),e=`${r(n)}/git/diff?${t}`}else e=`${r(n)}/git/diff`;i.get(e).then(e=>{T(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,h,_,v,y,S]);let{original:U,modified:W}=(0,f.useMemo)(()=>S?{original:b??``,modified:x??``}:C&&E?E:O||(w?g(w):{original:``,modified:``}),[w,S,b,x,C,E,O]),G=(0,f.useMemo)(()=>{let e=t??y??v;return e?m(e):`plaintext`},[t,v,y]),K=typeof window<`u`&&window.innerWidth<768,q=!K;return(0,f.useEffect)(()=>{let e=R.current;if(!e)return;let t=K||P?`on`:`off`;e.updateOptions({diffWordWrap:t}),e.getOriginalEditor().updateOptions({wordWrapOverride2:t}),e.getModifiedEditor().updateOptions({wordWrapOverride2:t})},[P,K,z]),!n&&!S?(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,p.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,p.jsx)(l,{className:`size-5 animate-spin`}),(0,p.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!S&&!C&&!O&&!U&&!W?(0,p.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,p.jsx)(c,{className:`size-8`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,p.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,p.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!K&&(0,p.jsx)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:(0,p.jsx)(`button`,{type:`button`,onClick:F,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${P?`bg-muted text-foreground`:``}`,children:(0,p.jsx)(o,{className:`size-3.5`})})}),(0,p.jsx)(`div`,{ref:L,className:`flex-1 overflow-hidden`,children:V&&V>0?(0,p.jsx)(u,{height:V,language:G,original:U,modified:W,theme:I,onMount:e=>{R.current=e,B(!0)},options:{fontSize:K?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,diffWordWrap:K||P?`on`:`off`,renderSideBySide:q,useInlineViewWhenSpaceIsLimited:!1,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,p.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})}):(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,p.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function g(e){let t=e.split(`
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{i as r,t as i}from"./api-client-bbJLzRVE.js";import{n as a}from"./settings-store-BL2a9FtJ.js";import"./vendor-mermaid-Bfbv_YGB.js";import{$ as o,D as s,St as c,mt as l}from"./index-DUQla965.js";import{r as u,t as d}from"./use-monaco-theme-B9wG8s0C.js";var f=e(n(),1),p=t();function m(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function h({metadata:e}){let t=e?.filePath,n=e?.projectName,h=e?.ref1,_=e?.ref2,v=e?.file1,y=e?.file2,b=e?.original,x=e?.modified,S=b!=null||x!=null,C=!!(v&&y),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!S),[M,N]=(0,f.useState)(null),{wordWrap:P,toggleWordWrap:F}=a(s(e=>({wordWrap:e.wordWrap,toggleWordWrap:e.toggleWordWrap}))),I=d(),L=(0,f.useRef)(null),R=(0,f.useRef)(null),[z,B]=(0,f.useState)(!1),[V,H]=(0,f.useState)();(0,f.useEffect)(()=>{let e=L.current;if(!e)return;let t=new ResizeObserver(([e])=>{e&&H(Math.floor(e.contentRect.height))});return t.observe(e),()=>t.disconnect()},[A,M]),(0,f.useEffect)(()=>{if(S||!n)return;if(j(!0),N(null),k(null),D(null),T(null),v&&y){let e=new URLSearchParams({file1:v,file2:y});i.get(`${r(n)}/files/compare?${e}`).then(e=>{D(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}if(t){let e=new URLSearchParams({file:t});h&&e.set(`ref`,h),_&&e.set(`ref2`,_),i.get(`${r(n)}/git/file-full-diff?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)});return}let e;if(h||_){let t=new URLSearchParams;h&&t.set(`ref1`,h),_&&t.set(`ref2`,_),e=`${r(n)}/git/diff?${t}`}else e=`${r(n)}/git/diff`;i.get(e).then(e=>{T(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,h,_,v,y,S]);let{original:U,modified:W}=(0,f.useMemo)(()=>S?{original:b??``,modified:x??``}:C&&E?E:O||(w?g(w):{original:``,modified:``}),[w,S,b,x,C,E,O]),G=(0,f.useMemo)(()=>{let e=t??y??v;return e?m(e):`plaintext`},[t,v,y]),K=typeof window<`u`&&window.innerWidth<768,q=!K;return(0,f.useEffect)(()=>{let e=R.current;if(!e)return;let t=K||P?`on`:`off`;e.updateOptions({diffWordWrap:t}),e.getOriginalEditor().updateOptions({wordWrapOverride2:t}),e.getModifiedEditor().updateOptions({wordWrapOverride2:t})},[P,K,z]),!n&&!S?(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`}):A?(0,p.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,p.jsx)(l,{className:`size-5 animate-spin`}),(0,p.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]}):M?(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M}):!S&&!C&&!O&&!U&&!W?(0,p.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,p.jsx)(c,{className:`size-8`}),(0,p.jsx)(`p`,{className:`text-sm`,children:`No content changes`}),t&&(0,p.jsx)(`p`,{className:`text-xs font-mono`,children:t})]}):(0,p.jsxs)(`div`,{className:`flex flex-col h-full`,children:[!K&&(0,p.jsx)(`div`,{className:`flex items-center justify-end gap-0.5 px-2 py-0.5 border-b border-border shrink-0`,children:(0,p.jsx)(`button`,{type:`button`,onClick:F,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${P?`bg-muted text-foreground`:``}`,children:(0,p.jsx)(o,{className:`size-3.5`})})}),(0,p.jsx)(`div`,{ref:L,className:`flex-1 overflow-hidden`,children:V&&V>0?(0,p.jsx)(u,{height:V,language:G,original:U,modified:W,theme:I,onMount:e=>{R.current=e,B(!0)},options:{fontSize:K?11:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,diffWordWrap:K||P?`on`:`off`,renderSideBySide:q,useInlineViewWhenSpaceIsLimited:!1,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,p.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})}):(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,p.jsx)(l,{className:`size-5 animate-spin text-muted-foreground`})})})]})}function g(e){let t=e.split(`
2
2
  `),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
3
3
  `),modified:r.join(`
4
4
  `)}}export{h as DiffViewer};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{t as r}from"./file-exclamation-point-Baz81y5z.js";import{i,t as a}from"./api-client-bbJLzRVE.js";import{mt as o}from"./index-V5EQVDli.js";var s=e(n(),1),c=t();function l({filePath:e,projectName:t}){let[n,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(!0),[f,p]=(0,s.useState)(null);return(0,s.useEffect)(()=>{d(!0),p(null);let n=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${i(t)}/files/docx-html?path=${encodeURIComponent(e)}`;a.get(n).then(e=>{l(e.html),d(!1)}).catch(e=>{p(e instanceof Error?e.message:`Failed to convert docx`),d(!1)})},[e,t]),(0,s.useEffect)(()=>{let n=n=>{let r=n.detail;if(r.projectName!==t||r.path!==e)return;let o=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${i(t)}/files/docx-html?path=${encodeURIComponent(e)}`;a.get(o).then(e=>l(e.html)).catch(()=>{})};return window.addEventListener(`file:changed`,n),()=>window.removeEventListener(`file:changed`,n)},[e,t]),u?(0,c.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,c.jsx)(o,{className:`size-5 animate-spin`}),(0,c.jsx)(`span`,{className:`text-sm`,children:`Converting document...`})]}):f?(0,c.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,c.jsx)(r,{className:`size-10 text-text-subtle`}),(0,c.jsx)(`p`,{className:`text-sm`,children:`Failed to load document.`}),(0,c.jsx)(`p`,{className:`text-xs text-text-subtle`,children:f})]}):(0,c.jsx)(`div`,{className:`h-full overflow-auto bg-white dark:bg-zinc-900`,children:(0,c.jsx)(`div`,{className:`docx-preview max-w-3xl mx-auto px-6 py-8 text-sm text-foreground leading-relaxed
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{t as r}from"./file-exclamation-point-Baz81y5z.js";import{i,t as a}from"./api-client-bbJLzRVE.js";import{mt as o}from"./index-DUQla965.js";var s=e(n(),1),c=t();function l({filePath:e,projectName:t}){let[n,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(!0),[f,p]=(0,s.useState)(null);return(0,s.useEffect)(()=>{d(!0),p(null);let n=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${i(t)}/files/docx-html?path=${encodeURIComponent(e)}`;a.get(n).then(e=>{l(e.html),d(!1)}).catch(e=>{p(e instanceof Error?e.message:`Failed to convert docx`),d(!1)})},[e,t]),(0,s.useEffect)(()=>{let n=n=>{let r=n.detail;if(r.projectName!==t||r.path!==e)return;let o=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/docx-html?path=${encodeURIComponent(e)}`:`${i(t)}/files/docx-html?path=${encodeURIComponent(e)}`;a.get(o).then(e=>l(e.html)).catch(()=>{})};return window.addEventListener(`file:changed`,n),()=>window.removeEventListener(`file:changed`,n)},[e,t]),u?(0,c.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,c.jsx)(o,{className:`size-5 animate-spin`}),(0,c.jsx)(`span`,{className:`text-sm`,children:`Converting document...`})]}):f?(0,c.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,c.jsx)(r,{className:`size-10 text-text-subtle`}),(0,c.jsx)(`p`,{className:`text-sm`,children:`Failed to load document.`}),(0,c.jsx)(`p`,{className:`text-xs text-text-subtle`,children:f})]}):(0,c.jsx)(`div`,{className:`h-full overflow-auto bg-white dark:bg-zinc-900`,children:(0,c.jsx)(`div`,{className:`docx-preview max-w-3xl mx-auto px-6 py-8 text-sm text-foreground leading-relaxed
2
2
  [&_table]:border-collapse [&_table]:w-full [&_table]:my-3
3
3
  [&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1
4
4
  [&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:font-semibold [&_th]:bg-muted/50
@@ -1,3 +1,3 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{r}from"./api-client-bbJLzRVE.js";import{j as i,mt as a}from"./index-V5EQVDli.js";var o=e(n(),1),s=t(),c=`<script>
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import{r}from"./api-client-bbJLzRVE.js";import{j as i,mt as a}from"./index-DUQla965.js";var o=e(n(),1),s=t(),c=`<script>
2
2
  function acquireVsCodeApi(){return{postMessage:function(m){window.parent.postMessage(m,"*")},getState:function(){try{return JSON.parse(sessionStorage.getItem("vscode-state")||"null")}catch{return null}},setState:function(s){sessionStorage.setItem("vscode-state",JSON.stringify(s));return s}}}
3
3
  <\/script>`;function l(e){if(!e)return e;let t=e.indexOf(`<head>`);return t===-1?c+e:e.slice(0,t+6)+c+e.slice(t+6)}function u({metadata:e}){let t=e?.panelId,n=e?.viewType,c=e?.projectName||void 0,[u,d]=(0,o.useState)(!1),f=i(e=>e.contributions!==null),p=i(e=>{if(t&&e.webviewPanels[t])return e.webviewPanels[t];if(n){let t=n.includes(`.`)?n:`${n}.view`;return Object.values(e.webviewPanels).find(e=>e.viewType===n||e.viewType===t)}}),m=p?.id??t,h=(0,o.useRef)(null),g=p?.html??``,_=l(g),v=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(p||!n||!f||c&&c===v.current)return;c&&(v.current=c);let e=n.includes(`.`)?n:`${n}.view`,t=!1;async function i(){let n=[];if(c)try{let e=r(),t=(await(await fetch(`/api/projects`,e?{headers:{Authorization:`Bearer ${e}`}}:{})).json()).data?.find(e=>e.name===c);t&&(n=[t.path])}catch{}t||window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:n,recovery:!0}}))}return i(),()=>{t=!0}},[p,n,c,f]);let y=e?.extensionId,b=i(e=>{if(y&&e.activationErrors[y])return e.activationErrors[y];if(n){for(let[t,r]of Object.entries(e.activationErrors))if(t===`ext-${n}`)return r}}),x=(0,o.useCallback)(()=>{if(d(!1),!n)return;let e=n.includes(`.`)?n:`${n}.view`;(async()=>{try{let t=r(),n=(await(await fetch(`/api/projects`,t?{headers:{Authorization:`Bearer ${t}`}}:{})).json()).data?.find(e=>e.name===c),i=n?[n.path]:[];window.dispatchEvent(new CustomEvent(`ext:command:execute`,{detail:{command:e,args:i,recovery:!0}}))}catch{}})()},[n,c]),S=(0,o.useRef)(null),C=(0,o.useRef)(n);return(0,o.useEffect)(()=>{S.current=m??null},[m]),(0,o.useEffect)(()=>{C.current=n},[n]),(0,o.useEffect)(()=>()=>{let e=S.current;if(e){let t=C.current;i.getState().removeWebviewPanel(e),window.dispatchEvent(new CustomEvent(`ext:webview:close`,{detail:{panelId:e,viewType:t}}))}},[]),(0,o.useEffect)(()=>{if(p){d(!1);return}if(!f||!n)return;let e=0,t=setInterval(()=>{if(e++,e>3){clearInterval(t),d(!0);return}x()},2e3);return()=>clearInterval(t)},[p,f,n,x]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{h.current&&e.source===h.current.contentWindow&&window.dispatchEvent(new CustomEvent(`ext:webview:send`,{detail:{panelId:m,message:e.data}}))};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[m]),(0,o.useEffect)(()=>{if(!m)return;let e=e=>{let{panelId:t,message:n}=e.detail;t===m&&h.current?.contentWindow?.postMessage(n,`*`)};return window.addEventListener(`ext:webview:message`,e),()=>window.removeEventListener(`ext:webview:message`,e)},[m]),!p||!g?(0,s.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-sm text-text-subtle`,children:u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`span`,{className:`text-destructive font-medium`,children:`Extension failed to load`}),b&&(0,s.jsx)(`span`,{className:`text-xs text-muted-foreground max-w-md text-center`,children:b}),(0,s.jsx)(`button`,{onClick:x,className:`text-xs text-primary hover:underline`,children:`Retry`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{className:`size-5 animate-spin`}),(0,s.jsx)(`span`,{children:`Loading extension...`})]})}):(0,s.jsx)(`div`,{className:`h-full w-full relative`,children:(0,s.jsx)(`iframe`,{ref:h,srcDoc:_,sandbox:`allow-scripts`,className:`w-full h-full border-0 bg-white dark:bg-zinc-900`,title:p.title},m)})}export{u as ExtensionWebview};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./createLucideIcon-BjHrJDVb.js";import{t as i}from"./arrow-down-D825m4vm.js";import{t as a}from"./arrow-up-Rcw6_KKu.js";import{i as o,t as s}from"./api-client-bbJLzRVE.js";import{n as c}from"./utils-B1vxU5xS.js";import{n as l}from"./project-store-Byuc-f31.js";import{D as u,Et as d,_t as f,mt as p,st as m,tt as h}from"./index-V5EQVDli.js";var g=r(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=e(n(),1),v=t(),y=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function b(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return y[Math.abs(t)%y.length]}function x({name:e,syncState:t,isHead:n,isTag:r,className:o}){let s=r?`#d97706`:b(e),l=r?h:t===`synced`?d:t===`ahead`?a:t===`behind`?i:t===`remote-only`?d:g,u=r?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,v.jsxs)(`span`,{className:c(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,o),style:{borderColor:s,backgroundColor:s+`1A`,color:`#1a1a1a`,...n?{"--tw-ring-color":s}:{}},title:u,children:[(0,v.jsx)(l,{className:`size-3 shrink-0`,style:{color:s}}),(0,v.jsx)(`span`,{className:`truncate`,children:e})]})}function S(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var C=100;function w({metadata:e}){let t=e?.projectName??l(u(e=>e.activeProject))?.name,[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[c,d]=(0,_.useState)(!0),h=(0,_.useRef)(null),g=(0,_.useCallback)(async(e=0,n=!1)=>{if(t){a(!0);try{let i=await s.get(`${o(t)}/git/graph?max=${C}&skip=${e}`);r(e=>n&&e?{...i,commits:[...e.commits,...i.commits]}:i),d(i.commits.length===C)}catch{}a(!1)}},[t]);(0,_.useEffect)(()=>{g()},[g]);let y=(0,_.useCallback)(()=>{i||!c||!n||g(n.commits.length,!0)},[i,c,n,g]),b=(0,_.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&y()},[y]);return t?(0,v.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,v.jsx)(f,{className:`size-4 text-text-secondary`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:n?`${n.commits.length} commits`:``}),(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`button`,{onClick:()=>g(),disabled:i,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,v.jsx)(m,{className:`size-3.5 ${i?`animate-spin`:``}`})})]}),!n&&i?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,v.jsx)(p,{className:`size-5 animate-spin text-primary`})}):n&&n.commits.length===0?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):n?(0,v.jsxs)(`div`,{ref:h,className:`flex-1 overflow-y-auto min-h-0`,onScroll:b,children:[n.commits.map(e=>(0,v.jsx)(T,{commit:e,branches:n.branches,head:n.head},e.hash)),i&&(0,v.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,v.jsx)(p,{className:`size-4 animate-spin text-text-subtle`})}),!c&&n.commits.length>0&&(0,v.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function T({commit:e,branches:t,head:n}){let r=e.hash===n,i=S(e.hash,e.refs,t,n);return(0,v.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,v.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,v.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,v.jsx)(x,{...e},`${e.name}-${e.syncState}`))}),(0,v.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:E(e.authorDate)})]})]})]})}function E(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{w as GitLogPanel};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./createLucideIcon-BjHrJDVb.js";import{t as i}from"./arrow-down-D825m4vm.js";import{t as a}from"./arrow-up-Rcw6_KKu.js";import{i as o,t as s}from"./api-client-bbJLzRVE.js";import{n as c}from"./utils-B1vxU5xS.js";import{n as l}from"./project-store-Byuc-f31.js";import{D as u,Et as d,_t as f,mt as p,st as m,tt as h}from"./index-DUQla965.js";var g=r(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_=e(n(),1),v=t(),y=[`#2563eb`,`#16a34a`,`#d97706`,`#9333ea`,`#dc2626`,`#0891b2`,`#c026d3`,`#ea580c`];function b(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return y[Math.abs(t)%y.length]}function x({name:e,syncState:t,isHead:n,isTag:r,className:o}){let s=r?`#d97706`:b(e),l=r?h:t===`synced`?d:t===`ahead`?a:t===`behind`?i:t===`remote-only`?d:g,u=r?`Tag: ${e}`:t===`synced`?`${e} — synced with remote`:t===`ahead`?`${e} — ahead of remote`:t===`behind`?`${e} — behind remote`:t===`remote-only`?`${e} — remote only`:`${e} — local only`;return(0,v.jsxs)(`span`,{className:c(`inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-tight max-w-[220px]`,n&&`ring-1 ring-offset-1 ring-offset-background`,t===`remote-only`&&`opacity-70`,o),style:{borderColor:s,backgroundColor:s+`1A`,color:`#1a1a1a`,...n?{"--tw-ring-color":s}:{}},title:u,children:[(0,v.jsx)(l,{className:`size-3 shrink-0`,style:{color:s}}),(0,v.jsx)(`span`,{className:`truncate`,children:e})]})}function S(e,t,n,r){let i=[],a=e===r;for(let e of t)e.startsWith(`tag: `)&&i.push({name:e.slice(5),syncState:`synced`,isTag:!0});let o=n.filter(t=>t.commitHash===e),s=o.filter(e=>!e.remote),c=o.filter(e=>e.remote);new Set(s.map(e=>e.name));let l=new Set;for(let e of s){let t=`local-only`;e.remotes.length>0&&(t=e.ahead>0&&e.behind===0?`ahead`:e.behind>0&&e.ahead===0?`behind`:`synced`),i.push({name:e.name,syncState:t,isHead:a&&e.current});for(let t of c){let n=t.name.replace(/^remotes\//,``),r=n.indexOf(`/`);r<0||n.slice(r+1)===e.name&&l.add(t.name)}}for(let e of c){if(l.has(e.name))continue;let t=e.name.replace(/^remotes\//,``);i.push({name:t,syncState:`remote-only`})}return i}var C=100;function w({metadata:e}){let t=e?.projectName??l(u(e=>e.activeProject))?.name,[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[c,d]=(0,_.useState)(!0),h=(0,_.useRef)(null),g=(0,_.useCallback)(async(e=0,n=!1)=>{if(t){a(!0);try{let i=await s.get(`${o(t)}/git/graph?max=${C}&skip=${e}`);r(e=>n&&e?{...i,commits:[...e.commits,...i.commits]}:i),d(i.commits.length===C)}catch{}a(!1)}},[t]);(0,_.useEffect)(()=>{g()},[g]);let y=(0,_.useCallback)(()=>{i||!c||!n||g(n.commits.length,!0)},[i,c,n,g]),b=(0,_.useCallback)(e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<200&&y()},[y]);return t?(0,v.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b border-border shrink-0`,children:[(0,v.jsx)(f,{className:`size-4 text-text-secondary`}),(0,v.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:`Git Log`}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:n?`${n.commits.length} commits`:``}),(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`button`,{onClick:()=>g(),disabled:i,className:`p-1 rounded text-text-subtle hover:text-text-secondary transition-colors`,title:`Refresh`,children:(0,v.jsx)(m,{className:`size-3.5 ${i?`animate-spin`:``}`})})]}),!n&&i?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,v.jsx)(p,{className:`size-5 animate-spin text-primary`})}):n&&n.commits.length===0?(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No commits yet`}):n?(0,v.jsxs)(`div`,{ref:h,className:`flex-1 overflow-y-auto min-h-0`,onScroll:b,children:[n.commits.map(e=>(0,v.jsx)(T,{commit:e,branches:n.branches,head:n.head},e.hash)),i&&(0,v.jsx)(`div`,{className:`flex items-center justify-center py-3`,children:(0,v.jsx)(p,{className:`size-4 animate-spin text-text-subtle`})}),!c&&n.commits.length>0&&(0,v.jsx)(`div`,{className:`text-center text-[10px] text-text-subtle py-3`,children:`End of history`})]}):null]}):(0,v.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`Select a project to view git log`})}function T({commit:e,branches:t,head:n}){let r=e.hash===n,i=S(e.hash,e.refs,t,n);return(0,v.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-1.5 border-b border-border/50 hover:bg-surface-elevated transition-colors ${r?`bg-primary/5`:``}`,children:[(0,v.jsx)(`div`,{className:`flex items-center pt-1 shrink-0`,children:(0,v.jsx)(`span`,{className:`size-2.5 rounded-full border-2 ${r?`border-primary bg-primary`:`border-text-subtle bg-transparent`}`})}),(0,v.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[i.length>0&&(0,v.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 mb-0.5`,children:i.map(e=>(0,v.jsx)(x,{...e},`${e.name}-${e.syncState}`))}),(0,v.jsx)(`p`,{className:`text-xs text-text-primary truncate leading-snug`,children:e.subject}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[10px] font-mono text-text-subtle`,children:e.abbreviatedHash}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle truncate`,children:e.authorName}),(0,v.jsx)(`span`,{className:`text-[10px] text-text-subtle shrink-0`,children:E(e.authorDate)})]})]})]})}function E(e){let t=new Date(e),n=Date.now()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<30?`${a}d`:t.toLocaleDateString(`en`,{month:`short`,day:`numeric`})}export{w as GitLogPanel};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/data-grid-overlay-editor-DZGHoBdv.js","assets/rolldown-runtime-FhOqtrmT.js","assets/dist-JYGF-20y.js","assets/vendor-markdown-0Mxgxy0L.js","assets/vendor-ui-UXCWAcmi.js","assets/data-grid-types-DcEKQO3y.js","assets/number-overlay-editor-DSno9uQL.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{b as n,x as r}from"./vendor-markdown-0Mxgxy0L.js";import{Y as i}from"./vendor-ui-UXCWAcmi.js";import{t as a}from"./createLucideIcon-BjHrJDVb.js";import{t as o}from"./arrow-down-D825m4vm.js";import{t as s}from"./arrow-up-Rcw6_KKu.js";import{n as c}from"./database-NmqHg29g.js";import{t as l}from"./chevron-right-BzAdxJRG.js";import{i as u,n as d,r as f,t as p}from"./search-BEy08Exr.js";import{i as m,n as h,r as g,t as _}from"./trash-2-D5P4y8p_.js";import{t as v}from"./sparkles-CulWHe4c.js";import{t as y}from"./x-BVxklgnd.js";import{K as b,j as x}from"./vendor-mermaid-Bfbv_YGB.js";import{t as S}from"./tab-store-B_Kf29se.js";import{$ as C,D as w,Q as T,ht as E,mt as D,wt as O}from"./index-V5EQVDli.js";import{A as k,B as A,C as ee,D as j,E as te,F as M,G as ne,H as re,I as ie,L as N,M as ae,N as P,O as F,P as oe,R as se,S as ce,T as I,U as L,V as le,W as ue,_ as de,a as fe,b as pe,c as me,d as he,f as ge,g as _e,h as R,i as ve,j as z,k as ye,l as B,m as be,n as V,o as xe,p as H,r as Se,s as Ce,t as U,u as we,v as Te,w as Ee,x as W,y as De,z as Oe}from"./data-grid-types-DcEKQO3y.js";import{t as G}from"./dist-JYGF-20y.js";import{n as ke,t as Ae}from"./use-monaco-theme-B9wG8s0C.js";import{n as je}from"./csv-parser-B9nz_FWE.js";var Me=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Ne=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Pe=`SELECT.FROM.WHERE.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.ALTER.DROP.INDEX.JOIN.LEFT.RIGHT.INNER.OUTER.ON.AND.OR.NOT.NULL.IS.IN.LIKE.BETWEEN.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MIN.MAX.CASE.WHEN.THEN.ELSE.END.EXISTS.UNION.ALL.ASC.DESC.ORDER BY.GROUP BY.LEFT JOIN.RIGHT JOIN.INNER JOIN.CROSS JOIN.FULL OUTER JOIN.IS NULL.IS NOT NULL`.split(`.`),Fe=[`COUNT`,`SUM`,`AVG`,`MIN`,`MAX`],Ie=[`=`,`!=`,`<>`,`>`,`<`,`>=`,`<=`,`LIKE`,`ILIKE`,`IN`,`NOT IN`,`BETWEEN`,`IS NULL`,`IS NOT NULL`],Le=[`ASC`,`DESC`];function Re(e,t){let n=e.split(`
2
+ import{o as e,t}from"./rolldown-runtime-FhOqtrmT.js";import{b as n,x as r}from"./vendor-markdown-0Mxgxy0L.js";import{Y as i}from"./vendor-ui-UXCWAcmi.js";import{t as a}from"./createLucideIcon-BjHrJDVb.js";import{t as o}from"./arrow-down-D825m4vm.js";import{t as s}from"./arrow-up-Rcw6_KKu.js";import{n as c}from"./database-NmqHg29g.js";import{t as l}from"./chevron-right-BzAdxJRG.js";import{i as u,n as d,r as f,t as p}from"./search-BEy08Exr.js";import{i as m,n as h,r as g,t as _}from"./trash-2-D5P4y8p_.js";import{t as v}from"./sparkles-CulWHe4c.js";import{t as y}from"./x-BVxklgnd.js";import{K as b,j as x}from"./vendor-mermaid-Bfbv_YGB.js";import{t as S}from"./tab-store-B_Kf29se.js";import{$ as C,D as w,Q as T,ht as E,mt as D,wt as O}from"./index-DUQla965.js";import{A as k,B as A,C as ee,D as j,E as te,F as M,G as ne,H as re,I as ie,L as N,M as ae,N as P,O as F,P as oe,R as se,S as ce,T as I,U as L,V as le,W as ue,_ as de,a as fe,b as pe,c as me,d as he,f as ge,g as _e,h as R,i as ve,j as z,k as ye,l as B,m as be,n as V,o as xe,p as H,r as Se,s as Ce,t as U,u as we,v as Te,w as Ee,x as W,y as De,z as Oe}from"./data-grid-types-DcEKQO3y.js";import{t as G}from"./dist-JYGF-20y.js";import{n as ke,t as Ae}from"./use-monaco-theme-B9wG8s0C.js";import{n as je}from"./csv-parser-B9nz_FWE.js";var Me=a(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Ne=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Pe=`SELECT.FROM.WHERE.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.ALTER.DROP.INDEX.JOIN.LEFT.RIGHT.INNER.OUTER.ON.AND.OR.NOT.NULL.IS.IN.LIKE.BETWEEN.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MIN.MAX.CASE.WHEN.THEN.ELSE.END.EXISTS.UNION.ALL.ASC.DESC.ORDER BY.GROUP BY.LEFT JOIN.RIGHT JOIN.INNER JOIN.CROSS JOIN.FULL OUTER JOIN.IS NULL.IS NOT NULL`.split(`.`),Fe=[`COUNT`,`SUM`,`AVG`,`MIN`,`MAX`],Ie=[`=`,`!=`,`<>`,`>`,`<`,`>=`,`<=`,`LIKE`,`ILIKE`,`IN`,`NOT IN`,`BETWEEN`,`IS NULL`,`IS NOT NULL`],Le=[`ASC`,`DESC`];function Re(e,t){let n=e.split(`
3
3
  `),r=0;for(let e=0;e<n.length;e++){let i=n[e].trim();e<t-1&&i.endsWith(`;`)&&(r=e+1)}let i=n.length-1;for(let e=t-1;e<n.length;e++)if(n[e].trim().endsWith(`;`)){i=e;break}for(;r<=i;){let e=n[r].trim();if(e&&!e.startsWith(`--`))break;r++}return n.slice(r,i+1).join(`
4
4
  `).trim()}var ze=new Map,Be=new Set(`WHERE.SET.ON.ORDER.GROUP.HAVING.LIMIT.LEFT.RIGHT.INNER.OUTER.CROSS.FULL.JOIN.AND.OR.VALUES.SELECT.FROM.INTO.UPDATE.DELETE.INSERT.CREATE.ALTER.DROP`.split(`.`));function Ve(e){let t=new Set,n=new Map,r=e.matchAll(/\b(?:FROM|JOIN|UPDATE|INTO)\s+"?(\w+)"?(?:\s+AS\s+(\w+)|\s+(?!(?:FROM|JOIN|UPDATE|INTO|WHERE|SET|ON|ORDER|GROUP|HAVING|LIMIT|LEFT|RIGHT|INNER|OUTER|CROSS|FULL|AND|OR|VALUES|SELECT)\b)(\w+))?/gi);for(let e of r){let r=e[1];t.add(r);let i=e[2]??e[3];i&&!Be.has(i.toUpperCase())&&n.set(i.toLowerCase(),r)}return{tableRefs:t,aliasMap:n}}function He(e,t){return t.get(e.toLowerCase())??e}async function Ue(e,t){let n=e.toLowerCase(),r=ze.get(n);if(!r)try{r=await t.getColumns(e),ze.set(n,r)}catch{r=[]}return r}async function We(e,t,n,r){let i=[],a=new Set;for(let o of e){let e=await Ue(o,t);for(let t of e){if(a.has(t.name))continue;a.add(t.name);let e=/[A-Z]/.test(t.name);i.push({label:t.name,kind:n.languages.CompletionItemKind.Field,detail:`${o} · ${t.type}`,insertText:e?`"${t.name}"`:t.name,range:r,sortText:`0`+t.name})}}return i}function Ge(e){if(/(\w+)\.\s*$/.test(e))return`dot`;let t=e.match(/\b(?:ORDER|GROUP)\s+BY\s+(?:[\w"]+\s+(?:ASC|DESC)\s*,\s*)*[\w"]+\s+(\w*)$/i);if(t){let e=t[1].toUpperCase();return e===`ASC`||e===`DESC`?`after-direction`:`sort-direction`}return/\b(?:ORDER|GROUP)\s+BY\s+.*(?:ASC|DESC)\s*,\s*\w*$/i.test(e)?`order-by-next-col`:/\b(?:WHERE|AND|OR)\s+[\w"]+\s+\S*$/i.test(e)?`operator`:/\b(?:FROM|JOIN|INTO|UPDATE|TABLE)\s+\w*$/i.test(e)?`table`:/\bINSERT\s+INTO\s+[\w"]+\s*\(\s*(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`insert-cols`:/\b(?:SELECT|WHERE|ORDER\s+BY|GROUP\s+BY|HAVING|SET|ON|AND|OR)\s+(?:[\w"]+\s*,\s*)*\w*$/i.test(e)?`columns`:/,\s*\w*$/.test(e)?`comma-cols`:`default`}function Ke(e,t){return{triggerCharacters:[`.`,`,`],provideCompletionItems:async(n,r)=>{try{let i=n.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:r.lineNumber,endColumn:r.column}),a=n.getWordUntilPosition(r),o={startLineNumber:r.lineNumber,endLineNumber:r.lineNumber,startColumn:a.startColumn,endColumn:a.endColumn},{tableRefs:s,aliasMap:c}=Ve(Re(n.getValue(),r.lineNumber)),l=[],u=Ge(i);if(u===`dot`){let n=i.match(/(\w+)\.\s*$/);if(n){let r=n[1],i=await Ue(He(r,c),t);for(let t of i){let n=/[A-Z]/.test(t.name);l.push({label:t.name,kind:e.languages.CompletionItemKind.Field,detail:t.type,insertText:n?`"${t.name}"`:t.name,range:o})}}return{suggestions:l}}if(u===`sort-direction`){for(let t of Le)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`after-direction`)return{suggestions:[]};if(u===`order-by-next-col`)return l.push(...await We(s,t,e,o)),{suggestions:l};if(u===`operator`){for(let t of Ie)l.push({label:t,kind:e.languages.CompletionItemKind.Operator,insertText:t,range:o,sortText:`0`+t});return{suggestions:l}}if(u===`table`){for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`0`+n.name});return{suggestions:l}}if(u===`insert-cols`)return l.push(...await We(s,t,e,o)),{suggestions:l};if(u===`columns`){if(l.push(...await We(s,t,e,o)),/\bSELECT\s+/i.test(i)){l.push({label:`*`,kind:e.languages.CompletionItemKind.Value,insertText:`*`,range:o,sortText:`00*`});for(let t of Fe)l.push({label:`${t}()`,kind:e.languages.CompletionItemKind.Function,insertText:`${t}($0)`,insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o,sortText:`1`+t})}for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`3`+t});return{suggestions:l}}if(u===`comma-cols`&&s.size>0)return l.push(...await We(s,t,e,o)),{suggestions:l};for(let t of Pe)l.push({label:t,kind:e.languages.CompletionItemKind.Keyword,insertText:t,range:o,sortText:`2`+t});for(let n of t.tables)l.push({label:n.name,kind:e.languages.CompletionItemKind.Struct,detail:n.schema,insertText:n.name,range:o,sortText:`1`+n.name});return{suggestions:l}}catch{return{suggestions:[]}}}}}function qe(){ze.clear()}var K=e(r(),1),Je=e(i(),1),q=n();function Ye(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),URL.revokeObjectURL(i)}function Xe({columns:e,rows:t,filename:n=`export`,exportAllUrl:r}){let[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(!1),c=(0,K.useRef)(null),l=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!i)return;let e=e=>{l.current&&!l.current.contains(e.target)&&c.current&&!c.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let u=(0,K.useCallback)(()=>a(e=>!e),[]),d=()=>{let r=je(e,t.map(t=>e.map(e=>String(t[e]??``))));Ye(`${n}.csv`,r,`text/csv`),a(!1)},f=()=>{let e=JSON.stringify(t,null,2);Ye(`${n}.json`,e,`application/json`),a(!1)},p=async()=>{let n=e.join(` `),r=t.map(t=>e.map(e=>String(t[e]??``)).join(` `)).join(`
5
5
  `);await navigator.clipboard.writeText(n+`
@@ -1 +1 @@
1
- import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./file-exclamation-point-Baz81y5z.js";import"./api-client-bbJLzRVE.js";import{mt as n}from"./index-V5EQVDli.js";import{t as r}from"./use-blob-url-BiQjyxOy.js";var i=e();function a({filePath:e,projectName:a}){let{blobUrl:o,error:s}=r(e,a);return s?(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,i.jsx)(t,{className:`size-10 text-text-subtle`}),(0,i.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):o?(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,i.jsx)(`img`,{src:o,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,i.jsx)(n,{className:`size-5 animate-spin text-text-subtle`})})}export{a as ImagePreview};
1
+ import{b as e}from"./vendor-markdown-0Mxgxy0L.js";import{t}from"./file-exclamation-point-Baz81y5z.js";import"./api-client-bbJLzRVE.js";import{mt as n}from"./index-DUQla965.js";import{t as r}from"./use-blob-url-BiQjyxOy.js";var i=e();function a({filePath:e,projectName:a}){let{blobUrl:o,error:s}=r(e,a);return s?(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,i.jsx)(t,{className:`size-10 text-text-subtle`}),(0,i.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):o?(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,i.jsx)(`img`,{src:o,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,i.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,i.jsx)(n,{className:`size-5 animate-spin text-text-subtle`})})}export{a as ImagePreview};