tarsk 0.5.47 → 0.5.48

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 (33) hide show
  1. package/dist/index.js +31 -15
  2. package/dist/public/assets/{account-view-XO30M3P0.js → account-view-Bbdb8T18.js} +1 -1
  3. package/dist/public/assets/{browser-tab-B7XwV-sa.js → browser-tab-3DUg6V0M.js} +1 -1
  4. package/dist/public/assets/{commit-dialog-D96fJ90J.js → commit-dialog-CgHm8yd5.js} +1 -1
  5. package/dist/public/assets/{create-repo-dialog-CTyZJfi1.js → create-repo-dialog-BlvNaVRv.js} +1 -1
  6. package/dist/public/assets/{diff-view-JfXPy7qA.js → diff-view-BTMJ68_E.js} +1 -1
  7. package/dist/public/assets/{explorer-tab-view-CUFm_j8i.js → explorer-tab-view-BBkCWKSi.js} +2 -2
  8. package/dist/public/assets/{explorer-tree-D5h9dOAX.js → explorer-tree-CboAGH2h.js} +1 -1
  9. package/dist/public/assets/{explorer-view-IOQM4kWJ.js → explorer-view-CBxsEzQT.js} +1 -1
  10. package/dist/public/assets/git-ops-button-qjbfOO7Y.js +2 -0
  11. package/dist/public/assets/index-C7FLshNp.css +1 -0
  12. package/dist/public/assets/{index-B4PyD4Io.js → index-r-MGLt04.js} +6 -6
  13. package/dist/public/assets/{project-settings-view-DHZVnkug.js → project-settings-view-DuZuSAP6.js} +1 -1
  14. package/dist/public/assets/{pull-request-dialog-RwRZAOLd.js → pull-request-dialog-DUFq4dcj.js} +1 -1
  15. package/dist/public/assets/{settings-general-view-D94zYQNc.js → settings-general-view-DRoJpfeq.js} +1 -1
  16. package/dist/public/assets/{settings-instructions-view-DG6YpJy-.js → settings-instructions-view-DMiTyhgF.js} +1 -1
  17. package/dist/public/assets/{settings-mcp-servers-view-DsUxcHD0.js → settings-mcp-servers-view-D-ZPqbhw.js} +1 -1
  18. package/dist/public/assets/{settings-rules-view-BPKmp2c-.js → settings-rules-view-CpGhrZ4c.js} +1 -1
  19. package/dist/public/assets/{settings-skills-view-DD_0AweF.js → settings-skills-view-Bbo2EUTs.js} +1 -1
  20. package/dist/public/assets/{settings-slash-commands-view-CSEjoSTd.js → settings-slash-commands-view-B9knfs3R.js} +1 -1
  21. package/dist/public/assets/{settings-subagents-view-Bs5ftymi.js → settings-subagents-view-CmSR8G5x.js} +1 -1
  22. package/dist/public/assets/{settings-system-prompt-view-BNhTFs0x.js → settings-system-prompt-view-N-H35C8O.js} +1 -1
  23. package/dist/public/assets/{settings-view-CZ9Gvo8Y.js → settings-view-CjN-sUwG.js} +2 -2
  24. package/dist/public/assets/{terminal-panel-DwHeNF9e.js → terminal-panel-0S4qt1S4.js} +1 -1
  25. package/dist/public/assets/{todos-view-CWPTnaGF.js → todos-view-CMguWUyv.js} +1 -1
  26. package/dist/public/assets/{web-B3nTDZgN.js → web-CBt5zrp2.js} +1 -1
  27. package/dist/public/assets/{web-DVkb9rcs.js → web-Ca4UIlTP.js} +1 -1
  28. package/dist/public/assets/{web-C59q93HV.js → web-DltYtNVf.js} +1 -1
  29. package/dist/public/assets/{web-bG55HoO2.js → web-oCvIBpv0.js} +1 -1
  30. package/dist/public/index.html +2 -2
  31. package/package.json +1 -1
  32. package/dist/public/assets/git-ops-button-0IGtolLO.js +0 -2
  33. package/dist/public/assets/index-HzthG2_q.css +0 -1
package/dist/index.js CHANGED
@@ -6735,11 +6735,9 @@ function hasUnpushedCommits(gitRoot, currentBranch) {
6735
6735
  proc.on("error", () => resolve8(false));
6736
6736
  });
6737
6737
  }
