admin08077/Githubgemini
0
1import{r as l,j as e}from"./react-CIdJ77ke.js";import{a3 as g,w as j,L as u,J as y,M as b}from"./index-CX7Qxd1D.js";import{d as v}from"./fileUtils-DLahR3l0.js";import"./@braintree-DzxiOROe.js";import"./react-dom-R9L8nDNe.js";import"./scheduler-CoSDG3-6.js";import"./@google-CcUHq7Ay.js";import"./idb-Dob3nYDb.js";import"./marked-BrGMJkBT.js";import"./mermaid-KwKZWwy0.js";import"./dayjs-CeEF-NGT.js";import"./d3-transition-CiCB8KJE.js";import"./d3-timer-DdKHrDhs.js";import"./d3-dispatch-kxCwF96_.js";import"./d3-interpolate-CtIaNujU.js";import"./d3-color-amxIadob.js";import"./d3-selection-C52G7wmG.js";import"./d3-ease-DRPgKoYJ.js";import"./d3-zoom-BYoC3mS3.js";import"./dompurify-J5RlrwSC.js";import"./dagre-d3-es-CTpFWynZ.js";import"./lodash-es-Dt6r0yiR.js";import"./d3-shape-CX8xTzfR.js";import"./d3-path-CimkQT29.js";import"./d3-fetch-BOsq7VnW.js";import"./khroma-DUX6PT6k.js";import"./uuid-DhYbOkY1.js";import"./d3-scale-DRZz3QW5.js";import"./internmap-BkD7Hj8s.js";import"./d3-array-DGRYoJHh.js";import"./d3-format-CzD4bSOQ.js";import"./d3-time-format-CUNN4Ell.js";import"./d3-time-6cSPyVSY.js";import"./d3-axis-DSWTncID.js";import"./elkjs-oKFFZvz7.js";import"./cytoscape-DtBltrT8.js";import"./cytoscape-cose-bilkent-Cgr1thlj.js";import"./cose-base-CwCxnKwh.js";import"./layout-base-CMXQqlmj.js";import"./d3-sankey-DgqkLiUE.js";import"./d3-scale-chromatic-B-NsZVaP.js";import"./ts-dedent-DrFu-skq.js";import"./stylis-D5iaQeiq.js";import"./mdast-util-from-markdown-CLAsVoWb.js";import"./micromark-CTBPIv-_.js";import"./micromark-util-combine-extensions-Bka6Sc1c.js";import"./micromark-util-chunked-DrRIdSP-.js";import"./micromark-factory-space-x2vfxbz5.js";import"./micromark-util-character-Bcm1tP9o.js";import"./micromark-core-commonmark-AH8VCgT7.js";import"./micromark-util-classify-character-Cq7Fg3xE.js";import"./micromark-util-resolve-all-PQCKh0dx.js";import"./decode-named-character-reference-C3-224fz.js";import"./micromark-util-subtokenize-QwsxNXk2.js";import"./micromark-factory-destination-CypD_wgM.js";import"./micromark-factory-label-CRHH4ZHP.js";import"./micromark-factory-title-B7kCBvC9.js";import"./micromark-factory-whitespace-B322EA6O.js";import"./micromark-util-normalize-identifier-C9ANKk3v.js";import"./micromark-util-html-tag-name-DbKNfynz.js";import"./micromark-util-decode-numeric-character-reference-DRnCnno4.js";import"./micromark-util-decode-string-DJl8Y_PO.js";import"./unist-util-stringify-position-Ch_qCilz.js";import"./mdast-util-to-string-C_aolqmU.js";import"./jszip-CFFhfFtd.js";import"./octokit-B6bKu3NB.js";import"./@octokit-MBEWYTsi.js";import"./bottleneck-D_vuF9V7.js";import"./universal-user-agent-CLgqIJsR.js";import"./before-after-hook-y8XtM9xW.js";import"./fast-content-type-parse-3SwieiST.js";const N=`* commit 3a4b5c6d7e8f9g0h1i2j3k4l5m6n7o8p9q0r (HEAD -> main, origin/main)2|\\ Merge: 1a2b3c4 2d3e4f53| | Author: Dev One <dev.one@example.com>4| | Date: Mon Jul 15 11:30:00 2024 -04005| |6| | feat: Implement collapsible sidebar navigation7| |8* | commit 2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u (feature/new-sidebar)9| | Author: Dev Two <dev.two@example.com>10| | Date: Mon Jul 15 10:00:00 2024 -040011| |12| | feat: Add icons to sidebar items13| |14* | commit 1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r15|/ Author: Dev One <dev.one@example.com>16| Date: Fri Jul 12 16:45:00 2024 -040017|18| fix: Correct user authentication bug`,w=({logInput:i})=>{const m=l.useMemo(()=>{const r=i.split(`19`),o=[];let t=null;return r.forEach(s=>{const a=s.match(/^.?[\\|/ ]*\* commit (\w+)(.*)/);a?(t&&o.push(t),t={hash:a[1],shortHash:a[1].substring(0,7),refs:a[2].trim(),message:"",author:""}):t&&(s.includes("Author:")?t.author=s.split("Author:")[1].trim():s.trim().length>0&&!s.match(/^[\\|/ ]*[\\|/ ]/)&&(t.message+=s.trim()+" "))}),t&&o.push(t),o.map((s,a)=>({...s,x:50,y:50+a*60}))},[i]);return e.jsx("svg",{width:"100%",height:50+m.length*60,className:"min-h-[200px]",children:m.map((r,o)=>{const t=m[o+1];return e.jsxs("g",{children:[t&&e.jsx("line",{x1:r.x,y1:r.y,x2:t.x,y2:t.y,stroke:"var(--color-border)",strokeWidth:"2"}),e.jsxs("g",{className:"group cursor-pointer",children:[e.jsx("circle",{cx:r.x,cy:r.y,r:"8",fill:"var(--color-primary)",stroke:"var(--color-surface)",strokeWidth:"3"}),e.jsx("foreignObject",{x:r.x+20,y:r.y-25,width:"350",height:"50",children:e.jsxs("div",{className:"text-sm p-1",children:[e.jsx("p",{className:"font-bold truncate text-text-primary",children:r.message}),e.jsxs("p",{className:"text-xs text-text-secondary font-mono",children:[r.shortHash," ",e.jsx("span",{className:"text-amber-600",children:r.refs})]})]})}),e.jsx("title",{children:`Commit: ${r.hash}20Author: ${r.author}21 22${r.message}`})]})]},r.hash)})})},Pe=({logInput:i})=>{const[m,r]=l.useState(i||N),[o,t]=l.useState(""),[s,a]=l.useState(!1),[d,x]=l.useState(""),h=l.useCallback(async n=>{if(!n.trim()){x("Please paste git log output.");return}a(!0),x(""),t("");try{const c=g(n);let p="";for await(const f of c)p+=f,t(p)}catch(c){const p=c instanceof Error?c.message:"An unknown error occurred.";x(`Failed to analyze log: ${p}`)}finally{a(!1)}},[]);return l.useEffect(()=>{i&&(r(i),h(i))},[i,h]),e.jsxs("div",{className:"h-full flex flex-col p-4 sm:p-6 lg:p-8 text-text-primary",children:[e.jsxs("header",{className:"mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold flex items-center",children:[e.jsx(j,{}),e.jsx("span",{className:"ml-3",children:"Visual Git Tree"})]}),e.jsx("p",{className:"text-text-secondary mt-1",children:"Paste your `git log --graph` output to visualize the history and get an AI summary."})]}),e.jsxs("div",{className:"flex-grow grid grid-cols-1 lg:grid-cols-2 gap-6 h-full overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("label",{htmlFor:"log-input",className:"text-sm font-medium text-text-secondary mb-2",children:"Git Log Output"}),e.jsx("textarea",{id:"log-input",value:m,onChange:n=>r(n.target.value),placeholder:"Paste your git log output here...",className:"flex-grow p-4 bg-surface border border-border rounded-md resize-none font-mono text-sm"}),e.jsx("button",{onClick:()=>h(m),disabled:s,className:"btn-primary mt-4 w-full flex items-center justify-center px-6 py-3",children:s?e.jsx(u,{}):"Analyze & Summarize"})]}),e.jsxs("div",{className:"flex flex-col h-full gap-4",children:[e.jsxs("div",{className:"flex flex-col h-1/2",children:[e.jsx("label",{className:"text-sm font-medium text-text-secondary mb-2",children:"Commit Graph"}),e.jsx("div",{className:"flex-grow p-2 bg-surface border border-border rounded-md overflow-auto",children:e.jsx(w,{logInput:m})})]}),e.jsxs("div",{className:"flex flex-col h-1/2",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"text-sm font-medium text-text-secondary",children:"AI Summary"}),o&&!s&&e.jsxs("button",{onClick:()=>v(o,"summary.md","text/markdown"),className:"flex items-center gap-1 px-3 py-1 bg-gray-100 text-xs rounded-md hover:bg-gray-200",children:[e.jsx(y,{className:"w-4 h-4"})," Download Summary"]})]}),e.jsxs("div",{className:"flex-grow p-4 bg-background border border-border rounded-md overflow-y-auto",children:[s&&e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(u,{})}),d&&e.jsx("p",{className:"text-red-500",children:d}),o&&!s&&e.jsx(b,{content:o}),!s&&!o&&!d&&e.jsx("div",{className:"text-text-secondary h-full flex items-center justify-center",children:"AI summary will appear here."})]})]})]})]})]})};export{Pe as VisualGitTree};23//# sourceMappingURL=VisualGitTree-Cj3hu0Q0.js.map24 