6738
- function hasCommitsAheadOfDefault(gitRoot, defaultBranch) {
6738
+ function countRevListRange(gitRoot, range) {
6739
6739
  return new Promise((resolve8) => {
6740
- const proc = spawnProcess("git", ["rev-list", "--count", `origin/${defaultBranch}..HEAD`], {
6741
- cwd: gitRoot
6742
- });
6740
+ const proc = spawnProcess("git", ["rev-list", "--count", range], { cwd: gitRoot });
6743
6741
  let out = "";
6744
6742
  if (proc.stdout) {
6745
6743
  proc.stdout.on("data", (d) => {
@@ -6748,14 +6746,23 @@ function hasCommitsAheadOfDefault(gitRoot, defaultBranch) {
6748
6746
  }
6749
6747
  proc.on("close", (code) => {
6750
6748
  if (code === 0) {
6751
- resolve8(parseInt(out.trim(), 10) > 0);
6749
+ const count = parseInt(out.trim(), 10);
6750
+ resolve8(Number.isNaN(count) ? 0 : count);
6752
6751
  } else {
6753
- resolve8(false);
6752
+ resolve8(0);
6754
6753
  }
6755
6754
  });
6756
- proc.on("error", () => resolve8(false));
6755
+ proc.on("error", () => resolve8(0));
6757
6756
  });
6758
6757
  }
6758
+ async function getDefaultBranchAheadBehind(gitRoot, defaultBranch) {
6759
+ const remoteRef = `origin/${defaultBranch}`;
6760
+ const [ahead, behind] = await Promise.all([
6761
+ countRevListRange(gitRoot, `${remoteRef}..HEAD`),
6762
+ countRevListRange(gitRoot, `HEAD..${remoteRef}`)
6763
+ ]);
6764
+ return { ahead, behind };
6765
+ }
6759
6766
  async function getRemoteOrigin(gitRoot) {
6760
6767
  if (isGitSubprocessTimingEnabled()) {
6761
6768
  const result = await runGitCommandTimed("getRemoteOrigin", gitRoot, [
@@ -11396,8 +11403,7 @@ async function createCodingTools(cwd, options) {
11396
11403
  }
11397
11404
  }
11398
11405
  }
11399
- let filteredTools = applyCodeSearchInvalidationHooks([...coreTools], options?.threadId);
11400
- filteredTools = filterToolsBySkillAllowlist(filteredTools, options?.skills ?? []);
11406
+ const filteredTools = applyCodeSearchInvalidationHooks([...coreTools], options?.threadId);
11401
11407
  const filteredDeferredTools = /* @__PURE__ */ new Map();
11402
11408
  for (const [name, tool] of deferredTools) {
11403
11409
  const filtered = filterToolsBySkillAllowlist([tool], options?.skills ?? []);
@@ -28797,16 +28803,22 @@ async function computeUnifiedGitStatus(db, threadId, fresh, tracker) {
28797
28803
  const status = !hasUpstream ? "Up to date" : ahead > 0 && behind > 0 ? "Diverged" : behind > 0 ? "Behind" : ahead > 0 ? "Ahead" : "Up to date";
28798
28804
  const emptyPrStatus = { exists: false };
28799
28805
  const shouldCheckPr = isOnGitHub && Boolean(currentBranch) && currentBranch !== "HEAD" && hasRemoteBranchExists && currentBranch !== defaultBranchName;
28800
- const [commitsAheadOfDefault, prStatus] = await Promise.all([
28801
- defaultBranchName && currentBranch && currentBranch !== defaultBranchName ? tracker.step(
28802
- "hasCommitsAheadOfDefault",
28803
- () => hasCommitsAheadOfDefault(gitRoot, defaultBranchName).catch(() => false)
28804
- ) : Promise.resolve(false),
28806
+ const [defaultBranchComparison, prStatus] = await Promise.all([
28807
+ defaultBranchName && currentBranch && remoteUrl ? tracker.step(
28808
+ "getDefaultBranchAheadBehind",
28809
+ () => getDefaultBranchAheadBehind(gitRoot, defaultBranchName).catch(() => ({
28810
+ ahead: 0,
28811
+ behind: 0
28812
+ }))
28813
+ ) : Promise.resolve({ ahead: 0, behind: 0 }),
28805
28814
  shouldCheckPr ? tracker.step(
28806
28815
  "getPullRequestStatus",
28807
28816
  () => getPullRequestStatusCached(gitRoot, currentBranch, fresh).catch(() => emptyPrStatus)
28808
28817
  ) : Promise.resolve(emptyPrStatus)
28809
28818
  ]);
28819
+ const defaultBranchAhead = defaultBranchComparison.ahead;
28820
+ const defaultBranchBehind = defaultBranchComparison.behind;
28821
+ const commitsAheadOfDefault = defaultBranchName && currentBranch && currentBranch !== defaultBranchName ? defaultBranchAhead > 0 : false;
28810
28822
  return {
28811
28823
  hasChanges,
28812
28824
  changedFilesCount,
@@ -28814,6 +28826,8 @@ async function computeUnifiedGitStatus(db, threadId, fresh, tracker) {
28814
28826
  hasUnpushedCommits: hasUnpushed,
28815
28827
  hasRemoteBranch: hasRemoteBranchExists,
28816
28828
  commitsAheadOfDefault,
28829
+ defaultBranchAhead,
28830
+ defaultBranchBehind,
28817
28831
  isOnGitHub,
28818
28832
  remoteUrl,
28819
28833
  canCreateRepo: !isOnGitHub && remoteUrl.length === 0,
@@ -28893,7 +28907,9 @@ async function gitUnifiedStatusHandler(c, _metadataManager, db) {
28893
28907
  status: "Up to date",
28894
28908
  defaultBranch: null,
28895
28909
  prExists: false,
28896
- commitsAheadOfDefault: false
28910
+ commitsAheadOfDefault: false,
28911
+ defaultBranchAhead: 0,
28912
+ defaultBranchBehind: 0
28897
28913
  };
28898
28914
  return c.json({
28899
28915
  ...staleCached ?? placeholder,
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Mi as n,Ro as r,X as i,Xi as a,Zo as o,in as s,ls as c,os as l,so as u}from"./dialogs-config-BEazgV7k.js";import{C as d,D as f,S as p,v as m}from"./history-view-BMVTxWTg.js";import{P as h}from"./index-B4PyD4Io.js";import{t as g}from"./skeleton-6mGMglV0.js";var _=e(c(),1),v=l();function y(){let[e,c]=(0,_.useState)(null),[l,y]=(0,_.useState)(!0);(0,_.useEffect)(()=>{b();let e=()=>{document.visibilityState===`visible`&&b()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function b(){y(!0);try{c(await i())}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{y(!1)}}function x(){s(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function S(){s(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(l)return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsxs)(`div`,{className:`mb-6`,children:[(0,v.jsx)(g,{className:`h-8 w-32 mb-2`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsx)(g,{className:`h-4 w-20`}),(0,v.jsx)(g,{className:`h-9 w-28`})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsx)(g,{className:`h-6 w-32`}),(0,v.jsx)(g,{className:`h-4 w-full`})]})]}),(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-28`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsx)(g,{className:`h-9 w-28 shrink-0`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-36`}),(0,v.jsx)(g,{className:`h-4 w-56`}),(0,v.jsx)(g,{className:`h-4 w-32`})]}),(0,v.jsx)(g,{className:`h-9 w-24 shrink-0`})]})]})]})]})});let C=e?.plan===`unlimited-pro`;return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsx)(p,{title:`Account`,description:`Manage your Tarsk plan and prompt balance.`}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsxs)(`div`,{className:n(a.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(u,{className:`h-4 w-4`}),`Balance`]}),(0,v.jsx)(`div`,{className:`flex items-end gap-2`,children:C?(0,v.jsx)(`span`,{className:a.stat,children:`Unlimited`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:a.stat,children:e?.promptsRemaining.toLocaleString()??0}),(0,v.jsx)(`span`,{className:`${a.caption} mb-1`,children:`prompts remaining`})]})})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsxs)(`div`,{className:n(a.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(r,{className:`h-4 w-4`}),`Current Plan`]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:a.label,children:C?`Unlimited Pro`:`Pay as you go`}),C&&(0,v.jsx)(`span`,{className:n(a.compact,`rounded-full bg-primary/10 px-2 py-0.5 font-medium text-primary`),children:`Active`})]}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:C?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!C&&(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(d,{title:`Add Prompts`,className:`mb-0`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,v.jsx)(`span`,{className:a.label,children:`1,000 Prompts`})}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,v.jsx)(t,{onClick:x,className:`shrink-0`,children:`Top Up Balance`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(r,{className:`h-4 w-4 text-primary`}),(0,v.jsx)(`span`,{className:a.label,children:`Unlimited Pro Plan`})]}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,v.jsxs)(`ul`,{className:n(a.bodyMuted,`space-y-0.5`),children:[(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(o,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(o,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,v.jsx)(t,{onClick:S,className:`shrink-0`,children:`Purchase`})]})]})]})]})})}export{y as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Mi as n,Ro as r,X as i,Xi as a,Zo as o,in as s,ls as c,os as l,so as u}from"./dialogs-config-BEazgV7k.js";import{C as d,D as f,S as p,v as m}from"./history-view-BMVTxWTg.js";import{P as h}from"./index-r-MGLt04.js";import{t as g}from"./skeleton-6mGMglV0.js";var _=e(c(),1),v=l();function y(){let[e,c]=(0,_.useState)(null),[l,y]=(0,_.useState)(!0);(0,_.useEffect)(()=>{b();let e=()=>{document.visibilityState===`visible`&&b()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function b(){y(!0);try{c(await i())}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{y(!1)}}function x(){s(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function S(){s(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(l)return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsxs)(`div`,{className:`mb-6`,children:[(0,v.jsx)(g,{className:`h-8 w-32 mb-2`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsx)(g,{className:`h-4 w-20`}),(0,v.jsx)(g,{className:`h-9 w-28`})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsx)(g,{className:`h-6 w-32`}),(0,v.jsx)(g,{className:`h-4 w-full`})]})]}),(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-28`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsx)(g,{className:`h-9 w-28 shrink-0`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-36`}),(0,v.jsx)(g,{className:`h-4 w-56`}),(0,v.jsx)(g,{className:`h-4 w-32`})]}),(0,v.jsx)(g,{className:`h-9 w-24 shrink-0`})]})]})]})]})});let C=e?.plan===`unlimited-pro`;return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsx)(p,{title:`Account`,description:`Manage your Tarsk plan and prompt balance.`}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsxs)(`div`,{className:n(a.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(u,{className:`h-4 w-4`}),`Balance`]}),(0,v.jsx)(`div`,{className:`flex items-end gap-2`,children:C?(0,v.jsx)(`span`,{className:a.stat,children:`Unlimited`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:a.stat,children:e?.promptsRemaining.toLocaleString()??0}),(0,v.jsx)(`span`,{className:`${a.caption} mb-1`,children:`prompts remaining`})]})})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsxs)(`div`,{className:n(a.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(r,{className:`h-4 w-4`}),`Current Plan`]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:a.label,children:C?`Unlimited Pro`:`Pay as you go`}),C&&(0,v.jsx)(`span`,{className:n(a.compact,`rounded-full bg-primary/10 px-2 py-0.5 font-medium text-primary`),children:`Active`})]}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:C?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!C&&(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(d,{title:`Add Prompts`,className:`mb-0`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,v.jsx)(`span`,{className:a.label,children:`1,000 Prompts`})}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,v.jsx)(t,{onClick:x,className:`shrink-0`,children:`Top Up Balance`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(r,{className:`h-4 w-4 text-primary`}),(0,v.jsx)(`span`,{className:a.label,children:`Unlimited Pro Plan`})]}),(0,v.jsx)(`p`,{className:a.bodyMuted,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,v.jsxs)(`ul`,{className:n(a.bodyMuted,`space-y-0.5`),children:[(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(o,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(o,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,v.jsx)(t,{onClick:S,className:`shrink-0`,children:`Purchase`})]})]})]})]})})}export{y as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fo as t,Fr as n,Ha as r,Ir as i,Mi as a,Na as o,Nr as s,Pr as c,Wn as l,Xi as u,in as d,ka as f,ls as p,os as m,qr as h,ro as g,ss as _}from"./dialogs-config-BEazgV7k.js";import{R as v,_ as y,b,j as x,m as S,n as C}from"./index-B4PyD4Io.js";var w=_(),T=e(p(),1),E=m();function D(e){let t=e.trim();return t?(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://${t}`),t):``}function O(e){return e?e.querySelector(`electrobun-webview`):null}function k(e){e.webviewId!=null&&(e.toggleHidden(!0),e.togglePassthrough(!0))}function A(e){e.webviewId!=null&&(e.toggleHidden(!1),e.togglePassthrough(!1),e.syncDimensions(!0))}function j(e,t){let n=!1,r=0;function i(){if(!n){if(e.webviewId==null){r=requestAnimationFrame(i);return}t&&e.getAttribute(`src`)!==t&&e.loadURL(t),A(e)}}return r=requestAnimationFrame(i),function(){n=!0,cancelAnimationFrame(r)}}function M(e){let t=(0,w.c)(9),{onClick:n,label:r,children:a,isActive:o}=e,l=`p-1.5 rounded transition-colors ${o!==void 0&&o?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,u;t[0]!==a||t[1]!==n||t[2]!==l?(u=(0,E.jsx)(i,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,onClick:n,className:l,children:a})}),t[0]=a,t[1]=n,t[2]=l,t[3]=u):u=t[3];let d;t[4]===r?d=t[5]:(d=(0,E.jsx)(c,{children:r}),t[4]=r,t[5]=d);let f;return t[6]!==u||t[7]!==d?(f=(0,E.jsxs)(s,{children:[u,d]}),t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function N(){let{activeMainTab:e}=x(),{devServerUrl:i}=b(),{browserResetTrigger:s,browserDeviceMode:c,setBrowserDeviceMode:p}=C(),m=v(e=>e.selectedProjectId),_=v(e=>e.projects).find(e=>e.projectId===m),[w,N]=(0,T.useState)(``),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(c),B=(0,T.useRef)(null),V=(0,T.useRef)(I),H=(0,T.useRef)(null),U=(0,T.useRef)(null),W=l(),G=S(),K=W&&e===`browser`&&!!P,[q,J]=(0,T.useState)(K);V.current=I,(0,T.useEffect)(()=>{z(c)},[c]);function Y(e){z(e),p(e)}function X(){return B.current??O(U.current)}(0,T.useLayoutEffect)(()=>{if(!W)return;if(K){J(!0);return}let e=X();e&&k(e);let t=requestAnimationFrame(()=>{J(!1)});return function(){cancelAnimationFrame(t)}},[K,W,P]),(0,T.useEffect)(()=>{F(``),L(``),N(``);let e=B.current;e&&(e.src=``),H.current&&(H.current.src=``)},[s]),(0,T.useEffect)(()=>{if(!i)return;let e=D(i);N(e),F(e),L(e)},[i]);let Z=(0,T.useCallback)(e=>{B.current=e,e&&j(e,V.current)},[]);(0,T.useLayoutEffect)(()=>{if(!W||!q)return;let e=X();!e||e.webviewId==null||A(e)},[q,W,P,R]),(0,T.useEffect)(()=>{let e=X();if(!(!W||!e||!I||!q))return j(e,I)},[I,W,P,q]),(0,T.useEffect)(()=>{let e=X();if(!W||!e||!q)return;function t(e){let t=typeof e.detail==`string`?e.detail:P;t&&(F(t),L(``),N(t))}function n(e){let t=typeof e.detail==`string`?e.detail:P;t&&(F(t),N(t))}function r(e){let t=e.detail,n=typeof t==`string`?t:typeof t==`object`&&t&&`url`in t?String(t.url):``;n&&d(n)}return e.on(`did-navigate`,t),e.on(`did-navigate-in-page`,n),e.on(`new-window-open`,r),function(){e.off(`did-navigate`,t),e.off(`did-navigate-in-page`,n),e.off(`new-window-open`,r)}},[P,W,q]);function Q(e){let t=D(e);t&&(N(t),F(t),L(t))}function ee(e){e.key===`Enter`&&Q(w)}function te(){if(W){let e=X();e&&e.reload();return}let e=H.current;if(!e)return;let t=e.src;e.src=``,requestAnimationFrame(()=>{e.src=t})}let $={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}}[R];function ne(){return W?q?(0,T.createElement)(`electrobun-webview`,{ref:Z,src:P,preload:G,renderer:`native`,className:`block h-full w-full bg-background`}):null:(0,E.jsx)(`iframe`,{ref:H,src:P,className:`h-full w-full border-none`,title:`Browser`})}return(0,E.jsx)(n,{children:(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-2`,children:[(0,E.jsx)(h,{type:`text`,value:w,onChange:e=>N(e.target.value),onKeyDown:ee,placeholder:`Enter URL...`,className:a(`flex-1 rounded-full bg-muted font-mono`),spellCheck:!1}),P&&(0,E.jsx)(M,{onClick:te,label:`Refresh page`,children:(0,E.jsx)(r,{size:15})}),P&&(0,E.jsxs)(`div`,{className:`flex items-center rounded-md bg-muted p-0.5`,children:[(0,E.jsx)(M,{onClick:()=>Y(`desktop`),label:`Desktop view`,isActive:R===`desktop`,children:(0,E.jsx)(g,{size:15})}),(0,E.jsx)(M,{onClick:()=>Y(`tablet`),label:`Tablet view`,isActive:R===`tablet`,children:(0,E.jsx)(f,{size:15})}),(0,E.jsx)(M,{onClick:()=>Y(`mobile`),label:`Mobile view`,isActive:R===`mobile`,children:(0,E.jsx)(o,{size:15})})]}),P&&(0,E.jsx)(M,{onClick:()=>void d(P),label:`Open in external browser`,children:(0,E.jsx)(t,{size:15})})]}),P?(0,E.jsx)(`div`,{ref:U,className:`flex min-h-0 flex-1 items-center justify-center bg-background`,children:(0,E.jsx)(`div`,{className:`overflow-hidden border border-border bg-background shadow-sm ${R===`desktop`?`h-full w-full rounded-none border-0 shadow-none`:`rounded-lg`}`,style:{width:$.width,height:$.height,maxWidth:`100%`,maxHeight:`100%`},children:ne()})}):(0,E.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6 text-muted-foreground`,children:m&&_?.runCommand?(0,E.jsx)(y,{projectId:m,runCommand:_.runCommand,large:!0}):(0,E.jsx)(`p`,{className:u.body,children:`Enter a URL to browse`})})]})})}export{N as BrowserTab};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fo as t,Fr as n,Ha as r,Ir as i,Mi as a,Na as o,Nr as s,Pr as c,Wn as l,Xi as u,in as d,ka as f,ls as p,os as m,qr as h,ro as g,ss as _}from"./dialogs-config-BEazgV7k.js";import{R as v,_ as y,b,j as x,m as S,n as C}from"./index-r-MGLt04.js";var w=_(),T=e(p(),1),E=m();function D(e){let t=e.trim();return t?(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://${t}`),t):``}function O(e){return e?e.querySelector(`electrobun-webview`):null}function k(e){e.webviewId!=null&&(e.toggleHidden(!0),e.togglePassthrough(!0))}function A(e){e.webviewId!=null&&(e.toggleHidden(!1),e.togglePassthrough(!1),e.syncDimensions(!0))}function j(e,t){let n=!1,r=0;function i(){if(!n){if(e.webviewId==null){r=requestAnimationFrame(i);return}t&&e.getAttribute(`src`)!==t&&e.loadURL(t),A(e)}}return r=requestAnimationFrame(i),function(){n=!0,cancelAnimationFrame(r)}}function M(e){let t=(0,w.c)(9),{onClick:n,label:r,children:a,isActive:o}=e,l=`p-1.5 rounded transition-colors ${o!==void 0&&o?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,u;t[0]!==a||t[1]!==n||t[2]!==l?(u=(0,E.jsx)(i,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,onClick:n,className:l,children:a})}),t[0]=a,t[1]=n,t[2]=l,t[3]=u):u=t[3];let d;t[4]===r?d=t[5]:(d=(0,E.jsx)(c,{children:r}),t[4]=r,t[5]=d);let f;return t[6]!==u||t[7]!==d?(f=(0,E.jsxs)(s,{children:[u,d]}),t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function N(){let{activeMainTab:e}=x(),{devServerUrl:i}=b(),{browserResetTrigger:s,browserDeviceMode:c,setBrowserDeviceMode:p}=C(),m=v(e=>e.selectedProjectId),_=v(e=>e.projects).find(e=>e.projectId===m),[w,N]=(0,T.useState)(``),[P,F]=(0,T.useState)(``),[I,L]=(0,T.useState)(``),[R,z]=(0,T.useState)(c),B=(0,T.useRef)(null),V=(0,T.useRef)(I),H=(0,T.useRef)(null),U=(0,T.useRef)(null),W=l(),G=S(),K=W&&e===`browser`&&!!P,[q,J]=(0,T.useState)(K);V.current=I,(0,T.useEffect)(()=>{z(c)},[c]);function Y(e){z(e),p(e)}function X(){return B.current??O(U.current)}(0,T.useLayoutEffect)(()=>{if(!W)return;if(K){J(!0);return}let e=X();e&&k(e);let t=requestAnimationFrame(()=>{J(!1)});return function(){cancelAnimationFrame(t)}},[K,W,P]),(0,T.useEffect)(()=>{F(``),L(``),N(``);let e=B.current;e&&(e.src=``),H.current&&(H.current.src=``)},[s]),(0,T.useEffect)(()=>{if(!i)return;let e=D(i);N(e),F(e),L(e)},[i]);let Z=(0,T.useCallback)(e=>{B.current=e,e&&j(e,V.current)},[]);(0,T.useLayoutEffect)(()=>{if(!W||!q)return;let e=X();!e||e.webviewId==null||A(e)},[q,W,P,R]),(0,T.useEffect)(()=>{let e=X();if(!(!W||!e||!I||!q))return j(e,I)},[I,W,P,q]),(0,T.useEffect)(()=>{let e=X();if(!W||!e||!q)return;function t(e){let t=typeof e.detail==`string`?e.detail:P;t&&(F(t),L(``),N(t))}function n(e){let t=typeof e.detail==`string`?e.detail:P;t&&(F(t),N(t))}function r(e){let t=e.detail,n=typeof t==`string`?t:typeof t==`object`&&t&&`url`in t?String(t.url):``;n&&d(n)}return e.on(`did-navigate`,t),e.on(`did-navigate-in-page`,n),e.on(`new-window-open`,r),function(){e.off(`did-navigate`,t),e.off(`did-navigate-in-page`,n),e.off(`new-window-open`,r)}},[P,W,q]);function Q(e){let t=D(e);t&&(N(t),F(t),L(t))}function ee(e){e.key===`Enter`&&Q(w)}function te(){if(W){let e=X();e&&e.reload();return}let e=H.current;if(!e)return;let t=e.src;e.src=``,requestAnimationFrame(()=>{e.src=t})}let $={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}}[R];function ne(){return W?q?(0,T.createElement)(`electrobun-webview`,{ref:Z,src:P,preload:G,renderer:`native`,className:`block h-full w-full bg-background`}):null:(0,E.jsx)(`iframe`,{ref:H,src:P,className:`h-full w-full border-none`,title:`Browser`})}return(0,E.jsx)(n,{children:(0,E.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-2`,children:[(0,E.jsx)(h,{type:`text`,value:w,onChange:e=>N(e.target.value),onKeyDown:ee,placeholder:`Enter URL...`,className:a(`flex-1 rounded-full bg-muted font-mono`),spellCheck:!1}),P&&(0,E.jsx)(M,{onClick:te,label:`Refresh page`,children:(0,E.jsx)(r,{size:15})}),P&&(0,E.jsxs)(`div`,{className:`flex items-center rounded-md bg-muted p-0.5`,children:[(0,E.jsx)(M,{onClick:()=>Y(`desktop`),label:`Desktop view`,isActive:R===`desktop`,children:(0,E.jsx)(g,{size:15})}),(0,E.jsx)(M,{onClick:()=>Y(`tablet`),label:`Tablet view`,isActive:R===`tablet`,children:(0,E.jsx)(f,{size:15})}),(0,E.jsx)(M,{onClick:()=>Y(`mobile`),label:`Mobile view`,isActive:R===`mobile`,children:(0,E.jsx)(o,{size:15})})]}),P&&(0,E.jsx)(M,{onClick:()=>void d(P),label:`Open in external browser`,children:(0,E.jsx)(t,{size:15})})]}),P?(0,E.jsx)(`div`,{ref:U,className:`flex min-h-0 flex-1 items-center justify-center bg-background`,children:(0,E.jsx)(`div`,{className:`overflow-hidden border border-border bg-background shadow-sm ${R===`desktop`?`h-full w-full rounded-none border-0 shadow-none`:`rounded-lg`}`,style:{width:$.width,height:$.height,maxWidth:`100%`,maxHeight:`100%`},children:ne()})}):(0,E.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6 text-muted-foreground`,children:m&&_?.runCommand?(0,E.jsx)(y,{projectId:m,runCommand:_.runCommand,large:!0}):(0,E.jsx)(`p`,{className:u.body,children:`Enter a URL to browse`})})]})})}export{N as BrowserTab};
@@ -1 +1 @@
1
- import{$r as e,Ai as t,Fr as n,Gr as r,Ir as i,Jr as a,Ma as o,Nr as s,Pr as c,Qr as l,Xi as u,Xr as d,Zr as f,ei as p,os as m,ss as h,uo as g}from"./dialogs-config-BEazgV7k.js";import{a as _}from"./onboarding-Bi5MieW-.js";import{I as v}from"./index-B4PyD4Io.js";var y=h(),b=m();function x(m){let h=(0,y.c)(47),{open:x,onOpenChange:S,commitMessage:C,onCommitMessageChange:w,autoGenerateCommitMessage:T,onAutoGenerateChange:E,isGeneratingMessage:D,isLoading:O,onGenerateMessage:k,onCommit:A,currentBranch:j}=m,M;h[0]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,b.jsx)(p,{children:`Commit Changes`}),h[0]=M):M=h[0];let N;h[1]===j?N=h[2]:(N=(0,b.jsxs)(e,{children:[M,(0,b.jsxs)(f,{children:[`Enter a commit message for your changes on branch `,j]})]}),h[1]=j,h[2]=N);let P;h[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(r,{htmlFor:`commit-message`,children:`Commit Message`}),h[3]=P):P=h[3];let F;h[4]===w?F=h[5]:(F=e=>w(e.target.value),h[4]=w,h[5]=F);let I;h[6]!==C||h[7]!==F?(I=(0,b.jsx)(v,{id:`commit-message`,placeholder:`Enter commit message...`,value:C,onChange:F,className:`pr-10 h-full min-h-[14rem] resize-none`}),h[6]=C,h[7]=F,h[8]=I):I=h[8];let L=D||O,R;h[9]===D?R=h[10]:(R=D?(0,b.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,b.jsx)(o,{className:`h-3.5 w-3.5`}),h[9]=D,h[10]=R);let z;h[11]!==k||h[12]!==L||h[13]!==R?(z=(0,b.jsx)(i,{asChild:!0,children:(0,b.jsx)(t,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:k,disabled:L,children:R})}),h[11]=k,h[12]=L,h[13]=R,h[14]=z):z=h[14];let B=D?`Generating commit message...`:`Generate commit message with AI`,V;h[15]===B?V=h[16]:(V=(0,b.jsx)(c,{children:B}),h[15]=B,h[16]=V);let H;h[17]!==V||h[18]!==z?(H=(0,b.jsx)(n,{children:(0,b.jsxs)(s,{children:[z,V]})}),h[17]=V,h[18]=z,h[19]=H):H=h[19];let U;h[20]!==H||h[21]!==I?(U=(0,b.jsx)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:(0,b.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[P,(0,b.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[I,H]})]})}),h[20]=H,h[21]=I,h[22]=U):U=h[22];let W;h[23]===E?W=h[24]:(W=e=>E(e===!0),h[23]=E,h[24]=W);let G;h[25]!==T||h[26]!==W?(G=(0,b.jsx)(_,{id:`auto-generate`,checked:T,onCheckedChange:W}),h[25]=T,h[26]=W,h[27]=G):G=h[27];let K;h[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,b.jsx)(r,{htmlFor:`auto-generate`,className:u.labelNormal,children:`Auto generate commit messages`}),h[28]=K):K=h[28];let q;h[29]===G?q=h[30]:(q=(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[G,K]}),h[29]=G,h[30]=q);let J;h[31]!==C||h[32]!==O?(J=O||!C.trim(),h[31]=C,h[32]=O,h[33]=J):J=h[33];let Y=O?`Committing...`:`Commit`,X;h[34]!==A||h[35]!==J||h[36]!==Y?(X=(0,b.jsx)(l,{children:(0,b.jsx)(t,{onClick:A,disabled:J,children:Y})}),h[34]=A,h[35]=J,h[36]=Y,h[37]=X):X=h[37];let Z;h[38]!==U||h[39]!==q||h[40]!==X||h[41]!==N?(Z=(0,b.jsxs)(d,{className:`flex max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:h-[min(36rem,85dvh)]`,children:[N,U,q,X]}),h[38]=U,h[39]=q,h[40]=X,h[41]=N,h[42]=Z):Z=h[42];let Q;return h[43]!==S||h[44]!==x||h[45]!==Z?(Q=(0,b.jsx)(a,{open:x,onOpenChange:S,children:Z}),h[43]=S,h[44]=x,h[45]=Z,h[46]=Q):Q=h[46],Q}export{x as CommitDialog};
1
+ import{$r as e,Ai as t,Fr as n,Gr as r,Ir as i,Jr as a,Ma as o,Nr as s,Pr as c,Qr as l,Xi as u,Xr as d,Zr as f,ei as p,os as m,ss as h,uo as g}from"./dialogs-config-BEazgV7k.js";import{a as _}from"./onboarding-Bi5MieW-.js";import{I as v}from"./index-r-MGLt04.js";var y=h(),b=m();function x(m){let h=(0,y.c)(47),{open:x,onOpenChange:S,commitMessage:C,onCommitMessageChange:w,autoGenerateCommitMessage:T,onAutoGenerateChange:E,isGeneratingMessage:D,isLoading:O,onGenerateMessage:k,onCommit:A,currentBranch:j}=m,M;h[0]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,b.jsx)(p,{children:`Commit Changes`}),h[0]=M):M=h[0];let N;h[1]===j?N=h[2]:(N=(0,b.jsxs)(e,{children:[M,(0,b.jsxs)(f,{children:[`Enter a commit message for your changes on branch `,j]})]}),h[1]=j,h[2]=N);let P;h[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(r,{htmlFor:`commit-message`,children:`Commit Message`}),h[3]=P):P=h[3];let F;h[4]===w?F=h[5]:(F=e=>w(e.target.value),h[4]=w,h[5]=F);let I;h[6]!==C||h[7]!==F?(I=(0,b.jsx)(v,{id:`commit-message`,placeholder:`Enter commit message...`,value:C,onChange:F,className:`pr-10 h-full min-h-[14rem] resize-none`}),h[6]=C,h[7]=F,h[8]=I):I=h[8];let L=D||O,R;h[9]===D?R=h[10]:(R=D?(0,b.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,b.jsx)(o,{className:`h-3.5 w-3.5`}),h[9]=D,h[10]=R);let z;h[11]!==k||h[12]!==L||h[13]!==R?(z=(0,b.jsx)(i,{asChild:!0,children:(0,b.jsx)(t,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:k,disabled:L,children:R})}),h[11]=k,h[12]=L,h[13]=R,h[14]=z):z=h[14];let B=D?`Generating commit message...`:`Generate commit message with AI`,V;h[15]===B?V=h[16]:(V=(0,b.jsx)(c,{children:B}),h[15]=B,h[16]=V);let H;h[17]!==V||h[18]!==z?(H=(0,b.jsx)(n,{children:(0,b.jsxs)(s,{children:[z,V]})}),h[17]=V,h[18]=z,h[19]=H):H=h[19];let U;h[20]!==H||h[21]!==I?(U=(0,b.jsx)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:(0,b.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[P,(0,b.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[I,H]})]})}),h[20]=H,h[21]=I,h[22]=U):U=h[22];let W;h[23]===E?W=h[24]:(W=e=>E(e===!0),h[23]=E,h[24]=W);let G;h[25]!==T||h[26]!==W?(G=(0,b.jsx)(_,{id:`auto-generate`,checked:T,onCheckedChange:W}),h[25]=T,h[26]=W,h[27]=G):G=h[27];let K;h[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,b.jsx)(r,{htmlFor:`auto-generate`,className:u.labelNormal,children:`Auto generate commit messages`}),h[28]=K):K=h[28];let q;h[29]===G?q=h[30]:(q=(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[G,K]}),h[29]=G,h[30]=q);let J;h[31]!==C||h[32]!==O?(J=O||!C.trim(),h[31]=C,h[32]=O,h[33]=J):J=h[33];let Y=O?`Committing...`:`Commit`,X;h[34]!==A||h[35]!==J||h[36]!==Y?(X=(0,b.jsx)(l,{children:(0,b.jsx)(t,{onClick:A,disabled:J,children:Y})}),h[34]=A,h[35]=J,h[36]=Y,h[37]=X):X=h[37];let Z;h[38]!==U||h[39]!==q||h[40]!==X||h[41]!==N?(Z=(0,b.jsxs)(d,{className:`flex max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:h-[min(36rem,85dvh)]`,children:[N,U,q,X]}),h[38]=U,h[39]=q,h[40]=X,h[41]=N,h[42]=Z):Z=h[42];let Q;return h[43]!==S||h[44]!==x||h[45]!==Z?(Q=(0,b.jsx)(a,{open:x,onOpenChange:S,children:Z}),h[43]=S,h[44]=x,h[45]=Z,h[46]=Q):Q=h[46],Q}export{x as CommitDialog};
@@ -1 +1 @@
1
- import{$r as e,Ai as t,Gr as n,Jr as r,Qr as i,Xi as a,Xr as o,Zr as s,ei as c,os as l,qr as u,ss as d}from"./dialogs-config-BEazgV7k.js";import{a as f}from"./onboarding-Bi5MieW-.js";import{I as p}from"./index-B4PyD4Io.js";var m=d(),h=l();function g(l){let d=(0,m.c)(48),{open:g,onOpenChange:_,repoName:v,onRepoNameChange:y,repoDescription:b,onRepoDescriptionChange:x,isPrivateRepo:S,onPrivateRepoChange:C,isLoading:w,onCreateRepo:T}=l,E;d[0]!==_||d[1]!==x||d[2]!==y?(E=e=>{e||(y(``),x(``)),_(e)},d[0]=_,d[1]=x,d[2]=y,d[3]=E):E=d[3];let D;d[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsxs)(e,{children:[(0,h.jsx)(c,{children:`Create GitHub Repository`}),(0,h.jsx)(s,{children:`Create a new GitHub repository and push your local repository`})]}),d[4]=D):D=d[4];let O;d[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,h.jsx)(n,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),d[5]=O):O=d[5];let k;d[6]===y?k=d[7]:(k=e=>y(e.target.value),d[6]=y,d[7]=k);let A;d[8]!==v||d[9]!==k?(A=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,h.jsx)(u,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:v,onChange:k})]}),d[8]=v,d[9]=k,d[10]=A):A=d[10];let j;d[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(n,{htmlFor:`repo-description`,children:`Description (optional)`}),d[11]=j):j=d[11];let M;d[12]===x?M=d[13]:(M=e=>x(e.target.value),d[12]=x,d[13]=M);let N;d[14]!==b||d[15]!==M?(N=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(p,{id:`repo-description`,placeholder:`Enter repository description...`,value:b,onChange:M,rows:3})]}),d[14]=b,d[15]=M,d[16]=N):N=d[16];let P;d[17]===C?P=d[18]:(P=e=>C(e===!0),d[17]=C,d[18]=P);let F;d[19]!==S||d[20]!==P?(F=(0,h.jsx)(f,{id:`repo-private`,checked:S,onCheckedChange:P}),d[19]=S,d[20]=P,d[21]=F):F=d[21];let I;d[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(n,{htmlFor:`repo-private`,className:a.labelNormal,children:`Private repository`}),d[22]=I):I=d[22];let L;d[23]===F?L=d[24]:(L=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F,I]}),d[23]=F,d[24]=L);let R;d[25]!==L||d[26]!==A||d[27]!==N?(R=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[A,N,L]}),d[25]=L,d[26]=A,d[27]=N,d[28]=R):R=d[28];let z;d[29]===_?z=d[30]:(z=()=>_(!1),d[29]=_,d[30]=z);let B;d[31]!==w||d[32]!==z?(B=(0,h.jsx)(t,{variant:`outline`,onClick:z,disabled:w,children:`Cancel`}),d[31]=w,d[32]=z,d[33]=B):B=d[33];let V=w?`Creating...`:`Create & Push`,H;d[34]!==w||d[35]!==T||d[36]!==V?(H=(0,h.jsx)(t,{onClick:T,disabled:w,children:V}),d[34]=w,d[35]=T,d[36]=V,d[37]=H):H=d[37];let U;d[38]!==B||d[39]!==H?(U=(0,h.jsxs)(i,{children:[B,H]}),d[38]=B,d[39]=H,d[40]=U):U=d[40];let W;d[41]!==R||d[42]!==U?(W=(0,h.jsxs)(o,{children:[D,R,U]}),d[41]=R,d[42]=U,d[43]=W):W=d[43];let G;return d[44]!==g||d[45]!==E||d[46]!==W?(G=(0,h.jsx)(r,{open:g,onOpenChange:E,children:W}),d[44]=g,d[45]=E,d[46]=W,d[47]=G):G=d[47],G}export{g as CreateRepoDialog};
1
+ import{$r as e,Ai as t,Gr as n,Jr as r,Qr as i,Xi as a,Xr as o,Zr as s,ei as c,os as l,qr as u,ss as d}from"./dialogs-config-BEazgV7k.js";import{a as f}from"./onboarding-Bi5MieW-.js";import{I as p}from"./index-r-MGLt04.js";var m=d(),h=l();function g(l){let d=(0,m.c)(48),{open:g,onOpenChange:_,repoName:v,onRepoNameChange:y,repoDescription:b,onRepoDescriptionChange:x,isPrivateRepo:S,onPrivateRepoChange:C,isLoading:w,onCreateRepo:T}=l,E;d[0]!==_||d[1]!==x||d[2]!==y?(E=e=>{e||(y(``),x(``)),_(e)},d[0]=_,d[1]=x,d[2]=y,d[3]=E):E=d[3];let D;d[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsxs)(e,{children:[(0,h.jsx)(c,{children:`Create GitHub Repository`}),(0,h.jsx)(s,{children:`Create a new GitHub repository and push your local repository`})]}),d[4]=D):D=d[4];let O;d[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,h.jsx)(n,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),d[5]=O):O=d[5];let k;d[6]===y?k=d[7]:(k=e=>y(e.target.value),d[6]=y,d[7]=k);let A;d[8]!==v||d[9]!==k?(A=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,h.jsx)(u,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:v,onChange:k})]}),d[8]=v,d[9]=k,d[10]=A):A=d[10];let j;d[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(n,{htmlFor:`repo-description`,children:`Description (optional)`}),d[11]=j):j=d[11];let M;d[12]===x?M=d[13]:(M=e=>x(e.target.value),d[12]=x,d[13]=M);let N;d[14]!==b||d[15]!==M?(N=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(p,{id:`repo-description`,placeholder:`Enter repository description...`,value:b,onChange:M,rows:3})]}),d[14]=b,d[15]=M,d[16]=N):N=d[16];let P;d[17]===C?P=d[18]:(P=e=>C(e===!0),d[17]=C,d[18]=P);let F;d[19]!==S||d[20]!==P?(F=(0,h.jsx)(f,{id:`repo-private`,checked:S,onCheckedChange:P}),d[19]=S,d[20]=P,d[21]=F):F=d[21];let I;d[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(n,{htmlFor:`repo-private`,className:a.labelNormal,children:`Private repository`}),d[22]=I):I=d[22];let L;d[23]===F?L=d[24]:(L=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F,I]}),d[23]=F,d[24]=L);let R;d[25]!==L||d[26]!==A||d[27]!==N?(R=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[A,N,L]}),d[25]=L,d[26]=A,d[27]=N,d[28]=R):R=d[28];let z;d[29]===_?z=d[30]:(z=()=>_(!1),d[29]=_,d[30]=z);let B;d[31]!==w||d[32]!==z?(B=(0,h.jsx)(t,{variant:`outline`,onClick:z,disabled:w,children:`Cancel`}),d[31]=w,d[32]=z,d[33]=B):B=d[33];let V=w?`Creating...`:`Create & Push`,H;d[34]!==w||d[35]!==T||d[36]!==V?(H=(0,h.jsx)(t,{onClick:T,disabled:w,children:V}),d[34]=w,d[35]=T,d[36]=V,d[37]=H):H=d[37];let U;d[38]!==B||d[39]!==H?(U=(0,h.jsxs)(i,{children:[B,H]}),d[38]=B,d[39]=H,d[40]=U):U=d[40];let W;d[41]!==R||d[42]!==U?(W=(0,h.jsxs)(o,{children:[D,R,U]}),d[41]=R,d[42]=U,d[43]=W):W=d[43];let G;return d[44]!==g||d[45]!==E||d[46]!==W?(G=(0,h.jsx)(r,{open:g,onOpenChange:E,children:W}),d[44]=g,d[45]=E,d[46]=W,d[47]=G):G=d[47],G}export{g as CreateRepoDialog};
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$r as n,Ai as r,Do as i,Ft as a,Hn as o,Ir as s,Jo as c,Jr as l,K as u,Mi as d,Nr as f,Pr as p,Qr as m,To as h,Ua as g,Xi as _,Xr as v,Xt as y,Yo as b,ao as x,c as S,ei as C,eo as w,lo as T,ls as E,lt as D,os as O,so as k,ss as A,st as j,to as ee,wo as M,ya as N}from"./dialogs-config-BEazgV7k.js";import{N as P}from"./react-vendor-iDwBzcYF.js";import{t as F}from"./monaco-CZnIWXyV.js";import{I,a as te,l as L,n as R,o as ne}from"./history-view-BMVTxWTg.js";import{d as re}from"./onboarding-Bi5MieW-.js";import{n as ie}from"./utils-CECQ_-6N.js";import{B as ae,F as oe,I as se,L as ce,R as le,c as ue,d as de,f as fe,l as z,u as pe,y as me}from"./index-B4PyD4Io.js";import{a as B,n as he,r as ge,t as _e}from"./context-menu-PIC-g8wy.js";var V=e(E(),1),H=A(),U=O();function W(e){let t=(0,H.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,U.jsx)(`span`,{className:_.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,U.jsx)(S,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function ve(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var G={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},ye={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(d(_.compact,`status-badge font-mono font-semibold`),G[e]??`text-orange-500`)}function be(e){return ye[e]??`M`}var q=I(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,U.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,U.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),xe=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,H.c)(32),{treeData:n,files:r,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:l}=e,u;t[0]===r?u=t[1]:(u=r.reduce(Y,0),t[0]=r,t[1]=u);let f=u,p;t[2]===r?p=t[3]:(p=r.reduce(Oe,0),t[2]=r,t[3]=p);let m=p,v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=d(_.compact,`text-muted-foreground`),t[4]=v):v=t[4];let y=r.length,b=r.length===1?``:`s`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=d(_.compact,`text-green-500`),t[5]=x):x=t[5];let S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=d(_.compact,`text-red-500`),t[6]=S):S=t[6];let C;t[7]!==r.length||t[8]!==b||t[9]!==f||t[10]!==m?(C=(0,U.jsx)(q,{v0:v,v1:y,v2:b,v3:x,v4:f,v5:S,v6:m}),t[7]=r.length,t[8]=b,t[9]=f,t[10]=m,t[11]=C):C=t[11];let w=C;if(a){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=d(_.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===a?n=t[14]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:a})}),t[13]=a,t[14]=n);let r;return t[15]!==w||t[16]!==n?(r=(0,U.jsx)(xe,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:n})}),t[15]=w,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:d(_.compact,_.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===w?n=t[20]:(n=(0,U.jsx)(J,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:e})}),t[19]=w,t[20]=n),n}let T;t[21]!==r||t[22]!==s||t[23]!==l||t[24]!==o?(T=(e,t)=>{let{isOpen:n,toggle:a}=t,u=!!e.children,f=(0,U.jsxs)(re,{onClick:()=>{u?a():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!u&&e.fileIndex===o,className:`gap-1.5`,children:[u?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(c,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!u&&e.status&&(0,U.jsx)(`span`,{className:K(e.status),children:be(e.status)})]});return u?f:(0,U.jsxs)(_e,{children:[(0,U.jsx)(B,{asChild:!0,children:(0,U.jsx)(`div`,{children:f})}),(0,U.jsx)(he,{children:(0,U.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,U.jsx)(g,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=s,t[23]=l,t[24]=o,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==n?(E=(0,U.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,U.jsx)(oe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:T})}),t[26]=T,t[27]=n,t[28]=E):E=t[28];let D;return t[29]!==w||t[30]!==E?(D=(0,U.jsx)(Se,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:E})}),t[29]=w,t[30]=E,t[31]=D):D=t[31],D};function we(e){return e.type===`add`}function Te(e,t){return e+t.changes.filter(we).length}function Y(e,t){return e+t.hunks.reduce(Te,0)}function Ee(e){return e.type===`delete`}function De(e,t){return e+t.changes.filter(Ee).length}function Oe(e,t){return e+t.hunks.reduce(De,0)}var ke=I(e=>(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:e.v0,children:e.v1}),(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,U.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),X=function(e){let t=(0,H.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Z(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=d(_.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,U.jsx)(ke,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function Ae(e,t,n){return`git-media:${e}:${t}:${n}`}function Z(e,t,n){let r=(0,H.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Ae(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>D(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=te(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,V.useEffect)(l,u),c}function je(e){let t=(0,H.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(L,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,U.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,U.jsx)(V.Suspense,{fallback:e,children:(0,U.jsx)(X,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(L,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,U.jsx)(`div`,{className:`flex-1`,children:(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(X,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,U.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,U.jsx)(L,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,U.jsx)(X,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,U.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,U.jsx)(V.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Me(e){let t=(0,H.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=d(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,U.jsx)(z,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Ne(e){let t=(0,H.c)(36),{open:i,lineNumber:a,lineContent:o,initialComment:s,isEditing:c,onSave:u,onDelete:f,onClose:p}=e,[h,g]=(0,V.useState)((s===void 0?``:s)??``),y;t[0]!==u||t[1]!==h?(y=()=>{h.trim()&&u(h.trim())},t[0]=u,t[1]=h,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},t[3]=b,t[4]=x);let S=x,w;t[5]===p?w=t[6]:(w=e=>{e||p()},t[5]=p,t[6]=w);let T;t[7]===a?T=t[8]:(T=(0,U.jsx)(n,{children:(0,U.jsxs)(C,{children:[`Comment on line `,a]})}),t[7]=a,t[8]=T);let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=d(_.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=E):E=t[9];let D=o||` `,O;t[10]===D?O=t[11]:(O=(0,U.jsx)(`div`,{className:E,children:D}),t[10]=D,t[11]=O);let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>g(e.target.value),t[12]=k):k=t[12];let A;t[13]!==S||t[14]!==h?(A=(0,U.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:h,onChange:k,onKeyDown:S,rows:12,className:`resize-none text-base`}),t[13]=S,t[14]=h,t[15]=A):A=t[15];let j;t[16]!==c||t[17]!==f?(j=c&&f&&(0,U.jsx)(r,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),t[16]=c,t[17]=f,t[18]=j):j=t[18];let ee;t[19]===h?ee=t[20]:(ee=h.trim(),t[19]=h,t[20]=ee);let M=!ee,N;t[21]!==b||t[22]!==M?(N=(0,U.jsx)(r,{size:`sm`,onClick:b,disabled:M,children:`Save`}),t[21]=b,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==j||t[25]!==N?(P=(0,U.jsxs)(m,{className:`gap-2 sm:gap-0`,children:[j,N]}),t[24]=j,t[25]=N,t[26]=P):P=t[26];let F;t[27]!==A||t[28]!==P||t[29]!==T||t[30]!==O?(F=(0,U.jsxs)(v,{className:`max-w-2xl`,children:[T,O,A,P]}),t[27]=A,t[28]=P,t[29]=T,t[30]=O,t[31]=F):F=t[31];let I;return t[32]!==i||t[33]!==F||t[34]!==w?(I=(0,U.jsx)(l,{open:i,onOpenChange:w,children:F}),t[32]=i,t[33]=F,t[34]=w,t[35]=I):I=t[35],I}var Pe=I(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Fe=I(e=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,U.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Ie=function(e){let t=(0,H.c)(5),{onRetry:n}=e,[i,a]=(0,V.useState)(!1),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=window.setTimeout(()=>{a(!0)},15e3);return()=>{window.clearTimeout(e)}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,V.useEffect)(o,s),!i){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(Pe,{v0:(0,U.jsx)(L,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===n?c=t[4]:(c=(0,U.jsx)(Fe,{v0:_.bodyMuted,v1:(0,U.jsx)(r,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=c),c};function Le(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Re(e,t=15e3){return Promise.race([j(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function ze({threadId:e,onExit:n,loadVersion:i}){let l=te(Le(e,i),()=>Re(e)),m=ce(),h=le(e=>e.diffComments),g=le(e=>e.projectModelSelections),{resolvedTheme:v}=ie(),S=me(),[C,E]=(0,V.useState)(l.files||[]),[D,O]=(0,V.useState)(null),[A,M]=(0,V.useState)(0),[I,L]=(0,V.useState)(!1),[R,ne]=(0,V.useState)(!1),[re,oe]=(0,V.useState)(!1),[se,z]=(0,V.useState)(!0),B=(0,V.useRef)(null);(0,V.useEffect)(()=>{z(!0)},[e]);let he=(0,V.useCallback)(e=>{M(e),S&&z(!1)},[S]),ge=(0,V.useCallback)(()=>{z(!0)},[]),_e=S&&!se,H=(0,V.useMemo)(()=>h[e]??[],[h,e]),W=(0,V.useCallback)(t=>{let n=h[e]??[],r=typeof t==`function`?t(n):t;m({type:ae.SetDiffComments,threadId:e,comments:r})},[m,e,h]),[G,ye]=(0,V.useState)(null),[K,be]=(0,V.useState)(null),[q,xe]=(0,V.useState)(null),J=(0,V.useRef)(null),Se=(0,V.useRef)(H),we=(0,V.useRef)(G),Te=(0,V.useRef)({isFullView:I,selectedFileIndex:A,files:C}),Y=(0,V.useRef)({original:[],modified:[]}),Ee=(0,V.useRef)(!0);(0,V.useEffect)(()=>{Se.current=H},[H]),(0,V.useEffect)(()=>{we.current=G},[G]),(0,V.useEffect)(()=>{Te.current={isFullView:I,selectedFileIndex:A,files:C}},[I,A,C]);let De=(0,V.useCallback)(()=>{B.current&&(R?B.current.expand():B.current.collapse())},[R]),Oe=(0,V.useCallback)(async()=>{if(e){O(null);try{E((await j(e)).files||[]),M(0)}catch(e){O(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),ke=(0,V.useCallback)(async t=>{try{await y(e,t.path),await Oe()}catch(e){O(e instanceof Error?e.message:`Failed to revert file`)}},[e,Oe]),X=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((h[e]??[]).length>0){X.current=!0;return}a(e).then(t=>{t.diffComments&&t.diffComments.length>0&&m({type:ae.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,V.useEffect)(()=>{X.current&&o(e,{diffComments:H}).catch(()=>{})},[e,H]);let Ae=(0,V.useMemo)(()=>ve(C),[C]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Pe=(e,t,n)=>e.split(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$r as n,Ai as r,Do as i,Ft as a,Hn as o,Ir as s,Jo as c,Jr as l,K as u,Mi as d,Nr as f,Pr as p,Qr as m,To as h,Ua as g,Xi as _,Xr as v,Xt as y,Yo as b,ao as x,c as S,ei as C,eo as w,lo as T,ls as E,lt as D,os as O,so as k,ss as A,st as j,to as ee,wo as M,ya as N}from"./dialogs-config-BEazgV7k.js";import{N as P}from"./react-vendor-iDwBzcYF.js";import{t as F}from"./monaco-CZnIWXyV.js";import{I,a as te,l as L,n as R,o as ne}from"./history-view-BMVTxWTg.js";import{d as re}from"./onboarding-Bi5MieW-.js";import{n as ie}from"./utils-CECQ_-6N.js";import{B as ae,F as oe,I as se,L as ce,R as le,c as ue,d as de,f as fe,l as z,u as pe,y as me}from"./index-r-MGLt04.js";import{a as B,n as he,r as ge,t as _e}from"./context-menu-PIC-g8wy.js";var V=e(E(),1),H=A(),U=O();function W(e){let t=(0,H.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,U.jsx)(`span`,{className:_.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,U.jsx)(S,{className:`min-h-0 flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function ve(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var G={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},ye={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return d(d(_.compact,`status-badge font-mono font-semibold`),G[e]??`text-orange-500`)}function be(e){return ye[e]??`M`}var q=I(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,U.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,U.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),xe=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),J=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,H.c)(32),{treeData:n,files:r,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:l}=e,u;t[0]===r?u=t[1]:(u=r.reduce(Y,0),t[0]=r,t[1]=u);let f=u,p;t[2]===r?p=t[3]:(p=r.reduce(Oe,0),t[2]=r,t[3]=p);let m=p,v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=d(_.compact,`text-muted-foreground`),t[4]=v):v=t[4];let y=r.length,b=r.length===1?``:`s`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=d(_.compact,`text-green-500`),t[5]=x):x=t[5];let S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=d(_.compact,`text-red-500`),t[6]=S):S=t[6];let C;t[7]!==r.length||t[8]!==b||t[9]!==f||t[10]!==m?(C=(0,U.jsx)(q,{v0:v,v1:y,v2:b,v3:x,v4:f,v5:S,v6:m}),t[7]=r.length,t[8]=b,t[9]=f,t[10]=m,t[11]=C):C=t[11];let w=C;if(a){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=d(_.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===a?n=t[14]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:a})}),t[13]=a,t[14]=n);let r;return t[15]!==w||t[16]!==n?(r=(0,U.jsx)(xe,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:n})}),t[15]=w,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:d(_.compact,_.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===w?n=t[20]:(n=(0,U.jsx)(J,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:e})}),t[19]=w,t[20]=n),n}let T;t[21]!==r||t[22]!==s||t[23]!==l||t[24]!==o?(T=(e,t)=>{let{isOpen:n,toggle:a}=t,u=!!e.children,f=(0,U.jsxs)(re,{onClick:()=>{u?a():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!u&&e.fileIndex===o,className:`gap-1.5`,children:[u?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(c,{className:d(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(i,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!u&&e.status&&(0,U.jsx)(`span`,{className:K(e.status),children:be(e.status)})]});return u?f:(0,U.jsxs)(_e,{children:[(0,U.jsx)(B,{asChild:!0,children:(0,U.jsx)(`div`,{children:f})}),(0,U.jsx)(he,{children:(0,U.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&l?.(r[e.fileIndex])},children:[(0,U.jsx)(g,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=s,t[23]=l,t[24]=o,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==n?(E=(0,U.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,U.jsx)(oe,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:T})}),t[26]=T,t[27]=n,t[28]=E):E=t[28];let D;return t[29]!==w||t[30]!==E?(D=(0,U.jsx)(Se,{v0:(0,U.jsx)(W,{title:`Review Changes`,subtitle:w,children:E})}),t[29]=w,t[30]=E,t[31]=D):D=t[31],D};function we(e){return e.type===`add`}function Te(e,t){return e+t.changes.filter(we).length}function Y(e,t){return e+t.hunks.reduce(Te,0)}function Ee(e){return e.type===`delete`}function De(e,t){return e+t.changes.filter(Ee).length}function Oe(e,t){return e+t.hunks.reduce(De,0)}var ke=I(e=>(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsx)(`div`,{className:e.v0,children:e.v1}),(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,U.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),X=function(e){let t=(0,H.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Z(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=d(_.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,U.jsx)(ke,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function Ae(e,t,n){return`git-media:${e}:${t}:${n}`}function Z(e,t,n){let r=(0,H.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Ae(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>D(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=te(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,V.useEffect)(l,u),c}function je(e){let t=(0,H.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(L,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,U.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,U.jsx)(V.Suspense,{fallback:e,children:(0,U.jsx)(X,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(L,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,U.jsx)(`div`,{className:`flex-1`,children:(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(X,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,U.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,U.jsx)(L,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,U.jsx)(X,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,U.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,U.jsx)(V.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Me(e){let t=(0,H.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=d(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,U.jsx)(z,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Ne(e){let t=(0,H.c)(36),{open:i,lineNumber:a,lineContent:o,initialComment:s,isEditing:c,onSave:u,onDelete:f,onClose:p}=e,[h,g]=(0,V.useState)((s===void 0?``:s)??``),y;t[0]!==u||t[1]!==h?(y=()=>{h.trim()&&u(h.trim())},t[0]=u,t[1]=h,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),b())},t[3]=b,t[4]=x);let S=x,w;t[5]===p?w=t[6]:(w=e=>{e||p()},t[5]=p,t[6]=w);let T;t[7]===a?T=t[8]:(T=(0,U.jsx)(n,{children:(0,U.jsxs)(C,{children:[`Comment on line `,a]})}),t[7]=a,t[8]=T);let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=d(_.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=E):E=t[9];let D=o||` `,O;t[10]===D?O=t[11]:(O=(0,U.jsx)(`div`,{className:E,children:D}),t[10]=D,t[11]=O);let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>g(e.target.value),t[12]=k):k=t[12];let A;t[13]!==S||t[14]!==h?(A=(0,U.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:h,onChange:k,onKeyDown:S,rows:12,className:`resize-none text-base`}),t[13]=S,t[14]=h,t[15]=A):A=t[15];let j;t[16]!==c||t[17]!==f?(j=c&&f&&(0,U.jsx)(r,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),t[16]=c,t[17]=f,t[18]=j):j=t[18];let ee;t[19]===h?ee=t[20]:(ee=h.trim(),t[19]=h,t[20]=ee);let M=!ee,N;t[21]!==b||t[22]!==M?(N=(0,U.jsx)(r,{size:`sm`,onClick:b,disabled:M,children:`Save`}),t[21]=b,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==j||t[25]!==N?(P=(0,U.jsxs)(m,{className:`gap-2 sm:gap-0`,children:[j,N]}),t[24]=j,t[25]=N,t[26]=P):P=t[26];let F;t[27]!==A||t[28]!==P||t[29]!==T||t[30]!==O?(F=(0,U.jsxs)(v,{className:`max-w-2xl`,children:[T,O,A,P]}),t[27]=A,t[28]=P,t[29]=T,t[30]=O,t[31]=F):F=t[31];let I;return t[32]!==i||t[33]!==F||t[34]!==w?(I=(0,U.jsx)(l,{open:i,onOpenChange:w,children:F}),t[32]=i,t[33]=F,t[34]=w,t[35]=I):I=t[35],I}var Pe=I(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Fe=I(e=>(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,U.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Ie=function(e){let t=(0,H.c)(5),{onRetry:n}=e,[i,a]=(0,V.useState)(!1),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=window.setTimeout(()=>{a(!0)},15e3);return()=>{window.clearTimeout(e)}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,V.useEffect)(o,s),!i){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(Pe,{v0:(0,U.jsx)(L,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===n?c=t[4]:(c=(0,U.jsx)(Fe,{v0:_.bodyMuted,v1:(0,U.jsx)(r,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=c),c};function Le(e,t){return`git-diff:${e}:${t}`}function Q(){return Error(`Loading review changes timed out. Please try again.`)}async function Re(e,t=15e3){return Promise.race([j(e),new Promise((e,n)=>{window.setTimeout(()=>n(Q()),t)})])}function ze({threadId:e,onExit:n,loadVersion:i}){let l=te(Le(e,i),()=>Re(e)),m=ce(),h=le(e=>e.diffComments),g=le(e=>e.projectModelSelections),{resolvedTheme:v}=ie(),S=me(),[C,E]=(0,V.useState)(l.files||[]),[D,O]=(0,V.useState)(null),[A,M]=(0,V.useState)(0),[I,L]=(0,V.useState)(!1),[R,ne]=(0,V.useState)(!1),[re,oe]=(0,V.useState)(!1),[se,z]=(0,V.useState)(!0),B=(0,V.useRef)(null);(0,V.useEffect)(()=>{z(!0)},[e]);let he=(0,V.useCallback)(e=>{M(e),S&&z(!1)},[S]),ge=(0,V.useCallback)(()=>{z(!0)},[]),_e=S&&!se,H=(0,V.useMemo)(()=>h[e]??[],[h,e]),W=(0,V.useCallback)(t=>{let n=h[e]??[],r=typeof t==`function`?t(n):t;m({type:ae.SetDiffComments,threadId:e,comments:r})},[m,e,h]),[G,ye]=(0,V.useState)(null),[K,be]=(0,V.useState)(null),[q,xe]=(0,V.useState)(null),J=(0,V.useRef)(null),Se=(0,V.useRef)(H),we=(0,V.useRef)(G),Te=(0,V.useRef)({isFullView:I,selectedFileIndex:A,files:C}),Y=(0,V.useRef)({original:[],modified:[]}),Ee=(0,V.useRef)(!0);(0,V.useEffect)(()=>{Se.current=H},[H]),(0,V.useEffect)(()=>{we.current=G},[G]),(0,V.useEffect)(()=>{Te.current={isFullView:I,selectedFileIndex:A,files:C}},[I,A,C]);let De=(0,V.useCallback)(()=>{B.current&&(R?B.current.expand():B.current.collapse())},[R]),Oe=(0,V.useCallback)(async()=>{if(e){O(null);try{E((await j(e)).files||[]),M(0)}catch(e){O(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),ke=(0,V.useCallback)(async t=>{try{await y(e,t.path),await Oe()}catch(e){O(e instanceof Error?e.message:`Failed to revert file`)}},[e,Oe]),X=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((h[e]??[]).length>0){X.current=!0;return}a(e).then(t=>{t.diffComments&&t.diffComments.length>0&&m({type:ae.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,V.useEffect)(()=>{X.current&&o(e,{diffComments:H}).catch(()=>{})},[e,H]);let Ae=(0,V.useMemo)(()=>ve(C),[C]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Pe=(e,t,n)=>e.split(`
2
2
  `).slice(t-1,n).join(`
3
3
  `),Fe=e=>{let t=Z(e);return t?t.startLine<=1:!0},Ie=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=C[A],ze=Q?.isBinary??!1,Be=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Pe(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ve=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Pe(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!Ee.current)return;let e=J.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Te.current,i=Se.current,a=we.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:F.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,H,G,A,I,Q]),(0,V.useEffect)(()=>()=>{J.current=null,Y.current={original:[],modified:[]}},[A]),(0,V.useEffect)(()=>()=>{Ee.current=!1,J.current&&=(J.current.getOriginalEditor().getModel()?.dispose(),J.current.getModifiedEditor().getModel()?.dispose(),J.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let He=(0,V.useCallback)(e=>{J.current=e;let t=e=>e===F.MouseTargetType.GUTTER_GLYPH_MARGIN||e===F.MouseTargetType.GUTTER_LINE_NUMBERS||e===F.MouseTargetType.GUTTER_LINE_DECORATIONS||e===F.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=Te.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=Se.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?xe(f):be({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{J.current===e&&$()},150)},[$]),Ue=(0,V.useCallback)(e=>{if(K&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:A,lineNumber:K.lineNumber,lineContent:K.lineContent,comment:e,side:K.side};W(e=>[...e,t]),be(null)}else q&&(W(t=>t.map(t=>t.id===q.id?{...t,comment:e}:t)),xe(null))},[K,q,Q,A,W]),We=(0,V.useCallback)(()=>{q&&(W(e=>e.filter(e=>e.id!==q.id)),xe(null))},[q,W]),Ge=(0,V.useCallback)(e=>{if(H.length===0)return;let t=(e%H.length+H.length)%H.length,n=H[t];ye(t),M(n.fileIndex),S&&z(!1),setTimeout(()=>{let e=J.current;if(!e)return;let t=C[n.fileIndex];if(!t)return;let r=I?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[H,C,I,$,S]),Ke=(0,V.useCallback)(()=>{Ge((G??0)-1)},[Ge,G]),qe=(0,V.useCallback)(()=>{Ge((G??-1)+1)},[Ge,G]),Je=(0,V.useCallback)(async()=>{let r=g[e];if(!r)try{let e=await t(),n=Object.values(e).flat();if(n.length>0)r=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let i=r.id,a=r.provider;try{let{prompt:t}=await u(e,H);W([]),m({type:ae.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:a}}),n()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[H,g,m,e,n,W]),Ye={readOnly:!0,renderSideBySide:!S,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Fe(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0},Xe=(0,U.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,U.jsx)(Ce,{treeData:Ae,files:C,error:D,selectedFileIndex:A,onFileSelect:he,onRevertFile:ke})}),Ze=(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,U.jsxs)(ue,{className:d(`bg-transparent`,R&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_e?(0,U.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:ge,children:[(0,U.jsx)(w,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,U.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:De,children:[R?(0,U.jsx)(w,{className:`h-4 w-4`}):(0,U.jsx)(ee,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:d(_.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:d(`flex items-center gap-2`,R&&`ml-0`,!R&&`ml-auto`,`md:ml-auto`),children:[!ze&&(0,U.jsx)(r,{variant:`ghost`,size:`sm`,onClick:()=>L(e=>!e),disabled:!Q,className:d(_.compact,`h-8 gap-1 px-2`),children:I?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(x,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(T,{className:`h-3 w-3`}),` Show full file`]})}),H.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(f,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(G??0)===0,children:(0,U.jsx)(b,{className:`h-3 w-3`})})}),(0,U.jsx)(p,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:d(_.caption,`whitespace-nowrap`),children:H.length===1?`1 Comment`:`Comment ${(G??0)+1} of ${H.length}`}),(0,U.jsxs)(f,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:qe,disabled:(G??0)===H.length-1,children:(0,U.jsx)(c,{className:`h-3 w-3`})})}),(0,U.jsx)(p,{children:`Next comment`})]})]}),H.length>0&&(0,U.jsxs)(f,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsxs)(r,{size:`sm`,onClick:Je,className:d(_.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(k,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(p,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[ze&&Q?(0,U.jsx)(je,{threadId:e,file:Q}):(0,U.jsx)(P,{height:`100%`,language:Ie(Q?.path||``),original:Be,modified:Ve,theme:v===`dark`?`vs-dark`:`vs-light`,onMount:He,options:Ye},`diff-${A}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[re&&(0,U.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,U.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>oe(!1),children:[(0,U.jsx)(N,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(fe,{})]}),!re&&(0,U.jsxs)(f,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsxs)(r,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>oe(!0),children:[(0,U.jsx)(k,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(p,{children:`Chat about this diff`})]})]})]})]});return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:S?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!se&&`hidden`),children:Xe}),(0,U.jsx)(`div`,{className:d(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,se&&`hidden`),children:Ze})]}):(0,U.jsxs)(de,{direction:`horizontal`,children:[(0,U.jsx)(pe,{ref:B,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ne(!0),onExpand:()=>ne(!1),className:`border-r border-transparent`,children:Xe}),(0,U.jsx)(Me,{isOpen:!R}),(0,U.jsx)(pe,{className:`overflow-hidden border-l border-border bg-transparent`,children:Ze})]})}),(0,U.jsx)(Ne,{open:K!==null||q!==null,lineNumber:q?.lineNumber??K?.lineNumber??0,lineContent:q?.lineContent??K?.lineContent??``,initialComment:q?.comment,isEditing:q!==null,onSave:Ue,onDelete:We,onClose:()=>{be(null),xe(null)}},`${q?.id??``}-${K?.lineNumber??``}-${K?.side??``}`)]})}function Be(e){let t=(0,H.c)(22),[n,r]=(0,V.useState)(0),[i,a]=(0,V.useState)(0),o=(0,V.useRef)(0),s;t[0]===e.threadId?s=t[1]:(s=()=>{r(t=>(ne(Le(e.threadId,t)),t+1)),a($)},t[0]=e.threadId,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(0),r(0),o.current=0},t[2]=l):l=t[2];let u;t[3]===e.threadId?u=t[4]:(u=[e.threadId],t[3]=e.threadId,t[4]=u),(0,V.useEffect)(l,u);let d,f;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(d=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(ne(Le(e.threadId,t)),t+1)),a(Ve))},f=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,V.useEffect)(d,f);let p=`${e.threadId}:${i}`,m;t[9]===c?m=t[10]:(m=(0,U.jsx)(Ie,{onRetry:c}),t[9]=c,t[10]=m);let h=`${e.threadId}:${n}`,g;t[11]!==n||t[12]!==e||t[13]!==h?(g=(0,U.jsx)(ze,{...e,loadVersion:n},h),t[11]=n,t[12]=e,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==m||t[16]!==g?(_=(0,U.jsx)(V.Suspense,{fallback:m,children:g}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==c||t[19]!==p||t[20]!==_?(v=(0,U.jsx)(R,{fallbackTitle:`Failed to load review changes`,onRetry:c,children:_},p),t[18]=c,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function Ve(e){return e+1}function $(e){return e+1}export{Be as DiffView,Be as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-D5h9dOAX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B4PyD4Io.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-HzthG2_q.css","assets/api-Dhzdgb40.js","assets/context-menu-PIC-g8wy.js","assets/ui-components-kSaUEA_X.js","assets/explorer-view-IOQM4kWJ.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Mi as t,Xi as n,c as r,ls as i,os as a,ss as o}from"./dialogs-config-BEazgV7k.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-BMVTxWTg.js";import{A as u,R as d,d as f,l as p,u as m,y as h}from"./index-B4PyD4Io.js";var g=o(),_=e(i(),1),v=a(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-D5h9dOAX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-IOQM4kWJ.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(49),i=d(S),a=h(),[o,s]=(0,_.useState)(null),[x,C]=(0,_.useState)(!0),{pendingExplorerPath:w,setPendingExplorerPath:T,explorerClearPath:E,setExplorerClearPath:D}=u(),O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{C(!0)},e[0]=O):O=e[0];let k;e[1]===i?k=e[2]:(k=[i],e[1]=i,e[2]=k),(0,_.useEffect)(O,k);let A;e[3]===a?A=e[4]:(A=e=>{s(e),a&&C(!1)},e[3]=a,e[4]=A);let j=A,M;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{C(!0)},e[5]=M):M=e[5];let N=M,P;e[6]===a?P=e[7]:(P=e=>{s(e),a&&C(!1)},e[6]=a,e[7]=P);let F=P,I,L;e[8]!==a||e[9]!==w||e[10]!==T?(I=()=>{w&&(s({name:w.split(`/`).pop()??w,path:w,type:`file`}),a&&C(!1),T(null))},L=[a,w,T],e[8]=a,e[9]=w,e[10]=T,e[11]=I,e[12]=L):(I=e[11],L=e[12]),(0,_.useEffect)(I,L);let R,z;e[13]!==E||e[14]!==a||e[15]!==o||e[16]!==D?(R=()=>{E&&(o&&(o.path===E||o.path.startsWith(E+`/`))&&(s(null),a&&C(!0)),D(null))},z=[E,a,o,D],e[13]=E,e[14]=a,e[15]=o,e[16]=D,e[17]=R,e[18]=z):(R=e[17],z=e[18]),(0,_.useEffect)(R,z);let B;e[19]!==j||e[20]!==o?.path||e[21]!==i?(B=(0,v.jsx)(r,{className:`h-full`,children:i?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:i,selectedPath:o?.path??null,onNodeSelect:j})}):(0,v.jsx)(`p`,{className:t(n.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=j,e[20]=o?.path,e[21]=i,e[22]=B):B=e[22];let V=B,H;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,v.jsx)(c,{}),e[23]=H):H=e[23];let U=a&&!x,W;e[24]!==F||e[25]!==o||e[26]!==U?(W=(0,v.jsx)(_.Suspense,{fallback:H,children:(0,v.jsx)(b,{selectedFile:o,showTreeBackButton:U,onShowTree:N,onFileCreated:F})}),e[24]=F,e[25]=o,e[26]=U,e[27]=W):W=e[27];let G=W;if(a){let n=!x&&`hidden`,r;e[28]===n?r=e[29]:(r=t(`flex-1 min-h-0 overflow-hidden`,n),e[28]=n,e[29]=r);let i;e[30]!==V||e[31]!==r?(i=(0,v.jsx)(`div`,{className:r,children:V}),e[30]=V,e[31]=r,e[32]=i):i=e[32];let a=x&&`hidden`,o;e[33]===a?o=e[34]:(o=t(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==G||e[36]!==o?(s=(0,v.jsx)(`div`,{className:o,children:G}),e[35]=G,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,v.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let K;e[41]===V?K=e[42]:(K=(0,v.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:V}),e[41]=V,e[42]=K);let q;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,v.jsx)(p,{withHandle:!0}),e[43]=q):q=e[43];let J;e[44]===G?J=e[45]:(J=(0,v.jsx)(m,{className:`overflow-hidden`,children:G}),e[44]=G,e[45]=J);let Y;return e[46]!==K||e[47]!==J?(Y=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[K,q,J]})}),e[46]=K,e[47]=J,e[48]=Y):Y=e[48],Y}function S(e){return e.selectedThreadId}export{x as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-CboAGH2h.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-r-MGLt04.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-C7FLshNp.css","assets/api-Dhzdgb40.js","assets/context-menu-PIC-g8wy.js","assets/ui-components-kSaUEA_X.js","assets/explorer-view-CBxsEzQT.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Mi as t,Xi as n,c as r,ls as i,os as a,ss as o}from"./dialogs-config-BEazgV7k.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-BMVTxWTg.js";import{A as u,R as d,d as f,l as p,u as m,y as h}from"./index-r-MGLt04.js";var g=o(),_=e(i(),1),v=a(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-CboAGH2h.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-CBxsEzQT.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(49),i=d(S),a=h(),[o,s]=(0,_.useState)(null),[x,C]=(0,_.useState)(!0),{pendingExplorerPath:w,setPendingExplorerPath:T,explorerClearPath:E,setExplorerClearPath:D}=u(),O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{C(!0)},e[0]=O):O=e[0];let k;e[1]===i?k=e[2]:(k=[i],e[1]=i,e[2]=k),(0,_.useEffect)(O,k);let A;e[3]===a?A=e[4]:(A=e=>{s(e),a&&C(!1)},e[3]=a,e[4]=A);let j=A,M;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{C(!0)},e[5]=M):M=e[5];let N=M,P;e[6]===a?P=e[7]:(P=e=>{s(e),a&&C(!1)},e[6]=a,e[7]=P);let F=P,I,L;e[8]!==a||e[9]!==w||e[10]!==T?(I=()=>{w&&(s({name:w.split(`/`).pop()??w,path:w,type:`file`}),a&&C(!1),T(null))},L=[a,w,T],e[8]=a,e[9]=w,e[10]=T,e[11]=I,e[12]=L):(I=e[11],L=e[12]),(0,_.useEffect)(I,L);let R,z;e[13]!==E||e[14]!==a||e[15]!==o||e[16]!==D?(R=()=>{E&&(o&&(o.path===E||o.path.startsWith(E+`/`))&&(s(null),a&&C(!0)),D(null))},z=[E,a,o,D],e[13]=E,e[14]=a,e[15]=o,e[16]=D,e[17]=R,e[18]=z):(R=e[17],z=e[18]),(0,_.useEffect)(R,z);let B;e[19]!==j||e[20]!==o?.path||e[21]!==i?(B=(0,v.jsx)(r,{className:`h-full`,children:i?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:i,selectedPath:o?.path??null,onNodeSelect:j})}):(0,v.jsx)(`p`,{className:t(n.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=j,e[20]=o?.path,e[21]=i,e[22]=B):B=e[22];let V=B,H;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,v.jsx)(c,{}),e[23]=H):H=e[23];let U=a&&!x,W;e[24]!==F||e[25]!==o||e[26]!==U?(W=(0,v.jsx)(_.Suspense,{fallback:H,children:(0,v.jsx)(b,{selectedFile:o,showTreeBackButton:U,onShowTree:N,onFileCreated:F})}),e[24]=F,e[25]=o,e[26]=U,e[27]=W):W=e[27];let G=W;if(a){let n=!x&&`hidden`,r;e[28]===n?r=e[29]:(r=t(`flex-1 min-h-0 overflow-hidden`,n),e[28]=n,e[29]=r);let i;e[30]!==V||e[31]!==r?(i=(0,v.jsx)(`div`,{className:r,children:V}),e[30]=V,e[31]=r,e[32]=i):i=e[32];let a=x&&`hidden`,o;e[33]===a?o=e[34]:(o=t(`flex-1 min-h-0 overflow-hidden`,a),e[33]=a,e[34]=o);let s;e[35]!==G||e[36]!==o?(s=(0,v.jsx)(`div`,{className:o,children:G}),e[35]=G,e[36]=o,e[37]=s):s=e[37];let c;return e[38]!==i||e[39]!==s?(c=(0,v.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[i,s]}),e[38]=i,e[39]=s,e[40]=c):c=e[40],c}let K;e[41]===V?K=e[42]:(K=(0,v.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:V}),e[41]=V,e[42]=K);let q;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,v.jsx)(p,{withHandle:!0}),e[43]=q):q=e[43];let J;e[44]===G?J=e[45]:(J=(0,v.jsx)(m,{className:`overflow-hidden`,children:G}),e[44]=G,e[45]=J);let Y;return e[46]!==K||e[47]!==J?(Y=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[K,q,J]})}),e[46]=K,e[47]=J,e[48]=Y):Y=e[48],Y}function S(e){return e.selectedThreadId}export{x as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Do as t,Jo as n,Mi as r,To as i,Xi as a,Xo as o,ls as s,os as c,qr as l,ss as u,wo as d,za as f}from"./dialogs-config-BEazgV7k.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-BMVTxWTg.js";import{d as w}from"./onboarding-Bi5MieW-.js";import{A as T,D as ee,O as E,P as D,k as O}from"./index-B4PyD4Io.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-PIC-g8wy.js";import{c as P,n as F,o as I,r as L,s as R,t as z}from"./api-Dhzdgb40.js";import{t as B}from"./ui-components-kSaUEA_X.js";var V=u(),H=e(s(),1),U=c(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(f,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===i?s=n[5]:(s=r(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`max-h-[300px] overflow-y-auto overflow-x-hidden`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=r(a.bodyMuted,`py-6 text-center`),n[0]=i):i=n[0];let o;return n[1]!==e||n[2]!==t?(o=(0,U.jsx)(B.Empty,{ref:t,className:i,...e}),n[1]=e,n[2]=t,n[3]=o):o=n[3],o});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`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`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var Y=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});Y.displayName=B.Separator.displayName;var te=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,o;n[0]===e?(i=n[1],o=n[2]):({className:i,...o}=e,n[0]=e,n[1]=i,n[2]=o);let s;n[3]===i?s=n[4]:(s=r(r(a.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),i),n[3]=i,n[4]=s);let c;return n[5]!==o||n[6]!==t||n[7]!==s?(c=(0,U.jsx)(B.Item,{ref:t,className:s,...o}),n[5]=o,n[6]=t,n[7]=s,n[8]=c):c=n[8],c});te.displayName=B.Item.displayName;var X=e=>{let t=(0,V.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let o;t[3]===n?o=t[4]:(o=r(a.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,U.jsx)(`span`,{className:o,...i}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function oe(e){let n=(0,V.c)(38),{items:i,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,f=o===void 0?!1:o,p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(``),b=(0,H.useDeferredValue)(v),x;n[0]===s?x=n[1]:(x=function(){h.current||(h.current=!0,s())},n[0]=s,n[1]=x);let S=x,C;n[2]!==b||n[3]!==i?(C=ae(i,re(b),b),n[2]=b,n[3]=i,n[4]=C):C=n[4];let w=C,T,D;n[5]!==c||n[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},D=[c,v],n[5]=c,n[6]=v,n[7]=T,n[8]=D):(T=n[7],D=n[8]),(0,H.useEffect)(T,D);let k;n[9]===c?k=n[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},n[9]=c,n[10]=k);let A=k,j;n[11]!==c||n[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},n[11]=c,n[12]=u,n[13]=j):j=n[13];let M=j,N;n[14]===S?N=n[15]:(N=e=>{S(),y(e.target.value)},n[14]=S,n[15]=N);let P;n[16]!==v||n[17]!==S||n[18]!==N?(P=(0,U.jsx)(O,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(l,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=v,n[17]=S,n[18]=N,n[19]=P):P=n[19];let F;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=r(a.compact,`py-4`),n[20]=F):F=n[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;n[21]===I?L=n[22]:(L=(0,U.jsx)(q,{className:F,children:I}),n[21]=I,n[22]=L);let R;if(n[23]!==M||n[24]!==w){let e;n[26]===M?e=n[27]:(e=e=>(0,U.jsxs)(te,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:r(a.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=M,n[27]=e),R=w.map(e),n[23]=M,n[24]=w,n[25]=R}else R=n[25];let z;n[28]===R?z=n[29]:(z=(0,U.jsx)(J,{children:R}),n[28]=R,n[29]=z);let B;n[30]!==L||n[31]!==z?(B=(0,U.jsx)(E,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[L,z]})})}),n[30]=L,n[31]=z,n[32]=B):B=n[32];let G;return n[33]!==A||n[34]!==g||n[35]!==B||n[36]!==P?(G=(0,U.jsxs)(ee,{open:g,onOpenChange:A,children:[P,B]}),n[33]=A,n[34]=g,n[35]=B,n[36]=P,n[37]=G):G=n[37],G}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=ce(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>I(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:de}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(w,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,H.memo)(function e({node:r,level:a,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee}){let E=l.has(r.path),D=f===r.path,O=p?.dirPath===r.path&&E;return r.type===`folder`?(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(w,{level:a,basePadding:10,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(r)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,U.jsx)(o,{className:`h-3 w-3`}):(0,U.jsx)(n,{className:`h-3 w-3`})}),D?(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(v,{}),children:(0,U.jsx)(le,{threadId:s,dirPath:r.path,version:u(r.path),children:n=>(0,U.jsxs)(U.Fragment,{children:[O&&(0,U.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:ee}),n.map(t=>(0,U.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee},t.path))]})})})})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(w,{level:a,basePadding:22,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>h(r),children:[(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[o,s]=(0,H.useState)(new Set),[c,l]=(0,H.useState)(null),[u,f]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[w,ee]=(0,H.useState)(!1),[E,O]=(0,H.useState)([]),[A,B]=(0,H.useState)(!1),[V,W]=(0,H.useState)(!1),G=(0,H.useRef)(null),K=(0,H.useRef)(0),q=(0,H.useRef)(null),{explorerRefreshTick:J,pendingExplorerPath:Y,setExplorerClearPath:te}=T(),X=(0,H.useMemo)(()=>`${e}:${J}`,[J,e]),ne=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){O(t),B(!0);return}if(G.current!==X){G.current=X,O([]),B(!1);try{let t=fe((await I(e,``,!0)).entries);me.set(X,t),O(t),B(!0)}catch{O([]),B(!1)}finally{G.current===X&&(G.current=null)}}},[X,e]),re=(0,H.useCallback)(()=>{W(!0)},[]),ie=(0,H.useCallback)(()=>{me.delete(X),O([]),B(!1)},[X]),ae=(0,H.useCallback)(()=>{ie(),V&&Z()},[ie,Z,V]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),se=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,H.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);s(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=q.current!==null&&q.current!==e;q.current=e,t&&(a(new Map([[``,0]])),s(new Set),l(null),f(null),K.current=J)},[J,e]),(0,H.useEffect)(()=>{!e||J<=K.current||(K.current=J,a(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[J,o,e]),(0,H.useEffect)(()=>{O([]),B(!1),W(!1),G.current=null},[X]),(0,H.useEffect)(()=>{!V||!e||Z()},[Z,V,e]),(0,H.useEffect)(()=>{if(!Y||!e)return;let t=Y.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[Y,e]);function he(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await R(e,t.path)}catch{D({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await L(e,t.path),te(t.path),$(ge(t.path)),ae(),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{D({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),l(e.path)}async function xe(t,n){if(n===t.name){l(null);return}l(null);try{await P(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{D({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function Ce(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function we(t){if(!u)return;let{dirPath:n,type:r}=u;f(null);try{r===`file`?await z(e,n,t):await F(e,n,t),$(n),ae()}catch{D({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&r(e)}let De=u?.dirPath===``?(0,U.jsx)(ue,{defaultValue:``,level:0,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,U.jsxs)(y,{children:[(0,U.jsx)(m,{children:`Move to Trash`}),(0,U.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsx)(oe,{items:E,isReady:A,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,disabled:w,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[De,t.map(t=>(0,U.jsx)(pe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:o,getDirVersion:Q,renamingPath:c,newItemIn:u,onToggleFolder:he,onSelectNode:r,onStartRename:be,onCommitRename:xe,onCancelRename:()=>l(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},t.path))]})})})})})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>Se(``),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Do as t,Jo as n,Mi as r,To as i,Xi as a,Xo as o,ls as s,os as c,qr as l,ss as u,wo as d,za as f}from"./dialogs-config-BEazgV7k.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-BMVTxWTg.js";import{d as w}from"./onboarding-Bi5MieW-.js";import{A as T,D as ee,O as E,P as D,k as O}from"./index-r-MGLt04.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-PIC-g8wy.js";import{c as P,n as F,o as I,r as L,s as R,t as z}from"./api-Dhzdgb40.js";import{t as B}from"./ui-components-kSaUEA_X.js";var V=u(),H=e(s(),1),U=c(),W=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});W.displayName=B.displayName;var G=H.forwardRef((e,t)=>{let n=(0,V.c)(10),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(f,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===i?s=n[5]:(s=r(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=s);let c;return n[6]!==a||n[7]!==t||n[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,U.jsx)(B.Input,{ref:t,className:s,...a})]}),n[6]=a,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});G.displayName=B.Input.displayName;var K=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`max-h-[300px] overflow-y-auto overflow-x-hidden`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});K.displayName=B.List.displayName;var q=H.forwardRef((e,t)=>{let n=(0,V.c)(4),i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=r(a.bodyMuted,`py-6 text-center`),n[0]=i):i=n[0];let o;return n[1]!==e||n[2]!==t?(o=(0,U.jsx)(B.Empty,{ref:t,className:i,...e}),n[1]=e,n[2]=t,n[3]=o):o=n[3],o});q.displayName=B.Empty.displayName;var J=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`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`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=B.Group.displayName;var Y=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`-mx-1 h-px bg-border`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(B.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});Y.displayName=B.Separator.displayName;var te=H.forwardRef((e,t)=>{let n=(0,V.c)(9),i,o;n[0]===e?(i=n[1],o=n[2]):({className:i,...o}=e,n[0]=e,n[1]=i,n[2]=o);let s;n[3]===i?s=n[4]:(s=r(r(a.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),i),n[3]=i,n[4]=s);let c;return n[5]!==o||n[6]!==t||n[7]!==s?(c=(0,U.jsx)(B.Item,{ref:t,className:s,...o}),n[5]=o,n[6]=t,n[7]=s,n[8]=c):c=n[8],c});te.displayName=B.Item.displayName;var X=e=>{let t=(0,V.c)(8),n,i;t[0]===e?(n=t[1],i=t[2]):({className:n,...i}=e,t[0]=e,t[1]=n,t[2]=i);let o;t[3]===n?o=t[4]:(o=r(a.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,U.jsx)(`span`,{className:o,...i}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function oe(e){let n=(0,V.c)(38),{items:i,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,f=o===void 0?!1:o,p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(``),b=(0,H.useDeferredValue)(v),x;n[0]===s?x=n[1]:(x=function(){h.current||(h.current=!0,s())},n[0]=s,n[1]=x);let S=x,C;n[2]!==b||n[3]!==i?(C=ae(i,re(b),b),n[2]=b,n[3]=i,n[4]=C):C=n[4];let w=C,T,D;n[5]!==c||n[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},D=[c,v],n[5]=c,n[6]=v,n[7]=T,n[8]=D):(T=n[7],D=n[8]),(0,H.useEffect)(T,D);let k;n[9]===c?k=n[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},n[9]=c,n[10]=k);let A=k,j;n[11]!==c||n[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},n[11]=c,n[12]=u,n[13]=j):j=n[13];let M=j,N;n[14]===S?N=n[15]:(N=e=>{S(),y(e.target.value)},n[14]=S,n[15]=N);let P;n[16]!==v||n[17]!==S||n[18]!==N?(P=(0,U.jsx)(O,{asChild:!0,children:(0,U.jsx)(`div`,{children:(0,U.jsx)(l,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=v,n[17]=S,n[18]=N,n[19]=P):P=n[19];let F;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=r(a.compact,`py-4`),n[20]=F):F=n[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;n[21]===I?L=n[22]:(L=(0,U.jsx)(q,{className:F,children:I}),n[21]=I,n[22]=L);let R;if(n[23]!==M||n[24]!==w){let e;n[26]===M?e=n[27]:(e=e=>(0,U.jsxs)(te,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate`,children:e.name}),(0,U.jsx)(`div`,{className:r(a.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=M,n[27]=e),R=w.map(e),n[23]=M,n[24]=w,n[25]=R}else R=n[25];let z;n[28]===R?z=n[29]:(z=(0,U.jsx)(J,{children:R}),n[28]=R,n[29]=z);let B;n[30]!==L||n[31]!==z?(B=(0,U.jsx)(E,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,U.jsx)(W,{shouldFilter:!1,children:(0,U.jsxs)(K,{children:[L,z]})})}),n[30]=L,n[31]=z,n[32]=B):B=n[32];let G;return n[33]!==A||n[34]!==g||n[35]!==B||n[36]!==P?(G=(0,U.jsxs)(ee,{open:g,onOpenChange:A,children:[P,B]}),n[33]=A,n[34]=g,n[35]=B,n[36]=P,n[37]=G):G=n[37],G}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,V.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=ce(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>I(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,U.jsx)(U.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,V.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,H.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,H.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,U.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:de}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,U.jsxs)(w,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,H.memo)(function e({node:r,level:a,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee}){let E=l.has(r.path),D=f===r.path,O=p?.dirPath===r.path&&E;return r.type===`folder`?(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(w,{level:a,basePadding:10,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(r)},children:[(0,U.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,U.jsx)(o,{className:`h-3 w-3`}):(0,U.jsx)(n,{className:`h-3 w-3`})}),D?(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,U.jsxs)(U.Fragment,{children:[E?(0,U.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,U.jsx)(`div`,{children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(v,{}),children:(0,U.jsx)(le,{threadId:s,dirPath:r.path,version:u(r.path),children:n=>(0,U.jsxs)(U.Fragment,{children:[O&&(0,U.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:ee}),n.map(t=>(0,U.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:ee},t.path))]})})})})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,children:(0,U.jsxs)(w,{level:a,basePadding:22,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>h(r),children:[(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,U.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(r,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(r,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,U.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>x(r),children:`Open`}),(0,U.jsx)(A,{}),(0,U.jsx)(M,{onSelect:()=>g(r),children:`Rename...`}),(0,U.jsx)(M,{onSelect:()=>b(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:n,onNodeSelect:r}){let[i,a]=(0,H.useState)(()=>new Map([[``,0]])),[o,s]=(0,H.useState)(new Set),[c,l]=(0,H.useState)(null),[u,f]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[w,ee]=(0,H.useState)(!1),[E,O]=(0,H.useState)([]),[A,B]=(0,H.useState)(!1),[V,W]=(0,H.useState)(!1),G=(0,H.useRef)(null),K=(0,H.useRef)(0),q=(0,H.useRef)(null),{explorerRefreshTick:J,pendingExplorerPath:Y,setExplorerClearPath:te}=T(),X=(0,H.useMemo)(()=>`${e}:${J}`,[J,e]),ne=(0,H.useCallback)(e=>{(0,H.startTransition)(()=>{ee(t=>t===e?t:e)})},[]),Z=(0,H.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){O(t),B(!0);return}if(G.current!==X){G.current=X,O([]),B(!1);try{let t=fe((await I(e,``,!0)).entries);me.set(X,t),O(t),B(!0)}catch{O([]),B(!1)}finally{G.current===X&&(G.current=null)}}},[X,e]),re=(0,H.useCallback)(()=>{W(!0)},[]),ie=(0,H.useCallback)(()=>{me.delete(X),O([]),B(!1)},[X]),ae=(0,H.useCallback)(()=>{ie(),V&&Z()},[ie,Z,V]),Q=(0,H.useCallback)(e=>i.get(e)??0,[i]),se=(0,H.useCallback)(e=>{a(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,H.useCallback)(t=>{e&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,H.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);s(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,H.useEffect)(()=>{if(!e)return;let t=q.current!==null&&q.current!==e;q.current=e,t&&(a(new Map([[``,0]])),s(new Set),l(null),f(null),K.current=J)},[J,e]),(0,H.useEffect)(()=>{!e||J<=K.current||(K.current=J,a(t=>{let n=new Set([``]);for(let e of o)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[J,o,e]),(0,H.useEffect)(()=>{O([]),B(!1),W(!1),G.current=null},[X]),(0,H.useEffect)(()=>{!V||!e||Z()},[Z,V,e]),(0,H.useEffect)(()=>{if(!Y||!e)return;let t=Y.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){s(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[Y,e]);function he(e){o.has(e.path)?s(t=>{let n=new Set(t);return n.delete(e.path),n}):(s(t=>new Set(t).add(e.path)),a(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await R(e,t.path)}catch{D({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await L(e,t.path),te(t.path),$(ge(t.path)),ae(),s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{D({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),l(e.path)}async function xe(t,n){if(n===t.name){l(null);return}l(null);try{await P(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(s(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),a(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{D({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function Ce(e){l(null),o.has(e)||(s(t=>new Set(t).add(e)),a(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function we(t){if(!u)return;let{dirPath:n,type:r}=u;f(null);try{r===`file`?await z(e,n,t):await F(e,n,t),$(n),ae()}catch{D({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&r(e)}let De=u?.dirPath===``?(0,U.jsx)(ue,{defaultValue:``,level:0,basePadding:u.type===`folder`?10:22,icon:u.type===`folder`?(0,U.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}):(0,U.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,U.jsxs)(y,{children:[(0,U.jsx)(m,{children:`Move to Trash`}),(0,U.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,U.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,U.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,U.jsx)(oe,{items:E,isReady:A,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,U.jsxs)(N,{children:[(0,U.jsx)(k,{asChild:!0,disabled:w,children:(0,U.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,U.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(C,{}),children:(0,U.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,U.jsxs)(U.Fragment,{children:[De,t.map(t=>(0,U.jsx)(pe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:o,getDirVersion:Q,renamingPath:c,newItemIn:u,onToggleFolder:he,onSelectNode:r,onStartRename:be,onCommitRename:xe,onCancelRename:()=>l(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},t.path))]})})})})})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(M,{onSelect:()=>Se(``),children:`New File...`}),(0,U.jsx)(M,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Bo as n,Hi as r,Mi as i,Mo as a,Oo as o,Vi as s,Xi as c,Zo as l,at as ee,eo as u,ko as d,ls as f,os as p,qa as m,ss as h,uo as te}from"./dialogs-config-BEazgV7k.js";import{M as ne}from"./react-vendor-iDwBzcYF.js";import{I as g,a as _,l as v,n as y,o as b}from"./history-view-BMVTxWTg.js";import{n as x}from"./utils-CECQ_-6N.js";import{A as S,C,E as w,M as re,P as T,R as ie,S as ae,c as oe,x as se}from"./index-B4PyD4Io.js";import{a as E,i as D,l as O,o as k,s as A,t as ce}from"./api-Dhzdgb40.js";var j=h(),M=p(),N=e(f(),1),P=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:r=!1,onShowTree:a,onFileCreated:o}){let{resolvedTheme:f}=x(),p=ie(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=S(),g=(0,N.useRef)(null),_=(0,N.useRef)(null),E=(0,N.useRef)(!1),D=(0,N.useRef)(!0),[k,j]=(0,N.useState)(null),[I,W]=(0,N.useState)(!1),[K,q]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[J,fe]=(0,N.useState)(null),[Y,X]=(0,N.useState)(!1);(0,N.useEffect)(()=>{p&&ee(p).then(fe).catch(()=>{})},[p]);let pe=async()=>{if(!(!J||Y)){X(!0);try{await navigator.clipboard.writeText(J),T({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{T({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{X(!1)}}},me=async()=>{if(p)try{await A(p,`.`)}catch{T({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(p)try{let t=await R(p,e);await ce(p,``,t);let n={name:t,path:t,type:`file`};_.current=t,E.current=!0,o?.(n),h(),T({title:`Created`,description:`${t} created successfully.`})}catch{T({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[p,o,h]),Z=e?s(e.path,e.name):null,Q=e?.type===`file`&&p&&!Z?e:null,$=k?.content??``,ge=k?.original??``,_e=Q?`${p}:${Q.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,N.useEffect)(()=>{if(e?.type===`file`?_.current===e.path?(_.current=null,q(`edit`)):q(z(e.path)?`view`:`edit`):q(`edit`),D.current){D.current=!1;return}j(null)},[e?.path,p]);async function ve(){if(!(!p||!e)){W(!0);try{await O(p,e.path,$),j({content:$,original:$}),T({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{W(!1)}}}function ye(){!p||!Q||(b(V(p,Q.path)),j(null),de(e=>e+1))}return p?(0,M.jsx)(F,{v0:(0,M.jsxs)(oe,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[r&&a?(0,M.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,M.jsx)(u,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:i(c.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:i(c.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Q&&k?(0,M.jsxs)(M.Fragment,{children:[z(Q.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(t,{size:`sm`,variant:K===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`view`),children:`View`}),(0,M.jsx)(t,{size:`sm`,variant:K===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(t,{size:`sm`,onClick:()=>void ve(),disabled:I||!$||$===ge,children:[I?(0,M.jsx)(te,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(se,{children:[(0,M.jsx)(w,{asChild:!0,children:(0,M.jsxs)(t,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(m,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(ae,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(C,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Q?(0,M.jsxs)(y,{fallbackTitle:`Failed to load file`,onRetry:ye,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(H,{threadId:p,path:Q.path,onContentReady:j},_e??void 0)}),k?z(Q.path)&&K===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(re,{content:$,enableMermaid:!0})}):(0,M.jsx)(ne,{height:`100%`,language:B(Q.path),value:$,onChange:e=>j(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,E.current&&(E.current=!1,e.focus())},theme:f===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,M.jsx)(v,{})]}):e?.type===`file`&&Z===`image`?(0,M.jsx)(y,{fallbackTitle:`Failed to load image`,onRetry:()=>{!p||!e||b(U(p,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(G,{threadId:p,path:e.path,alt:e.name})})}):e?.type===`file`&&Z===`video`?(0,M.jsx)(y,{fallbackTitle:`Failed to load video`,onRetry:()=>{!p||!e||b(U(p,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(le,{threadId:p,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:i(c.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:i(c.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:J?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:i(c.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:J,children:J}),(0,M.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:Y,children:[Y?(0,M.jsx)(l,{className:`h-3.5 w-3.5`}):(0,M.jsx)(n,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:i(c.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(d,{className:`h-8 w-8 text-muted-foreground`}),v1:c.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:d},{label:`TypeScript`,ext:`ts`,icon:a},{label:`Text`,ext:`txt`,icon:o}];async function R(e,t){try{let n=await k(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function z(e){return r(e)===`md`}function B(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[r(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>E(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=_(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>D(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=_(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Bo as n,Hi as r,Mi as i,Mo as a,Oo as o,Vi as s,Xi as c,Zo as l,at as ee,eo as u,ko as d,ls as f,os as p,qa as m,ss as h,uo as te}from"./dialogs-config-BEazgV7k.js";import{M as ne}from"./react-vendor-iDwBzcYF.js";import{I as g,a as _,l as v,n as y,o as b}from"./history-view-BMVTxWTg.js";import{n as x}from"./utils-CECQ_-6N.js";import{A as S,C,E as w,M as re,P as T,R as ie,S as ae,c as oe,x as se}from"./index-r-MGLt04.js";import{a as E,i as D,l as O,o as k,s as A,t as ce}from"./api-Dhzdgb40.js";var j=h(),M=p(),N=e(f(),1),P=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:r=!1,onShowTree:a,onFileCreated:o}){let{resolvedTheme:f}=x(),p=ie(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=S(),g=(0,N.useRef)(null),_=(0,N.useRef)(null),E=(0,N.useRef)(!1),D=(0,N.useRef)(!0),[k,j]=(0,N.useState)(null),[I,W]=(0,N.useState)(!1),[K,q]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[J,fe]=(0,N.useState)(null),[Y,X]=(0,N.useState)(!1);(0,N.useEffect)(()=>{p&&ee(p).then(fe).catch(()=>{})},[p]);let pe=async()=>{if(!(!J||Y)){X(!0);try{await navigator.clipboard.writeText(J),T({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{T({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{X(!1)}}},me=async()=>{if(p)try{await A(p,`.`)}catch{T({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(p)try{let t=await R(p,e);await ce(p,``,t);let n={name:t,path:t,type:`file`};_.current=t,E.current=!0,o?.(n),h(),T({title:`Created`,description:`${t} created successfully.`})}catch{T({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[p,o,h]),Z=e?s(e.path,e.name):null,Q=e?.type===`file`&&p&&!Z?e:null,$=k?.content??``,ge=k?.original??``,_e=Q?`${p}:${Q.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,N.useEffect)(()=>{if(e?.type===`file`?_.current===e.path?(_.current=null,q(`edit`)):q(z(e.path)?`view`:`edit`):q(`edit`),D.current){D.current=!1;return}j(null)},[e?.path,p]);async function ve(){if(!(!p||!e)){W(!0);try{await O(p,e.path,$),j({content:$,original:$}),T({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{W(!1)}}}function ye(){!p||!Q||(b(V(p,Q.path)),j(null),de(e=>e+1))}return p?(0,M.jsx)(F,{v0:(0,M.jsxs)(oe,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[r&&a?(0,M.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,M.jsx)(u,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:i(c.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:i(c.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Q&&k?(0,M.jsxs)(M.Fragment,{children:[z(Q.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(t,{size:`sm`,variant:K===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`view`),children:`View`}),(0,M.jsx)(t,{size:`sm`,variant:K===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>q(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(t,{size:`sm`,onClick:()=>void ve(),disabled:I||!$||$===ge,children:[I?(0,M.jsx)(te,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(se,{children:[(0,M.jsx)(w,{asChild:!0,children:(0,M.jsxs)(t,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(m,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(ae,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(C,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Q?(0,M.jsxs)(y,{fallbackTitle:`Failed to load file`,onRetry:ye,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(H,{threadId:p,path:Q.path,onContentReady:j},_e??void 0)}),k?z(Q.path)&&K===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(re,{content:$,enableMermaid:!0})}):(0,M.jsx)(ne,{height:`100%`,language:B(Q.path),value:$,onChange:e=>j(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,E.current&&(E.current=!1,e.focus())},theme:f===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,M.jsx)(v,{})]}):e?.type===`file`&&Z===`image`?(0,M.jsx)(y,{fallbackTitle:`Failed to load image`,onRetry:()=>{!p||!e||b(U(p,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(G,{threadId:p,path:e.path,alt:e.name})})}):e?.type===`file`&&Z===`video`?(0,M.jsx)(y,{fallbackTitle:`Failed to load video`,onRetry:()=>{!p||!e||b(U(p,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(le,{threadId:p,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:i(c.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:i(c.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:J?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:i(c.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:J,children:J}),(0,M.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:Y,children:[Y?(0,M.jsx)(l,{className:`h-3.5 w-3.5`}):(0,M.jsx)(n,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:i(c.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(d,{className:`h-8 w-8 text-muted-foreground`}),v1:c.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:d},{label:`TypeScript`,ext:`ts`,icon:a},{label:`Text`,ext:`txt`,icon:o}];async function R(e,t){try{let n=await k(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function z(e){return r(e)===`md`}function B(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[r(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>E(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=_(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>D(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=_(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-CgHm8yd5.js","assets/index-r-MGLt04.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-C7FLshNp.css","assets/pull-request-dialog-DUFq4dcj.js","assets/create-repo-dialog-BlvNaVRv.js","assets/git-history-dialog-qUZ7Qsp4.js","assets/push-before-pr-dialog-BQ0QC6Qu.js","assets/pull-with-changes-dialog-oGP-j8Yw.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,C as n,Ca as r,Et as i,Fo as a,Fr as o,Ga as ee,Gt as te,Hn as s,Ht as ne,Io as re,Ir as ie,Jt as ae,Mi as oe,Nr as c,Pr as l,So as u,Wt as se,Xi as d,Xo as f,Y as p,Zt as m,bo as h,ct as ce,dt as le,ho as ue,in as g,is as _,ls as v,ns as de,oa as fe,os as y,q as b,qt as pe,ss as x,tn as me,uo as S,va as he,yo as ge}from"./dialogs-config-BEazgV7k.js";import{r as C}from"./monaco-CZnIWXyV.js";import{B as w,C as T,E as _e,L as ve,P as E,R as ye,S as be,T as xe,g as Se,h as Ce,v as we,w as Te,x as Ee}from"./index-r-MGLt04.js";var D=e(v(),1),O=y();function k(e){return!e.hasChanges&&e.defaultBranchBehind>0}function De(e,t){return t?`Creating PR...`:k(e)?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function Oe(e,t,n=!1){return t||n?(0,O.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}):k(e)?(0,O.jsx)(_,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,O.jsx)(u,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,O.jsx)(a,{className:`h-3.5 w-3.5`}):(0,O.jsx)(h,{className:`h-3.5 w-3.5`})}function ke(e){if(k(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function Ae(e,t,n=!1){return t||n?!0:k(e)||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function je(e){return e.hasChanges||k(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Me=x();function Ne(e){let n=(0,Me.c)(103),{branchStatus:i,remoteUrl:te,hasRemoteBranch:s,hasUnpushedCommits:ne,canCreateRepo:ae,repoUrl:u,isRefreshing:se,isBrandState:p,hasChanges:m,defaultBranch:ce,defaultBranchAhead:le,defaultBranchBehind:g,gitUser:v,isDirectCommitMode:fe,autoGenerateCommitMessage:y,isLoading:b,isLoadingHistory:pe,isQuickCommitting:x,onFetch:me,onPull:C,onPush:w,onOpenHistory:ve,onCreatePR:E,onCreateRepo:ye,onViewInGitHub:Se,onQuickCommit:Ce,onSyncWithDefault:we,onOpenChange:D,layout:k}=e,De=k===void 0?`bar`:k,Oe=!!ce&&!!te&&g>0,ke=!m&&!b,Ae=De===`bar`&&`w-8 rounded-l-none`,je=De===`menu`&&`w-full justify-start gap-2 rounded-md`,Ne=p&&De===`bar`&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,A;n[0]!==Ae||n[1]!==je||n[2]!==Ne?(A=oe(`h-8 px-1`,Ae,je,Ne),n[0]=Ae,n[1]=je,n[2]=Ne,n[3]=A):A=n[3];let j;n[4]===se?j=n[5]:(j=se?(0,O.jsx)(S,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(f,{className:`h-3.5 w-3.5`}),n[4]=se,n[5]=j);let Pe;n[6]===De?Pe=n[7]:(Pe=De===`menu`&&(0,O.jsx)(`span`,{children:`More git actions`}),n[6]=De,n[7]=Pe);let Fe;n[8]!==b||n[9]!==A||n[10]!==j||n[11]!==Pe?(Fe=(0,O.jsx)(_e,{asChild:!0,children:(0,O.jsxs)(t,{variant:`outline`,size:`sm`,className:A,disabled:b,children:[j,Pe]})}),n[8]=b,n[9]=A,n[10]=j,n[11]=Pe,n[12]=Fe):Fe=n[12];let Ie;n[13]!==i||n[14]!==te?(Ie=i===`Behind`&&(0,O.jsxs)(`div`,{className:oe(d.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,te?`origin`:`remote`]}),n[13]=i,n[14]=te,n[15]=Ie):Ie=n[15];let Le;n[16]===v?Le=n[17]:(Le=v&&(0,O.jsxs)(`div`,{className:oe(d.compact,`px-2 py-1 text-muted-foreground`),children:[(0,O.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,v]}),n[16]=v,n[17]=Le);let Re;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,O.jsx)(Te,{}),n[18]=Re):Re=n[18];let ze;n[19]!==ke||n[20]!==ce||n[21]!==le||n[22]!==g||n[23]!==m||n[24]!==we||n[25]!==Oe?(ze=Oe&&(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:()=>{ke&&we()},className:ke?``:`opacity-50 cursor-not-allowed`,children:[(0,O.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,ce,(0,O.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[le>0&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,O.jsx)(de,{className:`h-3 w-3`}),le]}),g>0&&(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,O.jsx)(_,{className:`h-3 w-3`}),g]})]})]})}),(0,O.jsx)(l,{side:`right`,children:m?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${ce} onto your current branch`})]})}),n[19]=ke,n[20]=ce,n[21]=le,n[22]=g,n[23]=m,n[24]=we,n[25]=Oe,n[26]=ze):ze=n[26];let M;n[27]!==y||n[28]!==m||n[29]!==b||n[30]!==x||n[31]!==Ce?(M=m&&y&&(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:Ce,disabled:b||x,children:[x?(0,O.jsx)(S,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,O.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,O.jsx)(xe,{children:`⌘⇧C`})]})}),(0,O.jsx)(l,{side:`right`,children:`Generate the commit message and commit`})]})}),n[27]=y,n[28]=m,n[29]=b,n[30]=x,n[31]=Ce,n[32]=M):M=n[32];let N;n[33]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,O.jsx)(re,{className:`h-3.5 w-3.5 mr-2`}),n[33]=N):N=n[33];let P;n[34]!==b||n[35]!==me?(P=(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:me,disabled:b,children:[N,`Fetch`]})}),n[34]=b,n[35]=me,n[36]=P):P=n[36];let Be;n[37]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,O.jsx)(l,{side:`right`,children:`Download latest information from remote without merging changes`}),n[37]=Be):Be=n[37];let F;n[38]===P?F=n[39]:(F=(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[P,Be]})}),n[38]=P,n[39]=F);let I;n[40]!==s||n[41]!==b||n[42]!==C?(I=()=>{s&&!b&&C()},n[40]=s,n[41]=b,n[42]=C,n[43]=I):I=n[43];let Ve=!s||b?`opacity-50 cursor-not-allowed`:``,He;n[44]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,O.jsx)(_,{className:`h-3.5 w-3.5 mr-2`}),n[44]=He):He=n[44];let L;n[45]!==I||n[46]!==Ve?(L=(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:I,className:Ve,children:[He,`Pull`]})}),n[45]=I,n[46]=Ve,n[47]=L):L=n[47];let Ue=s?`Pull latest changes from remote`:`No remote branch to pull from`,R;n[48]===Ue?R=n[49]:(R=(0,O.jsx)(l,{side:`right`,children:Ue}),n[48]=Ue,n[49]=R);let z;n[50]!==L||n[51]!==R?(z=(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[L,R]})}),n[50]=L,n[51]=R,n[52]=z):z=n[52];let B;n[53]!==s||n[54]!==b||n[55]!==w?(B=!s&&(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:w,disabled:b,children:[(0,O.jsx)(r,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,O.jsx)(l,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[53]=s,n[54]=b,n[55]=w,n[56]=B):B=n[56];let V;n[57]!==ne||n[58]!==b||n[59]!==w?(V=()=>{ne&&!b&&w()},n[57]=ne,n[58]=b,n[59]=w,n[60]=V):V=n[60];let We=!ne||b?`opacity-50 cursor-not-allowed`:``,Ge;n[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,O.jsx)(r,{className:`h-3.5 w-3.5 mr-2`}),n[61]=Ge):Ge=n[61];let H;n[62]!==V||n[63]!==We?(H=(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(T,{onClick:V,className:We,children:[Ge,`Push Commits`]})}),n[62]=V,n[63]=We,n[64]=H):H=n[64];let Ke=ne?b?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,U;n[65]===Ke?U=n[66]:(U=(0,O.jsx)(l,{side:`right`,children:Ke}),n[65]=Ke,n[66]=U);let W;n[67]!==H||n[68]!==U?(W=(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[H,U]})}),n[67]=H,n[68]=U,n[69]=W):W=n[69];let qe=b||pe,G;n[70]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,O.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[70]=G):G=n[70];let Je;n[71]!==ve||n[72]!==qe?(Je=(0,O.jsxs)(T,{onClick:ve,disabled:qe,children:[G,`History`]}),n[71]=ve,n[72]=qe,n[73]=Je):Je=n[73];let K;n[74]!==fe||n[75]!==b||n[76]!==E?(K=!fe&&(0,O.jsxs)(T,{onClick:E,disabled:b,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,O.jsx)(xe,{children:`⌘⇧P`})]}),n[74]=fe,n[75]=b,n[76]=E,n[77]=K):K=n[77];let q;n[78]!==ae||n[79]!==b||n[80]!==ye?(q=ae&&(0,O.jsxs)(T,{onClick:ye,disabled:b,children:[(0,O.jsx)(ge,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[78]=ae,n[79]=b,n[80]=ye,n[81]=q):q=n[81];let J;n[82]!==b||n[83]!==Se||n[84]!==u?(J=u&&(0,O.jsxs)(T,{onClick:Se,disabled:b,children:[(0,O.jsx)(a,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[82]=b,n[83]=Se,n[84]=u,n[85]=J):J=n[85];let Y;n[86]!==Le||n[87]!==ze||n[88]!==M||n[89]!==F||n[90]!==z||n[91]!==B||n[92]!==W||n[93]!==Je||n[94]!==K||n[95]!==q||n[96]!==J||n[97]!==Ie?(Y=(0,O.jsxs)(be,{align:`end`,children:[Ie,Le,Re,ze,M,F,z,B,W,Je,K,q,J]}),n[86]=Le,n[87]=ze,n[88]=M,n[89]=F,n[90]=z,n[91]=B,n[92]=W,n[93]=Je,n[94]=K,n[95]=q,n[96]=J,n[97]=Ie,n[98]=Y):Y=n[98];let X;return n[99]!==D||n[100]!==Y||n[101]!==Fe?(X=(0,O.jsxs)(Ee,{onOpenChange:D,children:[Fe,Y]}),n[99]=D,n[100]=Y,n[101]=Fe,n[102]=X):X=n[102],X}function A(e){return e?!0:(E({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function j(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function Pe(e,t,n){let[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(!1),ee=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:j(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,D.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=ee();return await b(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),E({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,D.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=ee();return await p(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),E({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var Fe=(0,D.lazy)(()=>C(()=>import(`./commit-dialog-CgHm8yd5.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Ie=(0,D.lazy)(()=>C(()=>import(`./pull-request-dialog-DUFq4dcj.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Le=(0,D.lazy)(()=>C(()=>import(`./create-repo-dialog-BlvNaVRv.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Re=(0,D.lazy)(()=>C(()=>import(`./git-history-dialog-qUZ7Qsp4.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),ze=(0,D.lazy)(()=>C(()=>import(`./push-before-pr-dialog-BQ0QC6Qu.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),M=(0,D.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-oGP-j8Yw.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6])));function N(){return null}async function P(e,t,n,r){r&&(await s(e,{title:r}),n({type:w.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function Be({projectId:e,threadId:r,layout:a=`bar`}){let ee=ve(),s=ye(e=>e.projectModelSelections[r]),re=ye(t=>t.projects.find(t=>t.projectId===e)),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)(!1),[h,ue]=(0,D.useState)(!1),[_,v]=(0,D.useState)(!1),[de,y]=(0,D.useState)(``),[b,x]=(0,D.useState)(``),[S,he]=(0,D.useState)(``),[ge,C]=(0,D.useState)(!1),[T,_e]=(0,D.useState)(null),be=(0,D.useRef)(!1),xe=(0,D.useRef)(!1),Te=(0,D.useRef)(b),Ee=(0,D.useRef)(S);Te.current=b,Ee.current=S;let[k,Me]=(0,D.useState)(!1),[j,Be]=(0,D.useState)([]),[F,I]=(0,D.useState)(!1),[Ve,He]=(0,D.useState)([]),[L,Ue]=(0,D.useState)(!1),[R,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(``),[We,Ge]=(0,D.useState)(``),[H,Ke]=(0,D.useState)(``),[U,W]=(0,D.useState)(!1),[qe,G]=(0,D.useState)(!1),[Je,K]=(0,D.useState)(!1),q=(0,D.useRef)(!1),J=we(),{fetchUnifiedStatus:Y}=J,X=Pe(r,e,s),Z=(0,D.useRef)(null),Ye=(0,D.useRef)(()=>{}),Xe=(0,D.useRef)(()=>{});(0,D.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){me();let e=await i();ee({type:w.SetProjects,projects:e.projects})}let[$,Ze]=(0,D.useState)(()=>Ce()),Qe=re?.commitMethod===fe.Direct;(0,D.useEffect)(()=>{R&&re?.name&&!B&&V(re.name)},[R,re?.name,B]),(0,D.useEffect)(()=>{Se($)},[$]);function $e(){U||(W(!0),le().then(e=>Ke(e)).catch(()=>{}))}(0,D.useEffect)(()=>{if(!h){xe.current=!1;return}if(h&&$.autoGenerateCommitMessage&&!de.trim()&&r&&!xe.current){xe.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&y(e)}e()}},[h,$.autoGenerateCommitMessage,r,X.generateCommitMessageWithAI,de]),(0,D.useEffect)(()=>{if(!_){be.current=!1;return}if(_&&$.autoGeneratePRInfo&&!Te.current.trim()&&!Ee.current.trim()&&r&&!be.current){be.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(x(e.title),he(e.description),E({title:`Success`,description:`PR title and description generated`}))}e()}},[_,$.autoGeneratePRInfo,r,X.generatePRInfoWithAI]),Ye.current=rt,Xe.current=()=>v(!0),(0,D.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){J.hasChanges&&$.autoGenerateCommitMessage&&!u&&(e.preventDefault(),Ye.current());return}t===`p`&&J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges&&!u&&!Qe&&(e.preventDefault(),Xe.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[J.commitsAheadOfDefault,J.hasChanges,J.prExists,$.autoGenerateCommitMessage,u,Qe]),(0,D.useEffect)(()=>{f&&J.prExists&&J.prState===`OPEN`&&p(!1)},[J.prExists,J.prState,f]),(0,D.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[f]),(0,D.useEffect)(()=>{let e=J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits;e&&!q.current&&Q(),q.current=e},[J.hasChanges,J.hasUnpushedCommits,J.prExists,J.prState]);async function et(){if(de.trim()&&A(r))try{d(!0),await ne(r,de),y(``),ue(!1),await J.fetchUnifiedStatus(!0),Q(),E({title:`Changes committed successfully`,description:`Your changes have been committed to '${J.currentBranch}'.`}),Je&&(K(!1),await st())}catch(e){console.error(`Failed to commit:`,e),E({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{d(!1)}}async function tt(){if(J.hasChanges){ue(!0);return}if(J.defaultBranchBehind>0){await ut();return}if(J.prExists&&J.prState===`OPEN`&&!J.hasChanges&&!J.hasUnpushedCommits){J.prUrl&&await g(J.prUrl);return}if(J.commitsAheadOfDefault&&!J.prExists&&!J.hasChanges){v(!0);return}if(J.hasUnpushedCommits&&J.prExists){await at();return}}async function nt(){let e=await X.generateCommitMessageWithAI();e&&y(e)}async function rt(){if(A(r))try{d(!0);let e=await X.generateCommitMessageWithAI();if(!e){E({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await ne(r,e),await J.fetchUnifiedStatus(!0),Q(),E({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){console.error(`Quick commit failed:`,e),E({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{d(!1)}}async function it(){if(A(r))try{d(!0),await te(r),await J.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{d(!1)}}async function at(){if(A(r))try{d(!0),await ae(r),await J.fetchUnifiedStatus(!0),Q(),J.hasRemoteBranch?E({title:`Branch pushed successfully`,description:`Your branch '${J.currentBranch}' has been pushed to the remote.`}):E({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),E({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{d(!1)}}async function ot(){if(A(r)){if(J.hasChanges){G(!0);return}await st()}}async function st(){try{d(!0),await pe(r),await J.fetchUnifiedStatus(!0),Q(),E({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),E({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{d(!1)}}function ct(){G(!1),K(!0),ue(!0)}async function lt(){G(!1),await st()}async function ut(){if(A(r))try{d(!0),await m(r),await J.fetchUnifiedStatus(!0),Q(),E({title:`Branch synced successfully`,description:`Your branch '${J.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),E({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{d(!1)}}async function dt(){if(A(r))try{d(!0),p(!0);let t=await se(r,b,S);await P(r,e,ee,t.title??b),t.prUrl&&await g(t.prUrl),x(``),he(``),v(!1),await J.fetchUnifiedStatus(!0),Q();let n=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(n++,n>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(v(!1),mt({title:b,description:S})):(p(!1),E({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{d(!1)}}async function ft(){if(A(r))try{d(!0);let e=await n(r,B,We,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{g(e.repoUrl)},3e3),V(``),Ge(``),z(!1),await J.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{d(!1)}}async function pt(){let e=await X.generatePRInfoWithAI();e&&(x(e.title),he(e.description),E({title:`Success`,description:`PR title and description generated`}))}async function mt(t){let n=t??T;if(!(!r||!n))try{d(!0),p(!0);try{await ae(r)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){E({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await m(r),await ae(r)}catch{throw e}}else throw e}let t=await se(r,n.title,n.description);await P(r,e,ee,t.title??n.title),t.prUrl&&await g(t.prUrl),x(``),he(``),_e(null),C(!1),await J.fetchUnifiedStatus(!0),Q();let i=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(i++,i>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await J.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;p(!1),E({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{d(!1)}}async function ht(){if(A(r))try{I(!0);let e=await ce(r,100);Be(e),He(e.slice(0,10)),Me(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{I(!1)}}function gt(){L||(Ue(!0),setTimeout(()=>{let e=Ve.length+10;He(j.slice(0,e)),Ue(!1)},300))}function _t(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&Ve.length<j.length&&!L&&gt()}let vt=je(J);function yt(){J.repoUrl&&g(J.repoUrl)}function bt(){C(!1),_e(null)}return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:oe(`flex items-center gap-0`,a===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,O.jsx)(o,{children:(0,O.jsxs)(c,{children:[(0,O.jsx)(ie,{asChild:!0,children:(0,O.jsxs)(t,{variant:`outline`,size:`sm`,className:oe(`h-8 gap-1.5`,a===`bar`&&`rounded-r-none border-r-0`,a===`menu`&&`rounded-md border`,vt&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:Ae(J,u,f),onClick:tt,children:[Oe(J,f,u),De(J,f)]})}),(0,O.jsx)(l,{children:ke(J)})]})}),(0,O.jsx)(Ne,{branchStatus:J.status,remoteUrl:J.remoteUrl,hasRemoteBranch:J.hasRemoteBranch,hasUnpushedCommits:J.hasUnpushedCommits,canCreateRepo:J.canCreateRepo,repoUrl:J.repoUrl,isRefreshing:J.isRefreshing,isBrandState:vt,hasChanges:J.hasChanges,defaultBranch:J.defaultBranch??null,defaultBranchAhead:J.defaultBranchAhead,defaultBranchBehind:J.defaultBranchBehind,gitUser:H,isDirectCommitMode:Qe,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:u||f,isLoadingHistory:F,isQuickCommitting:X.isGeneratingMessage&&u,onFetch:()=>void it(),onPull:()=>void ot(),onPush:()=>void at(),onOpenHistory:()=>void ht(),onCreatePR:()=>v(!0),onCreateRepo:()=>z(!0),onViewInGitHub:yt,onQuickCommit:()=>void rt(),onSyncWithDefault:()=>void ut(),onOpenChange:e=>{e&&($e(),Y(!0))},layout:a})]}),h&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(Fe,{open:h,onOpenChange:ue,commitMessage:de,onCommitMessageChange:y,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Ze(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:u,onGenerateMessage:nt,onCommit:et,currentBranch:J.currentBranch})}),_&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(Ie,{open:_,onOpenChange:v,prTitle:b,onPrTitleChange:x,prDescription:S,onPrDescriptionChange:he,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:u,onGeneratePRInfo:pt,onCreatePR:dt,currentBranch:J.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Ze(t=>({...t,autoGeneratePRInfo:e}))})}),ge&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(ze,{open:ge,onOpenChange:C,isLoading:u,onPushAndCreatePR:mt,onCancel:bt})}),R&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(Le,{open:R,onOpenChange:z,repoName:B,onRepoNameChange:V,repoDescription:We,onRepoDescriptionChange:Ge,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Ze(t=>({...t,privateRepositoryDefault:e})),isLoading:u,onCreateRepo:ft})}),k&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(Re,{open:k,onOpenChange:Me,commits:j,displayedCommits:Ve,isLoadingMore:L,onScroll:_t,currentBranch:J.currentBranch})}),qe&&(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(N,{}),children:(0,O.jsx)(M,{open:qe,onOpenChange:G,onCommitFirst:ct,onStashAndPull:lt,onCancel:()=>G(!1),isLoading:u})})]})}export{Be as GitOpsButton};